From c066d1f06577a2b9436b6cd96d629ecd33015cdc Mon Sep 17 00:00:00 2001 From: Kristen Date: Sun, 11 Mar 2018 23:11:02 -0700 Subject: [PATCH] Initial commit --- TODO.txt | 2 + app.js | 56 + bin/www | 90 + node_modules/.bin/acorn | 1 + node_modules/.bin/atob | 1 + node_modules/.bin/babylon | 1 + node_modules/.bin/cleancss | 1 + node_modules/.bin/mime | 1 + node_modules/.bin/nodemon | 1 + node_modules/.bin/nodetouch | 1 + node_modules/.bin/nopt | 1 + node_modules/.bin/rc | 1 + node_modules/.bin/semver | 1 + node_modules/.bin/uglifyjs | 1 + node_modules/.bin/which | 1 + node_modules/@types/babel-types/LICENSE | 21 + node_modules/@types/babel-types/README.md | 16 + node_modules/@types/babel-types/index.d.ts | 1992 ++ node_modules/@types/babel-types/package.json | 60 + node_modules/@types/babylon/LICENSE | 21 + node_modules/@types/babylon/README.md | 16 + node_modules/@types/babylon/index.d.ts | 58 + node_modules/@types/babylon/package.json | 54 + node_modules/abbrev/LICENSE | 46 + node_modules/abbrev/README.md | 23 + node_modules/abbrev/abbrev.js | 61 + node_modules/abbrev/package.json | 56 + node_modules/accepts/HISTORY.md | 224 + node_modules/accepts/LICENSE | 23 + node_modules/accepts/README.md | 143 + node_modules/accepts/index.js | 238 + node_modules/accepts/package.json | 85 + node_modules/acorn-globals/LICENSE | 19 + node_modules/acorn-globals/README.md | 76 + node_modules/acorn-globals/index.js | 163 + .../acorn-globals/node_modules/.bin/acorn | 1 + .../node_modules/acorn/.npmignore | 10 + .../acorn-globals/node_modules/acorn/AUTHORS | 62 + .../node_modules/acorn/CHANGELOG.md | 286 + .../acorn-globals/node_modules/acorn/LICENSE | 19 + .../node_modules/acorn/README.md | 409 + .../node_modules/acorn/bin/acorn | 67 + .../node_modules/acorn/dist/.keep | 0 .../node_modules/acorn/dist/acorn.es.js | 3401 +++ .../node_modules/acorn/dist/acorn.js | 3433 +++ .../node_modules/acorn/dist/acorn_loose.es.js | 1364 ++ .../node_modules/acorn/dist/acorn_loose.js | 1374 ++ .../node_modules/acorn/dist/walk.es.js | 342 + .../node_modules/acorn/dist/walk.js | 360 + .../node_modules/acorn/package.json | 259 + .../node_modules/acorn/src/bin/acorn.js | 60 + .../node_modules/acorn/src/expression.js | 819 + .../node_modules/acorn/src/identifier.js | 81 + .../node_modules/acorn/src/index.js | 77 + .../node_modules/acorn/src/location.js | 26 + .../node_modules/acorn/src/locutil.js | 42 + .../acorn/src/loose/expression.js | 562 + .../node_modules/acorn/src/loose/index.js | 48 + .../node_modules/acorn/src/loose/parseutil.js | 1 + .../node_modules/acorn/src/loose/state.js | 161 + .../node_modules/acorn/src/loose/statement.js | 450 + .../node_modules/acorn/src/loose/tokenize.js | 108 + .../node_modules/acorn/src/lval.js | 219 + .../node_modules/acorn/src/node.js | 50 + .../node_modules/acorn/src/options.js | 128 + .../node_modules/acorn/src/parseutil.js | 128 + .../node_modules/acorn/src/state.js | 111 + .../node_modules/acorn/src/statement.js | 744 + .../node_modules/acorn/src/tokencontext.js | 110 + .../node_modules/acorn/src/tokenize.js | 686 + .../node_modules/acorn/src/tokentype.js | 147 + .../node_modules/acorn/src/util.js | 9 + .../node_modules/acorn/src/walk/index.js | 342 + .../node_modules/acorn/src/whitespace.js | 13 + node_modules/acorn-globals/package.json | 65 + node_modules/acorn/.editorconfig | 7 + node_modules/acorn/.gitattributes | 1 + node_modules/acorn/.npmignore | 3 + node_modules/acorn/.tern-project | 6 + node_modules/acorn/.travis.yml | 7 + node_modules/acorn/AUTHORS | 59 + node_modules/acorn/CHANGELOG.md | 159 + node_modules/acorn/LICENSE | 19 + node_modules/acorn/README.md | 407 + node_modules/acorn/bin/acorn | 65 + .../acorn/bin/generate-identifier-regex.js | 55 + node_modules/acorn/bin/update_authors.sh | 6 + node_modules/acorn/dist/.keep | 0 node_modules/acorn/dist/acorn.es.js | 3112 +++ node_modules/acorn/dist/acorn.js | 3142 +++ node_modules/acorn/dist/acorn_loose.es.js | 1261 + node_modules/acorn/dist/acorn_loose.js | 1273 + node_modules/acorn/dist/walk.es.js | 342 + node_modules/acorn/dist/walk.js | 360 + node_modules/acorn/package.json | 250 + node_modules/acorn/rollup/config.bin.js | 15 + node_modules/acorn/rollup/config.loose.js | 20 + node_modules/acorn/rollup/config.main.js | 11 + node_modules/acorn/rollup/config.walk.js | 11 + node_modules/acorn/src/bin/acorn.js | 58 + node_modules/acorn/src/expression.js | 701 + node_modules/acorn/src/identifier.js | 82 + node_modules/acorn/src/index.js | 67 + node_modules/acorn/src/location.js | 26 + node_modules/acorn/src/locutil.js | 42 + node_modules/acorn/src/loose/expression.js | 514 + node_modules/acorn/src/loose/index.js | 50 + node_modules/acorn/src/loose/parseutil.js | 1 + node_modules/acorn/src/loose/state.js | 160 + node_modules/acorn/src/loose/statement.js | 425 + node_modules/acorn/src/loose/tokenize.js | 108 + node_modules/acorn/src/lval.js | 216 + node_modules/acorn/src/node.js | 50 + node_modules/acorn/src/options.js | 121 + node_modules/acorn/src/parseutil.js | 109 + node_modules/acorn/src/state.js | 104 + node_modules/acorn/src/statement.js | 654 + node_modules/acorn/src/tokencontext.js | 110 + node_modules/acorn/src/tokenize.js | 696 + node_modules/acorn/src/tokentype.js | 147 + node_modules/acorn/src/util.js | 9 + node_modules/acorn/src/walk/index.js | 342 + node_modules/acorn/src/whitespace.js | 13 + node_modules/align-text/LICENSE | 21 + node_modules/align-text/README.md | 236 + node_modules/align-text/index.js | 52 + node_modules/align-text/package.json | 78 + node_modules/amdefine/LICENSE | 58 + node_modules/amdefine/README.md | 171 + node_modules/amdefine/amdefine.js | 301 + node_modules/amdefine/intercept.js | 36 + node_modules/amdefine/package.json | 48 + node_modules/ansi-align/CHANGELOG.md | 36 + node_modules/ansi-align/LICENSE | 13 + node_modules/ansi-align/README.md | 79 + node_modules/ansi-align/index.js | 61 + node_modules/ansi-align/package.json | 70 + node_modules/ansi-regex/index.js | 10 + node_modules/ansi-regex/license | 9 + node_modules/ansi-regex/package.json | 85 + node_modules/ansi-regex/readme.md | 46 + node_modules/ansi-styles/index.js | 165 + node_modules/ansi-styles/license | 9 + node_modules/ansi-styles/package.json | 88 + node_modules/ansi-styles/readme.md | 147 + node_modules/anymatch/LICENSE | 15 + node_modules/anymatch/README.md | 99 + node_modules/anymatch/index.js | 67 + node_modules/anymatch/package.json | 72 + node_modules/arr-diff/LICENSE | 21 + node_modules/arr-diff/README.md | 130 + node_modules/arr-diff/index.js | 47 + node_modules/arr-diff/package.json | 109 + node_modules/arr-flatten/LICENSE | 21 + node_modules/arr-flatten/README.md | 86 + node_modules/arr-flatten/index.js | 22 + node_modules/arr-flatten/package.json | 113 + node_modules/arr-union/LICENSE | 21 + node_modules/arr-union/README.md | 99 + node_modules/arr-union/index.js | 29 + node_modules/arr-union/package.json | 108 + node_modules/array-flatten/LICENSE | 21 + node_modules/array-flatten/README.md | 43 + node_modules/array-flatten/array-flatten.js | 64 + node_modules/array-flatten/package.json | 64 + node_modules/array-unique/LICENSE | 21 + node_modules/array-unique/README.md | 77 + node_modules/array-unique/index.js | 43 + node_modules/array-unique/package.json | 96 + node_modules/asap/CHANGES.md | 70 + node_modules/asap/LICENSE.md | 21 + node_modules/asap/README.md | 237 + node_modules/asap/asap.js | 65 + node_modules/asap/browser-asap.js | 66 + node_modules/asap/browser-raw.js | 223 + node_modules/asap/package.json | 87 + node_modules/asap/raw.js | 101 + node_modules/assign-symbols/LICENSE | 21 + node_modules/assign-symbols/README.md | 73 + node_modules/assign-symbols/index.js | 40 + node_modules/assign-symbols/package.json | 71 + node_modules/async-each/.npmignore | 3 + node_modules/async-each/CHANGELOG.md | 23 + node_modules/async-each/README.md | 38 + node_modules/async-each/index.js | 38 + node_modules/async-each/package.json | 60 + node_modules/async/CHANGELOG.md | 223 + node_modules/async/LICENSE | 19 + node_modules/async/README.md | 12 + node_modules/async/apply.js | 62 + node_modules/async/applyEach.js | 51 + node_modules/async/applyEachSeries.js | 37 + node_modules/async/asyncify.js | 93 + node_modules/async/auto.js | 285 + node_modules/async/autoInject.js | 163 + node_modules/async/bower.json | 17 + node_modules/async/cargo.js | 95 + node_modules/async/compose.js | 55 + node_modules/async/concat.js | 45 + node_modules/async/concatSeries.js | 37 + node_modules/async/constant.js | 65 + node_modules/async/detect.js | 61 + node_modules/async/detectLimit.js | 48 + node_modules/async/detectSeries.js | 46 + node_modules/async/dir.js | 42 + node_modules/async/dist/async.js | 5289 +++++ node_modules/async/dist/async.min.js | 2 + node_modules/async/doDuring.js | 60 + node_modules/async/doUntil.js | 39 + node_modules/async/doWhilst.js | 54 + node_modules/async/during.js | 71 + node_modules/async/each.js | 80 + node_modules/async/eachLimit.js | 42 + node_modules/async/eachOf.js | 105 + node_modules/async/eachOfLimit.js | 39 + node_modules/async/eachOfSeries.js | 37 + node_modules/async/eachSeries.js | 38 + node_modules/async/ensureAsync.js | 69 + node_modules/async/every.js | 50 + node_modules/async/everyLimit.js | 42 + node_modules/async/everySeries.js | 37 + node_modules/async/filter.js | 45 + node_modules/async/filterLimit.js | 37 + node_modules/async/filterSeries.js | 35 + node_modules/async/forever.js | 61 + node_modules/async/index.js | 505 + .../async/internal/DoublyLinkedList.js | 63 + node_modules/async/internal/applyEach.js | 33 + node_modules/async/internal/breakLoop.js | 9 + node_modules/async/internal/concat.js | 18 + node_modules/async/internal/consoleFunc.js | 35 + node_modules/async/internal/createTester.js | 50 + node_modules/async/internal/doLimit.js | 12 + node_modules/async/internal/doParallel.js | 19 + .../async/internal/doParallelLimit.js | 19 + node_modules/async/internal/doSeries.js | 19 + node_modules/async/internal/eachOfLimit.js | 71 + node_modules/async/internal/filter.js | 71 + node_modules/async/internal/findGetResult.js | 10 + node_modules/async/internal/getIterator.js | 13 + node_modules/async/internal/initialParams.js | 20 + node_modules/async/internal/iterator.js | 58 + node_modules/async/internal/map.js | 30 + node_modules/async/internal/notId.js | 10 + node_modules/async/internal/once.js | 15 + node_modules/async/internal/onlyOnce.js | 15 + node_modules/async/internal/parallel.js | 38 + node_modules/async/internal/queue.js | 184 + node_modules/async/internal/reject.js | 21 + node_modules/async/internal/rest.js | 23 + node_modules/async/internal/setImmediate.js | 41 + node_modules/async/internal/withoutIndex.js | 12 + node_modules/async/log.js | 41 + node_modules/async/map.js | 54 + node_modules/async/mapLimit.js | 37 + node_modules/async/mapSeries.js | 36 + node_modules/async/mapValues.js | 63 + node_modules/async/mapValuesLimit.js | 56 + node_modules/async/mapValuesSeries.js | 37 + node_modules/async/memoize.js | 95 + node_modules/async/nextTick.js | 51 + node_modules/async/package.json | 109 + node_modules/async/parallel.js | 87 + node_modules/async/parallelLimit.js | 41 + node_modules/async/priorityQueue.js | 99 + node_modules/async/queue.js | 120 + node_modules/async/race.js | 67 + node_modules/async/reduce.js | 73 + node_modules/async/reduceRight.js | 42 + node_modules/async/reflect.js | 80 + node_modules/async/reflectAll.js | 104 + node_modules/async/reject.js | 44 + node_modules/async/rejectLimit.js | 36 + node_modules/async/rejectSeries.js | 34 + node_modules/async/retry.js | 152 + node_modules/async/retryable.js | 56 + node_modules/async/seq.js | 79 + node_modules/async/series.js | 85 + node_modules/async/setImmediate.js | 45 + node_modules/async/some.js | 52 + node_modules/async/someLimit.js | 43 + node_modules/async/someSeries.js | 38 + node_modules/async/sortBy.js | 85 + node_modules/async/timeout.js | 85 + node_modules/async/times.js | 50 + node_modules/async/timesLimit.js | 37 + node_modules/async/timesSeries.js | 32 + node_modules/async/transform.js | 85 + node_modules/async/unmemoize.js | 25 + node_modules/async/until.js | 42 + node_modules/async/waterfall.js | 114 + node_modules/async/whilst.js | 67 + node_modules/atob/LICENSE | 230 + node_modules/atob/LICENSE.DOCS | 319 + node_modules/atob/README.md | 43 + node_modules/atob/bin/atob.js | 6 + node_modules/atob/bower.json | 25 + node_modules/atob/browser-atob.js | 36 + node_modules/atob/node-atob.js | 7 + node_modules/atob/package.json | 53 + node_modules/atob/test.js | 20 + node_modules/babel-runtime/.npmignore | 2 + node_modules/babel-runtime/README.md | 2 + node_modules/babel-runtime/core-js.js | 4 + .../babel-runtime/core-js/array/concat.js | 1 + .../core-js/array/copy-within.js | 1 + .../babel-runtime/core-js/array/entries.js | 1 + .../babel-runtime/core-js/array/every.js | 1 + .../babel-runtime/core-js/array/fill.js | 1 + .../babel-runtime/core-js/array/filter.js | 1 + .../babel-runtime/core-js/array/find-index.js | 1 + .../babel-runtime/core-js/array/find.js | 1 + .../babel-runtime/core-js/array/for-each.js | 1 + .../babel-runtime/core-js/array/from.js | 1 + .../babel-runtime/core-js/array/includes.js | 1 + .../babel-runtime/core-js/array/index-of.js | 1 + .../babel-runtime/core-js/array/join.js | 1 + .../babel-runtime/core-js/array/keys.js | 1 + .../core-js/array/last-index-of.js | 1 + .../babel-runtime/core-js/array/map.js | 1 + .../babel-runtime/core-js/array/of.js | 1 + .../babel-runtime/core-js/array/pop.js | 1 + .../babel-runtime/core-js/array/push.js | 1 + .../core-js/array/reduce-right.js | 1 + .../babel-runtime/core-js/array/reduce.js | 1 + .../babel-runtime/core-js/array/reverse.js | 1 + .../babel-runtime/core-js/array/shift.js | 1 + .../babel-runtime/core-js/array/slice.js | 1 + .../babel-runtime/core-js/array/some.js | 1 + .../babel-runtime/core-js/array/sort.js | 1 + .../babel-runtime/core-js/array/splice.js | 1 + .../babel-runtime/core-js/array/unshift.js | 1 + .../babel-runtime/core-js/array/values.js | 1 + node_modules/babel-runtime/core-js/asap.js | 1 + .../babel-runtime/core-js/clear-immediate.js | 1 + .../babel-runtime/core-js/error/is-error.js | 1 + .../babel-runtime/core-js/get-iterator.js | 1 + .../babel-runtime/core-js/is-iterable.js | 1 + .../babel-runtime/core-js/json/stringify.js | 1 + node_modules/babel-runtime/core-js/map.js | 1 + .../babel-runtime/core-js/math/acosh.js | 1 + .../babel-runtime/core-js/math/asinh.js | 1 + .../babel-runtime/core-js/math/atanh.js | 1 + .../babel-runtime/core-js/math/cbrt.js | 1 + .../babel-runtime/core-js/math/clz32.js | 1 + .../babel-runtime/core-js/math/cosh.js | 1 + .../babel-runtime/core-js/math/expm1.js | 1 + .../babel-runtime/core-js/math/fround.js | 1 + .../babel-runtime/core-js/math/hypot.js | 1 + .../babel-runtime/core-js/math/iaddh.js | 1 + .../babel-runtime/core-js/math/imul.js | 1 + .../babel-runtime/core-js/math/imulh.js | 1 + .../babel-runtime/core-js/math/isubh.js | 1 + .../babel-runtime/core-js/math/log10.js | 1 + .../babel-runtime/core-js/math/log1p.js | 1 + .../babel-runtime/core-js/math/log2.js | 1 + .../babel-runtime/core-js/math/sign.js | 1 + .../babel-runtime/core-js/math/sinh.js | 1 + .../babel-runtime/core-js/math/tanh.js | 1 + .../babel-runtime/core-js/math/trunc.js | 1 + .../babel-runtime/core-js/math/umulh.js | 1 + .../babel-runtime/core-js/number/epsilon.js | 1 + .../babel-runtime/core-js/number/is-finite.js | 1 + .../core-js/number/is-integer.js | 1 + .../babel-runtime/core-js/number/is-nan.js | 1 + .../core-js/number/is-safe-integer.js | 1 + .../core-js/number/max-safe-integer.js | 1 + .../core-js/number/min-safe-integer.js | 1 + .../core-js/number/parse-float.js | 1 + .../babel-runtime/core-js/number/parse-int.js | 1 + .../babel-runtime/core-js/object/assign.js | 1 + .../babel-runtime/core-js/object/create.js | 1 + .../core-js/object/define-properties.js | 1 + .../core-js/object/define-property.js | 1 + .../babel-runtime/core-js/object/entries.js | 1 + .../babel-runtime/core-js/object/freeze.js | 1 + .../object/get-own-property-descriptor.js | 1 + .../object/get-own-property-descriptors.js | 1 + .../core-js/object/get-own-property-names.js | 1 + .../object/get-own-property-symbols.js | 1 + .../core-js/object/get-prototype-of.js | 1 + .../core-js/object/is-extensible.js | 1 + .../babel-runtime/core-js/object/is-frozen.js | 1 + .../babel-runtime/core-js/object/is-sealed.js | 1 + .../babel-runtime/core-js/object/is.js | 1 + .../babel-runtime/core-js/object/keys.js | 1 + .../core-js/object/prevent-extensions.js | 1 + .../babel-runtime/core-js/object/seal.js | 1 + .../core-js/object/set-prototype-of.js | 1 + .../babel-runtime/core-js/object/values.js | 1 + .../babel-runtime/core-js/observable.js | 1 + node_modules/babel-runtime/core-js/promise.js | 1 + .../babel-runtime/core-js/reflect/apply.js | 1 + .../core-js/reflect/construct.js | 1 + .../core-js/reflect/define-metadata.js | 1 + .../core-js/reflect/define-property.js | 1 + .../core-js/reflect/delete-metadata.js | 1 + .../core-js/reflect/delete-property.js | 1 + .../core-js/reflect/enumerate.js | 1 + .../core-js/reflect/get-metadata-keys.js | 1 + .../core-js/reflect/get-metadata.js | 1 + .../core-js/reflect/get-own-metadata-keys.js | 1 + .../core-js/reflect/get-own-metadata.js | 1 + .../reflect/get-own-property-descriptor.js | 1 + .../core-js/reflect/get-prototype-of.js | 1 + .../babel-runtime/core-js/reflect/get.js | 1 + .../core-js/reflect/has-metadata.js | 1 + .../core-js/reflect/has-own-metadata.js | 1 + .../babel-runtime/core-js/reflect/has.js | 1 + .../core-js/reflect/is-extensible.js | 1 + .../babel-runtime/core-js/reflect/metadata.js | 1 + .../babel-runtime/core-js/reflect/own-keys.js | 1 + .../core-js/reflect/prevent-extensions.js | 1 + .../core-js/reflect/set-prototype-of.js | 1 + .../babel-runtime/core-js/reflect/set.js | 1 + .../babel-runtime/core-js/regexp/escape.js | 1 + .../babel-runtime/core-js/set-immediate.js | 1 + node_modules/babel-runtime/core-js/set.js | 1 + .../babel-runtime/core-js/string/at.js | 1 + .../core-js/string/code-point-at.js | 1 + .../babel-runtime/core-js/string/ends-with.js | 1 + .../core-js/string/from-code-point.js | 1 + .../babel-runtime/core-js/string/includes.js | 1 + .../babel-runtime/core-js/string/match-all.js | 1 + .../babel-runtime/core-js/string/pad-end.js | 1 + .../babel-runtime/core-js/string/pad-left.js | 1 + .../babel-runtime/core-js/string/pad-right.js | 1 + .../babel-runtime/core-js/string/pad-start.js | 1 + .../babel-runtime/core-js/string/raw.js | 1 + .../babel-runtime/core-js/string/repeat.js | 1 + .../core-js/string/starts-with.js | 1 + .../babel-runtime/core-js/string/trim-end.js | 1 + .../babel-runtime/core-js/string/trim-left.js | 1 + .../core-js/string/trim-right.js | 1 + .../core-js/string/trim-start.js | 1 + .../babel-runtime/core-js/string/trim.js | 1 + node_modules/babel-runtime/core-js/symbol.js | 1 + .../core-js/symbol/async-iterator.js | 1 + .../babel-runtime/core-js/symbol/for.js | 1 + .../core-js/symbol/has-instance.js | 1 + .../core-js/symbol/is-concat-spreadable.js | 1 + .../babel-runtime/core-js/symbol/iterator.js | 1 + .../babel-runtime/core-js/symbol/key-for.js | 1 + .../babel-runtime/core-js/symbol/match.js | 1 + .../core-js/symbol/observable.js | 1 + .../babel-runtime/core-js/symbol/replace.js | 1 + .../babel-runtime/core-js/symbol/search.js | 1 + .../babel-runtime/core-js/symbol/species.js | 1 + .../babel-runtime/core-js/symbol/split.js | 1 + .../core-js/symbol/to-primitive.js | 1 + .../core-js/symbol/to-string-tag.js | 1 + .../core-js/symbol/unscopables.js | 1 + .../babel-runtime/core-js/system/global.js | 1 + .../babel-runtime/core-js/weak-map.js | 1 + .../babel-runtime/core-js/weak-set.js | 1 + .../helpers/_async-generator-delegate.js | 1 + .../babel-runtime/helpers/_async-generator.js | 1 + .../babel-runtime/helpers/_async-iterator.js | 1 + .../helpers/_async-to-generator.js | 1 + .../helpers/_class-call-check.js | 1 + .../babel-runtime/helpers/_create-class.js | 1 + .../babel-runtime/helpers/_defaults.js | 1 + .../helpers/_define-enumerable-properties.js | 1 + .../babel-runtime/helpers/_define-property.js | 1 + .../babel-runtime/helpers/_extends.js | 1 + node_modules/babel-runtime/helpers/_get.js | 1 + .../babel-runtime/helpers/_inherits.js | 1 + .../babel-runtime/helpers/_instanceof.js | 1 + .../helpers/_interop-require-default.js | 1 + .../helpers/_interop-require-wildcard.js | 1 + node_modules/babel-runtime/helpers/_jsx.js | 1 + .../babel-runtime/helpers/_new-arrow-check.js | 1 + .../helpers/_object-destructuring-empty.js | 1 + .../helpers/_object-without-properties.js | 1 + .../helpers/_possible-constructor-return.js | 1 + .../babel-runtime/helpers/_self-global.js | 1 + node_modules/babel-runtime/helpers/_set.js | 1 + .../helpers/_sliced-to-array-loose.js | 1 + .../babel-runtime/helpers/_sliced-to-array.js | 1 + .../helpers/_tagged-template-literal-loose.js | 1 + .../helpers/_tagged-template-literal.js | 1 + .../babel-runtime/helpers/_temporal-ref.js | 1 + .../helpers/_temporal-undefined.js | 1 + .../babel-runtime/helpers/_to-array.js | 1 + .../helpers/_to-consumable-array.js | 1 + node_modules/babel-runtime/helpers/_typeof.js | 1 + .../helpers/async-generator-delegate.js | 1 + .../babel-runtime/helpers/async-generator.js | 1 + .../babel-runtime/helpers/async-iterator.js | 1 + .../helpers/async-to-generator.js | 1 + .../babel-runtime/helpers/asyncGenerator.js | 126 + .../helpers/asyncGeneratorDelegate.js | 69 + .../babel-runtime/helpers/asyncIterator.js | 32 + .../babel-runtime/helpers/asyncToGenerator.js | 38 + .../babel-runtime/helpers/class-call-check.js | 1 + .../babel-runtime/helpers/classCallCheck.js | 9 + .../babel-runtime/helpers/create-class.js | 1 + .../babel-runtime/helpers/createClass.js | 27 + .../babel-runtime/helpers/defaults.js | 32 + .../helpers/define-enumerable-properties.js | 1 + .../babel-runtime/helpers/define-property.js | 1 + .../helpers/defineEnumerableProperties.js | 20 + .../babel-runtime/helpers/defineProperty.js | 24 + node_modules/babel-runtime/helpers/extends.js | 23 + node_modules/babel-runtime/helpers/get.js | 38 + .../babel-runtime/helpers/inherits.js | 33 + .../babel-runtime/helpers/instanceof.js | 21 + .../helpers/interop-require-default.js | 1 + .../helpers/interop-require-wildcard.js | 1 + .../helpers/interopRequireDefault.js | 9 + .../helpers/interopRequireWildcard.js | 20 + node_modules/babel-runtime/helpers/jsx.js | 56 + .../babel-runtime/helpers/new-arrow-check.js | 1 + .../babel-runtime/helpers/newArrowCheck.js | 9 + .../helpers/object-destructuring-empty.js | 1 + .../helpers/object-without-properties.js | 1 + .../helpers/objectDestructuringEmpty.js | 7 + .../helpers/objectWithoutProperties.js | 15 + .../helpers/possible-constructor-return.js | 1 + .../helpers/possibleConstructorReturn.js | 17 + .../babel-runtime/helpers/self-global.js | 1 + .../babel-runtime/helpers/selfGlobal.js | 4 + node_modules/babel-runtime/helpers/set.js | 35 + .../helpers/sliced-to-array-loose.js | 1 + .../babel-runtime/helpers/sliced-to-array.js | 1 + .../babel-runtime/helpers/slicedToArray.js | 51 + .../helpers/slicedToArrayLoose.js | 31 + .../helpers/tagged-template-literal-loose.js | 1 + .../helpers/tagged-template-literal.js | 1 + .../helpers/taggedTemplateLiteral.js | 21 + .../helpers/taggedTemplateLiteralLoose.js | 8 + .../babel-runtime/helpers/temporal-ref.js | 1 + .../helpers/temporal-undefined.js | 1 + .../babel-runtime/helpers/temporalRef.js | 11 + .../helpers/temporalUndefined.js | 4 + .../babel-runtime/helpers/to-array.js | 1 + .../helpers/to-consumable-array.js | 1 + node_modules/babel-runtime/helpers/toArray.js | 13 + .../helpers/toConsumableArray.js | 21 + node_modules/babel-runtime/helpers/typeof.js | 21 + node_modules/babel-runtime/package-lock.json | 232 + node_modules/babel-runtime/package.json | 47 + .../babel-runtime/regenerator/index.js | 1 + node_modules/babel-types/.npmignore | 3 + node_modules/babel-types/README.md | 2029 ++ node_modules/babel-types/lib/constants.js | 38 + node_modules/babel-types/lib/converters.js | 350 + .../babel-types/lib/definitions/core.js | 701 + .../babel-types/lib/definitions/es2015.js | 354 + .../lib/definitions/experimental.js | 103 + .../babel-types/lib/definitions/flow.js | 285 + .../babel-types/lib/definitions/index.js | 249 + .../babel-types/lib/definitions/init.js | 15 + .../babel-types/lib/definitions/jsx.js | 147 + .../babel-types/lib/definitions/misc.js | 21 + node_modules/babel-types/lib/flow.js | 108 + node_modules/babel-types/lib/index.js | 835 + node_modules/babel-types/lib/react.js | 80 + node_modules/babel-types/lib/retrievers.js | 116 + node_modules/babel-types/lib/validators.js | 265 + node_modules/babel-types/package-lock.json | 29 + node_modules/babel-types/package.json | 51 + node_modules/babylon/CHANGELOG.md | 979 + node_modules/babylon/LICENSE | 19 + node_modules/babylon/README.md | 134 + node_modules/babylon/bin/babylon.js | 16 + .../babylon/bin/generate-identifier-regex.js | 62 + node_modules/babylon/lib/index.js | 7318 ++++++ node_modules/babylon/package.json | 118 + node_modules/balanced-match/.npmignore | 5 + node_modules/balanced-match/LICENSE.md | 21 + node_modules/balanced-match/README.md | 91 + node_modules/balanced-match/index.js | 59 + node_modules/balanced-match/package.json | 77 + node_modules/base/LICENSE | 21 + node_modules/base/README.md | 491 + node_modules/base/index.js | 435 + .../base/node_modules/define-property/LICENSE | 21 + .../node_modules/define-property/README.md | 95 + .../node_modules/define-property/index.js | 31 + .../node_modules/define-property/package.json | 93 + node_modules/base/package.json | 164 + node_modules/basic-auth/HISTORY.md | 47 + node_modules/basic-auth/LICENSE | 24 + node_modules/basic-auth/README.md | 99 + node_modules/basic-auth/index.js | 133 + node_modules/basic-auth/package.json | 73 + .../binary-extensions/binary-extensions.json | 246 + node_modules/binary-extensions/license | 9 + node_modules/binary-extensions/package.json | 68 + node_modules/binary-extensions/readme.md | 33 + node_modules/bluebird/LICENSE | 21 + node_modules/bluebird/README.md | 51 + node_modules/bluebird/changelog.md | 1 + .../bluebird/js/browser/bluebird.core.js | 3777 +++ .../bluebird/js/browser/bluebird.core.min.js | 31 + node_modules/bluebird/js/browser/bluebird.js | 5619 +++++ .../bluebird/js/browser/bluebird.min.js | 31 + node_modules/bluebird/js/release/any.js | 21 + node_modules/bluebird/js/release/assert.js | 55 + node_modules/bluebird/js/release/async.js | 161 + node_modules/bluebird/js/release/bind.js | 67 + node_modules/bluebird/js/release/bluebird.js | 11 + node_modules/bluebird/js/release/call_get.js | 123 + node_modules/bluebird/js/release/cancel.js | 129 + .../bluebird/js/release/catch_filter.js | 42 + node_modules/bluebird/js/release/context.js | 69 + .../bluebird/js/release/debuggability.js | 916 + .../bluebird/js/release/direct_resolve.js | 46 + node_modules/bluebird/js/release/each.js | 30 + node_modules/bluebird/js/release/errors.js | 116 + node_modules/bluebird/js/release/es5.js | 80 + node_modules/bluebird/js/release/filter.js | 12 + node_modules/bluebird/js/release/finally.js | 146 + .../bluebird/js/release/generators.js | 223 + node_modules/bluebird/js/release/join.js | 168 + node_modules/bluebird/js/release/map.js | 168 + node_modules/bluebird/js/release/method.js | 55 + node_modules/bluebird/js/release/nodeback.js | 51 + node_modules/bluebird/js/release/nodeify.js | 58 + node_modules/bluebird/js/release/promise.js | 775 + .../bluebird/js/release/promise_array.js | 185 + node_modules/bluebird/js/release/promisify.js | 314 + node_modules/bluebird/js/release/props.js | 118 + node_modules/bluebird/js/release/queue.js | 73 + node_modules/bluebird/js/release/race.js | 49 + node_modules/bluebird/js/release/reduce.js | 172 + node_modules/bluebird/js/release/schedule.js | 61 + node_modules/bluebird/js/release/settle.js | 43 + node_modules/bluebird/js/release/some.js | 148 + .../js/release/synchronous_inspection.js | 103 + node_modules/bluebird/js/release/thenables.js | 86 + node_modules/bluebird/js/release/timers.js | 93 + node_modules/bluebird/js/release/using.js | 226 + node_modules/bluebird/js/release/util.js | 379 + node_modules/bluebird/package.json | 101 + node_modules/body-parser/HISTORY.md | 568 + node_modules/body-parser/LICENSE | 23 + node_modules/body-parser/README.md | 438 + node_modules/body-parser/index.js | 157 + node_modules/body-parser/lib/read.js | 181 + node_modules/body-parser/lib/types/json.js | 232 + node_modules/body-parser/lib/types/raw.js | 101 + node_modules/body-parser/lib/types/text.js | 121 + .../body-parser/lib/types/urlencoded.js | 284 + node_modules/body-parser/package.json | 91 + node_modules/boxen/index.js | 138 + node_modules/boxen/license | 9 + .../boxen/node_modules/camelcase/index.js | 64 + .../boxen/node_modules/camelcase/license | 21 + .../boxen/node_modules/camelcase/package.json | 74 + .../boxen/node_modules/camelcase/readme.md | 57 + node_modules/boxen/package.json | 79 + node_modules/boxen/readme.md | 175 + node_modules/brace-expansion/LICENSE | 21 + node_modules/brace-expansion/README.md | 129 + node_modules/brace-expansion/index.js | 201 + node_modules/brace-expansion/package.json | 75 + node_modules/braces/LICENSE | 21 + node_modules/braces/README.md | 640 + node_modules/braces/index.js | 315 + node_modules/braces/lib/braces.js | 106 + node_modules/braces/lib/compilers.js | 282 + node_modules/braces/lib/parsers-new.js | 439 + node_modules/braces/lib/parsers-orig.js | 360 + node_modules/braces/lib/parsers-parens.js | 493 + node_modules/braces/lib/parsers.js | 360 + node_modules/braces/lib/utils.js | 335 + .../node_modules/define-property/LICENSE | 21 + .../node_modules/define-property/README.md | 95 + .../node_modules/define-property/index.js | 31 + .../node_modules/define-property/package.json | 93 + .../node_modules/extend-shallow/LICENSE | 21 + .../node_modules/extend-shallow/README.md | 61 + .../node_modules/extend-shallow/index.js | 33 + .../node_modules/extend-shallow/package.json | 87 + .../braces/node_modules/kind-of/CHANGELOG.md | 157 + .../braces/node_modules/kind-of/LICENSE | 21 + .../braces/node_modules/kind-of/README.md | 365 + .../braces/node_modules/kind-of/index.js | 129 + .../braces/node_modules/kind-of/package.json | 143 + node_modules/braces/package.json | 160 + node_modules/bson/HISTORY.md | 210 + node_modules/bson/LICENSE.md | 201 + node_modules/bson/README.md | 150 + node_modules/bson/bower.json | 25 + node_modules/bson/browser_build/bson.js | 19407 ++++++++++++++++ node_modules/bson/browser_build/package.json | 8 + node_modules/bson/index.js | 46 + node_modules/bson/lib/bson/binary.js | 372 + node_modules/bson/lib/bson/bson.js | 377 + node_modules/bson/lib/bson/code.js | 24 + node_modules/bson/lib/bson/db_ref.js | 32 + node_modules/bson/lib/bson/decimal128.js | 818 + node_modules/bson/lib/bson/double.js | 33 + node_modules/bson/lib/bson/float_parser.js | 124 + node_modules/bson/lib/bson/int_32.js | 33 + node_modules/bson/lib/bson/long.js | 851 + node_modules/bson/lib/bson/map.js | 128 + node_modules/bson/lib/bson/max_key.js | 14 + node_modules/bson/lib/bson/min_key.js | 14 + node_modules/bson/lib/bson/objectid.js | 381 + .../bson/lib/bson/parser/calculate_size.js | 253 + .../bson/lib/bson/parser/deserializer.js | 780 + .../bson/lib/bson/parser/serializer.js | 1179 + node_modules/bson/lib/bson/regexp.js | 33 + node_modules/bson/lib/bson/symbol.js | 47 + node_modules/bson/lib/bson/timestamp.js | 854 + node_modules/bson/package.json | 88 + node_modules/bytes/History.md | 82 + node_modules/bytes/LICENSE | 23 + node_modules/bytes/Readme.md | 125 + node_modules/bytes/index.js | 159 + node_modules/bytes/package.json | 82 + node_modules/cache-base/LICENSE | 21 + node_modules/cache-base/README.md | 291 + node_modules/cache-base/index.js | 261 + node_modules/cache-base/package.json | 118 + node_modules/camelcase/index.js | 27 + node_modules/camelcase/license | 21 + node_modules/camelcase/package.json | 70 + node_modules/camelcase/readme.md | 56 + node_modules/capture-stack-trace/index.js | 18 + node_modules/capture-stack-trace/package.json | 61 + node_modules/capture-stack-trace/readme.md | 36 + node_modules/center-align/LICENSE | 21 + node_modules/center-align/README.md | 74 + node_modules/center-align/index.js | 16 + node_modules/center-align/package.json | 82 + node_modules/center-align/utils.js | 40 + node_modules/chalk/index.js | 228 + node_modules/chalk/license | 9 + node_modules/chalk/package.json | 99 + node_modules/chalk/readme.md | 309 + node_modules/chalk/templates.js | 128 + node_modules/chalk/types/index.d.ts | 97 + node_modules/character-parser/.npmignore | 2 + node_modules/character-parser/LICENSE | 19 + node_modules/character-parser/README.md | 177 + node_modules/character-parser/index.js | 296 + node_modules/character-parser/package.json | 64 + node_modules/chokidar/CHANGELOG.md | 290 + node_modules/chokidar/README.md | 293 + node_modules/chokidar/index.js | 738 + node_modules/chokidar/lib/fsevents-handler.js | 399 + node_modules/chokidar/lib/nodefs-handler.js | 481 + node_modules/chokidar/package.json | 88 + node_modules/class-utils/LICENSE | 21 + node_modules/class-utils/README.md | 300 + node_modules/class-utils/index.js | 370 + .../node_modules/define-property/LICENSE | 21 + .../node_modules/define-property/README.md | 77 + .../node_modules/define-property/index.js | 31 + .../node_modules/define-property/package.json | 82 + .../is-accessor-descriptor/LICENSE | 21 + .../is-accessor-descriptor/README.md | 123 + .../is-accessor-descriptor/index.js | 69 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 261 + .../node_modules/kind-of/index.js | 116 + .../node_modules/kind-of/package.json | 139 + .../is-accessor-descriptor/package.json | 94 + .../node_modules/is-data-descriptor/LICENSE | 21 + .../node_modules/is-data-descriptor/README.md | 128 + .../node_modules/is-data-descriptor/index.js | 55 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 261 + .../node_modules/kind-of/index.js | 116 + .../node_modules/kind-of/package.json | 139 + .../is-data-descriptor/package.json | 93 + .../node_modules/is-descriptor/LICENSE | 21 + .../node_modules/is-descriptor/README.md | 193 + .../node_modules/is-descriptor/index.js | 22 + .../node_modules/is-descriptor/package.json | 114 + .../class-utils/node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 342 + .../class-utils/node_modules/kind-of/index.js | 147 + .../node_modules/kind-of/package.json | 146 + node_modules/class-utils/package.json | 131 + node_modules/clean-css/History.md | 1138 + node_modules/clean-css/LICENSE | 19 + node_modules/clean-css/README.md | 369 + node_modules/clean-css/bin/cleancss | 184 + node_modules/clean-css/index.js | 1 + node_modules/clean-css/lib/clean.js | 231 + .../lib/colors/hex-name-shortener.js | 186 + node_modules/clean-css/lib/colors/hsl.js | 67 + node_modules/clean-css/lib/colors/rgb.js | 16 + node_modules/clean-css/lib/imports/inliner.js | 399 + .../clean-css/lib/properties/break-up.js | 335 + .../clean-css/lib/properties/can-override.js | 142 + .../clean-css/lib/properties/clone.js | 26 + .../clean-css/lib/properties/compactable.js | 285 + .../lib/properties/every-combination.js | 28 + .../clean-css/lib/properties/has-inherit.js | 10 + .../lib/properties/invalid-property-error.js | 10 + .../clean-css/lib/properties/optimizer.js | 215 + .../lib/properties/override-compactor.js | 384 + .../lib/properties/populate-components.js | 32 + .../clean-css/lib/properties/remove-unused.js | 10 + .../lib/properties/restore-from-optimizing.js | 60 + .../clean-css/lib/properties/restore.js | 232 + .../lib/properties/shorthand-compactor.js | 134 + .../clean-css/lib/properties/validator.js | 197 + .../lib/properties/vendor-prefixes.js | 26 + .../lib/properties/wrap-for-optimizing.js | 118 + .../clean-css/lib/selectors/advanced.js | 86 + .../clean-css/lib/selectors/clean-up.js | 89 + .../clean-css/lib/selectors/extractor.js | 69 + .../clean-css/lib/selectors/is-special.js | 5 + .../clean-css/lib/selectors/merge-adjacent.js | 35 + .../lib/selectors/merge-media-queries.js | 64 + .../selectors/merge-non-adjacent-by-body.js | 61 + .../merge-non-adjacent-by-selector.js | 76 + .../lib/selectors/reduce-non-adjacent.js | 172 + .../remove-duplicate-media-queries.js | 21 + .../lib/selectors/remove-duplicates.js | 41 + .../clean-css/lib/selectors/reorderable.js | 99 + .../clean-css/lib/selectors/restructure.js | 369 + .../clean-css/lib/selectors/simple.js | 454 + .../clean-css/lib/source-maps/track.js | 119 + .../clean-css/lib/stringifier/helpers.js | 167 + .../clean-css/lib/stringifier/one-time.js | 50 + .../clean-css/lib/stringifier/simple.js | 22 + .../clean-css/lib/stringifier/source-maps.js | 96 + .../clean-css/lib/text/comments-processor.js | 131 + .../clean-css/lib/text/escape-store.js | 53 + .../lib/text/expressions-processor.js | 117 + .../clean-css/lib/text/free-text-processor.js | 98 + .../clean-css/lib/text/urls-processor.js | 75 + .../lib/tokenizer/extract-properties.js | 193 + .../lib/tokenizer/extract-selectors.js | 17 + .../clean-css/lib/tokenizer/tokenize.js | 297 + node_modules/clean-css/lib/urls/rebase.js | 30 + node_modules/clean-css/lib/urls/reduce.js | 154 + node_modules/clean-css/lib/urls/rewrite.js | 107 + .../clean-css/lib/utils/clone-array.js | 12 + .../clean-css/lib/utils/compatibility.js | 162 + .../lib/utils/input-source-map-tracker.js | 284 + node_modules/clean-css/lib/utils/object.js | 11 + .../clean-css/lib/utils/quote-scanner.js | 119 + .../clean-css/lib/utils/source-reader.js | 96 + .../clean-css/lib/utils/source-tracker.js | 31 + node_modules/clean-css/lib/utils/split.js | 62 + node_modules/clean-css/package.json | 82 + node_modules/cli-boxes/boxes.json | 50 + node_modules/cli-boxes/index.js | 2 + node_modules/cli-boxes/license | 21 + node_modules/cli-boxes/package.json | 71 + node_modules/cli-boxes/readme.md | 94 + node_modules/cliui/.coveralls.yml | 1 + node_modules/cliui/.npmignore | 2 + node_modules/cliui/.travis.yml | 7 + node_modules/cliui/LICENSE.txt | 14 + node_modules/cliui/README.md | 104 + node_modules/cliui/index.js | 273 + node_modules/cliui/package.json | 91 + node_modules/cliui/test/cliui.js | 349 + node_modules/collection-visit/LICENSE | 21 + node_modules/collection-visit/README.md | 89 + node_modules/collection-visit/index.js | 30 + node_modules/collection-visit/package.json | 115 + node_modules/color-convert/CHANGELOG.md | 54 + node_modules/color-convert/LICENSE | 21 + node_modules/color-convert/README.md | 68 + node_modules/color-convert/conversions.js | 861 + node_modules/color-convert/index.js | 78 + node_modules/color-convert/package.json | 81 + node_modules/color-convert/route.js | 97 + node_modules/color-name/.eslintrc.json | 43 + node_modules/color-name/.npmignore | 107 + node_modules/color-name/LICENSE | 8 + node_modules/color-name/README.md | 11 + node_modules/color-name/index.js | 152 + node_modules/color-name/package.json | 53 + node_modules/color-name/test.js | 7 + node_modules/commander/History.md | 256 + node_modules/commander/LICENSE | 22 + node_modules/commander/Readme.md | 342 + node_modules/commander/index.js | 1103 + node_modules/commander/package.json | 65 + node_modules/component-emitter/History.md | 68 + node_modules/component-emitter/LICENSE | 24 + node_modules/component-emitter/Readme.md | 74 + node_modules/component-emitter/index.js | 163 + node_modules/component-emitter/package.json | 57 + node_modules/concat-map/.travis.yml | 4 + node_modules/concat-map/LICENSE | 18 + node_modules/concat-map/README.markdown | 62 + node_modules/concat-map/example/map.js | 6 + node_modules/concat-map/index.js | 13 + node_modules/concat-map/package.json | 88 + node_modules/concat-map/test/map.js | 39 + node_modules/configstore/index.js | 98 + node_modules/configstore/package.json | 79 + node_modules/configstore/readme.md | 116 + node_modules/constantinople/.gitattributes | 22 + node_modules/constantinople/.prettierrc | 5 + node_modules/constantinople/.travis.yml | 5 + node_modules/constantinople/LICENSE | 19 + node_modules/constantinople/README.md | 46 + .../constantinople/lib/binaryOperation.d.ts | 2 + .../constantinople/lib/binaryOperation.js | 51 + node_modules/constantinople/lib/index.d.ts | 19 + node_modules/constantinople/lib/index.js | 353 + node_modules/constantinople/package.json | 68 + .../constantinople/src/binaryOperation.ts | 76 + node_modules/constantinople/src/index.ts | 357 + node_modules/constantinople/test/index.js | 86 + node_modules/constantinople/tsconfig.json | 8 + node_modules/content-disposition/HISTORY.md | 50 + node_modules/content-disposition/LICENSE | 22 + node_modules/content-disposition/README.md | 141 + node_modules/content-disposition/index.js | 445 + node_modules/content-disposition/package.json | 74 + node_modules/content-type/HISTORY.md | 24 + node_modules/content-type/LICENSE | 22 + node_modules/content-type/README.md | 92 + node_modules/content-type/index.js | 222 + node_modules/content-type/package.json | 76 + node_modules/cookie-parser/HISTORY.md | 85 + node_modules/cookie-parser/LICENSE | 23 + node_modules/cookie-parser/README.md | 85 + node_modules/cookie-parser/index.js | 181 + node_modules/cookie-parser/package.json | 76 + node_modules/cookie-signature/.npmignore | 4 + node_modules/cookie-signature/History.md | 38 + node_modules/cookie-signature/Readme.md | 42 + node_modules/cookie-signature/index.js | 51 + node_modules/cookie-signature/package.json | 58 + node_modules/cookie/HISTORY.md | 118 + node_modules/cookie/LICENSE | 24 + node_modules/cookie/README.md | 220 + node_modules/cookie/index.js | 195 + node_modules/cookie/package.json | 72 + node_modules/copy-descriptor/LICENSE | 21 + node_modules/copy-descriptor/index.js | 81 + node_modules/copy-descriptor/package.json | 87 + node_modules/core-js/CHANGELOG.md | 649 + node_modules/core-js/Gruntfile.js | 3 + node_modules/core-js/LICENSE | 19 + node_modules/core-js/README.md | 2289 ++ node_modules/core-js/bower.json | 49 + node_modules/core-js/build/Gruntfile.ls | 86 + node_modules/core-js/build/build.ls | 62 + node_modules/core-js/build/config.js | 274 + node_modules/core-js/build/index.js | 104 + node_modules/core-js/client/core.js | 8624 +++++++ node_modules/core-js/client/core.min.js | 10 + node_modules/core-js/client/core.min.js.map | 1 + node_modules/core-js/client/library.js | 8107 +++++++ node_modules/core-js/client/library.min.js | 10 + .../core-js/client/library.min.js.map | 1 + node_modules/core-js/client/shim.js | 8192 +++++++ node_modules/core-js/client/shim.min.js | 10 + node_modules/core-js/client/shim.min.js.map | 1 + node_modules/core-js/core/_.js | 2 + node_modules/core-js/core/delay.js | 2 + node_modules/core-js/core/dict.js | 2 + node_modules/core-js/core/function.js | 2 + node_modules/core-js/core/index.js | 15 + node_modules/core-js/core/number.js | 2 + node_modules/core-js/core/object.js | 5 + node_modules/core-js/core/regexp.js | 2 + node_modules/core-js/core/string.js | 3 + node_modules/core-js/es5/index.js | 37 + node_modules/core-js/es6/array.js | 23 + node_modules/core-js/es6/date.js | 6 + node_modules/core-js/es6/function.js | 4 + node_modules/core-js/es6/index.js | 138 + node_modules/core-js/es6/map.js | 5 + node_modules/core-js/es6/math.js | 18 + node_modules/core-js/es6/number.js | 13 + node_modules/core-js/es6/object.js | 20 + node_modules/core-js/es6/parse-float.js | 2 + node_modules/core-js/es6/parse-int.js | 2 + node_modules/core-js/es6/promise.js | 5 + node_modules/core-js/es6/reflect.js | 15 + node_modules/core-js/es6/regexp.js | 8 + node_modules/core-js/es6/set.js | 5 + node_modules/core-js/es6/string.js | 27 + node_modules/core-js/es6/symbol.js | 3 + node_modules/core-js/es6/typed.js | 13 + node_modules/core-js/es6/weak-map.js | 4 + node_modules/core-js/es6/weak-set.js | 4 + node_modules/core-js/es7/array.js | 4 + node_modules/core-js/es7/asap.js | 2 + node_modules/core-js/es7/error.js | 2 + node_modules/core-js/es7/global.js | 2 + node_modules/core-js/es7/index.js | 56 + node_modules/core-js/es7/map.js | 4 + node_modules/core-js/es7/math.js | 13 + node_modules/core-js/es7/object.js | 8 + node_modules/core-js/es7/observable.js | 7 + node_modules/core-js/es7/promise.js | 3 + node_modules/core-js/es7/reflect.js | 10 + node_modules/core-js/es7/set.js | 4 + node_modules/core-js/es7/string.js | 7 + node_modules/core-js/es7/symbol.js | 3 + node_modules/core-js/es7/system.js | 2 + node_modules/core-js/es7/weak-map.js | 3 + node_modules/core-js/es7/weak-set.js | 3 + node_modules/core-js/fn/_.js | 2 + node_modules/core-js/fn/array/concat.js | 4 + node_modules/core-js/fn/array/copy-within.js | 2 + node_modules/core-js/fn/array/entries.js | 2 + node_modules/core-js/fn/array/every.js | 2 + node_modules/core-js/fn/array/fill.js | 2 + node_modules/core-js/fn/array/filter.js | 2 + node_modules/core-js/fn/array/find-index.js | 2 + node_modules/core-js/fn/array/find.js | 2 + node_modules/core-js/fn/array/flat-map.js | 2 + node_modules/core-js/fn/array/flatten.js | 2 + node_modules/core-js/fn/array/for-each.js | 2 + node_modules/core-js/fn/array/from.js | 3 + node_modules/core-js/fn/array/includes.js | 2 + node_modules/core-js/fn/array/index-of.js | 2 + node_modules/core-js/fn/array/index.js | 26 + node_modules/core-js/fn/array/is-array.js | 2 + node_modules/core-js/fn/array/iterator.js | 2 + node_modules/core-js/fn/array/join.js | 2 + node_modules/core-js/fn/array/keys.js | 2 + .../core-js/fn/array/last-index-of.js | 2 + node_modules/core-js/fn/array/map.js | 2 + node_modules/core-js/fn/array/of.js | 2 + node_modules/core-js/fn/array/pop.js | 4 + node_modules/core-js/fn/array/push.js | 4 + node_modules/core-js/fn/array/reduce-right.js | 2 + node_modules/core-js/fn/array/reduce.js | 2 + node_modules/core-js/fn/array/reverse.js | 4 + node_modules/core-js/fn/array/shift.js | 4 + node_modules/core-js/fn/array/slice.js | 2 + node_modules/core-js/fn/array/some.js | 2 + node_modules/core-js/fn/array/sort.js | 2 + node_modules/core-js/fn/array/splice.js | 4 + node_modules/core-js/fn/array/unshift.js | 4 + node_modules/core-js/fn/array/values.js | 2 + .../core-js/fn/array/virtual/copy-within.js | 2 + .../core-js/fn/array/virtual/entries.js | 2 + .../core-js/fn/array/virtual/every.js | 2 + node_modules/core-js/fn/array/virtual/fill.js | 2 + .../core-js/fn/array/virtual/filter.js | 2 + .../core-js/fn/array/virtual/find-index.js | 2 + node_modules/core-js/fn/array/virtual/find.js | 2 + .../core-js/fn/array/virtual/flat-map.js | 2 + .../core-js/fn/array/virtual/flatten.js | 2 + .../core-js/fn/array/virtual/for-each.js | 2 + .../core-js/fn/array/virtual/includes.js | 2 + .../core-js/fn/array/virtual/index-of.js | 2 + .../core-js/fn/array/virtual/index.js | 20 + .../core-js/fn/array/virtual/iterator.js | 2 + node_modules/core-js/fn/array/virtual/join.js | 2 + node_modules/core-js/fn/array/virtual/keys.js | 2 + .../core-js/fn/array/virtual/last-index-of.js | 2 + node_modules/core-js/fn/array/virtual/map.js | 2 + .../core-js/fn/array/virtual/reduce-right.js | 2 + .../core-js/fn/array/virtual/reduce.js | 2 + .../core-js/fn/array/virtual/slice.js | 2 + node_modules/core-js/fn/array/virtual/some.js | 2 + node_modules/core-js/fn/array/virtual/sort.js | 2 + .../core-js/fn/array/virtual/values.js | 2 + node_modules/core-js/fn/asap.js | 2 + node_modules/core-js/fn/clear-immediate.js | 2 + node_modules/core-js/fn/date/index.js | 6 + node_modules/core-js/fn/date/now.js | 2 + node_modules/core-js/fn/date/to-iso-string.js | 3 + node_modules/core-js/fn/date/to-json.js | 2 + node_modules/core-js/fn/date/to-primitive.js | 5 + node_modules/core-js/fn/date/to-string.js | 5 + node_modules/core-js/fn/delay.js | 2 + node_modules/core-js/fn/dict.js | 2 + .../core-js/fn/dom-collections/index.js | 8 + .../core-js/fn/dom-collections/iterator.js | 2 + node_modules/core-js/fn/error/index.js | 2 + node_modules/core-js/fn/error/is-error.js | 2 + node_modules/core-js/fn/function/bind.js | 2 + .../core-js/fn/function/has-instance.js | 2 + node_modules/core-js/fn/function/index.js | 5 + node_modules/core-js/fn/function/name.js | 1 + node_modules/core-js/fn/function/part.js | 2 + .../core-js/fn/function/virtual/bind.js | 2 + .../core-js/fn/function/virtual/index.js | 3 + .../core-js/fn/function/virtual/part.js | 2 + .../core-js/fn/get-iterator-method.js | 3 + node_modules/core-js/fn/get-iterator.js | 3 + node_modules/core-js/fn/global.js | 2 + node_modules/core-js/fn/is-iterable.js | 3 + node_modules/core-js/fn/json/index.js | 2 + node_modules/core-js/fn/json/stringify.js | 5 + node_modules/core-js/fn/map.js | 8 + node_modules/core-js/fn/map/from.js | 8 + node_modules/core-js/fn/map/index.js | 8 + node_modules/core-js/fn/map/of.js | 8 + node_modules/core-js/fn/math/acosh.js | 2 + node_modules/core-js/fn/math/asinh.js | 2 + node_modules/core-js/fn/math/atanh.js | 2 + node_modules/core-js/fn/math/cbrt.js | 2 + node_modules/core-js/fn/math/clamp.js | 2 + node_modules/core-js/fn/math/clz32.js | 2 + node_modules/core-js/fn/math/cosh.js | 2 + node_modules/core-js/fn/math/deg-per-rad.js | 2 + node_modules/core-js/fn/math/degrees.js | 2 + node_modules/core-js/fn/math/expm1.js | 2 + node_modules/core-js/fn/math/fround.js | 2 + node_modules/core-js/fn/math/fscale.js | 2 + node_modules/core-js/fn/math/hypot.js | 2 + node_modules/core-js/fn/math/iaddh.js | 2 + node_modules/core-js/fn/math/imul.js | 2 + node_modules/core-js/fn/math/imulh.js | 2 + node_modules/core-js/fn/math/index.js | 30 + node_modules/core-js/fn/math/isubh.js | 2 + node_modules/core-js/fn/math/log10.js | 2 + node_modules/core-js/fn/math/log1p.js | 2 + node_modules/core-js/fn/math/log2.js | 2 + node_modules/core-js/fn/math/rad-per-deg.js | 2 + node_modules/core-js/fn/math/radians.js | 2 + node_modules/core-js/fn/math/scale.js | 2 + node_modules/core-js/fn/math/sign.js | 2 + node_modules/core-js/fn/math/signbit.js | 3 + node_modules/core-js/fn/math/sinh.js | 2 + node_modules/core-js/fn/math/tanh.js | 2 + node_modules/core-js/fn/math/trunc.js | 2 + node_modules/core-js/fn/math/umulh.js | 2 + node_modules/core-js/fn/number/constructor.js | 2 + node_modules/core-js/fn/number/epsilon.js | 2 + node_modules/core-js/fn/number/index.js | 14 + node_modules/core-js/fn/number/is-finite.js | 2 + node_modules/core-js/fn/number/is-integer.js | 2 + node_modules/core-js/fn/number/is-nan.js | 2 + .../core-js/fn/number/is-safe-integer.js | 2 + node_modules/core-js/fn/number/iterator.js | 5 + .../core-js/fn/number/max-safe-integer.js | 2 + .../core-js/fn/number/min-safe-integer.js | 2 + node_modules/core-js/fn/number/parse-float.js | 2 + node_modules/core-js/fn/number/parse-int.js | 2 + node_modules/core-js/fn/number/to-fixed.js | 2 + .../core-js/fn/number/to-precision.js | 2 + .../core-js/fn/number/virtual/index.js | 4 + .../core-js/fn/number/virtual/iterator.js | 2 + .../core-js/fn/number/virtual/to-fixed.js | 2 + .../core-js/fn/number/virtual/to-precision.js | 2 + node_modules/core-js/fn/object/assign.js | 2 + node_modules/core-js/fn/object/classof.js | 2 + node_modules/core-js/fn/object/create.js | 5 + .../core-js/fn/object/define-getter.js | 2 + .../core-js/fn/object/define-properties.js | 5 + .../core-js/fn/object/define-property.js | 5 + .../core-js/fn/object/define-setter.js | 2 + node_modules/core-js/fn/object/define.js | 2 + node_modules/core-js/fn/object/entries.js | 2 + node_modules/core-js/fn/object/freeze.js | 2 + .../fn/object/get-own-property-descriptor.js | 5 + .../fn/object/get-own-property-descriptors.js | 2 + .../fn/object/get-own-property-names.js | 5 + .../fn/object/get-own-property-symbols.js | 2 + .../core-js/fn/object/get-prototype-of.js | 2 + node_modules/core-js/fn/object/index.js | 30 + .../core-js/fn/object/is-extensible.js | 2 + node_modules/core-js/fn/object/is-frozen.js | 2 + node_modules/core-js/fn/object/is-object.js | 2 + node_modules/core-js/fn/object/is-sealed.js | 2 + node_modules/core-js/fn/object/is.js | 2 + node_modules/core-js/fn/object/keys.js | 2 + .../core-js/fn/object/lookup-getter.js | 2 + .../core-js/fn/object/lookup-setter.js | 2 + node_modules/core-js/fn/object/make.js | 2 + .../core-js/fn/object/prevent-extensions.js | 2 + node_modules/core-js/fn/object/seal.js | 2 + .../core-js/fn/object/set-prototype-of.js | 2 + node_modules/core-js/fn/object/values.js | 2 + node_modules/core-js/fn/observable.js | 7 + node_modules/core-js/fn/parse-float.js | 2 + node_modules/core-js/fn/parse-int.js | 2 + node_modules/core-js/fn/promise.js | 7 + node_modules/core-js/fn/promise/finally.js | 4 + node_modules/core-js/fn/promise/index.js | 7 + node_modules/core-js/fn/promise/try.js | 8 + node_modules/core-js/fn/reflect/apply.js | 2 + node_modules/core-js/fn/reflect/construct.js | 2 + .../core-js/fn/reflect/define-metadata.js | 2 + .../core-js/fn/reflect/define-property.js | 2 + .../core-js/fn/reflect/delete-metadata.js | 2 + .../core-js/fn/reflect/delete-property.js | 2 + node_modules/core-js/fn/reflect/enumerate.js | 2 + .../core-js/fn/reflect/get-metadata-keys.js | 2 + .../core-js/fn/reflect/get-metadata.js | 2 + .../fn/reflect/get-own-metadata-keys.js | 2 + .../core-js/fn/reflect/get-own-metadata.js | 2 + .../fn/reflect/get-own-property-descriptor.js | 2 + .../core-js/fn/reflect/get-prototype-of.js | 2 + node_modules/core-js/fn/reflect/get.js | 2 + .../core-js/fn/reflect/has-metadata.js | 2 + .../core-js/fn/reflect/has-own-metadata.js | 2 + node_modules/core-js/fn/reflect/has.js | 2 + node_modules/core-js/fn/reflect/index.js | 24 + .../core-js/fn/reflect/is-extensible.js | 2 + node_modules/core-js/fn/reflect/metadata.js | 2 + node_modules/core-js/fn/reflect/own-keys.js | 2 + .../core-js/fn/reflect/prevent-extensions.js | 2 + .../core-js/fn/reflect/set-prototype-of.js | 2 + node_modules/core-js/fn/reflect/set.js | 2 + node_modules/core-js/fn/regexp/constructor.js | 2 + node_modules/core-js/fn/regexp/escape.js | 2 + node_modules/core-js/fn/regexp/flags.js | 5 + node_modules/core-js/fn/regexp/index.js | 9 + node_modules/core-js/fn/regexp/match.js | 5 + node_modules/core-js/fn/regexp/replace.js | 5 + node_modules/core-js/fn/regexp/search.js | 5 + node_modules/core-js/fn/regexp/split.js | 5 + node_modules/core-js/fn/regexp/to-string.js | 5 + node_modules/core-js/fn/set-immediate.js | 2 + node_modules/core-js/fn/set-interval.js | 2 + node_modules/core-js/fn/set-timeout.js | 2 + node_modules/core-js/fn/set.js | 8 + node_modules/core-js/fn/set/from.js | 8 + node_modules/core-js/fn/set/index.js | 8 + node_modules/core-js/fn/set/of.js | 8 + node_modules/core-js/fn/string/anchor.js | 2 + node_modules/core-js/fn/string/at.js | 2 + node_modules/core-js/fn/string/big.js | 2 + node_modules/core-js/fn/string/blink.js | 2 + node_modules/core-js/fn/string/bold.js | 2 + .../core-js/fn/string/code-point-at.js | 2 + node_modules/core-js/fn/string/ends-with.js | 2 + node_modules/core-js/fn/string/escape-html.js | 2 + node_modules/core-js/fn/string/fixed.js | 2 + node_modules/core-js/fn/string/fontcolor.js | 2 + node_modules/core-js/fn/string/fontsize.js | 2 + .../core-js/fn/string/from-code-point.js | 2 + node_modules/core-js/fn/string/includes.js | 2 + node_modules/core-js/fn/string/index.js | 35 + node_modules/core-js/fn/string/italics.js | 2 + node_modules/core-js/fn/string/iterator.js | 5 + node_modules/core-js/fn/string/link.js | 2 + node_modules/core-js/fn/string/match-all.js | 2 + node_modules/core-js/fn/string/pad-end.js | 2 + node_modules/core-js/fn/string/pad-start.js | 2 + node_modules/core-js/fn/string/raw.js | 2 + node_modules/core-js/fn/string/repeat.js | 2 + node_modules/core-js/fn/string/small.js | 2 + node_modules/core-js/fn/string/starts-with.js | 2 + node_modules/core-js/fn/string/strike.js | 2 + node_modules/core-js/fn/string/sub.js | 2 + node_modules/core-js/fn/string/sup.js | 2 + node_modules/core-js/fn/string/trim-end.js | 2 + node_modules/core-js/fn/string/trim-left.js | 2 + node_modules/core-js/fn/string/trim-right.js | 2 + node_modules/core-js/fn/string/trim-start.js | 2 + node_modules/core-js/fn/string/trim.js | 2 + .../core-js/fn/string/unescape-html.js | 2 + .../core-js/fn/string/virtual/anchor.js | 2 + node_modules/core-js/fn/string/virtual/at.js | 2 + node_modules/core-js/fn/string/virtual/big.js | 2 + .../core-js/fn/string/virtual/blink.js | 2 + .../core-js/fn/string/virtual/bold.js | 2 + .../fn/string/virtual/code-point-at.js | 2 + .../core-js/fn/string/virtual/ends-with.js | 2 + .../core-js/fn/string/virtual/escape-html.js | 2 + .../core-js/fn/string/virtual/fixed.js | 2 + .../core-js/fn/string/virtual/fontcolor.js | 2 + .../core-js/fn/string/virtual/fontsize.js | 2 + .../core-js/fn/string/virtual/includes.js | 2 + .../core-js/fn/string/virtual/index.js | 33 + .../core-js/fn/string/virtual/italics.js | 2 + .../core-js/fn/string/virtual/iterator.js | 2 + .../core-js/fn/string/virtual/link.js | 2 + .../core-js/fn/string/virtual/match-all.js | 2 + .../core-js/fn/string/virtual/pad-end.js | 2 + .../core-js/fn/string/virtual/pad-start.js | 2 + .../core-js/fn/string/virtual/repeat.js | 2 + .../core-js/fn/string/virtual/small.js | 2 + .../core-js/fn/string/virtual/starts-with.js | 2 + .../core-js/fn/string/virtual/strike.js | 2 + node_modules/core-js/fn/string/virtual/sub.js | 2 + node_modules/core-js/fn/string/virtual/sup.js | 2 + .../core-js/fn/string/virtual/trim-end.js | 2 + .../core-js/fn/string/virtual/trim-left.js | 2 + .../core-js/fn/string/virtual/trim-right.js | 2 + .../core-js/fn/string/virtual/trim-start.js | 2 + .../core-js/fn/string/virtual/trim.js | 2 + .../fn/string/virtual/unescape-html.js | 2 + .../core-js/fn/symbol/async-iterator.js | 2 + node_modules/core-js/fn/symbol/for.js | 2 + .../core-js/fn/symbol/has-instance.js | 2 + node_modules/core-js/fn/symbol/index.js | 5 + .../core-js/fn/symbol/is-concat-spreadable.js | 1 + node_modules/core-js/fn/symbol/iterator.js | 3 + node_modules/core-js/fn/symbol/key-for.js | 2 + node_modules/core-js/fn/symbol/match.js | 2 + node_modules/core-js/fn/symbol/observable.js | 2 + node_modules/core-js/fn/symbol/replace.js | 2 + node_modules/core-js/fn/symbol/search.js | 2 + node_modules/core-js/fn/symbol/species.js | 1 + node_modules/core-js/fn/symbol/split.js | 2 + .../core-js/fn/symbol/to-primitive.js | 1 + .../core-js/fn/symbol/to-string-tag.js | 2 + node_modules/core-js/fn/symbol/unscopables.js | 1 + node_modules/core-js/fn/system/global.js | 2 + node_modules/core-js/fn/system/index.js | 2 + node_modules/core-js/fn/typed/array-buffer.js | 3 + node_modules/core-js/fn/typed/data-view.js | 3 + .../core-js/fn/typed/float32-array.js | 2 + .../core-js/fn/typed/float64-array.js | 2 + node_modules/core-js/fn/typed/index.js | 13 + node_modules/core-js/fn/typed/int16-array.js | 2 + node_modules/core-js/fn/typed/int32-array.js | 2 + node_modules/core-js/fn/typed/int8-array.js | 2 + node_modules/core-js/fn/typed/uint16-array.js | 2 + node_modules/core-js/fn/typed/uint32-array.js | 2 + node_modules/core-js/fn/typed/uint8-array.js | 2 + .../core-js/fn/typed/uint8-clamped-array.js | 2 + node_modules/core-js/fn/weak-map.js | 6 + node_modules/core-js/fn/weak-map/from.js | 8 + node_modules/core-js/fn/weak-map/index.js | 6 + node_modules/core-js/fn/weak-map/of.js | 8 + node_modules/core-js/fn/weak-set.js | 6 + node_modules/core-js/fn/weak-set/from.js | 8 + node_modules/core-js/fn/weak-set/index.js | 6 + node_modules/core-js/fn/weak-set/of.js | 8 + node_modules/core-js/index.js | 16 + node_modules/core-js/library/core/_.js | 2 + node_modules/core-js/library/core/delay.js | 2 + node_modules/core-js/library/core/dict.js | 2 + node_modules/core-js/library/core/function.js | 2 + node_modules/core-js/library/core/index.js | 15 + node_modules/core-js/library/core/number.js | 2 + node_modules/core-js/library/core/object.js | 5 + node_modules/core-js/library/core/regexp.js | 2 + node_modules/core-js/library/core/string.js | 3 + node_modules/core-js/library/es5/index.js | 37 + node_modules/core-js/library/es6/array.js | 23 + node_modules/core-js/library/es6/date.js | 6 + node_modules/core-js/library/es6/function.js | 4 + node_modules/core-js/library/es6/index.js | 138 + node_modules/core-js/library/es6/map.js | 5 + node_modules/core-js/library/es6/math.js | 18 + node_modules/core-js/library/es6/number.js | 13 + node_modules/core-js/library/es6/object.js | 20 + .../core-js/library/es6/parse-float.js | 2 + node_modules/core-js/library/es6/parse-int.js | 2 + node_modules/core-js/library/es6/promise.js | 5 + node_modules/core-js/library/es6/reflect.js | 15 + node_modules/core-js/library/es6/regexp.js | 8 + node_modules/core-js/library/es6/set.js | 5 + node_modules/core-js/library/es6/string.js | 27 + node_modules/core-js/library/es6/symbol.js | 3 + node_modules/core-js/library/es6/typed.js | 13 + node_modules/core-js/library/es6/weak-map.js | 4 + node_modules/core-js/library/es6/weak-set.js | 4 + node_modules/core-js/library/es7/array.js | 4 + node_modules/core-js/library/es7/asap.js | 2 + node_modules/core-js/library/es7/error.js | 2 + node_modules/core-js/library/es7/global.js | 2 + node_modules/core-js/library/es7/index.js | 56 + node_modules/core-js/library/es7/map.js | 4 + node_modules/core-js/library/es7/math.js | 13 + node_modules/core-js/library/es7/object.js | 8 + .../core-js/library/es7/observable.js | 7 + node_modules/core-js/library/es7/promise.js | 3 + node_modules/core-js/library/es7/reflect.js | 10 + node_modules/core-js/library/es7/set.js | 4 + node_modules/core-js/library/es7/string.js | 7 + node_modules/core-js/library/es7/symbol.js | 3 + node_modules/core-js/library/es7/system.js | 2 + node_modules/core-js/library/es7/weak-map.js | 3 + node_modules/core-js/library/es7/weak-set.js | 3 + node_modules/core-js/library/fn/_.js | 2 + .../core-js/library/fn/array/concat.js | 4 + .../core-js/library/fn/array/copy-within.js | 2 + .../core-js/library/fn/array/entries.js | 2 + .../core-js/library/fn/array/every.js | 2 + node_modules/core-js/library/fn/array/fill.js | 2 + .../core-js/library/fn/array/filter.js | 2 + .../core-js/library/fn/array/find-index.js | 2 + node_modules/core-js/library/fn/array/find.js | 2 + .../core-js/library/fn/array/flat-map.js | 2 + .../core-js/library/fn/array/flatten.js | 2 + .../core-js/library/fn/array/for-each.js | 2 + node_modules/core-js/library/fn/array/from.js | 3 + .../core-js/library/fn/array/includes.js | 2 + .../core-js/library/fn/array/index-of.js | 2 + .../core-js/library/fn/array/index.js | 26 + .../core-js/library/fn/array/is-array.js | 2 + .../core-js/library/fn/array/iterator.js | 2 + node_modules/core-js/library/fn/array/join.js | 2 + node_modules/core-js/library/fn/array/keys.js | 2 + .../core-js/library/fn/array/last-index-of.js | 2 + node_modules/core-js/library/fn/array/map.js | 2 + node_modules/core-js/library/fn/array/of.js | 2 + node_modules/core-js/library/fn/array/pop.js | 4 + node_modules/core-js/library/fn/array/push.js | 4 + .../core-js/library/fn/array/reduce-right.js | 2 + .../core-js/library/fn/array/reduce.js | 2 + .../core-js/library/fn/array/reverse.js | 4 + .../core-js/library/fn/array/shift.js | 4 + .../core-js/library/fn/array/slice.js | 2 + node_modules/core-js/library/fn/array/some.js | 2 + node_modules/core-js/library/fn/array/sort.js | 2 + .../core-js/library/fn/array/splice.js | 4 + .../core-js/library/fn/array/unshift.js | 4 + .../core-js/library/fn/array/values.js | 2 + .../library/fn/array/virtual/copy-within.js | 2 + .../library/fn/array/virtual/entries.js | 2 + .../core-js/library/fn/array/virtual/every.js | 2 + .../core-js/library/fn/array/virtual/fill.js | 2 + .../library/fn/array/virtual/filter.js | 2 + .../library/fn/array/virtual/find-index.js | 2 + .../core-js/library/fn/array/virtual/find.js | 2 + .../library/fn/array/virtual/flat-map.js | 2 + .../library/fn/array/virtual/flatten.js | 2 + .../library/fn/array/virtual/for-each.js | 2 + .../library/fn/array/virtual/includes.js | 2 + .../library/fn/array/virtual/index-of.js | 2 + .../core-js/library/fn/array/virtual/index.js | 20 + .../library/fn/array/virtual/iterator.js | 2 + .../core-js/library/fn/array/virtual/join.js | 2 + .../core-js/library/fn/array/virtual/keys.js | 2 + .../library/fn/array/virtual/last-index-of.js | 2 + .../core-js/library/fn/array/virtual/map.js | 2 + .../library/fn/array/virtual/reduce-right.js | 2 + .../library/fn/array/virtual/reduce.js | 2 + .../core-js/library/fn/array/virtual/slice.js | 2 + .../core-js/library/fn/array/virtual/some.js | 2 + .../core-js/library/fn/array/virtual/sort.js | 2 + .../library/fn/array/virtual/values.js | 2 + node_modules/core-js/library/fn/asap.js | 2 + .../core-js/library/fn/clear-immediate.js | 2 + node_modules/core-js/library/fn/date/index.js | 6 + node_modules/core-js/library/fn/date/now.js | 2 + .../core-js/library/fn/date/to-iso-string.js | 3 + .../core-js/library/fn/date/to-json.js | 2 + .../core-js/library/fn/date/to-primitive.js | 5 + .../core-js/library/fn/date/to-string.js | 5 + node_modules/core-js/library/fn/delay.js | 2 + node_modules/core-js/library/fn/dict.js | 2 + .../library/fn/dom-collections/index.js | 8 + .../library/fn/dom-collections/iterator.js | 2 + .../core-js/library/fn/error/index.js | 2 + .../core-js/library/fn/error/is-error.js | 2 + .../core-js/library/fn/function/bind.js | 2 + .../library/fn/function/has-instance.js | 2 + .../core-js/library/fn/function/index.js | 5 + .../core-js/library/fn/function/name.js | 1 + .../core-js/library/fn/function/part.js | 2 + .../library/fn/function/virtual/bind.js | 2 + .../library/fn/function/virtual/index.js | 3 + .../library/fn/function/virtual/part.js | 2 + .../core-js/library/fn/get-iterator-method.js | 3 + .../core-js/library/fn/get-iterator.js | 3 + node_modules/core-js/library/fn/global.js | 2 + .../core-js/library/fn/is-iterable.js | 3 + node_modules/core-js/library/fn/json/index.js | 2 + .../core-js/library/fn/json/stringify.js | 5 + node_modules/core-js/library/fn/map.js | 8 + node_modules/core-js/library/fn/map/from.js | 8 + node_modules/core-js/library/fn/map/index.js | 8 + node_modules/core-js/library/fn/map/of.js | 8 + node_modules/core-js/library/fn/math/acosh.js | 2 + node_modules/core-js/library/fn/math/asinh.js | 2 + node_modules/core-js/library/fn/math/atanh.js | 2 + node_modules/core-js/library/fn/math/cbrt.js | 2 + node_modules/core-js/library/fn/math/clamp.js | 2 + node_modules/core-js/library/fn/math/clz32.js | 2 + node_modules/core-js/library/fn/math/cosh.js | 2 + .../core-js/library/fn/math/deg-per-rad.js | 2 + .../core-js/library/fn/math/degrees.js | 2 + node_modules/core-js/library/fn/math/expm1.js | 2 + .../core-js/library/fn/math/fround.js | 2 + .../core-js/library/fn/math/fscale.js | 2 + node_modules/core-js/library/fn/math/hypot.js | 2 + node_modules/core-js/library/fn/math/iaddh.js | 2 + node_modules/core-js/library/fn/math/imul.js | 2 + node_modules/core-js/library/fn/math/imulh.js | 2 + node_modules/core-js/library/fn/math/index.js | 30 + node_modules/core-js/library/fn/math/isubh.js | 2 + node_modules/core-js/library/fn/math/log10.js | 2 + node_modules/core-js/library/fn/math/log1p.js | 2 + node_modules/core-js/library/fn/math/log2.js | 2 + .../core-js/library/fn/math/rad-per-deg.js | 2 + .../core-js/library/fn/math/radians.js | 2 + node_modules/core-js/library/fn/math/scale.js | 2 + node_modules/core-js/library/fn/math/sign.js | 2 + .../core-js/library/fn/math/signbit.js | 3 + node_modules/core-js/library/fn/math/sinh.js | 2 + node_modules/core-js/library/fn/math/tanh.js | 2 + node_modules/core-js/library/fn/math/trunc.js | 2 + node_modules/core-js/library/fn/math/umulh.js | 2 + .../core-js/library/fn/number/constructor.js | 2 + .../core-js/library/fn/number/epsilon.js | 2 + .../core-js/library/fn/number/index.js | 14 + .../core-js/library/fn/number/is-finite.js | 2 + .../core-js/library/fn/number/is-integer.js | 2 + .../core-js/library/fn/number/is-nan.js | 2 + .../library/fn/number/is-safe-integer.js | 2 + .../core-js/library/fn/number/iterator.js | 5 + .../library/fn/number/max-safe-integer.js | 2 + .../library/fn/number/min-safe-integer.js | 2 + .../core-js/library/fn/number/parse-float.js | 2 + .../core-js/library/fn/number/parse-int.js | 2 + .../core-js/library/fn/number/to-fixed.js | 2 + .../core-js/library/fn/number/to-precision.js | 2 + .../library/fn/number/virtual/index.js | 4 + .../library/fn/number/virtual/iterator.js | 2 + .../library/fn/number/virtual/to-fixed.js | 2 + .../library/fn/number/virtual/to-precision.js | 2 + .../core-js/library/fn/object/assign.js | 2 + .../core-js/library/fn/object/classof.js | 2 + .../core-js/library/fn/object/create.js | 5 + .../library/fn/object/define-getter.js | 2 + .../library/fn/object/define-properties.js | 5 + .../library/fn/object/define-property.js | 5 + .../library/fn/object/define-setter.js | 2 + .../core-js/library/fn/object/define.js | 2 + .../core-js/library/fn/object/entries.js | 2 + .../core-js/library/fn/object/freeze.js | 2 + .../fn/object/get-own-property-descriptor.js | 5 + .../fn/object/get-own-property-descriptors.js | 2 + .../fn/object/get-own-property-names.js | 5 + .../fn/object/get-own-property-symbols.js | 2 + .../library/fn/object/get-prototype-of.js | 2 + .../core-js/library/fn/object/index.js | 30 + .../library/fn/object/is-extensible.js | 2 + .../core-js/library/fn/object/is-frozen.js | 2 + .../core-js/library/fn/object/is-object.js | 2 + .../core-js/library/fn/object/is-sealed.js | 2 + node_modules/core-js/library/fn/object/is.js | 2 + .../core-js/library/fn/object/keys.js | 2 + .../library/fn/object/lookup-getter.js | 2 + .../library/fn/object/lookup-setter.js | 2 + .../core-js/library/fn/object/make.js | 2 + .../library/fn/object/prevent-extensions.js | 2 + .../core-js/library/fn/object/seal.js | 2 + .../library/fn/object/set-prototype-of.js | 2 + .../core-js/library/fn/object/values.js | 2 + node_modules/core-js/library/fn/observable.js | 7 + .../core-js/library/fn/parse-float.js | 2 + node_modules/core-js/library/fn/parse-int.js | 2 + node_modules/core-js/library/fn/promise.js | 7 + .../core-js/library/fn/promise/finally.js | 4 + .../core-js/library/fn/promise/index.js | 7 + .../core-js/library/fn/promise/try.js | 8 + .../core-js/library/fn/reflect/apply.js | 2 + .../core-js/library/fn/reflect/construct.js | 2 + .../library/fn/reflect/define-metadata.js | 2 + .../library/fn/reflect/define-property.js | 2 + .../library/fn/reflect/delete-metadata.js | 2 + .../library/fn/reflect/delete-property.js | 2 + .../core-js/library/fn/reflect/enumerate.js | 2 + .../library/fn/reflect/get-metadata-keys.js | 2 + .../library/fn/reflect/get-metadata.js | 2 + .../fn/reflect/get-own-metadata-keys.js | 2 + .../library/fn/reflect/get-own-metadata.js | 2 + .../fn/reflect/get-own-property-descriptor.js | 2 + .../library/fn/reflect/get-prototype-of.js | 2 + .../core-js/library/fn/reflect/get.js | 2 + .../library/fn/reflect/has-metadata.js | 2 + .../library/fn/reflect/has-own-metadata.js | 2 + .../core-js/library/fn/reflect/has.js | 2 + .../core-js/library/fn/reflect/index.js | 24 + .../library/fn/reflect/is-extensible.js | 2 + .../core-js/library/fn/reflect/metadata.js | 2 + .../core-js/library/fn/reflect/own-keys.js | 2 + .../library/fn/reflect/prevent-extensions.js | 2 + .../library/fn/reflect/set-prototype-of.js | 2 + .../core-js/library/fn/reflect/set.js | 2 + .../core-js/library/fn/regexp/constructor.js | 2 + .../core-js/library/fn/regexp/escape.js | 2 + .../core-js/library/fn/regexp/flags.js | 5 + .../core-js/library/fn/regexp/index.js | 9 + .../core-js/library/fn/regexp/match.js | 5 + .../core-js/library/fn/regexp/replace.js | 5 + .../core-js/library/fn/regexp/search.js | 5 + .../core-js/library/fn/regexp/split.js | 5 + .../core-js/library/fn/regexp/to-string.js | 5 + .../core-js/library/fn/set-immediate.js | 2 + .../core-js/library/fn/set-interval.js | 2 + .../core-js/library/fn/set-timeout.js | 2 + node_modules/core-js/library/fn/set.js | 8 + node_modules/core-js/library/fn/set/from.js | 8 + node_modules/core-js/library/fn/set/index.js | 8 + node_modules/core-js/library/fn/set/of.js | 8 + .../core-js/library/fn/string/anchor.js | 2 + node_modules/core-js/library/fn/string/at.js | 2 + node_modules/core-js/library/fn/string/big.js | 2 + .../core-js/library/fn/string/blink.js | 2 + .../core-js/library/fn/string/bold.js | 2 + .../library/fn/string/code-point-at.js | 2 + .../core-js/library/fn/string/ends-with.js | 2 + .../core-js/library/fn/string/escape-html.js | 2 + .../core-js/library/fn/string/fixed.js | 2 + .../core-js/library/fn/string/fontcolor.js | 2 + .../core-js/library/fn/string/fontsize.js | 2 + .../library/fn/string/from-code-point.js | 2 + .../core-js/library/fn/string/includes.js | 2 + .../core-js/library/fn/string/index.js | 35 + .../core-js/library/fn/string/italics.js | 2 + .../core-js/library/fn/string/iterator.js | 5 + .../core-js/library/fn/string/link.js | 2 + .../core-js/library/fn/string/match-all.js | 2 + .../core-js/library/fn/string/pad-end.js | 2 + .../core-js/library/fn/string/pad-start.js | 2 + node_modules/core-js/library/fn/string/raw.js | 2 + .../core-js/library/fn/string/repeat.js | 2 + .../core-js/library/fn/string/small.js | 2 + .../core-js/library/fn/string/starts-with.js | 2 + .../core-js/library/fn/string/strike.js | 2 + node_modules/core-js/library/fn/string/sub.js | 2 + node_modules/core-js/library/fn/string/sup.js | 2 + .../core-js/library/fn/string/trim-end.js | 2 + .../core-js/library/fn/string/trim-left.js | 2 + .../core-js/library/fn/string/trim-right.js | 2 + .../core-js/library/fn/string/trim-start.js | 2 + .../core-js/library/fn/string/trim.js | 2 + .../library/fn/string/unescape-html.js | 2 + .../library/fn/string/virtual/anchor.js | 2 + .../core-js/library/fn/string/virtual/at.js | 2 + .../core-js/library/fn/string/virtual/big.js | 2 + .../library/fn/string/virtual/blink.js | 2 + .../core-js/library/fn/string/virtual/bold.js | 2 + .../fn/string/virtual/code-point-at.js | 2 + .../library/fn/string/virtual/ends-with.js | 2 + .../library/fn/string/virtual/escape-html.js | 2 + .../library/fn/string/virtual/fixed.js | 2 + .../library/fn/string/virtual/fontcolor.js | 2 + .../library/fn/string/virtual/fontsize.js | 2 + .../library/fn/string/virtual/includes.js | 2 + .../library/fn/string/virtual/index.js | 33 + .../library/fn/string/virtual/italics.js | 2 + .../library/fn/string/virtual/iterator.js | 2 + .../core-js/library/fn/string/virtual/link.js | 2 + .../library/fn/string/virtual/match-all.js | 2 + .../library/fn/string/virtual/pad-end.js | 2 + .../library/fn/string/virtual/pad-start.js | 2 + .../library/fn/string/virtual/repeat.js | 2 + .../library/fn/string/virtual/small.js | 2 + .../library/fn/string/virtual/starts-with.js | 2 + .../library/fn/string/virtual/strike.js | 2 + .../core-js/library/fn/string/virtual/sub.js | 2 + .../core-js/library/fn/string/virtual/sup.js | 2 + .../library/fn/string/virtual/trim-end.js | 2 + .../library/fn/string/virtual/trim-left.js | 2 + .../library/fn/string/virtual/trim-right.js | 2 + .../library/fn/string/virtual/trim-start.js | 2 + .../core-js/library/fn/string/virtual/trim.js | 2 + .../fn/string/virtual/unescape-html.js | 2 + .../library/fn/symbol/async-iterator.js | 2 + node_modules/core-js/library/fn/symbol/for.js | 2 + .../core-js/library/fn/symbol/has-instance.js | 2 + .../core-js/library/fn/symbol/index.js | 5 + .../library/fn/symbol/is-concat-spreadable.js | 1 + .../core-js/library/fn/symbol/iterator.js | 3 + .../core-js/library/fn/symbol/key-for.js | 2 + .../core-js/library/fn/symbol/match.js | 2 + .../core-js/library/fn/symbol/observable.js | 2 + .../core-js/library/fn/symbol/replace.js | 2 + .../core-js/library/fn/symbol/search.js | 2 + .../core-js/library/fn/symbol/species.js | 1 + .../core-js/library/fn/symbol/split.js | 2 + .../core-js/library/fn/symbol/to-primitive.js | 1 + .../library/fn/symbol/to-string-tag.js | 2 + .../core-js/library/fn/symbol/unscopables.js | 1 + .../core-js/library/fn/system/global.js | 2 + .../core-js/library/fn/system/index.js | 2 + .../core-js/library/fn/typed/array-buffer.js | 3 + .../core-js/library/fn/typed/data-view.js | 3 + .../core-js/library/fn/typed/float32-array.js | 2 + .../core-js/library/fn/typed/float64-array.js | 2 + .../core-js/library/fn/typed/index.js | 13 + .../core-js/library/fn/typed/int16-array.js | 2 + .../core-js/library/fn/typed/int32-array.js | 2 + .../core-js/library/fn/typed/int8-array.js | 2 + .../core-js/library/fn/typed/uint16-array.js | 2 + .../core-js/library/fn/typed/uint32-array.js | 2 + .../core-js/library/fn/typed/uint8-array.js | 2 + .../library/fn/typed/uint8-clamped-array.js | 2 + node_modules/core-js/library/fn/weak-map.js | 6 + .../core-js/library/fn/weak-map/from.js | 8 + .../core-js/library/fn/weak-map/index.js | 6 + .../core-js/library/fn/weak-map/of.js | 8 + node_modules/core-js/library/fn/weak-set.js | 6 + .../core-js/library/fn/weak-set/from.js | 8 + .../core-js/library/fn/weak-set/index.js | 6 + .../core-js/library/fn/weak-set/of.js | 8 + node_modules/core-js/library/index.js | 16 + .../core-js/library/modules/_a-function.js | 4 + .../library/modules/_a-number-value.js | 5 + .../library/modules/_add-to-unscopables.js | 1 + .../core-js/library/modules/_an-instance.js | 5 + .../core-js/library/modules/_an-object.js | 5 + .../library/modules/_array-copy-within.js | 26 + .../core-js/library/modules/_array-fill.js | 15 + .../library/modules/_array-from-iterable.js | 7 + .../library/modules/_array-includes.js | 23 + .../core-js/library/modules/_array-methods.js | 44 + .../core-js/library/modules/_array-reduce.js | 28 + .../modules/_array-species-constructor.js | 16 + .../library/modules/_array-species-create.js | 6 + node_modules/core-js/library/modules/_bind.js | 25 + .../core-js/library/modules/_classof.js | 23 + node_modules/core-js/library/modules/_cof.js | 5 + .../library/modules/_collection-strong.js | 144 + .../library/modules/_collection-to-json.js | 9 + .../library/modules/_collection-weak.js | 85 + .../core-js/library/modules/_collection.js | 59 + node_modules/core-js/library/modules/_core.js | 2 + .../library/modules/_create-property.js | 8 + node_modules/core-js/library/modules/_ctx.js | 20 + .../library/modules/_date-to-iso-string.js | 26 + .../library/modules/_date-to-primitive.js | 9 + .../core-js/library/modules/_defined.js | 5 + .../core-js/library/modules/_descriptors.js | 4 + .../core-js/library/modules/_dom-create.js | 7 + .../core-js/library/modules/_entry-virtual.js | 5 + .../core-js/library/modules/_enum-bug-keys.js | 4 + .../core-js/library/modules/_enum-keys.js | 15 + .../core-js/library/modules/_export.js | 61 + .../library/modules/_fails-is-regexp.js | 12 + .../core-js/library/modules/_fails.js | 7 + .../core-js/library/modules/_fix-re-wks.js | 28 + .../core-js/library/modules/_flags.js | 13 + .../library/modules/_flatten-into-array.js | 39 + .../core-js/library/modules/_for-of.js | 25 + .../core-js/library/modules/_global.js | 6 + node_modules/core-js/library/modules/_has.js | 4 + node_modules/core-js/library/modules/_hide.js | 8 + node_modules/core-js/library/modules/_html.js | 2 + .../library/modules/_ie8-dom-define.js | 3 + .../library/modules/_inherit-if-required.js | 9 + .../core-js/library/modules/_invoke.js | 16 + .../core-js/library/modules/_iobject.js | 6 + .../core-js/library/modules/_is-array-iter.js | 8 + .../core-js/library/modules/_is-array.js | 5 + .../core-js/library/modules/_is-integer.js | 6 + .../core-js/library/modules/_is-object.js | 3 + .../core-js/library/modules/_is-regexp.js | 8 + .../core-js/library/modules/_iter-call.js | 12 + .../core-js/library/modules/_iter-create.js | 13 + .../core-js/library/modules/_iter-define.js | 70 + .../core-js/library/modules/_iter-detect.js | 22 + .../core-js/library/modules/_iter-step.js | 3 + .../core-js/library/modules/_iterators.js | 1 + .../core-js/library/modules/_keyof.js | 10 + .../core-js/library/modules/_library.js | 1 + .../core-js/library/modules/_math-expm1.js | 10 + .../core-js/library/modules/_math-fround.js | 23 + .../core-js/library/modules/_math-log1p.js | 4 + .../core-js/library/modules/_math-scale.js | 18 + .../core-js/library/modules/_math-sign.js | 5 + node_modules/core-js/library/modules/_meta.js | 53 + .../core-js/library/modules/_metadata.js | 51 + .../core-js/library/modules/_microtask.js | 68 + .../modules/_new-promise-capability.js | 18 + .../core-js/library/modules/_object-assign.js | 34 + .../core-js/library/modules/_object-create.js | 41 + .../core-js/library/modules/_object-define.js | 13 + .../core-js/library/modules/_object-dp.js | 16 + .../core-js/library/modules/_object-dps.js | 13 + .../library/modules/_object-forced-pam.js | 9 + .../core-js/library/modules/_object-gopd.js | 16 + .../library/modules/_object-gopn-ext.js | 19 + .../core-js/library/modules/_object-gopn.js | 7 + .../core-js/library/modules/_object-gops.js | 1 + .../core-js/library/modules/_object-gpo.js | 13 + .../library/modules/_object-keys-internal.js | 17 + .../core-js/library/modules/_object-keys.js | 7 + .../core-js/library/modules/_object-pie.js | 1 + .../core-js/library/modules/_object-sap.js | 10 + .../library/modules/_object-to-array.js | 16 + .../core-js/library/modules/_own-keys.js | 10 + .../core-js/library/modules/_parse-float.js | 8 + .../core-js/library/modules/_parse-int.js | 9 + .../core-js/library/modules/_partial.js | 25 + node_modules/core-js/library/modules/_path.js | 1 + .../core-js/library/modules/_perform.js | 7 + .../library/modules/_promise-resolve.js | 12 + .../core-js/library/modules/_property-desc.js | 8 + .../core-js/library/modules/_redefine-all.js | 7 + .../core-js/library/modules/_redefine.js | 1 + .../core-js/library/modules/_replacer.js | 8 + .../core-js/library/modules/_same-value.js | 5 + .../library/modules/_set-collection-from.js | 28 + .../library/modules/_set-collection-of.js | 12 + .../core-js/library/modules/_set-proto.js | 25 + .../core-js/library/modules/_set-species.js | 14 + .../library/modules/_set-to-string-tag.js | 7 + .../core-js/library/modules/_shared-key.js | 5 + .../core-js/library/modules/_shared.js | 6 + .../library/modules/_species-constructor.js | 9 + .../core-js/library/modules/_strict-method.js | 9 + .../core-js/library/modules/_string-at.js | 17 + .../library/modules/_string-context.js | 8 + .../core-js/library/modules/_string-html.js | 19 + .../core-js/library/modules/_string-pad.js | 16 + .../core-js/library/modules/_string-repeat.js | 12 + .../core-js/library/modules/_string-trim.js | 30 + .../core-js/library/modules/_string-ws.js | 2 + node_modules/core-js/library/modules/_task.js | 84 + .../library/modules/_to-absolute-index.js | 7 + .../core-js/library/modules/_to-index.js | 10 + .../core-js/library/modules/_to-integer.js | 6 + .../core-js/library/modules/_to-iobject.js | 6 + .../core-js/library/modules/_to-length.js | 6 + .../core-js/library/modules/_to-object.js | 5 + .../core-js/library/modules/_to-primitive.js | 12 + .../core-js/library/modules/_typed-array.js | 480 + .../core-js/library/modules/_typed-buffer.js | 276 + .../core-js/library/modules/_typed.js | 28 + node_modules/core-js/library/modules/_uid.js | 5 + .../core-js/library/modules/_user-agent.js | 4 + .../library/modules/_validate-collection.js | 5 + .../core-js/library/modules/_wks-define.js | 9 + .../core-js/library/modules/_wks-ext.js | 1 + node_modules/core-js/library/modules/_wks.js | 11 + .../core-js/library/modules/core.delay.js | 12 + .../core-js/library/modules/core.dict.js | 157 + .../library/modules/core.function.part.js | 7 + .../modules/core.get-iterator-method.js | 8 + .../library/modules/core.get-iterator.js | 7 + .../library/modules/core.is-iterable.js | 10 + .../library/modules/core.number.iterator.js | 9 + .../library/modules/core.object.classof.js | 3 + .../library/modules/core.object.define.js | 4 + .../library/modules/core.object.is-object.js | 3 + .../library/modules/core.object.make.js | 9 + .../library/modules/core.regexp.escape.js | 5 + .../modules/core.string.escape-html.js | 11 + .../modules/core.string.unescape-html.js | 11 + node_modules/core-js/library/modules/es5.js | 35 + .../library/modules/es6.array.copy-within.js | 6 + .../library/modules/es6.array.every.js | 10 + .../core-js/library/modules/es6.array.fill.js | 6 + .../library/modules/es6.array.filter.js | 10 + .../library/modules/es6.array.find-index.js | 14 + .../core-js/library/modules/es6.array.find.js | 14 + .../library/modules/es6.array.for-each.js | 11 + .../core-js/library/modules/es6.array.from.js | 37 + .../library/modules/es6.array.index-of.js | 15 + .../library/modules/es6.array.is-array.js | 4 + .../library/modules/es6.array.iterator.js | 34 + .../core-js/library/modules/es6.array.join.js | 12 + .../modules/es6.array.last-index-of.js | 22 + .../core-js/library/modules/es6.array.map.js | 10 + .../core-js/library/modules/es6.array.of.js | 19 + .../library/modules/es6.array.reduce-right.js | 10 + .../library/modules/es6.array.reduce.js | 10 + .../library/modules/es6.array.slice.js | 28 + .../core-js/library/modules/es6.array.some.js | 10 + .../core-js/library/modules/es6.array.sort.js | 23 + .../library/modules/es6.array.species.js | 1 + .../core-js/library/modules/es6.date.now.js | 4 + .../library/modules/es6.date.to-iso-string.js | 8 + .../library/modules/es6.date.to-json.js | 19 + .../library/modules/es6.date.to-primitive.js | 0 .../library/modules/es6.date.to-string.js | 0 .../library/modules/es6.function.bind.js | 4 + .../modules/es6.function.has-instance.js | 13 + .../library/modules/es6.function.name.js | 0 .../core-js/library/modules/es6.map.js | 19 + .../core-js/library/modules/es6.math.acosh.js | 18 + .../core-js/library/modules/es6.math.asinh.js | 10 + .../core-js/library/modules/es6.math.atanh.js | 10 + .../core-js/library/modules/es6.math.cbrt.js | 9 + .../core-js/library/modules/es6.math.clz32.js | 8 + .../core-js/library/modules/es6.math.cosh.js | 9 + .../core-js/library/modules/es6.math.expm1.js | 5 + .../library/modules/es6.math.fround.js | 4 + .../core-js/library/modules/es6.math.hypot.js | 25 + .../core-js/library/modules/es6.math.imul.js | 17 + .../core-js/library/modules/es6.math.log10.js | 8 + .../core-js/library/modules/es6.math.log1p.js | 4 + .../core-js/library/modules/es6.math.log2.js | 8 + .../core-js/library/modules/es6.math.sign.js | 4 + .../core-js/library/modules/es6.math.sinh.js | 15 + .../core-js/library/modules/es6.math.tanh.js | 12 + .../core-js/library/modules/es6.math.trunc.js | 8 + .../library/modules/es6.number.constructor.js | 0 .../library/modules/es6.number.epsilon.js | 4 + .../library/modules/es6.number.is-finite.js | 9 + .../library/modules/es6.number.is-integer.js | 4 + .../library/modules/es6.number.is-nan.js | 9 + .../modules/es6.number.is-safe-integer.js | 10 + .../modules/es6.number.max-safe-integer.js | 4 + .../modules/es6.number.min-safe-integer.js | 4 + .../library/modules/es6.number.parse-float.js | 4 + .../library/modules/es6.number.parse-int.js | 4 + .../library/modules/es6.number.to-fixed.js | 114 + .../modules/es6.number.to-precision.js | 18 + .../library/modules/es6.object.assign.js | 4 + .../library/modules/es6.object.create.js | 3 + .../modules/es6.object.define-properties.js | 3 + .../modules/es6.object.define-property.js | 3 + .../library/modules/es6.object.freeze.js | 9 + .../es6.object.get-own-property-descriptor.js | 9 + .../es6.object.get-own-property-names.js | 4 + .../modules/es6.object.get-prototype-of.js | 9 + .../modules/es6.object.is-extensible.js | 8 + .../library/modules/es6.object.is-frozen.js | 8 + .../library/modules/es6.object.is-sealed.js | 8 + .../core-js/library/modules/es6.object.is.js | 3 + .../library/modules/es6.object.keys.js | 9 + .../modules/es6.object.prevent-extensions.js | 9 + .../library/modules/es6.object.seal.js | 9 + .../modules/es6.object.set-prototype-of.js | 3 + .../library/modules/es6.object.to-string.js | 0 .../library/modules/es6.parse-float.js | 4 + .../core-js/library/modules/es6.parse-int.js | 4 + .../core-js/library/modules/es6.promise.js | 273 + .../library/modules/es6.reflect.apply.js | 16 + .../library/modules/es6.reflect.construct.js | 47 + .../modules/es6.reflect.define-property.js | 23 + .../modules/es6.reflect.delete-property.js | 11 + .../library/modules/es6.reflect.enumerate.js | 26 + ...es6.reflect.get-own-property-descriptor.js | 10 + .../modules/es6.reflect.get-prototype-of.js | 10 + .../library/modules/es6.reflect.get.js | 21 + .../library/modules/es6.reflect.has.js | 8 + .../modules/es6.reflect.is-extensible.js | 11 + .../library/modules/es6.reflect.own-keys.js | 4 + .../modules/es6.reflect.prevent-extensions.js | 16 + .../modules/es6.reflect.set-prototype-of.js | 15 + .../library/modules/es6.reflect.set.js | 31 + .../library/modules/es6.regexp.constructor.js | 1 + .../library/modules/es6.regexp.flags.js | 0 .../library/modules/es6.regexp.match.js | 0 .../library/modules/es6.regexp.replace.js | 0 .../library/modules/es6.regexp.search.js | 0 .../library/modules/es6.regexp.split.js | 0 .../library/modules/es6.regexp.to-string.js | 0 .../core-js/library/modules/es6.set.js | 14 + .../library/modules/es6.string.anchor.js | 7 + .../core-js/library/modules/es6.string.big.js | 7 + .../library/modules/es6.string.blink.js | 7 + .../library/modules/es6.string.bold.js | 7 + .../modules/es6.string.code-point-at.js | 9 + .../library/modules/es6.string.ends-with.js | 20 + .../library/modules/es6.string.fixed.js | 7 + .../library/modules/es6.string.fontcolor.js | 7 + .../library/modules/es6.string.fontsize.js | 7 + .../modules/es6.string.from-code-point.js | 23 + .../library/modules/es6.string.includes.js | 12 + .../library/modules/es6.string.italics.js | 7 + .../library/modules/es6.string.iterator.js | 17 + .../library/modules/es6.string.link.js | 7 + .../core-js/library/modules/es6.string.raw.js | 18 + .../library/modules/es6.string.repeat.js | 6 + .../library/modules/es6.string.small.js | 7 + .../library/modules/es6.string.starts-with.js | 18 + .../library/modules/es6.string.strike.js | 7 + .../core-js/library/modules/es6.string.sub.js | 7 + .../core-js/library/modules/es6.string.sup.js | 7 + .../library/modules/es6.string.trim.js | 7 + .../core-js/library/modules/es6.symbol.js | 234 + .../library/modules/es6.typed.array-buffer.js | 46 + .../library/modules/es6.typed.data-view.js | 4 + .../modules/es6.typed.float32-array.js | 5 + .../modules/es6.typed.float64-array.js | 5 + .../library/modules/es6.typed.int16-array.js | 5 + .../library/modules/es6.typed.int32-array.js | 5 + .../library/modules/es6.typed.int8-array.js | 5 + .../library/modules/es6.typed.uint16-array.js | 5 + .../library/modules/es6.typed.uint32-array.js | 5 + .../library/modules/es6.typed.uint8-array.js | 5 + .../modules/es6.typed.uint8-clamped-array.js | 5 + .../core-js/library/modules/es6.weak-map.js | 59 + .../core-js/library/modules/es6.weak-set.js | 14 + .../library/modules/es7.array.flat-map.js | 22 + .../library/modules/es7.array.flatten.js | 21 + .../library/modules/es7.array.includes.js | 12 + .../core-js/library/modules/es7.asap.js | 12 + .../library/modules/es7.error.is-error.js | 9 + .../core-js/library/modules/es7.global.js | 4 + .../core-js/library/modules/es7.map.from.js | 2 + .../core-js/library/modules/es7.map.of.js | 2 + .../library/modules/es7.map.to-json.js | 4 + .../core-js/library/modules/es7.math.clamp.js | 8 + .../library/modules/es7.math.deg-per-rad.js | 4 + .../library/modules/es7.math.degrees.js | 9 + .../library/modules/es7.math.fscale.js | 10 + .../core-js/library/modules/es7.math.iaddh.js | 11 + .../core-js/library/modules/es7.math.imulh.js | 16 + .../core-js/library/modules/es7.math.isubh.js | 11 + .../library/modules/es7.math.rad-per-deg.js | 4 + .../library/modules/es7.math.radians.js | 9 + .../core-js/library/modules/es7.math.scale.js | 4 + .../library/modules/es7.math.signbit.js | 7 + .../core-js/library/modules/es7.math.umulh.js | 16 + .../modules/es7.object.define-getter.js | 12 + .../modules/es7.object.define-setter.js | 12 + .../library/modules/es7.object.entries.js | 9 + ...es7.object.get-own-property-descriptors.js | 22 + .../modules/es7.object.lookup-getter.js | 18 + .../modules/es7.object.lookup-setter.js | 18 + .../library/modules/es7.object.values.js | 9 + .../core-js/library/modules/es7.observable.js | 199 + .../library/modules/es7.promise.finally.js | 20 + .../library/modules/es7.promise.try.js | 12 + .../modules/es7.reflect.define-metadata.js | 8 + .../modules/es7.reflect.delete-metadata.js | 15 + .../modules/es7.reflect.get-metadata-keys.js | 19 + .../modules/es7.reflect.get-metadata.js | 17 + .../es7.reflect.get-own-metadata-keys.js | 8 + .../modules/es7.reflect.get-own-metadata.js | 9 + .../modules/es7.reflect.has-metadata.js | 16 + .../modules/es7.reflect.has-own-metadata.js | 9 + .../library/modules/es7.reflect.metadata.js | 15 + .../core-js/library/modules/es7.set.from.js | 2 + .../core-js/library/modules/es7.set.of.js | 2 + .../library/modules/es7.set.to-json.js | 4 + .../core-js/library/modules/es7.string.at.js | 10 + .../library/modules/es7.string.match-all.js | 30 + .../library/modules/es7.string.pad-end.js | 12 + .../library/modules/es7.string.pad-start.js | 12 + .../library/modules/es7.string.trim-left.js | 7 + .../library/modules/es7.string.trim-right.js | 7 + .../modules/es7.symbol.async-iterator.js | 1 + .../library/modules/es7.symbol.observable.js | 1 + .../library/modules/es7.system.global.js | 4 + .../library/modules/es7.weak-map.from.js | 2 + .../library/modules/es7.weak-map.of.js | 2 + .../library/modules/es7.weak-set.from.js | 2 + .../library/modules/es7.weak-set.of.js | 2 + .../library/modules/web.dom.iterable.js | 19 + .../core-js/library/modules/web.immediate.js | 6 + .../core-js/library/modules/web.timers.js | 20 + node_modules/core-js/library/shim.js | 197 + node_modules/core-js/library/stage/0.js | 10 + node_modules/core-js/library/stage/1.js | 23 + node_modules/core-js/library/stage/2.js | 4 + node_modules/core-js/library/stage/3.js | 4 + node_modules/core-js/library/stage/4.js | 11 + node_modules/core-js/library/stage/index.js | 1 + node_modules/core-js/library/stage/pre.js | 10 + .../core-js/library/web/dom-collections.js | 2 + node_modules/core-js/library/web/immediate.js | 2 + node_modules/core-js/library/web/index.js | 4 + node_modules/core-js/library/web/timers.js | 2 + node_modules/core-js/modules/_a-function.js | 4 + .../core-js/modules/_a-number-value.js | 5 + .../core-js/modules/_add-to-unscopables.js | 7 + node_modules/core-js/modules/_an-instance.js | 5 + node_modules/core-js/modules/_an-object.js | 5 + .../core-js/modules/_array-copy-within.js | 26 + node_modules/core-js/modules/_array-fill.js | 15 + .../core-js/modules/_array-from-iterable.js | 7 + .../core-js/modules/_array-includes.js | 23 + .../core-js/modules/_array-methods.js | 44 + node_modules/core-js/modules/_array-reduce.js | 28 + .../modules/_array-species-constructor.js | 16 + .../core-js/modules/_array-species-create.js | 6 + node_modules/core-js/modules/_bind.js | 25 + node_modules/core-js/modules/_classof.js | 23 + node_modules/core-js/modules/_cof.js | 5 + .../core-js/modules/_collection-strong.js | 144 + .../core-js/modules/_collection-to-json.js | 9 + .../core-js/modules/_collection-weak.js | 85 + node_modules/core-js/modules/_collection.js | 85 + node_modules/core-js/modules/_core.js | 2 + .../core-js/modules/_create-property.js | 8 + node_modules/core-js/modules/_ctx.js | 20 + .../core-js/modules/_date-to-iso-string.js | 26 + .../core-js/modules/_date-to-primitive.js | 9 + node_modules/core-js/modules/_defined.js | 5 + node_modules/core-js/modules/_descriptors.js | 4 + node_modules/core-js/modules/_dom-create.js | 7 + .../core-js/modules/_entry-virtual.js | 5 + .../core-js/modules/_enum-bug-keys.js | 4 + node_modules/core-js/modules/_enum-keys.js | 15 + node_modules/core-js/modules/_export.js | 43 + .../core-js/modules/_fails-is-regexp.js | 12 + node_modules/core-js/modules/_fails.js | 7 + node_modules/core-js/modules/_fix-re-wks.js | 28 + node_modules/core-js/modules/_flags.js | 13 + .../core-js/modules/_flatten-into-array.js | 39 + node_modules/core-js/modules/_for-of.js | 25 + node_modules/core-js/modules/_global.js | 6 + node_modules/core-js/modules/_has.js | 4 + node_modules/core-js/modules/_hide.js | 8 + node_modules/core-js/modules/_html.js | 2 + .../core-js/modules/_ie8-dom-define.js | 3 + .../core-js/modules/_inherit-if-required.js | 9 + node_modules/core-js/modules/_invoke.js | 16 + node_modules/core-js/modules/_iobject.js | 6 + .../core-js/modules/_is-array-iter.js | 8 + node_modules/core-js/modules/_is-array.js | 5 + node_modules/core-js/modules/_is-integer.js | 6 + node_modules/core-js/modules/_is-object.js | 3 + node_modules/core-js/modules/_is-regexp.js | 8 + node_modules/core-js/modules/_iter-call.js | 12 + node_modules/core-js/modules/_iter-create.js | 13 + node_modules/core-js/modules/_iter-define.js | 70 + node_modules/core-js/modules/_iter-detect.js | 22 + node_modules/core-js/modules/_iter-step.js | 3 + node_modules/core-js/modules/_iterators.js | 1 + node_modules/core-js/modules/_keyof.js | 10 + node_modules/core-js/modules/_library.js | 1 + node_modules/core-js/modules/_math-expm1.js | 10 + node_modules/core-js/modules/_math-fround.js | 23 + node_modules/core-js/modules/_math-log1p.js | 4 + node_modules/core-js/modules/_math-scale.js | 18 + node_modules/core-js/modules/_math-sign.js | 5 + node_modules/core-js/modules/_meta.js | 53 + node_modules/core-js/modules/_metadata.js | 51 + node_modules/core-js/modules/_microtask.js | 68 + .../modules/_new-promise-capability.js | 18 + .../core-js/modules/_object-assign.js | 34 + .../core-js/modules/_object-create.js | 41 + .../core-js/modules/_object-define.js | 13 + node_modules/core-js/modules/_object-dp.js | 16 + node_modules/core-js/modules/_object-dps.js | 13 + .../core-js/modules/_object-forced-pam.js | 9 + node_modules/core-js/modules/_object-gopd.js | 16 + .../core-js/modules/_object-gopn-ext.js | 19 + node_modules/core-js/modules/_object-gopn.js | 7 + node_modules/core-js/modules/_object-gops.js | 1 + node_modules/core-js/modules/_object-gpo.js | 13 + .../core-js/modules/_object-keys-internal.js | 17 + node_modules/core-js/modules/_object-keys.js | 7 + node_modules/core-js/modules/_object-pie.js | 1 + node_modules/core-js/modules/_object-sap.js | 10 + .../core-js/modules/_object-to-array.js | 16 + node_modules/core-js/modules/_own-keys.js | 10 + node_modules/core-js/modules/_parse-float.js | 8 + node_modules/core-js/modules/_parse-int.js | 9 + node_modules/core-js/modules/_partial.js | 25 + node_modules/core-js/modules/_path.js | 1 + node_modules/core-js/modules/_perform.js | 7 + .../core-js/modules/_promise-resolve.js | 12 + .../core-js/modules/_property-desc.js | 8 + node_modules/core-js/modules/_redefine-all.js | 5 + node_modules/core-js/modules/_redefine.js | 31 + node_modules/core-js/modules/_replacer.js | 8 + node_modules/core-js/modules/_same-value.js | 5 + .../core-js/modules/_set-collection-from.js | 28 + .../core-js/modules/_set-collection-of.js | 12 + node_modules/core-js/modules/_set-proto.js | 25 + node_modules/core-js/modules/_set-species.js | 13 + .../core-js/modules/_set-to-string-tag.js | 7 + node_modules/core-js/modules/_shared-key.js | 5 + node_modules/core-js/modules/_shared.js | 6 + .../core-js/modules/_species-constructor.js | 9 + .../core-js/modules/_strict-method.js | 9 + node_modules/core-js/modules/_string-at.js | 17 + .../core-js/modules/_string-context.js | 8 + node_modules/core-js/modules/_string-html.js | 19 + node_modules/core-js/modules/_string-pad.js | 16 + .../core-js/modules/_string-repeat.js | 12 + node_modules/core-js/modules/_string-trim.js | 30 + node_modules/core-js/modules/_string-ws.js | 2 + node_modules/core-js/modules/_task.js | 84 + .../core-js/modules/_to-absolute-index.js | 7 + node_modules/core-js/modules/_to-index.js | 10 + node_modules/core-js/modules/_to-integer.js | 6 + node_modules/core-js/modules/_to-iobject.js | 6 + node_modules/core-js/modules/_to-length.js | 6 + node_modules/core-js/modules/_to-object.js | 5 + node_modules/core-js/modules/_to-primitive.js | 12 + node_modules/core-js/modules/_typed-array.js | 480 + node_modules/core-js/modules/_typed-buffer.js | 276 + node_modules/core-js/modules/_typed.js | 28 + node_modules/core-js/modules/_uid.js | 5 + node_modules/core-js/modules/_user-agent.js | 4 + .../core-js/modules/_validate-collection.js | 5 + node_modules/core-js/modules/_wks-define.js | 9 + node_modules/core-js/modules/_wks-ext.js | 1 + node_modules/core-js/modules/_wks.js | 11 + node_modules/core-js/modules/core.delay.js | 12 + node_modules/core-js/modules/core.dict.js | 157 + .../core-js/modules/core.function.part.js | 7 + .../modules/core.get-iterator-method.js | 8 + .../core-js/modules/core.get-iterator.js | 7 + .../core-js/modules/core.is-iterable.js | 10 + .../core-js/modules/core.number.iterator.js | 9 + .../core-js/modules/core.object.classof.js | 3 + .../core-js/modules/core.object.define.js | 4 + .../core-js/modules/core.object.is-object.js | 3 + .../core-js/modules/core.object.make.js | 9 + .../core-js/modules/core.regexp.escape.js | 5 + .../modules/core.string.escape-html.js | 11 + .../modules/core.string.unescape-html.js | 11 + node_modules/core-js/modules/es5.js | 35 + .../core-js/modules/es6.array.copy-within.js | 6 + .../core-js/modules/es6.array.every.js | 10 + .../core-js/modules/es6.array.fill.js | 6 + .../core-js/modules/es6.array.filter.js | 10 + .../core-js/modules/es6.array.find-index.js | 14 + .../core-js/modules/es6.array.find.js | 14 + .../core-js/modules/es6.array.for-each.js | 11 + .../core-js/modules/es6.array.from.js | 37 + .../core-js/modules/es6.array.index-of.js | 15 + .../core-js/modules/es6.array.is-array.js | 4 + .../core-js/modules/es6.array.iterator.js | 34 + .../core-js/modules/es6.array.join.js | 12 + .../modules/es6.array.last-index-of.js | 22 + node_modules/core-js/modules/es6.array.map.js | 10 + node_modules/core-js/modules/es6.array.of.js | 19 + .../core-js/modules/es6.array.reduce-right.js | 10 + .../core-js/modules/es6.array.reduce.js | 10 + .../core-js/modules/es6.array.slice.js | 28 + .../core-js/modules/es6.array.some.js | 10 + .../core-js/modules/es6.array.sort.js | 23 + .../core-js/modules/es6.array.species.js | 1 + node_modules/core-js/modules/es6.date.now.js | 4 + .../core-js/modules/es6.date.to-iso-string.js | 8 + .../core-js/modules/es6.date.to-json.js | 16 + .../core-js/modules/es6.date.to-primitive.js | 4 + .../core-js/modules/es6.date.to-string.js | 12 + .../core-js/modules/es6.function.bind.js | 4 + .../modules/es6.function.has-instance.js | 13 + .../core-js/modules/es6.function.name.js | 16 + node_modules/core-js/modules/es6.map.js | 19 + .../core-js/modules/es6.math.acosh.js | 18 + .../core-js/modules/es6.math.asinh.js | 10 + .../core-js/modules/es6.math.atanh.js | 10 + node_modules/core-js/modules/es6.math.cbrt.js | 9 + .../core-js/modules/es6.math.clz32.js | 8 + node_modules/core-js/modules/es6.math.cosh.js | 9 + .../core-js/modules/es6.math.expm1.js | 5 + .../core-js/modules/es6.math.fround.js | 4 + .../core-js/modules/es6.math.hypot.js | 25 + node_modules/core-js/modules/es6.math.imul.js | 17 + .../core-js/modules/es6.math.log10.js | 8 + .../core-js/modules/es6.math.log1p.js | 4 + node_modules/core-js/modules/es6.math.log2.js | 8 + node_modules/core-js/modules/es6.math.sign.js | 4 + node_modules/core-js/modules/es6.math.sinh.js | 15 + node_modules/core-js/modules/es6.math.tanh.js | 12 + .../core-js/modules/es6.math.trunc.js | 8 + .../core-js/modules/es6.number.constructor.js | 69 + .../core-js/modules/es6.number.epsilon.js | 4 + .../core-js/modules/es6.number.is-finite.js | 9 + .../core-js/modules/es6.number.is-integer.js | 4 + .../core-js/modules/es6.number.is-nan.js | 9 + .../modules/es6.number.is-safe-integer.js | 10 + .../modules/es6.number.max-safe-integer.js | 4 + .../modules/es6.number.min-safe-integer.js | 4 + .../core-js/modules/es6.number.parse-float.js | 4 + .../core-js/modules/es6.number.parse-int.js | 4 + .../core-js/modules/es6.number.to-fixed.js | 114 + .../modules/es6.number.to-precision.js | 18 + .../core-js/modules/es6.object.assign.js | 4 + .../core-js/modules/es6.object.create.js | 3 + .../modules/es6.object.define-properties.js | 3 + .../modules/es6.object.define-property.js | 3 + .../core-js/modules/es6.object.freeze.js | 9 + .../es6.object.get-own-property-descriptor.js | 9 + .../es6.object.get-own-property-names.js | 4 + .../modules/es6.object.get-prototype-of.js | 9 + .../modules/es6.object.is-extensible.js | 8 + .../core-js/modules/es6.object.is-frozen.js | 8 + .../core-js/modules/es6.object.is-sealed.js | 8 + node_modules/core-js/modules/es6.object.is.js | 3 + .../core-js/modules/es6.object.keys.js | 9 + .../modules/es6.object.prevent-extensions.js | 9 + .../core-js/modules/es6.object.seal.js | 9 + .../modules/es6.object.set-prototype-of.js | 3 + .../core-js/modules/es6.object.to-string.js | 10 + .../core-js/modules/es6.parse-float.js | 4 + node_modules/core-js/modules/es6.parse-int.js | 4 + node_modules/core-js/modules/es6.promise.js | 273 + .../core-js/modules/es6.reflect.apply.js | 16 + .../core-js/modules/es6.reflect.construct.js | 47 + .../modules/es6.reflect.define-property.js | 23 + .../modules/es6.reflect.delete-property.js | 11 + .../core-js/modules/es6.reflect.enumerate.js | 26 + ...es6.reflect.get-own-property-descriptor.js | 10 + .../modules/es6.reflect.get-prototype-of.js | 10 + .../core-js/modules/es6.reflect.get.js | 21 + .../core-js/modules/es6.reflect.has.js | 8 + .../modules/es6.reflect.is-extensible.js | 11 + .../core-js/modules/es6.reflect.own-keys.js | 4 + .../modules/es6.reflect.prevent-extensions.js | 16 + .../modules/es6.reflect.set-prototype-of.js | 15 + .../core-js/modules/es6.reflect.set.js | 31 + .../core-js/modules/es6.regexp.constructor.js | 43 + .../core-js/modules/es6.regexp.flags.js | 5 + .../core-js/modules/es6.regexp.match.js | 10 + .../core-js/modules/es6.regexp.replace.js | 12 + .../core-js/modules/es6.regexp.search.js | 10 + .../core-js/modules/es6.regexp.split.js | 71 + .../core-js/modules/es6.regexp.to-string.js | 25 + node_modules/core-js/modules/es6.set.js | 14 + .../core-js/modules/es6.string.anchor.js | 7 + .../core-js/modules/es6.string.big.js | 7 + .../core-js/modules/es6.string.blink.js | 7 + .../core-js/modules/es6.string.bold.js | 7 + .../modules/es6.string.code-point-at.js | 9 + .../core-js/modules/es6.string.ends-with.js | 20 + .../core-js/modules/es6.string.fixed.js | 7 + .../core-js/modules/es6.string.fontcolor.js | 7 + .../core-js/modules/es6.string.fontsize.js | 7 + .../modules/es6.string.from-code-point.js | 23 + .../core-js/modules/es6.string.includes.js | 12 + .../core-js/modules/es6.string.italics.js | 7 + .../core-js/modules/es6.string.iterator.js | 17 + .../core-js/modules/es6.string.link.js | 7 + .../core-js/modules/es6.string.raw.js | 18 + .../core-js/modules/es6.string.repeat.js | 6 + .../core-js/modules/es6.string.small.js | 7 + .../core-js/modules/es6.string.starts-with.js | 18 + .../core-js/modules/es6.string.strike.js | 7 + .../core-js/modules/es6.string.sub.js | 7 + .../core-js/modules/es6.string.sup.js | 7 + .../core-js/modules/es6.string.trim.js | 7 + node_modules/core-js/modules/es6.symbol.js | 234 + .../core-js/modules/es6.typed.array-buffer.js | 46 + .../core-js/modules/es6.typed.data-view.js | 4 + .../modules/es6.typed.float32-array.js | 5 + .../modules/es6.typed.float64-array.js | 5 + .../core-js/modules/es6.typed.int16-array.js | 5 + .../core-js/modules/es6.typed.int32-array.js | 5 + .../core-js/modules/es6.typed.int8-array.js | 5 + .../core-js/modules/es6.typed.uint16-array.js | 5 + .../core-js/modules/es6.typed.uint32-array.js | 5 + .../core-js/modules/es6.typed.uint8-array.js | 5 + .../modules/es6.typed.uint8-clamped-array.js | 5 + node_modules/core-js/modules/es6.weak-map.js | 59 + node_modules/core-js/modules/es6.weak-set.js | 14 + .../core-js/modules/es7.array.flat-map.js | 22 + .../core-js/modules/es7.array.flatten.js | 21 + .../core-js/modules/es7.array.includes.js | 12 + node_modules/core-js/modules/es7.asap.js | 12 + .../core-js/modules/es7.error.is-error.js | 9 + node_modules/core-js/modules/es7.global.js | 4 + node_modules/core-js/modules/es7.map.from.js | 2 + node_modules/core-js/modules/es7.map.of.js | 2 + .../core-js/modules/es7.map.to-json.js | 4 + .../core-js/modules/es7.math.clamp.js | 8 + .../core-js/modules/es7.math.deg-per-rad.js | 4 + .../core-js/modules/es7.math.degrees.js | 9 + .../core-js/modules/es7.math.fscale.js | 10 + .../core-js/modules/es7.math.iaddh.js | 11 + .../core-js/modules/es7.math.imulh.js | 16 + .../core-js/modules/es7.math.isubh.js | 11 + .../core-js/modules/es7.math.rad-per-deg.js | 4 + .../core-js/modules/es7.math.radians.js | 9 + .../core-js/modules/es7.math.scale.js | 4 + .../core-js/modules/es7.math.signbit.js | 7 + .../core-js/modules/es7.math.umulh.js | 16 + .../modules/es7.object.define-getter.js | 12 + .../modules/es7.object.define-setter.js | 12 + .../core-js/modules/es7.object.entries.js | 9 + ...es7.object.get-own-property-descriptors.js | 22 + .../modules/es7.object.lookup-getter.js | 18 + .../modules/es7.object.lookup-setter.js | 18 + .../core-js/modules/es7.object.values.js | 9 + .../core-js/modules/es7.observable.js | 199 + .../core-js/modules/es7.promise.finally.js | 20 + .../core-js/modules/es7.promise.try.js | 12 + .../modules/es7.reflect.define-metadata.js | 8 + .../modules/es7.reflect.delete-metadata.js | 15 + .../modules/es7.reflect.get-metadata-keys.js | 19 + .../modules/es7.reflect.get-metadata.js | 17 + .../es7.reflect.get-own-metadata-keys.js | 8 + .../modules/es7.reflect.get-own-metadata.js | 9 + .../modules/es7.reflect.has-metadata.js | 16 + .../modules/es7.reflect.has-own-metadata.js | 9 + .../core-js/modules/es7.reflect.metadata.js | 15 + node_modules/core-js/modules/es7.set.from.js | 2 + node_modules/core-js/modules/es7.set.of.js | 2 + .../core-js/modules/es7.set.to-json.js | 4 + node_modules/core-js/modules/es7.string.at.js | 10 + .../core-js/modules/es7.string.match-all.js | 30 + .../core-js/modules/es7.string.pad-end.js | 12 + .../core-js/modules/es7.string.pad-start.js | 12 + .../core-js/modules/es7.string.trim-left.js | 7 + .../core-js/modules/es7.string.trim-right.js | 7 + .../modules/es7.symbol.async-iterator.js | 1 + .../core-js/modules/es7.symbol.observable.js | 1 + .../core-js/modules/es7.system.global.js | 4 + .../core-js/modules/es7.weak-map.from.js | 2 + .../core-js/modules/es7.weak-map.of.js | 2 + .../core-js/modules/es7.weak-set.from.js | 2 + .../core-js/modules/es7.weak-set.of.js | 2 + .../modules/library/_add-to-unscopables.js | 1 + .../core-js/modules/library/_collection.js | 59 + .../core-js/modules/library/_export.js | 61 + .../core-js/modules/library/_library.js | 1 + node_modules/core-js/modules/library/_path.js | 1 + .../core-js/modules/library/_redefine-all.js | 7 + .../core-js/modules/library/_redefine.js | 1 + .../core-js/modules/library/_set-species.js | 14 + .../modules/library/es6.date.to-json.js | 19 + .../modules/library/es6.date.to-primitive.js | 0 .../modules/library/es6.date.to-string.js | 0 .../modules/library/es6.function.name.js | 0 .../modules/library/es6.number.constructor.js | 0 .../modules/library/es6.object.to-string.js | 0 .../modules/library/es6.regexp.constructor.js | 1 + .../modules/library/es6.regexp.flags.js | 0 .../modules/library/es6.regexp.match.js | 0 .../modules/library/es6.regexp.replace.js | 0 .../modules/library/es6.regexp.search.js | 0 .../modules/library/es6.regexp.split.js | 0 .../modules/library/es6.regexp.to-string.js | 0 .../modules/library/web.dom.iterable.js | 19 + .../core-js/modules/web.dom.iterable.js | 58 + node_modules/core-js/modules/web.immediate.js | 6 + node_modules/core-js/modules/web.timers.js | 20 + node_modules/core-js/package.json | 101 + node_modules/core-js/shim.js | 197 + node_modules/core-js/stage/0.js | 10 + node_modules/core-js/stage/1.js | 23 + node_modules/core-js/stage/2.js | 4 + node_modules/core-js/stage/3.js | 4 + node_modules/core-js/stage/4.js | 11 + node_modules/core-js/stage/index.js | 1 + node_modules/core-js/stage/pre.js | 10 + node_modules/core-js/web/dom-collections.js | 2 + node_modules/core-js/web/immediate.js | 2 + node_modules/core-js/web/index.js | 4 + node_modules/core-js/web/timers.js | 2 + node_modules/core-util-is/LICENSE | 19 + node_modules/core-util-is/README.md | 3 + node_modules/core-util-is/float.patch | 604 + node_modules/core-util-is/lib/util.js | 107 + node_modules/core-util-is/package.json | 62 + node_modules/core-util-is/test.js | 68 + node_modules/create-error-class/index.js | 44 + node_modules/create-error-class/license | 21 + node_modules/create-error-class/package.json | 60 + node_modules/create-error-class/readme.md | 54 + node_modules/cross-spawn/CHANGELOG.md | 6 + node_modules/cross-spawn/LICENSE | 19 + node_modules/cross-spawn/README.md | 85 + node_modules/cross-spawn/index.js | 59 + node_modules/cross-spawn/lib/enoent.js | 73 + node_modules/cross-spawn/lib/parse.js | 113 + .../cross-spawn/lib/util/escapeArgument.js | 30 + .../cross-spawn/lib/util/escapeCommand.js | 12 + .../lib/util/hasEmptyArgumentBug.js | 18 + .../cross-spawn/lib/util/readShebang.js | 37 + .../cross-spawn/lib/util/resolveCommand.js | 31 + node_modules/cross-spawn/package.json | 83 + node_modules/crypto-random-string/index.js | 10 + node_modules/crypto-random-string/license | 21 + .../crypto-random-string/package.json | 75 + node_modules/crypto-random-string/readme.md | 49 + node_modules/debug/.coveralls.yml | 1 + node_modules/debug/.eslintrc | 11 + node_modules/debug/.npmignore | 9 + node_modules/debug/.travis.yml | 14 + node_modules/debug/CHANGELOG.md | 362 + node_modules/debug/LICENSE | 19 + node_modules/debug/Makefile | 50 + node_modules/debug/README.md | 312 + node_modules/debug/component.json | 19 + node_modules/debug/karma.conf.js | 70 + node_modules/debug/node.js | 1 + node_modules/debug/package.json | 93 + node_modules/debug/src/browser.js | 185 + node_modules/debug/src/debug.js | 202 + node_modules/debug/src/index.js | 10 + node_modules/debug/src/inspector-log.js | 15 + node_modules/debug/src/node.js | 248 + node_modules/decamelize/index.js | 13 + node_modules/decamelize/license | 21 + node_modules/decamelize/package.json | 70 + node_modules/decamelize/readme.md | 48 + node_modules/decode-uri-component/index.js | 94 + node_modules/decode-uri-component/license | 21 + .../decode-uri-component/package.json | 69 + node_modules/decode-uri-component/readme.md | 70 + node_modules/deep-extend/CHANGELOG.md | 21 + node_modules/deep-extend/LICENSE | 20 + node_modules/deep-extend/README.md | 90 + node_modules/deep-extend/index.js | 1 + node_modules/deep-extend/lib/deep-extend.js | 144 + node_modules/deep-extend/package.json | 93 + node_modules/define-property/CHANGELOG.md | 82 + node_modules/define-property/LICENSE | 21 + node_modules/define-property/README.md | 117 + node_modules/define-property/index.js | 38 + node_modules/define-property/package.json | 106 + node_modules/depd/History.md | 96 + node_modules/depd/LICENSE | 22 + node_modules/depd/Readme.md | 280 + node_modules/depd/index.js | 522 + node_modules/depd/lib/browser/index.js | 77 + .../depd/lib/compat/callsite-tostring.js | 103 + .../depd/lib/compat/event-listener-count.js | 22 + node_modules/depd/lib/compat/index.js | 79 + node_modules/depd/package.json | 79 + node_modules/destroy/LICENSE | 22 + node_modules/destroy/README.md | 60 + node_modules/destroy/index.js | 75 + node_modules/destroy/package.json | 71 + node_modules/doctypes/.npmignore | 13 + node_modules/doctypes/.travis.yml | 3 + node_modules/doctypes/HISTORY.md | 14 + node_modules/doctypes/LICENSE | 19 + node_modules/doctypes/README.md | 24 + node_modules/doctypes/index.js | 13 + node_modules/doctypes/package.json | 50 + node_modules/doctypes/test.js | 9 + node_modules/dot-prop/index.js | 123 + node_modules/dot-prop/license | 21 + node_modules/dot-prop/package.json | 80 + node_modules/dot-prop/readme.md | 103 + node_modules/duplexer/.npmignore | 3 + node_modules/duplexer/.travis.yml | 6 + node_modules/duplexer/LICENCE | 19 + node_modules/duplexer/README.md | 47 + node_modules/duplexer/index.js | 87 + node_modules/duplexer/package.json | 79 + node_modules/duplexer/test/index.js | 31 + node_modules/duplexer3/LICENSE.md | 26 + node_modules/duplexer3/README.md | 115 + node_modules/duplexer3/index.js | 76 + node_modules/duplexer3/package.json | 64 + node_modules/ee-first/LICENSE | 22 + node_modules/ee-first/README.md | 80 + node_modules/ee-first/index.js | 95 + node_modules/ee-first/package.json | 63 + node_modules/encodeurl/HISTORY.md | 14 + node_modules/encodeurl/LICENSE | 22 + node_modules/encodeurl/README.md | 128 + node_modules/encodeurl/index.js | 60 + node_modules/encodeurl/package.json | 78 + node_modules/escape-html/LICENSE | 24 + node_modules/escape-html/Readme.md | 43 + node_modules/escape-html/index.js | 78 + node_modules/escape-html/package.json | 59 + node_modules/escape-string-regexp/index.js | 11 + node_modules/escape-string-regexp/license | 21 + .../escape-string-regexp/package.json | 81 + node_modules/escape-string-regexp/readme.md | 27 + node_modules/esutils/LICENSE.BSD | 19 + node_modules/esutils/README.md | 169 + node_modules/esutils/lib/ast.js | 144 + node_modules/esutils/lib/code.js | 135 + node_modules/esutils/lib/keyword.js | 165 + node_modules/esutils/lib/utils.js | 33 + node_modules/esutils/package.json | 77 + node_modules/etag/HISTORY.md | 83 + node_modules/etag/LICENSE | 22 + node_modules/etag/README.md | 159 + node_modules/etag/index.js | 131 + node_modules/etag/package.json | 87 + node_modules/event-stream/.npmignore | 3 + node_modules/event-stream/.travis.yml | 3 + node_modules/event-stream/LICENCE | 24 + node_modules/event-stream/examples/pretty.js | 25 + node_modules/event-stream/index.js | 324 + node_modules/event-stream/package.json | 86 + node_modules/event-stream/readme.markdown | 314 + .../event-stream/test/connect.asynct.js | 86 + .../event-stream/test/helper/index.js | 12 + .../event-stream/test/merge.asynct.js | 29 + .../event-stream/test/parse.asynct.js | 32 + .../event-stream/test/pause.asynct.js | 39 + .../event-stream/test/pipeline.asynct.js | 52 + .../event-stream/test/readArray.asynct.js | 89 + .../event-stream/test/readable.asynct.js | 197 + .../event-stream/test/replace.asynct.js | 76 + .../event-stream/test/simple-map.asynct.js | 343 + node_modules/event-stream/test/spec.asynct.js | 86 + .../event-stream/test/split.asynct.js | 47 + node_modules/event-stream/test/stringify.js | 15 + .../event-stream/test/writeArray.asynct.js | 31 + node_modules/execa/index.js | 309 + node_modules/execa/lib/errname.js | 37 + node_modules/execa/lib/stdio.js | 41 + node_modules/execa/license | 9 + node_modules/execa/package.json | 108 + node_modules/execa/readme.md | 279 + node_modules/expand-brackets/LICENSE | 21 + node_modules/expand-brackets/README.md | 302 + node_modules/expand-brackets/changelog.md | 35 + node_modules/expand-brackets/index.js | 211 + node_modules/expand-brackets/lib/compilers.js | 87 + node_modules/expand-brackets/lib/parsers.js | 219 + node_modules/expand-brackets/lib/utils.js | 34 + .../node_modules/define-property/LICENSE | 21 + .../node_modules/define-property/README.md | 77 + .../node_modules/define-property/index.js | 31 + .../node_modules/define-property/package.json | 82 + .../node_modules/extend-shallow/LICENSE | 21 + .../node_modules/extend-shallow/README.md | 61 + .../node_modules/extend-shallow/index.js | 33 + .../node_modules/extend-shallow/package.json | 87 + .../is-accessor-descriptor/LICENSE | 21 + .../is-accessor-descriptor/README.md | 123 + .../is-accessor-descriptor/index.js | 69 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 261 + .../node_modules/kind-of/index.js | 116 + .../node_modules/kind-of/package.json | 139 + .../is-accessor-descriptor/package.json | 94 + .../node_modules/is-data-descriptor/LICENSE | 21 + .../node_modules/is-data-descriptor/README.md | 128 + .../node_modules/is-data-descriptor/index.js | 55 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 261 + .../node_modules/kind-of/index.js | 116 + .../node_modules/kind-of/package.json | 139 + .../is-data-descriptor/package.json | 93 + .../node_modules/is-descriptor/LICENSE | 21 + .../node_modules/is-descriptor/README.md | 193 + .../node_modules/is-descriptor/index.js | 22 + .../node_modules/is-descriptor/package.json | 114 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 342 + .../node_modules/kind-of/index.js | 147 + .../node_modules/kind-of/package.json | 146 + node_modules/expand-brackets/package.json | 133 + node_modules/express/History.md | 3311 +++ node_modules/express/LICENSE | 24 + node_modules/express/Readme.md | 141 + node_modules/express/index.js | 11 + node_modules/express/lib/application.js | 644 + node_modules/express/lib/express.js | 111 + node_modules/express/lib/middleware/init.js | 43 + node_modules/express/lib/middleware/query.js | 47 + node_modules/express/lib/request.js | 517 + node_modules/express/lib/response.js | 1076 + node_modules/express/lib/router/index.js | 662 + node_modules/express/lib/router/layer.js | 181 + node_modules/express/lib/router/route.js | 216 + node_modules/express/lib/utils.js | 298 + node_modules/express/lib/view.js | 174 + .../express/node_modules/qs/.editorconfig | 30 + .../express/node_modules/qs/.eslintignore | 1 + .../express/node_modules/qs/.eslintrc | 18 + .../express/node_modules/qs/CHANGELOG.md | 212 + node_modules/express/node_modules/qs/LICENSE | 28 + .../express/node_modules/qs/README.md | 475 + .../express/node_modules/qs/dist/qs.js | 615 + .../express/node_modules/qs/lib/formats.js | 18 + .../express/node_modules/qs/lib/index.js | 11 + .../express/node_modules/qs/lib/parse.js | 172 + .../express/node_modules/qs/lib/stringify.js | 210 + .../express/node_modules/qs/lib/utils.js | 192 + .../express/node_modules/qs/package.json | 79 + .../express/node_modules/qs/test/.eslintrc | 11 + .../express/node_modules/qs/test/index.js | 7 + .../express/node_modules/qs/test/parse.js | 546 + .../express/node_modules/qs/test/stringify.js | 596 + .../express/node_modules/qs/test/utils.js | 34 + .../express/node_modules/statuses/HISTORY.md | 55 + .../express/node_modules/statuses/LICENSE | 23 + .../express/node_modules/statuses/README.md | 103 + .../express/node_modules/statuses/codes.json | 65 + .../express/node_modules/statuses/index.js | 110 + .../node_modules/statuses/package.json | 83 + node_modules/express/package.json | 152 + node_modules/extend-shallow/LICENSE | 21 + node_modules/extend-shallow/README.md | 97 + node_modules/extend-shallow/index.js | 60 + .../node_modules/is-extendable/LICENSE | 21 + .../node_modules/is-extendable/README.md | 88 + .../node_modules/is-extendable/index.d.ts | 5 + .../node_modules/is-extendable/index.js | 14 + .../node_modules/is-extendable/package.json | 98 + node_modules/extend-shallow/package.json | 126 + node_modules/extglob/LICENSE | 21 + node_modules/extglob/README.md | 362 + node_modules/extglob/changelog.md | 25 + node_modules/extglob/index.js | 331 + node_modules/extglob/lib/compilers.js | 169 + node_modules/extglob/lib/extglob.js | 78 + node_modules/extglob/lib/parsers.js | 156 + node_modules/extglob/lib/utils.js | 69 + .../node_modules/define-property/LICENSE | 21 + .../node_modules/define-property/README.md | 95 + .../node_modules/define-property/index.js | 31 + .../node_modules/define-property/package.json | 93 + .../node_modules/extend-shallow/LICENSE | 21 + .../node_modules/extend-shallow/README.md | 61 + .../node_modules/extend-shallow/index.js | 33 + .../node_modules/extend-shallow/package.json | 87 + node_modules/extglob/package.json | 160 + node_modules/fill-range/LICENSE | 21 + node_modules/fill-range/README.md | 250 + node_modules/fill-range/index.js | 208 + .../node_modules/extend-shallow/LICENSE | 21 + .../node_modules/extend-shallow/README.md | 61 + .../node_modules/extend-shallow/index.js | 33 + .../node_modules/extend-shallow/package.json | 87 + node_modules/fill-range/package.json | 130 + node_modules/finalhandler/HISTORY.md | 167 + node_modules/finalhandler/LICENSE | 22 + node_modules/finalhandler/README.md | 148 + node_modules/finalhandler/index.js | 300 + .../node_modules/statuses/HISTORY.md | 55 + .../node_modules/statuses/LICENSE | 23 + .../node_modules/statuses/README.md | 103 + .../node_modules/statuses/codes.json | 65 + .../node_modules/statuses/index.js | 110 + .../node_modules/statuses/package.json | 83 + node_modules/finalhandler/package.json | 80 + node_modules/for-in/LICENSE | 21 + node_modules/for-in/README.md | 85 + node_modules/for-in/index.js | 16 + node_modules/for-in/package.json | 106 + node_modules/forwarded/HISTORY.md | 16 + node_modules/forwarded/LICENSE | 22 + node_modules/forwarded/README.md | 57 + node_modules/forwarded/index.js | 76 + node_modules/forwarded/package.json | 78 + node_modules/fragment-cache/LICENSE | 21 + node_modules/fragment-cache/README.md | 156 + node_modules/fragment-cache/index.js | 128 + node_modules/fragment-cache/package.json | 93 + node_modules/fresh/HISTORY.md | 70 + node_modules/fresh/LICENSE | 23 + node_modules/fresh/README.md | 119 + node_modules/fresh/index.js | 137 + node_modules/fresh/package.json | 91 + node_modules/from/.npmignore | 1 + node_modules/from/.travis.yml | 6 + node_modules/from/LICENSE.APACHE2 | 15 + node_modules/from/LICENSE.MIT | 24 + node_modules/from/index.js | 68 + node_modules/from/package.json | 59 + node_modules/from/readme.markdown | 40 + node_modules/from/test/index.js | 210 + node_modules/fsevents/.npmignore | 1 + node_modules/fsevents/.travis.yml | 102 + node_modules/fsevents/ISSUE_TEMPLATE.md | 8 + node_modules/fsevents/LICENSE | 22 + node_modules/fsevents/Readme.md | 78 + node_modules/fsevents/binding.gyp | 29 + node_modules/fsevents/build/.target.mk | 53 + node_modules/fsevents/build/Makefile | 352 + .../build/Release/.deps/Release/.node.d | 1 + .../build/Release/.deps/Release/fse.node.d | 1 + .../obj.target/action_after_build.stamp.d | 1 + .../.deps/Release/obj.target/fse/fsevents.o.d | 65 + .../Release/node-v48-darwin-x64/fse.node.d | 1 + node_modules/fsevents/build/Release/.node | Bin 0 -> 4144 bytes node_modules/fsevents/build/Release/fse.node | Bin 0 -> 38328 bytes .../obj.target/action_after_build.stamp | 0 .../build/Release/obj.target/fse/fsevents.o | Bin 0 -> 301752 bytes .../build/action_after_build.target.mk | 32 + node_modules/fsevents/build/binding.Makefile | 6 + node_modules/fsevents/build/fse.target.mk | 179 + node_modules/fsevents/build/gyp-mac-tool | 611 + .../fse-v1.1.2-node-v48-darwin-x64.tar.gz | Bin 0 -> 10817 bytes node_modules/fsevents/fsevents.cc | 102 + node_modules/fsevents/fsevents.js | 108 + node_modules/fsevents/install.js | 7 + .../Release/node-v11-darwin-x64/fse.node | Bin 0 -> 33384 bytes .../Release/node-v46-darwin-x64/fse.node | Bin 0 -> 34672 bytes .../Release/node-v47-darwin-x64/fse.node | Bin 0 -> 34672 bytes .../Release/node-v48-darwin-x64/fse.node | Bin 0 -> 38328 bytes .../Release/node-v57-darwin-x64/fse.node | Bin 0 -> 40736 bytes .../fsevents/node_modules/.bin/detect-libc | 1 + .../fsevents/node_modules/.bin/mkdirp | 1 + .../fsevents/node_modules/.bin/node-pre-gyp | 1 + node_modules/fsevents/node_modules/.bin/nopt | 1 + node_modules/fsevents/node_modules/.bin/rc | 1 + .../fsevents/node_modules/.bin/rimraf | 1 + .../fsevents/node_modules/.bin/semver | 1 + .../fsevents/node_modules/.bin/sshpk-conv | 1 + .../fsevents/node_modules/.bin/sshpk-sign | 1 + .../fsevents/node_modules/.bin/sshpk-verify | 1 + node_modules/fsevents/node_modules/.bin/uuid | 1 + .../fsevents/node_modules/abbrev/LICENSE | 15 + .../fsevents/node_modules/abbrev/README.md | 23 + .../fsevents/node_modules/abbrev/abbrev.js | 61 + .../fsevents/node_modules/abbrev/package.json | 59 + .../node_modules/ajv/.tonic_example.js | 20 + .../fsevents/node_modules/ajv/LICENSE | 22 + .../fsevents/node_modules/ajv/README.md | 1213 + .../node_modules/ajv/dist/ajv.bundle.js | 8023 +++++++ .../fsevents/node_modules/ajv/dist/ajv.min.js | 6 + .../node_modules/ajv/dist/ajv.min.js.map | 1 + .../node_modules/ajv/dist/nodent.min.js | 8 + .../node_modules/ajv/dist/regenerator.min.js | 32 + .../fsevents/node_modules/ajv/lib/ajv.d.ts | 284 + .../fsevents/node_modules/ajv/lib/ajv.js | 420 + .../fsevents/node_modules/ajv/lib/async.js | 218 + .../fsevents/node_modules/ajv/lib/cache.js | 26 + .../node_modules/ajv/lib/compile/_rules.js | 28 + .../node_modules/ajv/lib/compile/equal.js | 45 + .../node_modules/ajv/lib/compile/formats.js | 164 + .../node_modules/ajv/lib/compile/index.js | 390 + .../node_modules/ajv/lib/compile/resolve.js | 267 + .../node_modules/ajv/lib/compile/rules.js | 40 + .../ajv/lib/compile/schema_obj.js | 9 + .../ajv/lib/compile/ucs2length.js | 20 + .../node_modules/ajv/lib/compile/util.js | 257 + .../ajv/lib/compile/validation_error.js | 14 + .../node_modules/ajv/lib/dot/_limit.jst | 49 + .../node_modules/ajv/lib/dot/_limitItems.jst | 10 + .../node_modules/ajv/lib/dot/_limitLength.jst | 10 + .../ajv/lib/dot/_limitProperties.jst | 10 + .../node_modules/ajv/lib/dot/allOf.jst | 34 + .../node_modules/ajv/lib/dot/anyOf.jst | 48 + .../node_modules/ajv/lib/dot/coerce.def | 61 + .../node_modules/ajv/lib/dot/custom.jst | 184 + .../node_modules/ajv/lib/dot/defaults.def | 32 + .../node_modules/ajv/lib/dot/definitions.def | 182 + .../node_modules/ajv/lib/dot/dependencies.jst | 69 + .../node_modules/ajv/lib/dot/enum.jst | 30 + .../node_modules/ajv/lib/dot/errors.def | 185 + .../node_modules/ajv/lib/dot/format.jst | 100 + .../node_modules/ajv/lib/dot/items.jst | 101 + .../node_modules/ajv/lib/dot/missing.def | 34 + .../node_modules/ajv/lib/dot/multipleOf.jst | 20 + .../fsevents/node_modules/ajv/lib/dot/not.jst | 43 + .../node_modules/ajv/lib/dot/oneOf.jst | 44 + .../node_modules/ajv/lib/dot/pattern.jst | 14 + .../node_modules/ajv/lib/dot/properties.jst | 319 + .../fsevents/node_modules/ajv/lib/dot/ref.jst | 86 + .../node_modules/ajv/lib/dot/required.jst | 96 + .../node_modules/ajv/lib/dot/uniqueItems.jst | 38 + .../ajv/lib/dot/v5/_formatLimit.jst | 116 + .../node_modules/ajv/lib/dot/v5/constant.jst | 10 + .../ajv/lib/dot/v5/patternRequired.jst | 28 + .../node_modules/ajv/lib/dot/v5/switch.jst | 73 + .../node_modules/ajv/lib/dot/validate.jst | 210 + .../node_modules/ajv/lib/dotjs/README.md | 3 + .../ajv/lib/dotjs/_formatLimit.js | 176 + .../node_modules/ajv/lib/dotjs/_limit.js | 124 + .../node_modules/ajv/lib/dotjs/_limitItems.js | 76 + .../ajv/lib/dotjs/_limitLength.js | 81 + .../ajv/lib/dotjs/_limitProperties.js | 76 + .../node_modules/ajv/lib/dotjs/allOf.js | 43 + .../node_modules/ajv/lib/dotjs/anyOf.js | 65 + .../node_modules/ajv/lib/dotjs/constant.js | 52 + .../node_modules/ajv/lib/dotjs/custom.js | 220 + .../ajv/lib/dotjs/dependencies.js | 147 + .../node_modules/ajv/lib/dotjs/enum.js | 65 + .../node_modules/ajv/lib/dotjs/format.js | 138 + .../node_modules/ajv/lib/dotjs/items.js | 144 + .../node_modules/ajv/lib/dotjs/multipleOf.js | 76 + .../node_modules/ajv/lib/dotjs/not.js | 83 + .../node_modules/ajv/lib/dotjs/oneOf.js | 76 + .../node_modules/ajv/lib/dotjs/pattern.js | 74 + .../ajv/lib/dotjs/patternRequired.js | 51 + .../node_modules/ajv/lib/dotjs/properties.js | 445 + .../node_modules/ajv/lib/dotjs/ref.js | 119 + .../node_modules/ajv/lib/dotjs/required.js | 249 + .../node_modules/ajv/lib/dotjs/switch.js | 128 + .../node_modules/ajv/lib/dotjs/uniqueItems.js | 71 + .../node_modules/ajv/lib/dotjs/validate.js | 375 + .../fsevents/node_modules/ajv/lib/keyword.js | 129 + .../ajv/lib/refs/json-schema-draft-04.json | 150 + .../ajv/lib/refs/json-schema-v5.json | 328 + .../fsevents/node_modules/ajv/lib/v5.js | 52 + .../fsevents/node_modules/ajv/package.json | 134 + .../node_modules/ajv/scripts/.eslintrc.yml | 3 + .../node_modules/ajv/scripts/bundle.js | 54 + .../node_modules/ajv/scripts/compile-dots.js | 73 + .../fsevents/node_modules/ajv/scripts/info | 10 + .../node_modules/ajv/scripts/prepare-tests | 9 + .../node_modules/ajv/scripts/travis-gh-pages | 23 + .../fsevents/node_modules/ansi-regex/index.js | 4 + .../fsevents/node_modules/ansi-regex/license | 21 + .../node_modules/ansi-regex/package.json | 111 + .../node_modules/ansi-regex/readme.md | 39 + .../fsevents/node_modules/aproba/LICENSE | 14 + .../fsevents/node_modules/aproba/README.md | 89 + .../fsevents/node_modules/aproba/index.js | 103 + .../fsevents/node_modules/aproba/package.json | 65 + .../node_modules/are-we-there-yet/CHANGES.md | 31 + .../node_modules/are-we-there-yet/CHANGES.md~ | 27 + .../node_modules/are-we-there-yet/LICENSE | 5 + .../node_modules/are-we-there-yet/README.md | 195 + .../node_modules/are-we-there-yet/index.js | 4 + .../are-we-there-yet/package.json | 66 + .../are-we-there-yet/tracker-base.js | 11 + .../are-we-there-yet/tracker-group.js | 107 + .../are-we-there-yet/tracker-stream.js | 35 + .../node_modules/are-we-there-yet/tracker.js | 30 + .../fsevents/node_modules/asn1/.npmignore | 2 + .../fsevents/node_modules/asn1/.travis.yml | 4 + .../fsevents/node_modules/asn1/LICENSE | 19 + .../fsevents/node_modules/asn1/README.md | 50 + .../node_modules/asn1/lib/ber/errors.js | 13 + .../node_modules/asn1/lib/ber/index.js | 27 + .../node_modules/asn1/lib/ber/reader.js | 261 + .../node_modules/asn1/lib/ber/types.js | 36 + .../node_modules/asn1/lib/ber/writer.js | 316 + .../fsevents/node_modules/asn1/lib/index.js | 20 + .../fsevents/node_modules/asn1/package.json | 68 + .../node_modules/asn1/tst/ber/reader.test.js | 208 + .../node_modules/asn1/tst/ber/writer.test.js | 370 + .../fsevents/node_modules/assert-plus/AUTHORS | 6 + .../node_modules/assert-plus/CHANGES.md | 8 + .../node_modules/assert-plus/README.md | 155 + .../node_modules/assert-plus/assert.js | 206 + .../node_modules/assert-plus/package.json | 85 + .../fsevents/node_modules/asynckit/LICENSE | 21 + .../fsevents/node_modules/asynckit/README.md | 233 + .../fsevents/node_modules/asynckit/bench.js | 76 + .../fsevents/node_modules/asynckit/index.js | 6 + .../node_modules/asynckit/lib/abort.js | 29 + .../node_modules/asynckit/lib/async.js | 34 + .../node_modules/asynckit/lib/defer.js | 26 + .../node_modules/asynckit/lib/iterate.js | 75 + .../asynckit/lib/readable_asynckit.js | 91 + .../asynckit/lib/readable_parallel.js | 25 + .../asynckit/lib/readable_serial.js | 25 + .../asynckit/lib/readable_serial_ordered.js | 29 + .../node_modules/asynckit/lib/state.js | 37 + .../node_modules/asynckit/lib/streamify.js | 141 + .../node_modules/asynckit/lib/terminator.js | 29 + .../node_modules/asynckit/package.json | 94 + .../node_modules/asynckit/parallel.js | 43 + .../fsevents/node_modules/asynckit/serial.js | 17 + .../node_modules/asynckit/serialOrdered.js | 75 + .../fsevents/node_modules/asynckit/stream.js | 21 + .../fsevents/node_modules/aws-sign2/LICENSE | 55 + .../fsevents/node_modules/aws-sign2/README.md | 4 + .../fsevents/node_modules/aws-sign2/index.js | 212 + .../node_modules/aws-sign2/package.json | 53 + .../fsevents/node_modules/aws4/.npmignore | 4 + .../fsevents/node_modules/aws4/.tern-port | 1 + .../fsevents/node_modules/aws4/.travis.yml | 5 + .../fsevents/node_modules/aws4/LICENSE | 19 + .../fsevents/node_modules/aws4/README.md | 523 + .../fsevents/node_modules/aws4/aws4.js | 332 + .../fsevents/node_modules/aws4/lru.js | 96 + .../fsevents/node_modules/aws4/package.json | 107 + .../node_modules/balanced-match/.npmignore | 5 + .../node_modules/balanced-match/LICENSE.md | 21 + .../node_modules/balanced-match/README.md | 91 + .../node_modules/balanced-match/index.js | 58 + .../node_modules/balanced-match/package.json | 78 + .../node_modules/bcrypt-pbkdf/README.md | 39 + .../node_modules/bcrypt-pbkdf/index.js | 556 + .../node_modules/bcrypt-pbkdf/package.json | 40 + .../node_modules/block-stream/LICENCE | 25 + .../node_modules/block-stream/LICENSE | 15 + .../node_modules/block-stream/README.md | 14 + .../node_modules/block-stream/block-stream.js | 209 + .../node_modules/block-stream/package.json | 63 + .../fsevents/node_modules/boom/.npmignore | 18 + .../fsevents/node_modules/boom/.travis.yml | 8 + .../node_modules/boom/CONTRIBUTING.md | 1 + .../fsevents/node_modules/boom/LICENSE | 28 + .../fsevents/node_modules/boom/README.md | 652 + .../node_modules/boom/images/boom.png | Bin 0 -> 29479 bytes .../fsevents/node_modules/boom/lib/index.js | 318 + .../fsevents/node_modules/boom/package.json | 62 + .../fsevents/node_modules/boom/test/index.js | 654 + .../node_modules/brace-expansion/README.md | 123 + .../node_modules/brace-expansion/index.js | 201 + .../node_modules/brace-expansion/package.json | 78 + .../node_modules/buffer-shims/index.js | 108 + .../node_modules/buffer-shims/license.md | 19 + .../node_modules/buffer-shims/package.json | 52 + .../node_modules/buffer-shims/readme.md | 21 + .../fsevents/node_modules/caseless/LICENSE | 28 + .../fsevents/node_modules/caseless/README.md | 45 + .../fsevents/node_modules/caseless/index.js | 67 + .../node_modules/caseless/package.json | 59 + .../fsevents/node_modules/caseless/test.js | 67 + .../fsevents/node_modules/co/History.md | 172 + node_modules/fsevents/node_modules/co/LICENSE | 22 + .../fsevents/node_modules/co/Readme.md | 212 + .../fsevents/node_modules/co/index.js | 237 + .../fsevents/node_modules/co/package.json | 69 + .../node_modules/code-point-at/index.js | 32 + .../node_modules/code-point-at/license | 21 + .../node_modules/code-point-at/package.json | 73 + .../node_modules/code-point-at/readme.md | 32 + .../node_modules/combined-stream/License | 19 + .../node_modules/combined-stream/Readme.md | 138 + .../combined-stream/lib/combined_stream.js | 188 + .../node_modules/combined-stream/package.json | 61 + .../node_modules/concat-map/.travis.yml | 4 + .../fsevents/node_modules/concat-map/LICENSE | 18 + .../node_modules/concat-map/README.markdown | 62 + .../node_modules/concat-map/example/map.js | 6 + .../fsevents/node_modules/concat-map/index.js | 13 + .../node_modules/concat-map/package.json | 91 + .../node_modules/concat-map/test/map.js | 39 + .../console-control-strings/LICENSE | 13 + .../console-control-strings/README.md | 145 + .../console-control-strings/README.md~ | 140 + .../console-control-strings/index.js | 125 + .../console-control-strings/package.json | 64 + .../node_modules/core-util-is/LICENSE | 19 + .../node_modules/core-util-is/README.md | 3 + .../node_modules/core-util-is/float.patch | 604 + .../node_modules/core-util-is/lib/util.js | 107 + .../node_modules/core-util-is/package.json | 65 + .../node_modules/core-util-is/test.js | 68 + .../node_modules/cryptiles/.npmignore | 18 + .../node_modules/cryptiles/.travis.yml | 8 + .../fsevents/node_modules/cryptiles/LICENSE | 28 + .../fsevents/node_modules/cryptiles/README.md | 16 + .../node_modules/cryptiles/lib/index.js | 68 + .../node_modules/cryptiles/package.json | 62 + .../node_modules/cryptiles/test/index.js | 102 + .../fsevents/node_modules/dashdash/CHANGES.md | 364 + .../node_modules/dashdash/LICENSE.txt | 24 + .../fsevents/node_modules/dashdash/README.md | 574 + .../dashdash/etc/dashdash.bash_completion.in | 389 + .../node_modules/dashdash/lib/dashdash.js | 1055 + .../dashdash/node_modules/assert-plus/AUTHORS | 6 + .../node_modules/assert-plus/CHANGES.md | 14 + .../node_modules/assert-plus/README.md | 162 + .../node_modules/assert-plus/assert.js | 211 + .../node_modules/assert-plus/package.json | 85 + .../node_modules/dashdash/package.json | 70 + .../node_modules/debug/.coveralls.yml | 1 + .../fsevents/node_modules/debug/.eslintrc | 11 + .../fsevents/node_modules/debug/.npmignore | 9 + .../fsevents/node_modules/debug/.travis.yml | 14 + .../fsevents/node_modules/debug/CHANGELOG.md | 357 + .../fsevents/node_modules/debug/LICENSE | 19 + .../fsevents/node_modules/debug/Makefile | 50 + .../fsevents/node_modules/debug/README.md | 312 + .../node_modules/debug/component.json | 19 + .../fsevents/node_modules/debug/karma.conf.js | 70 + .../fsevents/node_modules/debug/node.js | 1 + .../fsevents/node_modules/debug/package.json | 91 + .../node_modules/debug/src/browser.js | 185 + .../fsevents/node_modules/debug/src/debug.js | 202 + .../fsevents/node_modules/debug/src/index.js | 10 + .../fsevents/node_modules/debug/src/node.js | 246 + .../node_modules/deep-extend/CHANGELOG.md | 21 + .../fsevents/node_modules/deep-extend/LICENSE | 20 + .../node_modules/deep-extend/README.md | 90 + .../node_modules/deep-extend/index.js | 1 + .../deep-extend/lib/deep-extend.js | 144 + .../node_modules/deep-extend/package.json | 96 + .../node_modules/delayed-stream/.npmignore | 1 + .../node_modules/delayed-stream/License | 19 + .../node_modules/delayed-stream/Makefile | 7 + .../node_modules/delayed-stream/Readme.md | 141 + .../delayed-stream/lib/delayed_stream.js | 107 + .../node_modules/delayed-stream/package.json | 65 + .../node_modules/delegates/.npmignore | 1 + .../node_modules/delegates/History.md | 22 + .../fsevents/node_modules/delegates/License | 20 + .../fsevents/node_modules/delegates/Makefile | 8 + .../fsevents/node_modules/delegates/Readme.md | 94 + .../fsevents/node_modules/delegates/index.js | 121 + .../node_modules/delegates/package.json | 51 + .../node_modules/delegates/test/index.js | 94 + .../node_modules/detect-libc/.npmignore | 7 + .../fsevents/node_modules/detect-libc/LICENSE | 201 + .../node_modules/detect-libc/README.md | 78 + .../detect-libc/bin/detect-libc.js | 18 + .../detect-libc/lib/detect-libc.js | 85 + .../node_modules/detect-libc/package.json | 70 + .../fsevents/node_modules/ecc-jsbn/.npmignore | 15 + .../fsevents/node_modules/ecc-jsbn/LICENSE | 21 + .../fsevents/node_modules/ecc-jsbn/README.md | 8 + .../fsevents/node_modules/ecc-jsbn/index.js | 57 + .../node_modules/ecc-jsbn/lib/LICENSE-jsbn | 40 + .../fsevents/node_modules/ecc-jsbn/lib/ec.js | 561 + .../fsevents/node_modules/ecc-jsbn/lib/sec.js | 170 + .../node_modules/ecc-jsbn/package.json | 68 + .../fsevents/node_modules/ecc-jsbn/test.js | 14 + .../fsevents/node_modules/extend/.eslintrc | 17 + .../fsevents/node_modules/extend/.jscs.json | 175 + .../fsevents/node_modules/extend/.npmignore | 1 + .../fsevents/node_modules/extend/.travis.yml | 179 + .../fsevents/node_modules/extend/CHANGELOG.md | 77 + .../fsevents/node_modules/extend/LICENSE | 23 + .../fsevents/node_modules/extend/README.md | 81 + .../node_modules/extend/component.json | 32 + .../fsevents/node_modules/extend/index.js | 86 + .../fsevents/node_modules/extend/package.json | 78 + .../node_modules/extsprintf/.gitmodules | 6 + .../fsevents/node_modules/extsprintf/LICENSE | 19 + .../fsevents/node_modules/extsprintf/Makefile | 23 + .../node_modules/extsprintf/Makefile.deps | 39 + .../node_modules/extsprintf/Makefile.targ | 285 + .../node_modules/extsprintf/README.md | 39 + .../extsprintf/examples/simple.js | 2 + .../node_modules/extsprintf/jsl.node.conf | 137 + .../node_modules/extsprintf/lib/extsprintf.js | 166 + .../node_modules/extsprintf/package.json | 46 + .../node_modules/forever-agent/LICENSE | 55 + .../node_modules/forever-agent/README.md | 4 + .../node_modules/forever-agent/index.js | 138 + .../node_modules/forever-agent/package.json | 53 + .../fsevents/node_modules/form-data/License | 19 + .../fsevents/node_modules/form-data/README.md | 217 + .../node_modules/form-data/lib/browser.js | 2 + .../node_modules/form-data/lib/form_data.js | 444 + .../node_modules/form-data/lib/populate.js | 10 + .../node_modules/form-data/package.json | 101 + .../fsevents/node_modules/fs.realpath/LICENSE | 43 + .../node_modules/fs.realpath/README.md | 33 + .../node_modules/fs.realpath/index.js | 66 + .../fsevents/node_modules/fs.realpath/old.js | 303 + .../node_modules/fs.realpath/package.json | 62 + .../node_modules/fstream-ignore/LICENSE | 15 + .../node_modules/fstream-ignore/README.md | 22 + .../node_modules/fstream-ignore/ignore.js | 275 + .../node_modules/fstream-ignore/package.json | 64 + .../fsevents/node_modules/fstream/.npmignore | 5 + .../fsevents/node_modules/fstream/.travis.yml | 9 + .../fsevents/node_modules/fstream/LICENSE | 15 + .../fsevents/node_modules/fstream/README.md | 76 + .../fstream/examples/filter-pipe.js | 134 + .../node_modules/fstream/examples/pipe.js | 118 + .../node_modules/fstream/examples/reader.js | 68 + .../fstream/examples/symlink-write.js | 27 + .../fsevents/node_modules/fstream/fstream.js | 35 + .../node_modules/fstream/lib/abstract.js | 85 + .../node_modules/fstream/lib/collect.js | 70 + .../node_modules/fstream/lib/dir-reader.js | 252 + .../node_modules/fstream/lib/dir-writer.js | 174 + .../node_modules/fstream/lib/file-reader.js | 150 + .../node_modules/fstream/lib/file-writer.js | 107 + .../node_modules/fstream/lib/get-type.js | 33 + .../node_modules/fstream/lib/link-reader.js | 53 + .../node_modules/fstream/lib/link-writer.js | 95 + .../node_modules/fstream/lib/proxy-reader.js | 95 + .../node_modules/fstream/lib/proxy-writer.js | 111 + .../node_modules/fstream/lib/reader.js | 255 + .../node_modules/fstream/lib/socket-reader.js | 36 + .../node_modules/fstream/lib/writer.js | 390 + .../node_modules/fstream/package.json | 66 + .../fsevents/node_modules/gauge/CHANGELOG.md | 160 + .../fsevents/node_modules/gauge/LICENSE | 13 + .../fsevents/node_modules/gauge/README.md | 399 + .../fsevents/node_modules/gauge/base-theme.js | 14 + .../fsevents/node_modules/gauge/error.js | 24 + .../fsevents/node_modules/gauge/has-color.js | 12 + .../fsevents/node_modules/gauge/index.js | 233 + .../fsevents/node_modules/gauge/package.json | 94 + .../fsevents/node_modules/gauge/plumbing.js | 48 + .../fsevents/node_modules/gauge/process.js | 3 + .../node_modules/gauge/progress-bar.js | 35 + .../node_modules/gauge/render-template.js | 181 + .../node_modules/gauge/set-immediate.js | 7 + .../node_modules/gauge/set-interval.js | 3 + .../fsevents/node_modules/gauge/spin.js | 5 + .../node_modules/gauge/template-item.js | 73 + .../fsevents/node_modules/gauge/theme-set.js | 115 + .../fsevents/node_modules/gauge/themes.js | 54 + .../node_modules/gauge/wide-truncate.js | 25 + .../fsevents/node_modules/getpass/.npmignore | 8 + .../fsevents/node_modules/getpass/.travis.yml | 9 + .../fsevents/node_modules/getpass/LICENSE | 18 + .../fsevents/node_modules/getpass/README.md | 32 + .../node_modules/getpass/lib/index.js | 123 + .../getpass/node_modules/assert-plus/AUTHORS | 6 + .../node_modules/assert-plus/CHANGES.md | 14 + .../node_modules/assert-plus/README.md | 162 + .../node_modules/assert-plus/assert.js | 211 + .../node_modules/assert-plus/package.json | 85 + .../node_modules/getpass/package.json | 53 + .../fsevents/node_modules/glob/LICENSE | 15 + .../fsevents/node_modules/glob/README.md | 368 + .../fsevents/node_modules/glob/changelog.md | 67 + .../fsevents/node_modules/glob/common.js | 240 + .../fsevents/node_modules/glob/glob.js | 790 + .../fsevents/node_modules/glob/package.json | 79 + .../fsevents/node_modules/glob/sync.js | 486 + .../fsevents/node_modules/graceful-fs/LICENSE | 15 + .../node_modules/graceful-fs/README.md | 133 + .../fsevents/node_modules/graceful-fs/fs.js | 21 + .../node_modules/graceful-fs/graceful-fs.js | 262 + .../graceful-fs/legacy-streams.js | 118 + .../node_modules/graceful-fs/package.json | 79 + .../node_modules/graceful-fs/polyfills.js | 330 + .../fsevents/node_modules/har-schema/LICENSE | 13 + .../node_modules/har-schema/README.md | 49 + .../har-schema/lib/afterRequest.json | 29 + .../har-schema/lib/beforeRequest.json | 29 + .../node_modules/har-schema/lib/browser.json | 19 + .../node_modules/har-schema/lib/cache.json | 20 + .../node_modules/har-schema/lib/content.json | 28 + .../node_modules/har-schema/lib/cookie.json | 35 + .../node_modules/har-schema/lib/creator.json | 19 + .../node_modules/har-schema/lib/entry.json | 52 + .../node_modules/har-schema/lib/har.json | 12 + .../node_modules/har-schema/lib/header.json | 19 + .../node_modules/har-schema/lib/index.js | 22 + .../node_modules/har-schema/lib/log.json | 35 + .../node_modules/har-schema/lib/page.json | 31 + .../har-schema/lib/pageTimings.json | 17 + .../node_modules/har-schema/lib/postData.json | 42 + .../node_modules/har-schema/lib/query.json | 19 + .../node_modules/har-schema/lib/request.json | 56 + .../node_modules/har-schema/lib/response.json | 53 + .../node_modules/har-schema/lib/timings.json | 41 + .../node_modules/har-schema/package.json | 89 + .../node_modules/har-validator/LICENSE | 13 + .../node_modules/har-validator/README.md | 75 + .../har-validator/lib/browser/async.js | 96 + .../har-validator/lib/browser/error.js | 15 + .../har-validator/lib/browser/promise.js | 93 + .../har-validator/lib/node4/async.js | 136 + .../har-validator/lib/node4/error.js | 22 + .../har-validator/lib/node4/promise.js | 132 + .../har-validator/lib/node6/async.js | 133 + .../har-validator/lib/node6/error.js | 22 + .../har-validator/lib/node6/promise.js | 130 + .../har-validator/lib/node7/async.js | 133 + .../har-validator/lib/node7/error.js | 22 + .../har-validator/lib/node7/promise.js | 130 + .../node_modules/har-validator/package.json | 104 + .../node_modules/har-validator/src/async.js | 96 + .../node_modules/har-validator/src/error.js | 15 + .../node_modules/har-validator/src/promise.js | 93 + .../fsevents/node_modules/has-unicode/LICENSE | 14 + .../node_modules/has-unicode/README.md | 43 + .../node_modules/has-unicode/index.js | 16 + .../node_modules/has-unicode/package.json | 61 + .../fsevents/node_modules/hawk/.npmignore | 20 + .../fsevents/node_modules/hawk/.travis.yml | 5 + .../fsevents/node_modules/hawk/LICENSE | 28 + .../fsevents/node_modules/hawk/README.md | 634 + .../fsevents/node_modules/hawk/bower.json | 24 + .../fsevents/node_modules/hawk/component.json | 19 + .../fsevents/node_modules/hawk/dist/client.js | 343 + .../node_modules/hawk/example/usage.js | 78 + .../node_modules/hawk/images/hawk.png | Bin 0 -> 6945 bytes .../node_modules/hawk/images/logo.png | Bin 0 -> 71732 bytes .../fsevents/node_modules/hawk/lib/browser.js | 637 + .../fsevents/node_modules/hawk/lib/client.js | 369 + .../fsevents/node_modules/hawk/lib/crypto.js | 126 + .../fsevents/node_modules/hawk/lib/index.js | 15 + .../fsevents/node_modules/hawk/lib/server.js | 548 + .../fsevents/node_modules/hawk/lib/utils.js | 184 + .../fsevents/node_modules/hawk/package.json | 74 + .../node_modules/hawk/test/browser.js | 1492 ++ .../fsevents/node_modules/hawk/test/client.js | 440 + .../fsevents/node_modules/hawk/test/crypto.js | 70 + .../fsevents/node_modules/hawk/test/index.js | 378 + .../fsevents/node_modules/hawk/test/readme.js | 95 + .../fsevents/node_modules/hawk/test/server.js | 1329 ++ .../fsevents/node_modules/hawk/test/uri.js | 838 + .../fsevents/node_modules/hawk/test/utils.js | 149 + .../fsevents/node_modules/hoek/.npmignore | 18 + .../fsevents/node_modules/hoek/.travis.yml | 7 + .../node_modules/hoek/CONTRIBUTING.md | 1 + .../fsevents/node_modules/hoek/LICENSE | 31 + .../fsevents/node_modules/hoek/README.md | 584 + .../node_modules/hoek/images/hoek.png | Bin 0 -> 37939 bytes .../fsevents/node_modules/hoek/lib/escape.js | 132 + .../fsevents/node_modules/hoek/lib/index.js | 993 + .../fsevents/node_modules/hoek/package.json | 60 + .../node_modules/hoek/test/escaper.js | 88 + .../fsevents/node_modules/hoek/test/index.js | 2513 ++ .../node_modules/hoek/test/modules/ignore.txt | 0 .../node_modules/hoek/test/modules/test1.js | 1 + .../node_modules/hoek/test/modules/test2.js | 1 + .../node_modules/hoek/test/modules/test3.js | 1 + .../http-signature/.dir-locals.el | 6 + .../node_modules/http-signature/.npmignore | 7 + .../node_modules/http-signature/CHANGES.md | 46 + .../node_modules/http-signature/LICENSE | 18 + .../node_modules/http-signature/README.md | 79 + .../http-signature/http_signing.md | 363 + .../node_modules/http-signature/lib/index.js | 29 + .../node_modules/http-signature/lib/parser.js | 318 + .../node_modules/http-signature/lib/signer.js | 399 + .../node_modules/http-signature/lib/utils.js | 112 + .../node_modules/http-signature/lib/verify.js | 88 + .../node_modules/http-signature/package.json | 80 + .../fsevents/node_modules/inflight/LICENSE | 15 + .../fsevents/node_modules/inflight/README.md | 37 + .../node_modules/inflight/inflight.js | 54 + .../node_modules/inflight/package.json | 61 + .../fsevents/node_modules/inherits/LICENSE | 16 + .../fsevents/node_modules/inherits/README.md | 42 + .../node_modules/inherits/inherits.js | 7 + .../node_modules/inherits/inherits_browser.js | 23 + .../node_modules/inherits/package.json | 69 + .../fsevents/node_modules/ini/LICENSE | 15 + .../fsevents/node_modules/ini/README.md | 102 + node_modules/fsevents/node_modules/ini/ini.js | 190 + .../fsevents/node_modules/ini/package.json | 61 + .../is-fullwidth-code-point/index.js | 46 + .../is-fullwidth-code-point/license | 21 + .../is-fullwidth-code-point/package.json | 80 + .../is-fullwidth-code-point/readme.md | 39 + .../node_modules/is-typedarray/LICENSE.md | 18 + .../node_modules/is-typedarray/README.md | 16 + .../node_modules/is-typedarray/index.js | 41 + .../node_modules/is-typedarray/package.json | 62 + .../node_modules/is-typedarray/test.js | 34 + .../fsevents/node_modules/isarray/.npmignore | 1 + .../fsevents/node_modules/isarray/.travis.yml | 4 + .../fsevents/node_modules/isarray/Makefile | 6 + .../fsevents/node_modules/isarray/README.md | 60 + .../node_modules/isarray/component.json | 19 + .../fsevents/node_modules/isarray/index.js | 5 + .../node_modules/isarray/package.json | 76 + .../fsevents/node_modules/isarray/test.js | 20 + .../fsevents/node_modules/isstream/.jshintrc | 59 + .../fsevents/node_modules/isstream/.npmignore | 1 + .../node_modules/isstream/.travis.yml | 12 + .../fsevents/node_modules/isstream/LICENSE.md | 11 + .../fsevents/node_modules/isstream/README.md | 66 + .../node_modules/isstream/isstream.js | 27 + .../node_modules/isstream/package.json | 64 + .../fsevents/node_modules/isstream/test.js | 168 + .../node_modules/jodid25519/.npmignore | 11 + .../node_modules/jodid25519/.travis.yml | 7 + .../node_modules/jodid25519/AUTHORS.md | 3 + .../fsevents/node_modules/jodid25519/LICENSE | 23 + .../node_modules/jodid25519/README.md | 51 + .../fsevents/node_modules/jodid25519/almond.0 | 42 + .../fsevents/node_modules/jodid25519/almond.1 | 13 + .../fsevents/node_modules/jodid25519/index.js | 35 + .../node_modules/jodid25519/jsdoc.json | 19 + .../node_modules/jodid25519/lib/core.js | 481 + .../node_modules/jodid25519/lib/curve255.js | 221 + .../node_modules/jodid25519/lib/dh.js | 111 + .../node_modules/jodid25519/lib/eddsa.js | 573 + .../node_modules/jodid25519/lib/utils.js | 198 + .../node_modules/jodid25519/package.json | 78 + .../fsevents/node_modules/jsbn/.npmignore | 2 + .../fsevents/node_modules/jsbn/LICENSE | 40 + .../fsevents/node_modules/jsbn/README.md | 175 + .../fsevents/node_modules/jsbn/example.html | 12 + .../fsevents/node_modules/jsbn/example.js | 3 + .../fsevents/node_modules/jsbn/index.js | 1357 ++ .../fsevents/node_modules/jsbn/package.json | 58 + .../node_modules/json-schema/README.md | 5 + .../json-schema/draft-00/hyper-schema | 68 + .../json-schema/draft-00/json-ref | 26 + .../node_modules/json-schema/draft-00/links | 33 + .../node_modules/json-schema/draft-00/schema | 155 + .../json-schema/draft-01/hyper-schema | 68 + .../json-schema/draft-01/json-ref | 26 + .../node_modules/json-schema/draft-01/links | 33 + .../node_modules/json-schema/draft-01/schema | 155 + .../json-schema/draft-02/hyper-schema | 68 + .../json-schema/draft-02/json-ref | 26 + .../node_modules/json-schema/draft-02/links | 35 + .../node_modules/json-schema/draft-02/schema | 166 + .../json-schema/draft-03/examples/address | 20 + .../json-schema/draft-03/examples/calendar | 53 + .../json-schema/draft-03/examples/card | 105 + .../json-schema/draft-03/examples/geo | 8 + .../json-schema/draft-03/examples/interfaces | 23 + .../json-schema/draft-03/hyper-schema | 60 + .../json-schema/draft-03/json-ref | 26 + .../node_modules/json-schema/draft-03/links | 35 + .../node_modules/json-schema/draft-03/schema | 174 + .../json-schema/draft-04/hyper-schema | 60 + .../node_modules/json-schema/draft-04/links | 41 + .../node_modules/json-schema/draft-04/schema | 189 + .../json-schema/draft-zyp-json-schema-03.xml | 1120 + .../json-schema/draft-zyp-json-schema-04.xml | 1072 + .../node_modules/json-schema/lib/links.js | 66 + .../node_modules/json-schema/lib/validate.js | 273 + .../node_modules/json-schema/package.json | 74 + .../node_modules/json-schema/test/tests.js | 95 + .../json-stable-stringify/.npmignore | 1 + .../json-stable-stringify/.travis.yml | 4 + .../json-stable-stringify/LICENSE | 18 + .../json-stable-stringify/example/key_cmp.js | 7 + .../json-stable-stringify/example/nested.js | 3 + .../json-stable-stringify/example/str.js | 3 + .../example/value_cmp.js | 7 + .../json-stable-stringify/index.js | 84 + .../json-stable-stringify/package.json | 77 + .../json-stable-stringify/readme.markdown | 130 + .../json-stable-stringify/test/cmp.js | 11 + .../json-stable-stringify/test/nested.js | 35 + .../json-stable-stringify/test/replacer.js | 74 + .../json-stable-stringify/test/space.js | 59 + .../json-stable-stringify/test/str.js | 32 + .../json-stable-stringify/test/to-json.js | 20 + .../json-stringify-safe/.npmignore | 1 + .../json-stringify-safe/CHANGELOG.md | 14 + .../node_modules/json-stringify-safe/LICENSE | 15 + .../node_modules/json-stringify-safe/Makefile | 35 + .../json-stringify-safe/README.md | 52 + .../json-stringify-safe/package.json | 69 + .../json-stringify-safe/stringify.js | 27 + .../json-stringify-safe/test/mocha.opts | 2 + .../test/stringify_test.js | 246 + .../node_modules/jsonify/README.markdown | 34 + .../fsevents/node_modules/jsonify/index.js | 2 + .../node_modules/jsonify/lib/parse.js | 273 + .../node_modules/jsonify/lib/stringify.js | 154 + .../node_modules/jsonify/package.json | 62 + .../node_modules/jsonify/test/parse.js | 16 + .../node_modules/jsonify/test/stringify.js | 15 + .../fsevents/node_modules/jsprim/CHANGES.md | 43 + .../fsevents/node_modules/jsprim/LICENSE | 19 + .../fsevents/node_modules/jsprim/README.md | 292 + .../node_modules/jsprim/lib/jsprim.js | 735 + .../jsprim/node_modules/assert-plus/AUTHORS | 6 + .../node_modules/assert-plus/CHANGES.md | 14 + .../jsprim/node_modules/assert-plus/README.md | 162 + .../jsprim/node_modules/assert-plus/assert.js | 211 + .../node_modules/assert-plus/package.json | 85 + .../fsevents/node_modules/jsprim/package.json | 52 + .../fsevents/node_modules/mime-db/HISTORY.md | 412 + .../fsevents/node_modules/mime-db/LICENSE | 22 + .../fsevents/node_modules/mime-db/README.md | 82 + .../fsevents/node_modules/mime-db/db.json | 6805 ++++++ .../fsevents/node_modules/mime-db/index.js | 11 + .../node_modules/mime-db/package.json | 101 + .../node_modules/mime-types/HISTORY.md | 223 + .../fsevents/node_modules/mime-types/LICENSE | 23 + .../node_modules/mime-types/README.md | 108 + .../fsevents/node_modules/mime-types/index.js | 188 + .../node_modules/mime-types/package.json | 88 + .../fsevents/node_modules/minimatch/LICENSE | 15 + .../fsevents/node_modules/minimatch/README.md | 209 + .../node_modules/minimatch/minimatch.js | 923 + .../node_modules/minimatch/package.json | 67 + .../node_modules/minimist/.travis.yml | 4 + .../fsevents/node_modules/minimist/LICENSE | 18 + .../node_modules/minimist/example/parse.js | 2 + .../fsevents/node_modules/minimist/index.js | 187 + .../node_modules/minimist/package.json | 74 + .../node_modules/minimist/readme.markdown | 73 + .../node_modules/minimist/test/dash.js | 24 + .../minimist/test/default_bool.js | 20 + .../node_modules/minimist/test/dotted.js | 16 + .../node_modules/minimist/test/long.js | 31 + .../node_modules/minimist/test/parse.js | 318 + .../minimist/test/parse_modified.js | 9 + .../node_modules/minimist/test/short.js | 67 + .../node_modules/minimist/test/whitespace.js | 8 + .../fsevents/node_modules/mkdirp/.travis.yml | 8 + .../fsevents/node_modules/mkdirp/LICENSE | 21 + .../fsevents/node_modules/mkdirp/bin/cmd.js | 33 + .../node_modules/mkdirp/bin/usage.txt | 12 + .../node_modules/mkdirp/examples/pow.js | 6 + .../fsevents/node_modules/mkdirp/index.js | 98 + .../fsevents/node_modules/mkdirp/package.json | 66 + .../node_modules/mkdirp/readme.markdown | 100 + .../node_modules/mkdirp/test/chmod.js | 41 + .../node_modules/mkdirp/test/clobber.js | 38 + .../node_modules/mkdirp/test/mkdirp.js | 28 + .../node_modules/mkdirp/test/opts_fs.js | 29 + .../node_modules/mkdirp/test/opts_fs_sync.js | 27 + .../fsevents/node_modules/mkdirp/test/perm.js | 32 + .../node_modules/mkdirp/test/perm_sync.js | 36 + .../fsevents/node_modules/mkdirp/test/race.js | 37 + .../fsevents/node_modules/mkdirp/test/rel.js | 32 + .../node_modules/mkdirp/test/return.js | 25 + .../node_modules/mkdirp/test/return_sync.js | 24 + .../fsevents/node_modules/mkdirp/test/root.js | 19 + .../fsevents/node_modules/mkdirp/test/sync.js | 32 + .../node_modules/mkdirp/test/umask.js | 28 + .../node_modules/mkdirp/test/umask_sync.js | 32 + .../fsevents/node_modules/ms/index.js | 152 + .../fsevents/node_modules/ms/license.md | 21 + .../fsevents/node_modules/ms/package.json | 72 + .../fsevents/node_modules/ms/readme.md | 51 + .../node_modules/node-pre-gyp/CHANGELOG.md | 376 + .../node_modules/node-pre-gyp/LICENSE | 27 + .../node_modules/node-pre-gyp/README.md | 586 + .../node_modules/node-pre-gyp/appveyor.yml | 46 + .../node-pre-gyp/bin/node-pre-gyp | 134 + .../node-pre-gyp/bin/node-pre-gyp.cmd | 2 + .../node_modules/node-pre-gyp/contributing.md | 10 + .../node_modules/node-pre-gyp/lib/build.js | 43 + .../node_modules/node-pre-gyp/lib/clean.js | 23 + .../node-pre-gyp/lib/configure.js | 48 + .../node_modules/node-pre-gyp/lib/info.js | 40 + .../node_modules/node-pre-gyp/lib/install.js | 197 + .../node-pre-gyp/lib/node-pre-gyp.js | 194 + .../node_modules/node-pre-gyp/lib/package.js | 46 + .../node-pre-gyp/lib/pre-binding.js | 25 + .../node_modules/node-pre-gyp/lib/publish.js | 77 + .../node_modules/node-pre-gyp/lib/rebuild.js | 13 + .../node-pre-gyp/lib/reinstall.js | 13 + .../node_modules/node-pre-gyp/lib/reveal.js | 31 + .../node-pre-gyp/lib/testbinary.js | 79 + .../node-pre-gyp/lib/testpackage.js | 49 + .../node-pre-gyp/lib/unpublish.js | 41 + .../node-pre-gyp/lib/util/abi_crosswalk.json | 1578 ++ .../node-pre-gyp/lib/util/compile.js | 87 + .../node-pre-gyp/lib/util/handle_gyp_opts.js | 94 + .../lib/util/nw-pre-gyp/index.html | 26 + .../lib/util/nw-pre-gyp/package.json | 9 + .../node-pre-gyp/lib/util/s3_setup.js | 27 + .../node-pre-gyp/lib/util/versioning.js | 325 + .../node_modules/node-pre-gyp/package.json | 87 + .../fsevents/node_modules/nopt/.npmignore | 1 + .../fsevents/node_modules/nopt/.travis.yml | 8 + .../fsevents/node_modules/nopt/CHANGELOG.md | 58 + .../fsevents/node_modules/nopt/LICENSE | 15 + .../fsevents/node_modules/nopt/README.md | 213 + .../fsevents/node_modules/nopt/bin/nopt.js | 54 + .../node_modules/nopt/examples/my-program.js | 30 + .../fsevents/node_modules/nopt/lib/nopt.js | 436 + .../fsevents/node_modules/nopt/package.json | 61 + .../fsevents/node_modules/nopt/test/basic.js | 303 + .../fsevents/node_modules/npmlog/CHANGELOG.md | 49 + .../fsevents/node_modules/npmlog/LICENSE | 15 + .../fsevents/node_modules/npmlog/README.md | 216 + .../fsevents/node_modules/npmlog/log.js | 304 + .../fsevents/node_modules/npmlog/package.json | 64 + .../node_modules/number-is-nan/index.js | 4 + .../node_modules/number-is-nan/license | 21 + .../node_modules/number-is-nan/package.json | 70 + .../node_modules/number-is-nan/readme.md | 28 + .../fsevents/node_modules/oauth-sign/LICENSE | 55 + .../node_modules/oauth-sign/README.md | 4 + .../fsevents/node_modules/oauth-sign/index.js | 136 + .../node_modules/oauth-sign/package.json | 59 + .../node_modules/object-assign/index.js | 90 + .../node_modules/object-assign/license | 21 + .../node_modules/object-assign/package.json | 77 + .../node_modules/object-assign/readme.md | 61 + .../fsevents/node_modules/once/LICENSE | 15 + .../fsevents/node_modules/once/README.md | 79 + .../fsevents/node_modules/once/once.js | 42 + .../fsevents/node_modules/once/package.json | 71 + .../fsevents/node_modules/os-homedir/index.js | 24 + .../fsevents/node_modules/os-homedir/license | 21 + .../node_modules/os-homedir/package.json | 76 + .../node_modules/os-homedir/readme.md | 31 + .../fsevents/node_modules/os-tmpdir/index.js | 25 + .../fsevents/node_modules/os-tmpdir/license | 21 + .../node_modules/os-tmpdir/package.json | 76 + .../fsevents/node_modules/os-tmpdir/readme.md | 32 + .../fsevents/node_modules/osenv/.npmignore | 13 + .../fsevents/node_modules/osenv/.travis.yml | 9 + .../fsevents/node_modules/osenv/LICENSE | 15 + .../fsevents/node_modules/osenv/README.md | 63 + .../fsevents/node_modules/osenv/osenv.js | 72 + .../fsevents/node_modules/osenv/package.json | 70 + .../fsevents/node_modules/osenv/test/unix.js | 71 + .../node_modules/osenv/test/windows.js | 74 + .../fsevents/node_modules/osenv/x.tap | 39 + .../node_modules/path-is-absolute/index.js | 20 + .../node_modules/path-is-absolute/license | 21 + .../path-is-absolute/package.json | 78 + .../node_modules/path-is-absolute/readme.md | 59 + .../node_modules/performance-now/.npmignore | 1 + .../performance-now/.tm_properties | 7 + .../node_modules/performance-now/.travis.yml | 4 + .../node_modules/performance-now/Makefile | 25 + .../node_modules/performance-now/README.md | 30 + .../performance-now/lib/performance-now.js | 32 + .../node_modules/performance-now/license.txt | 7 + .../node_modules/performance-now/package.json | 60 + .../src/performance-now.coffee | 15 + .../performance-now/test/mocha.opts | 3 + .../test/performance-now.coffee | 38 + .../process-nextick-args/.travis.yml | 12 + .../process-nextick-args/index.js | 43 + .../process-nextick-args/license.md | 19 + .../process-nextick-args/package.json | 50 + .../process-nextick-args/readme.md | 18 + .../node_modules/process-nextick-args/test.js | 24 + .../node_modules/punycode/LICENSE-MIT.txt | 20 + .../fsevents/node_modules/punycode/README.md | 176 + .../node_modules/punycode/package.json | 92 + .../node_modules/punycode/punycode.js | 533 + .../fsevents/node_modules/qs/.eslintignore | 1 + .../fsevents/node_modules/qs/.eslintrc | 18 + .../fsevents/node_modules/qs/.jscs.json | 176 + .../fsevents/node_modules/qs/CHANGELOG.md | 175 + node_modules/fsevents/node_modules/qs/LICENSE | 28 + .../fsevents/node_modules/qs/README.md | 440 + .../fsevents/node_modules/qs/dist/qs.js | 597 + .../fsevents/node_modules/qs/lib/formats.js | 18 + .../fsevents/node_modules/qs/lib/index.js | 11 + .../fsevents/node_modules/qs/lib/parse.js | 167 + .../fsevents/node_modules/qs/lib/stringify.js | 207 + .../fsevents/node_modules/qs/lib/utils.js | 182 + .../fsevents/node_modules/qs/package.json | 81 + .../fsevents/node_modules/qs/test/.eslintrc | 11 + .../fsevents/node_modules/qs/test/index.js | 7 + .../fsevents/node_modules/qs/test/parse.js | 519 + .../node_modules/qs/test/stringify.js | 567 + .../fsevents/node_modules/qs/test/utils.js | 22 + .../fsevents/node_modules/rc/.npmignore | 3 + .../fsevents/node_modules/rc/LICENSE.APACHE2 | 15 + .../fsevents/node_modules/rc/LICENSE.BSD | 26 + .../fsevents/node_modules/rc/LICENSE.MIT | 24 + .../fsevents/node_modules/rc/README.md | 149 + .../fsevents/node_modules/rc/browser.js | 7 + .../fsevents/node_modules/rc/index.js | 60 + .../fsevents/node_modules/rc/lib/utils.js | 104 + .../rc/node_modules/minimist/.travis.yml | 8 + .../rc/node_modules/minimist/LICENSE | 18 + .../rc/node_modules/minimist/example/parse.js | 2 + .../rc/node_modules/minimist/index.js | 236 + .../rc/node_modules/minimist/package.json | 76 + .../rc/node_modules/minimist/readme.markdown | 91 + .../rc/node_modules/minimist/test/all_bool.js | 32 + .../rc/node_modules/minimist/test/bool.js | 166 + .../rc/node_modules/minimist/test/dash.js | 31 + .../minimist/test/default_bool.js | 35 + .../rc/node_modules/minimist/test/dotted.js | 22 + .../rc/node_modules/minimist/test/kv_short.js | 16 + .../rc/node_modules/minimist/test/long.js | 31 + .../rc/node_modules/minimist/test/num.js | 36 + .../rc/node_modules/minimist/test/parse.js | 197 + .../minimist/test/parse_modified.js | 9 + .../rc/node_modules/minimist/test/short.js | 67 + .../node_modules/minimist/test/stop_early.js | 15 + .../rc/node_modules/minimist/test/unknown.js | 102 + .../node_modules/minimist/test/whitespace.js | 8 + .../fsevents/node_modules/rc/package.json | 67 + .../fsevents/node_modules/rc/test/ini.js | 16 + .../node_modules/rc/test/nested-env-vars.js | 50 + .../fsevents/node_modules/rc/test/test.js | 59 + .../node_modules/readable-stream/.npmignore | 9 + .../node_modules/readable-stream/.travis.yml | 49 + .../readable-stream/CONTRIBUTING.md | 38 + .../readable-stream/GOVERNANCE.md | 136 + .../node_modules/readable-stream/LICENSE | 47 + .../node_modules/readable-stream/README.md | 57 + .../doc/wg-meetings/2015-01-30.md | 60 + .../readable-stream/duplex-browser.js | 1 + .../node_modules/readable-stream/duplex.js | 1 + .../readable-stream/lib/_stream_duplex.js | 75 + .../lib/_stream_passthrough.js | 26 + .../readable-stream/lib/_stream_readable.js | 935 + .../readable-stream/lib/_stream_transform.js | 182 + .../readable-stream/lib/_stream_writable.js | 544 + .../lib/internal/streams/BufferList.js | 64 + .../lib/internal/streams/stream-browser.js | 1 + .../lib/internal/streams/stream.js | 1 + .../node_modules/readable-stream/package.json | 87 + .../readable-stream/passthrough.js | 1 + .../readable-stream/readable-browser.js | 7 + .../node_modules/readable-stream/readable.js | 19 + .../node_modules/readable-stream/transform.js | 1 + .../readable-stream/writable-browser.js | 1 + .../node_modules/readable-stream/writable.js | 8 + .../node_modules/request/CHANGELOG.md | 674 + .../fsevents/node_modules/request/LICENSE | 55 + .../fsevents/node_modules/request/README.md | 1115 + .../fsevents/node_modules/request/index.js | 156 + .../fsevents/node_modules/request/lib/auth.js | 168 + .../node_modules/request/lib/cookies.js | 39 + .../request/lib/getProxyFromURI.js | 79 + .../fsevents/node_modules/request/lib/har.js | 215 + .../node_modules/request/lib/helpers.js | 66 + .../node_modules/request/lib/multipart.js | 113 + .../node_modules/request/lib/oauth.js | 148 + .../node_modules/request/lib/querystring.js | 51 + .../node_modules/request/lib/redirect.js | 157 + .../node_modules/request/lib/tunnel.js | 176 + .../node_modules/request/package.json | 121 + .../fsevents/node_modules/request/request.js | 1565 ++ .../fsevents/node_modules/rimraf/LICENSE | 15 + .../fsevents/node_modules/rimraf/README.md | 101 + .../fsevents/node_modules/rimraf/bin.js | 50 + .../fsevents/node_modules/rimraf/package.json | 69 + .../fsevents/node_modules/rimraf/rimraf.js | 363 + .../node_modules/safe-buffer/.travis.yml | 7 + .../fsevents/node_modules/safe-buffer/LICENSE | 21 + .../node_modules/safe-buffer/README.md | 581 + .../node_modules/safe-buffer/browser.js | 1 + .../node_modules/safe-buffer/index.js | 58 + .../node_modules/safe-buffer/package.json | 68 + .../fsevents/node_modules/safe-buffer/test.js | 99 + .../fsevents/node_modules/semver/LICENSE | 15 + .../fsevents/node_modules/semver/README.md | 350 + .../fsevents/node_modules/semver/bin/semver | 133 + .../fsevents/node_modules/semver/package.json | 57 + .../fsevents/node_modules/semver/range.bnf | 16 + .../fsevents/node_modules/semver/semver.js | 1203 + .../node_modules/set-blocking/CHANGELOG.md | 26 + .../node_modules/set-blocking/LICENSE.txt | 14 + .../node_modules/set-blocking/README.md | 31 + .../node_modules/set-blocking/index.js | 7 + .../node_modules/set-blocking/package.json | 73 + .../node_modules/signal-exit/CHANGELOG.md | 27 + .../node_modules/signal-exit/LICENSE.txt | 16 + .../node_modules/signal-exit/README.md | 40 + .../node_modules/signal-exit/index.js | 157 + .../node_modules/signal-exit/package.json | 69 + .../node_modules/signal-exit/signals.js | 53 + .../fsevents/node_modules/sntp/.npmignore | 18 + .../fsevents/node_modules/sntp/.travis.yml | 5 + .../fsevents/node_modules/sntp/LICENSE | 28 + .../fsevents/node_modules/sntp/Makefile | 9 + .../fsevents/node_modules/sntp/README.md | 68 + .../node_modules/sntp/examples/offset.js | 16 + .../node_modules/sntp/examples/time.js | 25 + .../fsevents/node_modules/sntp/index.js | 1 + .../fsevents/node_modules/sntp/lib/index.js | 412 + .../fsevents/node_modules/sntp/package.json | 71 + .../fsevents/node_modules/sntp/test/index.js | 435 + .../fsevents/node_modules/sshpk/.npmignore | 9 + .../fsevents/node_modules/sshpk/.travis.yml | 11 + .../fsevents/node_modules/sshpk/LICENSE | 18 + .../fsevents/node_modules/sshpk/README.md | 698 + .../node_modules/sshpk/bin/sshpk-conv | 201 + .../node_modules/sshpk/bin/sshpk-sign | 191 + .../node_modules/sshpk/bin/sshpk-verify | 166 + .../fsevents/node_modules/sshpk/lib/algs.js | 168 + .../node_modules/sshpk/lib/certificate.js | 377 + .../fsevents/node_modules/sshpk/lib/dhe.js | 410 + .../node_modules/sshpk/lib/ed-compat.js | 96 + .../fsevents/node_modules/sshpk/lib/errors.js | 84 + .../node_modules/sshpk/lib/fingerprint.js | 161 + .../node_modules/sshpk/lib/formats/auto.js | 73 + .../sshpk/lib/formats/openssh-cert.js | 322 + .../node_modules/sshpk/lib/formats/pem.js | 186 + .../node_modules/sshpk/lib/formats/pkcs1.js | 320 + .../node_modules/sshpk/lib/formats/pkcs8.js | 505 + .../node_modules/sshpk/lib/formats/rfc4253.js | 146 + .../sshpk/lib/formats/ssh-private.js | 261 + .../node_modules/sshpk/lib/formats/ssh.js | 114 + .../sshpk/lib/formats/x509-pem.js | 77 + .../node_modules/sshpk/lib/formats/x509.js | 726 + .../node_modules/sshpk/lib/identity.js | 277 + .../fsevents/node_modules/sshpk/lib/index.js | 39 + .../fsevents/node_modules/sshpk/lib/key.js | 274 + .../node_modules/sshpk/lib/private-key.js | 255 + .../node_modules/sshpk/lib/signature.js | 313 + .../node_modules/sshpk/lib/ssh-buffer.js | 148 + .../fsevents/node_modules/sshpk/lib/utils.js | 288 + .../node_modules/sshpk/man/man1/sshpk-conv.1 | 135 + .../node_modules/sshpk/man/man1/sshpk-sign.1 | 81 + .../sshpk/man/man1/sshpk-verify.1 | 68 + .../sshpk/node_modules/assert-plus/AUTHORS | 6 + .../sshpk/node_modules/assert-plus/CHANGES.md | 14 + .../sshpk/node_modules/assert-plus/README.md | 162 + .../sshpk/node_modules/assert-plus/assert.js | 211 + .../node_modules/assert-plus/package.json | 85 + .../fsevents/node_modules/sshpk/package.json | 105 + .../node_modules/string-width/index.js | 37 + .../node_modules/string-width/license | 21 + .../node_modules/string-width/package.json | 92 + .../node_modules/string-width/readme.md | 42 + .../node_modules/string_decoder/.npmignore | 2 + .../node_modules/string_decoder/LICENSE | 48 + .../node_modules/string_decoder/README.md | 28 + .../string_decoder/lib/string_decoder.js | 272 + .../node_modules/string_decoder/package.json | 59 + .../node_modules/stringstream/.npmignore | 15 + .../node_modules/stringstream/.travis.yml | 4 + .../node_modules/stringstream/LICENSE.txt | 22 + .../node_modules/stringstream/README.md | 38 + .../node_modules/stringstream/example.js | 27 + .../node_modules/stringstream/package.json | 54 + .../node_modules/stringstream/stringstream.js | 102 + .../fsevents/node_modules/strip-ansi/index.js | 6 + .../fsevents/node_modules/strip-ansi/license | 21 + .../node_modules/strip-ansi/package.json | 105 + .../node_modules/strip-ansi/readme.md | 33 + .../node_modules/strip-json-comments/index.js | 70 + .../node_modules/strip-json-comments/license | 21 + .../strip-json-comments/package.json | 77 + .../strip-json-comments/readme.md | 64 + .../fsevents/node_modules/tar-pack/.npmignore | 14 + .../node_modules/tar-pack/.travis.yml | 7 + .../fsevents/node_modules/tar-pack/LICENSE | 23 + .../fsevents/node_modules/tar-pack/README.md | 84 + .../fsevents/node_modules/tar-pack/index.js | 245 + .../node_modules/tar-pack/package.json | 60 + .../tar-pack/test/fixtures/packed-file.txt | 1 + .../tar-pack/test/fixtures/packed.tar | Bin 0 -> 3584 bytes .../tar-pack/test/fixtures/packed.tar.gz | Bin 0 -> 152 bytes .../tar-pack/test/fixtures/to-pack/bar.txt | 1 + .../tar-pack/test/fixtures/to-pack/foo.txt | 1 + .../node_modules/tar-pack/test/index.js | 109 + .../fsevents/node_modules/tar/.npmignore | 5 + .../fsevents/node_modules/tar/.travis.yml | 4 + .../fsevents/node_modules/tar/LICENSE | 12 + .../fsevents/node_modules/tar/README.md | 50 + .../node_modules/tar/examples/extracter.js | 19 + .../node_modules/tar/examples/packer.js | 24 + .../node_modules/tar/examples/reader.js | 36 + .../node_modules/tar/lib/buffer-entry.js | 30 + .../node_modules/tar/lib/entry-writer.js | 169 + .../fsevents/node_modules/tar/lib/entry.js | 220 + .../tar/lib/extended-header-writer.js | 191 + .../node_modules/tar/lib/extended-header.js | 140 + .../fsevents/node_modules/tar/lib/extract.js | 94 + .../tar/lib/global-header-writer.js | 14 + .../fsevents/node_modules/tar/lib/header.js | 385 + .../fsevents/node_modules/tar/lib/pack.js | 236 + .../fsevents/node_modules/tar/lib/parse.js | 275 + .../fsevents/node_modules/tar/package.json | 63 + node_modules/fsevents/node_modules/tar/tar.js | 173 + .../tar/test/00-setup-fixtures.js | 53 + .../tar/test/cb-never-called-1.0.1.tgz | Bin 0 -> 4096 bytes .../tar/test/dir-normalization.js | 177 + .../tar/test/dir-normalization.tar | Bin 0 -> 4608 bytes .../node_modules/tar/test/error-on-broken.js | 33 + .../node_modules/tar/test/extract-move.js | 132 + .../fsevents/node_modules/tar/test/extract.js | 367 + .../node_modules/tar/test/fixtures.tgz | Bin 0 -> 19352 bytes .../fsevents/node_modules/tar/test/header.js | 183 + .../tar/test/pack-no-proprietary.js | 886 + .../fsevents/node_modules/tar/test/pack.js | 952 + .../node_modules/tar/test/parse-discard.js | 29 + .../fsevents/node_modules/tar/test/parse.js | 359 + .../node_modules/tar/test/zz-cleanup.js | 20 + .../node_modules/tough-cookie/LICENSE | 27 + .../node_modules/tough-cookie/README.md | 506 + .../node_modules/tough-cookie/lib/cookie.js | 1336 ++ .../node_modules/tough-cookie/lib/memstore.js | 170 + .../tough-cookie/lib/pathMatch.js | 61 + .../tough-cookie/lib/permuteDomain.js | 56 + .../tough-cookie/lib/pubsuffix.js | 98 + .../node_modules/tough-cookie/lib/store.js | 71 + .../node_modules/tough-cookie/package.json | 95 + .../node_modules/tunnel-agent/LICENSE | 55 + .../node_modules/tunnel-agent/README.md | 4 + .../node_modules/tunnel-agent/index.js | 244 + .../node_modules/tunnel-agent/package.json | 58 + .../node_modules/tweetnacl/.npmignore | 4 + .../node_modules/tweetnacl/AUTHORS.md | 28 + .../node_modules/tweetnacl/CHANGELOG.md | 221 + .../fsevents/node_modules/tweetnacl/LICENSE | 24 + .../tweetnacl/PULL_REQUEST_TEMPLATE.md | 20 + .../fsevents/node_modules/tweetnacl/README.md | 459 + .../node_modules/tweetnacl/nacl-fast.js | 2388 ++ .../node_modules/tweetnacl/nacl-fast.min.js | 2 + .../fsevents/node_modules/tweetnacl/nacl.d.ts | 98 + .../fsevents/node_modules/tweetnacl/nacl.js | 1175 + .../node_modules/tweetnacl/nacl.min.js | 1 + .../node_modules/tweetnacl/package.json | 90 + .../fsevents/node_modules/uid-number/LICENSE | 15 + .../node_modules/uid-number/README.md | 17 + .../node_modules/uid-number/get-uid-gid.js | 24 + .../node_modules/uid-number/package.json | 54 + .../node_modules/uid-number/uid-number.js | 59 + .../node_modules/util-deprecate/History.md | 16 + .../node_modules/util-deprecate/LICENSE | 24 + .../node_modules/util-deprecate/README.md | 53 + .../node_modules/util-deprecate/browser.js | 67 + .../node_modules/util-deprecate/node.js | 6 + .../node_modules/util-deprecate/package.json | 59 + .../fsevents/node_modules/uuid/.npmignore | 8 + .../fsevents/node_modules/uuid/.travis.yml | 5 + .../fsevents/node_modules/uuid/AUTHORS | 5 + .../fsevents/node_modules/uuid/HISTORY.md | 28 + .../fsevents/node_modules/uuid/LICENSE.md | 21 + .../fsevents/node_modules/uuid/README.md | 132 + .../fsevents/node_modules/uuid/bin/uuid | 26 + .../fsevents/node_modules/uuid/index.js | 8 + .../node_modules/uuid/lib/bytesToUuid.js | 23 + .../node_modules/uuid/lib/rng-browser.js | 33 + .../fsevents/node_modules/uuid/lib/rng.js | 10 + .../fsevents/node_modules/uuid/package.json | 81 + .../node_modules/uuid/test/mocha.opts | 3 + .../fsevents/node_modules/uuid/test/test.js | 96 + node_modules/fsevents/node_modules/uuid/v1.js | 103 + node_modules/fsevents/node_modules/uuid/v4.js | 29 + .../fsevents/node_modules/verror/.gitmodules | 0 .../fsevents/node_modules/verror/.npmignore | 1 + .../fsevents/node_modules/verror/LICENSE | 19 + .../fsevents/node_modules/verror/Makefile | 35 + .../node_modules/verror/Makefile.targ | 285 + .../fsevents/node_modules/verror/README.md | 120 + .../verror/examples/levels-verror.js | 36 + .../verror/examples/levels-werror.js | 34 + .../node_modules/verror/examples/varargs.js | 6 + .../node_modules/verror/examples/verror.js | 13 + .../node_modules/verror/examples/werror.js | 14 + .../node_modules/verror/jsl.node.conf | 139 + .../node_modules/verror/lib/verror.js | 157 + .../fsevents/node_modules/verror/package.json | 51 + .../node_modules/verror/tests/tst.inherit.js | 100 + .../node_modules/verror/tests/tst.verror.js | 156 + .../node_modules/verror/tests/tst.werror.js | 179 + .../fsevents/node_modules/wide-align/LICENSE | 14 + .../node_modules/wide-align/README.md | 47 + .../fsevents/node_modules/wide-align/align.js | 65 + .../node_modules/wide-align/package.json | 69 + .../fsevents/node_modules/wrappy/LICENSE | 15 + .../fsevents/node_modules/wrappy/README.md | 36 + .../fsevents/node_modules/wrappy/package.json | 62 + .../fsevents/node_modules/wrappy/wrappy.js | 33 + node_modules/fsevents/package.json | 76 + node_modules/fsevents/src/async.cc | 43 + node_modules/fsevents/src/constants.cc | 110 + node_modules/fsevents/src/locking.cc | 27 + node_modules/fsevents/src/methods.cc | 42 + node_modules/fsevents/src/storage.cc | 27 + node_modules/fsevents/src/thread.cc | 72 + node_modules/function-bind/.editorconfig | 20 + node_modules/function-bind/.eslintrc | 15 + node_modules/function-bind/.jscs.json | 176 + node_modules/function-bind/.npmignore | 22 + node_modules/function-bind/.travis.yml | 168 + node_modules/function-bind/LICENSE | 20 + node_modules/function-bind/README.md | 48 + node_modules/function-bind/implementation.js | 52 + node_modules/function-bind/index.js | 5 + node_modules/function-bind/package.json | 94 + node_modules/function-bind/test/.eslintrc | 9 + node_modules/function-bind/test/index.js | 252 + node_modules/get-stream/buffer-stream.js | 51 + node_modules/get-stream/index.js | 51 + node_modules/get-stream/license | 21 + node_modules/get-stream/package.json | 81 + node_modules/get-stream/readme.md | 117 + node_modules/get-value/LICENSE | 21 + node_modules/get-value/index.js | 50 + node_modules/get-value/package.json | 113 + node_modules/glob-parent/LICENSE | 15 + node_modules/glob-parent/README.md | 109 + node_modules/glob-parent/index.js | 24 + .../glob-parent/node_modules/is-glob/LICENSE | 21 + .../node_modules/is-glob/README.md | 142 + .../glob-parent/node_modules/is-glob/index.js | 25 + .../node_modules/is-glob/package.json | 119 + node_modules/glob-parent/package.json | 72 + node_modules/global-dirs/index.js | 90 + node_modules/global-dirs/license | 9 + node_modules/global-dirs/package.json | 84 + node_modules/global-dirs/readme.md | 69 + node_modules/got/index.js | 364 + node_modules/got/license | 21 + node_modules/got/package.json | 110 + node_modules/got/readme.md | 335 + node_modules/graceful-fs/LICENSE | 15 + node_modules/graceful-fs/README.md | 133 + node_modules/graceful-fs/fs.js | 21 + node_modules/graceful-fs/graceful-fs.js | 262 + node_modules/graceful-fs/legacy-streams.js | 118 + node_modules/graceful-fs/package.json | 78 + node_modules/graceful-fs/polyfills.js | 330 + node_modules/graceful-readlink/.npmignore | 3 + node_modules/graceful-readlink/.travis.yml | 5 + node_modules/graceful-readlink/LICENSE | 22 + node_modules/graceful-readlink/README.md | 17 + node_modules/graceful-readlink/index.js | 12 + node_modules/graceful-readlink/package.json | 50 + node_modules/has-flag/index.js | 8 + node_modules/has-flag/license | 9 + node_modules/has-flag/package.json | 76 + node_modules/has-flag/readme.md | 70 + node_modules/has-value/LICENSE | 21 + node_modules/has-value/README.md | 149 + node_modules/has-value/index.js | 16 + node_modules/has-value/package.json | 120 + node_modules/has-values/LICENSE | 21 + node_modules/has-values/README.md | 129 + node_modules/has-values/index.js | 60 + .../has-values/node_modules/kind-of/LICENSE | 21 + .../has-values/node_modules/kind-of/README.md | 267 + .../has-values/node_modules/kind-of/index.js | 119 + .../node_modules/kind-of/package.json | 139 + node_modules/has-values/package.json | 115 + node_modules/has/.jshintrc | 14 + node_modules/has/.npmignore | 3 + node_modules/has/LICENSE-MIT | 22 + node_modules/has/README.mkd | 18 + node_modules/has/package.json | 62 + node_modules/has/src/index.js | 3 + node_modules/has/test/.jshintrc | 7 + node_modules/has/test/index.js | 10 + node_modules/http-errors/HISTORY.md | 124 + node_modules/http-errors/LICENSE | 23 + node_modules/http-errors/README.md | 135 + node_modules/http-errors/index.js | 260 + .../http-errors/node_modules/depd/History.md | 90 + .../http-errors/node_modules/depd/LICENSE | 22 + .../http-errors/node_modules/depd/Readme.md | 283 + .../http-errors/node_modules/depd/index.js | 520 + .../node_modules/depd/lib/browser/index.js | 77 + .../depd/lib/compat/callsite-tostring.js | 103 + .../depd/lib/compat/event-listener-count.js | 22 + .../node_modules/depd/lib/compat/index.js | 79 + .../node_modules/depd/package.json | 76 + node_modules/http-errors/package.json | 92 + node_modules/iconv-lite/.npmignore | 6 + node_modules/iconv-lite/.travis.yml | 23 + node_modules/iconv-lite/Changelog.md | 134 + node_modules/iconv-lite/LICENSE | 21 + node_modules/iconv-lite/README.md | 160 + .../iconv-lite/encodings/dbcs-codec.js | 555 + .../iconv-lite/encodings/dbcs-data.js | 176 + node_modules/iconv-lite/encodings/index.js | 22 + node_modules/iconv-lite/encodings/internal.js | 188 + .../iconv-lite/encodings/sbcs-codec.js | 73 + .../encodings/sbcs-data-generated.js | 451 + .../iconv-lite/encodings/sbcs-data.js | 169 + .../encodings/tables/big5-added.json | 122 + .../iconv-lite/encodings/tables/cp936.json | 264 + .../iconv-lite/encodings/tables/cp949.json | 273 + .../iconv-lite/encodings/tables/cp950.json | 177 + .../iconv-lite/encodings/tables/eucjp.json | 182 + .../encodings/tables/gb18030-ranges.json | 1 + .../encodings/tables/gbk-added.json | 55 + .../iconv-lite/encodings/tables/shiftjis.json | 125 + node_modules/iconv-lite/encodings/utf16.js | 177 + node_modules/iconv-lite/encodings/utf7.js | 290 + node_modules/iconv-lite/lib/bom-handling.js | 52 + node_modules/iconv-lite/lib/extend-node.js | 215 + node_modules/iconv-lite/lib/index.d.ts | 24 + node_modules/iconv-lite/lib/index.js | 148 + node_modules/iconv-lite/lib/streams.js | 121 + node_modules/iconv-lite/package.json | 124 + node_modules/ignore-by-default/LICENSE | 14 + node_modules/ignore-by-default/README.md | 26 + node_modules/ignore-by-default/index.js | 12 + node_modules/ignore-by-default/package.json | 62 + node_modules/import-lazy/index.js | 53 + node_modules/import-lazy/license | 21 + node_modules/import-lazy/package.json | 76 + node_modules/import-lazy/readme.md | 64 + node_modules/imurmurhash/README.md | 122 + node_modules/imurmurhash/imurmurhash.js | 138 + node_modules/imurmurhash/imurmurhash.min.js | 12 + node_modules/imurmurhash/package.json | 63 + node_modules/inherits/LICENSE | 16 + node_modules/inherits/README.md | 42 + node_modules/inherits/inherits.js | 7 + node_modules/inherits/inherits_browser.js | 23 + node_modules/inherits/package.json | 61 + node_modules/ini/LICENSE | 15 + node_modules/ini/README.md | 102 + node_modules/ini/ini.js | 194 + node_modules/ini/package.json | 64 + node_modules/ipaddr.js/.npmignore | 2 + node_modules/ipaddr.js/.travis.yml | 10 + node_modules/ipaddr.js/Cakefile | 18 + node_modules/ipaddr.js/LICENSE | 19 + node_modules/ipaddr.js/README.md | 227 + node_modules/ipaddr.js/bower.json | 29 + node_modules/ipaddr.js/ipaddr.min.js | 1 + node_modules/ipaddr.js/lib/ipaddr.js | 586 + node_modules/ipaddr.js/package.json | 64 + node_modules/ipaddr.js/src/ipaddr.coffee | 504 + .../ipaddr.js/test/ipaddr.test.coffee | 391 + node_modules/is-accessor-descriptor/LICENSE | 21 + node_modules/is-accessor-descriptor/README.md | 144 + node_modules/is-accessor-descriptor/index.js | 69 + .../node_modules/kind-of/CHANGELOG.md | 157 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 365 + .../node_modules/kind-of/index.js | 129 + .../node_modules/kind-of/package.json | 143 + .../is-accessor-descriptor/package.json | 110 + node_modules/is-binary-path/index.js | 12 + node_modules/is-binary-path/license | 21 + node_modules/is-binary-path/package.json | 71 + node_modules/is-binary-path/readme.md | 34 + node_modules/is-buffer/LICENSE | 21 + node_modules/is-buffer/README.md | 53 + node_modules/is-buffer/index.js | 21 + node_modules/is-buffer/package.json | 77 + node_modules/is-buffer/test/basic.js | 24 + node_modules/is-data-descriptor/LICENSE | 21 + node_modules/is-data-descriptor/README.md | 161 + node_modules/is-data-descriptor/index.js | 49 + .../node_modules/kind-of/CHANGELOG.md | 157 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 365 + .../node_modules/kind-of/index.js | 129 + .../node_modules/kind-of/package.json | 143 + node_modules/is-data-descriptor/package.json | 109 + node_modules/is-descriptor/LICENSE | 21 + node_modules/is-descriptor/README.md | 193 + node_modules/is-descriptor/index.js | 22 + .../node_modules/kind-of/CHANGELOG.md | 157 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 365 + .../node_modules/kind-of/index.js | 129 + .../node_modules/kind-of/package.json | 143 + node_modules/is-descriptor/package.json | 118 + node_modules/is-expression/.npmignore | 14 + node_modules/is-expression/.travis.yml | 17 + node_modules/is-expression/CHANGELOG.md | 46 + node_modules/is-expression/LICENSE.md | 19 + node_modules/is-expression/README.md | 66 + node_modules/is-expression/index.js | 45 + .../is-expression/node_modules/.bin/acorn | 1 + .../node_modules/acorn/.npmignore | 10 + .../is-expression/node_modules/acorn/AUTHORS | 62 + .../node_modules/acorn/CHANGELOG.md | 286 + .../is-expression/node_modules/acorn/LICENSE | 19 + .../node_modules/acorn/README.md | 409 + .../node_modules/acorn/bin/acorn | 67 + .../node_modules/acorn/dist/.keep | 0 .../node_modules/acorn/dist/acorn.es.js | 3401 +++ .../node_modules/acorn/dist/acorn.js | 3433 +++ .../node_modules/acorn/dist/acorn_loose.es.js | 1364 ++ .../node_modules/acorn/dist/acorn_loose.js | 1374 ++ .../node_modules/acorn/dist/walk.es.js | 342 + .../node_modules/acorn/dist/walk.js | 360 + .../node_modules/acorn/package.json | 259 + .../node_modules/acorn/src/bin/acorn.js | 60 + .../node_modules/acorn/src/expression.js | 819 + .../node_modules/acorn/src/identifier.js | 81 + .../node_modules/acorn/src/index.js | 77 + .../node_modules/acorn/src/location.js | 26 + .../node_modules/acorn/src/locutil.js | 42 + .../acorn/src/loose/expression.js | 562 + .../node_modules/acorn/src/loose/index.js | 48 + .../node_modules/acorn/src/loose/parseutil.js | 1 + .../node_modules/acorn/src/loose/state.js | 161 + .../node_modules/acorn/src/loose/statement.js | 450 + .../node_modules/acorn/src/loose/tokenize.js | 108 + .../node_modules/acorn/src/lval.js | 219 + .../node_modules/acorn/src/node.js | 50 + .../node_modules/acorn/src/options.js | 128 + .../node_modules/acorn/src/parseutil.js | 128 + .../node_modules/acorn/src/state.js | 111 + .../node_modules/acorn/src/statement.js | 744 + .../node_modules/acorn/src/tokencontext.js | 110 + .../node_modules/acorn/src/tokenize.js | 686 + .../node_modules/acorn/src/tokentype.js | 147 + .../node_modules/acorn/src/util.js | 9 + .../node_modules/acorn/src/walk/index.js | 342 + .../node_modules/acorn/src/whitespace.js | 13 + node_modules/is-expression/package.json | 59 + node_modules/is-expression/test.js | 48 + node_modules/is-extendable/LICENSE | 21 + node_modules/is-extendable/README.md | 72 + node_modules/is-extendable/index.js | 13 + node_modules/is-extendable/package.json | 91 + node_modules/is-extglob/LICENSE | 21 + node_modules/is-extglob/README.md | 107 + node_modules/is-extglob/index.js | 20 + node_modules/is-extglob/package.json | 101 + node_modules/is-fullwidth-code-point/index.js | 46 + node_modules/is-fullwidth-code-point/license | 21 + .../is-fullwidth-code-point/package.json | 77 + .../is-fullwidth-code-point/readme.md | 39 + node_modules/is-glob/LICENSE | 21 + node_modules/is-glob/README.md | 190 + node_modules/is-glob/index.js | 46 + node_modules/is-glob/package.json | 121 + node_modules/is-installed-globally/index.js | 5 + node_modules/is-installed-globally/license | 9 + .../is-installed-globally/package.json | 80 + node_modules/is-installed-globally/readme.md | 39 + node_modules/is-npm/index.js | 4 + node_modules/is-npm/package.json | 64 + node_modules/is-npm/readme.md | 30 + node_modules/is-number/LICENSE | 21 + node_modules/is-number/README.md | 115 + node_modules/is-number/index.js | 22 + node_modules/is-number/package.json | 123 + node_modules/is-obj/index.js | 5 + node_modules/is-obj/license | 21 + node_modules/is-obj/package.json | 65 + node_modules/is-obj/readme.md | 34 + node_modules/is-odd/LICENSE | 21 + node_modules/is-odd/README.md | 94 + node_modules/is-odd/index.js | 20 + .../is-odd/node_modules/is-number/LICENSE | 21 + .../is-odd/node_modules/is-number/README.md | 135 + .../is-odd/node_modules/is-number/index.js | 21 + .../node_modules/is-number/package.json | 113 + node_modules/is-odd/package.json | 110 + node_modules/is-path-inside/index.js | 14 + node_modules/is-path-inside/license | 21 + node_modules/is-path-inside/package.json | 69 + node_modules/is-path-inside/readme.md | 34 + node_modules/is-plain-object/LICENSE | 21 + node_modules/is-plain-object/README.md | 104 + node_modules/is-plain-object/index.d.ts | 5 + node_modules/is-plain-object/index.js | 37 + node_modules/is-plain-object/package.json | 124 + node_modules/is-promise/.npmignore | 6 + node_modules/is-promise/.travis.yml | 3 + node_modules/is-promise/LICENSE | 19 + node_modules/is-promise/index.js | 5 + node_modules/is-promise/package.json | 50 + node_modules/is-promise/readme.md | 29 + node_modules/is-redirect/index.js | 14 + node_modules/is-redirect/license | 21 + node_modules/is-redirect/package.json | 67 + node_modules/is-redirect/readme.md | 28 + node_modules/is-regex/.eslintrc | 9 + node_modules/is-regex/.jscs.json | 176 + node_modules/is-regex/.npmignore | 15 + node_modules/is-regex/.travis.yml | 165 + node_modules/is-regex/CHANGELOG.md | 27 + node_modules/is-regex/LICENSE | 20 + node_modules/is-regex/Makefile | 61 + node_modules/is-regex/README.md | 54 + node_modules/is-regex/index.js | 39 + node_modules/is-regex/package.json | 100 + node_modules/is-regex/test.js | 58 + node_modules/is-retry-allowed/index.js | 60 + node_modules/is-retry-allowed/license | 21 + node_modules/is-retry-allowed/package.json | 59 + node_modules/is-retry-allowed/readme.md | 42 + node_modules/is-stream/index.js | 21 + node_modules/is-stream/license | 21 + node_modules/is-stream/package.json | 71 + node_modules/is-stream/readme.md | 42 + node_modules/is-windows/LICENSE | 21 + node_modules/is-windows/README.md | 95 + node_modules/is-windows/index.js | 27 + node_modules/is-windows/package.json | 111 + node_modules/isarray/.npmignore | 1 + node_modules/isarray/.travis.yml | 4 + node_modules/isarray/Makefile | 6 + node_modules/isarray/README.md | 60 + node_modules/isarray/component.json | 19 + node_modules/isarray/index.js | 5 + node_modules/isarray/package.json | 74 + node_modules/isarray/test.js | 20 + node_modules/isexe/.npmignore | 2 + node_modules/isexe/LICENSE | 15 + node_modules/isexe/README.md | 51 + node_modules/isexe/index.js | 57 + node_modules/isexe/mode.js | 41 + node_modules/isexe/package.json | 60 + node_modules/isexe/test/basic.js | 221 + node_modules/isexe/windows.js | 42 + node_modules/isobject/LICENSE | 21 + node_modules/isobject/README.md | 122 + node_modules/isobject/index.d.ts | 5 + node_modules/isobject/index.js | 12 + node_modules/isobject/package.json | 129 + node_modules/js-stringify/.npmignore | 13 + node_modules/js-stringify/.travis.yml | 3 + node_modules/js-stringify/LICENSE | 19 + node_modules/js-stringify/README.md | 34 + node_modules/js-stringify/index.js | 17 + node_modules/js-stringify/package.json | 49 + node_modules/js-stringify/test/index.js | 17 + node_modules/jstransformer/CHANGELOG.md | 38 + node_modules/jstransformer/LICENSE.md | 21 + node_modules/jstransformer/README.md | 114 + node_modules/jstransformer/index.js | 359 + node_modules/jstransformer/package.json | 62 + node_modules/kareem/.travis.yml | 10 + node_modules/kareem/LICENSE | 202 + node_modules/kareem/Makefile | 5 + node_modules/kareem/README.md | 428 + node_modules/kareem/docs.js | 37 + node_modules/kareem/gulpfile.js | 18 + node_modules/kareem/index.js | 428 + node_modules/kareem/package.json | 62 + node_modules/kareem/test/examples.test.js | 379 + node_modules/kareem/test/post.test.js | 183 + node_modules/kareem/test/pre.test.js | 305 + node_modules/kareem/test/wrap.test.js | 342 + node_modules/kind-of/LICENSE | 21 + node_modules/kind-of/README.md | 261 + node_modules/kind-of/index.js | 116 + node_modules/kind-of/package.json | 139 + node_modules/latest-version/index.js | 4 + node_modules/latest-version/license | 21 + node_modules/latest-version/package.json | 71 + node_modules/latest-version/readme.md | 40 + node_modules/lazy-cache/LICENSE | 21 + node_modules/lazy-cache/README.md | 147 + node_modules/lazy-cache/index.js | 67 + node_modules/lazy-cache/package.json | 89 + node_modules/lodash.get/LICENSE | 47 + node_modules/lodash.get/README.md | 18 + node_modules/lodash.get/index.js | 931 + node_modules/lodash.get/package.json | 69 + node_modules/lodash/LICENSE | 47 + node_modules/lodash/README.md | 39 + node_modules/lodash/_DataView.js | 7 + node_modules/lodash/_Hash.js | 32 + node_modules/lodash/_LazyWrapper.js | 28 + node_modules/lodash/_ListCache.js | 32 + node_modules/lodash/_LodashWrapper.js | 22 + node_modules/lodash/_Map.js | 7 + node_modules/lodash/_MapCache.js | 32 + node_modules/lodash/_Promise.js | 7 + node_modules/lodash/_Set.js | 7 + node_modules/lodash/_SetCache.js | 27 + node_modules/lodash/_Stack.js | 27 + node_modules/lodash/_Symbol.js | 6 + node_modules/lodash/_Uint8Array.js | 6 + node_modules/lodash/_WeakMap.js | 7 + node_modules/lodash/_apply.js | 21 + node_modules/lodash/_arrayAggregator.js | 22 + node_modules/lodash/_arrayEach.js | 22 + node_modules/lodash/_arrayEachRight.js | 21 + node_modules/lodash/_arrayEvery.js | 23 + node_modules/lodash/_arrayFilter.js | 25 + node_modules/lodash/_arrayIncludes.js | 17 + node_modules/lodash/_arrayIncludesWith.js | 22 + node_modules/lodash/_arrayLikeKeys.js | 49 + node_modules/lodash/_arrayMap.js | 21 + node_modules/lodash/_arrayPush.js | 20 + node_modules/lodash/_arrayReduce.js | 26 + node_modules/lodash/_arrayReduceRight.js | 24 + node_modules/lodash/_arraySample.js | 15 + node_modules/lodash/_arraySampleSize.js | 17 + node_modules/lodash/_arrayShuffle.js | 15 + node_modules/lodash/_arraySome.js | 23 + node_modules/lodash/_asciiSize.js | 12 + node_modules/lodash/_asciiToArray.js | 12 + node_modules/lodash/_asciiWords.js | 15 + node_modules/lodash/_assignMergeValue.js | 20 + node_modules/lodash/_assignValue.js | 28 + node_modules/lodash/_assocIndexOf.js | 21 + node_modules/lodash/_baseAggregator.js | 21 + node_modules/lodash/_baseAssign.js | 17 + node_modules/lodash/_baseAssignIn.js | 17 + node_modules/lodash/_baseAssignValue.js | 25 + node_modules/lodash/_baseAt.js | 23 + node_modules/lodash/_baseClamp.js | 22 + node_modules/lodash/_baseClone.js | 171 + node_modules/lodash/_baseConforms.js | 18 + node_modules/lodash/_baseConformsTo.js | 27 + node_modules/lodash/_baseCreate.js | 30 + node_modules/lodash/_baseDelay.js | 21 + node_modules/lodash/_baseDifference.js | 67 + node_modules/lodash/_baseEach.js | 14 + node_modules/lodash/_baseEachRight.js | 14 + node_modules/lodash/_baseEvery.js | 21 + node_modules/lodash/_baseExtremum.js | 32 + node_modules/lodash/_baseFill.js | 32 + node_modules/lodash/_baseFilter.js | 21 + node_modules/lodash/_baseFindIndex.js | 24 + node_modules/lodash/_baseFindKey.js | 23 + node_modules/lodash/_baseFlatten.js | 38 + node_modules/lodash/_baseFor.js | 16 + node_modules/lodash/_baseForOwn.js | 16 + node_modules/lodash/_baseForOwnRight.js | 16 + node_modules/lodash/_baseForRight.js | 15 + node_modules/lodash/_baseFunctions.js | 19 + node_modules/lodash/_baseGet.js | 24 + node_modules/lodash/_baseGetAllKeys.js | 20 + node_modules/lodash/_baseGetTag.js | 28 + node_modules/lodash/_baseGt.js | 14 + node_modules/lodash/_baseHas.js | 19 + node_modules/lodash/_baseHasIn.js | 13 + node_modules/lodash/_baseInRange.js | 18 + node_modules/lodash/_baseIndexOf.js | 20 + node_modules/lodash/_baseIndexOfWith.js | 23 + node_modules/lodash/_baseIntersection.js | 74 + node_modules/lodash/_baseInverter.js | 21 + node_modules/lodash/_baseInvoke.js | 24 + node_modules/lodash/_baseIsArguments.js | 18 + node_modules/lodash/_baseIsArrayBuffer.js | 17 + node_modules/lodash/_baseIsDate.js | 18 + node_modules/lodash/_baseIsEqual.js | 28 + node_modules/lodash/_baseIsEqualDeep.js | 83 + node_modules/lodash/_baseIsMap.js | 18 + node_modules/lodash/_baseIsMatch.js | 62 + node_modules/lodash/_baseIsNaN.js | 12 + node_modules/lodash/_baseIsNative.js | 47 + node_modules/lodash/_baseIsRegExp.js | 18 + node_modules/lodash/_baseIsSet.js | 18 + node_modules/lodash/_baseIsTypedArray.js | 60 + node_modules/lodash/_baseIteratee.js | 31 + node_modules/lodash/_baseKeys.js | 30 + node_modules/lodash/_baseKeysIn.js | 33 + node_modules/lodash/_baseLodash.js | 10 + node_modules/lodash/_baseLt.js | 14 + node_modules/lodash/_baseMap.js | 22 + node_modules/lodash/_baseMatches.js | 22 + node_modules/lodash/_baseMatchesProperty.js | 33 + node_modules/lodash/_baseMean.js | 20 + node_modules/lodash/_baseMerge.js | 42 + node_modules/lodash/_baseMergeDeep.js | 94 + node_modules/lodash/_baseNth.js | 20 + node_modules/lodash/_baseOrderBy.js | 34 + node_modules/lodash/_basePick.js | 19 + node_modules/lodash/_basePickBy.js | 30 + node_modules/lodash/_baseProperty.js | 14 + node_modules/lodash/_basePropertyDeep.js | 16 + node_modules/lodash/_basePropertyOf.js | 14 + node_modules/lodash/_basePullAll.js | 51 + node_modules/lodash/_basePullAt.js | 37 + node_modules/lodash/_baseRandom.js | 18 + node_modules/lodash/_baseRange.js | 28 + node_modules/lodash/_baseReduce.js | 23 + node_modules/lodash/_baseRepeat.js | 35 + node_modules/lodash/_baseRest.js | 17 + node_modules/lodash/_baseSample.js | 15 + node_modules/lodash/_baseSampleSize.js | 18 + node_modules/lodash/_baseSet.js | 47 + node_modules/lodash/_baseSetData.js | 17 + node_modules/lodash/_baseSetToString.js | 22 + node_modules/lodash/_baseShuffle.js | 15 + node_modules/lodash/_baseSlice.js | 31 + node_modules/lodash/_baseSome.js | 22 + node_modules/lodash/_baseSortBy.js | 21 + node_modules/lodash/_baseSortedIndex.js | 42 + node_modules/lodash/_baseSortedIndexBy.js | 64 + node_modules/lodash/_baseSortedUniq.js | 30 + node_modules/lodash/_baseSum.js | 24 + node_modules/lodash/_baseTimes.js | 20 + node_modules/lodash/_baseToNumber.js | 24 + node_modules/lodash/_baseToPairs.js | 18 + node_modules/lodash/_baseToString.js | 37 + node_modules/lodash/_baseUnary.js | 14 + node_modules/lodash/_baseUniq.js | 72 + node_modules/lodash/_baseUnset.js | 20 + node_modules/lodash/_baseUpdate.js | 18 + node_modules/lodash/_baseValues.js | 19 + node_modules/lodash/_baseWhile.js | 26 + node_modules/lodash/_baseWrapperValue.js | 25 + node_modules/lodash/_baseXor.js | 36 + node_modules/lodash/_baseZipObject.js | 23 + node_modules/lodash/_cacheHas.js | 13 + node_modules/lodash/_castArrayLikeObject.js | 14 + node_modules/lodash/_castFunction.js | 14 + node_modules/lodash/_castPath.js | 21 + node_modules/lodash/_castRest.js | 14 + node_modules/lodash/_castSlice.js | 18 + node_modules/lodash/_charsEndIndex.js | 19 + node_modules/lodash/_charsStartIndex.js | 20 + node_modules/lodash/_cloneArrayBuffer.js | 16 + node_modules/lodash/_cloneBuffer.js | 35 + node_modules/lodash/_cloneDataView.js | 16 + node_modules/lodash/_cloneRegExp.js | 17 + node_modules/lodash/_cloneSymbol.js | 18 + node_modules/lodash/_cloneTypedArray.js | 16 + node_modules/lodash/_compareAscending.js | 41 + node_modules/lodash/_compareMultiple.js | 44 + node_modules/lodash/_composeArgs.js | 39 + node_modules/lodash/_composeArgsRight.js | 41 + node_modules/lodash/_copyArray.js | 20 + node_modules/lodash/_copyObject.js | 40 + node_modules/lodash/_copySymbols.js | 16 + node_modules/lodash/_copySymbolsIn.js | 16 + node_modules/lodash/_coreJsData.js | 6 + node_modules/lodash/_countHolders.js | 21 + node_modules/lodash/_createAggregator.js | 23 + node_modules/lodash/_createAssigner.js | 37 + node_modules/lodash/_createBaseEach.js | 32 + node_modules/lodash/_createBaseFor.js | 25 + node_modules/lodash/_createBind.js | 28 + node_modules/lodash/_createCaseFirst.js | 33 + node_modules/lodash/_createCompounder.js | 24 + node_modules/lodash/_createCtor.js | 37 + node_modules/lodash/_createCurry.js | 46 + node_modules/lodash/_createFind.js | 25 + node_modules/lodash/_createFlow.js | 78 + node_modules/lodash/_createHybrid.js | 92 + node_modules/lodash/_createInverter.js | 17 + node_modules/lodash/_createMathOperation.js | 38 + node_modules/lodash/_createOver.js | 27 + node_modules/lodash/_createPadding.js | 33 + node_modules/lodash/_createPartial.js | 43 + node_modules/lodash/_createRange.js | 30 + node_modules/lodash/_createRecurry.js | 56 + .../lodash/_createRelationalOperation.js | 20 + node_modules/lodash/_createRound.js | 33 + node_modules/lodash/_createSet.js | 19 + node_modules/lodash/_createToPairs.js | 30 + node_modules/lodash/_createWrap.js | 106 + .../lodash/_customDefaultsAssignIn.js | 29 + node_modules/lodash/_customDefaultsMerge.js | 28 + node_modules/lodash/_customOmitClone.js | 16 + node_modules/lodash/_deburrLetter.js | 71 + node_modules/lodash/_defineProperty.js | 11 + node_modules/lodash/_equalArrays.js | 83 + node_modules/lodash/_equalByTag.js | 112 + node_modules/lodash/_equalObjects.js | 89 + node_modules/lodash/_escapeHtmlChar.js | 21 + node_modules/lodash/_escapeStringChar.js | 22 + node_modules/lodash/_flatRest.js | 16 + node_modules/lodash/_freeGlobal.js | 4 + node_modules/lodash/_getAllKeys.js | 16 + node_modules/lodash/_getAllKeysIn.js | 17 + node_modules/lodash/_getData.js | 15 + node_modules/lodash/_getFuncName.js | 31 + node_modules/lodash/_getHolder.js | 13 + node_modules/lodash/_getMapData.js | 18 + node_modules/lodash/_getMatchData.js | 24 + node_modules/lodash/_getNative.js | 17 + node_modules/lodash/_getPrototype.js | 6 + node_modules/lodash/_getRawTag.js | 46 + node_modules/lodash/_getSymbols.js | 30 + node_modules/lodash/_getSymbolsIn.js | 25 + node_modules/lodash/_getTag.js | 58 + node_modules/lodash/_getValue.js | 13 + node_modules/lodash/_getView.js | 33 + node_modules/lodash/_getWrapDetails.js | 17 + node_modules/lodash/_hasPath.js | 39 + node_modules/lodash/_hasUnicode.js | 26 + node_modules/lodash/_hasUnicodeWord.js | 15 + node_modules/lodash/_hashClear.js | 15 + node_modules/lodash/_hashDelete.js | 17 + node_modules/lodash/_hashGet.js | 30 + node_modules/lodash/_hashHas.js | 23 + node_modules/lodash/_hashSet.js | 23 + node_modules/lodash/_initCloneArray.js | 26 + node_modules/lodash/_initCloneByTag.js | 77 + node_modules/lodash/_initCloneObject.js | 18 + node_modules/lodash/_insertWrapDetails.js | 23 + node_modules/lodash/_isFlattenable.js | 20 + node_modules/lodash/_isIndex.js | 25 + node_modules/lodash/_isIterateeCall.js | 30 + node_modules/lodash/_isKey.js | 29 + node_modules/lodash/_isKeyable.js | 15 + node_modules/lodash/_isLaziable.js | 28 + node_modules/lodash/_isMaskable.js | 14 + node_modules/lodash/_isMasked.js | 20 + node_modules/lodash/_isPrototype.js | 18 + node_modules/lodash/_isStrictComparable.js | 15 + node_modules/lodash/_iteratorToArray.js | 18 + node_modules/lodash/_lazyClone.js | 23 + node_modules/lodash/_lazyReverse.js | 23 + node_modules/lodash/_lazyValue.js | 69 + node_modules/lodash/_listCacheClear.js | 13 + node_modules/lodash/_listCacheDelete.js | 35 + node_modules/lodash/_listCacheGet.js | 19 + node_modules/lodash/_listCacheHas.js | 16 + node_modules/lodash/_listCacheSet.js | 26 + node_modules/lodash/_mapCacheClear.js | 21 + node_modules/lodash/_mapCacheDelete.js | 18 + node_modules/lodash/_mapCacheGet.js | 16 + node_modules/lodash/_mapCacheHas.js | 16 + node_modules/lodash/_mapCacheSet.js | 22 + node_modules/lodash/_mapToArray.js | 18 + .../lodash/_matchesStrictComparable.js | 20 + node_modules/lodash/_memoizeCapped.js | 26 + node_modules/lodash/_mergeData.js | 90 + node_modules/lodash/_metaMap.js | 6 + node_modules/lodash/_nativeCreate.js | 6 + node_modules/lodash/_nativeKeys.js | 6 + node_modules/lodash/_nativeKeysIn.js | 20 + node_modules/lodash/_nodeUtil.js | 22 + node_modules/lodash/_objectToString.js | 22 + node_modules/lodash/_overArg.js | 15 + node_modules/lodash/_overRest.js | 36 + node_modules/lodash/_parent.js | 16 + node_modules/lodash/_reEscape.js | 4 + node_modules/lodash/_reEvaluate.js | 4 + node_modules/lodash/_reInterpolate.js | 4 + node_modules/lodash/_realNames.js | 4 + node_modules/lodash/_reorder.js | 29 + node_modules/lodash/_replaceHolders.js | 29 + node_modules/lodash/_root.js | 9 + node_modules/lodash/_safeGet.js | 15 + node_modules/lodash/_setCacheAdd.js | 19 + node_modules/lodash/_setCacheHas.js | 14 + node_modules/lodash/_setData.js | 20 + node_modules/lodash/_setToArray.js | 18 + node_modules/lodash/_setToPairs.js | 18 + node_modules/lodash/_setToString.js | 14 + node_modules/lodash/_setWrapToString.js | 21 + node_modules/lodash/_shortOut.js | 37 + node_modules/lodash/_shuffleSelf.js | 28 + node_modules/lodash/_stackClear.js | 15 + node_modules/lodash/_stackDelete.js | 18 + node_modules/lodash/_stackGet.js | 14 + node_modules/lodash/_stackHas.js | 14 + node_modules/lodash/_stackSet.js | 34 + node_modules/lodash/_strictIndexOf.js | 23 + node_modules/lodash/_strictLastIndexOf.js | 21 + node_modules/lodash/_stringSize.js | 18 + node_modules/lodash/_stringToArray.js | 18 + node_modules/lodash/_stringToPath.js | 27 + node_modules/lodash/_toKey.js | 21 + node_modules/lodash/_toSource.js | 26 + node_modules/lodash/_unescapeHtmlChar.js | 21 + node_modules/lodash/_unicodeSize.js | 44 + node_modules/lodash/_unicodeToArray.js | 40 + node_modules/lodash/_unicodeWords.js | 69 + node_modules/lodash/_updateWrapDetails.js | 46 + node_modules/lodash/_wrapperClone.js | 23 + node_modules/lodash/add.js | 22 + node_modules/lodash/after.js | 42 + node_modules/lodash/array.js | 67 + node_modules/lodash/ary.js | 29 + node_modules/lodash/assign.js | 58 + node_modules/lodash/assignIn.js | 40 + node_modules/lodash/assignInWith.js | 38 + node_modules/lodash/assignWith.js | 37 + node_modules/lodash/at.js | 23 + node_modules/lodash/attempt.js | 35 + node_modules/lodash/before.js | 40 + node_modules/lodash/bind.js | 57 + node_modules/lodash/bindAll.js | 41 + node_modules/lodash/bindKey.js | 68 + node_modules/lodash/camelCase.js | 29 + node_modules/lodash/capitalize.js | 23 + node_modules/lodash/castArray.js | 44 + node_modules/lodash/ceil.js | 26 + node_modules/lodash/chain.js | 38 + node_modules/lodash/chunk.js | 50 + node_modules/lodash/clamp.js | 39 + node_modules/lodash/clone.js | 36 + node_modules/lodash/cloneDeep.js | 29 + node_modules/lodash/cloneDeepWith.js | 40 + node_modules/lodash/cloneWith.js | 42 + node_modules/lodash/collection.js | 30 + node_modules/lodash/commit.js | 33 + node_modules/lodash/compact.js | 31 + node_modules/lodash/concat.js | 43 + node_modules/lodash/cond.js | 60 + node_modules/lodash/conforms.js | 35 + node_modules/lodash/conformsTo.js | 32 + node_modules/lodash/constant.js | 26 + node_modules/lodash/core.js | 3854 +++ node_modules/lodash/core.min.js | 29 + node_modules/lodash/countBy.js | 40 + node_modules/lodash/create.js | 43 + node_modules/lodash/curry.js | 57 + node_modules/lodash/curryRight.js | 54 + node_modules/lodash/date.js | 3 + node_modules/lodash/debounce.js | 190 + node_modules/lodash/deburr.js | 45 + node_modules/lodash/defaultTo.js | 25 + node_modules/lodash/defaults.js | 64 + node_modules/lodash/defaultsDeep.js | 30 + node_modules/lodash/defer.js | 26 + node_modules/lodash/delay.js | 28 + node_modules/lodash/difference.js | 33 + node_modules/lodash/differenceBy.js | 44 + node_modules/lodash/differenceWith.js | 40 + node_modules/lodash/divide.js | 22 + node_modules/lodash/drop.js | 38 + node_modules/lodash/dropRight.js | 39 + node_modules/lodash/dropRightWhile.js | 45 + node_modules/lodash/dropWhile.js | 45 + node_modules/lodash/each.js | 1 + node_modules/lodash/eachRight.js | 1 + node_modules/lodash/endsWith.js | 43 + node_modules/lodash/entries.js | 1 + node_modules/lodash/entriesIn.js | 1 + node_modules/lodash/eq.js | 37 + node_modules/lodash/escape.js | 43 + node_modules/lodash/escapeRegExp.js | 32 + node_modules/lodash/every.js | 56 + node_modules/lodash/extend.js | 1 + node_modules/lodash/extendWith.js | 1 + node_modules/lodash/fill.js | 45 + node_modules/lodash/filter.js | 48 + node_modules/lodash/find.js | 42 + node_modules/lodash/findIndex.js | 55 + node_modules/lodash/findKey.js | 44 + node_modules/lodash/findLast.js | 25 + node_modules/lodash/findLastIndex.js | 59 + node_modules/lodash/findLastKey.js | 44 + node_modules/lodash/first.js | 1 + node_modules/lodash/flatMap.js | 29 + node_modules/lodash/flatMapDeep.js | 31 + node_modules/lodash/flatMapDepth.js | 31 + node_modules/lodash/flatten.js | 22 + node_modules/lodash/flattenDeep.js | 25 + node_modules/lodash/flattenDepth.js | 33 + node_modules/lodash/flip.js | 28 + node_modules/lodash/floor.js | 26 + node_modules/lodash/flow.js | 27 + node_modules/lodash/flowRight.js | 26 + node_modules/lodash/forEach.js | 41 + node_modules/lodash/forEachRight.js | 31 + node_modules/lodash/forIn.js | 39 + node_modules/lodash/forInRight.js | 37 + node_modules/lodash/forOwn.js | 36 + node_modules/lodash/forOwnRight.js | 34 + node_modules/lodash/fp.js | 2 + node_modules/lodash/fp/F.js | 1 + node_modules/lodash/fp/T.js | 1 + node_modules/lodash/fp/__.js | 1 + node_modules/lodash/fp/_baseConvert.js | 573 + node_modules/lodash/fp/_convertBrowser.js | 18 + node_modules/lodash/fp/_falseOptions.js | 7 + node_modules/lodash/fp/_mapping.js | 368 + node_modules/lodash/fp/_util.js | 16 + node_modules/lodash/fp/add.js | 5 + node_modules/lodash/fp/after.js | 5 + node_modules/lodash/fp/all.js | 1 + node_modules/lodash/fp/allPass.js | 1 + node_modules/lodash/fp/always.js | 1 + node_modules/lodash/fp/any.js | 1 + node_modules/lodash/fp/anyPass.js | 1 + node_modules/lodash/fp/apply.js | 1 + node_modules/lodash/fp/array.js | 2 + node_modules/lodash/fp/ary.js | 5 + node_modules/lodash/fp/assign.js | 5 + node_modules/lodash/fp/assignAll.js | 5 + node_modules/lodash/fp/assignAllWith.js | 5 + node_modules/lodash/fp/assignIn.js | 5 + node_modules/lodash/fp/assignInAll.js | 5 + node_modules/lodash/fp/assignInAllWith.js | 5 + node_modules/lodash/fp/assignInWith.js | 5 + node_modules/lodash/fp/assignWith.js | 5 + node_modules/lodash/fp/assoc.js | 1 + node_modules/lodash/fp/assocPath.js | 1 + node_modules/lodash/fp/at.js | 5 + node_modules/lodash/fp/attempt.js | 5 + node_modules/lodash/fp/before.js | 5 + node_modules/lodash/fp/bind.js | 5 + node_modules/lodash/fp/bindAll.js | 5 + node_modules/lodash/fp/bindKey.js | 5 + node_modules/lodash/fp/camelCase.js | 5 + node_modules/lodash/fp/capitalize.js | 5 + node_modules/lodash/fp/castArray.js | 5 + node_modules/lodash/fp/ceil.js | 5 + node_modules/lodash/fp/chain.js | 5 + node_modules/lodash/fp/chunk.js | 5 + node_modules/lodash/fp/clamp.js | 5 + node_modules/lodash/fp/clone.js | 5 + node_modules/lodash/fp/cloneDeep.js | 5 + node_modules/lodash/fp/cloneDeepWith.js | 5 + node_modules/lodash/fp/cloneWith.js | 5 + node_modules/lodash/fp/collection.js | 2 + node_modules/lodash/fp/commit.js | 5 + node_modules/lodash/fp/compact.js | 5 + node_modules/lodash/fp/complement.js | 1 + node_modules/lodash/fp/compose.js | 1 + node_modules/lodash/fp/concat.js | 5 + node_modules/lodash/fp/cond.js | 5 + node_modules/lodash/fp/conforms.js | 1 + node_modules/lodash/fp/conformsTo.js | 5 + node_modules/lodash/fp/constant.js | 5 + node_modules/lodash/fp/contains.js | 1 + node_modules/lodash/fp/convert.js | 18 + node_modules/lodash/fp/countBy.js | 5 + node_modules/lodash/fp/create.js | 5 + node_modules/lodash/fp/curry.js | 5 + node_modules/lodash/fp/curryN.js | 5 + node_modules/lodash/fp/curryRight.js | 5 + node_modules/lodash/fp/curryRightN.js | 5 + node_modules/lodash/fp/date.js | 2 + node_modules/lodash/fp/debounce.js | 5 + node_modules/lodash/fp/deburr.js | 5 + node_modules/lodash/fp/defaultTo.js | 5 + node_modules/lodash/fp/defaults.js | 5 + node_modules/lodash/fp/defaultsAll.js | 5 + node_modules/lodash/fp/defaultsDeep.js | 5 + node_modules/lodash/fp/defaultsDeepAll.js | 5 + node_modules/lodash/fp/defer.js | 5 + node_modules/lodash/fp/delay.js | 5 + node_modules/lodash/fp/difference.js | 5 + node_modules/lodash/fp/differenceBy.js | 5 + node_modules/lodash/fp/differenceWith.js | 5 + node_modules/lodash/fp/dissoc.js | 1 + node_modules/lodash/fp/dissocPath.js | 1 + node_modules/lodash/fp/divide.js | 5 + node_modules/lodash/fp/drop.js | 5 + node_modules/lodash/fp/dropLast.js | 1 + node_modules/lodash/fp/dropLastWhile.js | 1 + node_modules/lodash/fp/dropRight.js | 5 + node_modules/lodash/fp/dropRightWhile.js | 5 + node_modules/lodash/fp/dropWhile.js | 5 + node_modules/lodash/fp/each.js | 1 + node_modules/lodash/fp/eachRight.js | 1 + node_modules/lodash/fp/endsWith.js | 5 + node_modules/lodash/fp/entries.js | 1 + node_modules/lodash/fp/entriesIn.js | 1 + node_modules/lodash/fp/eq.js | 5 + node_modules/lodash/fp/equals.js | 1 + node_modules/lodash/fp/escape.js | 5 + node_modules/lodash/fp/escapeRegExp.js | 5 + node_modules/lodash/fp/every.js | 5 + node_modules/lodash/fp/extend.js | 1 + node_modules/lodash/fp/extendAll.js | 1 + node_modules/lodash/fp/extendAllWith.js | 1 + node_modules/lodash/fp/extendWith.js | 1 + node_modules/lodash/fp/fill.js | 5 + node_modules/lodash/fp/filter.js | 5 + node_modules/lodash/fp/find.js | 5 + node_modules/lodash/fp/findFrom.js | 5 + node_modules/lodash/fp/findIndex.js | 5 + node_modules/lodash/fp/findIndexFrom.js | 5 + node_modules/lodash/fp/findKey.js | 5 + node_modules/lodash/fp/findLast.js | 5 + node_modules/lodash/fp/findLastFrom.js | 5 + node_modules/lodash/fp/findLastIndex.js | 5 + node_modules/lodash/fp/findLastIndexFrom.js | 5 + node_modules/lodash/fp/findLastKey.js | 5 + node_modules/lodash/fp/first.js | 1 + node_modules/lodash/fp/flatMap.js | 5 + node_modules/lodash/fp/flatMapDeep.js | 5 + node_modules/lodash/fp/flatMapDepth.js | 5 + node_modules/lodash/fp/flatten.js | 5 + node_modules/lodash/fp/flattenDeep.js | 5 + node_modules/lodash/fp/flattenDepth.js | 5 + node_modules/lodash/fp/flip.js | 5 + node_modules/lodash/fp/floor.js | 5 + node_modules/lodash/fp/flow.js | 5 + node_modules/lodash/fp/flowRight.js | 5 + node_modules/lodash/fp/forEach.js | 5 + node_modules/lodash/fp/forEachRight.js | 5 + node_modules/lodash/fp/forIn.js | 5 + node_modules/lodash/fp/forInRight.js | 5 + node_modules/lodash/fp/forOwn.js | 5 + node_modules/lodash/fp/forOwnRight.js | 5 + node_modules/lodash/fp/fromPairs.js | 5 + node_modules/lodash/fp/function.js | 2 + node_modules/lodash/fp/functions.js | 5 + node_modules/lodash/fp/functionsIn.js | 5 + node_modules/lodash/fp/get.js | 5 + node_modules/lodash/fp/getOr.js | 5 + node_modules/lodash/fp/groupBy.js | 5 + node_modules/lodash/fp/gt.js | 5 + node_modules/lodash/fp/gte.js | 5 + node_modules/lodash/fp/has.js | 5 + node_modules/lodash/fp/hasIn.js | 5 + node_modules/lodash/fp/head.js | 5 + node_modules/lodash/fp/identical.js | 1 + node_modules/lodash/fp/identity.js | 5 + node_modules/lodash/fp/inRange.js | 5 + node_modules/lodash/fp/includes.js | 5 + node_modules/lodash/fp/includesFrom.js | 5 + node_modules/lodash/fp/indexBy.js | 1 + node_modules/lodash/fp/indexOf.js | 5 + node_modules/lodash/fp/indexOfFrom.js | 5 + node_modules/lodash/fp/init.js | 1 + node_modules/lodash/fp/initial.js | 5 + node_modules/lodash/fp/intersection.js | 5 + node_modules/lodash/fp/intersectionBy.js | 5 + node_modules/lodash/fp/intersectionWith.js | 5 + node_modules/lodash/fp/invert.js | 5 + node_modules/lodash/fp/invertBy.js | 5 + node_modules/lodash/fp/invertObj.js | 1 + node_modules/lodash/fp/invoke.js | 5 + node_modules/lodash/fp/invokeArgs.js | 5 + node_modules/lodash/fp/invokeArgsMap.js | 5 + node_modules/lodash/fp/invokeMap.js | 5 + node_modules/lodash/fp/isArguments.js | 5 + node_modules/lodash/fp/isArray.js | 5 + node_modules/lodash/fp/isArrayBuffer.js | 5 + node_modules/lodash/fp/isArrayLike.js | 5 + node_modules/lodash/fp/isArrayLikeObject.js | 5 + node_modules/lodash/fp/isBoolean.js | 5 + node_modules/lodash/fp/isBuffer.js | 5 + node_modules/lodash/fp/isDate.js | 5 + node_modules/lodash/fp/isElement.js | 5 + node_modules/lodash/fp/isEmpty.js | 5 + node_modules/lodash/fp/isEqual.js | 5 + node_modules/lodash/fp/isEqualWith.js | 5 + node_modules/lodash/fp/isError.js | 5 + node_modules/lodash/fp/isFinite.js | 5 + node_modules/lodash/fp/isFunction.js | 5 + node_modules/lodash/fp/isInteger.js | 5 + node_modules/lodash/fp/isLength.js | 5 + node_modules/lodash/fp/isMap.js | 5 + node_modules/lodash/fp/isMatch.js | 5 + node_modules/lodash/fp/isMatchWith.js | 5 + node_modules/lodash/fp/isNaN.js | 5 + node_modules/lodash/fp/isNative.js | 5 + node_modules/lodash/fp/isNil.js | 5 + node_modules/lodash/fp/isNull.js | 5 + node_modules/lodash/fp/isNumber.js | 5 + node_modules/lodash/fp/isObject.js | 5 + node_modules/lodash/fp/isObjectLike.js | 5 + node_modules/lodash/fp/isPlainObject.js | 5 + node_modules/lodash/fp/isRegExp.js | 5 + node_modules/lodash/fp/isSafeInteger.js | 5 + node_modules/lodash/fp/isSet.js | 5 + node_modules/lodash/fp/isString.js | 5 + node_modules/lodash/fp/isSymbol.js | 5 + node_modules/lodash/fp/isTypedArray.js | 5 + node_modules/lodash/fp/isUndefined.js | 5 + node_modules/lodash/fp/isWeakMap.js | 5 + node_modules/lodash/fp/isWeakSet.js | 5 + node_modules/lodash/fp/iteratee.js | 5 + node_modules/lodash/fp/join.js | 5 + node_modules/lodash/fp/juxt.js | 1 + node_modules/lodash/fp/kebabCase.js | 5 + node_modules/lodash/fp/keyBy.js | 5 + node_modules/lodash/fp/keys.js | 5 + node_modules/lodash/fp/keysIn.js | 5 + node_modules/lodash/fp/lang.js | 2 + node_modules/lodash/fp/last.js | 5 + node_modules/lodash/fp/lastIndexOf.js | 5 + node_modules/lodash/fp/lastIndexOfFrom.js | 5 + node_modules/lodash/fp/lowerCase.js | 5 + node_modules/lodash/fp/lowerFirst.js | 5 + node_modules/lodash/fp/lt.js | 5 + node_modules/lodash/fp/lte.js | 5 + node_modules/lodash/fp/map.js | 5 + node_modules/lodash/fp/mapKeys.js | 5 + node_modules/lodash/fp/mapValues.js | 5 + node_modules/lodash/fp/matches.js | 1 + node_modules/lodash/fp/matchesProperty.js | 5 + node_modules/lodash/fp/math.js | 2 + node_modules/lodash/fp/max.js | 5 + node_modules/lodash/fp/maxBy.js | 5 + node_modules/lodash/fp/mean.js | 5 + node_modules/lodash/fp/meanBy.js | 5 + node_modules/lodash/fp/memoize.js | 5 + node_modules/lodash/fp/merge.js | 5 + node_modules/lodash/fp/mergeAll.js | 5 + node_modules/lodash/fp/mergeAllWith.js | 5 + node_modules/lodash/fp/mergeWith.js | 5 + node_modules/lodash/fp/method.js | 5 + node_modules/lodash/fp/methodOf.js | 5 + node_modules/lodash/fp/min.js | 5 + node_modules/lodash/fp/minBy.js | 5 + node_modules/lodash/fp/mixin.js | 5 + node_modules/lodash/fp/multiply.js | 5 + node_modules/lodash/fp/nAry.js | 1 + node_modules/lodash/fp/negate.js | 5 + node_modules/lodash/fp/next.js | 5 + node_modules/lodash/fp/noop.js | 5 + node_modules/lodash/fp/now.js | 5 + node_modules/lodash/fp/nth.js | 5 + node_modules/lodash/fp/nthArg.js | 5 + node_modules/lodash/fp/number.js | 2 + node_modules/lodash/fp/object.js | 2 + node_modules/lodash/fp/omit.js | 5 + node_modules/lodash/fp/omitAll.js | 1 + node_modules/lodash/fp/omitBy.js | 5 + node_modules/lodash/fp/once.js | 5 + node_modules/lodash/fp/orderBy.js | 5 + node_modules/lodash/fp/over.js | 5 + node_modules/lodash/fp/overArgs.js | 5 + node_modules/lodash/fp/overEvery.js | 5 + node_modules/lodash/fp/overSome.js | 5 + node_modules/lodash/fp/pad.js | 5 + node_modules/lodash/fp/padChars.js | 5 + node_modules/lodash/fp/padCharsEnd.js | 5 + node_modules/lodash/fp/padCharsStart.js | 5 + node_modules/lodash/fp/padEnd.js | 5 + node_modules/lodash/fp/padStart.js | 5 + node_modules/lodash/fp/parseInt.js | 5 + node_modules/lodash/fp/partial.js | 5 + node_modules/lodash/fp/partialRight.js | 5 + node_modules/lodash/fp/partition.js | 5 + node_modules/lodash/fp/path.js | 1 + node_modules/lodash/fp/pathEq.js | 1 + node_modules/lodash/fp/pathOr.js | 1 + node_modules/lodash/fp/paths.js | 1 + node_modules/lodash/fp/pick.js | 5 + node_modules/lodash/fp/pickAll.js | 1 + node_modules/lodash/fp/pickBy.js | 5 + node_modules/lodash/fp/pipe.js | 1 + node_modules/lodash/fp/placeholder.js | 6 + node_modules/lodash/fp/plant.js | 5 + node_modules/lodash/fp/pluck.js | 1 + node_modules/lodash/fp/prop.js | 1 + node_modules/lodash/fp/propEq.js | 1 + node_modules/lodash/fp/propOr.js | 1 + node_modules/lodash/fp/property.js | 1 + node_modules/lodash/fp/propertyOf.js | 5 + node_modules/lodash/fp/props.js | 1 + node_modules/lodash/fp/pull.js | 5 + node_modules/lodash/fp/pullAll.js | 5 + node_modules/lodash/fp/pullAllBy.js | 5 + node_modules/lodash/fp/pullAllWith.js | 5 + node_modules/lodash/fp/pullAt.js | 5 + node_modules/lodash/fp/random.js | 5 + node_modules/lodash/fp/range.js | 5 + node_modules/lodash/fp/rangeRight.js | 5 + node_modules/lodash/fp/rangeStep.js | 5 + node_modules/lodash/fp/rangeStepRight.js | 5 + node_modules/lodash/fp/rearg.js | 5 + node_modules/lodash/fp/reduce.js | 5 + node_modules/lodash/fp/reduceRight.js | 5 + node_modules/lodash/fp/reject.js | 5 + node_modules/lodash/fp/remove.js | 5 + node_modules/lodash/fp/repeat.js | 5 + node_modules/lodash/fp/replace.js | 5 + node_modules/lodash/fp/rest.js | 5 + node_modules/lodash/fp/restFrom.js | 5 + node_modules/lodash/fp/result.js | 5 + node_modules/lodash/fp/reverse.js | 5 + node_modules/lodash/fp/round.js | 5 + node_modules/lodash/fp/sample.js | 5 + node_modules/lodash/fp/sampleSize.js | 5 + node_modules/lodash/fp/seq.js | 2 + node_modules/lodash/fp/set.js | 5 + node_modules/lodash/fp/setWith.js | 5 + node_modules/lodash/fp/shuffle.js | 5 + node_modules/lodash/fp/size.js | 5 + node_modules/lodash/fp/slice.js | 5 + node_modules/lodash/fp/snakeCase.js | 5 + node_modules/lodash/fp/some.js | 5 + node_modules/lodash/fp/sortBy.js | 5 + node_modules/lodash/fp/sortedIndex.js | 5 + node_modules/lodash/fp/sortedIndexBy.js | 5 + node_modules/lodash/fp/sortedIndexOf.js | 5 + node_modules/lodash/fp/sortedLastIndex.js | 5 + node_modules/lodash/fp/sortedLastIndexBy.js | 5 + node_modules/lodash/fp/sortedLastIndexOf.js | 5 + node_modules/lodash/fp/sortedUniq.js | 5 + node_modules/lodash/fp/sortedUniqBy.js | 5 + node_modules/lodash/fp/split.js | 5 + node_modules/lodash/fp/spread.js | 5 + node_modules/lodash/fp/spreadFrom.js | 5 + node_modules/lodash/fp/startCase.js | 5 + node_modules/lodash/fp/startsWith.js | 5 + node_modules/lodash/fp/string.js | 2 + node_modules/lodash/fp/stubArray.js | 5 + node_modules/lodash/fp/stubFalse.js | 5 + node_modules/lodash/fp/stubObject.js | 5 + node_modules/lodash/fp/stubString.js | 5 + node_modules/lodash/fp/stubTrue.js | 5 + node_modules/lodash/fp/subtract.js | 5 + node_modules/lodash/fp/sum.js | 5 + node_modules/lodash/fp/sumBy.js | 5 + node_modules/lodash/fp/symmetricDifference.js | 1 + .../lodash/fp/symmetricDifferenceBy.js | 1 + .../lodash/fp/symmetricDifferenceWith.js | 1 + node_modules/lodash/fp/tail.js | 5 + node_modules/lodash/fp/take.js | 5 + node_modules/lodash/fp/takeLast.js | 1 + node_modules/lodash/fp/takeLastWhile.js | 1 + node_modules/lodash/fp/takeRight.js | 5 + node_modules/lodash/fp/takeRightWhile.js | 5 + node_modules/lodash/fp/takeWhile.js | 5 + node_modules/lodash/fp/tap.js | 5 + node_modules/lodash/fp/template.js | 5 + node_modules/lodash/fp/templateSettings.js | 5 + node_modules/lodash/fp/throttle.js | 5 + node_modules/lodash/fp/thru.js | 5 + node_modules/lodash/fp/times.js | 5 + node_modules/lodash/fp/toArray.js | 5 + node_modules/lodash/fp/toFinite.js | 5 + node_modules/lodash/fp/toInteger.js | 5 + node_modules/lodash/fp/toIterator.js | 5 + node_modules/lodash/fp/toJSON.js | 5 + node_modules/lodash/fp/toLength.js | 5 + node_modules/lodash/fp/toLower.js | 5 + node_modules/lodash/fp/toNumber.js | 5 + node_modules/lodash/fp/toPairs.js | 5 + node_modules/lodash/fp/toPairsIn.js | 5 + node_modules/lodash/fp/toPath.js | 5 + node_modules/lodash/fp/toPlainObject.js | 5 + node_modules/lodash/fp/toSafeInteger.js | 5 + node_modules/lodash/fp/toString.js | 5 + node_modules/lodash/fp/toUpper.js | 5 + node_modules/lodash/fp/transform.js | 5 + node_modules/lodash/fp/trim.js | 5 + node_modules/lodash/fp/trimChars.js | 5 + node_modules/lodash/fp/trimCharsEnd.js | 5 + node_modules/lodash/fp/trimCharsStart.js | 5 + node_modules/lodash/fp/trimEnd.js | 5 + node_modules/lodash/fp/trimStart.js | 5 + node_modules/lodash/fp/truncate.js | 5 + node_modules/lodash/fp/unapply.js | 1 + node_modules/lodash/fp/unary.js | 5 + node_modules/lodash/fp/unescape.js | 5 + node_modules/lodash/fp/union.js | 5 + node_modules/lodash/fp/unionBy.js | 5 + node_modules/lodash/fp/unionWith.js | 5 + node_modules/lodash/fp/uniq.js | 5 + node_modules/lodash/fp/uniqBy.js | 5 + node_modules/lodash/fp/uniqWith.js | 5 + node_modules/lodash/fp/uniqueId.js | 5 + node_modules/lodash/fp/unnest.js | 1 + node_modules/lodash/fp/unset.js | 5 + node_modules/lodash/fp/unzip.js | 5 + node_modules/lodash/fp/unzipWith.js | 5 + node_modules/lodash/fp/update.js | 5 + node_modules/lodash/fp/updateWith.js | 5 + node_modules/lodash/fp/upperCase.js | 5 + node_modules/lodash/fp/upperFirst.js | 5 + node_modules/lodash/fp/useWith.js | 1 + node_modules/lodash/fp/util.js | 2 + node_modules/lodash/fp/value.js | 5 + node_modules/lodash/fp/valueOf.js | 5 + node_modules/lodash/fp/values.js | 5 + node_modules/lodash/fp/valuesIn.js | 5 + node_modules/lodash/fp/where.js | 1 + node_modules/lodash/fp/whereEq.js | 1 + node_modules/lodash/fp/without.js | 5 + node_modules/lodash/fp/words.js | 5 + node_modules/lodash/fp/wrap.js | 5 + node_modules/lodash/fp/wrapperAt.js | 5 + node_modules/lodash/fp/wrapperChain.js | 5 + node_modules/lodash/fp/wrapperLodash.js | 5 + node_modules/lodash/fp/wrapperReverse.js | 5 + node_modules/lodash/fp/wrapperValue.js | 5 + node_modules/lodash/fp/xor.js | 5 + node_modules/lodash/fp/xorBy.js | 5 + node_modules/lodash/fp/xorWith.js | 5 + node_modules/lodash/fp/zip.js | 5 + node_modules/lodash/fp/zipAll.js | 5 + node_modules/lodash/fp/zipObj.js | 1 + node_modules/lodash/fp/zipObject.js | 5 + node_modules/lodash/fp/zipObjectDeep.js | 5 + node_modules/lodash/fp/zipWith.js | 5 + node_modules/lodash/fromPairs.js | 28 + node_modules/lodash/function.js | 25 + node_modules/lodash/functions.js | 31 + node_modules/lodash/functionsIn.js | 31 + node_modules/lodash/get.js | 33 + node_modules/lodash/groupBy.js | 41 + node_modules/lodash/gt.js | 29 + node_modules/lodash/gte.js | 30 + node_modules/lodash/has.js | 35 + node_modules/lodash/hasIn.js | 34 + node_modules/lodash/head.js | 23 + node_modules/lodash/identity.js | 21 + node_modules/lodash/inRange.js | 55 + node_modules/lodash/includes.js | 53 + node_modules/lodash/index.js | 1 + node_modules/lodash/indexOf.js | 42 + node_modules/lodash/initial.js | 22 + node_modules/lodash/intersection.js | 30 + node_modules/lodash/intersectionBy.js | 45 + node_modules/lodash/intersectionWith.js | 41 + node_modules/lodash/invert.js | 42 + node_modules/lodash/invertBy.js | 56 + node_modules/lodash/invoke.js | 24 + node_modules/lodash/invokeMap.js | 41 + node_modules/lodash/isArguments.js | 36 + node_modules/lodash/isArray.js | 26 + node_modules/lodash/isArrayBuffer.js | 27 + node_modules/lodash/isArrayLike.js | 33 + node_modules/lodash/isArrayLikeObject.js | 33 + node_modules/lodash/isBoolean.js | 29 + node_modules/lodash/isBuffer.js | 38 + node_modules/lodash/isDate.js | 27 + node_modules/lodash/isElement.js | 25 + node_modules/lodash/isEmpty.js | 77 + node_modules/lodash/isEqual.js | 35 + node_modules/lodash/isEqualWith.js | 41 + node_modules/lodash/isError.js | 36 + node_modules/lodash/isFinite.js | 36 + node_modules/lodash/isFunction.js | 37 + node_modules/lodash/isInteger.js | 33 + node_modules/lodash/isLength.js | 35 + node_modules/lodash/isMap.js | 27 + node_modules/lodash/isMatch.js | 36 + node_modules/lodash/isMatchWith.js | 41 + node_modules/lodash/isNaN.js | 38 + node_modules/lodash/isNative.js | 40 + node_modules/lodash/isNil.js | 25 + node_modules/lodash/isNull.js | 22 + node_modules/lodash/isNumber.js | 38 + node_modules/lodash/isObject.js | 31 + node_modules/lodash/isObjectLike.js | 29 + node_modules/lodash/isPlainObject.js | 62 + node_modules/lodash/isRegExp.js | 27 + node_modules/lodash/isSafeInteger.js | 37 + node_modules/lodash/isSet.js | 27 + node_modules/lodash/isString.js | 30 + node_modules/lodash/isSymbol.js | 29 + node_modules/lodash/isTypedArray.js | 27 + node_modules/lodash/isUndefined.js | 22 + node_modules/lodash/isWeakMap.js | 28 + node_modules/lodash/isWeakSet.js | 28 + node_modules/lodash/iteratee.js | 53 + node_modules/lodash/join.js | 26 + node_modules/lodash/kebabCase.js | 28 + node_modules/lodash/keyBy.js | 36 + node_modules/lodash/keys.js | 37 + node_modules/lodash/keysIn.js | 32 + node_modules/lodash/lang.js | 58 + node_modules/lodash/last.js | 20 + node_modules/lodash/lastIndexOf.js | 46 + node_modules/lodash/lodash.js | 17097 ++++++++++++++ node_modules/lodash/lodash.min.js | 137 + node_modules/lodash/lowerCase.js | 27 + node_modules/lodash/lowerFirst.js | 22 + node_modules/lodash/lt.js | 29 + node_modules/lodash/lte.js | 30 + node_modules/lodash/map.js | 53 + node_modules/lodash/mapKeys.js | 36 + node_modules/lodash/mapValues.js | 43 + node_modules/lodash/matches.js | 39 + node_modules/lodash/matchesProperty.js | 37 + node_modules/lodash/math.js | 17 + node_modules/lodash/max.js | 29 + node_modules/lodash/maxBy.js | 34 + node_modules/lodash/mean.js | 22 + node_modules/lodash/meanBy.js | 31 + node_modules/lodash/memoize.js | 73 + node_modules/lodash/merge.js | 39 + node_modules/lodash/mergeWith.js | 39 + node_modules/lodash/method.js | 34 + node_modules/lodash/methodOf.js | 33 + node_modules/lodash/min.js | 29 + node_modules/lodash/minBy.js | 34 + node_modules/lodash/mixin.js | 74 + node_modules/lodash/multiply.js | 22 + node_modules/lodash/negate.js | 40 + node_modules/lodash/next.js | 35 + node_modules/lodash/noop.js | 17 + node_modules/lodash/now.js | 23 + node_modules/lodash/nth.js | 29 + node_modules/lodash/nthArg.js | 32 + node_modules/lodash/number.js | 5 + node_modules/lodash/object.js | 49 + node_modules/lodash/omit.js | 57 + node_modules/lodash/omitBy.js | 29 + node_modules/lodash/once.js | 25 + node_modules/lodash/orderBy.js | 47 + node_modules/lodash/over.js | 24 + node_modules/lodash/overArgs.js | 61 + node_modules/lodash/overEvery.js | 30 + node_modules/lodash/overSome.js | 30 + node_modules/lodash/package.json | 66 + node_modules/lodash/pad.js | 49 + node_modules/lodash/padEnd.js | 39 + node_modules/lodash/padStart.js | 39 + node_modules/lodash/parseInt.js | 43 + node_modules/lodash/partial.js | 50 + node_modules/lodash/partialRight.js | 49 + node_modules/lodash/partition.js | 43 + node_modules/lodash/pick.js | 25 + node_modules/lodash/pickBy.js | 37 + node_modules/lodash/plant.js | 48 + node_modules/lodash/property.js | 32 + node_modules/lodash/propertyOf.js | 30 + node_modules/lodash/pull.js | 29 + node_modules/lodash/pullAll.js | 29 + node_modules/lodash/pullAllBy.js | 33 + node_modules/lodash/pullAllWith.js | 32 + node_modules/lodash/pullAt.js | 43 + node_modules/lodash/random.js | 82 + node_modules/lodash/range.js | 46 + node_modules/lodash/rangeRight.js | 41 + node_modules/lodash/rearg.js | 33 + node_modules/lodash/reduce.js | 51 + node_modules/lodash/reduceRight.js | 36 + node_modules/lodash/reject.js | 46 + node_modules/lodash/remove.js | 53 + node_modules/lodash/repeat.js | 37 + node_modules/lodash/replace.js | 29 + node_modules/lodash/rest.js | 40 + node_modules/lodash/result.js | 56 + node_modules/lodash/reverse.js | 34 + node_modules/lodash/round.js | 26 + node_modules/lodash/sample.js | 24 + node_modules/lodash/sampleSize.js | 37 + node_modules/lodash/seq.js | 16 + node_modules/lodash/set.js | 35 + node_modules/lodash/setWith.js | 32 + node_modules/lodash/shuffle.js | 25 + node_modules/lodash/size.js | 46 + node_modules/lodash/slice.js | 37 + node_modules/lodash/snakeCase.js | 28 + node_modules/lodash/some.js | 51 + node_modules/lodash/sortBy.js | 48 + node_modules/lodash/sortedIndex.js | 24 + node_modules/lodash/sortedIndexBy.js | 33 + node_modules/lodash/sortedIndexOf.js | 31 + node_modules/lodash/sortedLastIndex.js | 25 + node_modules/lodash/sortedLastIndexBy.js | 33 + node_modules/lodash/sortedLastIndexOf.js | 31 + node_modules/lodash/sortedUniq.js | 24 + node_modules/lodash/sortedUniqBy.js | 26 + node_modules/lodash/split.js | 52 + node_modules/lodash/spread.js | 63 + node_modules/lodash/startCase.js | 29 + node_modules/lodash/startsWith.js | 39 + node_modules/lodash/string.js | 33 + node_modules/lodash/stubArray.js | 23 + node_modules/lodash/stubFalse.js | 18 + node_modules/lodash/stubObject.js | 23 + node_modules/lodash/stubString.js | 18 + node_modules/lodash/stubTrue.js | 18 + node_modules/lodash/subtract.js | 22 + node_modules/lodash/sum.js | 24 + node_modules/lodash/sumBy.js | 33 + node_modules/lodash/tail.js | 22 + node_modules/lodash/take.js | 37 + node_modules/lodash/takeRight.js | 39 + node_modules/lodash/takeRightWhile.js | 45 + node_modules/lodash/takeWhile.js | 45 + node_modules/lodash/tap.js | 29 + node_modules/lodash/template.js | 238 + node_modules/lodash/templateSettings.js | 67 + node_modules/lodash/throttle.js | 69 + node_modules/lodash/thru.js | 28 + node_modules/lodash/times.js | 51 + node_modules/lodash/toArray.js | 58 + node_modules/lodash/toFinite.js | 42 + node_modules/lodash/toInteger.js | 36 + node_modules/lodash/toIterator.js | 23 + node_modules/lodash/toJSON.js | 1 + node_modules/lodash/toLength.js | 38 + node_modules/lodash/toLower.js | 28 + node_modules/lodash/toNumber.js | 66 + node_modules/lodash/toPairs.js | 30 + node_modules/lodash/toPairsIn.js | 30 + node_modules/lodash/toPath.js | 33 + node_modules/lodash/toPlainObject.js | 32 + node_modules/lodash/toSafeInteger.js | 37 + node_modules/lodash/toString.js | 28 + node_modules/lodash/toUpper.js | 28 + node_modules/lodash/transform.js | 65 + node_modules/lodash/trim.js | 49 + node_modules/lodash/trimEnd.js | 43 + node_modules/lodash/trimStart.js | 43 + node_modules/lodash/truncate.js | 111 + node_modules/lodash/unary.js | 22 + node_modules/lodash/unescape.js | 34 + node_modules/lodash/union.js | 26 + node_modules/lodash/unionBy.js | 39 + node_modules/lodash/unionWith.js | 34 + node_modules/lodash/uniq.js | 25 + node_modules/lodash/uniqBy.js | 31 + node_modules/lodash/uniqWith.js | 28 + node_modules/lodash/uniqueId.js | 28 + node_modules/lodash/unset.js | 34 + node_modules/lodash/unzip.js | 45 + node_modules/lodash/unzipWith.js | 39 + node_modules/lodash/update.js | 35 + node_modules/lodash/updateWith.js | 33 + node_modules/lodash/upperCase.js | 27 + node_modules/lodash/upperFirst.js | 22 + node_modules/lodash/util.js | 34 + node_modules/lodash/value.js | 1 + node_modules/lodash/valueOf.js | 1 + node_modules/lodash/values.js | 34 + node_modules/lodash/valuesIn.js | 32 + node_modules/lodash/without.js | 31 + node_modules/lodash/words.js | 35 + node_modules/lodash/wrap.js | 30 + node_modules/lodash/wrapperAt.js | 48 + node_modules/lodash/wrapperChain.js | 34 + node_modules/lodash/wrapperLodash.js | 147 + node_modules/lodash/wrapperReverse.js | 44 + node_modules/lodash/wrapperValue.js | 21 + node_modules/lodash/xor.js | 28 + node_modules/lodash/xorBy.js | 39 + node_modules/lodash/xorWith.js | 34 + node_modules/lodash/zip.js | 22 + node_modules/lodash/zipObject.js | 24 + node_modules/lodash/zipObjectDeep.js | 23 + node_modules/lodash/zipWith.js | 32 + node_modules/longest/LICENSE | 21 + node_modules/longest/README.md | 65 + node_modules/longest/index.js | 37 + node_modules/longest/package.json | 68 + node_modules/lowercase-keys/index.js | 11 + node_modules/lowercase-keys/package.json | 67 + node_modules/lowercase-keys/readme.md | 33 + node_modules/lru-cache/LICENSE | 15 + node_modules/lru-cache/README.md | 158 + node_modules/lru-cache/index.js | 467 + node_modules/lru-cache/package.json | 68 + node_modules/make-dir/index.js | 83 + node_modules/make-dir/license | 9 + node_modules/make-dir/package.json | 86 + node_modules/make-dir/readme.md | 116 + node_modules/map-cache/LICENSE | 21 + node_modules/map-cache/README.md | 145 + node_modules/map-cache/index.js | 100 + node_modules/map-cache/package.json | 91 + node_modules/map-stream/.npmignore | 3 + node_modules/map-stream/.travis.yml | 4 + node_modules/map-stream/LICENCE | 22 + node_modules/map-stream/examples/pretty.js | 26 + node_modules/map-stream/index.js | 145 + node_modules/map-stream/package.json | 55 + node_modules/map-stream/readme.markdown | 37 + .../map-stream/test/simple-map.asynct.js | 318 + node_modules/map-visit/LICENSE | 21 + node_modules/map-visit/README.md | 155 + node_modules/map-visit/index.js | 37 + node_modules/map-visit/package.json | 113 + node_modules/media-typer/HISTORY.md | 22 + node_modules/media-typer/LICENSE | 22 + node_modules/media-typer/README.md | 81 + node_modules/media-typer/index.js | 270 + node_modules/media-typer/package.json | 61 + node_modules/merge-descriptors/HISTORY.md | 21 + node_modules/merge-descriptors/LICENSE | 23 + node_modules/merge-descriptors/README.md | 48 + node_modules/merge-descriptors/index.js | 60 + node_modules/merge-descriptors/package.json | 69 + node_modules/methods/HISTORY.md | 29 + node_modules/methods/LICENSE | 24 + node_modules/methods/README.md | 51 + node_modules/methods/index.js | 69 + node_modules/methods/package.json | 79 + node_modules/micromatch/CHANGELOG.md | 37 + node_modules/micromatch/LICENSE | 21 + node_modules/micromatch/README.md | 1150 + node_modules/micromatch/index.js | 877 + node_modules/micromatch/lib/cache.js | 1 + node_modules/micromatch/lib/compilers.js | 77 + node_modules/micromatch/lib/parsers.js | 83 + node_modules/micromatch/lib/utils.js | 309 + .../node_modules/kind-of/CHANGELOG.md | 157 + .../micromatch/node_modules/kind-of/LICENSE | 21 + .../micromatch/node_modules/kind-of/README.md | 365 + .../micromatch/node_modules/kind-of/index.js | 129 + .../node_modules/kind-of/package.json | 143 + node_modules/micromatch/package.json | 216 + node_modules/mime-db/HISTORY.md | 368 + node_modules/mime-db/LICENSE | 22 + node_modules/mime-db/README.md | 94 + node_modules/mime-db/db.json | 7088 ++++++ node_modules/mime-db/index.js | 11 + node_modules/mime-db/package.json | 100 + node_modules/mime-types/HISTORY.md | 260 + node_modules/mime-types/LICENSE | 23 + node_modules/mime-types/README.md | 108 + node_modules/mime-types/index.js | 188 + node_modules/mime-types/package.json | 87 + node_modules/mime/.npmignore | 0 node_modules/mime/LICENSE | 19 + node_modules/mime/README.md | 90 + node_modules/mime/build/build.js | 11 + node_modules/mime/build/test.js | 57 + node_modules/mime/cli.js | 8 + node_modules/mime/mime.js | 108 + node_modules/mime/package.json | 72 + node_modules/mime/types.json | 1 + node_modules/minimatch/LICENSE | 15 + node_modules/minimatch/README.md | 209 + node_modules/minimatch/minimatch.js | 923 + node_modules/minimatch/package.json | 64 + node_modules/minimist/.travis.yml | 8 + node_modules/minimist/LICENSE | 18 + node_modules/minimist/example/parse.js | 2 + node_modules/minimist/index.js | 236 + node_modules/minimist/package.json | 73 + node_modules/minimist/readme.markdown | 91 + node_modules/minimist/test/all_bool.js | 32 + node_modules/minimist/test/bool.js | 166 + node_modules/minimist/test/dash.js | 31 + node_modules/minimist/test/default_bool.js | 35 + node_modules/minimist/test/dotted.js | 22 + node_modules/minimist/test/kv_short.js | 16 + node_modules/minimist/test/long.js | 31 + node_modules/minimist/test/num.js | 36 + node_modules/minimist/test/parse.js | 197 + node_modules/minimist/test/parse_modified.js | 9 + node_modules/minimist/test/short.js | 67 + node_modules/minimist/test/stop_early.js | 15 + node_modules/minimist/test/unknown.js | 102 + node_modules/minimist/test/whitespace.js | 8 + node_modules/mixin-deep/LICENSE | 21 + node_modules/mixin-deep/README.md | 80 + node_modules/mixin-deep/index.js | 53 + .../node_modules/is-extendable/LICENSE | 21 + .../node_modules/is-extendable/README.md | 88 + .../node_modules/is-extendable/index.d.ts | 5 + .../node_modules/is-extendable/index.js | 14 + .../node_modules/is-extendable/package.json | 98 + node_modules/mixin-deep/package.json | 98 + node_modules/mongodb-core/.coveralls.yml | 1 + node_modules/mongodb-core/.eslintrc | 30 + node_modules/mongodb-core/HISTORY.md | 829 + node_modules/mongodb-core/LICENSE | 201 + node_modules/mongodb-core/Makefile | 11 + node_modules/mongodb-core/README.md | 228 + node_modules/mongodb-core/THIRD-PARTY-NOTICES | 41 + node_modules/mongodb-core/conf.json | 59 + node_modules/mongodb-core/index.js | 38 + node_modules/mongodb-core/lib/auth/gssapi.js | 384 + node_modules/mongodb-core/lib/auth/mongocr.js | 214 + node_modules/mongodb-core/lib/auth/plain.js | 183 + node_modules/mongodb-core/lib/auth/scram.js | 367 + node_modules/mongodb-core/lib/auth/sspi.js | 304 + node_modules/mongodb-core/lib/auth/x509.js | 179 + .../lib/connection/command_result.js | 34 + .../mongodb-core/lib/connection/commands.js | 531 + .../mongodb-core/lib/connection/connection.js | 804 + .../mongodb-core/lib/connection/logger.js | 246 + .../mongodb-core/lib/connection/pool.js | 1621 ++ .../mongodb-core/lib/connection/utils.js | 113 + node_modules/mongodb-core/lib/cursor.js | 794 + node_modules/mongodb-core/lib/error.js | 82 + node_modules/mongodb-core/lib/sessions.js | 191 + .../mongodb-core/lib/tools/smoke_plugin.js | 61 + .../mongodb-core/lib/topologies/mongos.js | 1452 ++ .../lib/topologies/read_preference.js | 171 + .../mongodb-core/lib/topologies/replset.js | 1674 ++ .../lib/topologies/replset_state.js | 1104 + .../mongodb-core/lib/topologies/server.js | 1102 + .../mongodb-core/lib/topologies/shared.js | 447 + node_modules/mongodb-core/lib/uri_parser.js | 304 + node_modules/mongodb-core/lib/utils.js | 14 + .../lib/wireprotocol/2_6_support.js | 374 + .../lib/wireprotocol/3_2_support.js | 590 + .../lib/wireprotocol/compression.js | 73 + .../mongodb-core/lib/wireprotocol/shared.js | 55 + node_modules/mongodb-core/package.json | 75 + node_modules/mongodb-core/yarn.lock | 3263 +++ node_modules/mongodb/.coveralls.yml | 1 + node_modules/mongodb/.eslintrc | 30 + node_modules/mongodb/CHANGES_3.0.0.md | 288 + node_modules/mongodb/HISTORY.md | 1910 ++ node_modules/mongodb/LICENSE | 201 + node_modules/mongodb/Makefile | 11 + node_modules/mongodb/README.md | 486 + node_modules/mongodb/THIRD-PARTY-NOTICES | 41 + node_modules/mongodb/boot_auth.js | 52 + node_modules/mongodb/conf.json | 76 + node_modules/mongodb/index.js | 62 + node_modules/mongodb/insert_bench.js | 231 + node_modules/mongodb/lib/admin.js | 371 + .../mongodb/lib/aggregation_cursor.js | 436 + node_modules/mongodb/lib/apm.js | 639 + node_modules/mongodb/lib/authenticate.js | 130 + node_modules/mongodb/lib/bulk/common.js | 465 + node_modules/mongodb/lib/bulk/ordered.js | 617 + node_modules/mongodb/lib/bulk/unordered.js | 631 + node_modules/mongodb/lib/change_stream.js | 359 + node_modules/mongodb/lib/collection.js | 3143 +++ node_modules/mongodb/lib/command_cursor.js | 347 + node_modules/mongodb/lib/cursor.js | 1304 ++ node_modules/mongodb/lib/db.js | 1809 ++ .../mongodb/lib/gridfs-stream/download.js | 415 + .../mongodb/lib/gridfs-stream/index.js | 346 + .../mongodb/lib/gridfs-stream/upload.js | 529 + node_modules/mongodb/lib/gridfs/chunk.js | 234 + node_modules/mongodb/lib/gridfs/grid_store.js | 1951 ++ node_modules/mongodb/lib/metadata.js | 70 + node_modules/mongodb/lib/mongo_client.js | 944 + node_modules/mongodb/lib/topologies/mongos.js | 446 + .../mongodb/lib/topologies/replset.js | 490 + node_modules/mongodb/lib/topologies/server.js | 450 + .../mongodb/lib/topologies/topology_base.js | 459 + node_modules/mongodb/lib/url_parser.js | 610 + node_modules/mongodb/lib/utils.js | 460 + node_modules/mongodb/package.json | 81 + node_modules/mongodb/yarn.lock | 3904 ++++ .../mongoose-legacy-pluralize/LICENSE | 201 + .../mongoose-legacy-pluralize/README.md | 2 + .../mongoose-legacy-pluralize/index.js | 95 + .../mongoose-legacy-pluralize/package.json | 51 + node_modules/mongoose/.eslintignore | 6 + .../mongoose/.github/ISSUE_TEMPLATE.md | 12 + .../mongoose/.github/PULL_REQUEST_TEMPLATE.md | 9 + node_modules/mongoose/.travis.yml | 21 + node_modules/mongoose/CONTRIBUTING.md | 91 + node_modules/mongoose/History.md | 4125 ++++ node_modules/mongoose/README.md | 327 + node_modules/mongoose/browser.js | 6 + node_modules/mongoose/examples/README.md | 41 + .../mongoose/examples/aggregate/aggregate.js | 103 + .../mongoose/examples/aggregate/package.json | 14 + .../mongoose/examples/aggregate/person.js | 17 + node_modules/mongoose/examples/doc-methods.js | 77 + .../mongoose/examples/express/README.md | 1 + .../express/connection-sharing/README.md | 6 + .../express/connection-sharing/app.js | 17 + .../express/connection-sharing/modelA.js | 5 + .../express/connection-sharing/package.json | 14 + .../express/connection-sharing/routes.js | 20 + .../examples/geospatial/geoJSONSchema.js | 22 + .../examples/geospatial/geoJSONexample.js | 56 + .../examples/geospatial/geospatial.js | 100 + .../mongoose/examples/geospatial/package.json | 14 + .../mongoose/examples/geospatial/person.js | 27 + .../examples/globalschemas/gs_example.js | 47 + .../mongoose/examples/globalschemas/person.js | 14 + node_modules/mongoose/examples/lean/lean.js | 84 + .../mongoose/examples/lean/package.json | 14 + node_modules/mongoose/examples/lean/person.js | 16 + .../mongoose/examples/mapreduce/mapreduce.js | 100 + .../mongoose/examples/mapreduce/package.json | 14 + .../mongoose/examples/mapreduce/person.js | 16 + .../population-across-three-collections.js | 134 + .../examples/population/population-basic.js | 103 + .../population/population-of-existing-doc.js | 109 + .../population-of-multiple-existing-docs.js | 124 + .../examples/population/population-options.js | 138 + .../population/population-plain-objects.js | 106 + .../mongoose/examples/promises/package.json | 14 + .../mongoose/examples/promises/person.js | 15 + .../mongoose/examples/promises/promise.js | 94 + .../examples/querybuilder/package.json | 14 + .../mongoose/examples/querybuilder/person.js | 15 + .../examples/querybuilder/querybuilder.js | 79 + .../examples/replicasets/package.json | 14 + .../mongoose/examples/replicasets/person.js | 15 + .../examples/replicasets/replica-sets.js | 71 + .../mongoose/examples/schema/schema.js | 119 + .../schema/storing-schemas-as-json/index.js | 27 + .../storing-schemas-as-json/schema.json | 9 + .../mongoose/examples/statics/person.js | 20 + .../mongoose/examples/statics/statics.js | 41 + node_modules/mongoose/index.js | 7 + node_modules/mongoose/lib/aggregate.js | 888 + node_modules/mongoose/lib/browser.js | 129 + node_modules/mongoose/lib/browserDocument.js | 118 + node_modules/mongoose/lib/cast.js | 306 + node_modules/mongoose/lib/collection.js | 248 + node_modules/mongoose/lib/connection.js | 712 + node_modules/mongoose/lib/connectionstate.js | 24 + .../mongoose/lib/cursor/AggregationCursor.js | 281 + .../mongoose/lib/cursor/ChangeStream.js | 48 + .../mongoose/lib/cursor/QueryCursor.js | 311 + node_modules/mongoose/lib/document.js | 2725 +++ .../mongoose/lib/document_provider.js | 30 + node_modules/mongoose/lib/drivers/SPEC.md | 4 + .../lib/drivers/browser/ReadPreference.js | 5 + .../mongoose/lib/drivers/browser/binary.js | 12 + .../lib/drivers/browser/decimal128.js | 5 + .../mongoose/lib/drivers/browser/index.js | 8 + .../mongoose/lib/drivers/browser/objectid.js | 14 + node_modules/mongoose/lib/drivers/index.js | 20 + .../mongoose/lib/drivers/index.web.js | 5 + .../node-mongodb-native/ReadPreference.js | 45 + .../lib/drivers/node-mongodb-native/binary.js | 8 + .../drivers/node-mongodb-native/collection.js | 280 + .../drivers/node-mongodb-native/connection.js | 168 + .../drivers/node-mongodb-native/decimal128.js | 5 + .../lib/drivers/node-mongodb-native/index.js | 8 + .../drivers/node-mongodb-native/objectid.js | 14 + .../lib/error/browserMissingSchema.js | 36 + node_modules/mongoose/lib/error/cast.js | 60 + .../mongoose/lib/error/disconnected.js | 40 + .../mongoose/lib/error/divergentArray.js | 46 + node_modules/mongoose/lib/error/index.js | 116 + node_modules/mongoose/lib/error/messages.js | 44 + .../mongoose/lib/error/missingSchema.js | 37 + node_modules/mongoose/lib/error/notFound.js | 50 + .../mongoose/lib/error/objectExpected.js | 35 + .../mongoose/lib/error/objectParameter.js | 36 + .../mongoose/lib/error/overwriteModel.js | 35 + node_modules/mongoose/lib/error/strict.js | 36 + node_modules/mongoose/lib/error/validation.js | 101 + node_modules/mongoose/lib/error/validator.js | 82 + node_modules/mongoose/lib/error/version.js | 33 + node_modules/mongoose/lib/index.js | 730 + node_modules/mongoose/lib/internal.js | 32 + node_modules/mongoose/lib/model.js | 3941 ++++ node_modules/mongoose/lib/options.js | 14 + node_modules/mongoose/lib/plugins/idGetter.js | 26 + .../mongoose/lib/plugins/removeSubdocs.js | 38 + .../mongoose/lib/plugins/saveSubdocs.js | 38 + node_modules/mongoose/lib/plugins/sharding.js | 76 + .../lib/plugins/validateBeforeSave.js | 38 + node_modules/mongoose/lib/promise_provider.js | 47 + node_modules/mongoose/lib/query.js | 3779 +++ node_modules/mongoose/lib/queryhelpers.js | 263 + node_modules/mongoose/lib/schema.js | 1834 ++ node_modules/mongoose/lib/schema/array.js | 376 + node_modules/mongoose/lib/schema/boolean.js | 107 + node_modules/mongoose/lib/schema/buffer.js | 216 + node_modules/mongoose/lib/schema/date.js | 298 + .../mongoose/lib/schema/decimal128.js | 150 + .../mongoose/lib/schema/documentarray.js | 398 + node_modules/mongoose/lib/schema/embedded.js | 271 + node_modules/mongoose/lib/schema/index.js | 32 + node_modules/mongoose/lib/schema/mixed.js | 80 + node_modules/mongoose/lib/schema/number.js | 290 + node_modules/mongoose/lib/schema/objectid.js | 229 + .../mongoose/lib/schema/operators/bitwise.js | 36 + .../mongoose/lib/schema/operators/exists.js | 13 + .../lib/schema/operators/geospatial.js | 100 + .../mongoose/lib/schema/operators/helpers.js | 34 + .../mongoose/lib/schema/operators/type.js | 13 + node_modules/mongoose/lib/schema/string.js | 522 + node_modules/mongoose/lib/schematype.js | 1094 + node_modules/mongoose/lib/services/common.js | 87 + .../mongoose/lib/services/cursor/eachAsync.js | 71 + .../document/cleanModifiedSubpaths.js | 18 + .../mongoose/lib/services/document/compile.js | 146 + .../mongoose/lib/services/model/applyHooks.js | 51 + .../lib/services/model/applyMethods.js | 43 + .../lib/services/model/applyStatics.js | 12 + .../lib/services/model/discriminator.js | 138 + .../lib/services/populate/getSchemaTypes.js | 115 + .../projection/isDefiningProjection.js | 18 + .../lib/services/projection/isExclusive.js | 28 + .../lib/services/projection/isInclusive.js | 30 + .../projection/isPathSelectedInclusive.js | 28 + .../mongoose/lib/services/query/castUpdate.js | 376 + .../lib/services/query/hasDollarKeys.js | 16 + .../services/query/selectPopulatedFields.js | 45 + .../lib/services/setDefaultsOnInsert.js | 114 + .../mongoose/lib/services/updateValidators.js | 161 + node_modules/mongoose/lib/statemachine.js | 178 + node_modules/mongoose/lib/types/array.js | 838 + node_modules/mongoose/lib/types/buffer.js | 295 + node_modules/mongoose/lib/types/decimal128.js | 11 + .../mongoose/lib/types/documentarray.js | 300 + node_modules/mongoose/lib/types/embedded.js | 384 + node_modules/mongoose/lib/types/index.js | 16 + node_modules/mongoose/lib/types/objectid.js | 13 + .../mongoose/lib/types/subdocument.js | 197 + node_modules/mongoose/lib/utils.js | 822 + node_modules/mongoose/lib/virtualtype.js | 103 + node_modules/mongoose/migrating_to_5.md | 248 + node_modules/mongoose/package.json | 159 + node_modules/mongoose/release-items.md | 29 + node_modules/mongoose/static.js | 23 + node_modules/mongoose/tools/auth.js | 30 + node_modules/mongoose/tools/repl.js | 36 + node_modules/mongoose/tools/sharded.js | 42 + node_modules/mongoose/website.js | 86 + node_modules/morgan/HISTORY.md | 195 + node_modules/morgan/LICENSE | 23 + node_modules/morgan/README.md | 415 + node_modules/morgan/index.js | 522 + node_modules/morgan/package.json | 91 + node_modules/mpath/.npmignore | 2 + node_modules/mpath/.travis.yml | 4 + node_modules/mpath/History.md | 33 + node_modules/mpath/LICENSE | 22 + node_modules/mpath/Makefile | 8 + node_modules/mpath/README.md | 278 + node_modules/mpath/bench.js | 109 + node_modules/mpath/bench.log | 0 node_modules/mpath/bench.out | 52 + node_modules/mpath/component.json | 8 + node_modules/mpath/index.js | 1 + node_modules/mpath/lib/index.js | 275 + node_modules/mpath/package.json | 57 + node_modules/mpath/test/index.js | 1820 ++ node_modules/mquery/.travis.yml | 10 + node_modules/mquery/History.md | 311 + node_modules/mquery/LICENSE | 22 + node_modules/mquery/Makefile | 22 + node_modules/mquery/README.md | 1219 + .../mquery/lib/collection/collection.js | 46 + node_modules/mquery/lib/collection/index.js | 13 + node_modules/mquery/lib/collection/node.js | 151 + node_modules/mquery/lib/env.js | 22 + node_modules/mquery/lib/mquery.js | 3041 +++ node_modules/mquery/lib/permissions.js | 88 + node_modules/mquery/lib/utils.js | 320 + .../mquery/node_modules/sliced/.npmignore | 2 + .../mquery/node_modules/sliced/.travis.yml | 4 + .../mquery/node_modules/sliced/History.md | 30 + .../mquery/node_modules/sliced/LICENSE | 22 + .../mquery/node_modules/sliced/Makefile | 5 + .../mquery/node_modules/sliced/README.md | 62 + .../mquery/node_modules/sliced/bench.js | 95 + .../mquery/node_modules/sliced/component.json | 14 + .../mquery/node_modules/sliced/index.js | 1 + .../mquery/node_modules/sliced/lib/sliced.js | 33 + .../mquery/node_modules/sliced/package.json | 56 + .../mquery/node_modules/sliced/test/index.js | 80 + node_modules/mquery/package.json | 64 + .../mquery/test/collection/browser.js | 0 node_modules/mquery/test/collection/mongo.js | 0 node_modules/mquery/test/collection/node.js | 28 + node_modules/mquery/test/env.js | 20 + node_modules/mquery/test/index.js | 2944 +++ node_modules/mquery/test/utils.test.js | 143 + node_modules/ms/index.js | 152 + node_modules/ms/license.md | 21 + node_modules/ms/package.json | 71 + node_modules/ms/readme.md | 51 + node_modules/nan/CHANGELOG.md | 485 + node_modules/nan/LICENSE.md | 13 + node_modules/nan/README.md | 456 + node_modules/nan/doc/asyncworker.md | 146 + node_modules/nan/doc/buffers.md | 54 + node_modules/nan/doc/callback.md | 76 + node_modules/nan/doc/converters.md | 41 + node_modules/nan/doc/errors.md | 226 + node_modules/nan/doc/json.md | 62 + node_modules/nan/doc/maybe_types.md | 582 + node_modules/nan/doc/methods.md | 659 + node_modules/nan/doc/new.md | 147 + node_modules/nan/doc/node_misc.md | 121 + node_modules/nan/doc/object_wrappers.md | 263 + node_modules/nan/doc/persistent.md | 295 + node_modules/nan/doc/scopes.md | 73 + node_modules/nan/doc/script.md | 38 + node_modules/nan/doc/string_bytes.md | 62 + node_modules/nan/doc/v8_internals.md | 199 + node_modules/nan/doc/v8_misc.md | 85 + node_modules/nan/include_dirs.js | 1 + node_modules/nan/nan.h | 2657 +++ node_modules/nan/nan_callbacks.h | 88 + node_modules/nan/nan_callbacks_12_inl.h | 512 + node_modules/nan/nan_callbacks_pre_12_inl.h | 520 + node_modules/nan/nan_converters.h | 72 + node_modules/nan/nan_converters_43_inl.h | 48 + node_modules/nan/nan_converters_pre_43_inl.h | 42 + node_modules/nan/nan_implementation_12_inl.h | 399 + .../nan/nan_implementation_pre_12_inl.h | 263 + node_modules/nan/nan_json.h | 166 + node_modules/nan/nan_maybe_43_inl.h | 369 + node_modules/nan/nan_maybe_pre_43_inl.h | 318 + node_modules/nan/nan_new.h | 340 + node_modules/nan/nan_object_wrap.h | 155 + node_modules/nan/nan_persistent_12_inl.h | 132 + node_modules/nan/nan_persistent_pre_12_inl.h | 242 + node_modules/nan/nan_private.h | 73 + node_modules/nan/nan_string_bytes.h | 305 + node_modules/nan/nan_typedarray_contents.h | 90 + node_modules/nan/nan_weak.h | 432 + node_modules/nan/package.json | 97 + node_modules/nan/tools/1to2.js | 412 + node_modules/nan/tools/README.md | 14 + node_modules/nan/tools/package.json | 19 + node_modules/nanomatch/CHANGELOG.md | 57 + node_modules/nanomatch/LICENSE | 21 + node_modules/nanomatch/README.md | 1148 + node_modules/nanomatch/index.js | 838 + node_modules/nanomatch/lib/cache.js | 1 + node_modules/nanomatch/lib/compiler2.js | 320 + node_modules/nanomatch/lib/compilers.js | 339 + node_modules/nanomatch/lib/parsers.js | 387 + node_modules/nanomatch/lib/utils.js | 379 + .../node_modules/kind-of/CHANGELOG.md | 157 + .../nanomatch/node_modules/kind-of/LICENSE | 21 + .../nanomatch/node_modules/kind-of/README.md | 365 + .../nanomatch/node_modules/kind-of/index.js | 129 + .../node_modules/kind-of/package.json | 143 + node_modules/nanomatch/package.json | 172 + node_modules/negotiator/HISTORY.md | 98 + node_modules/negotiator/LICENSE | 24 + node_modules/negotiator/README.md | 203 + node_modules/negotiator/index.js | 124 + node_modules/negotiator/lib/charset.js | 169 + node_modules/negotiator/lib/encoding.js | 184 + node_modules/negotiator/lib/language.js | 179 + node_modules/negotiator/lib/mediaType.js | 294 + node_modules/negotiator/package.json | 81 + node_modules/nodemon/.github/CONTRIBUTING.md | 35 + .../nodemon/.github/ISSUE_TEMPLATE.md | 18 + node_modules/nodemon/.github/no-response.yml | 13 + node_modules/nodemon/.github/oliver.yml | 12 + node_modules/nodemon/.github/stale.yml | 20 + node_modules/nodemon/.jscsrc | 13 + node_modules/nodemon/.jshintrc | 16 + node_modules/nodemon/.travis.yml | 18 + node_modules/nodemon/CODE_OF_CONDUCT.md | 22 + node_modules/nodemon/README.md | 343 + node_modules/nodemon/bin/nodemon.js | 16 + node_modules/nodemon/commitlint.config.js | 7 + node_modules/nodemon/doc/arch.md | 41 + node_modules/nodemon/doc/cli/authors.txt | 8 + node_modules/nodemon/doc/cli/config.txt | 44 + node_modules/nodemon/doc/cli/help.txt | 29 + node_modules/nodemon/doc/cli/logo.txt | 20 + node_modules/nodemon/doc/cli/options.txt | 36 + node_modules/nodemon/doc/cli/topics.txt | 8 + node_modules/nodemon/doc/cli/usage.txt | 3 + node_modules/nodemon/doc/cli/whoami.txt | 9 + node_modules/nodemon/doc/events.md | 79 + .../nodemon/doc/option-parsing-logic.md | 8 + node_modules/nodemon/doc/requireable.md | 56 + node_modules/nodemon/doc/rules.md | 34 + node_modules/nodemon/doc/sample-nodemon.md | 28 + node_modules/nodemon/faq.md | 234 + node_modules/nodemon/lib/cli/index.js | 49 + node_modules/nodemon/lib/cli/parse.js | 230 + node_modules/nodemon/lib/config/command.js | 43 + node_modules/nodemon/lib/config/defaults.js | 27 + node_modules/nodemon/lib/config/exec.js | 225 + node_modules/nodemon/lib/config/index.js | 93 + node_modules/nodemon/lib/config/load.js | 251 + node_modules/nodemon/lib/help/index.js | 27 + node_modules/nodemon/lib/index.js | 1 + node_modules/nodemon/lib/monitor/index.js | 4 + node_modules/nodemon/lib/monitor/match.js | 265 + node_modules/nodemon/lib/monitor/run.js | 413 + node_modules/nodemon/lib/monitor/signals.js | 34 + node_modules/nodemon/lib/monitor/watch.js | 227 + node_modules/nodemon/lib/nodemon.js | 292 + node_modules/nodemon/lib/rules/add.js | 89 + node_modules/nodemon/lib/rules/index.js | 53 + node_modules/nodemon/lib/rules/parse.js | 43 + node_modules/nodemon/lib/spawn.js | 55 + node_modules/nodemon/lib/utils/bus.js | 44 + node_modules/nodemon/lib/utils/clone.js | 40 + node_modules/nodemon/lib/utils/colour.js | 26 + node_modules/nodemon/lib/utils/index.js | 102 + node_modules/nodemon/lib/utils/log.js | 79 + node_modules/nodemon/lib/utils/merge.js | 47 + node_modules/nodemon/lib/version.js | 100 + .../nodemon/node_modules/debug/.coveralls.yml | 1 + .../nodemon/node_modules/debug/.eslintrc | 14 + .../nodemon/node_modules/debug/.npmignore | 9 + .../nodemon/node_modules/debug/.travis.yml | 20 + .../nodemon/node_modules/debug/CHANGELOG.md | 395 + .../nodemon/node_modules/debug/LICENSE | 19 + .../nodemon/node_modules/debug/Makefile | 58 + .../nodemon/node_modules/debug/README.md | 368 + .../nodemon/node_modules/debug/karma.conf.js | 70 + .../nodemon/node_modules/debug/node.js | 1 + .../nodemon/node_modules/debug/package.json | 82 + .../nodemon/node_modules/debug/src/browser.js | 195 + .../nodemon/node_modules/debug/src/debug.js | 225 + .../nodemon/node_modules/debug/src/index.js | 10 + .../nodemon/node_modules/debug/src/node.js | 186 + node_modules/nodemon/package.json | 101 + node_modules/nodemon/website/index.html | 188 + node_modules/nodemon/website/mixmax.png | Bin 0 -> 7319 bytes node_modules/nodemon/website/nodemon.png | Bin 0 -> 16333 bytes node_modules/nodemon/website/nodemon.svg | 1 + node_modules/nodemon/website/sparkpost.png | Bin 0 -> 22321 bytes node_modules/nodemon/website/sparkpost.svg | 44 + node_modules/nopt/.npmignore | 0 node_modules/nopt/LICENSE | 23 + node_modules/nopt/README.md | 208 + node_modules/nopt/bin/nopt.js | 44 + node_modules/nopt/examples/my-program.js | 30 + node_modules/nopt/lib/nopt.js | 552 + node_modules/nopt/package.json | 60 + node_modules/normalize-path/LICENSE | 21 + node_modules/normalize-path/README.md | 92 + node_modules/normalize-path/index.js | 19 + node_modules/normalize-path/package.json | 118 + node_modules/npm-run-path/index.js | 39 + node_modules/npm-run-path/license | 21 + node_modules/npm-run-path/package.json | 77 + node_modules/npm-run-path/readme.md | 81 + node_modules/object-assign/index.js | 90 + node_modules/object-assign/license | 21 + node_modules/object-assign/package.json | 75 + node_modules/object-assign/readme.md | 61 + node_modules/object-copy/LICENSE | 21 + node_modules/object-copy/index.js | 174 + .../node_modules/define-property/LICENSE | 21 + .../node_modules/define-property/README.md | 77 + .../node_modules/define-property/index.js | 31 + .../node_modules/define-property/package.json | 82 + .../is-accessor-descriptor/LICENSE | 21 + .../is-accessor-descriptor/README.md | 123 + .../is-accessor-descriptor/index.js | 69 + .../is-accessor-descriptor/package.json | 92 + .../node_modules/is-data-descriptor/LICENSE | 21 + .../node_modules/is-data-descriptor/README.md | 128 + .../node_modules/is-data-descriptor/index.js | 55 + .../is-data-descriptor/package.json | 91 + .../node_modules/is-descriptor/LICENSE | 21 + .../node_modules/is-descriptor/README.md | 193 + .../node_modules/is-descriptor/index.js | 22 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 342 + .../node_modules/kind-of/index.js | 147 + .../node_modules/kind-of/package.json | 146 + .../node_modules/is-descriptor/package.json | 114 + node_modules/object-copy/package.json | 80 + node_modules/object-visit/LICENSE | 21 + node_modules/object-visit/README.md | 83 + node_modules/object-visit/index.js | 33 + node_modules/object-visit/package.json | 97 + node_modules/object.pick/LICENSE | 21 + node_modules/object.pick/README.md | 76 + node_modules/object.pick/index.js | 35 + node_modules/object.pick/package.json | 92 + node_modules/on-finished/HISTORY.md | 88 + node_modules/on-finished/LICENSE | 23 + node_modules/on-finished/README.md | 154 + node_modules/on-finished/index.js | 196 + node_modules/on-finished/package.json | 74 + node_modules/on-headers/HISTORY.md | 16 + node_modules/on-headers/LICENSE | 22 + node_modules/on-headers/README.md | 76 + node_modules/on-headers/index.js | 93 + node_modules/on-headers/package.json | 69 + node_modules/p-finally/index.js | 15 + node_modules/p-finally/license | 21 + node_modules/p-finally/package.json | 74 + node_modules/p-finally/readme.md | 47 + node_modules/package-json/index.js | 67 + node_modules/package-json/license | 21 + node_modules/package-json/package.json | 75 + node_modules/package-json/readme.md | 91 + node_modules/parseurl/HISTORY.md | 53 + node_modules/parseurl/LICENSE | 24 + node_modules/parseurl/README.md | 124 + node_modules/parseurl/index.js | 154 + node_modules/parseurl/package.json | 82 + node_modules/pascalcase/LICENSE | 21 + node_modules/pascalcase/README.md | 80 + node_modules/pascalcase/index.js | 21 + node_modules/pascalcase/package.json | 77 + node_modules/path-dirname/index.js | 143 + node_modules/path-dirname/license | 22 + node_modules/path-dirname/package.json | 63 + node_modules/path-dirname/readme.md | 53 + node_modules/path-is-absolute/index.js | 20 + node_modules/path-is-absolute/license | 21 + node_modules/path-is-absolute/package.json | 75 + node_modules/path-is-absolute/readme.md | 59 + node_modules/path-is-inside/LICENSE.txt | 47 + .../path-is-inside/lib/path-is-inside.js | 28 + node_modules/path-is-inside/package.json | 63 + node_modules/path-key/index.js | 13 + node_modules/path-key/license | 21 + node_modules/path-key/package.json | 71 + node_modules/path-key/readme.md | 51 + node_modules/path-parse/.travis.yml | 9 + node_modules/path-parse/README.md | 44 + node_modules/path-parse/index.js | 93 + node_modules/path-parse/index.min.js | 1 + node_modules/path-parse/package.json | 61 + node_modules/path-parse/test.js | 77 + node_modules/path-parse/test.min.js | 1 + node_modules/path-to-regexp/History.md | 36 + node_modules/path-to-regexp/LICENSE | 21 + node_modules/path-to-regexp/Readme.md | 35 + node_modules/path-to-regexp/index.js | 129 + node_modules/path-to-regexp/package.json | 59 + node_modules/pause-stream/.npmignore | 3 + node_modules/pause-stream/LICENSE | 231 + node_modules/pause-stream/index.js | 3 + node_modules/pause-stream/package.json | 68 + node_modules/pause-stream/readme.markdown | 29 + node_modules/pause-stream/test/index.js | 17 + node_modules/pause-stream/test/pause-end.js | 33 + node_modules/pify/index.js | 84 + node_modules/pify/license | 9 + node_modules/pify/package.json | 83 + node_modules/pify/readme.md | 131 + node_modules/posix-character-classes/LICENSE | 21 + .../posix-character-classes/README.md | 103 + node_modules/posix-character-classes/index.js | 22 + .../posix-character-classes/package.json | 85 + node_modules/prepend-http/index.js | 14 + node_modules/prepend-http/license | 21 + node_modules/prepend-http/package.json | 67 + node_modules/prepend-http/readme.md | 31 + node_modules/process-nextick-args/index.js | 44 + node_modules/process-nextick-args/license.md | 19 + .../process-nextick-args/package.json | 50 + node_modules/process-nextick-args/readme.md | 18 + node_modules/promise/.jshintrc | 5 + node_modules/promise/.npmignore | 7 + node_modules/promise/LICENSE | 19 + node_modules/promise/Readme.md | 231 + node_modules/promise/build.js | 69 + node_modules/promise/core.js | 5 + node_modules/promise/domains/core.js | 213 + node_modules/promise/domains/done.js | 13 + .../promise/domains/es6-extensions.js | 107 + node_modules/promise/domains/finally.js | 16 + node_modules/promise/domains/index.js | 8 + .../promise/domains/node-extensions.js | 130 + .../promise/domains/rejection-tracking.js | 113 + node_modules/promise/domains/synchronous.js | 62 + node_modules/promise/index.d.ts | 256 + node_modules/promise/index.js | 3 + node_modules/promise/lib/core.js | 213 + node_modules/promise/lib/done.js | 13 + node_modules/promise/lib/es6-extensions.js | 107 + node_modules/promise/lib/finally.js | 16 + node_modules/promise/lib/index.js | 8 + node_modules/promise/lib/node-extensions.js | 130 + .../promise/lib/rejection-tracking.js | 113 + node_modules/promise/lib/synchronous.js | 62 + node_modules/promise/package.json | 66 + node_modules/promise/polyfill-done.js | 12 + node_modules/promise/polyfill.js | 10 + node_modules/promise/setimmediate/core.js | 213 + node_modules/promise/setimmediate/done.js | 13 + .../promise/setimmediate/es6-extensions.js | 107 + node_modules/promise/setimmediate/finally.js | 16 + node_modules/promise/setimmediate/index.js | 8 + .../promise/setimmediate/node-extensions.js | 130 + .../setimmediate/rejection-tracking.js | 113 + .../promise/setimmediate/synchronous.js | 62 + node_modules/promise/src/core.js | 213 + node_modules/promise/src/done.js | 13 + node_modules/promise/src/es6-extensions.js | 107 + node_modules/promise/src/finally.js | 16 + node_modules/promise/src/index.js | 8 + node_modules/promise/src/node-extensions.js | 130 + .../promise/src/rejection-tracking.js | 113 + node_modules/promise/src/synchronous.js | 62 + node_modules/proxy-addr/HISTORY.md | 115 + node_modules/proxy-addr/LICENSE | 22 + node_modules/proxy-addr/README.md | 140 + node_modules/proxy-addr/index.js | 327 + node_modules/proxy-addr/package.json | 73 + node_modules/ps-tree/.appveyor.yml | 41 + node_modules/ps-tree/.npmignore | 28 + node_modules/ps-tree/.travis.yml | 22 + node_modules/ps-tree/LICENSE | 21 + node_modules/ps-tree/README.md | 83 + node_modules/ps-tree/bin/ps-tree.js | 16 + node_modules/ps-tree/index.js | 118 + node_modules/ps-tree/package.json | 79 + node_modules/ps-tree/test/direct.js | 20 + node_modules/ps-tree/test/exec/child.js | 7 + node_modules/ps-tree/test/exec/parent.js | 18 + node_modules/ps-tree/test/test.js | 70 + node_modules/pseudomap/LICENSE | 15 + node_modules/pseudomap/README.md | 60 + node_modules/pseudomap/map.js | 9 + node_modules/pseudomap/package.json | 54 + node_modules/pseudomap/pseudomap.js | 113 + node_modules/pseudomap/test/basic.js | 86 + node_modules/pstree.remy/.travis.yml | 8 + node_modules/pstree.remy/lib/index.js | 28 + node_modules/pstree.remy/lib/utils.js | 56 + node_modules/pstree.remy/package.json | 52 + node_modules/pstree.remy/tests/fixtures/out1 | 10 + node_modules/pstree.remy/tests/fixtures/out2 | 29 + node_modules/pstree.remy/tests/index.test.js | 46 + node_modules/pug-attrs/LICENSE | 19 + node_modules/pug-attrs/README.md | 75 + node_modules/pug-attrs/index.js | 122 + node_modules/pug-attrs/package.json | 50 + node_modules/pug-attrs/test/index.test.js | 96 + node_modules/pug-code-gen/HISTORY.md | 13 + node_modules/pug-code-gen/LICENSE | 19 + node_modules/pug-code-gen/README.md | 64 + node_modules/pug-code-gen/index.js | 821 + node_modules/pug-code-gen/package.json | 55 + node_modules/pug-error/LICENSE | 19 + node_modules/pug-error/README.md | 55 + node_modules/pug-error/index.js | 49 + node_modules/pug-error/package.json | 53 + node_modules/pug-filters/CHANGELOG.md | 34 + node_modules/pug-filters/LICENSE | 19 + node_modules/pug-filters/README.md | 41 + node_modules/pug-filters/index.js | 4 + .../pug-filters/lib/handle-filters.js | 112 + node_modules/pug-filters/lib/run-filter.js | 43 + node_modules/pug-filters/package.json | 66 + .../__snapshots__/filter-aliases.test.js.snap | 275 + .../test/__snapshots__/index.test.js.snap | 1072 + ...ons-applied-to-nested-filters.test.js.snap | 100 + .../test/cases/filters-empty.input.json | 84 + .../test/cases/filters.cdata.input.json | 83 + .../cases/filters.coffeescript.input.json | 84 + .../test/cases/filters.custom.input.json | 101 + .../cases/filters.include.custom.input.json | 91 + .../test/cases/filters.include.custom.pug | 4 + .../test/cases/filters.include.input.json | 153 + .../test/cases/filters.inline.input.json | 56 + .../test/cases/filters.less.input.json | 113 + .../test/cases/filters.markdown.input.json | 70 + .../test/cases/filters.nested.input.json | 161 + .../test/cases/filters.stylus.input.json | 109 + .../test/cases/include-filter-coffee.coffee | 2 + node_modules/pug-filters/test/cases/some.md | 3 + .../pug-filters/test/custom-filters.js | 9 + .../test/errors-src/dynamic-option.jade | 3 + .../test/errors/dynamic-option.input.json | 37 + .../pug-filters/test/filter-aliases.test.js | 89 + node_modules/pug-filters/test/index.test.js | 51 + ...-options-applied-to-nested-filters.test.js | 28 + .../pug-filters/test/update-test-cases.js | 131 + node_modules/pug-lexer/History.md | 66 + node_modules/pug-lexer/LICENSE | 19 + node_modules/pug-lexer/README.md | 72 + node_modules/pug-lexer/index.js | 1379 ++ node_modules/pug-lexer/package.json | 53 + .../test/__snapshots__/index.test.js.snap | 18710 +++++++++++++++ .../pug-lexer/test/cases/attr-es2015.pug | 3 + .../pug-lexer/test/cases/attrs-data.pug | 7 + .../pug-lexer/test/cases/attrs.js.pug | 17 + node_modules/pug-lexer/test/cases/attrs.pug | 43 + .../pug-lexer/test/cases/attrs.unescaped.pug | 3 + node_modules/pug-lexer/test/cases/basic.pug | 3 + node_modules/pug-lexer/test/cases/blanks.pug | 8 + .../pug-lexer/test/cases/block-code.pug | 12 + .../pug-lexer/test/cases/block-expansion.pug | 5 + .../test/cases/block-expansion.shorthands.pug | 2 + .../pug-lexer/test/cases/blockquote.pug | 4 + .../pug-lexer/test/cases/blocks-in-blocks.pug | 4 + .../pug-lexer/test/cases/blocks-in-if.pug | 19 + .../pug-lexer/test/cases/case-blocks.pug | 10 + node_modules/pug-lexer/test/cases/case.pug | 19 + .../pug-lexer/test/cases/classes-empty.pug | 3 + node_modules/pug-lexer/test/cases/classes.pug | 11 + .../test/cases/code.conditionals.pug | 43 + .../pug-lexer/test/cases/code.escape.pug | 2 + .../pug-lexer/test/cases/code.iteration.pug | 35 + node_modules/pug-lexer/test/cases/code.pug | 10 + .../pug-lexer/test/cases/comments-in-case.pug | 10 + .../pug-lexer/test/cases/comments.pug | 29 + .../pug-lexer/test/cases/comments.source.pug | 9 + .../pug-lexer/test/cases/doctype.custom.pug | 1 + .../pug-lexer/test/cases/doctype.default.pug | 4 + .../pug-lexer/test/cases/doctype.keyword.pug | 1 + .../pug-lexer/test/cases/each.else.pug | 43 + .../pug-lexer/test/cases/escape-chars.pug | 2 + .../pug-lexer/test/cases/escape-test.pug | 8 + .../test/cases/escaping-class-attribute.pug | 6 + .../test/cases/filter-in-include.pug | 1 + .../pug-lexer/test/cases/filters-empty.pug | 6 + .../test/cases/filters.coffeescript.pug | 6 + .../pug-lexer/test/cases/filters.custom.pug | 7 + .../test/cases/filters.include.custom.pug | 4 + .../pug-lexer/test/cases/filters.include.pug | 7 + .../pug-lexer/test/cases/filters.inline.pug | 1 + .../pug-lexer/test/cases/filters.less.pug | 8 + .../pug-lexer/test/cases/filters.markdown.pug | 5 + .../pug-lexer/test/cases/filters.nested.pug | 10 + .../pug-lexer/test/cases/filters.stylus.pug | 7 + .../pug-lexer/test/cases/filters.verbatim.pug | 6 + node_modules/pug-lexer/test/cases/html.pug | 13 + node_modules/pug-lexer/test/cases/html5.pug | 4 + .../test/cases/include-extends-from-root.pug | 1 + .../include-extends-of-common-template.pug | 2 + .../test/cases/include-extends-relative.pug | 1 + .../test/cases/include-only-text-body.pug | 3 + .../test/cases/include-only-text.pug | 5 + .../test/cases/include-with-text-head.pug | 3 + .../test/cases/include-with-text.pug | 4 + .../pug-lexer/test/cases/include.script.pug | 2 + .../test/cases/include.yield.nested.pug | 4 + .../test/cases/includes-with-ext-js.pug | 3 + .../pug-lexer/test/cases/includes.pug | 10 + .../test/cases/inheritance.alert-dialog.pug | 6 + .../test/cases/inheritance.defaults.pug | 6 + .../test/cases/inheritance.extend.include.pug | 13 + .../cases/inheritance.extend.mixins.block.pug | 4 + .../test/cases/inheritance.extend.mixins.pug | 11 + .../test/cases/inheritance.extend.pug | 9 + .../cases/inheritance.extend.recursive.pug | 4 + .../cases/inheritance.extend.whitespace.pug | 13 + .../pug-lexer/test/cases/inheritance.pug | 9 + .../test/cases/inline-block-comment.pug | 3 + .../pug-lexer/test/cases/inline-tag.pug | 19 + .../test/cases/intepolated-elements.pug | 3 + .../test/cases/interpolated-mixin.pug | 4 + .../test/cases/interpolation.escape.pug | 7 + .../test/cases/javascript-new-lines.js | 1 + .../pug-lexer/test/cases/layout.append.pug | 6 + .../cases/layout.append.without-block.pug | 6 + .../layout.multi.append.prepend.block.pug | 19 + .../pug-lexer/test/cases/layout.prepend.pug | 6 + .../cases/layout.prepend.without-block.pug | 6 + .../test/cases/mixin-at-end-of-file.pug | 4 + .../test/cases/mixin-block-with-space.pug | 6 + .../pug-lexer/test/cases/mixin-hoist.pug | 7 + .../test/cases/mixin-via-include.pug | 5 + .../pug-lexer/test/cases/mixin.attrs.pug | 59 + .../test/cases/mixin.block-tag-behaviour.pug | 24 + .../pug-lexer/test/cases/mixin.blocks.pug | 44 + .../pug-lexer/test/cases/mixin.merge.pug | 15 + .../pug-lexer/test/cases/mixins-unused.pug | 3 + node_modules/pug-lexer/test/cases/mixins.pug | 32 + .../pug-lexer/test/cases/mixins.rest-args.pug | 6 + .../pug-lexer/test/cases/namespaces.pug | 2 + node_modules/pug-lexer/test/cases/nesting.pug | 8 + .../test/cases/pipeless-comments.pug | 4 + .../pug-lexer/test/cases/pipeless-filters.pug | 4 + .../pug-lexer/test/cases/pipeless-tag.pug | 3 + node_modules/pug-lexer/test/cases/pre.pug | 10 + node_modules/pug-lexer/test/cases/quotes.pug | 2 + .../pug-lexer/test/cases/regression.1794.pug | 4 + .../pug-lexer/test/cases/regression.784.pug | 2 + .../test/cases/script.whitespace.pug | 6 + .../pug-lexer/test/cases/scripts.non-js.pug | 9 + node_modules/pug-lexer/test/cases/scripts.pug | 8 + .../test/cases/self-closing-html.pug | 4 + .../pug-lexer/test/cases/single-period.pug | 1 + node_modules/pug-lexer/test/cases/source.pug | 4 + node_modules/pug-lexer/test/cases/styles.pug | 19 + .../pug-lexer/test/cases/tag-blocks.pug | 5 + .../test/cases/tag.interpolation.pug | 22 + .../test/cases/tags.self-closing.pug | 19 + .../pug-lexer/test/cases/template.pug | 9 + .../pug-lexer/test/cases/text-block.pug | 6 + node_modules/pug-lexer/test/cases/text.pug | 46 + node_modules/pug-lexer/test/cases/utf8bom.pug | 1 + node_modules/pug-lexer/test/cases/vars.pug | 3 + node_modules/pug-lexer/test/cases/while.pug | 5 + node_modules/pug-lexer/test/cases/xml.pug | 3 + .../cases/yield-before-conditional-head.pug | 5 + .../test/cases/yield-before-conditional.pug | 5 + .../pug-lexer/test/cases/yield-head.pug | 4 + .../pug-lexer/test/cases/yield-title-head.pug | 5 + .../pug-lexer/test/cases/yield-title.pug | 4 + node_modules/pug-lexer/test/cases/yield.pug | 5 + .../test/check-lexer-functions.test.js | 98 + .../errors/attribute-invalid-expression.pug | 3 + .../errors/case-with-invalid-expression.pug | 1 + .../test/errors/case-with-no-expression.pug | 1 + .../test/errors/default-with-expression.pug | 1 + .../test/errors/else-with-condition.pug | 4 + .../pug-lexer/test/errors/extends-no-path.pug | 1 + .../test/errors/include-filter-no-path-2.pug | 1 + .../test/errors/include-filter-no-path.pug | 1 + .../test/errors/include-filter-no-space.pug | 1 + .../pug-lexer/test/errors/include-no-path.pug | 1 + .../test/errors/inconsistent-indentation.pug | 4 + .../test/errors/interpolated-call.pug | 5 + .../test/errors/invalid-class-name-1.pug | 1 + .../test/errors/invalid-class-name-2.pug | 1 + .../test/errors/invalid-class-name-3.pug | 1 + .../pug-lexer/test/errors/invalid-id.pug | 1 + .../pug-lexer/test/errors/malformed-each.pug | 1 + .../test/errors/malformed-extend.pug | 1 + .../test/errors/malformed-include.pug | 1 + .../test/errors/mismatched-inline-tag.pug | 2 + .../errors/mismatched-tag-interpolation.pug | 2 + .../test/errors/multi-line-interpolation.pug | 4 + .../test/errors/old-prefixed-each.pug | 3 + .../test/errors/open-interpolation.pug | 1 + .../test/errors/when-with-no-expression.pug | 1 + .../test/errors/while-with-no-expression.pug | 1 + node_modules/pug-lexer/test/index.test.js | 38 + node_modules/pug-linker/HISTORY.md | 10 + node_modules/pug-linker/LICENSE | 19 + node_modules/pug-linker/README.md | 27 + node_modules/pug-linker/index.js | 171 + node_modules/pug-linker/package.json | 54 + .../test/__snapshots__/index.test.js.snap | 4175 ++++ .../test/cases-src/auxiliary/1794-extends.pug | 1 + .../test/cases-src/auxiliary/1794-include.pug | 4 + .../auxiliary/blocks-in-blocks-layout.pug | 8 + .../test/cases-src/auxiliary/dialog.pug | 6 + .../test/cases-src/auxiliary/empty-block.pug | 2 + .../test/cases-src/auxiliary/escapes.html | 3 + .../auxiliary/extends-empty-block-1.pug | 5 + .../auxiliary/extends-empty-block-2.pug | 5 + .../cases-src/auxiliary/extends-from-root.pug | 4 + .../cases-src/auxiliary/extends-relative.pug | 4 + .../cases-src/auxiliary/filter-in-include.pug | 8 + .../test/cases-src/auxiliary/includable.js | 7 + .../cases-src/auxiliary/include-from-root.pug | 1 + .../inheritance.extend.mixin.block.pug | 11 + ...nce.extend.recursive-grand-grandparent.pug | 2 + ...heritance.extend.recursive-grandparent.pug | 6 + .../inheritance.extend.recursive-parent.pug | 5 + .../cases-src/auxiliary/layout.include.pug | 7 + .../test/cases-src/auxiliary/layout.pug | 6 + .../auxiliary/mixin-at-end-of-file.pug | 3 + .../test/cases-src/auxiliary/mixins.pug | 3 + .../test/cases-src/auxiliary/pet.pug | 3 + .../test/cases-src/auxiliary/smile.html | 1 + .../test/cases-src/auxiliary/window.pug | 4 + .../test/cases-src/auxiliary/yield-nested.pug | 10 + .../cases-src/include-extends-from-root.pug | 1 + .../include-extends-of-common-template.pug | 2 + .../cases-src/include-extends-relative.pug | 1 + .../cases-src/include-filter-coffee.coffee | 2 + .../test/cases-src/include-filter-stylus.pug | 2 + .../test/cases-src/include-filter.pug | 7 + .../test/cases-src/include-only-text-body.pug | 3 + .../test/cases-src/include-only-text.pug | 5 + .../test/cases-src/include-with-text-head.pug | 3 + .../test/cases-src/include-with-text.pug | 4 + .../test/cases-src/include.script.pug | 2 + .../test/cases-src/include.yield.nested.pug | 4 + .../test/cases-src/includes-with-ext-js.pug | 3 + .../pug-linker/test/cases-src/includes.pug | 10 + .../test/cases-src/javascript-new-lines.js | 1 + .../test/cases-src/layout.append.pug | 6 + .../cases-src/layout.append.without-block.pug | 6 + .../layout.multi.append.prepend.block.pug | 19 + .../test/cases-src/layout.prepend.pug | 6 + .../layout.prepend.without-block.pug | 6 + .../test/cases-src/some-included.styl | 2 + .../pug-linker/test/cases-src/some.md | 3 + .../pug-linker/test/cases-src/some.styl | 1 + .../include-extends-from-root.input.json | 201 + ...lude-extends-of-common-template.input.json | 179 + .../cases/include-extends-relative.input.json | 166 + .../cases/include-filter-stylus.input.json | 52 + .../test/cases/include-filter.input.json | 153 + .../cases/include-only-text-body.input.json | 24 + .../test/cases/include-only-text.input.json | 125 + .../cases/include-with-text-head.input.json | 53 + .../test/cases/include-with-text.input.json | 141 + .../test/cases/include.script.input.json | 130 + .../cases/include.yield.nested.input.json | 260 + .../cases/includes-with-ext-js.input.json | 55 + .../pug-linker/test/cases/includes.input.json | 172 + .../test/cases/layout.append.input.json | 226 + .../layout.append.without-block.input.json | 226 + ...yout.multi.append.prepend.block.input.json | 365 + .../test/cases/layout.prepend.input.json | 226 + .../layout.prepend.without-block.input.json | 226 + .../test/errors-src/child-with-tags.pug | 6 + .../test/errors-src/extends-not-first.pug | 4 + .../test/errors-src/unexpected-block.pug | 4 + .../test/errors/child-with-tags.input.json | 163 + .../test/errors/extends-not-first.input.json | 140 + .../test/errors/unexpected-block.input.json | 58 + .../append-without-block/app-layout.pug | 5 + .../fixtures/append-without-block/layout.pug | 7 + .../fixtures/append-without-block/page.pug | 6 + .../test/fixtures/append/app-layout.pug | 5 + .../test/fixtures/append/layout.pug | 7 + .../pug-linker/test/fixtures/append/page.html | 9 + .../pug-linker/test/fixtures/append/page.pug | 6 + .../pug-linker/test/fixtures/empty.pug | 0 .../pug-linker/test/fixtures/layout.pug | 8 + .../pug-linker/test/fixtures/mixins.pug | 2 + .../multi-append-prepend-block/redefine.pug | 5 + .../multi-append-prepend-block/root.pug | 5 + .../prepend-without-block/app-layout.pug | 5 + .../fixtures/prepend-without-block/layout.pug | 7 + .../fixtures/prepend-without-block/page.html | 9 + .../fixtures/prepend-without-block/page.pug | 6 + .../test/fixtures/prepend/app-layout.pug | 5 + .../test/fixtures/prepend/layout.pug | 7 + .../test/fixtures/prepend/page.html | 9 + .../pug-linker/test/fixtures/prepend/page.pug | 6 + node_modules/pug-linker/test/index.test.js | 46 + .../special-cases-src/extending-empty.pug | 1 + .../special-cases-src/extending-include.pug | 5 + .../test/special-cases-src/root-mixin.pug | 9 + .../special-cases/extending-empty.input.json | 26 + .../extending-include.input.json | 204 + .../test/special-cases/root-mixin.input.json | 212 + node_modules/pug-load/HISTORY.md | 19 + node_modules/pug-load/LICENSE | 19 + node_modules/pug-load/README.md | 104 + node_modules/pug-load/index.js | 101 + node_modules/pug-load/package.json | 53 + .../test/__snapshots__/index.test.js.snap | 149 + node_modules/pug-load/test/bar.pug | 1 + node_modules/pug-load/test/bing.pug | 1 + node_modules/pug-load/test/foo.pug | 6 + node_modules/pug-load/test/index.test.js | 24 + node_modules/pug-load/test/script.js | 1 + node_modules/pug-parser/HISTORY.md | 11 + node_modules/pug-parser/LICENSE | 19 + node_modules/pug-parser/README.md | 86 + node_modules/pug-parser/index.js | 1107 + node_modules/pug-parser/lib/inline-tags.js | 23 + node_modules/pug-parser/package.json | 52 + .../test/__snapshots__/index.test.js.snap | 17179 ++++++++++++++ .../test/cases/attr-es2015.tokens.json | 9 + .../test/cases/attrs-data.tokens.json | 33 + .../test/cases/attrs.js.tokens.json | 78 + .../pug-parser/test/cases/attrs.tokens.json | 180 + .../test/cases/attrs.unescaped.tokens.json | 15 + .../pug-parser/test/cases/basic.tokens.json | 9 + .../pug-parser/test/cases/blanks.tokens.json | 13 + .../test/cases/block-code.tokens.json | 28 + .../block-expansion.shorthands.tokens.json | 11 + .../test/cases/block-expansion.tokens.json | 21 + .../test/cases/blockquote.tokens.json | 10 + .../test/cases/blocks-in-blocks.tokens.json | 9 + .../test/cases/blocks-in-if.tokens.json | 44 + .../test/cases/case-blocks.tokens.json | 29 + .../pug-parser/test/cases/case.tokens.json | 47 + .../test/cases/classes-empty.tokens.json | 15 + .../pug-parser/test/cases/classes.tokens.json | 21 + .../test/cases/code.conditionals.tokens.json | 86 + .../test/cases/code.escape.tokens.json | 6 + .../test/cases/code.iteration.tokens.json | 71 + .../pug-parser/test/cases/code.tokens.json | 40 + .../test/cases/comments-in-case.tokens.json | 26 + .../test/cases/comments.source.tokens.json | 18 + .../test/cases/comments.tokens.json | 61 + .../test/cases/doctype.custom.tokens.json | 2 + .../test/cases/doctype.default.tokens.json | 11 + .../test/cases/doctype.keyword.tokens.json | 2 + .../test/cases/each.else.tokens.json | 88 + .../test/cases/escape-chars.tokens.json | 6 + .../test/cases/escape-test.tokens.json | 20 + .../escaping-class-attribute.tokens.json | 31 + .../test/cases/filter-in-include.tokens.json | 4 + .../test/cases/filters-empty.tokens.json | 16 + .../cases/filters.coffeescript.tokens.json | 21 + .../test/cases/filters.custom.tokens.json | 21 + .../cases/filters.include.custom.tokens.json | 17 + .../test/cases/filters.include.tokens.json | 29 + .../test/cases/filters.inline.tokens.json | 8 + .../test/cases/filters.less.tokens.json | 23 + .../test/cases/filters.markdown.tokens.json | 13 + .../test/cases/filters.nested.tokens.json | 26 + .../test/cases/filters.stylus.tokens.json | 20 + .../pug-parser/test/cases/html.tokens.json | 26 + .../pug-parser/test/cases/html5.tokens.json | 20 + .../include-extends-from-root.tokens.json | 4 + ...ude-extends-of-common-template.tokens.json | 7 + .../include-extends-relative.tokens.json | 4 + .../cases/include-only-text-body.tokens.json | 7 + .../test/cases/include-only-text.tokens.json | 16 + .../cases/include-with-text-head.tokens.json | 12 + .../test/cases/include-with-text.tokens.json | 17 + .../test/cases/include.script.tokens.json | 10 + .../cases/include.yield.nested.tokens.json | 11 + .../cases/includes-with-ext-js.tokens.json | 9 + .../test/cases/includes.tokens.json | 25 + .../inheritance.alert-dialog.tokens.json | 13 + .../cases/inheritance.defaults.tokens.json | 24 + .../inheritance.extend.include.tokens.json | 28 + ...nheritance.extend.mixins.block.tokens.json | 9 + .../inheritance.extend.mixins.tokens.json | 22 + .../inheritance.extend.recursive.tokens.json | 9 + .../test/cases/inheritance.extend.tokens.json | 20 + .../inheritance.extend.whitespace.tokens.json | 20 + .../test/cases/inheritance.tokens.json | 20 + .../cases/inline-block-comment.tokens.json | 10 + .../test/cases/inline-tag.tokens.json | 77 + .../cases/intepolated-elements.tokens.json | 38 + .../test/cases/interpolated-mixin.tokens.json | 15 + .../cases/interpolation.escape.tokens.json | 15 + .../test/cases/layout.append.tokens.json | 17 + .../layout.append.without-block.tokens.json | 17 + ...out.multi.append.prepend.block.tokens.json | 46 + .../test/cases/layout.prepend.tokens.json | 17 + .../layout.prepend.without-block.tokens.json | 17 + .../cases/mixin-at-end-of-file.tokens.json | 9 + .../cases/mixin-block-with-space.tokens.json | 12 + .../test/cases/mixin-hoist.tokens.json | 14 + .../test/cases/mixin-via-include.tokens.json | 7 + .../test/cases/mixin.attrs.tokens.json | 161 + .../mixin.block-tag-behaviour.tokens.json | 56 + .../test/cases/mixin.blocks.tokens.json | 108 + .../test/cases/mixin.merge.tokens.json | 58 + .../test/cases/mixins-unused.tokens.json | 7 + .../test/cases/mixins.rest-args.tokens.json | 14 + .../pug-parser/test/cases/mixins.tokens.json | 65 + .../test/cases/namespaces.tokens.json | 8 + .../pug-parser/test/cases/nesting.tokens.json | 23 + .../test/cases/pipeless-comments.tokens.json | 9 + .../test/cases/pipeless-filters.tokens.json | 9 + .../test/cases/pipeless-tag.tokens.json | 14 + .../pug-parser/test/cases/pre.tokens.json | 25 + .../pug-parser/test/cases/quotes.tokens.json | 6 + .../test/cases/regression.1794.tokens.json | 9 + .../test/cases/regression.784.tokens.json | 5 + .../test/cases/script.whitespace.tokens.json | 14 + .../test/cases/scripts.non-js.tokens.json | 29 + .../pug-parser/test/cases/scripts.tokens.json | 20 + .../test/cases/self-closing-html.tokens.json | 11 + .../test/cases/single-period.tokens.json | 3 + .../pug-parser/test/cases/source.tokens.json | 21 + .../pug-parser/test/cases/styles.tokens.json | 64 + .../test/cases/tag-blocks.tokens.json | 16 + .../test/cases/tag.interpolation.tokens.json | 66 + .../test/cases/tags.self-closing.tokens.json | 60 + .../test/cases/template.tokens.json | 27 + .../test/cases/text-block.tokens.json | 20 + .../pug-parser/test/cases/text.tokens.json | 87 + .../pug-parser/test/cases/utf8bom.tokens.json | 4 + .../pug-parser/test/cases/vars.tokens.json | 10 + .../pug-parser/test/cases/while.tokens.json | 13 + .../pug-parser/test/cases/xml.tokens.json | 11 + .../yield-before-conditional-head.tokens.json | 18 + .../yield-before-conditional.tokens.json | 20 + .../test/cases/yield-head.tokens.json | 15 + .../test/cases/yield-title-head.tokens.json | 17 + .../test/cases/yield-title.tokens.json | 12 + .../pug-parser/test/cases/yield.tokens.json | 20 + node_modules/pug-parser/test/index.test.js | 24 + node_modules/pug-runtime/CHANGELOG.md | 45 + node_modules/pug-runtime/LICENSE | 19 + node_modules/pug-runtime/README.md | 67 + node_modules/pug-runtime/build.js | 24 + node_modules/pug-runtime/index.js | 253 + node_modules/pug-runtime/lib/dependencies.js | 34 + node_modules/pug-runtime/lib/internals.js | 8 + node_modules/pug-runtime/lib/sources.js | 13 + node_modules/pug-runtime/package.json | 65 + node_modules/pug-runtime/wrap.js | 10 + node_modules/pug-strip-comments/CHANGELOG.md | 16 + node_modules/pug-strip-comments/LICENSE.md | 7 + node_modules/pug-strip-comments/README.md | 45 + node_modules/pug-strip-comments/index.js | 70 + node_modules/pug-strip-comments/package.json | 52 + .../test/__snapshots__/index.test.js.snap | 1171 + .../test/cases/comments-in-case.input.json | 26 + .../test/cases/comments.input.json | 76 + .../test/cases/comments.source.input.json | 19 + .../test/errors/comment-in-comment.input.json | 3 + .../test/errors/end.input.json | 4 + .../test/errors/startstart.input.json | 6 + .../pug-strip-comments/test/index.test.js | 51 + node_modules/pug-walk/HISTORY.md | 4 + node_modules/pug-walk/LICENSE | 19 + node_modules/pug-walk/README.md | 137 + node_modules/pug-walk/index.js | 112 + node_modules/pug-walk/package.json | 54 + node_modules/pug/History.md | 991 + node_modules/pug/LICENSE | 22 + node_modules/pug/README.md | 168 + node_modules/pug/examples/README.md | 5 + node_modules/pug/examples/attributes.js | 11 + node_modules/pug/examples/attributes.pug | 8 + node_modules/pug/examples/code.js | 16 + node_modules/pug/examples/code.pug | 17 + node_modules/pug/examples/dynamicscript.js | 16 + node_modules/pug/examples/dynamicscript.pug | 5 + node_modules/pug/examples/each.js | 16 + node_modules/pug/examples/each.pug | 3 + node_modules/pug/examples/extend-layout.pug | 10 + node_modules/pug/examples/extend.js | 18 + node_modules/pug/examples/extend.pug | 11 + node_modules/pug/examples/form.js | 18 + node_modules/pug/examples/form.pug | 29 + node_modules/pug/examples/includes.js | 11 + node_modules/pug/examples/includes.pug | 7 + node_modules/pug/examples/includes/foot.pug | 2 + node_modules/pug/examples/includes/head.pug | 6 + .../pug/examples/includes/scripts.pug | 2 + node_modules/pug/examples/includes/style.css | 5 + node_modules/pug/examples/layout-debug.js | 11 + node_modules/pug/examples/layout.js | 11 + node_modules/pug/examples/layout.pug | 14 + node_modules/pug/examples/mixins.js | 16 + node_modules/pug/examples/mixins.pug | 14 + node_modules/pug/examples/mixins/dialog.pug | 15 + node_modules/pug/examples/mixins/profile.pug | 10 + node_modules/pug/examples/pet.pug | 3 + node_modules/pug/examples/rss.js | 17 + node_modules/pug/examples/rss.pug | 14 + node_modules/pug/examples/text.js | 11 + node_modules/pug/examples/text.pug | 36 + node_modules/pug/examples/whitespace.js | 11 + node_modules/pug/examples/whitespace.pug | 11 + node_modules/pug/lib/index.js | 456 + node_modules/pug/package.json | 103 + node_modules/pug/register.js | 13 + node_modules/pug/support/benchmark.js | 121 + node_modules/pug/test/README.md | 15 + .../pug/test/anti-cases/attrs.unescaped.pug | 3 + .../pug/test/anti-cases/case-when.pug | 4 + .../pug/test/anti-cases/case-without-with.pug | 2 + .../pug/test/anti-cases/else-condition.pug | 4 + .../pug/test/anti-cases/else-without-if.pug | 2 + .../inlining-a-mixin-after-a-tag.pug | 1 + .../test/anti-cases/key-char-ending-badly.pug | 1 + .../pug/test/anti-cases/key-ending-badly.pug | 1 + .../test/anti-cases/mismatched-inline-tag.pug | 2 + .../anti-cases/mixin-args-syntax-error.pug | 2 + .../anti-cases/mixins-blocks-with-bodies.pug | 3 + .../multiple-non-nested-tags-on-a-line.pug | 1 + .../test/anti-cases/non-existant-filter.pug | 2 + .../pug/test/anti-cases/non-mixin-block.pug | 2 + .../anti-cases/open-brace-in-attributes.pug | 1 + node_modules/pug/test/anti-cases/readme.md | 1 + .../self-closing-tag-with-block.pug | 2 + .../anti-cases/self-closing-tag-with-body.pug | 1 + .../anti-cases/self-closing-tag-with-code.pug | 1 + .../pug/test/anti-cases/tabs-and-spaces.pug | 3 + .../anti-cases/unclosed-interpolated-call.pug | 1 + .../anti-cases/unclosed-interpolated-tag.pug | 4 + .../anti-cases/unclosed-interpolation.pug | 1 + node_modules/pug/test/browser/index.html | 10 + node_modules/pug/test/browser/index.pug | 20 + node_modules/pug/test/cases-es2015/attr.html | 1 + node_modules/pug/test/cases-es2015/attr.pug | 3 + node_modules/pug/test/cases/attrs-data.html | 6 + node_modules/pug/test/cases/attrs-data.pug | 7 + node_modules/pug/test/cases/attrs.html | 20 + node_modules/pug/test/cases/attrs.js.html | 5 + node_modules/pug/test/cases/attrs.js.pug | 17 + node_modules/pug/test/cases/attrs.pug | 43 + .../pug/test/cases/attrs.unescaped.html | 5 + .../pug/test/cases/attrs.unescaped.pug | 3 + .../pug/test/cases/auxiliary/1794-extends.pug | 1 + .../pug/test/cases/auxiliary/1794-include.pug | 4 + .../auxiliary/blocks-in-blocks-layout.pug | 8 + .../pug/test/cases/auxiliary/dialog.pug | 6 + .../pug/test/cases/auxiliary/empty-block.pug | 2 + .../pug/test/cases/auxiliary/escapes.html | 3 + .../cases/auxiliary/extends-empty-block-1.pug | 5 + .../cases/auxiliary/extends-empty-block-2.pug | 5 + .../cases/auxiliary/extends-from-root.pug | 4 + .../test/cases/auxiliary/extends-relative.pug | 4 + .../cases/auxiliary/filter-in-include.pug | 8 + .../pug/test/cases/auxiliary/includable.js | 7 + .../cases/auxiliary/include-from-root.pug | 1 + .../inheritance.extend.mixin.block.pug | 11 + ...nce.extend.recursive-grand-grandparent.pug | 2 + ...heritance.extend.recursive-grandparent.pug | 6 + .../inheritance.extend.recursive-parent.pug | 5 + .../test/cases/auxiliary/layout.include.pug | 7 + .../pug/test/cases/auxiliary/layout.pug | 6 + .../cases/auxiliary/mixin-at-end-of-file.pug | 3 + .../pug/test/cases/auxiliary/mixins.pug | 3 + node_modules/pug/test/cases/auxiliary/pet.pug | 3 + .../pug/test/cases/auxiliary/smile.html | 1 + .../pug/test/cases/auxiliary/window.pug | 4 + .../pug/test/cases/auxiliary/yield-nested.pug | 10 + node_modules/pug/test/cases/basic.html | 5 + node_modules/pug/test/cases/basic.pug | 3 + node_modules/pug/test/cases/blanks.html | 5 + node_modules/pug/test/cases/blanks.pug | 8 + node_modules/pug/test/cases/block-code.html | 7 + node_modules/pug/test/cases/block-code.pug | 12 + .../pug/test/cases/block-expansion.html | 5 + .../pug/test/cases/block-expansion.pug | 5 + .../cases/block-expansion.shorthands.html | 7 + .../test/cases/block-expansion.shorthands.pug | 2 + node_modules/pug/test/cases/blockquote.html | 4 + node_modules/pug/test/cases/blockquote.pug | 4 + .../pug/test/cases/blocks-in-blocks.html | 9 + .../pug/test/cases/blocks-in-blocks.pug | 4 + node_modules/pug/test/cases/blocks-in-if.html | 1 + node_modules/pug/test/cases/blocks-in-if.pug | 19 + node_modules/pug/test/cases/case-blocks.html | 5 + node_modules/pug/test/cases/case-blocks.pug | 10 + node_modules/pug/test/cases/case.html | 8 + node_modules/pug/test/cases/case.pug | 19 + .../pug/test/cases/classes-empty.html | 1 + node_modules/pug/test/cases/classes-empty.pug | 3 + node_modules/pug/test/cases/classes.html | 1 + node_modules/pug/test/cases/classes.pug | 11 + .../pug/test/cases/code.conditionals.html | 11 + .../pug/test/cases/code.conditionals.pug | 43 + node_modules/pug/test/cases/code.escape.html | 2 + node_modules/pug/test/cases/code.escape.pug | 2 + node_modules/pug/test/cases/code.html | 10 + .../pug/test/cases/code.iteration.html | 36 + .../pug/test/cases/code.iteration.pug | 35 + node_modules/pug/test/cases/code.pug | 10 + .../pug/test/cases/comments-in-case.html | 6 + .../pug/test/cases/comments-in-case.pug | 10 + node_modules/pug/test/cases/comments.html | 32 + node_modules/pug/test/cases/comments.pug | 29 + .../pug/test/cases/comments.source.html | 0 .../pug/test/cases/comments.source.pug | 9 + .../pug/test/cases/doctype.custom.html | 1 + .../pug/test/cases/doctype.custom.pug | 1 + .../pug/test/cases/doctype.default.html | 6 + .../pug/test/cases/doctype.default.pug | 4 + .../pug/test/cases/doctype.keyword.html | 1 + .../pug/test/cases/doctype.keyword.pug | 1 + node_modules/pug/test/cases/each.else.html | 17 + node_modules/pug/test/cases/each.else.pug | 43 + node_modules/pug/test/cases/escape-chars.html | 1 + node_modules/pug/test/cases/escape-chars.pug | 2 + node_modules/pug/test/cases/escape-test.html | 9 + node_modules/pug/test/cases/escape-test.pug | 8 + .../test/cases/escaping-class-attribute.html | 6 + .../test/cases/escaping-class-attribute.pug | 6 + .../pug/test/cases/filter-in-include.html | 7 + .../pug/test/cases/filter-in-include.pug | 1 + .../pug/test/cases/filters-empty.html | 4 + node_modules/pug/test/cases/filters-empty.pug | 6 + .../pug/test/cases/filters.coffeescript.html | 8 + .../pug/test/cases/filters.coffeescript.pug | 6 + .../pug/test/cases/filters.custom.html | 8 + .../pug/test/cases/filters.custom.pug | 7 + .../test/cases/filters.include.custom.html | 10 + .../pug/test/cases/filters.include.custom.pug | 4 + .../pug/test/cases/filters.include.html | 20 + .../pug/test/cases/filters.include.pug | 7 + .../pug/test/cases/filters.inline.html | 3 + .../pug/test/cases/filters.inline.pug | 1 + node_modules/pug/test/cases/filters.less.html | 7 + node_modules/pug/test/cases/filters.less.pug | 8 + .../pug/test/cases/filters.markdown.html | 5 + .../pug/test/cases/filters.markdown.pug | 5 + .../pug/test/cases/filters.nested.html | 3 + .../pug/test/cases/filters.nested.pug | 10 + .../pug/test/cases/filters.stylus.html | 8 + .../pug/test/cases/filters.stylus.pug | 7 + node_modules/pug/test/cases/html.html | 9 + node_modules/pug/test/cases/html.pug | 13 + node_modules/pug/test/cases/html5.html | 4 + node_modules/pug/test/cases/html5.pug | 4 + .../test/cases/include-extends-from-root.html | 8 + .../test/cases/include-extends-from-root.pug | 1 + .../include-extends-of-common-template.html | 2 + .../include-extends-of-common-template.pug | 2 + .../test/cases/include-extends-relative.html | 8 + .../test/cases/include-extends-relative.pug | 1 + .../test/cases/include-filter-coffee.coffee | 2 + .../test/cases/include-only-text-body.html | 1 + .../pug/test/cases/include-only-text-body.pug | 3 + .../pug/test/cases/include-only-text.html | 5 + .../pug/test/cases/include-only-text.pug | 5 + .../test/cases/include-with-text-head.html | 3 + .../pug/test/cases/include-with-text-head.pug | 3 + .../pug/test/cases/include-with-text.html | 7 + .../pug/test/cases/include-with-text.pug | 4 + .../pug/test/cases/include.script.html | 6 + .../pug/test/cases/include.script.pug | 2 + .../pug/test/cases/include.yield.nested.html | 17 + .../pug/test/cases/include.yield.nested.pug | 4 + .../pug/test/cases/includes-with-ext-js.html | 2 + .../pug/test/cases/includes-with-ext-js.pug | 3 + node_modules/pug/test/cases/includes.html | 16 + node_modules/pug/test/cases/includes.pug | 10 + .../test/cases/inheritance.alert-dialog.html | 6 + .../test/cases/inheritance.alert-dialog.pug | 6 + .../pug/test/cases/inheritance.defaults.html | 7 + .../pug/test/cases/inheritance.defaults.pug | 6 + .../pug/test/cases/inheritance.extend.html | 10 + .../cases/inheritance.extend.include.html | 14 + .../test/cases/inheritance.extend.include.pug | 13 + .../inheritance.extend.mixins.block.html | 10 + .../cases/inheritance.extend.mixins.block.pug | 4 + .../test/cases/inheritance.extend.mixins.html | 9 + .../test/cases/inheritance.extend.mixins.pug | 11 + .../pug/test/cases/inheritance.extend.pug | 9 + .../cases/inheritance.extend.recursive.html | 4 + .../cases/inheritance.extend.recursive.pug | 4 + .../cases/inheritance.extend.whitespace.html | 10 + .../cases/inheritance.extend.whitespace.pug | 13 + node_modules/pug/test/cases/inheritance.html | 10 + node_modules/pug/test/cases/inheritance.pug | 9 + node_modules/pug/test/cases/inline-tag.html | 21 + node_modules/pug/test/cases/inline-tag.pug | 19 + .../pug/test/cases/intepolated-elements.html | 4 + .../pug/test/cases/intepolated-elements.pug | 3 + .../pug/test/cases/interpolated-mixin.html | 3 + .../pug/test/cases/interpolated-mixin.pug | 4 + .../pug/test/cases/interpolation.escape.html | 6 + .../pug/test/cases/interpolation.escape.pug | 7 + .../pug/test/cases/javascript-new-lines.js | 1 + .../pug/test/cases/layout.append.html | 9 + node_modules/pug/test/cases/layout.append.pug | 6 + .../cases/layout.append.without-block.html | 9 + .../cases/layout.append.without-block.pug | 6 + .../layout.multi.append.prepend.block.html | 8 + .../layout.multi.append.prepend.block.pug | 19 + .../pug/test/cases/layout.prepend.html | 9 + .../pug/test/cases/layout.prepend.pug | 6 + .../cases/layout.prepend.without-block.html | 9 + .../cases/layout.prepend.without-block.pug | 6 + .../pug/test/cases/mixin-at-end-of-file.html | 3 + .../pug/test/cases/mixin-at-end-of-file.pug | 4 + .../test/cases/mixin-block-with-space.html | 3 + .../pug/test/cases/mixin-block-with-space.pug | 6 + node_modules/pug/test/cases/mixin-hoist.html | 5 + node_modules/pug/test/cases/mixin-hoist.pug | 7 + .../pug/test/cases/mixin-via-include.html | 1 + .../pug/test/cases/mixin-via-include.pug | 5 + node_modules/pug/test/cases/mixin.attrs.html | 32 + node_modules/pug/test/cases/mixin.attrs.pug | 59 + .../test/cases/mixin.block-tag-behaviour.html | 22 + .../test/cases/mixin.block-tag-behaviour.pug | 24 + node_modules/pug/test/cases/mixin.blocks.html | 34 + node_modules/pug/test/cases/mixin.blocks.pug | 44 + node_modules/pug/test/cases/mixin.merge.html | 34 + node_modules/pug/test/cases/mixin.merge.pug | 15 + .../pug/test/cases/mixins-unused.html | 1 + node_modules/pug/test/cases/mixins-unused.pug | 3 + node_modules/pug/test/cases/mixins.html | 23 + node_modules/pug/test/cases/mixins.pug | 32 + .../pug/test/cases/mixins.rest-args.html | 6 + .../pug/test/cases/mixins.rest-args.pug | 6 + node_modules/pug/test/cases/namespaces.html | 2 + node_modules/pug/test/cases/namespaces.pug | 2 + node_modules/pug/test/cases/nesting.html | 11 + node_modules/pug/test/cases/nesting.pug | 8 + .../pug/test/cases/pipeless-comments.html | 6 + .../pug/test/cases/pipeless-comments.pug | 4 + .../pug/test/cases/pipeless-filters.html | 2 + .../pug/test/cases/pipeless-filters.pug | 4 + node_modules/pug/test/cases/pipeless-tag.html | 3 + node_modules/pug/test/cases/pipeless-tag.pug | 3 + node_modules/pug/test/cases/pre.html | 7 + node_modules/pug/test/cases/pre.pug | 10 + node_modules/pug/test/cases/quotes.html | 2 + node_modules/pug/test/cases/quotes.pug | 2 + .../pug/test/cases/regression.1794.html | 1 + .../pug/test/cases/regression.1794.pug | 4 + .../pug/test/cases/regression.784.html | 1 + .../pug/test/cases/regression.784.pug | 2 + .../pug/test/cases/script.whitespace.html | 7 + .../pug/test/cases/script.whitespace.pug | 6 + node_modules/pug/test/cases/scripts.html | 9 + .../pug/test/cases/scripts.non-js.html | 11 + .../pug/test/cases/scripts.non-js.pug | 9 + node_modules/pug/test/cases/scripts.pug | 8 + .../pug/test/cases/self-closing-html.html | 4 + .../pug/test/cases/self-closing-html.pug | 4 + .../pug/test/cases/single-period.html | 1 + node_modules/pug/test/cases/single-period.pug | 1 + .../pug/test/cases/some-included.styl | 2 + node_modules/pug/test/cases/some.md | 3 + node_modules/pug/test/cases/some.styl | 1 + node_modules/pug/test/cases/source.html | 6 + node_modules/pug/test/cases/source.pug | 4 + node_modules/pug/test/cases/styles.html | 20 + node_modules/pug/test/cases/styles.pug | 19 + .../pug/test/cases/tag.interpolation.html | 9 + .../pug/test/cases/tag.interpolation.pug | 22 + .../pug/test/cases/tags.self-closing.html | 14 + .../pug/test/cases/tags.self-closing.pug | 19 + node_modules/pug/test/cases/template.html | 11 + node_modules/pug/test/cases/template.pug | 9 + node_modules/pug/test/cases/text-block.html | 6 + node_modules/pug/test/cases/text-block.pug | 6 + node_modules/pug/test/cases/text.html | 38 + node_modules/pug/test/cases/text.pug | 46 + node_modules/pug/test/cases/utf8bom.html | 1 + node_modules/pug/test/cases/utf8bom.pug | 1 + node_modules/pug/test/cases/vars.html | 1 + node_modules/pug/test/cases/vars.pug | 3 + node_modules/pug/test/cases/while.html | 11 + node_modules/pug/test/cases/while.pug | 5 + node_modules/pug/test/cases/xml.html | 3 + node_modules/pug/test/cases/xml.pug | 3 + .../cases/yield-before-conditional-head.html | 3 + .../cases/yield-before-conditional-head.pug | 5 + .../test/cases/yield-before-conditional.html | 9 + .../test/cases/yield-before-conditional.pug | 5 + node_modules/pug/test/cases/yield-head.html | 4 + node_modules/pug/test/cases/yield-head.pug | 4 + .../pug/test/cases/yield-title-head.html | 5 + .../pug/test/cases/yield-title-head.pug | 5 + node_modules/pug/test/cases/yield-title.html | 9 + node_modules/pug/test/cases/yield-title.pug | 4 + node_modules/pug/test/cases/yield.html | 10 + node_modules/pug/test/cases/yield.pug | 5 + .../pug/test/dependencies/dependency1.pug | 1 + .../pug/test/dependencies/dependency2.pug | 1 + .../pug/test/dependencies/dependency3.pug | 1 + .../pug/test/dependencies/extends1.pug | 1 + .../pug/test/dependencies/extends2.pug | 1 + .../pug/test/dependencies/include1.pug | 1 + .../pug/test/dependencies/include2.pug | 1 + .../__snapshots__/index.test.js.snap | 3 + .../pug/test/duplicate-block/index.pug | 4 + .../pug/test/duplicate-block/index.test.js | 14 + .../layout-with-duplicate-block.pug | 8 + node_modules/pug/test/error.reporting.test.js | 193 + node_modules/pug/test/examples.test.js | 23 + .../append-without-block/app-layout.pug | 5 + .../fixtures/append-without-block/layout.pug | 7 + .../fixtures/append-without-block/page.pug | 6 + .../pug/test/fixtures/append/app-layout.pug | 5 + .../pug/test/fixtures/append/layout.pug | 7 + .../pug/test/fixtures/append/page.html | 9 + .../pug/test/fixtures/append/page.pug | 6 + .../compile.with.include.locals.error.pug | 1 + .../compile.with.include.syntax.error.pug | 1 + .../compile.with.layout.locals.error.pug | 1 + .../compile.with.layout.syntax.error.pug | 1 + ....with.layout.with.include.locals.error.pug | 1 + ....with.layout.with.include.syntax.error.pug | 1 + .../element-with-multiple-attributes.pug | 1 + .../test/fixtures/include.locals.error.pug | 2 + .../test/fixtures/include.syntax.error.pug | 2 + .../fixtures/invalid-block-in-extends.pug | 7 + .../fixtures/issue-1593/include-layout.pug | 2 + .../pug/test/fixtures/issue-1593/include.pug | 4 + .../pug/test/fixtures/issue-1593/index.pug | 7 + .../pug/test/fixtures/issue-1593/layout.pug | 3 + .../pug/test/fixtures/layout.locals.error.pug | 2 + node_modules/pug/test/fixtures/layout.pug | 6 + .../pug/test/fixtures/layout.syntax.error.pug | 2 + .../fixtures/layout.with.runtime.error.pug | 5 + .../pug/test/fixtures/mixin-include.pug | 5 + .../pug/test/fixtures/mixin.error.pug | 2 + .../multi-append-prepend-block/redefine.pug | 5 + .../multi-append-prepend-block/root.pug | 5 + node_modules/pug/test/fixtures/perf.pug | 32 + .../prepend-without-block/app-layout.pug | 5 + .../fixtures/prepend-without-block/layout.pug | 7 + .../fixtures/prepend-without-block/page.html | 9 + .../fixtures/prepend-without-block/page.pug | 6 + .../pug/test/fixtures/prepend/app-layout.pug | 5 + .../pug/test/fixtures/prepend/layout.pug | 7 + .../pug/test/fixtures/prepend/page.html | 9 + .../pug/test/fixtures/prepend/page.pug | 6 + .../pug/test/fixtures/runtime.error.pug | 1 + .../test/fixtures/runtime.layout.error.pug | 3 + .../fixtures/runtime.with.mixin.error.pug | 3 + node_modules/pug/test/fixtures/scripts.pug | 2 + node_modules/pug/test/output-es2015/attr.html | 2 + node_modules/pug/test/output-es2015/attr.js | 56 + node_modules/pug/test/output/attrs-data.html | 7 + node_modules/pug/test/output/attrs-data.js | 49 + node_modules/pug/test/output/attrs.html | 20 + node_modules/pug/test/output/attrs.js | 93 + node_modules/pug/test/output/attrs.js.html | 5 + node_modules/pug/test/output/attrs.js.js | 115 + .../pug/test/output/attrs.unescaped.html | 6 + .../pug/test/output/attrs.unescaped.js | 5 + node_modules/pug/test/output/basic.html | 6 + node_modules/pug/test/output/basic.js | 5 + node_modules/pug/test/output/blanks.html | 6 + node_modules/pug/test/output/blanks.js | 5 + node_modules/pug/test/output/block-code.html | 7 + node_modules/pug/test/output/block-code.js | 58 + .../pug/test/output/block-expansion.html | 6 + .../pug/test/output/block-expansion.js | 5 + .../output/block-expansion.shorthands.html | 8 + .../test/output/block-expansion.shorthands.js | 5 + node_modules/pug/test/output/blockquote.html | 5 + node_modules/pug/test/output/blockquote.js | 5 + .../pug/test/output/blocks-in-blocks.html | 9 + .../pug/test/output/blocks-in-blocks.js | 5 + .../pug/test/output/blocks-in-if.html | 2 + node_modules/pug/test/output/blocks-in-if.js | 10 + node_modules/pug/test/output/case-blocks.html | 6 + node_modules/pug/test/output/case-blocks.js | 52 + node_modules/pug/test/output/case.html | 8 + node_modules/pug/test/output/case.js | 75 + .../pug/test/output/classes-empty.html | 1 + node_modules/pug/test/output/classes-empty.js | 62 + node_modules/pug/test/output/classes.html | 1 + node_modules/pug/test/output/classes.js | 5 + .../pug/test/output/code.conditionals.html | 12 + .../pug/test/output/code.conditionals.js | 47 + node_modules/pug/test/output/code.escape.html | 3 + node_modules/pug/test/output/code.escape.js | 37 + node_modules/pug/test/output/code.html | 11 + .../pug/test/output/code.iteration.html | 37 + .../pug/test/output/code.iteration.js | 194 + node_modules/pug/test/output/code.js | 43 + .../pug/test/output/comments-in-case.html | 6 + .../pug/test/output/comments-in-case.js | 16 + node_modules/pug/test/output/comments.html | 32 + node_modules/pug/test/output/comments.js | 5 + .../pug/test/output/comments.source.html | 0 .../pug/test/output/comments.source.js | 4 + .../pug/test/output/doctype.custom.html | 1 + .../pug/test/output/doctype.custom.js | 5 + .../pug/test/output/doctype.default.html | 6 + .../pug/test/output/doctype.default.js | 5 + .../pug/test/output/doctype.keyword.html | 1 + .../pug/test/output/doctype.keyword.js | 5 + node_modules/pug/test/output/each.else.html | 18 + node_modules/pug/test/output/each.else.js | 180 + .../pug/test/output/escape-chars.html | 2 + node_modules/pug/test/output/escape-chars.js | 5 + node_modules/pug/test/output/escape-test.html | 9 + node_modules/pug/test/output/escape-test.js | 39 + .../test/output/escaping-class-attribute.html | 7 + .../test/output/escaping-class-attribute.js | 5 + .../pug/test/output/filter-in-include.html | 10 + .../pug/test/output/filter-in-include.js | 5 + .../pug/test/output/filters-empty.html | 4 + node_modules/pug/test/output/filters-empty.js | 64 + .../pug/test/output/filters.coffeescript.html | 10 + .../pug/test/output/filters.coffeescript.js | 5 + .../pug/test/output/filters.custom.html | 8 + .../pug/test/output/filters.custom.js | 5 + .../test/output/filters.include.custom.html | 10 + .../pug/test/output/filters.include.custom.js | 5 + .../pug/test/output/filters.include.html | 20 + .../pug/test/output/filters.include.js | 5 + .../pug/test/output/filters.inline.html | 3 + .../pug/test/output/filters.inline.js | 5 + .../pug/test/output/filters.less.html | 10 + node_modules/pug/test/output/filters.less.js | 5 + .../pug/test/output/filters.markdown.html | 7 + .../pug/test/output/filters.markdown.js | 5 + .../pug/test/output/filters.nested.html | 3 + .../pug/test/output/filters.nested.js | 5 + .../pug/test/output/filters.stylus.html | 11 + .../pug/test/output/filters.stylus.js | 5 + node_modules/pug/test/output/html.html | 9 + node_modules/pug/test/output/html.js | 38 + node_modules/pug/test/output/html5.html | 4 + node_modules/pug/test/output/html5.js | 5 + .../output/include-extends-from-root.html | 9 + .../test/output/include-extends-from-root.js | 5 + .../include-extends-of-common-template.html | 3 + .../include-extends-of-common-template.js | 5 + .../test/output/include-extends-relative.html | 9 + .../test/output/include-extends-relative.js | 5 + .../test/output/include-only-text-body.html | 1 + .../pug/test/output/include-only-text-body.js | 5 + .../pug/test/output/include-only-text.html | 6 + .../pug/test/output/include-only-text.js | 5 + .../test/output/include-with-text-head.html | 4 + .../pug/test/output/include-with-text-head.js | 5 + .../pug/test/output/include-with-text.html | 8 + .../pug/test/output/include-with-text.js | 5 + .../pug/test/output/include.script.html | 7 + .../pug/test/output/include.script.js | 5 + .../pug/test/output/include.yield.nested.html | 18 + .../pug/test/output/include.yield.nested.js | 5 + .../pug/test/output/includes-with-ext-js.html | 3 + .../pug/test/output/includes-with-ext-js.js | 5 + node_modules/pug/test/output/includes.html | 17 + node_modules/pug/test/output/includes.js | 10 + .../test/output/inheritance.alert-dialog.html | 7 + .../test/output/inheritance.alert-dialog.js | 5 + .../pug/test/output/inheritance.defaults.html | 8 + .../pug/test/output/inheritance.defaults.js | 5 + .../pug/test/output/inheritance.extend.html | 11 + .../output/inheritance.extend.include.html | 15 + .../test/output/inheritance.extend.include.js | 5 + .../pug/test/output/inheritance.extend.js | 5 + .../inheritance.extend.mixins.block.html | 11 + .../output/inheritance.extend.mixins.block.js | 17 + .../output/inheritance.extend.mixins.html | 10 + .../test/output/inheritance.extend.mixins.js | 50 + .../output/inheritance.extend.recursive.html | 5 + .../output/inheritance.extend.recursive.js | 5 + .../output/inheritance.extend.whitespace.html | 11 + .../output/inheritance.extend.whitespace.js | 5 + node_modules/pug/test/output/inheritance.html | 11 + node_modules/pug/test/output/inheritance.js | 5 + node_modules/pug/test/output/inline-tag.html | 21 + node_modules/pug/test/output/inline-tag.js | 41 + .../pug/test/output/intepolated-elements.html | 4 + .../pug/test/output/intepolated-elements.js | 5 + .../pug/test/output/interpolated-mixin.html | 3 + .../pug/test/output/interpolated-mixin.js | 49 + .../pug/test/output/interpolation.escape.html | 7 + .../pug/test/output/interpolation.escape.js | 38 + .../pug/test/output/layout.append.html | 10 + node_modules/pug/test/output/layout.append.js | 5 + .../output/layout.append.without-block.html | 10 + .../output/layout.append.without-block.js | 5 + .../layout.multi.append.prepend.block.html | 9 + .../layout.multi.append.prepend.block.js | 5 + .../pug/test/output/layout.prepend.html | 10 + .../pug/test/output/layout.prepend.js | 5 + .../output/layout.prepend.without-block.html | 10 + .../output/layout.prepend.without-block.js | 5 + .../pug/test/output/mixin-at-end-of-file.html | 4 + .../pug/test/output/mixin-at-end-of-file.js | 15 + .../test/output/mixin-block-with-space.html | 3 + .../pug/test/output/mixin-block-with-space.js | 15 + node_modules/pug/test/output/mixin-hoist.html | 6 + node_modules/pug/test/output/mixin-hoist.js | 46 + .../pug/test/output/mixin-via-include.html | 2 + .../pug/test/output/mixin-via-include.js | 13 + node_modules/pug/test/output/mixin.attrs.html | 33 + node_modules/pug/test/output/mixin.attrs.js | 223 + .../output/mixin.block-tag-behaviour.html | 23 + .../test/output/mixin.block-tag-behaviour.js | 62 + .../pug/test/output/mixin.blocks.html | 35 + node_modules/pug/test/output/mixin.blocks.js | 97 + node_modules/pug/test/output/mixin.merge.html | 35 + node_modules/pug/test/output/mixin.merge.js | 148 + .../pug/test/output/mixins-unused.html | 2 + node_modules/pug/test/output/mixins-unused.js | 5 + node_modules/pug/test/output/mixins.html | 23 + node_modules/pug/test/output/mixins.js | 61 + .../pug/test/output/mixins.rest-args.html | 7 + .../pug/test/output/mixins.rest-args.js | 62 + node_modules/pug/test/output/namespaces.html | 3 + node_modules/pug/test/output/namespaces.js | 5 + node_modules/pug/test/output/nesting.html | 12 + node_modules/pug/test/output/nesting.js | 5 + .../pug/test/output/pipeless-comments.html | 6 + .../pug/test/output/pipeless-comments.js | 5 + .../pug/test/output/pipeless-filters.html | 3 + .../pug/test/output/pipeless-filters.js | 5 + .../pug/test/output/pipeless-tag.html | 3 + node_modules/pug/test/output/pipeless-tag.js | 37 + node_modules/pug/test/output/pre.html | 8 + node_modules/pug/test/output/pre.js | 5 + node_modules/pug/test/output/quotes.html | 3 + node_modules/pug/test/output/quotes.js | 5 + .../pug/test/output/regression.1794.html | 2 + .../pug/test/output/regression.1794.js | 106 + .../pug/test/output/regression.784.html | 2 + .../pug/test/output/regression.784.js | 38 + .../pug/test/output/script.whitespace.html | 8 + .../pug/test/output/script.whitespace.js | 5 + node_modules/pug/test/output/scripts.html | 10 + node_modules/pug/test/output/scripts.js | 5 + .../pug/test/output/scripts.non-js.html | 12 + .../pug/test/output/scripts.non-js.js | 5 + .../pug/test/output/self-closing-html.html | 4 + .../pug/test/output/self-closing-html.js | 5 + .../pug/test/output/single-period.html | 1 + node_modules/pug/test/output/single-period.js | 5 + node_modules/pug/test/output/source.html | 7 + node_modules/pug/test/output/source.js | 5 + node_modules/pug/test/output/styles.html | 21 + node_modules/pug/test/output/styles.js | 125 + .../pug/test/output/tag.interpolation.html | 10 + .../pug/test/output/tag.interpolation.js | 116 + .../pug/test/output/tags.self-closing.html | 14 + .../pug/test/output/tags.self-closing.js | 5 + node_modules/pug/test/output/template.html | 12 + node_modules/pug/test/output/template.js | 5 + node_modules/pug/test/output/text-block.html | 7 + node_modules/pug/test/output/text-block.js | 5 + node_modules/pug/test/output/text.html | 38 + node_modules/pug/test/output/text.js | 5 + node_modules/pug/test/output/utf8bom.html | 2 + node_modules/pug/test/output/utf8bom.js | 5 + node_modules/pug/test/output/vars.html | 1 + node_modules/pug/test/output/vars.js | 64 + node_modules/pug/test/output/while.html | 12 + node_modules/pug/test/output/while.js | 43 + node_modules/pug/test/output/xml.html | 3 + node_modules/pug/test/output/xml.js | 5 + .../output/yield-before-conditional-head.html | 4 + .../output/yield-before-conditional-head.js | 9 + .../test/output/yield-before-conditional.html | 10 + .../test/output/yield-before-conditional.js | 9 + node_modules/pug/test/output/yield-head.html | 5 + node_modules/pug/test/output/yield-head.js | 5 + .../pug/test/output/yield-title-head.html | 6 + .../pug/test/output/yield-title-head.js | 5 + node_modules/pug/test/output/yield-title.html | 10 + node_modules/pug/test/output/yield-title.js | 5 + node_modules/pug/test/output/yield.html | 11 + node_modules/pug/test/output/yield.js | 5 + node_modules/pug/test/pug.test.js | 1164 + node_modules/pug/test/run-es2015.test.js | 21 + .../pug/test/run-syntax-errors.test.js | 34 + node_modules/pug/test/run-utils.js | 106 + node_modules/pug/test/run.test.js | 20 + .../pug/test/temp/input-compileFile.pug | 1 + .../pug/test/temp/input-compileFileClient.pug | 1 + .../pug/test/temp/input-renderFile.pug | 1 + node_modules/qs/.editorconfig | 30 + node_modules/qs/.eslintignore | 1 + node_modules/qs/.eslintrc | 19 + node_modules/qs/CHANGELOG.md | 221 + node_modules/qs/LICENSE | 28 + node_modules/qs/README.md | 475 + node_modules/qs/dist/qs.js | 627 + node_modules/qs/lib/formats.js | 18 + node_modules/qs/lib/index.js | 11 + node_modules/qs/lib/parse.js | 174 + node_modules/qs/lib/stringify.js | 210 + node_modules/qs/lib/utils.js | 202 + node_modules/qs/package.json | 79 + node_modules/qs/test/.eslintrc | 15 + node_modules/qs/test/index.js | 7 + node_modules/qs/test/parse.js | 573 + node_modules/qs/test/stringify.js | 596 + node_modules/qs/test/utils.js | 34 + node_modules/range-parser/HISTORY.md | 51 + node_modules/range-parser/LICENSE | 23 + node_modules/range-parser/README.md | 75 + node_modules/range-parser/index.js | 158 + node_modules/range-parser/package.json | 87 + node_modules/raw-body/HISTORY.md | 247 + node_modules/raw-body/LICENSE | 22 + node_modules/raw-body/README.md | 219 + node_modules/raw-body/index.d.ts | 87 + node_modules/raw-body/index.js | 286 + node_modules/raw-body/package.json | 90 + node_modules/rc/.npmignore | 3 + node_modules/rc/LICENSE.APACHE2 | 15 + node_modules/rc/LICENSE.BSD | 26 + node_modules/rc/LICENSE.MIT | 24 + node_modules/rc/README.md | 225 + node_modules/rc/browser.js | 7 + node_modules/rc/cli.js | 4 + node_modules/rc/index.js | 53 + node_modules/rc/lib/utils.js | 104 + node_modules/rc/package.json | 65 + node_modules/rc/test/ini.js | 16 + node_modules/rc/test/nested-env-vars.js | 50 + node_modules/rc/test/test.js | 59 + node_modules/readable-stream/.travis.yml | 55 + node_modules/readable-stream/CONTRIBUTING.md | 38 + node_modules/readable-stream/GOVERNANCE.md | 136 + node_modules/readable-stream/LICENSE | 47 + node_modules/readable-stream/README.md | 58 + .../doc/wg-meetings/2015-01-30.md | 60 + .../readable-stream/duplex-browser.js | 1 + node_modules/readable-stream/duplex.js | 1 + .../readable-stream/lib/_stream_duplex.js | 124 + .../lib/_stream_passthrough.js | 47 + .../readable-stream/lib/_stream_readable.js | 1015 + .../readable-stream/lib/_stream_transform.js | 214 + .../readable-stream/lib/_stream_writable.js | 677 + .../lib/internal/streams/BufferList.js | 79 + .../lib/internal/streams/destroy.js | 74 + .../lib/internal/streams/stream-browser.js | 1 + .../lib/internal/streams/stream.js | 1 + node_modules/readable-stream/package.json | 85 + node_modules/readable-stream/passthrough.js | 1 + .../readable-stream/readable-browser.js | 7 + node_modules/readable-stream/readable.js | 19 + node_modules/readable-stream/transform.js | 1 + .../readable-stream/writable-browser.js | 1 + node_modules/readable-stream/writable.js | 8 + node_modules/readdirp/.npmignore | 15 + node_modules/readdirp/.travis.yml | 6 + node_modules/readdirp/LICENSE | 20 + node_modules/readdirp/README.md | 233 + node_modules/readdirp/examples/Readme.md | 37 + .../readdirp/examples/callback-api.js | 10 + node_modules/readdirp/examples/grep.js | 71 + node_modules/readdirp/examples/package.json | 9 + .../readdirp/examples/stream-api-pipe.js | 19 + node_modules/readdirp/examples/stream-api.js | 15 + node_modules/readdirp/package.json | 79 + node_modules/readdirp/readdirp.js | 300 + node_modules/readdirp/stream-api.js | 99 + .../test/bed/root_dir1/root_dir1_file1.ext1 | 0 .../test/bed/root_dir1/root_dir1_file2.ext2 | 0 .../test/bed/root_dir1/root_dir1_file3.ext3 | 0 .../root1_dir1_subdir1_file1.ext1 | 0 .../test/bed/root_dir2/root_dir2_file1.ext1 | 0 .../test/bed/root_dir2/root_dir2_file2.ext2 | 0 .../readdirp/test/bed/root_file1.ext1 | 0 .../readdirp/test/bed/root_file2.ext2 | 0 .../readdirp/test/bed/root_file3.ext3 | 0 node_modules/readdirp/test/readdirp-stream.js | 338 + node_modules/readdirp/test/readdirp.js | 289 + node_modules/regenerator-runtime/README.md | 31 + node_modules/regenerator-runtime/package.json | 46 + node_modules/regenerator-runtime/path.js | 11 + .../regenerator-runtime/runtime-module.js | 35 + node_modules/regenerator-runtime/runtime.js | 727 + node_modules/regex-not/LICENSE | 21 + node_modules/regex-not/README.md | 133 + node_modules/regex-not/index.js | 72 + node_modules/regex-not/package.json | 98 + node_modules/regexp-clone/.npmignore | 2 + node_modules/regexp-clone/.travis.yml | 5 + node_modules/regexp-clone/History.md | 5 + node_modules/regexp-clone/LICENSE | 22 + node_modules/regexp-clone/Makefile | 5 + node_modules/regexp-clone/README.md | 18 + node_modules/regexp-clone/index.js | 20 + node_modules/regexp-clone/package.json | 55 + node_modules/regexp-clone/test/index.js | 112 + node_modules/registry-auth-token/CHANGELOG.md | 106 + node_modules/registry-auth-token/LICENSE | 21 + node_modules/registry-auth-token/README.md | 65 + node_modules/registry-auth-token/base64.js | 14 + node_modules/registry-auth-token/index.js | 118 + node_modules/registry-auth-token/package.json | 74 + .../registry-auth-token/registry-url.js | 5 + .../test/auth-token.test.js | 419 + .../test/registry-url.test.js | 64 + node_modules/registry-auth-token/yarn.lock | 1512 ++ node_modules/registry-url/index.js | 6 + node_modules/registry-url/license | 21 + node_modules/registry-url/package.json | 72 + node_modules/registry-url/readme.md | 50 + .../remove-trailing-separator/history.md | 17 + .../remove-trailing-separator/index.js | 17 + .../remove-trailing-separator/license | 3 + .../remove-trailing-separator/package.json | 64 + .../remove-trailing-separator/readme.md | 51 + node_modules/repeat-element/LICENSE | 21 + node_modules/repeat-element/README.md | 71 + node_modules/repeat-element/index.js | 18 + node_modules/repeat-element/package.json | 69 + node_modules/repeat-string/LICENSE | 21 + node_modules/repeat-string/README.md | 136 + node_modules/repeat-string/index.js | 70 + node_modules/repeat-string/package.json | 128 + node_modules/require_optional/.npmignore | 33 + node_modules/require_optional/.travis.yml | 9 + node_modules/require_optional/HISTORY.md | 7 + node_modules/require_optional/LICENSE | 201 + node_modules/require_optional/README.md | 2 + node_modules/require_optional/index.js | 128 + node_modules/require_optional/package.json | 67 + .../require_optional/test/nestedTest/index.js | 8 + .../test/nestedTest/package.json | 11 + .../test/require_optional_tests.js | 59 + node_modules/resolve-from/index.js | 23 + node_modules/resolve-from/license | 21 + node_modules/resolve-from/package.json | 66 + node_modules/resolve-from/readme.md | 58 + node_modules/resolve-url/.jshintrc | 44 + node_modules/resolve-url/LICENSE | 21 + node_modules/resolve-url/bower.json | 15 + node_modules/resolve-url/changelog.md | 15 + node_modules/resolve-url/component.json | 15 + node_modules/resolve-url/package.json | 68 + node_modules/resolve-url/readme.md | 83 + node_modules/resolve-url/resolve-url.js | 47 + node_modules/resolve-url/test/resolve-url.js | 70 + node_modules/resolve/.editorconfig | 20 + node_modules/resolve/.eslintignore | 1 + node_modules/resolve/.eslintrc | 30 + node_modules/resolve/.travis.yml | 173 + node_modules/resolve/LICENSE | 18 + node_modules/resolve/appveyor.yml | 44 + node_modules/resolve/example/async.js | 5 + node_modules/resolve/example/sync.js | 3 + node_modules/resolve/index.js | 8 + node_modules/resolve/lib/async.js | 203 + node_modules/resolve/lib/caller.js | 8 + node_modules/resolve/lib/core.js | 34 + node_modules/resolve/lib/core.json | 43 + .../resolve/lib/node-modules-paths.js | 45 + node_modules/resolve/lib/sync.js | 93 + node_modules/resolve/package.json | 69 + node_modules/resolve/readme.markdown | 160 + node_modules/resolve/test/core.js | 36 + node_modules/resolve/test/dotdot.js | 29 + node_modules/resolve/test/dotdot/abc/index.js | 2 + node_modules/resolve/test/dotdot/index.js | 1 + node_modules/resolve/test/faulty_basedir.js | 13 + node_modules/resolve/test/filter.js | 19 + node_modules/resolve/test/filter_sync.js | 16 + node_modules/resolve/test/mock.js | 143 + node_modules/resolve/test/mock_sync.js | 67 + node_modules/resolve/test/module_dir.js | 56 + .../test/module_dir/xmodules/aaa/index.js | 1 + .../test/module_dir/ymodules/aaa/index.js | 1 + .../test/module_dir/zmodules/bbb/main.js | 1 + .../test/module_dir/zmodules/bbb/package.json | 3 + .../resolve/test/node-modules-paths.js | 93 + node_modules/resolve/test/node_path.js | 49 + .../resolve/test/node_path/x/aaa/index.js | 1 + .../resolve/test/node_path/x/ccc/index.js | 1 + .../resolve/test/node_path/y/bbb/index.js | 1 + .../resolve/test/node_path/y/ccc/index.js | 1 + node_modules/resolve/test/nonstring.js | 9 + node_modules/resolve/test/pathfilter.js | 42 + .../resolve/test/pathfilter/deep_ref/main.js | 0 node_modules/resolve/test/precedence.js | 23 + node_modules/resolve/test/precedence/aaa.js | 1 + .../resolve/test/precedence/aaa/index.js | 1 + .../resolve/test/precedence/aaa/main.js | 1 + node_modules/resolve/test/precedence/bbb.js | 1 + .../resolve/test/precedence/bbb/main.js | 1 + node_modules/resolve/test/resolver.js | 349 + .../resolve/test/resolver/baz/doom.js | 0 .../resolve/test/resolver/baz/package.json | 3 + .../resolve/test/resolver/baz/quux.js | 1 + node_modules/resolve/test/resolver/cup.coffee | 1 + .../resolve/test/resolver/dot_main/index.js | 1 + .../test/resolver/dot_main/package.json | 3 + .../test/resolver/dot_slash_main/index.js | 1 + .../test/resolver/dot_slash_main/package.json | 3 + node_modules/resolve/test/resolver/foo.js | 1 + .../test/resolver/incorrect_main/index.js | 2 + .../test/resolver/incorrect_main/package.json | 3 + node_modules/resolve/test/resolver/mug.coffee | 0 node_modules/resolve/test/resolver/mug.js | 0 .../test/resolver/other_path/lib/other-lib.js | 0 .../resolve/test/resolver/other_path/root.js | 0 .../resolve/test/resolver/quux/foo/index.js | 1 + .../resolve/test/resolver/same_names/foo.js | 1 + .../test/resolver/same_names/foo/index.js | 1 + .../symlinked/_/symlink_target/.gitkeep | 0 .../test/resolver/without_basedir/main.js | 5 + node_modules/resolve/test/resolver_sync.js | 267 + node_modules/resolve/test/subdirs.js | 13 + node_modules/resolve/test/symlinks.js | 54 + node_modules/ret/LICENSE | 19 + node_modules/ret/README.md | 183 + node_modules/ret/lib/index.js | 282 + node_modules/ret/lib/positions.js | 17 + node_modules/ret/lib/sets.js | 82 + node_modules/ret/lib/types.js | 10 + node_modules/ret/lib/util.js | 111 + node_modules/ret/package.json | 67 + node_modules/right-align/LICENSE | 21 + node_modules/right-align/README.md | 77 + node_modules/right-align/index.js | 16 + node_modules/right-align/package.json | 70 + node_modules/safe-buffer/.travis.yml | 7 + node_modules/safe-buffer/LICENSE | 21 + node_modules/safe-buffer/README.md | 584 + node_modules/safe-buffer/index.js | 62 + node_modules/safe-buffer/package.json | 63 + node_modules/safe-buffer/test.js | 101 + node_modules/safe-regex/.travis.yml | 4 + node_modules/safe-regex/LICENSE | 18 + node_modules/safe-regex/example/safe.js | 3 + node_modules/safe-regex/index.js | 43 + node_modules/safe-regex/package.json | 74 + node_modules/safe-regex/readme.markdown | 65 + node_modules/safe-regex/test/regex.js | 50 + node_modules/semver-diff/index.js | 27 + node_modules/semver-diff/license | 21 + node_modules/semver-diff/package.json | 66 + node_modules/semver-diff/readme.md | 52 + node_modules/semver/LICENSE | 15 + node_modules/semver/README.md | 388 + node_modules/semver/bin/semver | 143 + node_modules/semver/package.json | 56 + node_modules/semver/range.bnf | 16 + node_modules/semver/semver.js | 1324 ++ node_modules/send/HISTORY.md | 436 + node_modules/send/LICENSE | 23 + node_modules/send/README.md | 301 + node_modules/send/index.js | 1103 + .../send/node_modules/statuses/HISTORY.md | 55 + .../send/node_modules/statuses/LICENSE | 23 + .../send/node_modules/statuses/README.md | 103 + .../send/node_modules/statuses/codes.json | 65 + .../send/node_modules/statuses/index.js | 110 + .../send/node_modules/statuses/package.json | 83 + node_modules/send/package.json | 104 + node_modules/serve-favicon/HISTORY.md | 179 + node_modules/serve-favicon/LICENSE | 25 + node_modules/serve-favicon/README.md | 139 + node_modules/serve-favicon/index.js | 211 + node_modules/serve-favicon/package.json | 82 + node_modules/serve-static/HISTORY.md | 404 + node_modules/serve-static/LICENSE | 25 + node_modules/serve-static/README.md | 253 + node_modules/serve-static/index.js | 209 + node_modules/serve-static/package.json | 75 + node_modules/set-immediate-shim/index.js | 7 + node_modules/set-immediate-shim/package.json | 66 + node_modules/set-immediate-shim/readme.md | 31 + node_modules/set-value/LICENSE | 21 + node_modules/set-value/README.md | 150 + node_modules/set-value/index.js | 51 + .../node_modules/extend-shallow/LICENSE | 21 + .../node_modules/extend-shallow/README.md | 61 + .../node_modules/extend-shallow/index.js | 33 + .../node_modules/extend-shallow/package.json | 87 + node_modules/set-value/package.json | 120 + node_modules/setprototypeof/LICENSE | 13 + node_modules/setprototypeof/README.md | 21 + node_modules/setprototypeof/index.js | 15 + node_modules/setprototypeof/package.json | 52 + node_modules/shebang-command/index.js | 19 + node_modules/shebang-command/license | 21 + node_modules/shebang-command/package.json | 71 + node_modules/shebang-command/readme.md | 39 + node_modules/shebang-regex/index.js | 2 + node_modules/shebang-regex/license | 21 + node_modules/shebang-regex/package.json | 64 + node_modules/shebang-regex/readme.md | 29 + node_modules/signal-exit/CHANGELOG.md | 27 + node_modules/signal-exit/LICENSE.txt | 16 + node_modules/signal-exit/README.md | 40 + node_modules/signal-exit/index.js | 157 + node_modules/signal-exit/package.json | 67 + node_modules/signal-exit/signals.js | 53 + node_modules/sliced/History.md | 41 + node_modules/sliced/LICENSE | 22 + node_modules/sliced/README.md | 62 + node_modules/sliced/index.js | 33 + node_modules/sliced/package.json | 62 + node_modules/snapdragon-node/LICENSE | 21 + node_modules/snapdragon-node/README.md | 453 + node_modules/snapdragon-node/index.js | 492 + .../node_modules/define-property/LICENSE | 21 + .../node_modules/define-property/README.md | 95 + .../node_modules/define-property/index.js | 31 + .../node_modules/define-property/package.json | 93 + node_modules/snapdragon-node/package.json | 109 + node_modules/snapdragon-util/LICENSE | 21 + node_modules/snapdragon-util/README.md | 807 + node_modules/snapdragon-util/index.js | 1019 + node_modules/snapdragon-util/package.json | 96 + node_modules/snapdragon/LICENSE | 21 + node_modules/snapdragon/README.md | 321 + node_modules/snapdragon/index.js | 174 + node_modules/snapdragon/lib/compiler.js | 177 + node_modules/snapdragon/lib/parser.js | 533 + node_modules/snapdragon/lib/position.js | 14 + node_modules/snapdragon/lib/source-maps.js | 145 + node_modules/snapdragon/lib/utils.js | 48 + .../node_modules/define-property/LICENSE | 21 + .../node_modules/define-property/README.md | 77 + .../node_modules/define-property/index.js | 31 + .../node_modules/define-property/package.json | 82 + .../node_modules/extend-shallow/LICENSE | 21 + .../node_modules/extend-shallow/README.md | 61 + .../node_modules/extend-shallow/index.js | 33 + .../node_modules/extend-shallow/package.json | 87 + .../is-accessor-descriptor/LICENSE | 21 + .../is-accessor-descriptor/README.md | 123 + .../is-accessor-descriptor/index.js | 69 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 261 + .../node_modules/kind-of/index.js | 116 + .../node_modules/kind-of/package.json | 139 + .../is-accessor-descriptor/package.json | 94 + .../node_modules/is-data-descriptor/LICENSE | 21 + .../node_modules/is-data-descriptor/README.md | 128 + .../node_modules/is-data-descriptor/index.js | 55 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 261 + .../node_modules/kind-of/index.js | 116 + .../node_modules/kind-of/package.json | 139 + .../is-data-descriptor/package.json | 93 + .../node_modules/is-descriptor/LICENSE | 21 + .../node_modules/is-descriptor/README.md | 193 + .../node_modules/is-descriptor/index.js | 22 + .../node_modules/is-descriptor/package.json | 114 + .../snapdragon/node_modules/kind-of/LICENSE | 21 + .../snapdragon/node_modules/kind-of/README.md | 342 + .../snapdragon/node_modules/kind-of/index.js | 147 + .../node_modules/kind-of/package.json | 146 + .../node_modules/source-map/CHANGELOG.md | 301 + .../node_modules/source-map/LICENSE | 28 + .../node_modules/source-map/README.md | 729 + .../source-map/dist/source-map.debug.js | 3091 +++ .../source-map/dist/source-map.js | 3090 +++ .../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 | 121 + .../node_modules/source-map/lib/base64-vlq.js | 140 + .../node_modules/source-map/lib/base64.js | 67 + .../source-map/lib/binary-search.js | 111 + .../source-map/lib/mapping-list.js | 79 + .../node_modules/source-map/lib/quick-sort.js | 114 + .../source-map/lib/source-map-consumer.js | 1082 + .../source-map/lib/source-map-generator.js | 416 + .../source-map/lib/source-node.js | 413 + .../node_modules/source-map/lib/util.js | 417 + .../node_modules/source-map/package.json | 211 + .../node_modules/source-map/source-map.js | 8 + node_modules/snapdragon/package.json | 126 + node_modules/source-map-resolve/.jshintrc | 46 + node_modules/source-map-resolve/.travis.yml | 3 + node_modules/source-map-resolve/LICENSE | 21 + node_modules/source-map-resolve/bower.json | 30 + node_modules/source-map-resolve/changelog.md | 94 + .../source-map-resolve/component.json | 29 + .../generate-source-map-resolve.js | 28 + .../lib/decode-uri-component.js | 11 + .../source-map-resolve/lib/resolve-url.js | 12 + .../lib/source-map-resolve-node.js | 302 + node_modules/source-map-resolve/package.json | 90 + node_modules/source-map-resolve/readme.md | 236 + .../source-map-resolve/source-map-resolve.js | 309 + .../source-map-resolve.js.template | 22 + .../source-map-resolve/x-package.json5 | 83 + node_modules/source-map-url/.jshintrc | 43 + node_modules/source-map-url/LICENSE | 21 + node_modules/source-map-url/bower.json | 20 + node_modules/source-map-url/changelog.md | 52 + node_modules/source-map-url/component.json | 18 + node_modules/source-map-url/package.json | 73 + node_modules/source-map-url/readme.md | 97 + node_modules/source-map-url/source-map-url.js | 57 + .../source-map-url/test/source-map-url.js | 402 + node_modules/source-map-url/x-package.json5 | 55 + node_modules/source-map/README.md | 510 + node_modules/source-map/build/assert-shim.js | 56 + node_modules/source-map/build/mini-require.js | 152 + .../source-map/build/prefix-source-map.jsm | 21 + .../source-map/build/prefix-utils.jsm | 18 + .../source-map/build/suffix-browser.js | 8 + .../source-map/build/suffix-source-map.jsm | 6 + .../source-map/build/suffix-utils.jsm | 21 + node_modules/source-map/build/test-prefix.js | 8 + node_modules/source-map/build/test-suffix.js | 3 + node_modules/source-map/lib/source-map.js | 8 + .../source-map/lib/source-map/array-set.js | 107 + .../source-map/lib/source-map/base64-vlq.js | 146 + .../source-map/lib/source-map/base64.js | 73 + .../lib/source-map/binary-search.js | 117 + .../source-map/lib/source-map/mapping-list.js | 86 + .../source-map/lib/source-map/quick-sort.js | 120 + .../lib/source-map/source-map-consumer.js | 1077 + .../lib/source-map/source-map-generator.js | 399 + .../source-map/lib/source-map/source-node.js | 414 + .../source-map/lib/source-map/util.js | 370 + node_modules/source-map/package.json | 198 + node_modules/split-string/LICENSE | 21 + node_modules/split-string/README.md | 321 + node_modules/split-string/index.js | 171 + node_modules/split-string/package.json | 103 + node_modules/split/.npmignore | 3 + node_modules/split/.travis.yml | 4 + node_modules/split/LICENCE | 22 + node_modules/split/examples/pretty.js | 26 + node_modules/split/index.js | 63 + node_modules/split/package.json | 62 + node_modules/split/readme.markdown | 66 + node_modules/split/test/options.asynct.js | 23 + .../split/test/partitioned_unicode.js | 34 + node_modules/split/test/split.asynct.js | 137 + node_modules/split/test/try_catch.asynct.js | 51 + node_modules/static-extend/LICENSE | 21 + node_modules/static-extend/index.js | 90 + .../node_modules/define-property/LICENSE | 21 + .../node_modules/define-property/README.md | 77 + .../node_modules/define-property/index.js | 31 + .../node_modules/define-property/package.json | 82 + .../is-accessor-descriptor/LICENSE | 21 + .../is-accessor-descriptor/README.md | 123 + .../is-accessor-descriptor/index.js | 69 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 261 + .../node_modules/kind-of/index.js | 116 + .../node_modules/kind-of/package.json | 139 + .../is-accessor-descriptor/package.json | 94 + .../node_modules/is-data-descriptor/LICENSE | 21 + .../node_modules/is-data-descriptor/README.md | 128 + .../node_modules/is-data-descriptor/index.js | 55 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 261 + .../node_modules/kind-of/index.js | 116 + .../node_modules/kind-of/package.json | 139 + .../is-data-descriptor/package.json | 93 + .../node_modules/is-descriptor/LICENSE | 21 + .../node_modules/is-descriptor/README.md | 193 + .../node_modules/is-descriptor/index.js | 22 + .../node_modules/is-descriptor/package.json | 114 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 342 + .../node_modules/kind-of/index.js | 147 + .../node_modules/kind-of/package.json | 146 + node_modules/static-extend/package.json | 96 + node_modules/statuses/HISTORY.md | 60 + node_modules/statuses/LICENSE | 23 + node_modules/statuses/README.md | 127 + node_modules/statuses/codes.json | 65 + node_modules/statuses/index.js | 113 + node_modules/statuses/package.json | 87 + node_modules/stream-combiner/.npmignore | 3 + node_modules/stream-combiner/.travis.yml | 4 + node_modules/stream-combiner/LICENSE | 22 + node_modules/stream-combiner/README.md | 29 + node_modules/stream-combiner/index.js | 39 + node_modules/stream-combiner/package.json | 54 + node_modules/stream-combiner/test/index.js | 52 + node_modules/string-width/index.js | 36 + node_modules/string-width/license | 9 + node_modules/string-width/package.json | 89 + node_modules/string-width/readme.md | 42 + node_modules/string_decoder/.npmignore | 2 + node_modules/string_decoder/LICENSE | 48 + node_modules/string_decoder/README.md | 28 + .../string_decoder/lib/string_decoder.js | 272 + node_modules/string_decoder/package.json | 56 + node_modules/strip-ansi/index.js | 4 + node_modules/strip-ansi/license | 9 + node_modules/strip-ansi/package.json | 84 + node_modules/strip-ansi/readme.md | 39 + node_modules/strip-eof/index.js | 15 + node_modules/strip-eof/license | 21 + node_modules/strip-eof/package.json | 71 + node_modules/strip-eof/readme.md | 28 + node_modules/strip-json-comments/index.js | 70 + node_modules/strip-json-comments/license | 21 + node_modules/strip-json-comments/package.json | 74 + node_modules/strip-json-comments/readme.md | 64 + node_modules/supports-color/browser.js | 5 + node_modules/supports-color/index.js | 135 + node_modules/supports-color/license | 9 + node_modules/supports-color/package.json | 86 + node_modules/supports-color/readme.md | 66 + node_modules/term-size/index.js | 70 + node_modules/term-size/license | 21 + node_modules/term-size/package.json | 75 + node_modules/term-size/readme.md | 41 + node_modules/term-size/vendor/macos/term-size | Bin 0 -> 8760 bytes .../term-size/vendor/windows/term-size.exe | Bin 0 -> 17408 bytes node_modules/through/.travis.yml | 5 + node_modules/through/LICENSE.APACHE2 | 15 + node_modules/through/LICENSE.MIT | 24 + node_modules/through/index.js | 108 + node_modules/through/package.json | 70 + node_modules/through/readme.markdown | 64 + node_modules/through/test/async.js | 28 + node_modules/through/test/auto-destroy.js | 30 + node_modules/through/test/buffering.js | 71 + node_modules/through/test/end.js | 45 + node_modules/through/test/index.js | 133 + node_modules/timed-out/index.js | 55 + node_modules/timed-out/license | 21 + node_modules/timed-out/package.json | 68 + node_modules/timed-out/readme.md | 42 + node_modules/to-fast-properties/index.js | 11 + node_modules/to-fast-properties/license | 22 + node_modules/to-fast-properties/package.json | 67 + node_modules/to-fast-properties/readme.md | 37 + node_modules/to-object-path/LICENSE | 21 + node_modules/to-object-path/README.md | 71 + node_modules/to-object-path/index.js | 33 + node_modules/to-object-path/package.json | 80 + node_modules/to-regex-range/LICENSE | 21 + node_modules/to-regex-range/README.md | 281 + node_modules/to-regex-range/index.js | 294 + node_modules/to-regex-range/package.json | 117 + node_modules/to-regex/LICENSE | 21 + node_modules/to-regex/README.md | 205 + node_modules/to-regex/index.js | 155 + node_modules/to-regex/package.json | 97 + node_modules/token-stream/.npmignore | 14 + node_modules/token-stream/.travis.yml | 3 + node_modules/token-stream/LICENSE | 19 + node_modules/token-stream/README.md | 68 + node_modules/token-stream/index.js | 30 + node_modules/token-stream/package.json | 50 + node_modules/token-stream/test/index.js | 46 + node_modules/touch/LICENSE | 15 + node_modules/touch/README.md | 52 + node_modules/touch/bin/nodetouch.js | 112 + node_modules/touch/index.js | 224 + node_modules/touch/package.json | 64 + node_modules/type-is/HISTORY.md | 236 + node_modules/type-is/LICENSE | 23 + node_modules/type-is/README.md | 146 + node_modules/type-is/index.js | 262 + node_modules/type-is/package.json | 85 + node_modules/uglify-js/LICENSE | 29 + node_modules/uglify-js/README.md | 995 + node_modules/uglify-js/bin/extract-props.js | 77 + node_modules/uglify-js/bin/uglifyjs | 635 + node_modules/uglify-js/lib/ast.js | 1052 + node_modules/uglify-js/lib/compress.js | 4101 ++++ node_modules/uglify-js/lib/mozilla-ast.js | 611 + node_modules/uglify-js/lib/output.js | 1423 ++ node_modules/uglify-js/lib/parse.js | 1599 ++ node_modules/uglify-js/lib/propmangle.js | 264 + node_modules/uglify-js/lib/scope.js | 656 + node_modules/uglify-js/lib/sourcemap.js | 97 + node_modules/uglify-js/lib/transform.js | 218 + node_modules/uglify-js/lib/utils.js | 362 + .../node_modules/source-map/CHANGELOG.md | 301 + .../uglify-js/node_modules/source-map/LICENSE | 28 + .../node_modules/source-map/README.md | 729 + .../source-map/dist/source-map.debug.js | 3091 +++ .../source-map/dist/source-map.js | 3090 +++ .../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 | 121 + .../node_modules/source-map/lib/base64-vlq.js | 140 + .../node_modules/source-map/lib/base64.js | 67 + .../source-map/lib/binary-search.js | 111 + .../source-map/lib/mapping-list.js | 79 + .../node_modules/source-map/lib/quick-sort.js | 114 + .../source-map/lib/source-map-consumer.js | 1082 + .../source-map/lib/source-map-generator.js | 416 + .../source-map/lib/source-node.js | 413 + .../node_modules/source-map/lib/util.js | 417 + .../node_modules/source-map/package.json | 211 + .../node_modules/source-map/source-map.js | 8 + node_modules/uglify-js/package.json | 90 + node_modules/uglify-js/tools/domprops.json | 5603 +++++ node_modules/uglify-js/tools/exports.js | 19 + node_modules/uglify-js/tools/node.js | 320 + node_modules/uglify-js/tools/props.html | 61 + node_modules/uglify-to-browserify/.npmignore | 14 + node_modules/uglify-to-browserify/.travis.yml | 3 + node_modules/uglify-to-browserify/LICENSE | 19 + node_modules/uglify-to-browserify/README.md | 15 + node_modules/uglify-to-browserify/index.js | 49 + .../uglify-to-browserify/package.json | 51 + .../uglify-to-browserify/test/index.js | 22 + node_modules/undefsafe/.jscsrc | 13 + node_modules/undefsafe/.jshintrc | 16 + node_modules/undefsafe/.npmignore | 2 + node_modules/undefsafe/.travis.yml | 18 + node_modules/undefsafe/LICENSE | 22 + node_modules/undefsafe/README.md | 63 + node_modules/undefsafe/example.js | 14 + node_modules/undefsafe/lib/undefsafe.js | 113 + node_modules/undefsafe/package.json | 63 + node_modules/union-value/LICENSE | 21 + node_modules/union-value/README.md | 73 + node_modules/union-value/index.js | 30 + .../node_modules/extend-shallow/LICENSE | 21 + .../node_modules/extend-shallow/README.md | 61 + .../node_modules/extend-shallow/index.js | 33 + .../node_modules/extend-shallow/package.json | 87 + .../node_modules/set-value/LICENSE | 21 + .../node_modules/set-value/README.md | 81 + .../node_modules/set-value/index.js | 63 + .../node_modules/set-value/package.json | 121 + node_modules/union-value/package.json | 105 + node_modules/unique-string/index.js | 4 + node_modules/unique-string/license | 21 + node_modules/unique-string/package.json | 76 + node_modules/unique-string/readme.md | 32 + node_modules/unpipe/HISTORY.md | 4 + node_modules/unpipe/LICENSE | 22 + node_modules/unpipe/README.md | 43 + node_modules/unpipe/index.js | 69 + node_modules/unpipe/package.json | 63 + node_modules/unset-value/LICENSE | 21 + node_modules/unset-value/README.md | 131 + node_modules/unset-value/index.js | 32 + .../node_modules/has-value/LICENSE | 21 + .../node_modules/has-value/README.md | 130 + .../node_modules/has-value/index.js | 19 + .../has-value/node_modules/isobject/LICENSE | 21 + .../has-value/node_modules/isobject/README.md | 112 + .../has-value/node_modules/isobject/index.js | 14 + .../node_modules/isobject/package.json | 98 + .../node_modules/has-value/package.json | 114 + .../node_modules/has-values/LICENSE | 21 + .../node_modules/has-values/README.md | 114 + .../node_modules/has-values/index.js | 36 + .../node_modules/has-values/package.json | 106 + node_modules/unset-value/package.json | 112 + node_modules/unzip-response/index.js | 36 + node_modules/unzip-response/license | 21 + node_modules/unzip-response/package.json | 81 + node_modules/unzip-response/readme.md | 29 + node_modules/upath/LICENSE | 22 + node_modules/upath/build/code/upath.js | 169 + node_modules/upath/package.json | 84 + node_modules/upath/readme.md | 331 + node_modules/upath/upath.d.ts | 239 + node_modules/update-notifier/check.js | 22 + node_modules/update-notifier/index.js | 151 + node_modules/update-notifier/package.json | 85 + node_modules/update-notifier/readme.md | 184 + node_modules/urix/.jshintrc | 42 + node_modules/urix/LICENSE | 21 + node_modules/urix/index.js | 17 + node_modules/urix/package.json | 59 + node_modules/urix/readme.md | 46 + node_modules/urix/test/index.js | 43 + node_modules/url-parse-lax/index.js | 14 + node_modules/url-parse-lax/license | 21 + node_modules/url-parse-lax/package.json | 73 + node_modules/url-parse-lax/readme.md | 100 + node_modules/use/LICENSE | 21 + node_modules/use/README.md | 90 + node_modules/use/index.js | 153 + .../use/node_modules/kind-of/CHANGELOG.md | 157 + node_modules/use/node_modules/kind-of/LICENSE | 21 + .../use/node_modules/kind-of/README.md | 365 + .../use/node_modules/kind-of/index.js | 129 + .../use/node_modules/kind-of/package.json | 143 + node_modules/use/package.json | 111 + node_modules/util-deprecate/History.md | 16 + node_modules/util-deprecate/LICENSE | 24 + node_modules/util-deprecate/README.md | 53 + node_modules/util-deprecate/browser.js | 67 + node_modules/util-deprecate/node.js | 6 + node_modules/util-deprecate/package.json | 56 + node_modules/utils-merge/.travis.yml | 6 + node_modules/utils-merge/LICENSE | 20 + node_modules/utils-merge/README.md | 34 + node_modules/utils-merge/index.js | 23 + node_modules/utils-merge/package.json | 64 + node_modules/vary/HISTORY.md | 39 + node_modules/vary/LICENSE | 22 + node_modules/vary/README.md | 101 + node_modules/vary/index.js | 149 + node_modules/vary/package.json | 78 + node_modules/void-elements/.gitattributes | 1 + node_modules/void-elements/.npmignore | 1 + node_modules/void-elements/.travis.yml | 4 + node_modules/void-elements/LICENSE | 22 + node_modules/void-elements/README.md | 27 + node_modules/void-elements/index.js | 23 + node_modules/void-elements/package.json | 58 + node_modules/void-elements/pre-publish.js | 29 + node_modules/void-elements/test/index.js | 5 + node_modules/which/CHANGELOG.md | 147 + node_modules/which/LICENSE | 15 + node_modules/which/README.md | 51 + node_modules/which/bin/which | 52 + node_modules/which/package.json | 65 + node_modules/which/which.js | 135 + node_modules/widest-line/index.js | 5 + node_modules/widest-line/license | 9 + node_modules/widest-line/package.json | 86 + node_modules/widest-line/readme.md | 34 + node_modules/window-size/LICENSE-MIT | 22 + node_modules/window-size/README.md | 26 + node_modules/window-size/index.js | 33 + node_modules/window-size/package.json | 58 + node_modules/with/.npmignore | 2 + node_modules/with/LICENSE | 19 + node_modules/with/README.md | 81 + node_modules/with/index.js | 111 + node_modules/with/package.json | 54 + node_modules/wordwrap/.npmignore | 1 + node_modules/wordwrap/README.markdown | 70 + node_modules/wordwrap/example/center.js | 10 + node_modules/wordwrap/example/meat.js | 3 + node_modules/wordwrap/index.js | 76 + node_modules/wordwrap/package.json | 66 + node_modules/wordwrap/test/break.js | 30 + node_modules/wordwrap/test/idleness.txt | 63 + node_modules/wordwrap/test/wrap.js | 31 + node_modules/write-file-atomic/LICENSE | 6 + node_modules/write-file-atomic/README.md | 49 + node_modules/write-file-atomic/index.js | 199 + node_modules/write-file-atomic/package.json | 67 + node_modules/xdg-basedir/index.js | 28 + node_modules/xdg-basedir/license | 21 + node_modules/xdg-basedir/package.json | 73 + node_modules/xdg-basedir/readme.md | 60 + node_modules/yallist/LICENSE | 15 + node_modules/yallist/README.md | 204 + node_modules/yallist/iterator.js | 7 + node_modules/yallist/package.json | 62 + node_modules/yallist/yallist.js | 370 + node_modules/yargs/CHANGELOG.md | 374 + node_modules/yargs/LICENSE | 21 + node_modules/yargs/README.md | 926 + node_modules/yargs/completion.sh.hbs | 22 + node_modules/yargs/index.js | 504 + node_modules/yargs/lib/completion.js | 71 + node_modules/yargs/lib/parser.js | 448 + node_modules/yargs/lib/usage.js | 314 + node_modules/yargs/lib/validation.js | 196 + node_modules/yargs/package.json | 114 + package-lock.json | 4076 ++++ package.json | 22 + public/stylesheets/style.css | 8 + routes/index.js | 9 + routes/users.js | 9 + views/error.pug | 6 + views/index.pug | 5 + views/layout.pug | 7 + 7914 files changed, 781439 insertions(+) create mode 100644 TODO.txt create mode 100644 app.js create mode 100755 bin/www create mode 120000 node_modules/.bin/acorn create mode 120000 node_modules/.bin/atob create mode 120000 node_modules/.bin/babylon create mode 120000 node_modules/.bin/cleancss create mode 120000 node_modules/.bin/mime create mode 120000 node_modules/.bin/nodemon create mode 120000 node_modules/.bin/nodetouch create mode 120000 node_modules/.bin/nopt create mode 120000 node_modules/.bin/rc create mode 120000 node_modules/.bin/semver create mode 120000 node_modules/.bin/uglifyjs create mode 120000 node_modules/.bin/which create mode 100644 node_modules/@types/babel-types/LICENSE create mode 100644 node_modules/@types/babel-types/README.md create mode 100644 node_modules/@types/babel-types/index.d.ts create mode 100644 node_modules/@types/babel-types/package.json create mode 100644 node_modules/@types/babylon/LICENSE create mode 100644 node_modules/@types/babylon/README.md create mode 100644 node_modules/@types/babylon/index.d.ts create mode 100644 node_modules/@types/babylon/package.json create mode 100644 node_modules/abbrev/LICENSE create mode 100644 node_modules/abbrev/README.md create mode 100644 node_modules/abbrev/abbrev.js create mode 100644 node_modules/abbrev/package.json create mode 100644 node_modules/accepts/HISTORY.md create mode 100644 node_modules/accepts/LICENSE create mode 100644 node_modules/accepts/README.md create mode 100644 node_modules/accepts/index.js create mode 100644 node_modules/accepts/package.json create mode 100644 node_modules/acorn-globals/LICENSE create mode 100644 node_modules/acorn-globals/README.md create mode 100644 node_modules/acorn-globals/index.js create mode 120000 node_modules/acorn-globals/node_modules/.bin/acorn create mode 100644 node_modules/acorn-globals/node_modules/acorn/.npmignore create mode 100644 node_modules/acorn-globals/node_modules/acorn/AUTHORS create mode 100644 node_modules/acorn-globals/node_modules/acorn/CHANGELOG.md create mode 100644 node_modules/acorn-globals/node_modules/acorn/LICENSE create mode 100644 node_modules/acorn-globals/node_modules/acorn/README.md create mode 100755 node_modules/acorn-globals/node_modules/acorn/bin/acorn create mode 100644 node_modules/acorn-globals/node_modules/acorn/dist/.keep create mode 100644 node_modules/acorn-globals/node_modules/acorn/dist/acorn.es.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/dist/acorn.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/dist/acorn_loose.es.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/dist/acorn_loose.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/dist/walk.es.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/dist/walk.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/package.json create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/bin/acorn.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/expression.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/identifier.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/index.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/location.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/locutil.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/loose/expression.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/loose/index.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/loose/parseutil.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/loose/state.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/loose/statement.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/loose/tokenize.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/lval.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/node.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/options.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/parseutil.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/state.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/statement.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/tokencontext.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/tokenize.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/tokentype.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/util.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/walk/index.js create mode 100644 node_modules/acorn-globals/node_modules/acorn/src/whitespace.js create mode 100644 node_modules/acorn-globals/package.json create mode 100644 node_modules/acorn/.editorconfig create mode 100644 node_modules/acorn/.gitattributes create mode 100644 node_modules/acorn/.npmignore create mode 100644 node_modules/acorn/.tern-project create mode 100644 node_modules/acorn/.travis.yml create mode 100644 node_modules/acorn/AUTHORS create mode 100644 node_modules/acorn/CHANGELOG.md create mode 100644 node_modules/acorn/LICENSE create mode 100644 node_modules/acorn/README.md create mode 100755 node_modules/acorn/bin/acorn create mode 100644 node_modules/acorn/bin/generate-identifier-regex.js create mode 100755 node_modules/acorn/bin/update_authors.sh create mode 100644 node_modules/acorn/dist/.keep create mode 100644 node_modules/acorn/dist/acorn.es.js create mode 100644 node_modules/acorn/dist/acorn.js create mode 100644 node_modules/acorn/dist/acorn_loose.es.js create mode 100644 node_modules/acorn/dist/acorn_loose.js create mode 100644 node_modules/acorn/dist/walk.es.js create mode 100644 node_modules/acorn/dist/walk.js create mode 100644 node_modules/acorn/package.json create mode 100644 node_modules/acorn/rollup/config.bin.js create mode 100644 node_modules/acorn/rollup/config.loose.js create mode 100644 node_modules/acorn/rollup/config.main.js create mode 100644 node_modules/acorn/rollup/config.walk.js create mode 100644 node_modules/acorn/src/bin/acorn.js create mode 100644 node_modules/acorn/src/expression.js create mode 100644 node_modules/acorn/src/identifier.js create mode 100644 node_modules/acorn/src/index.js create mode 100644 node_modules/acorn/src/location.js create mode 100644 node_modules/acorn/src/locutil.js create mode 100644 node_modules/acorn/src/loose/expression.js create mode 100644 node_modules/acorn/src/loose/index.js create mode 100644 node_modules/acorn/src/loose/parseutil.js create mode 100644 node_modules/acorn/src/loose/state.js create mode 100644 node_modules/acorn/src/loose/statement.js create mode 100644 node_modules/acorn/src/loose/tokenize.js create mode 100644 node_modules/acorn/src/lval.js create mode 100644 node_modules/acorn/src/node.js create mode 100644 node_modules/acorn/src/options.js create mode 100644 node_modules/acorn/src/parseutil.js create mode 100644 node_modules/acorn/src/state.js create mode 100644 node_modules/acorn/src/statement.js create mode 100644 node_modules/acorn/src/tokencontext.js create mode 100644 node_modules/acorn/src/tokenize.js create mode 100644 node_modules/acorn/src/tokentype.js create mode 100644 node_modules/acorn/src/util.js create mode 100644 node_modules/acorn/src/walk/index.js create mode 100644 node_modules/acorn/src/whitespace.js create mode 100644 node_modules/align-text/LICENSE create mode 100644 node_modules/align-text/README.md create mode 100644 node_modules/align-text/index.js create mode 100644 node_modules/align-text/package.json create mode 100644 node_modules/amdefine/LICENSE create mode 100644 node_modules/amdefine/README.md create mode 100644 node_modules/amdefine/amdefine.js create mode 100644 node_modules/amdefine/intercept.js create mode 100644 node_modules/amdefine/package.json create mode 100644 node_modules/ansi-align/CHANGELOG.md create mode 100644 node_modules/ansi-align/LICENSE create mode 100644 node_modules/ansi-align/README.md create mode 100644 node_modules/ansi-align/index.js create mode 100644 node_modules/ansi-align/package.json create mode 100644 node_modules/ansi-regex/index.js create mode 100644 node_modules/ansi-regex/license create mode 100644 node_modules/ansi-regex/package.json create mode 100644 node_modules/ansi-regex/readme.md create mode 100644 node_modules/ansi-styles/index.js create mode 100644 node_modules/ansi-styles/license create mode 100644 node_modules/ansi-styles/package.json create mode 100644 node_modules/ansi-styles/readme.md create mode 100644 node_modules/anymatch/LICENSE create mode 100644 node_modules/anymatch/README.md create mode 100644 node_modules/anymatch/index.js create mode 100644 node_modules/anymatch/package.json create mode 100755 node_modules/arr-diff/LICENSE create mode 100644 node_modules/arr-diff/README.md create mode 100644 node_modules/arr-diff/index.js create mode 100644 node_modules/arr-diff/package.json create mode 100755 node_modules/arr-flatten/LICENSE create mode 100755 node_modules/arr-flatten/README.md create mode 100644 node_modules/arr-flatten/index.js create mode 100644 node_modules/arr-flatten/package.json create mode 100644 node_modules/arr-union/LICENSE create mode 100644 node_modules/arr-union/README.md create mode 100644 node_modules/arr-union/index.js create mode 100644 node_modules/arr-union/package.json create mode 100644 node_modules/array-flatten/LICENSE create mode 100644 node_modules/array-flatten/README.md create mode 100644 node_modules/array-flatten/array-flatten.js create mode 100644 node_modules/array-flatten/package.json create mode 100755 node_modules/array-unique/LICENSE create mode 100755 node_modules/array-unique/README.md create mode 100644 node_modules/array-unique/index.js create mode 100644 node_modules/array-unique/package.json create mode 100644 node_modules/asap/CHANGES.md create mode 100644 node_modules/asap/LICENSE.md create mode 100644 node_modules/asap/README.md create mode 100644 node_modules/asap/asap.js create mode 100644 node_modules/asap/browser-asap.js create mode 100644 node_modules/asap/browser-raw.js create mode 100644 node_modules/asap/package.json create mode 100644 node_modules/asap/raw.js create mode 100644 node_modules/assign-symbols/LICENSE create mode 100644 node_modules/assign-symbols/README.md create mode 100644 node_modules/assign-symbols/index.js create mode 100644 node_modules/assign-symbols/package.json create mode 100644 node_modules/async-each/.npmignore create mode 100644 node_modules/async-each/CHANGELOG.md create mode 100644 node_modules/async-each/README.md create mode 100644 node_modules/async-each/index.js create mode 100644 node_modules/async-each/package.json create mode 100644 node_modules/async/CHANGELOG.md create mode 100644 node_modules/async/LICENSE create mode 100644 node_modules/async/README.md create mode 100644 node_modules/async/apply.js create mode 100644 node_modules/async/applyEach.js create mode 100644 node_modules/async/applyEachSeries.js create mode 100644 node_modules/async/asyncify.js create mode 100644 node_modules/async/auto.js create mode 100644 node_modules/async/autoInject.js create mode 100644 node_modules/async/bower.json create mode 100644 node_modules/async/cargo.js create mode 100644 node_modules/async/compose.js create mode 100644 node_modules/async/concat.js create mode 100644 node_modules/async/concatSeries.js create mode 100644 node_modules/async/constant.js create mode 100644 node_modules/async/detect.js create mode 100644 node_modules/async/detectLimit.js create mode 100644 node_modules/async/detectSeries.js create mode 100644 node_modules/async/dir.js create mode 100644 node_modules/async/dist/async.js create mode 100644 node_modules/async/dist/async.min.js create mode 100644 node_modules/async/doDuring.js create mode 100644 node_modules/async/doUntil.js create mode 100644 node_modules/async/doWhilst.js create mode 100644 node_modules/async/during.js create mode 100644 node_modules/async/each.js create mode 100644 node_modules/async/eachLimit.js create mode 100644 node_modules/async/eachOf.js create mode 100644 node_modules/async/eachOfLimit.js create mode 100644 node_modules/async/eachOfSeries.js create mode 100644 node_modules/async/eachSeries.js create mode 100644 node_modules/async/ensureAsync.js create mode 100644 node_modules/async/every.js create mode 100644 node_modules/async/everyLimit.js create mode 100644 node_modules/async/everySeries.js create mode 100644 node_modules/async/filter.js create mode 100644 node_modules/async/filterLimit.js create mode 100644 node_modules/async/filterSeries.js create mode 100644 node_modules/async/forever.js create mode 100644 node_modules/async/index.js create mode 100644 node_modules/async/internal/DoublyLinkedList.js create mode 100644 node_modules/async/internal/applyEach.js create mode 100644 node_modules/async/internal/breakLoop.js create mode 100644 node_modules/async/internal/concat.js create mode 100644 node_modules/async/internal/consoleFunc.js create mode 100644 node_modules/async/internal/createTester.js create mode 100644 node_modules/async/internal/doLimit.js create mode 100644 node_modules/async/internal/doParallel.js create mode 100644 node_modules/async/internal/doParallelLimit.js create mode 100644 node_modules/async/internal/doSeries.js create mode 100644 node_modules/async/internal/eachOfLimit.js create mode 100644 node_modules/async/internal/filter.js create mode 100644 node_modules/async/internal/findGetResult.js create mode 100644 node_modules/async/internal/getIterator.js create mode 100644 node_modules/async/internal/initialParams.js create mode 100644 node_modules/async/internal/iterator.js create mode 100644 node_modules/async/internal/map.js create mode 100644 node_modules/async/internal/notId.js create mode 100644 node_modules/async/internal/once.js create mode 100644 node_modules/async/internal/onlyOnce.js create mode 100644 node_modules/async/internal/parallel.js create mode 100644 node_modules/async/internal/queue.js create mode 100644 node_modules/async/internal/reject.js create mode 100644 node_modules/async/internal/rest.js create mode 100644 node_modules/async/internal/setImmediate.js create mode 100644 node_modules/async/internal/withoutIndex.js create mode 100644 node_modules/async/log.js create mode 100644 node_modules/async/map.js create mode 100644 node_modules/async/mapLimit.js create mode 100644 node_modules/async/mapSeries.js create mode 100644 node_modules/async/mapValues.js create mode 100644 node_modules/async/mapValuesLimit.js create mode 100644 node_modules/async/mapValuesSeries.js create mode 100644 node_modules/async/memoize.js create mode 100644 node_modules/async/nextTick.js create mode 100644 node_modules/async/package.json create mode 100644 node_modules/async/parallel.js create mode 100644 node_modules/async/parallelLimit.js create mode 100644 node_modules/async/priorityQueue.js create mode 100644 node_modules/async/queue.js create mode 100644 node_modules/async/race.js create mode 100644 node_modules/async/reduce.js create mode 100644 node_modules/async/reduceRight.js create mode 100644 node_modules/async/reflect.js create mode 100644 node_modules/async/reflectAll.js create mode 100644 node_modules/async/reject.js create mode 100644 node_modules/async/rejectLimit.js create mode 100644 node_modules/async/rejectSeries.js create mode 100644 node_modules/async/retry.js create mode 100644 node_modules/async/retryable.js create mode 100644 node_modules/async/seq.js create mode 100644 node_modules/async/series.js create mode 100644 node_modules/async/setImmediate.js create mode 100644 node_modules/async/some.js create mode 100644 node_modules/async/someLimit.js create mode 100644 node_modules/async/someSeries.js create mode 100644 node_modules/async/sortBy.js create mode 100644 node_modules/async/timeout.js create mode 100644 node_modules/async/times.js create mode 100644 node_modules/async/timesLimit.js create mode 100644 node_modules/async/timesSeries.js create mode 100644 node_modules/async/transform.js create mode 100644 node_modules/async/unmemoize.js create mode 100644 node_modules/async/until.js create mode 100644 node_modules/async/waterfall.js create mode 100644 node_modules/async/whilst.js create mode 100644 node_modules/atob/LICENSE create mode 100644 node_modules/atob/LICENSE.DOCS create mode 100644 node_modules/atob/README.md create mode 100755 node_modules/atob/bin/atob.js create mode 100644 node_modules/atob/bower.json create mode 100644 node_modules/atob/browser-atob.js create mode 100644 node_modules/atob/node-atob.js create mode 100644 node_modules/atob/package.json create mode 100644 node_modules/atob/test.js create mode 100644 node_modules/babel-runtime/.npmignore create mode 100644 node_modules/babel-runtime/README.md create mode 100644 node_modules/babel-runtime/core-js.js create mode 100644 node_modules/babel-runtime/core-js/array/concat.js create mode 100644 node_modules/babel-runtime/core-js/array/copy-within.js create mode 100644 node_modules/babel-runtime/core-js/array/entries.js create mode 100644 node_modules/babel-runtime/core-js/array/every.js create mode 100644 node_modules/babel-runtime/core-js/array/fill.js create mode 100644 node_modules/babel-runtime/core-js/array/filter.js create mode 100644 node_modules/babel-runtime/core-js/array/find-index.js create mode 100644 node_modules/babel-runtime/core-js/array/find.js create mode 100644 node_modules/babel-runtime/core-js/array/for-each.js create mode 100644 node_modules/babel-runtime/core-js/array/from.js create mode 100644 node_modules/babel-runtime/core-js/array/includes.js create mode 100644 node_modules/babel-runtime/core-js/array/index-of.js create mode 100644 node_modules/babel-runtime/core-js/array/join.js create mode 100644 node_modules/babel-runtime/core-js/array/keys.js create mode 100644 node_modules/babel-runtime/core-js/array/last-index-of.js create mode 100644 node_modules/babel-runtime/core-js/array/map.js create mode 100644 node_modules/babel-runtime/core-js/array/of.js create mode 100644 node_modules/babel-runtime/core-js/array/pop.js create mode 100644 node_modules/babel-runtime/core-js/array/push.js create mode 100644 node_modules/babel-runtime/core-js/array/reduce-right.js create mode 100644 node_modules/babel-runtime/core-js/array/reduce.js create mode 100644 node_modules/babel-runtime/core-js/array/reverse.js create mode 100644 node_modules/babel-runtime/core-js/array/shift.js create mode 100644 node_modules/babel-runtime/core-js/array/slice.js create mode 100644 node_modules/babel-runtime/core-js/array/some.js create mode 100644 node_modules/babel-runtime/core-js/array/sort.js create mode 100644 node_modules/babel-runtime/core-js/array/splice.js create mode 100644 node_modules/babel-runtime/core-js/array/unshift.js create mode 100644 node_modules/babel-runtime/core-js/array/values.js create mode 100644 node_modules/babel-runtime/core-js/asap.js create mode 100644 node_modules/babel-runtime/core-js/clear-immediate.js create mode 100644 node_modules/babel-runtime/core-js/error/is-error.js create mode 100644 node_modules/babel-runtime/core-js/get-iterator.js create mode 100644 node_modules/babel-runtime/core-js/is-iterable.js create mode 100644 node_modules/babel-runtime/core-js/json/stringify.js create mode 100644 node_modules/babel-runtime/core-js/map.js create mode 100644 node_modules/babel-runtime/core-js/math/acosh.js create mode 100644 node_modules/babel-runtime/core-js/math/asinh.js create mode 100644 node_modules/babel-runtime/core-js/math/atanh.js create mode 100644 node_modules/babel-runtime/core-js/math/cbrt.js create mode 100644 node_modules/babel-runtime/core-js/math/clz32.js create mode 100644 node_modules/babel-runtime/core-js/math/cosh.js create mode 100644 node_modules/babel-runtime/core-js/math/expm1.js create mode 100644 node_modules/babel-runtime/core-js/math/fround.js create mode 100644 node_modules/babel-runtime/core-js/math/hypot.js create mode 100644 node_modules/babel-runtime/core-js/math/iaddh.js create mode 100644 node_modules/babel-runtime/core-js/math/imul.js create mode 100644 node_modules/babel-runtime/core-js/math/imulh.js create mode 100644 node_modules/babel-runtime/core-js/math/isubh.js create mode 100644 node_modules/babel-runtime/core-js/math/log10.js create mode 100644 node_modules/babel-runtime/core-js/math/log1p.js create mode 100644 node_modules/babel-runtime/core-js/math/log2.js create mode 100644 node_modules/babel-runtime/core-js/math/sign.js create mode 100644 node_modules/babel-runtime/core-js/math/sinh.js create mode 100644 node_modules/babel-runtime/core-js/math/tanh.js create mode 100644 node_modules/babel-runtime/core-js/math/trunc.js create mode 100644 node_modules/babel-runtime/core-js/math/umulh.js create mode 100644 node_modules/babel-runtime/core-js/number/epsilon.js create mode 100644 node_modules/babel-runtime/core-js/number/is-finite.js create mode 100644 node_modules/babel-runtime/core-js/number/is-integer.js create mode 100644 node_modules/babel-runtime/core-js/number/is-nan.js create mode 100644 node_modules/babel-runtime/core-js/number/is-safe-integer.js create mode 100644 node_modules/babel-runtime/core-js/number/max-safe-integer.js create mode 100644 node_modules/babel-runtime/core-js/number/min-safe-integer.js create mode 100644 node_modules/babel-runtime/core-js/number/parse-float.js create mode 100644 node_modules/babel-runtime/core-js/number/parse-int.js create mode 100644 node_modules/babel-runtime/core-js/object/assign.js create mode 100644 node_modules/babel-runtime/core-js/object/create.js create mode 100644 node_modules/babel-runtime/core-js/object/define-properties.js create mode 100644 node_modules/babel-runtime/core-js/object/define-property.js create mode 100644 node_modules/babel-runtime/core-js/object/entries.js create mode 100644 node_modules/babel-runtime/core-js/object/freeze.js create mode 100644 node_modules/babel-runtime/core-js/object/get-own-property-descriptor.js create mode 100644 node_modules/babel-runtime/core-js/object/get-own-property-descriptors.js create mode 100644 node_modules/babel-runtime/core-js/object/get-own-property-names.js create mode 100644 node_modules/babel-runtime/core-js/object/get-own-property-symbols.js create mode 100644 node_modules/babel-runtime/core-js/object/get-prototype-of.js create mode 100644 node_modules/babel-runtime/core-js/object/is-extensible.js create mode 100644 node_modules/babel-runtime/core-js/object/is-frozen.js create mode 100644 node_modules/babel-runtime/core-js/object/is-sealed.js create mode 100644 node_modules/babel-runtime/core-js/object/is.js create mode 100644 node_modules/babel-runtime/core-js/object/keys.js create mode 100644 node_modules/babel-runtime/core-js/object/prevent-extensions.js create mode 100644 node_modules/babel-runtime/core-js/object/seal.js create mode 100644 node_modules/babel-runtime/core-js/object/set-prototype-of.js create mode 100644 node_modules/babel-runtime/core-js/object/values.js create mode 100644 node_modules/babel-runtime/core-js/observable.js create mode 100644 node_modules/babel-runtime/core-js/promise.js create mode 100644 node_modules/babel-runtime/core-js/reflect/apply.js create mode 100644 node_modules/babel-runtime/core-js/reflect/construct.js create mode 100644 node_modules/babel-runtime/core-js/reflect/define-metadata.js create mode 100644 node_modules/babel-runtime/core-js/reflect/define-property.js create mode 100644 node_modules/babel-runtime/core-js/reflect/delete-metadata.js create mode 100644 node_modules/babel-runtime/core-js/reflect/delete-property.js create mode 100644 node_modules/babel-runtime/core-js/reflect/enumerate.js create mode 100644 node_modules/babel-runtime/core-js/reflect/get-metadata-keys.js create mode 100644 node_modules/babel-runtime/core-js/reflect/get-metadata.js create mode 100644 node_modules/babel-runtime/core-js/reflect/get-own-metadata-keys.js create mode 100644 node_modules/babel-runtime/core-js/reflect/get-own-metadata.js create mode 100644 node_modules/babel-runtime/core-js/reflect/get-own-property-descriptor.js create mode 100644 node_modules/babel-runtime/core-js/reflect/get-prototype-of.js create mode 100644 node_modules/babel-runtime/core-js/reflect/get.js create mode 100644 node_modules/babel-runtime/core-js/reflect/has-metadata.js create mode 100644 node_modules/babel-runtime/core-js/reflect/has-own-metadata.js create mode 100644 node_modules/babel-runtime/core-js/reflect/has.js create mode 100644 node_modules/babel-runtime/core-js/reflect/is-extensible.js create mode 100644 node_modules/babel-runtime/core-js/reflect/metadata.js create mode 100644 node_modules/babel-runtime/core-js/reflect/own-keys.js create mode 100644 node_modules/babel-runtime/core-js/reflect/prevent-extensions.js create mode 100644 node_modules/babel-runtime/core-js/reflect/set-prototype-of.js create mode 100644 node_modules/babel-runtime/core-js/reflect/set.js create mode 100644 node_modules/babel-runtime/core-js/regexp/escape.js create mode 100644 node_modules/babel-runtime/core-js/set-immediate.js create mode 100644 node_modules/babel-runtime/core-js/set.js create mode 100644 node_modules/babel-runtime/core-js/string/at.js create mode 100644 node_modules/babel-runtime/core-js/string/code-point-at.js create mode 100644 node_modules/babel-runtime/core-js/string/ends-with.js create mode 100644 node_modules/babel-runtime/core-js/string/from-code-point.js create mode 100644 node_modules/babel-runtime/core-js/string/includes.js create mode 100644 node_modules/babel-runtime/core-js/string/match-all.js create mode 100644 node_modules/babel-runtime/core-js/string/pad-end.js create mode 100644 node_modules/babel-runtime/core-js/string/pad-left.js create mode 100644 node_modules/babel-runtime/core-js/string/pad-right.js create mode 100644 node_modules/babel-runtime/core-js/string/pad-start.js create mode 100644 node_modules/babel-runtime/core-js/string/raw.js create mode 100644 node_modules/babel-runtime/core-js/string/repeat.js create mode 100644 node_modules/babel-runtime/core-js/string/starts-with.js create mode 100644 node_modules/babel-runtime/core-js/string/trim-end.js create mode 100644 node_modules/babel-runtime/core-js/string/trim-left.js create mode 100644 node_modules/babel-runtime/core-js/string/trim-right.js create mode 100644 node_modules/babel-runtime/core-js/string/trim-start.js create mode 100644 node_modules/babel-runtime/core-js/string/trim.js create mode 100644 node_modules/babel-runtime/core-js/symbol.js create mode 100644 node_modules/babel-runtime/core-js/symbol/async-iterator.js create mode 100644 node_modules/babel-runtime/core-js/symbol/for.js create mode 100644 node_modules/babel-runtime/core-js/symbol/has-instance.js create mode 100644 node_modules/babel-runtime/core-js/symbol/is-concat-spreadable.js create mode 100644 node_modules/babel-runtime/core-js/symbol/iterator.js create mode 100644 node_modules/babel-runtime/core-js/symbol/key-for.js create mode 100644 node_modules/babel-runtime/core-js/symbol/match.js create mode 100644 node_modules/babel-runtime/core-js/symbol/observable.js create mode 100644 node_modules/babel-runtime/core-js/symbol/replace.js create mode 100644 node_modules/babel-runtime/core-js/symbol/search.js create mode 100644 node_modules/babel-runtime/core-js/symbol/species.js create mode 100644 node_modules/babel-runtime/core-js/symbol/split.js create mode 100644 node_modules/babel-runtime/core-js/symbol/to-primitive.js create mode 100644 node_modules/babel-runtime/core-js/symbol/to-string-tag.js create mode 100644 node_modules/babel-runtime/core-js/symbol/unscopables.js create mode 100644 node_modules/babel-runtime/core-js/system/global.js create mode 100644 node_modules/babel-runtime/core-js/weak-map.js create mode 100644 node_modules/babel-runtime/core-js/weak-set.js create mode 100644 node_modules/babel-runtime/helpers/_async-generator-delegate.js create mode 100644 node_modules/babel-runtime/helpers/_async-generator.js create mode 100644 node_modules/babel-runtime/helpers/_async-iterator.js create mode 100644 node_modules/babel-runtime/helpers/_async-to-generator.js create mode 100644 node_modules/babel-runtime/helpers/_class-call-check.js create mode 100644 node_modules/babel-runtime/helpers/_create-class.js create mode 100644 node_modules/babel-runtime/helpers/_defaults.js create mode 100644 node_modules/babel-runtime/helpers/_define-enumerable-properties.js create mode 100644 node_modules/babel-runtime/helpers/_define-property.js create mode 100644 node_modules/babel-runtime/helpers/_extends.js create mode 100644 node_modules/babel-runtime/helpers/_get.js create mode 100644 node_modules/babel-runtime/helpers/_inherits.js create mode 100644 node_modules/babel-runtime/helpers/_instanceof.js create mode 100644 node_modules/babel-runtime/helpers/_interop-require-default.js create mode 100644 node_modules/babel-runtime/helpers/_interop-require-wildcard.js create mode 100644 node_modules/babel-runtime/helpers/_jsx.js create mode 100644 node_modules/babel-runtime/helpers/_new-arrow-check.js create mode 100644 node_modules/babel-runtime/helpers/_object-destructuring-empty.js create mode 100644 node_modules/babel-runtime/helpers/_object-without-properties.js create mode 100644 node_modules/babel-runtime/helpers/_possible-constructor-return.js create mode 100644 node_modules/babel-runtime/helpers/_self-global.js create mode 100644 node_modules/babel-runtime/helpers/_set.js create mode 100644 node_modules/babel-runtime/helpers/_sliced-to-array-loose.js create mode 100644 node_modules/babel-runtime/helpers/_sliced-to-array.js create mode 100644 node_modules/babel-runtime/helpers/_tagged-template-literal-loose.js create mode 100644 node_modules/babel-runtime/helpers/_tagged-template-literal.js create mode 100644 node_modules/babel-runtime/helpers/_temporal-ref.js create mode 100644 node_modules/babel-runtime/helpers/_temporal-undefined.js create mode 100644 node_modules/babel-runtime/helpers/_to-array.js create mode 100644 node_modules/babel-runtime/helpers/_to-consumable-array.js create mode 100644 node_modules/babel-runtime/helpers/_typeof.js create mode 100644 node_modules/babel-runtime/helpers/async-generator-delegate.js create mode 100644 node_modules/babel-runtime/helpers/async-generator.js create mode 100644 node_modules/babel-runtime/helpers/async-iterator.js create mode 100644 node_modules/babel-runtime/helpers/async-to-generator.js create mode 100644 node_modules/babel-runtime/helpers/asyncGenerator.js create mode 100644 node_modules/babel-runtime/helpers/asyncGeneratorDelegate.js create mode 100644 node_modules/babel-runtime/helpers/asyncIterator.js create mode 100644 node_modules/babel-runtime/helpers/asyncToGenerator.js create mode 100644 node_modules/babel-runtime/helpers/class-call-check.js create mode 100644 node_modules/babel-runtime/helpers/classCallCheck.js create mode 100644 node_modules/babel-runtime/helpers/create-class.js create mode 100644 node_modules/babel-runtime/helpers/createClass.js create mode 100644 node_modules/babel-runtime/helpers/defaults.js create mode 100644 node_modules/babel-runtime/helpers/define-enumerable-properties.js create mode 100644 node_modules/babel-runtime/helpers/define-property.js create mode 100644 node_modules/babel-runtime/helpers/defineEnumerableProperties.js create mode 100644 node_modules/babel-runtime/helpers/defineProperty.js create mode 100644 node_modules/babel-runtime/helpers/extends.js create mode 100644 node_modules/babel-runtime/helpers/get.js create mode 100644 node_modules/babel-runtime/helpers/inherits.js create mode 100644 node_modules/babel-runtime/helpers/instanceof.js create mode 100644 node_modules/babel-runtime/helpers/interop-require-default.js create mode 100644 node_modules/babel-runtime/helpers/interop-require-wildcard.js create mode 100644 node_modules/babel-runtime/helpers/interopRequireDefault.js create mode 100644 node_modules/babel-runtime/helpers/interopRequireWildcard.js create mode 100644 node_modules/babel-runtime/helpers/jsx.js create mode 100644 node_modules/babel-runtime/helpers/new-arrow-check.js create mode 100644 node_modules/babel-runtime/helpers/newArrowCheck.js create mode 100644 node_modules/babel-runtime/helpers/object-destructuring-empty.js create mode 100644 node_modules/babel-runtime/helpers/object-without-properties.js create mode 100644 node_modules/babel-runtime/helpers/objectDestructuringEmpty.js create mode 100644 node_modules/babel-runtime/helpers/objectWithoutProperties.js create mode 100644 node_modules/babel-runtime/helpers/possible-constructor-return.js create mode 100644 node_modules/babel-runtime/helpers/possibleConstructorReturn.js create mode 100644 node_modules/babel-runtime/helpers/self-global.js create mode 100644 node_modules/babel-runtime/helpers/selfGlobal.js create mode 100644 node_modules/babel-runtime/helpers/set.js create mode 100644 node_modules/babel-runtime/helpers/sliced-to-array-loose.js create mode 100644 node_modules/babel-runtime/helpers/sliced-to-array.js create mode 100644 node_modules/babel-runtime/helpers/slicedToArray.js create mode 100644 node_modules/babel-runtime/helpers/slicedToArrayLoose.js create mode 100644 node_modules/babel-runtime/helpers/tagged-template-literal-loose.js create mode 100644 node_modules/babel-runtime/helpers/tagged-template-literal.js create mode 100644 node_modules/babel-runtime/helpers/taggedTemplateLiteral.js create mode 100644 node_modules/babel-runtime/helpers/taggedTemplateLiteralLoose.js create mode 100644 node_modules/babel-runtime/helpers/temporal-ref.js create mode 100644 node_modules/babel-runtime/helpers/temporal-undefined.js create mode 100644 node_modules/babel-runtime/helpers/temporalRef.js create mode 100644 node_modules/babel-runtime/helpers/temporalUndefined.js create mode 100644 node_modules/babel-runtime/helpers/to-array.js create mode 100644 node_modules/babel-runtime/helpers/to-consumable-array.js create mode 100644 node_modules/babel-runtime/helpers/toArray.js create mode 100644 node_modules/babel-runtime/helpers/toConsumableArray.js create mode 100644 node_modules/babel-runtime/helpers/typeof.js create mode 100644 node_modules/babel-runtime/package-lock.json create mode 100644 node_modules/babel-runtime/package.json create mode 100644 node_modules/babel-runtime/regenerator/index.js create mode 100644 node_modules/babel-types/.npmignore create mode 100644 node_modules/babel-types/README.md create mode 100644 node_modules/babel-types/lib/constants.js create mode 100644 node_modules/babel-types/lib/converters.js create mode 100644 node_modules/babel-types/lib/definitions/core.js create mode 100644 node_modules/babel-types/lib/definitions/es2015.js create mode 100644 node_modules/babel-types/lib/definitions/experimental.js create mode 100644 node_modules/babel-types/lib/definitions/flow.js create mode 100644 node_modules/babel-types/lib/definitions/index.js create mode 100644 node_modules/babel-types/lib/definitions/init.js create mode 100644 node_modules/babel-types/lib/definitions/jsx.js create mode 100644 node_modules/babel-types/lib/definitions/misc.js create mode 100644 node_modules/babel-types/lib/flow.js create mode 100644 node_modules/babel-types/lib/index.js create mode 100644 node_modules/babel-types/lib/react.js create mode 100644 node_modules/babel-types/lib/retrievers.js create mode 100644 node_modules/babel-types/lib/validators.js create mode 100644 node_modules/babel-types/package-lock.json create mode 100644 node_modules/babel-types/package.json create mode 100644 node_modules/babylon/CHANGELOG.md create mode 100644 node_modules/babylon/LICENSE create mode 100644 node_modules/babylon/README.md create mode 100755 node_modules/babylon/bin/babylon.js create mode 100644 node_modules/babylon/bin/generate-identifier-regex.js create mode 100644 node_modules/babylon/lib/index.js create mode 100644 node_modules/babylon/package.json create mode 100644 node_modules/balanced-match/.npmignore create mode 100644 node_modules/balanced-match/LICENSE.md create mode 100644 node_modules/balanced-match/README.md create mode 100644 node_modules/balanced-match/index.js create mode 100644 node_modules/balanced-match/package.json create mode 100644 node_modules/base/LICENSE create mode 100644 node_modules/base/README.md create mode 100644 node_modules/base/index.js create mode 100644 node_modules/base/node_modules/define-property/LICENSE create mode 100644 node_modules/base/node_modules/define-property/README.md create mode 100644 node_modules/base/node_modules/define-property/index.js create mode 100644 node_modules/base/node_modules/define-property/package.json create mode 100644 node_modules/base/package.json create mode 100644 node_modules/basic-auth/HISTORY.md create mode 100644 node_modules/basic-auth/LICENSE create mode 100644 node_modules/basic-auth/README.md create mode 100644 node_modules/basic-auth/index.js create mode 100644 node_modules/basic-auth/package.json create mode 100644 node_modules/binary-extensions/binary-extensions.json create mode 100644 node_modules/binary-extensions/license create mode 100644 node_modules/binary-extensions/package.json create mode 100644 node_modules/binary-extensions/readme.md create mode 100644 node_modules/bluebird/LICENSE create mode 100644 node_modules/bluebird/README.md create mode 100644 node_modules/bluebird/changelog.md create mode 100644 node_modules/bluebird/js/browser/bluebird.core.js create mode 100644 node_modules/bluebird/js/browser/bluebird.core.min.js create mode 100644 node_modules/bluebird/js/browser/bluebird.js create mode 100644 node_modules/bluebird/js/browser/bluebird.min.js create mode 100644 node_modules/bluebird/js/release/any.js create mode 100644 node_modules/bluebird/js/release/assert.js create mode 100644 node_modules/bluebird/js/release/async.js create mode 100644 node_modules/bluebird/js/release/bind.js create mode 100644 node_modules/bluebird/js/release/bluebird.js create mode 100644 node_modules/bluebird/js/release/call_get.js create mode 100644 node_modules/bluebird/js/release/cancel.js create mode 100644 node_modules/bluebird/js/release/catch_filter.js create mode 100644 node_modules/bluebird/js/release/context.js create mode 100644 node_modules/bluebird/js/release/debuggability.js create mode 100644 node_modules/bluebird/js/release/direct_resolve.js create mode 100644 node_modules/bluebird/js/release/each.js create mode 100644 node_modules/bluebird/js/release/errors.js create mode 100644 node_modules/bluebird/js/release/es5.js create mode 100644 node_modules/bluebird/js/release/filter.js create mode 100644 node_modules/bluebird/js/release/finally.js create mode 100644 node_modules/bluebird/js/release/generators.js create mode 100644 node_modules/bluebird/js/release/join.js create mode 100644 node_modules/bluebird/js/release/map.js create mode 100644 node_modules/bluebird/js/release/method.js create mode 100644 node_modules/bluebird/js/release/nodeback.js create mode 100644 node_modules/bluebird/js/release/nodeify.js create mode 100644 node_modules/bluebird/js/release/promise.js create mode 100644 node_modules/bluebird/js/release/promise_array.js create mode 100644 node_modules/bluebird/js/release/promisify.js create mode 100644 node_modules/bluebird/js/release/props.js create mode 100644 node_modules/bluebird/js/release/queue.js create mode 100644 node_modules/bluebird/js/release/race.js create mode 100644 node_modules/bluebird/js/release/reduce.js create mode 100644 node_modules/bluebird/js/release/schedule.js create mode 100644 node_modules/bluebird/js/release/settle.js create mode 100644 node_modules/bluebird/js/release/some.js create mode 100644 node_modules/bluebird/js/release/synchronous_inspection.js create mode 100644 node_modules/bluebird/js/release/thenables.js create mode 100644 node_modules/bluebird/js/release/timers.js create mode 100644 node_modules/bluebird/js/release/using.js create mode 100644 node_modules/bluebird/js/release/util.js create mode 100644 node_modules/bluebird/package.json create mode 100644 node_modules/body-parser/HISTORY.md create mode 100644 node_modules/body-parser/LICENSE create mode 100644 node_modules/body-parser/README.md create mode 100644 node_modules/body-parser/index.js create mode 100644 node_modules/body-parser/lib/read.js create mode 100644 node_modules/body-parser/lib/types/json.js create mode 100644 node_modules/body-parser/lib/types/raw.js create mode 100644 node_modules/body-parser/lib/types/text.js create mode 100644 node_modules/body-parser/lib/types/urlencoded.js create mode 100644 node_modules/body-parser/package.json create mode 100644 node_modules/boxen/index.js create mode 100644 node_modules/boxen/license create mode 100644 node_modules/boxen/node_modules/camelcase/index.js create mode 100644 node_modules/boxen/node_modules/camelcase/license create mode 100644 node_modules/boxen/node_modules/camelcase/package.json create mode 100644 node_modules/boxen/node_modules/camelcase/readme.md create mode 100644 node_modules/boxen/package.json create mode 100644 node_modules/boxen/readme.md create mode 100644 node_modules/brace-expansion/LICENSE create mode 100644 node_modules/brace-expansion/README.md create mode 100644 node_modules/brace-expansion/index.js create mode 100644 node_modules/brace-expansion/package.json create mode 100644 node_modules/braces/LICENSE create mode 100644 node_modules/braces/README.md create mode 100644 node_modules/braces/index.js create mode 100644 node_modules/braces/lib/braces.js create mode 100644 node_modules/braces/lib/compilers.js create mode 100644 node_modules/braces/lib/parsers-new.js create mode 100644 node_modules/braces/lib/parsers-orig.js create mode 100644 node_modules/braces/lib/parsers-parens.js create mode 100644 node_modules/braces/lib/parsers.js create mode 100644 node_modules/braces/lib/utils.js create mode 100644 node_modules/braces/node_modules/define-property/LICENSE create mode 100644 node_modules/braces/node_modules/define-property/README.md create mode 100644 node_modules/braces/node_modules/define-property/index.js create mode 100644 node_modules/braces/node_modules/define-property/package.json create mode 100644 node_modules/braces/node_modules/extend-shallow/LICENSE create mode 100644 node_modules/braces/node_modules/extend-shallow/README.md create mode 100644 node_modules/braces/node_modules/extend-shallow/index.js create mode 100644 node_modules/braces/node_modules/extend-shallow/package.json create mode 100644 node_modules/braces/node_modules/kind-of/CHANGELOG.md create mode 100644 node_modules/braces/node_modules/kind-of/LICENSE create mode 100644 node_modules/braces/node_modules/kind-of/README.md create mode 100644 node_modules/braces/node_modules/kind-of/index.js create mode 100644 node_modules/braces/node_modules/kind-of/package.json create mode 100644 node_modules/braces/package.json create mode 100644 node_modules/bson/HISTORY.md create mode 100644 node_modules/bson/LICENSE.md create mode 100644 node_modules/bson/README.md create mode 100644 node_modules/bson/bower.json create mode 100644 node_modules/bson/browser_build/bson.js create mode 100644 node_modules/bson/browser_build/package.json create mode 100644 node_modules/bson/index.js create mode 100644 node_modules/bson/lib/bson/binary.js create mode 100644 node_modules/bson/lib/bson/bson.js create mode 100644 node_modules/bson/lib/bson/code.js create mode 100644 node_modules/bson/lib/bson/db_ref.js create mode 100644 node_modules/bson/lib/bson/decimal128.js create mode 100644 node_modules/bson/lib/bson/double.js create mode 100644 node_modules/bson/lib/bson/float_parser.js create mode 100644 node_modules/bson/lib/bson/int_32.js create mode 100644 node_modules/bson/lib/bson/long.js create mode 100644 node_modules/bson/lib/bson/map.js create mode 100644 node_modules/bson/lib/bson/max_key.js create mode 100644 node_modules/bson/lib/bson/min_key.js create mode 100644 node_modules/bson/lib/bson/objectid.js create mode 100644 node_modules/bson/lib/bson/parser/calculate_size.js create mode 100644 node_modules/bson/lib/bson/parser/deserializer.js create mode 100644 node_modules/bson/lib/bson/parser/serializer.js create mode 100644 node_modules/bson/lib/bson/regexp.js create mode 100644 node_modules/bson/lib/bson/symbol.js create mode 100644 node_modules/bson/lib/bson/timestamp.js create mode 100644 node_modules/bson/package.json create mode 100644 node_modules/bytes/History.md create mode 100644 node_modules/bytes/LICENSE create mode 100644 node_modules/bytes/Readme.md create mode 100644 node_modules/bytes/index.js create mode 100644 node_modules/bytes/package.json create mode 100644 node_modules/cache-base/LICENSE create mode 100644 node_modules/cache-base/README.md create mode 100644 node_modules/cache-base/index.js create mode 100644 node_modules/cache-base/package.json create mode 100644 node_modules/camelcase/index.js create mode 100644 node_modules/camelcase/license create mode 100644 node_modules/camelcase/package.json create mode 100644 node_modules/camelcase/readme.md create mode 100644 node_modules/capture-stack-trace/index.js create mode 100644 node_modules/capture-stack-trace/package.json create mode 100644 node_modules/capture-stack-trace/readme.md create mode 100644 node_modules/center-align/LICENSE create mode 100644 node_modules/center-align/README.md create mode 100644 node_modules/center-align/index.js create mode 100644 node_modules/center-align/package.json create mode 100644 node_modules/center-align/utils.js create mode 100644 node_modules/chalk/index.js create mode 100644 node_modules/chalk/license create mode 100644 node_modules/chalk/package.json create mode 100644 node_modules/chalk/readme.md create mode 100644 node_modules/chalk/templates.js create mode 100644 node_modules/chalk/types/index.d.ts create mode 100644 node_modules/character-parser/.npmignore create mode 100644 node_modules/character-parser/LICENSE create mode 100644 node_modules/character-parser/README.md create mode 100644 node_modules/character-parser/index.js create mode 100644 node_modules/character-parser/package.json create mode 100644 node_modules/chokidar/CHANGELOG.md create mode 100644 node_modules/chokidar/README.md create mode 100644 node_modules/chokidar/index.js create mode 100644 node_modules/chokidar/lib/fsevents-handler.js create mode 100644 node_modules/chokidar/lib/nodefs-handler.js create mode 100644 node_modules/chokidar/package.json create mode 100644 node_modules/class-utils/LICENSE create mode 100644 node_modules/class-utils/README.md create mode 100644 node_modules/class-utils/index.js create mode 100644 node_modules/class-utils/node_modules/define-property/LICENSE create mode 100644 node_modules/class-utils/node_modules/define-property/README.md create mode 100644 node_modules/class-utils/node_modules/define-property/index.js create mode 100644 node_modules/class-utils/node_modules/define-property/package.json create mode 100644 node_modules/class-utils/node_modules/is-accessor-descriptor/LICENSE create mode 100644 node_modules/class-utils/node_modules/is-accessor-descriptor/README.md create mode 100644 node_modules/class-utils/node_modules/is-accessor-descriptor/index.js create mode 100644 node_modules/class-utils/node_modules/is-accessor-descriptor/node_modules/kind-of/LICENSE create mode 100644 node_modules/class-utils/node_modules/is-accessor-descriptor/node_modules/kind-of/README.md create mode 100644 node_modules/class-utils/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js create mode 100644 node_modules/class-utils/node_modules/is-accessor-descriptor/node_modules/kind-of/package.json create mode 100644 node_modules/class-utils/node_modules/is-accessor-descriptor/package.json create mode 100644 node_modules/class-utils/node_modules/is-data-descriptor/LICENSE create mode 100644 node_modules/class-utils/node_modules/is-data-descriptor/README.md create mode 100644 node_modules/class-utils/node_modules/is-data-descriptor/index.js create mode 100644 node_modules/class-utils/node_modules/is-data-descriptor/node_modules/kind-of/LICENSE create mode 100644 node_modules/class-utils/node_modules/is-data-descriptor/node_modules/kind-of/README.md create mode 100644 node_modules/class-utils/node_modules/is-data-descriptor/node_modules/kind-of/index.js create mode 100644 node_modules/class-utils/node_modules/is-data-descriptor/node_modules/kind-of/package.json create mode 100644 node_modules/class-utils/node_modules/is-data-descriptor/package.json create mode 100644 node_modules/class-utils/node_modules/is-descriptor/LICENSE create mode 100644 node_modules/class-utils/node_modules/is-descriptor/README.md create mode 100644 node_modules/class-utils/node_modules/is-descriptor/index.js create mode 100644 node_modules/class-utils/node_modules/is-descriptor/package.json create mode 100644 node_modules/class-utils/node_modules/kind-of/LICENSE create mode 100644 node_modules/class-utils/node_modules/kind-of/README.md create mode 100644 node_modules/class-utils/node_modules/kind-of/index.js create mode 100644 node_modules/class-utils/node_modules/kind-of/package.json create mode 100644 node_modules/class-utils/package.json create mode 100644 node_modules/clean-css/History.md create mode 100644 node_modules/clean-css/LICENSE create mode 100644 node_modules/clean-css/README.md create mode 100755 node_modules/clean-css/bin/cleancss create mode 100644 node_modules/clean-css/index.js create mode 100644 node_modules/clean-css/lib/clean.js create mode 100644 node_modules/clean-css/lib/colors/hex-name-shortener.js create mode 100644 node_modules/clean-css/lib/colors/hsl.js create mode 100644 node_modules/clean-css/lib/colors/rgb.js create mode 100644 node_modules/clean-css/lib/imports/inliner.js create mode 100644 node_modules/clean-css/lib/properties/break-up.js create mode 100644 node_modules/clean-css/lib/properties/can-override.js create mode 100644 node_modules/clean-css/lib/properties/clone.js create mode 100644 node_modules/clean-css/lib/properties/compactable.js create mode 100644 node_modules/clean-css/lib/properties/every-combination.js create mode 100644 node_modules/clean-css/lib/properties/has-inherit.js create mode 100644 node_modules/clean-css/lib/properties/invalid-property-error.js create mode 100644 node_modules/clean-css/lib/properties/optimizer.js create mode 100644 node_modules/clean-css/lib/properties/override-compactor.js create mode 100644 node_modules/clean-css/lib/properties/populate-components.js create mode 100644 node_modules/clean-css/lib/properties/remove-unused.js create mode 100644 node_modules/clean-css/lib/properties/restore-from-optimizing.js create mode 100644 node_modules/clean-css/lib/properties/restore.js create mode 100644 node_modules/clean-css/lib/properties/shorthand-compactor.js create mode 100644 node_modules/clean-css/lib/properties/validator.js create mode 100644 node_modules/clean-css/lib/properties/vendor-prefixes.js create mode 100644 node_modules/clean-css/lib/properties/wrap-for-optimizing.js create mode 100644 node_modules/clean-css/lib/selectors/advanced.js create mode 100644 node_modules/clean-css/lib/selectors/clean-up.js create mode 100644 node_modules/clean-css/lib/selectors/extractor.js create mode 100644 node_modules/clean-css/lib/selectors/is-special.js create mode 100644 node_modules/clean-css/lib/selectors/merge-adjacent.js create mode 100644 node_modules/clean-css/lib/selectors/merge-media-queries.js create mode 100644 node_modules/clean-css/lib/selectors/merge-non-adjacent-by-body.js create mode 100644 node_modules/clean-css/lib/selectors/merge-non-adjacent-by-selector.js create mode 100644 node_modules/clean-css/lib/selectors/reduce-non-adjacent.js create mode 100644 node_modules/clean-css/lib/selectors/remove-duplicate-media-queries.js create mode 100644 node_modules/clean-css/lib/selectors/remove-duplicates.js create mode 100644 node_modules/clean-css/lib/selectors/reorderable.js create mode 100644 node_modules/clean-css/lib/selectors/restructure.js create mode 100644 node_modules/clean-css/lib/selectors/simple.js create mode 100644 node_modules/clean-css/lib/source-maps/track.js create mode 100644 node_modules/clean-css/lib/stringifier/helpers.js create mode 100644 node_modules/clean-css/lib/stringifier/one-time.js create mode 100644 node_modules/clean-css/lib/stringifier/simple.js create mode 100644 node_modules/clean-css/lib/stringifier/source-maps.js create mode 100644 node_modules/clean-css/lib/text/comments-processor.js create mode 100644 node_modules/clean-css/lib/text/escape-store.js create mode 100644 node_modules/clean-css/lib/text/expressions-processor.js create mode 100644 node_modules/clean-css/lib/text/free-text-processor.js create mode 100644 node_modules/clean-css/lib/text/urls-processor.js create mode 100644 node_modules/clean-css/lib/tokenizer/extract-properties.js create mode 100644 node_modules/clean-css/lib/tokenizer/extract-selectors.js create mode 100644 node_modules/clean-css/lib/tokenizer/tokenize.js create mode 100644 node_modules/clean-css/lib/urls/rebase.js create mode 100644 node_modules/clean-css/lib/urls/reduce.js create mode 100644 node_modules/clean-css/lib/urls/rewrite.js create mode 100644 node_modules/clean-css/lib/utils/clone-array.js create mode 100644 node_modules/clean-css/lib/utils/compatibility.js create mode 100644 node_modules/clean-css/lib/utils/input-source-map-tracker.js create mode 100644 node_modules/clean-css/lib/utils/object.js create mode 100644 node_modules/clean-css/lib/utils/quote-scanner.js create mode 100644 node_modules/clean-css/lib/utils/source-reader.js create mode 100644 node_modules/clean-css/lib/utils/source-tracker.js create mode 100644 node_modules/clean-css/lib/utils/split.js create mode 100644 node_modules/clean-css/package.json create mode 100644 node_modules/cli-boxes/boxes.json create mode 100644 node_modules/cli-boxes/index.js create mode 100644 node_modules/cli-boxes/license create mode 100644 node_modules/cli-boxes/package.json create mode 100644 node_modules/cli-boxes/readme.md create mode 100644 node_modules/cliui/.coveralls.yml create mode 100644 node_modules/cliui/.npmignore create mode 100644 node_modules/cliui/.travis.yml create mode 100644 node_modules/cliui/LICENSE.txt create mode 100644 node_modules/cliui/README.md create mode 100644 node_modules/cliui/index.js create mode 100644 node_modules/cliui/package.json create mode 100644 node_modules/cliui/test/cliui.js create mode 100644 node_modules/collection-visit/LICENSE create mode 100644 node_modules/collection-visit/README.md create mode 100644 node_modules/collection-visit/index.js create mode 100644 node_modules/collection-visit/package.json create mode 100644 node_modules/color-convert/CHANGELOG.md create mode 100644 node_modules/color-convert/LICENSE create mode 100644 node_modules/color-convert/README.md create mode 100644 node_modules/color-convert/conversions.js create mode 100644 node_modules/color-convert/index.js create mode 100644 node_modules/color-convert/package.json create mode 100644 node_modules/color-convert/route.js create mode 100644 node_modules/color-name/.eslintrc.json create mode 100644 node_modules/color-name/.npmignore create mode 100644 node_modules/color-name/LICENSE create mode 100644 node_modules/color-name/README.md create mode 100644 node_modules/color-name/index.js create mode 100644 node_modules/color-name/package.json create mode 100644 node_modules/color-name/test.js create mode 100644 node_modules/commander/History.md create mode 100644 node_modules/commander/LICENSE create mode 100644 node_modules/commander/Readme.md create mode 100644 node_modules/commander/index.js create mode 100644 node_modules/commander/package.json create mode 100644 node_modules/component-emitter/History.md create mode 100644 node_modules/component-emitter/LICENSE create mode 100644 node_modules/component-emitter/Readme.md create mode 100644 node_modules/component-emitter/index.js create mode 100644 node_modules/component-emitter/package.json create mode 100644 node_modules/concat-map/.travis.yml create mode 100644 node_modules/concat-map/LICENSE create mode 100644 node_modules/concat-map/README.markdown create mode 100644 node_modules/concat-map/example/map.js create mode 100644 node_modules/concat-map/index.js create mode 100644 node_modules/concat-map/package.json create mode 100644 node_modules/concat-map/test/map.js create mode 100644 node_modules/configstore/index.js create mode 100644 node_modules/configstore/package.json create mode 100644 node_modules/configstore/readme.md create mode 100644 node_modules/constantinople/.gitattributes create mode 100644 node_modules/constantinople/.prettierrc create mode 100644 node_modules/constantinople/.travis.yml create mode 100644 node_modules/constantinople/LICENSE create mode 100644 node_modules/constantinople/README.md create mode 100644 node_modules/constantinople/lib/binaryOperation.d.ts create mode 100644 node_modules/constantinople/lib/binaryOperation.js create mode 100644 node_modules/constantinople/lib/index.d.ts create mode 100644 node_modules/constantinople/lib/index.js create mode 100644 node_modules/constantinople/package.json create mode 100644 node_modules/constantinople/src/binaryOperation.ts create mode 100644 node_modules/constantinople/src/index.ts create mode 100644 node_modules/constantinople/test/index.js create mode 100644 node_modules/constantinople/tsconfig.json create mode 100644 node_modules/content-disposition/HISTORY.md create mode 100644 node_modules/content-disposition/LICENSE create mode 100644 node_modules/content-disposition/README.md create mode 100644 node_modules/content-disposition/index.js create mode 100644 node_modules/content-disposition/package.json create mode 100644 node_modules/content-type/HISTORY.md create mode 100644 node_modules/content-type/LICENSE create mode 100644 node_modules/content-type/README.md create mode 100644 node_modules/content-type/index.js create mode 100644 node_modules/content-type/package.json create mode 100644 node_modules/cookie-parser/HISTORY.md create mode 100644 node_modules/cookie-parser/LICENSE create mode 100644 node_modules/cookie-parser/README.md create mode 100644 node_modules/cookie-parser/index.js create mode 100644 node_modules/cookie-parser/package.json create mode 100644 node_modules/cookie-signature/.npmignore create mode 100644 node_modules/cookie-signature/History.md create mode 100644 node_modules/cookie-signature/Readme.md create mode 100644 node_modules/cookie-signature/index.js create mode 100644 node_modules/cookie-signature/package.json create mode 100644 node_modules/cookie/HISTORY.md create mode 100644 node_modules/cookie/LICENSE create mode 100644 node_modules/cookie/README.md create mode 100644 node_modules/cookie/index.js create mode 100644 node_modules/cookie/package.json create mode 100644 node_modules/copy-descriptor/LICENSE create mode 100644 node_modules/copy-descriptor/index.js create mode 100644 node_modules/copy-descriptor/package.json create mode 100644 node_modules/core-js/CHANGELOG.md create mode 100644 node_modules/core-js/Gruntfile.js create mode 100644 node_modules/core-js/LICENSE create mode 100644 node_modules/core-js/README.md create mode 100644 node_modules/core-js/bower.json create mode 100644 node_modules/core-js/build/Gruntfile.ls create mode 100644 node_modules/core-js/build/build.ls create mode 100644 node_modules/core-js/build/config.js create mode 100644 node_modules/core-js/build/index.js create mode 100644 node_modules/core-js/client/core.js create mode 100644 node_modules/core-js/client/core.min.js create mode 100644 node_modules/core-js/client/core.min.js.map create mode 100644 node_modules/core-js/client/library.js create mode 100644 node_modules/core-js/client/library.min.js create mode 100644 node_modules/core-js/client/library.min.js.map create mode 100644 node_modules/core-js/client/shim.js create mode 100644 node_modules/core-js/client/shim.min.js create mode 100644 node_modules/core-js/client/shim.min.js.map create mode 100644 node_modules/core-js/core/_.js create mode 100644 node_modules/core-js/core/delay.js create mode 100644 node_modules/core-js/core/dict.js create mode 100644 node_modules/core-js/core/function.js create mode 100644 node_modules/core-js/core/index.js create mode 100644 node_modules/core-js/core/number.js create mode 100644 node_modules/core-js/core/object.js create mode 100644 node_modules/core-js/core/regexp.js create mode 100644 node_modules/core-js/core/string.js create mode 100644 node_modules/core-js/es5/index.js create mode 100644 node_modules/core-js/es6/array.js create mode 100644 node_modules/core-js/es6/date.js create mode 100644 node_modules/core-js/es6/function.js create mode 100644 node_modules/core-js/es6/index.js create mode 100644 node_modules/core-js/es6/map.js create mode 100644 node_modules/core-js/es6/math.js create mode 100644 node_modules/core-js/es6/number.js create mode 100644 node_modules/core-js/es6/object.js create mode 100644 node_modules/core-js/es6/parse-float.js create mode 100644 node_modules/core-js/es6/parse-int.js create mode 100644 node_modules/core-js/es6/promise.js create mode 100644 node_modules/core-js/es6/reflect.js create mode 100644 node_modules/core-js/es6/regexp.js create mode 100644 node_modules/core-js/es6/set.js create mode 100644 node_modules/core-js/es6/string.js create mode 100644 node_modules/core-js/es6/symbol.js create mode 100644 node_modules/core-js/es6/typed.js create mode 100644 node_modules/core-js/es6/weak-map.js create mode 100644 node_modules/core-js/es6/weak-set.js create mode 100644 node_modules/core-js/es7/array.js create mode 100644 node_modules/core-js/es7/asap.js create mode 100644 node_modules/core-js/es7/error.js create mode 100644 node_modules/core-js/es7/global.js create mode 100644 node_modules/core-js/es7/index.js create mode 100644 node_modules/core-js/es7/map.js create mode 100644 node_modules/core-js/es7/math.js create mode 100644 node_modules/core-js/es7/object.js create mode 100644 node_modules/core-js/es7/observable.js create mode 100644 node_modules/core-js/es7/promise.js create mode 100644 node_modules/core-js/es7/reflect.js create mode 100644 node_modules/core-js/es7/set.js create mode 100644 node_modules/core-js/es7/string.js create mode 100644 node_modules/core-js/es7/symbol.js create mode 100644 node_modules/core-js/es7/system.js create mode 100644 node_modules/core-js/es7/weak-map.js create mode 100644 node_modules/core-js/es7/weak-set.js create mode 100644 node_modules/core-js/fn/_.js create mode 100644 node_modules/core-js/fn/array/concat.js create mode 100644 node_modules/core-js/fn/array/copy-within.js create mode 100644 node_modules/core-js/fn/array/entries.js create mode 100644 node_modules/core-js/fn/array/every.js create mode 100644 node_modules/core-js/fn/array/fill.js create mode 100644 node_modules/core-js/fn/array/filter.js create mode 100644 node_modules/core-js/fn/array/find-index.js create mode 100644 node_modules/core-js/fn/array/find.js create mode 100644 node_modules/core-js/fn/array/flat-map.js create mode 100644 node_modules/core-js/fn/array/flatten.js create mode 100644 node_modules/core-js/fn/array/for-each.js create mode 100644 node_modules/core-js/fn/array/from.js create mode 100644 node_modules/core-js/fn/array/includes.js create mode 100644 node_modules/core-js/fn/array/index-of.js create mode 100644 node_modules/core-js/fn/array/index.js create mode 100644 node_modules/core-js/fn/array/is-array.js create mode 100644 node_modules/core-js/fn/array/iterator.js create mode 100644 node_modules/core-js/fn/array/join.js create mode 100644 node_modules/core-js/fn/array/keys.js create mode 100644 node_modules/core-js/fn/array/last-index-of.js create mode 100644 node_modules/core-js/fn/array/map.js create mode 100644 node_modules/core-js/fn/array/of.js create mode 100644 node_modules/core-js/fn/array/pop.js create mode 100644 node_modules/core-js/fn/array/push.js create mode 100644 node_modules/core-js/fn/array/reduce-right.js create mode 100644 node_modules/core-js/fn/array/reduce.js create mode 100644 node_modules/core-js/fn/array/reverse.js create mode 100644 node_modules/core-js/fn/array/shift.js create mode 100644 node_modules/core-js/fn/array/slice.js create mode 100644 node_modules/core-js/fn/array/some.js create mode 100644 node_modules/core-js/fn/array/sort.js create mode 100644 node_modules/core-js/fn/array/splice.js create mode 100644 node_modules/core-js/fn/array/unshift.js create mode 100644 node_modules/core-js/fn/array/values.js create mode 100644 node_modules/core-js/fn/array/virtual/copy-within.js create mode 100644 node_modules/core-js/fn/array/virtual/entries.js create mode 100644 node_modules/core-js/fn/array/virtual/every.js create mode 100644 node_modules/core-js/fn/array/virtual/fill.js create mode 100644 node_modules/core-js/fn/array/virtual/filter.js create mode 100644 node_modules/core-js/fn/array/virtual/find-index.js create mode 100644 node_modules/core-js/fn/array/virtual/find.js create mode 100644 node_modules/core-js/fn/array/virtual/flat-map.js create mode 100644 node_modules/core-js/fn/array/virtual/flatten.js create mode 100644 node_modules/core-js/fn/array/virtual/for-each.js create mode 100644 node_modules/core-js/fn/array/virtual/includes.js create mode 100644 node_modules/core-js/fn/array/virtual/index-of.js create mode 100644 node_modules/core-js/fn/array/virtual/index.js create mode 100644 node_modules/core-js/fn/array/virtual/iterator.js create mode 100644 node_modules/core-js/fn/array/virtual/join.js create mode 100644 node_modules/core-js/fn/array/virtual/keys.js create mode 100644 node_modules/core-js/fn/array/virtual/last-index-of.js create mode 100644 node_modules/core-js/fn/array/virtual/map.js create mode 100644 node_modules/core-js/fn/array/virtual/reduce-right.js create mode 100644 node_modules/core-js/fn/array/virtual/reduce.js create mode 100644 node_modules/core-js/fn/array/virtual/slice.js create mode 100644 node_modules/core-js/fn/array/virtual/some.js create mode 100644 node_modules/core-js/fn/array/virtual/sort.js create mode 100644 node_modules/core-js/fn/array/virtual/values.js create mode 100644 node_modules/core-js/fn/asap.js create mode 100644 node_modules/core-js/fn/clear-immediate.js create mode 100644 node_modules/core-js/fn/date/index.js create mode 100644 node_modules/core-js/fn/date/now.js create mode 100644 node_modules/core-js/fn/date/to-iso-string.js create mode 100644 node_modules/core-js/fn/date/to-json.js create mode 100644 node_modules/core-js/fn/date/to-primitive.js create mode 100644 node_modules/core-js/fn/date/to-string.js create mode 100644 node_modules/core-js/fn/delay.js create mode 100644 node_modules/core-js/fn/dict.js create mode 100644 node_modules/core-js/fn/dom-collections/index.js create mode 100644 node_modules/core-js/fn/dom-collections/iterator.js create mode 100644 node_modules/core-js/fn/error/index.js create mode 100644 node_modules/core-js/fn/error/is-error.js create mode 100644 node_modules/core-js/fn/function/bind.js create mode 100644 node_modules/core-js/fn/function/has-instance.js create mode 100644 node_modules/core-js/fn/function/index.js create mode 100644 node_modules/core-js/fn/function/name.js create mode 100644 node_modules/core-js/fn/function/part.js create mode 100644 node_modules/core-js/fn/function/virtual/bind.js create mode 100644 node_modules/core-js/fn/function/virtual/index.js create mode 100644 node_modules/core-js/fn/function/virtual/part.js create mode 100644 node_modules/core-js/fn/get-iterator-method.js create mode 100644 node_modules/core-js/fn/get-iterator.js create mode 100644 node_modules/core-js/fn/global.js create mode 100644 node_modules/core-js/fn/is-iterable.js create mode 100644 node_modules/core-js/fn/json/index.js create mode 100644 node_modules/core-js/fn/json/stringify.js create mode 100644 node_modules/core-js/fn/map.js create mode 100644 node_modules/core-js/fn/map/from.js create mode 100644 node_modules/core-js/fn/map/index.js create mode 100644 node_modules/core-js/fn/map/of.js create mode 100644 node_modules/core-js/fn/math/acosh.js create mode 100644 node_modules/core-js/fn/math/asinh.js create mode 100644 node_modules/core-js/fn/math/atanh.js create mode 100644 node_modules/core-js/fn/math/cbrt.js create mode 100644 node_modules/core-js/fn/math/clamp.js create mode 100644 node_modules/core-js/fn/math/clz32.js create mode 100644 node_modules/core-js/fn/math/cosh.js create mode 100644 node_modules/core-js/fn/math/deg-per-rad.js create mode 100644 node_modules/core-js/fn/math/degrees.js create mode 100644 node_modules/core-js/fn/math/expm1.js create mode 100644 node_modules/core-js/fn/math/fround.js create mode 100644 node_modules/core-js/fn/math/fscale.js create mode 100644 node_modules/core-js/fn/math/hypot.js create mode 100644 node_modules/core-js/fn/math/iaddh.js create mode 100644 node_modules/core-js/fn/math/imul.js create mode 100644 node_modules/core-js/fn/math/imulh.js create mode 100644 node_modules/core-js/fn/math/index.js create mode 100644 node_modules/core-js/fn/math/isubh.js create mode 100644 node_modules/core-js/fn/math/log10.js create mode 100644 node_modules/core-js/fn/math/log1p.js create mode 100644 node_modules/core-js/fn/math/log2.js create mode 100644 node_modules/core-js/fn/math/rad-per-deg.js create mode 100644 node_modules/core-js/fn/math/radians.js create mode 100644 node_modules/core-js/fn/math/scale.js create mode 100644 node_modules/core-js/fn/math/sign.js create mode 100644 node_modules/core-js/fn/math/signbit.js create mode 100644 node_modules/core-js/fn/math/sinh.js create mode 100644 node_modules/core-js/fn/math/tanh.js create mode 100644 node_modules/core-js/fn/math/trunc.js create mode 100644 node_modules/core-js/fn/math/umulh.js create mode 100644 node_modules/core-js/fn/number/constructor.js create mode 100644 node_modules/core-js/fn/number/epsilon.js create mode 100644 node_modules/core-js/fn/number/index.js create mode 100644 node_modules/core-js/fn/number/is-finite.js create mode 100644 node_modules/core-js/fn/number/is-integer.js create mode 100644 node_modules/core-js/fn/number/is-nan.js create mode 100644 node_modules/core-js/fn/number/is-safe-integer.js create mode 100644 node_modules/core-js/fn/number/iterator.js create mode 100644 node_modules/core-js/fn/number/max-safe-integer.js create mode 100644 node_modules/core-js/fn/number/min-safe-integer.js create mode 100644 node_modules/core-js/fn/number/parse-float.js create mode 100644 node_modules/core-js/fn/number/parse-int.js create mode 100644 node_modules/core-js/fn/number/to-fixed.js create mode 100644 node_modules/core-js/fn/number/to-precision.js create mode 100644 node_modules/core-js/fn/number/virtual/index.js create mode 100644 node_modules/core-js/fn/number/virtual/iterator.js create mode 100644 node_modules/core-js/fn/number/virtual/to-fixed.js create mode 100644 node_modules/core-js/fn/number/virtual/to-precision.js create mode 100644 node_modules/core-js/fn/object/assign.js create mode 100644 node_modules/core-js/fn/object/classof.js create mode 100644 node_modules/core-js/fn/object/create.js create mode 100644 node_modules/core-js/fn/object/define-getter.js create mode 100644 node_modules/core-js/fn/object/define-properties.js create mode 100644 node_modules/core-js/fn/object/define-property.js create mode 100644 node_modules/core-js/fn/object/define-setter.js create mode 100644 node_modules/core-js/fn/object/define.js create mode 100644 node_modules/core-js/fn/object/entries.js create mode 100644 node_modules/core-js/fn/object/freeze.js create mode 100644 node_modules/core-js/fn/object/get-own-property-descriptor.js create mode 100644 node_modules/core-js/fn/object/get-own-property-descriptors.js create mode 100644 node_modules/core-js/fn/object/get-own-property-names.js create mode 100644 node_modules/core-js/fn/object/get-own-property-symbols.js create mode 100644 node_modules/core-js/fn/object/get-prototype-of.js create mode 100644 node_modules/core-js/fn/object/index.js create mode 100644 node_modules/core-js/fn/object/is-extensible.js create mode 100644 node_modules/core-js/fn/object/is-frozen.js create mode 100644 node_modules/core-js/fn/object/is-object.js create mode 100644 node_modules/core-js/fn/object/is-sealed.js create mode 100644 node_modules/core-js/fn/object/is.js create mode 100644 node_modules/core-js/fn/object/keys.js create mode 100644 node_modules/core-js/fn/object/lookup-getter.js create mode 100644 node_modules/core-js/fn/object/lookup-setter.js create mode 100644 node_modules/core-js/fn/object/make.js create mode 100644 node_modules/core-js/fn/object/prevent-extensions.js create mode 100644 node_modules/core-js/fn/object/seal.js create mode 100644 node_modules/core-js/fn/object/set-prototype-of.js create mode 100644 node_modules/core-js/fn/object/values.js create mode 100644 node_modules/core-js/fn/observable.js create mode 100644 node_modules/core-js/fn/parse-float.js create mode 100644 node_modules/core-js/fn/parse-int.js create mode 100644 node_modules/core-js/fn/promise.js create mode 100644 node_modules/core-js/fn/promise/finally.js create mode 100644 node_modules/core-js/fn/promise/index.js create mode 100644 node_modules/core-js/fn/promise/try.js create mode 100644 node_modules/core-js/fn/reflect/apply.js create mode 100644 node_modules/core-js/fn/reflect/construct.js create mode 100644 node_modules/core-js/fn/reflect/define-metadata.js create mode 100644 node_modules/core-js/fn/reflect/define-property.js create mode 100644 node_modules/core-js/fn/reflect/delete-metadata.js create mode 100644 node_modules/core-js/fn/reflect/delete-property.js create mode 100644 node_modules/core-js/fn/reflect/enumerate.js create mode 100644 node_modules/core-js/fn/reflect/get-metadata-keys.js create mode 100644 node_modules/core-js/fn/reflect/get-metadata.js create mode 100644 node_modules/core-js/fn/reflect/get-own-metadata-keys.js create mode 100644 node_modules/core-js/fn/reflect/get-own-metadata.js create mode 100644 node_modules/core-js/fn/reflect/get-own-property-descriptor.js create mode 100644 node_modules/core-js/fn/reflect/get-prototype-of.js create mode 100644 node_modules/core-js/fn/reflect/get.js create mode 100644 node_modules/core-js/fn/reflect/has-metadata.js create mode 100644 node_modules/core-js/fn/reflect/has-own-metadata.js create mode 100644 node_modules/core-js/fn/reflect/has.js create mode 100644 node_modules/core-js/fn/reflect/index.js create mode 100644 node_modules/core-js/fn/reflect/is-extensible.js create mode 100644 node_modules/core-js/fn/reflect/metadata.js create mode 100644 node_modules/core-js/fn/reflect/own-keys.js create mode 100644 node_modules/core-js/fn/reflect/prevent-extensions.js create mode 100644 node_modules/core-js/fn/reflect/set-prototype-of.js create mode 100644 node_modules/core-js/fn/reflect/set.js create mode 100644 node_modules/core-js/fn/regexp/constructor.js create mode 100644 node_modules/core-js/fn/regexp/escape.js create mode 100644 node_modules/core-js/fn/regexp/flags.js create mode 100644 node_modules/core-js/fn/regexp/index.js create mode 100644 node_modules/core-js/fn/regexp/match.js create mode 100644 node_modules/core-js/fn/regexp/replace.js create mode 100644 node_modules/core-js/fn/regexp/search.js create mode 100644 node_modules/core-js/fn/regexp/split.js create mode 100644 node_modules/core-js/fn/regexp/to-string.js create mode 100644 node_modules/core-js/fn/set-immediate.js create mode 100644 node_modules/core-js/fn/set-interval.js create mode 100644 node_modules/core-js/fn/set-timeout.js create mode 100644 node_modules/core-js/fn/set.js create mode 100644 node_modules/core-js/fn/set/from.js create mode 100644 node_modules/core-js/fn/set/index.js create mode 100644 node_modules/core-js/fn/set/of.js create mode 100644 node_modules/core-js/fn/string/anchor.js create mode 100644 node_modules/core-js/fn/string/at.js create mode 100644 node_modules/core-js/fn/string/big.js create mode 100644 node_modules/core-js/fn/string/blink.js create mode 100644 node_modules/core-js/fn/string/bold.js create mode 100644 node_modules/core-js/fn/string/code-point-at.js create mode 100644 node_modules/core-js/fn/string/ends-with.js create mode 100644 node_modules/core-js/fn/string/escape-html.js create mode 100644 node_modules/core-js/fn/string/fixed.js create mode 100644 node_modules/core-js/fn/string/fontcolor.js create mode 100644 node_modules/core-js/fn/string/fontsize.js create mode 100644 node_modules/core-js/fn/string/from-code-point.js create mode 100644 node_modules/core-js/fn/string/includes.js create mode 100644 node_modules/core-js/fn/string/index.js create mode 100644 node_modules/core-js/fn/string/italics.js create mode 100644 node_modules/core-js/fn/string/iterator.js create mode 100644 node_modules/core-js/fn/string/link.js create mode 100644 node_modules/core-js/fn/string/match-all.js create mode 100644 node_modules/core-js/fn/string/pad-end.js create mode 100644 node_modules/core-js/fn/string/pad-start.js create mode 100644 node_modules/core-js/fn/string/raw.js create mode 100644 node_modules/core-js/fn/string/repeat.js create mode 100644 node_modules/core-js/fn/string/small.js create mode 100644 node_modules/core-js/fn/string/starts-with.js create mode 100644 node_modules/core-js/fn/string/strike.js create mode 100644 node_modules/core-js/fn/string/sub.js create mode 100644 node_modules/core-js/fn/string/sup.js create mode 100644 node_modules/core-js/fn/string/trim-end.js create mode 100644 node_modules/core-js/fn/string/trim-left.js create mode 100644 node_modules/core-js/fn/string/trim-right.js create mode 100644 node_modules/core-js/fn/string/trim-start.js create mode 100644 node_modules/core-js/fn/string/trim.js create mode 100644 node_modules/core-js/fn/string/unescape-html.js create mode 100644 node_modules/core-js/fn/string/virtual/anchor.js create mode 100644 node_modules/core-js/fn/string/virtual/at.js create mode 100644 node_modules/core-js/fn/string/virtual/big.js create mode 100644 node_modules/core-js/fn/string/virtual/blink.js create mode 100644 node_modules/core-js/fn/string/virtual/bold.js create mode 100644 node_modules/core-js/fn/string/virtual/code-point-at.js create mode 100644 node_modules/core-js/fn/string/virtual/ends-with.js create mode 100644 node_modules/core-js/fn/string/virtual/escape-html.js create mode 100644 node_modules/core-js/fn/string/virtual/fixed.js create mode 100644 node_modules/core-js/fn/string/virtual/fontcolor.js create mode 100644 node_modules/core-js/fn/string/virtual/fontsize.js create mode 100644 node_modules/core-js/fn/string/virtual/includes.js create mode 100644 node_modules/core-js/fn/string/virtual/index.js create mode 100644 node_modules/core-js/fn/string/virtual/italics.js create mode 100644 node_modules/core-js/fn/string/virtual/iterator.js create mode 100644 node_modules/core-js/fn/string/virtual/link.js create mode 100644 node_modules/core-js/fn/string/virtual/match-all.js create mode 100644 node_modules/core-js/fn/string/virtual/pad-end.js create mode 100644 node_modules/core-js/fn/string/virtual/pad-start.js create mode 100644 node_modules/core-js/fn/string/virtual/repeat.js create mode 100644 node_modules/core-js/fn/string/virtual/small.js create mode 100644 node_modules/core-js/fn/string/virtual/starts-with.js create mode 100644 node_modules/core-js/fn/string/virtual/strike.js create mode 100644 node_modules/core-js/fn/string/virtual/sub.js create mode 100644 node_modules/core-js/fn/string/virtual/sup.js create mode 100644 node_modules/core-js/fn/string/virtual/trim-end.js create mode 100644 node_modules/core-js/fn/string/virtual/trim-left.js create mode 100644 node_modules/core-js/fn/string/virtual/trim-right.js create mode 100644 node_modules/core-js/fn/string/virtual/trim-start.js create mode 100644 node_modules/core-js/fn/string/virtual/trim.js create mode 100644 node_modules/core-js/fn/string/virtual/unescape-html.js create mode 100644 node_modules/core-js/fn/symbol/async-iterator.js create mode 100644 node_modules/core-js/fn/symbol/for.js create mode 100644 node_modules/core-js/fn/symbol/has-instance.js create mode 100644 node_modules/core-js/fn/symbol/index.js create mode 100644 node_modules/core-js/fn/symbol/is-concat-spreadable.js create mode 100644 node_modules/core-js/fn/symbol/iterator.js create mode 100644 node_modules/core-js/fn/symbol/key-for.js create mode 100644 node_modules/core-js/fn/symbol/match.js create mode 100644 node_modules/core-js/fn/symbol/observable.js create mode 100644 node_modules/core-js/fn/symbol/replace.js create mode 100644 node_modules/core-js/fn/symbol/search.js create mode 100644 node_modules/core-js/fn/symbol/species.js create mode 100644 node_modules/core-js/fn/symbol/split.js create mode 100644 node_modules/core-js/fn/symbol/to-primitive.js create mode 100644 node_modules/core-js/fn/symbol/to-string-tag.js create mode 100644 node_modules/core-js/fn/symbol/unscopables.js create mode 100644 node_modules/core-js/fn/system/global.js create mode 100644 node_modules/core-js/fn/system/index.js create mode 100644 node_modules/core-js/fn/typed/array-buffer.js create mode 100644 node_modules/core-js/fn/typed/data-view.js create mode 100644 node_modules/core-js/fn/typed/float32-array.js create mode 100644 node_modules/core-js/fn/typed/float64-array.js create mode 100644 node_modules/core-js/fn/typed/index.js create mode 100644 node_modules/core-js/fn/typed/int16-array.js create mode 100644 node_modules/core-js/fn/typed/int32-array.js create mode 100644 node_modules/core-js/fn/typed/int8-array.js create mode 100644 node_modules/core-js/fn/typed/uint16-array.js create mode 100644 node_modules/core-js/fn/typed/uint32-array.js create mode 100644 node_modules/core-js/fn/typed/uint8-array.js create mode 100644 node_modules/core-js/fn/typed/uint8-clamped-array.js create mode 100644 node_modules/core-js/fn/weak-map.js create mode 100644 node_modules/core-js/fn/weak-map/from.js create mode 100644 node_modules/core-js/fn/weak-map/index.js create mode 100644 node_modules/core-js/fn/weak-map/of.js create mode 100644 node_modules/core-js/fn/weak-set.js create mode 100644 node_modules/core-js/fn/weak-set/from.js create mode 100644 node_modules/core-js/fn/weak-set/index.js create mode 100644 node_modules/core-js/fn/weak-set/of.js create mode 100644 node_modules/core-js/index.js create mode 100644 node_modules/core-js/library/core/_.js create mode 100644 node_modules/core-js/library/core/delay.js create mode 100644 node_modules/core-js/library/core/dict.js create mode 100644 node_modules/core-js/library/core/function.js create mode 100644 node_modules/core-js/library/core/index.js create mode 100644 node_modules/core-js/library/core/number.js create mode 100644 node_modules/core-js/library/core/object.js create mode 100644 node_modules/core-js/library/core/regexp.js create mode 100644 node_modules/core-js/library/core/string.js create mode 100644 node_modules/core-js/library/es5/index.js create mode 100644 node_modules/core-js/library/es6/array.js create mode 100644 node_modules/core-js/library/es6/date.js create mode 100644 node_modules/core-js/library/es6/function.js create mode 100644 node_modules/core-js/library/es6/index.js create mode 100644 node_modules/core-js/library/es6/map.js create mode 100644 node_modules/core-js/library/es6/math.js create mode 100644 node_modules/core-js/library/es6/number.js create mode 100644 node_modules/core-js/library/es6/object.js create mode 100644 node_modules/core-js/library/es6/parse-float.js create mode 100644 node_modules/core-js/library/es6/parse-int.js create mode 100644 node_modules/core-js/library/es6/promise.js create mode 100644 node_modules/core-js/library/es6/reflect.js create mode 100644 node_modules/core-js/library/es6/regexp.js create mode 100644 node_modules/core-js/library/es6/set.js create mode 100644 node_modules/core-js/library/es6/string.js create mode 100644 node_modules/core-js/library/es6/symbol.js create mode 100644 node_modules/core-js/library/es6/typed.js create mode 100644 node_modules/core-js/library/es6/weak-map.js create mode 100644 node_modules/core-js/library/es6/weak-set.js create mode 100644 node_modules/core-js/library/es7/array.js create mode 100644 node_modules/core-js/library/es7/asap.js create mode 100644 node_modules/core-js/library/es7/error.js create mode 100644 node_modules/core-js/library/es7/global.js create mode 100644 node_modules/core-js/library/es7/index.js create mode 100644 node_modules/core-js/library/es7/map.js create mode 100644 node_modules/core-js/library/es7/math.js create mode 100644 node_modules/core-js/library/es7/object.js create mode 100644 node_modules/core-js/library/es7/observable.js create mode 100644 node_modules/core-js/library/es7/promise.js create mode 100644 node_modules/core-js/library/es7/reflect.js create mode 100644 node_modules/core-js/library/es7/set.js create mode 100644 node_modules/core-js/library/es7/string.js create mode 100644 node_modules/core-js/library/es7/symbol.js create mode 100644 node_modules/core-js/library/es7/system.js create mode 100644 node_modules/core-js/library/es7/weak-map.js create mode 100644 node_modules/core-js/library/es7/weak-set.js create mode 100644 node_modules/core-js/library/fn/_.js create mode 100644 node_modules/core-js/library/fn/array/concat.js create mode 100644 node_modules/core-js/library/fn/array/copy-within.js create mode 100644 node_modules/core-js/library/fn/array/entries.js create mode 100644 node_modules/core-js/library/fn/array/every.js create mode 100644 node_modules/core-js/library/fn/array/fill.js create mode 100644 node_modules/core-js/library/fn/array/filter.js create mode 100644 node_modules/core-js/library/fn/array/find-index.js create mode 100644 node_modules/core-js/library/fn/array/find.js create mode 100644 node_modules/core-js/library/fn/array/flat-map.js create mode 100644 node_modules/core-js/library/fn/array/flatten.js create mode 100644 node_modules/core-js/library/fn/array/for-each.js create mode 100644 node_modules/core-js/library/fn/array/from.js create mode 100644 node_modules/core-js/library/fn/array/includes.js create mode 100644 node_modules/core-js/library/fn/array/index-of.js create mode 100644 node_modules/core-js/library/fn/array/index.js create mode 100644 node_modules/core-js/library/fn/array/is-array.js create mode 100644 node_modules/core-js/library/fn/array/iterator.js create mode 100644 node_modules/core-js/library/fn/array/join.js create mode 100644 node_modules/core-js/library/fn/array/keys.js create mode 100644 node_modules/core-js/library/fn/array/last-index-of.js create mode 100644 node_modules/core-js/library/fn/array/map.js create mode 100644 node_modules/core-js/library/fn/array/of.js create mode 100644 node_modules/core-js/library/fn/array/pop.js create mode 100644 node_modules/core-js/library/fn/array/push.js create mode 100644 node_modules/core-js/library/fn/array/reduce-right.js create mode 100644 node_modules/core-js/library/fn/array/reduce.js create mode 100644 node_modules/core-js/library/fn/array/reverse.js create mode 100644 node_modules/core-js/library/fn/array/shift.js create mode 100644 node_modules/core-js/library/fn/array/slice.js create mode 100644 node_modules/core-js/library/fn/array/some.js create mode 100644 node_modules/core-js/library/fn/array/sort.js create mode 100644 node_modules/core-js/library/fn/array/splice.js create mode 100644 node_modules/core-js/library/fn/array/unshift.js create mode 100644 node_modules/core-js/library/fn/array/values.js create mode 100644 node_modules/core-js/library/fn/array/virtual/copy-within.js create mode 100644 node_modules/core-js/library/fn/array/virtual/entries.js create mode 100644 node_modules/core-js/library/fn/array/virtual/every.js create mode 100644 node_modules/core-js/library/fn/array/virtual/fill.js create mode 100644 node_modules/core-js/library/fn/array/virtual/filter.js create mode 100644 node_modules/core-js/library/fn/array/virtual/find-index.js create mode 100644 node_modules/core-js/library/fn/array/virtual/find.js create mode 100644 node_modules/core-js/library/fn/array/virtual/flat-map.js create mode 100644 node_modules/core-js/library/fn/array/virtual/flatten.js create mode 100644 node_modules/core-js/library/fn/array/virtual/for-each.js create mode 100644 node_modules/core-js/library/fn/array/virtual/includes.js create mode 100644 node_modules/core-js/library/fn/array/virtual/index-of.js create mode 100644 node_modules/core-js/library/fn/array/virtual/index.js create mode 100644 node_modules/core-js/library/fn/array/virtual/iterator.js create mode 100644 node_modules/core-js/library/fn/array/virtual/join.js create mode 100644 node_modules/core-js/library/fn/array/virtual/keys.js create mode 100644 node_modules/core-js/library/fn/array/virtual/last-index-of.js create mode 100644 node_modules/core-js/library/fn/array/virtual/map.js create mode 100644 node_modules/core-js/library/fn/array/virtual/reduce-right.js create mode 100644 node_modules/core-js/library/fn/array/virtual/reduce.js create mode 100644 node_modules/core-js/library/fn/array/virtual/slice.js create mode 100644 node_modules/core-js/library/fn/array/virtual/some.js create mode 100644 node_modules/core-js/library/fn/array/virtual/sort.js create mode 100644 node_modules/core-js/library/fn/array/virtual/values.js create mode 100644 node_modules/core-js/library/fn/asap.js create mode 100644 node_modules/core-js/library/fn/clear-immediate.js create mode 100644 node_modules/core-js/library/fn/date/index.js create mode 100644 node_modules/core-js/library/fn/date/now.js create mode 100644 node_modules/core-js/library/fn/date/to-iso-string.js create mode 100644 node_modules/core-js/library/fn/date/to-json.js create mode 100644 node_modules/core-js/library/fn/date/to-primitive.js create mode 100644 node_modules/core-js/library/fn/date/to-string.js create mode 100644 node_modules/core-js/library/fn/delay.js create mode 100644 node_modules/core-js/library/fn/dict.js create mode 100644 node_modules/core-js/library/fn/dom-collections/index.js create mode 100644 node_modules/core-js/library/fn/dom-collections/iterator.js create mode 100644 node_modules/core-js/library/fn/error/index.js create mode 100644 node_modules/core-js/library/fn/error/is-error.js create mode 100644 node_modules/core-js/library/fn/function/bind.js create mode 100644 node_modules/core-js/library/fn/function/has-instance.js create mode 100644 node_modules/core-js/library/fn/function/index.js create mode 100644 node_modules/core-js/library/fn/function/name.js create mode 100644 node_modules/core-js/library/fn/function/part.js create mode 100644 node_modules/core-js/library/fn/function/virtual/bind.js create mode 100644 node_modules/core-js/library/fn/function/virtual/index.js create mode 100644 node_modules/core-js/library/fn/function/virtual/part.js create mode 100644 node_modules/core-js/library/fn/get-iterator-method.js create mode 100644 node_modules/core-js/library/fn/get-iterator.js create mode 100644 node_modules/core-js/library/fn/global.js create mode 100644 node_modules/core-js/library/fn/is-iterable.js create mode 100644 node_modules/core-js/library/fn/json/index.js create mode 100644 node_modules/core-js/library/fn/json/stringify.js create mode 100644 node_modules/core-js/library/fn/map.js create mode 100644 node_modules/core-js/library/fn/map/from.js create mode 100644 node_modules/core-js/library/fn/map/index.js create mode 100644 node_modules/core-js/library/fn/map/of.js create mode 100644 node_modules/core-js/library/fn/math/acosh.js create mode 100644 node_modules/core-js/library/fn/math/asinh.js create mode 100644 node_modules/core-js/library/fn/math/atanh.js create mode 100644 node_modules/core-js/library/fn/math/cbrt.js create mode 100644 node_modules/core-js/library/fn/math/clamp.js create mode 100644 node_modules/core-js/library/fn/math/clz32.js create mode 100644 node_modules/core-js/library/fn/math/cosh.js create mode 100644 node_modules/core-js/library/fn/math/deg-per-rad.js create mode 100644 node_modules/core-js/library/fn/math/degrees.js create mode 100644 node_modules/core-js/library/fn/math/expm1.js create mode 100644 node_modules/core-js/library/fn/math/fround.js create mode 100644 node_modules/core-js/library/fn/math/fscale.js create mode 100644 node_modules/core-js/library/fn/math/hypot.js create mode 100644 node_modules/core-js/library/fn/math/iaddh.js create mode 100644 node_modules/core-js/library/fn/math/imul.js create mode 100644 node_modules/core-js/library/fn/math/imulh.js create mode 100644 node_modules/core-js/library/fn/math/index.js create mode 100644 node_modules/core-js/library/fn/math/isubh.js create mode 100644 node_modules/core-js/library/fn/math/log10.js create mode 100644 node_modules/core-js/library/fn/math/log1p.js create mode 100644 node_modules/core-js/library/fn/math/log2.js create mode 100644 node_modules/core-js/library/fn/math/rad-per-deg.js create mode 100644 node_modules/core-js/library/fn/math/radians.js create mode 100644 node_modules/core-js/library/fn/math/scale.js create mode 100644 node_modules/core-js/library/fn/math/sign.js create mode 100644 node_modules/core-js/library/fn/math/signbit.js create mode 100644 node_modules/core-js/library/fn/math/sinh.js create mode 100644 node_modules/core-js/library/fn/math/tanh.js create mode 100644 node_modules/core-js/library/fn/math/trunc.js create mode 100644 node_modules/core-js/library/fn/math/umulh.js create mode 100644 node_modules/core-js/library/fn/number/constructor.js create mode 100644 node_modules/core-js/library/fn/number/epsilon.js create mode 100644 node_modules/core-js/library/fn/number/index.js create mode 100644 node_modules/core-js/library/fn/number/is-finite.js create mode 100644 node_modules/core-js/library/fn/number/is-integer.js create mode 100644 node_modules/core-js/library/fn/number/is-nan.js create mode 100644 node_modules/core-js/library/fn/number/is-safe-integer.js create mode 100644 node_modules/core-js/library/fn/number/iterator.js create mode 100644 node_modules/core-js/library/fn/number/max-safe-integer.js create mode 100644 node_modules/core-js/library/fn/number/min-safe-integer.js create mode 100644 node_modules/core-js/library/fn/number/parse-float.js create mode 100644 node_modules/core-js/library/fn/number/parse-int.js create mode 100644 node_modules/core-js/library/fn/number/to-fixed.js create mode 100644 node_modules/core-js/library/fn/number/to-precision.js create mode 100644 node_modules/core-js/library/fn/number/virtual/index.js create mode 100644 node_modules/core-js/library/fn/number/virtual/iterator.js create mode 100644 node_modules/core-js/library/fn/number/virtual/to-fixed.js create mode 100644 node_modules/core-js/library/fn/number/virtual/to-precision.js create mode 100644 node_modules/core-js/library/fn/object/assign.js create mode 100644 node_modules/core-js/library/fn/object/classof.js create mode 100644 node_modules/core-js/library/fn/object/create.js create mode 100644 node_modules/core-js/library/fn/object/define-getter.js create mode 100644 node_modules/core-js/library/fn/object/define-properties.js create mode 100644 node_modules/core-js/library/fn/object/define-property.js create mode 100644 node_modules/core-js/library/fn/object/define-setter.js create mode 100644 node_modules/core-js/library/fn/object/define.js create mode 100644 node_modules/core-js/library/fn/object/entries.js create mode 100644 node_modules/core-js/library/fn/object/freeze.js create mode 100644 node_modules/core-js/library/fn/object/get-own-property-descriptor.js create mode 100644 node_modules/core-js/library/fn/object/get-own-property-descriptors.js create mode 100644 node_modules/core-js/library/fn/object/get-own-property-names.js create mode 100644 node_modules/core-js/library/fn/object/get-own-property-symbols.js create mode 100644 node_modules/core-js/library/fn/object/get-prototype-of.js create mode 100644 node_modules/core-js/library/fn/object/index.js create mode 100644 node_modules/core-js/library/fn/object/is-extensible.js create mode 100644 node_modules/core-js/library/fn/object/is-frozen.js create mode 100644 node_modules/core-js/library/fn/object/is-object.js create mode 100644 node_modules/core-js/library/fn/object/is-sealed.js create mode 100644 node_modules/core-js/library/fn/object/is.js create mode 100644 node_modules/core-js/library/fn/object/keys.js create mode 100644 node_modules/core-js/library/fn/object/lookup-getter.js create mode 100644 node_modules/core-js/library/fn/object/lookup-setter.js create mode 100644 node_modules/core-js/library/fn/object/make.js create mode 100644 node_modules/core-js/library/fn/object/prevent-extensions.js create mode 100644 node_modules/core-js/library/fn/object/seal.js create mode 100644 node_modules/core-js/library/fn/object/set-prototype-of.js create mode 100644 node_modules/core-js/library/fn/object/values.js create mode 100644 node_modules/core-js/library/fn/observable.js create mode 100644 node_modules/core-js/library/fn/parse-float.js create mode 100644 node_modules/core-js/library/fn/parse-int.js create mode 100644 node_modules/core-js/library/fn/promise.js create mode 100644 node_modules/core-js/library/fn/promise/finally.js create mode 100644 node_modules/core-js/library/fn/promise/index.js create mode 100644 node_modules/core-js/library/fn/promise/try.js create mode 100644 node_modules/core-js/library/fn/reflect/apply.js create mode 100644 node_modules/core-js/library/fn/reflect/construct.js create mode 100644 node_modules/core-js/library/fn/reflect/define-metadata.js create mode 100644 node_modules/core-js/library/fn/reflect/define-property.js create mode 100644 node_modules/core-js/library/fn/reflect/delete-metadata.js create mode 100644 node_modules/core-js/library/fn/reflect/delete-property.js create mode 100644 node_modules/core-js/library/fn/reflect/enumerate.js create mode 100644 node_modules/core-js/library/fn/reflect/get-metadata-keys.js create mode 100644 node_modules/core-js/library/fn/reflect/get-metadata.js create mode 100644 node_modules/core-js/library/fn/reflect/get-own-metadata-keys.js create mode 100644 node_modules/core-js/library/fn/reflect/get-own-metadata.js create mode 100644 node_modules/core-js/library/fn/reflect/get-own-property-descriptor.js create mode 100644 node_modules/core-js/library/fn/reflect/get-prototype-of.js create mode 100644 node_modules/core-js/library/fn/reflect/get.js create mode 100644 node_modules/core-js/library/fn/reflect/has-metadata.js create mode 100644 node_modules/core-js/library/fn/reflect/has-own-metadata.js create mode 100644 node_modules/core-js/library/fn/reflect/has.js create mode 100644 node_modules/core-js/library/fn/reflect/index.js create mode 100644 node_modules/core-js/library/fn/reflect/is-extensible.js create mode 100644 node_modules/core-js/library/fn/reflect/metadata.js create mode 100644 node_modules/core-js/library/fn/reflect/own-keys.js create mode 100644 node_modules/core-js/library/fn/reflect/prevent-extensions.js create mode 100644 node_modules/core-js/library/fn/reflect/set-prototype-of.js create mode 100644 node_modules/core-js/library/fn/reflect/set.js create mode 100644 node_modules/core-js/library/fn/regexp/constructor.js create mode 100644 node_modules/core-js/library/fn/regexp/escape.js create mode 100644 node_modules/core-js/library/fn/regexp/flags.js create mode 100644 node_modules/core-js/library/fn/regexp/index.js create mode 100644 node_modules/core-js/library/fn/regexp/match.js create mode 100644 node_modules/core-js/library/fn/regexp/replace.js create mode 100644 node_modules/core-js/library/fn/regexp/search.js create mode 100644 node_modules/core-js/library/fn/regexp/split.js create mode 100644 node_modules/core-js/library/fn/regexp/to-string.js create mode 100644 node_modules/core-js/library/fn/set-immediate.js create mode 100644 node_modules/core-js/library/fn/set-interval.js create mode 100644 node_modules/core-js/library/fn/set-timeout.js create mode 100644 node_modules/core-js/library/fn/set.js create mode 100644 node_modules/core-js/library/fn/set/from.js create mode 100644 node_modules/core-js/library/fn/set/index.js create mode 100644 node_modules/core-js/library/fn/set/of.js create mode 100644 node_modules/core-js/library/fn/string/anchor.js create mode 100644 node_modules/core-js/library/fn/string/at.js create mode 100644 node_modules/core-js/library/fn/string/big.js create mode 100644 node_modules/core-js/library/fn/string/blink.js create mode 100644 node_modules/core-js/library/fn/string/bold.js create mode 100644 node_modules/core-js/library/fn/string/code-point-at.js create mode 100644 node_modules/core-js/library/fn/string/ends-with.js create mode 100644 node_modules/core-js/library/fn/string/escape-html.js create mode 100644 node_modules/core-js/library/fn/string/fixed.js create mode 100644 node_modules/core-js/library/fn/string/fontcolor.js create mode 100644 node_modules/core-js/library/fn/string/fontsize.js create mode 100644 node_modules/core-js/library/fn/string/from-code-point.js create mode 100644 node_modules/core-js/library/fn/string/includes.js create mode 100644 node_modules/core-js/library/fn/string/index.js create mode 100644 node_modules/core-js/library/fn/string/italics.js create mode 100644 node_modules/core-js/library/fn/string/iterator.js create mode 100644 node_modules/core-js/library/fn/string/link.js create mode 100644 node_modules/core-js/library/fn/string/match-all.js create mode 100644 node_modules/core-js/library/fn/string/pad-end.js create mode 100644 node_modules/core-js/library/fn/string/pad-start.js create mode 100644 node_modules/core-js/library/fn/string/raw.js create mode 100644 node_modules/core-js/library/fn/string/repeat.js create mode 100644 node_modules/core-js/library/fn/string/small.js create mode 100644 node_modules/core-js/library/fn/string/starts-with.js create mode 100644 node_modules/core-js/library/fn/string/strike.js create mode 100644 node_modules/core-js/library/fn/string/sub.js create mode 100644 node_modules/core-js/library/fn/string/sup.js create mode 100644 node_modules/core-js/library/fn/string/trim-end.js create mode 100644 node_modules/core-js/library/fn/string/trim-left.js create mode 100644 node_modules/core-js/library/fn/string/trim-right.js create mode 100644 node_modules/core-js/library/fn/string/trim-start.js create mode 100644 node_modules/core-js/library/fn/string/trim.js create mode 100644 node_modules/core-js/library/fn/string/unescape-html.js create mode 100644 node_modules/core-js/library/fn/string/virtual/anchor.js create mode 100644 node_modules/core-js/library/fn/string/virtual/at.js create mode 100644 node_modules/core-js/library/fn/string/virtual/big.js create mode 100644 node_modules/core-js/library/fn/string/virtual/blink.js create mode 100644 node_modules/core-js/library/fn/string/virtual/bold.js create mode 100644 node_modules/core-js/library/fn/string/virtual/code-point-at.js create mode 100644 node_modules/core-js/library/fn/string/virtual/ends-with.js create mode 100644 node_modules/core-js/library/fn/string/virtual/escape-html.js create mode 100644 node_modules/core-js/library/fn/string/virtual/fixed.js create mode 100644 node_modules/core-js/library/fn/string/virtual/fontcolor.js create mode 100644 node_modules/core-js/library/fn/string/virtual/fontsize.js create mode 100644 node_modules/core-js/library/fn/string/virtual/includes.js create mode 100644 node_modules/core-js/library/fn/string/virtual/index.js create mode 100644 node_modules/core-js/library/fn/string/virtual/italics.js create mode 100644 node_modules/core-js/library/fn/string/virtual/iterator.js create mode 100644 node_modules/core-js/library/fn/string/virtual/link.js create mode 100644 node_modules/core-js/library/fn/string/virtual/match-all.js create mode 100644 node_modules/core-js/library/fn/string/virtual/pad-end.js create mode 100644 node_modules/core-js/library/fn/string/virtual/pad-start.js create mode 100644 node_modules/core-js/library/fn/string/virtual/repeat.js create mode 100644 node_modules/core-js/library/fn/string/virtual/small.js create mode 100644 node_modules/core-js/library/fn/string/virtual/starts-with.js create mode 100644 node_modules/core-js/library/fn/string/virtual/strike.js create mode 100644 node_modules/core-js/library/fn/string/virtual/sub.js create mode 100644 node_modules/core-js/library/fn/string/virtual/sup.js create mode 100644 node_modules/core-js/library/fn/string/virtual/trim-end.js create mode 100644 node_modules/core-js/library/fn/string/virtual/trim-left.js create mode 100644 node_modules/core-js/library/fn/string/virtual/trim-right.js create mode 100644 node_modules/core-js/library/fn/string/virtual/trim-start.js create mode 100644 node_modules/core-js/library/fn/string/virtual/trim.js create mode 100644 node_modules/core-js/library/fn/string/virtual/unescape-html.js create mode 100644 node_modules/core-js/library/fn/symbol/async-iterator.js create mode 100644 node_modules/core-js/library/fn/symbol/for.js create mode 100644 node_modules/core-js/library/fn/symbol/has-instance.js create mode 100644 node_modules/core-js/library/fn/symbol/index.js create mode 100644 node_modules/core-js/library/fn/symbol/is-concat-spreadable.js create mode 100644 node_modules/core-js/library/fn/symbol/iterator.js create mode 100644 node_modules/core-js/library/fn/symbol/key-for.js create mode 100644 node_modules/core-js/library/fn/symbol/match.js create mode 100644 node_modules/core-js/library/fn/symbol/observable.js create mode 100644 node_modules/core-js/library/fn/symbol/replace.js create mode 100644 node_modules/core-js/library/fn/symbol/search.js create mode 100644 node_modules/core-js/library/fn/symbol/species.js create mode 100644 node_modules/core-js/library/fn/symbol/split.js create mode 100644 node_modules/core-js/library/fn/symbol/to-primitive.js create mode 100644 node_modules/core-js/library/fn/symbol/to-string-tag.js create mode 100644 node_modules/core-js/library/fn/symbol/unscopables.js create mode 100644 node_modules/core-js/library/fn/system/global.js create mode 100644 node_modules/core-js/library/fn/system/index.js create mode 100644 node_modules/core-js/library/fn/typed/array-buffer.js create mode 100644 node_modules/core-js/library/fn/typed/data-view.js create mode 100644 node_modules/core-js/library/fn/typed/float32-array.js create mode 100644 node_modules/core-js/library/fn/typed/float64-array.js create mode 100644 node_modules/core-js/library/fn/typed/index.js create mode 100644 node_modules/core-js/library/fn/typed/int16-array.js create mode 100644 node_modules/core-js/library/fn/typed/int32-array.js create mode 100644 node_modules/core-js/library/fn/typed/int8-array.js create mode 100644 node_modules/core-js/library/fn/typed/uint16-array.js create mode 100644 node_modules/core-js/library/fn/typed/uint32-array.js create mode 100644 node_modules/core-js/library/fn/typed/uint8-array.js create mode 100644 node_modules/core-js/library/fn/typed/uint8-clamped-array.js create mode 100644 node_modules/core-js/library/fn/weak-map.js create mode 100644 node_modules/core-js/library/fn/weak-map/from.js create mode 100644 node_modules/core-js/library/fn/weak-map/index.js create mode 100644 node_modules/core-js/library/fn/weak-map/of.js create mode 100644 node_modules/core-js/library/fn/weak-set.js create mode 100644 node_modules/core-js/library/fn/weak-set/from.js create mode 100644 node_modules/core-js/library/fn/weak-set/index.js create mode 100644 node_modules/core-js/library/fn/weak-set/of.js create mode 100644 node_modules/core-js/library/index.js create mode 100644 node_modules/core-js/library/modules/_a-function.js create mode 100644 node_modules/core-js/library/modules/_a-number-value.js create mode 100644 node_modules/core-js/library/modules/_add-to-unscopables.js create mode 100644 node_modules/core-js/library/modules/_an-instance.js create mode 100644 node_modules/core-js/library/modules/_an-object.js create mode 100644 node_modules/core-js/library/modules/_array-copy-within.js create mode 100644 node_modules/core-js/library/modules/_array-fill.js create mode 100644 node_modules/core-js/library/modules/_array-from-iterable.js create mode 100644 node_modules/core-js/library/modules/_array-includes.js create mode 100644 node_modules/core-js/library/modules/_array-methods.js create mode 100644 node_modules/core-js/library/modules/_array-reduce.js create mode 100644 node_modules/core-js/library/modules/_array-species-constructor.js create mode 100644 node_modules/core-js/library/modules/_array-species-create.js create mode 100644 node_modules/core-js/library/modules/_bind.js create mode 100644 node_modules/core-js/library/modules/_classof.js create mode 100644 node_modules/core-js/library/modules/_cof.js create mode 100644 node_modules/core-js/library/modules/_collection-strong.js create mode 100644 node_modules/core-js/library/modules/_collection-to-json.js create mode 100644 node_modules/core-js/library/modules/_collection-weak.js create mode 100644 node_modules/core-js/library/modules/_collection.js create mode 100644 node_modules/core-js/library/modules/_core.js create mode 100644 node_modules/core-js/library/modules/_create-property.js create mode 100644 node_modules/core-js/library/modules/_ctx.js create mode 100644 node_modules/core-js/library/modules/_date-to-iso-string.js create mode 100644 node_modules/core-js/library/modules/_date-to-primitive.js create mode 100644 node_modules/core-js/library/modules/_defined.js create mode 100644 node_modules/core-js/library/modules/_descriptors.js create mode 100644 node_modules/core-js/library/modules/_dom-create.js create mode 100644 node_modules/core-js/library/modules/_entry-virtual.js create mode 100644 node_modules/core-js/library/modules/_enum-bug-keys.js create mode 100644 node_modules/core-js/library/modules/_enum-keys.js create mode 100644 node_modules/core-js/library/modules/_export.js create mode 100644 node_modules/core-js/library/modules/_fails-is-regexp.js create mode 100644 node_modules/core-js/library/modules/_fails.js create mode 100644 node_modules/core-js/library/modules/_fix-re-wks.js create mode 100644 node_modules/core-js/library/modules/_flags.js create mode 100644 node_modules/core-js/library/modules/_flatten-into-array.js create mode 100644 node_modules/core-js/library/modules/_for-of.js create mode 100644 node_modules/core-js/library/modules/_global.js create mode 100644 node_modules/core-js/library/modules/_has.js create mode 100644 node_modules/core-js/library/modules/_hide.js create mode 100644 node_modules/core-js/library/modules/_html.js create mode 100644 node_modules/core-js/library/modules/_ie8-dom-define.js create mode 100644 node_modules/core-js/library/modules/_inherit-if-required.js create mode 100644 node_modules/core-js/library/modules/_invoke.js create mode 100644 node_modules/core-js/library/modules/_iobject.js create mode 100644 node_modules/core-js/library/modules/_is-array-iter.js create mode 100644 node_modules/core-js/library/modules/_is-array.js create mode 100644 node_modules/core-js/library/modules/_is-integer.js create mode 100644 node_modules/core-js/library/modules/_is-object.js create mode 100644 node_modules/core-js/library/modules/_is-regexp.js create mode 100644 node_modules/core-js/library/modules/_iter-call.js create mode 100644 node_modules/core-js/library/modules/_iter-create.js create mode 100644 node_modules/core-js/library/modules/_iter-define.js create mode 100644 node_modules/core-js/library/modules/_iter-detect.js create mode 100644 node_modules/core-js/library/modules/_iter-step.js create mode 100644 node_modules/core-js/library/modules/_iterators.js create mode 100644 node_modules/core-js/library/modules/_keyof.js create mode 100644 node_modules/core-js/library/modules/_library.js create mode 100644 node_modules/core-js/library/modules/_math-expm1.js create mode 100644 node_modules/core-js/library/modules/_math-fround.js create mode 100644 node_modules/core-js/library/modules/_math-log1p.js create mode 100644 node_modules/core-js/library/modules/_math-scale.js create mode 100644 node_modules/core-js/library/modules/_math-sign.js create mode 100644 node_modules/core-js/library/modules/_meta.js create mode 100644 node_modules/core-js/library/modules/_metadata.js create mode 100644 node_modules/core-js/library/modules/_microtask.js create mode 100644 node_modules/core-js/library/modules/_new-promise-capability.js create mode 100644 node_modules/core-js/library/modules/_object-assign.js create mode 100644 node_modules/core-js/library/modules/_object-create.js create mode 100644 node_modules/core-js/library/modules/_object-define.js create mode 100644 node_modules/core-js/library/modules/_object-dp.js create mode 100644 node_modules/core-js/library/modules/_object-dps.js create mode 100644 node_modules/core-js/library/modules/_object-forced-pam.js create mode 100644 node_modules/core-js/library/modules/_object-gopd.js create mode 100644 node_modules/core-js/library/modules/_object-gopn-ext.js create mode 100644 node_modules/core-js/library/modules/_object-gopn.js create mode 100644 node_modules/core-js/library/modules/_object-gops.js create mode 100644 node_modules/core-js/library/modules/_object-gpo.js create mode 100644 node_modules/core-js/library/modules/_object-keys-internal.js create mode 100644 node_modules/core-js/library/modules/_object-keys.js create mode 100644 node_modules/core-js/library/modules/_object-pie.js create mode 100644 node_modules/core-js/library/modules/_object-sap.js create mode 100644 node_modules/core-js/library/modules/_object-to-array.js create mode 100644 node_modules/core-js/library/modules/_own-keys.js create mode 100644 node_modules/core-js/library/modules/_parse-float.js create mode 100644 node_modules/core-js/library/modules/_parse-int.js create mode 100644 node_modules/core-js/library/modules/_partial.js create mode 100644 node_modules/core-js/library/modules/_path.js create mode 100644 node_modules/core-js/library/modules/_perform.js create mode 100644 node_modules/core-js/library/modules/_promise-resolve.js create mode 100644 node_modules/core-js/library/modules/_property-desc.js create mode 100644 node_modules/core-js/library/modules/_redefine-all.js create mode 100644 node_modules/core-js/library/modules/_redefine.js create mode 100644 node_modules/core-js/library/modules/_replacer.js create mode 100644 node_modules/core-js/library/modules/_same-value.js create mode 100644 node_modules/core-js/library/modules/_set-collection-from.js create mode 100644 node_modules/core-js/library/modules/_set-collection-of.js create mode 100644 node_modules/core-js/library/modules/_set-proto.js create mode 100644 node_modules/core-js/library/modules/_set-species.js create mode 100644 node_modules/core-js/library/modules/_set-to-string-tag.js create mode 100644 node_modules/core-js/library/modules/_shared-key.js create mode 100644 node_modules/core-js/library/modules/_shared.js create mode 100644 node_modules/core-js/library/modules/_species-constructor.js create mode 100644 node_modules/core-js/library/modules/_strict-method.js create mode 100644 node_modules/core-js/library/modules/_string-at.js create mode 100644 node_modules/core-js/library/modules/_string-context.js create mode 100644 node_modules/core-js/library/modules/_string-html.js create mode 100644 node_modules/core-js/library/modules/_string-pad.js create mode 100644 node_modules/core-js/library/modules/_string-repeat.js create mode 100644 node_modules/core-js/library/modules/_string-trim.js create mode 100644 node_modules/core-js/library/modules/_string-ws.js create mode 100644 node_modules/core-js/library/modules/_task.js create mode 100644 node_modules/core-js/library/modules/_to-absolute-index.js create mode 100644 node_modules/core-js/library/modules/_to-index.js create mode 100644 node_modules/core-js/library/modules/_to-integer.js create mode 100644 node_modules/core-js/library/modules/_to-iobject.js create mode 100644 node_modules/core-js/library/modules/_to-length.js create mode 100644 node_modules/core-js/library/modules/_to-object.js create mode 100644 node_modules/core-js/library/modules/_to-primitive.js create mode 100644 node_modules/core-js/library/modules/_typed-array.js create mode 100644 node_modules/core-js/library/modules/_typed-buffer.js create mode 100644 node_modules/core-js/library/modules/_typed.js create mode 100644 node_modules/core-js/library/modules/_uid.js create mode 100644 node_modules/core-js/library/modules/_user-agent.js create mode 100644 node_modules/core-js/library/modules/_validate-collection.js create mode 100644 node_modules/core-js/library/modules/_wks-define.js create mode 100644 node_modules/core-js/library/modules/_wks-ext.js create mode 100644 node_modules/core-js/library/modules/_wks.js create mode 100644 node_modules/core-js/library/modules/core.delay.js create mode 100644 node_modules/core-js/library/modules/core.dict.js create mode 100644 node_modules/core-js/library/modules/core.function.part.js create mode 100644 node_modules/core-js/library/modules/core.get-iterator-method.js create mode 100644 node_modules/core-js/library/modules/core.get-iterator.js create mode 100644 node_modules/core-js/library/modules/core.is-iterable.js create mode 100644 node_modules/core-js/library/modules/core.number.iterator.js create mode 100644 node_modules/core-js/library/modules/core.object.classof.js create mode 100644 node_modules/core-js/library/modules/core.object.define.js create mode 100644 node_modules/core-js/library/modules/core.object.is-object.js create mode 100644 node_modules/core-js/library/modules/core.object.make.js create mode 100644 node_modules/core-js/library/modules/core.regexp.escape.js create mode 100644 node_modules/core-js/library/modules/core.string.escape-html.js create mode 100644 node_modules/core-js/library/modules/core.string.unescape-html.js create mode 100644 node_modules/core-js/library/modules/es5.js create mode 100644 node_modules/core-js/library/modules/es6.array.copy-within.js create mode 100644 node_modules/core-js/library/modules/es6.array.every.js create mode 100644 node_modules/core-js/library/modules/es6.array.fill.js create mode 100644 node_modules/core-js/library/modules/es6.array.filter.js create mode 100644 node_modules/core-js/library/modules/es6.array.find-index.js create mode 100644 node_modules/core-js/library/modules/es6.array.find.js create mode 100644 node_modules/core-js/library/modules/es6.array.for-each.js create mode 100644 node_modules/core-js/library/modules/es6.array.from.js create mode 100644 node_modules/core-js/library/modules/es6.array.index-of.js create mode 100644 node_modules/core-js/library/modules/es6.array.is-array.js create mode 100644 node_modules/core-js/library/modules/es6.array.iterator.js create mode 100644 node_modules/core-js/library/modules/es6.array.join.js create mode 100644 node_modules/core-js/library/modules/es6.array.last-index-of.js create mode 100644 node_modules/core-js/library/modules/es6.array.map.js create mode 100644 node_modules/core-js/library/modules/es6.array.of.js create mode 100644 node_modules/core-js/library/modules/es6.array.reduce-right.js create mode 100644 node_modules/core-js/library/modules/es6.array.reduce.js create mode 100644 node_modules/core-js/library/modules/es6.array.slice.js create mode 100644 node_modules/core-js/library/modules/es6.array.some.js create mode 100644 node_modules/core-js/library/modules/es6.array.sort.js create mode 100644 node_modules/core-js/library/modules/es6.array.species.js create mode 100644 node_modules/core-js/library/modules/es6.date.now.js create mode 100644 node_modules/core-js/library/modules/es6.date.to-iso-string.js create mode 100644 node_modules/core-js/library/modules/es6.date.to-json.js create mode 100644 node_modules/core-js/library/modules/es6.date.to-primitive.js create mode 100644 node_modules/core-js/library/modules/es6.date.to-string.js create mode 100644 node_modules/core-js/library/modules/es6.function.bind.js create mode 100644 node_modules/core-js/library/modules/es6.function.has-instance.js create mode 100644 node_modules/core-js/library/modules/es6.function.name.js create mode 100644 node_modules/core-js/library/modules/es6.map.js create mode 100644 node_modules/core-js/library/modules/es6.math.acosh.js create mode 100644 node_modules/core-js/library/modules/es6.math.asinh.js create mode 100644 node_modules/core-js/library/modules/es6.math.atanh.js create mode 100644 node_modules/core-js/library/modules/es6.math.cbrt.js create mode 100644 node_modules/core-js/library/modules/es6.math.clz32.js create mode 100644 node_modules/core-js/library/modules/es6.math.cosh.js create mode 100644 node_modules/core-js/library/modules/es6.math.expm1.js create mode 100644 node_modules/core-js/library/modules/es6.math.fround.js create mode 100644 node_modules/core-js/library/modules/es6.math.hypot.js create mode 100644 node_modules/core-js/library/modules/es6.math.imul.js create mode 100644 node_modules/core-js/library/modules/es6.math.log10.js create mode 100644 node_modules/core-js/library/modules/es6.math.log1p.js create mode 100644 node_modules/core-js/library/modules/es6.math.log2.js create mode 100644 node_modules/core-js/library/modules/es6.math.sign.js create mode 100644 node_modules/core-js/library/modules/es6.math.sinh.js create mode 100644 node_modules/core-js/library/modules/es6.math.tanh.js create mode 100644 node_modules/core-js/library/modules/es6.math.trunc.js create mode 100644 node_modules/core-js/library/modules/es6.number.constructor.js create mode 100644 node_modules/core-js/library/modules/es6.number.epsilon.js create mode 100644 node_modules/core-js/library/modules/es6.number.is-finite.js create mode 100644 node_modules/core-js/library/modules/es6.number.is-integer.js create mode 100644 node_modules/core-js/library/modules/es6.number.is-nan.js create mode 100644 node_modules/core-js/library/modules/es6.number.is-safe-integer.js create mode 100644 node_modules/core-js/library/modules/es6.number.max-safe-integer.js create mode 100644 node_modules/core-js/library/modules/es6.number.min-safe-integer.js create mode 100644 node_modules/core-js/library/modules/es6.number.parse-float.js create mode 100644 node_modules/core-js/library/modules/es6.number.parse-int.js create mode 100644 node_modules/core-js/library/modules/es6.number.to-fixed.js create mode 100644 node_modules/core-js/library/modules/es6.number.to-precision.js create mode 100644 node_modules/core-js/library/modules/es6.object.assign.js create mode 100644 node_modules/core-js/library/modules/es6.object.create.js create mode 100644 node_modules/core-js/library/modules/es6.object.define-properties.js create mode 100644 node_modules/core-js/library/modules/es6.object.define-property.js create mode 100644 node_modules/core-js/library/modules/es6.object.freeze.js create mode 100644 node_modules/core-js/library/modules/es6.object.get-own-property-descriptor.js create mode 100644 node_modules/core-js/library/modules/es6.object.get-own-property-names.js create mode 100644 node_modules/core-js/library/modules/es6.object.get-prototype-of.js create mode 100644 node_modules/core-js/library/modules/es6.object.is-extensible.js create mode 100644 node_modules/core-js/library/modules/es6.object.is-frozen.js create mode 100644 node_modules/core-js/library/modules/es6.object.is-sealed.js create mode 100644 node_modules/core-js/library/modules/es6.object.is.js create mode 100644 node_modules/core-js/library/modules/es6.object.keys.js create mode 100644 node_modules/core-js/library/modules/es6.object.prevent-extensions.js create mode 100644 node_modules/core-js/library/modules/es6.object.seal.js create mode 100644 node_modules/core-js/library/modules/es6.object.set-prototype-of.js create mode 100644 node_modules/core-js/library/modules/es6.object.to-string.js create mode 100644 node_modules/core-js/library/modules/es6.parse-float.js create mode 100644 node_modules/core-js/library/modules/es6.parse-int.js create mode 100644 node_modules/core-js/library/modules/es6.promise.js create mode 100644 node_modules/core-js/library/modules/es6.reflect.apply.js create mode 100644 node_modules/core-js/library/modules/es6.reflect.construct.js create mode 100644 node_modules/core-js/library/modules/es6.reflect.define-property.js create mode 100644 node_modules/core-js/library/modules/es6.reflect.delete-property.js create mode 100644 node_modules/core-js/library/modules/es6.reflect.enumerate.js create mode 100644 node_modules/core-js/library/modules/es6.reflect.get-own-property-descriptor.js create mode 100644 node_modules/core-js/library/modules/es6.reflect.get-prototype-of.js create mode 100644 node_modules/core-js/library/modules/es6.reflect.get.js create mode 100644 node_modules/core-js/library/modules/es6.reflect.has.js create mode 100644 node_modules/core-js/library/modules/es6.reflect.is-extensible.js create mode 100644 node_modules/core-js/library/modules/es6.reflect.own-keys.js create mode 100644 node_modules/core-js/library/modules/es6.reflect.prevent-extensions.js create mode 100644 node_modules/core-js/library/modules/es6.reflect.set-prototype-of.js create mode 100644 node_modules/core-js/library/modules/es6.reflect.set.js create mode 100644 node_modules/core-js/library/modules/es6.regexp.constructor.js create mode 100644 node_modules/core-js/library/modules/es6.regexp.flags.js create mode 100644 node_modules/core-js/library/modules/es6.regexp.match.js create mode 100644 node_modules/core-js/library/modules/es6.regexp.replace.js create mode 100644 node_modules/core-js/library/modules/es6.regexp.search.js create mode 100644 node_modules/core-js/library/modules/es6.regexp.split.js create mode 100644 node_modules/core-js/library/modules/es6.regexp.to-string.js create mode 100644 node_modules/core-js/library/modules/es6.set.js create mode 100644 node_modules/core-js/library/modules/es6.string.anchor.js create mode 100644 node_modules/core-js/library/modules/es6.string.big.js create mode 100644 node_modules/core-js/library/modules/es6.string.blink.js create mode 100644 node_modules/core-js/library/modules/es6.string.bold.js create mode 100644 node_modules/core-js/library/modules/es6.string.code-point-at.js create mode 100644 node_modules/core-js/library/modules/es6.string.ends-with.js create mode 100644 node_modules/core-js/library/modules/es6.string.fixed.js create mode 100644 node_modules/core-js/library/modules/es6.string.fontcolor.js create mode 100644 node_modules/core-js/library/modules/es6.string.fontsize.js create mode 100644 node_modules/core-js/library/modules/es6.string.from-code-point.js create mode 100644 node_modules/core-js/library/modules/es6.string.includes.js create mode 100644 node_modules/core-js/library/modules/es6.string.italics.js create mode 100644 node_modules/core-js/library/modules/es6.string.iterator.js create mode 100644 node_modules/core-js/library/modules/es6.string.link.js create mode 100644 node_modules/core-js/library/modules/es6.string.raw.js create mode 100644 node_modules/core-js/library/modules/es6.string.repeat.js create mode 100644 node_modules/core-js/library/modules/es6.string.small.js create mode 100644 node_modules/core-js/library/modules/es6.string.starts-with.js create mode 100644 node_modules/core-js/library/modules/es6.string.strike.js create mode 100644 node_modules/core-js/library/modules/es6.string.sub.js create mode 100644 node_modules/core-js/library/modules/es6.string.sup.js create mode 100644 node_modules/core-js/library/modules/es6.string.trim.js create mode 100644 node_modules/core-js/library/modules/es6.symbol.js create mode 100644 node_modules/core-js/library/modules/es6.typed.array-buffer.js create mode 100644 node_modules/core-js/library/modules/es6.typed.data-view.js create mode 100644 node_modules/core-js/library/modules/es6.typed.float32-array.js create mode 100644 node_modules/core-js/library/modules/es6.typed.float64-array.js create mode 100644 node_modules/core-js/library/modules/es6.typed.int16-array.js create mode 100644 node_modules/core-js/library/modules/es6.typed.int32-array.js create mode 100644 node_modules/core-js/library/modules/es6.typed.int8-array.js create mode 100644 node_modules/core-js/library/modules/es6.typed.uint16-array.js create mode 100644 node_modules/core-js/library/modules/es6.typed.uint32-array.js create mode 100644 node_modules/core-js/library/modules/es6.typed.uint8-array.js create mode 100644 node_modules/core-js/library/modules/es6.typed.uint8-clamped-array.js create mode 100644 node_modules/core-js/library/modules/es6.weak-map.js create mode 100644 node_modules/core-js/library/modules/es6.weak-set.js create mode 100644 node_modules/core-js/library/modules/es7.array.flat-map.js create mode 100644 node_modules/core-js/library/modules/es7.array.flatten.js create mode 100644 node_modules/core-js/library/modules/es7.array.includes.js create mode 100644 node_modules/core-js/library/modules/es7.asap.js create mode 100644 node_modules/core-js/library/modules/es7.error.is-error.js create mode 100644 node_modules/core-js/library/modules/es7.global.js create mode 100644 node_modules/core-js/library/modules/es7.map.from.js create mode 100644 node_modules/core-js/library/modules/es7.map.of.js create mode 100644 node_modules/core-js/library/modules/es7.map.to-json.js create mode 100644 node_modules/core-js/library/modules/es7.math.clamp.js create mode 100644 node_modules/core-js/library/modules/es7.math.deg-per-rad.js create mode 100644 node_modules/core-js/library/modules/es7.math.degrees.js create mode 100644 node_modules/core-js/library/modules/es7.math.fscale.js create mode 100644 node_modules/core-js/library/modules/es7.math.iaddh.js create mode 100644 node_modules/core-js/library/modules/es7.math.imulh.js create mode 100644 node_modules/core-js/library/modules/es7.math.isubh.js create mode 100644 node_modules/core-js/library/modules/es7.math.rad-per-deg.js create mode 100644 node_modules/core-js/library/modules/es7.math.radians.js create mode 100644 node_modules/core-js/library/modules/es7.math.scale.js create mode 100644 node_modules/core-js/library/modules/es7.math.signbit.js create mode 100644 node_modules/core-js/library/modules/es7.math.umulh.js create mode 100644 node_modules/core-js/library/modules/es7.object.define-getter.js create mode 100644 node_modules/core-js/library/modules/es7.object.define-setter.js create mode 100644 node_modules/core-js/library/modules/es7.object.entries.js create mode 100644 node_modules/core-js/library/modules/es7.object.get-own-property-descriptors.js create mode 100644 node_modules/core-js/library/modules/es7.object.lookup-getter.js create mode 100644 node_modules/core-js/library/modules/es7.object.lookup-setter.js create mode 100644 node_modules/core-js/library/modules/es7.object.values.js create mode 100644 node_modules/core-js/library/modules/es7.observable.js create mode 100644 node_modules/core-js/library/modules/es7.promise.finally.js create mode 100644 node_modules/core-js/library/modules/es7.promise.try.js create mode 100644 node_modules/core-js/library/modules/es7.reflect.define-metadata.js create mode 100644 node_modules/core-js/library/modules/es7.reflect.delete-metadata.js create mode 100644 node_modules/core-js/library/modules/es7.reflect.get-metadata-keys.js create mode 100644 node_modules/core-js/library/modules/es7.reflect.get-metadata.js create mode 100644 node_modules/core-js/library/modules/es7.reflect.get-own-metadata-keys.js create mode 100644 node_modules/core-js/library/modules/es7.reflect.get-own-metadata.js create mode 100644 node_modules/core-js/library/modules/es7.reflect.has-metadata.js create mode 100644 node_modules/core-js/library/modules/es7.reflect.has-own-metadata.js create mode 100644 node_modules/core-js/library/modules/es7.reflect.metadata.js create mode 100644 node_modules/core-js/library/modules/es7.set.from.js create mode 100644 node_modules/core-js/library/modules/es7.set.of.js create mode 100644 node_modules/core-js/library/modules/es7.set.to-json.js create mode 100644 node_modules/core-js/library/modules/es7.string.at.js create mode 100644 node_modules/core-js/library/modules/es7.string.match-all.js create mode 100644 node_modules/core-js/library/modules/es7.string.pad-end.js create mode 100644 node_modules/core-js/library/modules/es7.string.pad-start.js create mode 100644 node_modules/core-js/library/modules/es7.string.trim-left.js create mode 100644 node_modules/core-js/library/modules/es7.string.trim-right.js create mode 100644 node_modules/core-js/library/modules/es7.symbol.async-iterator.js create mode 100644 node_modules/core-js/library/modules/es7.symbol.observable.js create mode 100644 node_modules/core-js/library/modules/es7.system.global.js create mode 100644 node_modules/core-js/library/modules/es7.weak-map.from.js create mode 100644 node_modules/core-js/library/modules/es7.weak-map.of.js create mode 100644 node_modules/core-js/library/modules/es7.weak-set.from.js create mode 100644 node_modules/core-js/library/modules/es7.weak-set.of.js create mode 100644 node_modules/core-js/library/modules/web.dom.iterable.js create mode 100644 node_modules/core-js/library/modules/web.immediate.js create mode 100644 node_modules/core-js/library/modules/web.timers.js create mode 100644 node_modules/core-js/library/shim.js create mode 100644 node_modules/core-js/library/stage/0.js create mode 100644 node_modules/core-js/library/stage/1.js create mode 100644 node_modules/core-js/library/stage/2.js create mode 100644 node_modules/core-js/library/stage/3.js create mode 100644 node_modules/core-js/library/stage/4.js create mode 100644 node_modules/core-js/library/stage/index.js create mode 100644 node_modules/core-js/library/stage/pre.js create mode 100644 node_modules/core-js/library/web/dom-collections.js create mode 100644 node_modules/core-js/library/web/immediate.js create mode 100644 node_modules/core-js/library/web/index.js create mode 100644 node_modules/core-js/library/web/timers.js create mode 100644 node_modules/core-js/modules/_a-function.js create mode 100644 node_modules/core-js/modules/_a-number-value.js create mode 100644 node_modules/core-js/modules/_add-to-unscopables.js create mode 100644 node_modules/core-js/modules/_an-instance.js create mode 100644 node_modules/core-js/modules/_an-object.js create mode 100644 node_modules/core-js/modules/_array-copy-within.js create mode 100644 node_modules/core-js/modules/_array-fill.js create mode 100644 node_modules/core-js/modules/_array-from-iterable.js create mode 100644 node_modules/core-js/modules/_array-includes.js create mode 100644 node_modules/core-js/modules/_array-methods.js create mode 100644 node_modules/core-js/modules/_array-reduce.js create mode 100644 node_modules/core-js/modules/_array-species-constructor.js create mode 100644 node_modules/core-js/modules/_array-species-create.js create mode 100644 node_modules/core-js/modules/_bind.js create mode 100644 node_modules/core-js/modules/_classof.js create mode 100644 node_modules/core-js/modules/_cof.js create mode 100644 node_modules/core-js/modules/_collection-strong.js create mode 100644 node_modules/core-js/modules/_collection-to-json.js create mode 100644 node_modules/core-js/modules/_collection-weak.js create mode 100644 node_modules/core-js/modules/_collection.js create mode 100644 node_modules/core-js/modules/_core.js create mode 100644 node_modules/core-js/modules/_create-property.js create mode 100644 node_modules/core-js/modules/_ctx.js create mode 100644 node_modules/core-js/modules/_date-to-iso-string.js create mode 100644 node_modules/core-js/modules/_date-to-primitive.js create mode 100644 node_modules/core-js/modules/_defined.js create mode 100644 node_modules/core-js/modules/_descriptors.js create mode 100644 node_modules/core-js/modules/_dom-create.js create mode 100644 node_modules/core-js/modules/_entry-virtual.js create mode 100644 node_modules/core-js/modules/_enum-bug-keys.js create mode 100644 node_modules/core-js/modules/_enum-keys.js create mode 100644 node_modules/core-js/modules/_export.js create mode 100644 node_modules/core-js/modules/_fails-is-regexp.js create mode 100644 node_modules/core-js/modules/_fails.js create mode 100644 node_modules/core-js/modules/_fix-re-wks.js create mode 100644 node_modules/core-js/modules/_flags.js create mode 100644 node_modules/core-js/modules/_flatten-into-array.js create mode 100644 node_modules/core-js/modules/_for-of.js create mode 100644 node_modules/core-js/modules/_global.js create mode 100644 node_modules/core-js/modules/_has.js create mode 100644 node_modules/core-js/modules/_hide.js create mode 100644 node_modules/core-js/modules/_html.js create mode 100644 node_modules/core-js/modules/_ie8-dom-define.js create mode 100644 node_modules/core-js/modules/_inherit-if-required.js create mode 100644 node_modules/core-js/modules/_invoke.js create mode 100644 node_modules/core-js/modules/_iobject.js create mode 100644 node_modules/core-js/modules/_is-array-iter.js create mode 100644 node_modules/core-js/modules/_is-array.js create mode 100644 node_modules/core-js/modules/_is-integer.js create mode 100644 node_modules/core-js/modules/_is-object.js create mode 100644 node_modules/core-js/modules/_is-regexp.js create mode 100644 node_modules/core-js/modules/_iter-call.js create mode 100644 node_modules/core-js/modules/_iter-create.js create mode 100644 node_modules/core-js/modules/_iter-define.js create mode 100644 node_modules/core-js/modules/_iter-detect.js create mode 100644 node_modules/core-js/modules/_iter-step.js create mode 100644 node_modules/core-js/modules/_iterators.js create mode 100644 node_modules/core-js/modules/_keyof.js create mode 100644 node_modules/core-js/modules/_library.js create mode 100644 node_modules/core-js/modules/_math-expm1.js create mode 100644 node_modules/core-js/modules/_math-fround.js create mode 100644 node_modules/core-js/modules/_math-log1p.js create mode 100644 node_modules/core-js/modules/_math-scale.js create mode 100644 node_modules/core-js/modules/_math-sign.js create mode 100644 node_modules/core-js/modules/_meta.js create mode 100644 node_modules/core-js/modules/_metadata.js create mode 100644 node_modules/core-js/modules/_microtask.js create mode 100644 node_modules/core-js/modules/_new-promise-capability.js create mode 100644 node_modules/core-js/modules/_object-assign.js create mode 100644 node_modules/core-js/modules/_object-create.js create mode 100644 node_modules/core-js/modules/_object-define.js create mode 100644 node_modules/core-js/modules/_object-dp.js create mode 100644 node_modules/core-js/modules/_object-dps.js create mode 100644 node_modules/core-js/modules/_object-forced-pam.js create mode 100644 node_modules/core-js/modules/_object-gopd.js create mode 100644 node_modules/core-js/modules/_object-gopn-ext.js create mode 100644 node_modules/core-js/modules/_object-gopn.js create mode 100644 node_modules/core-js/modules/_object-gops.js create mode 100644 node_modules/core-js/modules/_object-gpo.js create mode 100644 node_modules/core-js/modules/_object-keys-internal.js create mode 100644 node_modules/core-js/modules/_object-keys.js create mode 100644 node_modules/core-js/modules/_object-pie.js create mode 100644 node_modules/core-js/modules/_object-sap.js create mode 100644 node_modules/core-js/modules/_object-to-array.js create mode 100644 node_modules/core-js/modules/_own-keys.js create mode 100644 node_modules/core-js/modules/_parse-float.js create mode 100644 node_modules/core-js/modules/_parse-int.js create mode 100644 node_modules/core-js/modules/_partial.js create mode 100644 node_modules/core-js/modules/_path.js create mode 100644 node_modules/core-js/modules/_perform.js create mode 100644 node_modules/core-js/modules/_promise-resolve.js create mode 100644 node_modules/core-js/modules/_property-desc.js create mode 100644 node_modules/core-js/modules/_redefine-all.js create mode 100644 node_modules/core-js/modules/_redefine.js create mode 100644 node_modules/core-js/modules/_replacer.js create mode 100644 node_modules/core-js/modules/_same-value.js create mode 100644 node_modules/core-js/modules/_set-collection-from.js create mode 100644 node_modules/core-js/modules/_set-collection-of.js create mode 100644 node_modules/core-js/modules/_set-proto.js create mode 100644 node_modules/core-js/modules/_set-species.js create mode 100644 node_modules/core-js/modules/_set-to-string-tag.js create mode 100644 node_modules/core-js/modules/_shared-key.js create mode 100644 node_modules/core-js/modules/_shared.js create mode 100644 node_modules/core-js/modules/_species-constructor.js create mode 100644 node_modules/core-js/modules/_strict-method.js create mode 100644 node_modules/core-js/modules/_string-at.js create mode 100644 node_modules/core-js/modules/_string-context.js create mode 100644 node_modules/core-js/modules/_string-html.js create mode 100644 node_modules/core-js/modules/_string-pad.js create mode 100644 node_modules/core-js/modules/_string-repeat.js create mode 100644 node_modules/core-js/modules/_string-trim.js create mode 100644 node_modules/core-js/modules/_string-ws.js create mode 100644 node_modules/core-js/modules/_task.js create mode 100644 node_modules/core-js/modules/_to-absolute-index.js create mode 100644 node_modules/core-js/modules/_to-index.js create mode 100644 node_modules/core-js/modules/_to-integer.js create mode 100644 node_modules/core-js/modules/_to-iobject.js create mode 100644 node_modules/core-js/modules/_to-length.js create mode 100644 node_modules/core-js/modules/_to-object.js create mode 100644 node_modules/core-js/modules/_to-primitive.js create mode 100644 node_modules/core-js/modules/_typed-array.js create mode 100644 node_modules/core-js/modules/_typed-buffer.js create mode 100644 node_modules/core-js/modules/_typed.js create mode 100644 node_modules/core-js/modules/_uid.js create mode 100644 node_modules/core-js/modules/_user-agent.js create mode 100644 node_modules/core-js/modules/_validate-collection.js create mode 100644 node_modules/core-js/modules/_wks-define.js create mode 100644 node_modules/core-js/modules/_wks-ext.js create mode 100644 node_modules/core-js/modules/_wks.js create mode 100644 node_modules/core-js/modules/core.delay.js create mode 100644 node_modules/core-js/modules/core.dict.js create mode 100644 node_modules/core-js/modules/core.function.part.js create mode 100644 node_modules/core-js/modules/core.get-iterator-method.js create mode 100644 node_modules/core-js/modules/core.get-iterator.js create mode 100644 node_modules/core-js/modules/core.is-iterable.js create mode 100644 node_modules/core-js/modules/core.number.iterator.js create mode 100644 node_modules/core-js/modules/core.object.classof.js create mode 100644 node_modules/core-js/modules/core.object.define.js create mode 100644 node_modules/core-js/modules/core.object.is-object.js create mode 100644 node_modules/core-js/modules/core.object.make.js create mode 100644 node_modules/core-js/modules/core.regexp.escape.js create mode 100644 node_modules/core-js/modules/core.string.escape-html.js create mode 100644 node_modules/core-js/modules/core.string.unescape-html.js create mode 100644 node_modules/core-js/modules/es5.js create mode 100644 node_modules/core-js/modules/es6.array.copy-within.js create mode 100644 node_modules/core-js/modules/es6.array.every.js create mode 100644 node_modules/core-js/modules/es6.array.fill.js create mode 100644 node_modules/core-js/modules/es6.array.filter.js create mode 100644 node_modules/core-js/modules/es6.array.find-index.js create mode 100644 node_modules/core-js/modules/es6.array.find.js create mode 100644 node_modules/core-js/modules/es6.array.for-each.js create mode 100644 node_modules/core-js/modules/es6.array.from.js create mode 100644 node_modules/core-js/modules/es6.array.index-of.js create mode 100644 node_modules/core-js/modules/es6.array.is-array.js create mode 100644 node_modules/core-js/modules/es6.array.iterator.js create mode 100644 node_modules/core-js/modules/es6.array.join.js create mode 100644 node_modules/core-js/modules/es6.array.last-index-of.js create mode 100644 node_modules/core-js/modules/es6.array.map.js create mode 100644 node_modules/core-js/modules/es6.array.of.js create mode 100644 node_modules/core-js/modules/es6.array.reduce-right.js create mode 100644 node_modules/core-js/modules/es6.array.reduce.js create mode 100644 node_modules/core-js/modules/es6.array.slice.js create mode 100644 node_modules/core-js/modules/es6.array.some.js create mode 100644 node_modules/core-js/modules/es6.array.sort.js create mode 100644 node_modules/core-js/modules/es6.array.species.js create mode 100644 node_modules/core-js/modules/es6.date.now.js create mode 100644 node_modules/core-js/modules/es6.date.to-iso-string.js create mode 100644 node_modules/core-js/modules/es6.date.to-json.js create mode 100644 node_modules/core-js/modules/es6.date.to-primitive.js create mode 100644 node_modules/core-js/modules/es6.date.to-string.js create mode 100644 node_modules/core-js/modules/es6.function.bind.js create mode 100644 node_modules/core-js/modules/es6.function.has-instance.js create mode 100644 node_modules/core-js/modules/es6.function.name.js create mode 100644 node_modules/core-js/modules/es6.map.js create mode 100644 node_modules/core-js/modules/es6.math.acosh.js create mode 100644 node_modules/core-js/modules/es6.math.asinh.js create mode 100644 node_modules/core-js/modules/es6.math.atanh.js create mode 100644 node_modules/core-js/modules/es6.math.cbrt.js create mode 100644 node_modules/core-js/modules/es6.math.clz32.js create mode 100644 node_modules/core-js/modules/es6.math.cosh.js create mode 100644 node_modules/core-js/modules/es6.math.expm1.js create mode 100644 node_modules/core-js/modules/es6.math.fround.js create mode 100644 node_modules/core-js/modules/es6.math.hypot.js create mode 100644 node_modules/core-js/modules/es6.math.imul.js create mode 100644 node_modules/core-js/modules/es6.math.log10.js create mode 100644 node_modules/core-js/modules/es6.math.log1p.js create mode 100644 node_modules/core-js/modules/es6.math.log2.js create mode 100644 node_modules/core-js/modules/es6.math.sign.js create mode 100644 node_modules/core-js/modules/es6.math.sinh.js create mode 100644 node_modules/core-js/modules/es6.math.tanh.js create mode 100644 node_modules/core-js/modules/es6.math.trunc.js create mode 100644 node_modules/core-js/modules/es6.number.constructor.js create mode 100644 node_modules/core-js/modules/es6.number.epsilon.js create mode 100644 node_modules/core-js/modules/es6.number.is-finite.js create mode 100644 node_modules/core-js/modules/es6.number.is-integer.js create mode 100644 node_modules/core-js/modules/es6.number.is-nan.js create mode 100644 node_modules/core-js/modules/es6.number.is-safe-integer.js create mode 100644 node_modules/core-js/modules/es6.number.max-safe-integer.js create mode 100644 node_modules/core-js/modules/es6.number.min-safe-integer.js create mode 100644 node_modules/core-js/modules/es6.number.parse-float.js create mode 100644 node_modules/core-js/modules/es6.number.parse-int.js create mode 100644 node_modules/core-js/modules/es6.number.to-fixed.js create mode 100644 node_modules/core-js/modules/es6.number.to-precision.js create mode 100644 node_modules/core-js/modules/es6.object.assign.js create mode 100644 node_modules/core-js/modules/es6.object.create.js create mode 100644 node_modules/core-js/modules/es6.object.define-properties.js create mode 100644 node_modules/core-js/modules/es6.object.define-property.js create mode 100644 node_modules/core-js/modules/es6.object.freeze.js create mode 100644 node_modules/core-js/modules/es6.object.get-own-property-descriptor.js create mode 100644 node_modules/core-js/modules/es6.object.get-own-property-names.js create mode 100644 node_modules/core-js/modules/es6.object.get-prototype-of.js create mode 100644 node_modules/core-js/modules/es6.object.is-extensible.js create mode 100644 node_modules/core-js/modules/es6.object.is-frozen.js create mode 100644 node_modules/core-js/modules/es6.object.is-sealed.js create mode 100644 node_modules/core-js/modules/es6.object.is.js create mode 100644 node_modules/core-js/modules/es6.object.keys.js create mode 100644 node_modules/core-js/modules/es6.object.prevent-extensions.js create mode 100644 node_modules/core-js/modules/es6.object.seal.js create mode 100644 node_modules/core-js/modules/es6.object.set-prototype-of.js create mode 100644 node_modules/core-js/modules/es6.object.to-string.js create mode 100644 node_modules/core-js/modules/es6.parse-float.js create mode 100644 node_modules/core-js/modules/es6.parse-int.js create mode 100644 node_modules/core-js/modules/es6.promise.js create mode 100644 node_modules/core-js/modules/es6.reflect.apply.js create mode 100644 node_modules/core-js/modules/es6.reflect.construct.js create mode 100644 node_modules/core-js/modules/es6.reflect.define-property.js create mode 100644 node_modules/core-js/modules/es6.reflect.delete-property.js create mode 100644 node_modules/core-js/modules/es6.reflect.enumerate.js create mode 100644 node_modules/core-js/modules/es6.reflect.get-own-property-descriptor.js create mode 100644 node_modules/core-js/modules/es6.reflect.get-prototype-of.js create mode 100644 node_modules/core-js/modules/es6.reflect.get.js create mode 100644 node_modules/core-js/modules/es6.reflect.has.js create mode 100644 node_modules/core-js/modules/es6.reflect.is-extensible.js create mode 100644 node_modules/core-js/modules/es6.reflect.own-keys.js create mode 100644 node_modules/core-js/modules/es6.reflect.prevent-extensions.js create mode 100644 node_modules/core-js/modules/es6.reflect.set-prototype-of.js create mode 100644 node_modules/core-js/modules/es6.reflect.set.js create mode 100644 node_modules/core-js/modules/es6.regexp.constructor.js create mode 100644 node_modules/core-js/modules/es6.regexp.flags.js create mode 100644 node_modules/core-js/modules/es6.regexp.match.js create mode 100644 node_modules/core-js/modules/es6.regexp.replace.js create mode 100644 node_modules/core-js/modules/es6.regexp.search.js create mode 100644 node_modules/core-js/modules/es6.regexp.split.js create mode 100644 node_modules/core-js/modules/es6.regexp.to-string.js create mode 100644 node_modules/core-js/modules/es6.set.js create mode 100644 node_modules/core-js/modules/es6.string.anchor.js create mode 100644 node_modules/core-js/modules/es6.string.big.js create mode 100644 node_modules/core-js/modules/es6.string.blink.js create mode 100644 node_modules/core-js/modules/es6.string.bold.js create mode 100644 node_modules/core-js/modules/es6.string.code-point-at.js create mode 100644 node_modules/core-js/modules/es6.string.ends-with.js create mode 100644 node_modules/core-js/modules/es6.string.fixed.js create mode 100644 node_modules/core-js/modules/es6.string.fontcolor.js create mode 100644 node_modules/core-js/modules/es6.string.fontsize.js create mode 100644 node_modules/core-js/modules/es6.string.from-code-point.js create mode 100644 node_modules/core-js/modules/es6.string.includes.js create mode 100644 node_modules/core-js/modules/es6.string.italics.js create mode 100644 node_modules/core-js/modules/es6.string.iterator.js create mode 100644 node_modules/core-js/modules/es6.string.link.js create mode 100644 node_modules/core-js/modules/es6.string.raw.js create mode 100644 node_modules/core-js/modules/es6.string.repeat.js create mode 100644 node_modules/core-js/modules/es6.string.small.js create mode 100644 node_modules/core-js/modules/es6.string.starts-with.js create mode 100644 node_modules/core-js/modules/es6.string.strike.js create mode 100644 node_modules/core-js/modules/es6.string.sub.js create mode 100644 node_modules/core-js/modules/es6.string.sup.js create mode 100644 node_modules/core-js/modules/es6.string.trim.js create mode 100644 node_modules/core-js/modules/es6.symbol.js create mode 100644 node_modules/core-js/modules/es6.typed.array-buffer.js create mode 100644 node_modules/core-js/modules/es6.typed.data-view.js create mode 100644 node_modules/core-js/modules/es6.typed.float32-array.js create mode 100644 node_modules/core-js/modules/es6.typed.float64-array.js create mode 100644 node_modules/core-js/modules/es6.typed.int16-array.js create mode 100644 node_modules/core-js/modules/es6.typed.int32-array.js create mode 100644 node_modules/core-js/modules/es6.typed.int8-array.js create mode 100644 node_modules/core-js/modules/es6.typed.uint16-array.js create mode 100644 node_modules/core-js/modules/es6.typed.uint32-array.js create mode 100644 node_modules/core-js/modules/es6.typed.uint8-array.js create mode 100644 node_modules/core-js/modules/es6.typed.uint8-clamped-array.js create mode 100644 node_modules/core-js/modules/es6.weak-map.js create mode 100644 node_modules/core-js/modules/es6.weak-set.js create mode 100644 node_modules/core-js/modules/es7.array.flat-map.js create mode 100644 node_modules/core-js/modules/es7.array.flatten.js create mode 100644 node_modules/core-js/modules/es7.array.includes.js create mode 100644 node_modules/core-js/modules/es7.asap.js create mode 100644 node_modules/core-js/modules/es7.error.is-error.js create mode 100644 node_modules/core-js/modules/es7.global.js create mode 100644 node_modules/core-js/modules/es7.map.from.js create mode 100644 node_modules/core-js/modules/es7.map.of.js create mode 100644 node_modules/core-js/modules/es7.map.to-json.js create mode 100644 node_modules/core-js/modules/es7.math.clamp.js create mode 100644 node_modules/core-js/modules/es7.math.deg-per-rad.js create mode 100644 node_modules/core-js/modules/es7.math.degrees.js create mode 100644 node_modules/core-js/modules/es7.math.fscale.js create mode 100644 node_modules/core-js/modules/es7.math.iaddh.js create mode 100644 node_modules/core-js/modules/es7.math.imulh.js create mode 100644 node_modules/core-js/modules/es7.math.isubh.js create mode 100644 node_modules/core-js/modules/es7.math.rad-per-deg.js create mode 100644 node_modules/core-js/modules/es7.math.radians.js create mode 100644 node_modules/core-js/modules/es7.math.scale.js create mode 100644 node_modules/core-js/modules/es7.math.signbit.js create mode 100644 node_modules/core-js/modules/es7.math.umulh.js create mode 100644 node_modules/core-js/modules/es7.object.define-getter.js create mode 100644 node_modules/core-js/modules/es7.object.define-setter.js create mode 100644 node_modules/core-js/modules/es7.object.entries.js create mode 100644 node_modules/core-js/modules/es7.object.get-own-property-descriptors.js create mode 100644 node_modules/core-js/modules/es7.object.lookup-getter.js create mode 100644 node_modules/core-js/modules/es7.object.lookup-setter.js create mode 100644 node_modules/core-js/modules/es7.object.values.js create mode 100644 node_modules/core-js/modules/es7.observable.js create mode 100644 node_modules/core-js/modules/es7.promise.finally.js create mode 100644 node_modules/core-js/modules/es7.promise.try.js create mode 100644 node_modules/core-js/modules/es7.reflect.define-metadata.js create mode 100644 node_modules/core-js/modules/es7.reflect.delete-metadata.js create mode 100644 node_modules/core-js/modules/es7.reflect.get-metadata-keys.js create mode 100644 node_modules/core-js/modules/es7.reflect.get-metadata.js create mode 100644 node_modules/core-js/modules/es7.reflect.get-own-metadata-keys.js create mode 100644 node_modules/core-js/modules/es7.reflect.get-own-metadata.js create mode 100644 node_modules/core-js/modules/es7.reflect.has-metadata.js create mode 100644 node_modules/core-js/modules/es7.reflect.has-own-metadata.js create mode 100644 node_modules/core-js/modules/es7.reflect.metadata.js create mode 100644 node_modules/core-js/modules/es7.set.from.js create mode 100644 node_modules/core-js/modules/es7.set.of.js create mode 100644 node_modules/core-js/modules/es7.set.to-json.js create mode 100644 node_modules/core-js/modules/es7.string.at.js create mode 100644 node_modules/core-js/modules/es7.string.match-all.js create mode 100644 node_modules/core-js/modules/es7.string.pad-end.js create mode 100644 node_modules/core-js/modules/es7.string.pad-start.js create mode 100644 node_modules/core-js/modules/es7.string.trim-left.js create mode 100644 node_modules/core-js/modules/es7.string.trim-right.js create mode 100644 node_modules/core-js/modules/es7.symbol.async-iterator.js create mode 100644 node_modules/core-js/modules/es7.symbol.observable.js create mode 100644 node_modules/core-js/modules/es7.system.global.js create mode 100644 node_modules/core-js/modules/es7.weak-map.from.js create mode 100644 node_modules/core-js/modules/es7.weak-map.of.js create mode 100644 node_modules/core-js/modules/es7.weak-set.from.js create mode 100644 node_modules/core-js/modules/es7.weak-set.of.js create mode 100644 node_modules/core-js/modules/library/_add-to-unscopables.js create mode 100644 node_modules/core-js/modules/library/_collection.js create mode 100644 node_modules/core-js/modules/library/_export.js create mode 100644 node_modules/core-js/modules/library/_library.js create mode 100644 node_modules/core-js/modules/library/_path.js create mode 100644 node_modules/core-js/modules/library/_redefine-all.js create mode 100644 node_modules/core-js/modules/library/_redefine.js create mode 100644 node_modules/core-js/modules/library/_set-species.js create mode 100644 node_modules/core-js/modules/library/es6.date.to-json.js create mode 100644 node_modules/core-js/modules/library/es6.date.to-primitive.js create mode 100644 node_modules/core-js/modules/library/es6.date.to-string.js create mode 100644 node_modules/core-js/modules/library/es6.function.name.js create mode 100644 node_modules/core-js/modules/library/es6.number.constructor.js create mode 100644 node_modules/core-js/modules/library/es6.object.to-string.js create mode 100644 node_modules/core-js/modules/library/es6.regexp.constructor.js create mode 100644 node_modules/core-js/modules/library/es6.regexp.flags.js create mode 100644 node_modules/core-js/modules/library/es6.regexp.match.js create mode 100644 node_modules/core-js/modules/library/es6.regexp.replace.js create mode 100644 node_modules/core-js/modules/library/es6.regexp.search.js create mode 100644 node_modules/core-js/modules/library/es6.regexp.split.js create mode 100644 node_modules/core-js/modules/library/es6.regexp.to-string.js create mode 100644 node_modules/core-js/modules/library/web.dom.iterable.js create mode 100644 node_modules/core-js/modules/web.dom.iterable.js create mode 100644 node_modules/core-js/modules/web.immediate.js create mode 100644 node_modules/core-js/modules/web.timers.js create mode 100644 node_modules/core-js/package.json create mode 100644 node_modules/core-js/shim.js create mode 100644 node_modules/core-js/stage/0.js create mode 100644 node_modules/core-js/stage/1.js create mode 100644 node_modules/core-js/stage/2.js create mode 100644 node_modules/core-js/stage/3.js create mode 100644 node_modules/core-js/stage/4.js create mode 100644 node_modules/core-js/stage/index.js create mode 100644 node_modules/core-js/stage/pre.js create mode 100644 node_modules/core-js/web/dom-collections.js create mode 100644 node_modules/core-js/web/immediate.js create mode 100644 node_modules/core-js/web/index.js create mode 100644 node_modules/core-js/web/timers.js create mode 100644 node_modules/core-util-is/LICENSE create mode 100644 node_modules/core-util-is/README.md create mode 100644 node_modules/core-util-is/float.patch create mode 100644 node_modules/core-util-is/lib/util.js create mode 100644 node_modules/core-util-is/package.json create mode 100644 node_modules/core-util-is/test.js create mode 100644 node_modules/create-error-class/index.js create mode 100644 node_modules/create-error-class/license create mode 100644 node_modules/create-error-class/package.json create mode 100644 node_modules/create-error-class/readme.md create mode 100644 node_modules/cross-spawn/CHANGELOG.md create mode 100644 node_modules/cross-spawn/LICENSE create mode 100644 node_modules/cross-spawn/README.md create mode 100644 node_modules/cross-spawn/index.js create mode 100644 node_modules/cross-spawn/lib/enoent.js create mode 100644 node_modules/cross-spawn/lib/parse.js create mode 100644 node_modules/cross-spawn/lib/util/escapeArgument.js create mode 100644 node_modules/cross-spawn/lib/util/escapeCommand.js create mode 100644 node_modules/cross-spawn/lib/util/hasEmptyArgumentBug.js create mode 100644 node_modules/cross-spawn/lib/util/readShebang.js create mode 100644 node_modules/cross-spawn/lib/util/resolveCommand.js create mode 100644 node_modules/cross-spawn/package.json create mode 100644 node_modules/crypto-random-string/index.js create mode 100644 node_modules/crypto-random-string/license create mode 100644 node_modules/crypto-random-string/package.json create mode 100644 node_modules/crypto-random-string/readme.md create mode 100644 node_modules/debug/.coveralls.yml create mode 100644 node_modules/debug/.eslintrc create mode 100644 node_modules/debug/.npmignore create mode 100644 node_modules/debug/.travis.yml create mode 100644 node_modules/debug/CHANGELOG.md create mode 100644 node_modules/debug/LICENSE create mode 100644 node_modules/debug/Makefile create mode 100644 node_modules/debug/README.md create mode 100644 node_modules/debug/component.json create mode 100644 node_modules/debug/karma.conf.js create mode 100644 node_modules/debug/node.js create mode 100644 node_modules/debug/package.json create mode 100644 node_modules/debug/src/browser.js create mode 100644 node_modules/debug/src/debug.js create mode 100644 node_modules/debug/src/index.js create mode 100644 node_modules/debug/src/inspector-log.js create mode 100644 node_modules/debug/src/node.js create mode 100644 node_modules/decamelize/index.js create mode 100644 node_modules/decamelize/license create mode 100644 node_modules/decamelize/package.json create mode 100644 node_modules/decamelize/readme.md create mode 100644 node_modules/decode-uri-component/index.js create mode 100644 node_modules/decode-uri-component/license create mode 100644 node_modules/decode-uri-component/package.json create mode 100644 node_modules/decode-uri-component/readme.md create mode 100644 node_modules/deep-extend/CHANGELOG.md create mode 100644 node_modules/deep-extend/LICENSE create mode 100644 node_modules/deep-extend/README.md create mode 100644 node_modules/deep-extend/index.js create mode 100644 node_modules/deep-extend/lib/deep-extend.js create mode 100644 node_modules/deep-extend/package.json create mode 100644 node_modules/define-property/CHANGELOG.md create mode 100644 node_modules/define-property/LICENSE create mode 100644 node_modules/define-property/README.md create mode 100644 node_modules/define-property/index.js create mode 100644 node_modules/define-property/package.json create mode 100644 node_modules/depd/History.md create mode 100644 node_modules/depd/LICENSE create mode 100644 node_modules/depd/Readme.md create mode 100644 node_modules/depd/index.js create mode 100644 node_modules/depd/lib/browser/index.js create mode 100644 node_modules/depd/lib/compat/callsite-tostring.js create mode 100644 node_modules/depd/lib/compat/event-listener-count.js create mode 100644 node_modules/depd/lib/compat/index.js create mode 100644 node_modules/depd/package.json create mode 100644 node_modules/destroy/LICENSE create mode 100644 node_modules/destroy/README.md create mode 100644 node_modules/destroy/index.js create mode 100644 node_modules/destroy/package.json create mode 100644 node_modules/doctypes/.npmignore create mode 100644 node_modules/doctypes/.travis.yml create mode 100644 node_modules/doctypes/HISTORY.md create mode 100644 node_modules/doctypes/LICENSE create mode 100644 node_modules/doctypes/README.md create mode 100644 node_modules/doctypes/index.js create mode 100644 node_modules/doctypes/package.json create mode 100644 node_modules/doctypes/test.js create mode 100644 node_modules/dot-prop/index.js create mode 100644 node_modules/dot-prop/license create mode 100644 node_modules/dot-prop/package.json create mode 100644 node_modules/dot-prop/readme.md create mode 100644 node_modules/duplexer/.npmignore create mode 100644 node_modules/duplexer/.travis.yml create mode 100644 node_modules/duplexer/LICENCE create mode 100644 node_modules/duplexer/README.md create mode 100644 node_modules/duplexer/index.js create mode 100644 node_modules/duplexer/package.json create mode 100644 node_modules/duplexer/test/index.js create mode 100644 node_modules/duplexer3/LICENSE.md create mode 100644 node_modules/duplexer3/README.md create mode 100644 node_modules/duplexer3/index.js create mode 100644 node_modules/duplexer3/package.json create mode 100644 node_modules/ee-first/LICENSE create mode 100644 node_modules/ee-first/README.md create mode 100644 node_modules/ee-first/index.js create mode 100644 node_modules/ee-first/package.json create mode 100644 node_modules/encodeurl/HISTORY.md create mode 100644 node_modules/encodeurl/LICENSE create mode 100644 node_modules/encodeurl/README.md create mode 100644 node_modules/encodeurl/index.js create mode 100644 node_modules/encodeurl/package.json create mode 100644 node_modules/escape-html/LICENSE create mode 100644 node_modules/escape-html/Readme.md create mode 100644 node_modules/escape-html/index.js create mode 100644 node_modules/escape-html/package.json create mode 100644 node_modules/escape-string-regexp/index.js create mode 100644 node_modules/escape-string-regexp/license create mode 100644 node_modules/escape-string-regexp/package.json create mode 100644 node_modules/escape-string-regexp/readme.md create mode 100644 node_modules/esutils/LICENSE.BSD create mode 100644 node_modules/esutils/README.md create mode 100644 node_modules/esutils/lib/ast.js create mode 100644 node_modules/esutils/lib/code.js create mode 100644 node_modules/esutils/lib/keyword.js create mode 100644 node_modules/esutils/lib/utils.js create mode 100644 node_modules/esutils/package.json create mode 100644 node_modules/etag/HISTORY.md create mode 100644 node_modules/etag/LICENSE create mode 100644 node_modules/etag/README.md create mode 100644 node_modules/etag/index.js create mode 100644 node_modules/etag/package.json create mode 100644 node_modules/event-stream/.npmignore create mode 100644 node_modules/event-stream/.travis.yml create mode 100644 node_modules/event-stream/LICENCE create mode 100644 node_modules/event-stream/examples/pretty.js create mode 100644 node_modules/event-stream/index.js create mode 100644 node_modules/event-stream/package.json create mode 100644 node_modules/event-stream/readme.markdown create mode 100644 node_modules/event-stream/test/connect.asynct.js create mode 100644 node_modules/event-stream/test/helper/index.js create mode 100644 node_modules/event-stream/test/merge.asynct.js create mode 100644 node_modules/event-stream/test/parse.asynct.js create mode 100644 node_modules/event-stream/test/pause.asynct.js create mode 100644 node_modules/event-stream/test/pipeline.asynct.js create mode 100644 node_modules/event-stream/test/readArray.asynct.js create mode 100644 node_modules/event-stream/test/readable.asynct.js create mode 100644 node_modules/event-stream/test/replace.asynct.js create mode 100644 node_modules/event-stream/test/simple-map.asynct.js create mode 100644 node_modules/event-stream/test/spec.asynct.js create mode 100644 node_modules/event-stream/test/split.asynct.js create mode 100644 node_modules/event-stream/test/stringify.js create mode 100644 node_modules/event-stream/test/writeArray.asynct.js create mode 100644 node_modules/execa/index.js create mode 100644 node_modules/execa/lib/errname.js create mode 100644 node_modules/execa/lib/stdio.js create mode 100644 node_modules/execa/license create mode 100644 node_modules/execa/package.json create mode 100644 node_modules/execa/readme.md create mode 100644 node_modules/expand-brackets/LICENSE create mode 100644 node_modules/expand-brackets/README.md create mode 100644 node_modules/expand-brackets/changelog.md create mode 100644 node_modules/expand-brackets/index.js create mode 100644 node_modules/expand-brackets/lib/compilers.js create mode 100644 node_modules/expand-brackets/lib/parsers.js create mode 100644 node_modules/expand-brackets/lib/utils.js create mode 100644 node_modules/expand-brackets/node_modules/define-property/LICENSE create mode 100644 node_modules/expand-brackets/node_modules/define-property/README.md create mode 100644 node_modules/expand-brackets/node_modules/define-property/index.js create mode 100644 node_modules/expand-brackets/node_modules/define-property/package.json create mode 100644 node_modules/expand-brackets/node_modules/extend-shallow/LICENSE create mode 100644 node_modules/expand-brackets/node_modules/extend-shallow/README.md create mode 100644 node_modules/expand-brackets/node_modules/extend-shallow/index.js create mode 100644 node_modules/expand-brackets/node_modules/extend-shallow/package.json create mode 100644 node_modules/expand-brackets/node_modules/is-accessor-descriptor/LICENSE create mode 100644 node_modules/expand-brackets/node_modules/is-accessor-descriptor/README.md create mode 100644 node_modules/expand-brackets/node_modules/is-accessor-descriptor/index.js create mode 100644 node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/LICENSE create mode 100644 node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/README.md create mode 100644 node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js create mode 100644 node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/package.json create mode 100644 node_modules/expand-brackets/node_modules/is-accessor-descriptor/package.json create mode 100644 node_modules/expand-brackets/node_modules/is-data-descriptor/LICENSE create mode 100644 node_modules/expand-brackets/node_modules/is-data-descriptor/README.md create mode 100644 node_modules/expand-brackets/node_modules/is-data-descriptor/index.js create mode 100644 node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/LICENSE create mode 100644 node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/README.md create mode 100644 node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/index.js create mode 100644 node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/package.json create mode 100644 node_modules/expand-brackets/node_modules/is-data-descriptor/package.json create mode 100644 node_modules/expand-brackets/node_modules/is-descriptor/LICENSE create mode 100644 node_modules/expand-brackets/node_modules/is-descriptor/README.md create mode 100644 node_modules/expand-brackets/node_modules/is-descriptor/index.js create mode 100644 node_modules/expand-brackets/node_modules/is-descriptor/package.json create mode 100644 node_modules/expand-brackets/node_modules/kind-of/LICENSE create mode 100644 node_modules/expand-brackets/node_modules/kind-of/README.md create mode 100644 node_modules/expand-brackets/node_modules/kind-of/index.js create mode 100644 node_modules/expand-brackets/node_modules/kind-of/package.json create mode 100644 node_modules/expand-brackets/package.json create mode 100644 node_modules/express/History.md create mode 100644 node_modules/express/LICENSE create mode 100644 node_modules/express/Readme.md create mode 100644 node_modules/express/index.js create mode 100644 node_modules/express/lib/application.js create mode 100644 node_modules/express/lib/express.js create mode 100644 node_modules/express/lib/middleware/init.js create mode 100644 node_modules/express/lib/middleware/query.js create mode 100644 node_modules/express/lib/request.js create mode 100644 node_modules/express/lib/response.js create mode 100644 node_modules/express/lib/router/index.js create mode 100644 node_modules/express/lib/router/layer.js create mode 100644 node_modules/express/lib/router/route.js create mode 100644 node_modules/express/lib/utils.js create mode 100644 node_modules/express/lib/view.js create mode 100644 node_modules/express/node_modules/qs/.editorconfig create mode 100644 node_modules/express/node_modules/qs/.eslintignore create mode 100644 node_modules/express/node_modules/qs/.eslintrc create mode 100644 node_modules/express/node_modules/qs/CHANGELOG.md create mode 100644 node_modules/express/node_modules/qs/LICENSE create mode 100644 node_modules/express/node_modules/qs/README.md create mode 100644 node_modules/express/node_modules/qs/dist/qs.js create mode 100644 node_modules/express/node_modules/qs/lib/formats.js create mode 100644 node_modules/express/node_modules/qs/lib/index.js create mode 100644 node_modules/express/node_modules/qs/lib/parse.js create mode 100644 node_modules/express/node_modules/qs/lib/stringify.js create mode 100644 node_modules/express/node_modules/qs/lib/utils.js create mode 100644 node_modules/express/node_modules/qs/package.json create mode 100644 node_modules/express/node_modules/qs/test/.eslintrc create mode 100644 node_modules/express/node_modules/qs/test/index.js create mode 100644 node_modules/express/node_modules/qs/test/parse.js create mode 100644 node_modules/express/node_modules/qs/test/stringify.js create mode 100644 node_modules/express/node_modules/qs/test/utils.js create mode 100644 node_modules/express/node_modules/statuses/HISTORY.md create mode 100644 node_modules/express/node_modules/statuses/LICENSE create mode 100644 node_modules/express/node_modules/statuses/README.md create mode 100644 node_modules/express/node_modules/statuses/codes.json create mode 100644 node_modules/express/node_modules/statuses/index.js create mode 100644 node_modules/express/node_modules/statuses/package.json create mode 100644 node_modules/express/package.json create mode 100644 node_modules/extend-shallow/LICENSE create mode 100644 node_modules/extend-shallow/README.md create mode 100644 node_modules/extend-shallow/index.js create mode 100644 node_modules/extend-shallow/node_modules/is-extendable/LICENSE create mode 100644 node_modules/extend-shallow/node_modules/is-extendable/README.md create mode 100644 node_modules/extend-shallow/node_modules/is-extendable/index.d.ts create mode 100644 node_modules/extend-shallow/node_modules/is-extendable/index.js create mode 100644 node_modules/extend-shallow/node_modules/is-extendable/package.json create mode 100644 node_modules/extend-shallow/package.json create mode 100644 node_modules/extglob/LICENSE create mode 100644 node_modules/extglob/README.md create mode 100644 node_modules/extglob/changelog.md create mode 100644 node_modules/extglob/index.js create mode 100644 node_modules/extglob/lib/compilers.js create mode 100644 node_modules/extglob/lib/extglob.js create mode 100644 node_modules/extglob/lib/parsers.js create mode 100644 node_modules/extglob/lib/utils.js create mode 100644 node_modules/extglob/node_modules/define-property/LICENSE create mode 100644 node_modules/extglob/node_modules/define-property/README.md create mode 100644 node_modules/extglob/node_modules/define-property/index.js create mode 100644 node_modules/extglob/node_modules/define-property/package.json create mode 100644 node_modules/extglob/node_modules/extend-shallow/LICENSE create mode 100644 node_modules/extglob/node_modules/extend-shallow/README.md create mode 100644 node_modules/extglob/node_modules/extend-shallow/index.js create mode 100644 node_modules/extglob/node_modules/extend-shallow/package.json create mode 100644 node_modules/extglob/package.json create mode 100644 node_modules/fill-range/LICENSE create mode 100644 node_modules/fill-range/README.md create mode 100644 node_modules/fill-range/index.js create mode 100644 node_modules/fill-range/node_modules/extend-shallow/LICENSE create mode 100644 node_modules/fill-range/node_modules/extend-shallow/README.md create mode 100644 node_modules/fill-range/node_modules/extend-shallow/index.js create mode 100644 node_modules/fill-range/node_modules/extend-shallow/package.json create mode 100644 node_modules/fill-range/package.json create mode 100644 node_modules/finalhandler/HISTORY.md create mode 100644 node_modules/finalhandler/LICENSE create mode 100644 node_modules/finalhandler/README.md create mode 100644 node_modules/finalhandler/index.js create mode 100644 node_modules/finalhandler/node_modules/statuses/HISTORY.md create mode 100644 node_modules/finalhandler/node_modules/statuses/LICENSE create mode 100644 node_modules/finalhandler/node_modules/statuses/README.md create mode 100644 node_modules/finalhandler/node_modules/statuses/codes.json create mode 100644 node_modules/finalhandler/node_modules/statuses/index.js create mode 100644 node_modules/finalhandler/node_modules/statuses/package.json create mode 100644 node_modules/finalhandler/package.json create mode 100644 node_modules/for-in/LICENSE create mode 100644 node_modules/for-in/README.md create mode 100644 node_modules/for-in/index.js create mode 100644 node_modules/for-in/package.json create mode 100644 node_modules/forwarded/HISTORY.md create mode 100644 node_modules/forwarded/LICENSE create mode 100644 node_modules/forwarded/README.md create mode 100644 node_modules/forwarded/index.js create mode 100644 node_modules/forwarded/package.json create mode 100644 node_modules/fragment-cache/LICENSE create mode 100644 node_modules/fragment-cache/README.md create mode 100644 node_modules/fragment-cache/index.js create mode 100644 node_modules/fragment-cache/package.json create mode 100644 node_modules/fresh/HISTORY.md create mode 100644 node_modules/fresh/LICENSE create mode 100644 node_modules/fresh/README.md create mode 100644 node_modules/fresh/index.js create mode 100644 node_modules/fresh/package.json create mode 100644 node_modules/from/.npmignore create mode 100644 node_modules/from/.travis.yml create mode 100644 node_modules/from/LICENSE.APACHE2 create mode 100644 node_modules/from/LICENSE.MIT create mode 100644 node_modules/from/index.js create mode 100644 node_modules/from/package.json create mode 100644 node_modules/from/readme.markdown create mode 100644 node_modules/from/test/index.js create mode 100644 node_modules/fsevents/.npmignore create mode 100644 node_modules/fsevents/.travis.yml create mode 100644 node_modules/fsevents/ISSUE_TEMPLATE.md create mode 100644 node_modules/fsevents/LICENSE create mode 100644 node_modules/fsevents/Readme.md create mode 100644 node_modules/fsevents/binding.gyp create mode 100644 node_modules/fsevents/build/.target.mk create mode 100644 node_modules/fsevents/build/Makefile create mode 100644 node_modules/fsevents/build/Release/.deps/Release/.node.d create mode 100644 node_modules/fsevents/build/Release/.deps/Release/fse.node.d create mode 100644 node_modules/fsevents/build/Release/.deps/Release/obj.target/action_after_build.stamp.d create mode 100644 node_modules/fsevents/build/Release/.deps/Release/obj.target/fse/fsevents.o.d create mode 100644 node_modules/fsevents/build/Release/.deps/Users/eshanker/Code/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node.d create mode 100755 node_modules/fsevents/build/Release/.node create mode 100755 node_modules/fsevents/build/Release/fse.node create mode 100644 node_modules/fsevents/build/Release/obj.target/action_after_build.stamp create mode 100644 node_modules/fsevents/build/Release/obj.target/fse/fsevents.o create mode 100644 node_modules/fsevents/build/action_after_build.target.mk create mode 100644 node_modules/fsevents/build/binding.Makefile create mode 100644 node_modules/fsevents/build/fse.target.mk create mode 100755 node_modules/fsevents/build/gyp-mac-tool create mode 100644 node_modules/fsevents/build/stage/v1.1.2/fse-v1.1.2-node-v48-darwin-x64.tar.gz create mode 100644 node_modules/fsevents/fsevents.cc create mode 100644 node_modules/fsevents/fsevents.js create mode 100644 node_modules/fsevents/install.js create mode 100755 node_modules/fsevents/lib/binding/Release/node-v11-darwin-x64/fse.node create mode 100755 node_modules/fsevents/lib/binding/Release/node-v46-darwin-x64/fse.node create mode 100755 node_modules/fsevents/lib/binding/Release/node-v47-darwin-x64/fse.node create mode 100755 node_modules/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node create mode 100755 node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node create mode 120000 node_modules/fsevents/node_modules/.bin/detect-libc create mode 120000 node_modules/fsevents/node_modules/.bin/mkdirp create mode 120000 node_modules/fsevents/node_modules/.bin/node-pre-gyp create mode 120000 node_modules/fsevents/node_modules/.bin/nopt create mode 120000 node_modules/fsevents/node_modules/.bin/rc create mode 120000 node_modules/fsevents/node_modules/.bin/rimraf create mode 120000 node_modules/fsevents/node_modules/.bin/semver create mode 120000 node_modules/fsevents/node_modules/.bin/sshpk-conv create mode 120000 node_modules/fsevents/node_modules/.bin/sshpk-sign create mode 120000 node_modules/fsevents/node_modules/.bin/sshpk-verify create mode 120000 node_modules/fsevents/node_modules/.bin/uuid create mode 100644 node_modules/fsevents/node_modules/abbrev/LICENSE create mode 100644 node_modules/fsevents/node_modules/abbrev/README.md create mode 100644 node_modules/fsevents/node_modules/abbrev/abbrev.js create mode 100644 node_modules/fsevents/node_modules/abbrev/package.json create mode 100644 node_modules/fsevents/node_modules/ajv/.tonic_example.js create mode 100644 node_modules/fsevents/node_modules/ajv/LICENSE create mode 100644 node_modules/fsevents/node_modules/ajv/README.md create mode 100644 node_modules/fsevents/node_modules/ajv/dist/ajv.bundle.js create mode 100644 node_modules/fsevents/node_modules/ajv/dist/ajv.min.js create mode 100644 node_modules/fsevents/node_modules/ajv/dist/ajv.min.js.map create mode 100644 node_modules/fsevents/node_modules/ajv/dist/nodent.min.js create mode 100644 node_modules/fsevents/node_modules/ajv/dist/regenerator.min.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/ajv.d.ts create mode 100644 node_modules/fsevents/node_modules/ajv/lib/ajv.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/async.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/cache.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/compile/_rules.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/compile/equal.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/compile/formats.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/compile/index.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/compile/resolve.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/compile/rules.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/compile/schema_obj.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/compile/ucs2length.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/compile/util.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/compile/validation_error.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/_limit.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/_limitItems.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/_limitLength.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/_limitProperties.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/allOf.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/anyOf.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/coerce.def create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/custom.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/defaults.def create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/definitions.def create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/dependencies.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/enum.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/errors.def create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/format.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/items.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/missing.def create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/multipleOf.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/not.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/oneOf.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/pattern.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/properties.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/ref.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/required.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/uniqueItems.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/v5/_formatLimit.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/v5/constant.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/v5/patternRequired.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/v5/switch.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dot/validate.jst create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/README.md create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/_formatLimit.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/_limit.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/_limitItems.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/_limitLength.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/_limitProperties.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/allOf.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/anyOf.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/constant.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/custom.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/dependencies.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/enum.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/format.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/items.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/multipleOf.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/not.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/oneOf.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/pattern.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/patternRequired.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/properties.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/ref.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/required.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/switch.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/uniqueItems.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/dotjs/validate.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/keyword.js create mode 100644 node_modules/fsevents/node_modules/ajv/lib/refs/json-schema-draft-04.json create mode 100644 node_modules/fsevents/node_modules/ajv/lib/refs/json-schema-v5.json create mode 100644 node_modules/fsevents/node_modules/ajv/lib/v5.js create mode 100644 node_modules/fsevents/node_modules/ajv/package.json create mode 100644 node_modules/fsevents/node_modules/ajv/scripts/.eslintrc.yml create mode 100644 node_modules/fsevents/node_modules/ajv/scripts/bundle.js create mode 100644 node_modules/fsevents/node_modules/ajv/scripts/compile-dots.js create mode 100755 node_modules/fsevents/node_modules/ajv/scripts/info create mode 100755 node_modules/fsevents/node_modules/ajv/scripts/prepare-tests create mode 100755 node_modules/fsevents/node_modules/ajv/scripts/travis-gh-pages create mode 100644 node_modules/fsevents/node_modules/ansi-regex/index.js create mode 100644 node_modules/fsevents/node_modules/ansi-regex/license create mode 100644 node_modules/fsevents/node_modules/ansi-regex/package.json create mode 100644 node_modules/fsevents/node_modules/ansi-regex/readme.md create mode 100644 node_modules/fsevents/node_modules/aproba/LICENSE create mode 100644 node_modules/fsevents/node_modules/aproba/README.md create mode 100644 node_modules/fsevents/node_modules/aproba/index.js create mode 100644 node_modules/fsevents/node_modules/aproba/package.json create mode 100644 node_modules/fsevents/node_modules/are-we-there-yet/CHANGES.md create mode 100644 node_modules/fsevents/node_modules/are-we-there-yet/CHANGES.md~ create mode 100644 node_modules/fsevents/node_modules/are-we-there-yet/LICENSE create mode 100644 node_modules/fsevents/node_modules/are-we-there-yet/README.md create mode 100644 node_modules/fsevents/node_modules/are-we-there-yet/index.js create mode 100644 node_modules/fsevents/node_modules/are-we-there-yet/package.json create mode 100644 node_modules/fsevents/node_modules/are-we-there-yet/tracker-base.js create mode 100644 node_modules/fsevents/node_modules/are-we-there-yet/tracker-group.js create mode 100644 node_modules/fsevents/node_modules/are-we-there-yet/tracker-stream.js create mode 100644 node_modules/fsevents/node_modules/are-we-there-yet/tracker.js create mode 100644 node_modules/fsevents/node_modules/asn1/.npmignore create mode 100644 node_modules/fsevents/node_modules/asn1/.travis.yml create mode 100644 node_modules/fsevents/node_modules/asn1/LICENSE create mode 100644 node_modules/fsevents/node_modules/asn1/README.md create mode 100644 node_modules/fsevents/node_modules/asn1/lib/ber/errors.js create mode 100644 node_modules/fsevents/node_modules/asn1/lib/ber/index.js create mode 100644 node_modules/fsevents/node_modules/asn1/lib/ber/reader.js create mode 100644 node_modules/fsevents/node_modules/asn1/lib/ber/types.js create mode 100644 node_modules/fsevents/node_modules/asn1/lib/ber/writer.js create mode 100644 node_modules/fsevents/node_modules/asn1/lib/index.js create mode 100644 node_modules/fsevents/node_modules/asn1/package.json create mode 100644 node_modules/fsevents/node_modules/asn1/tst/ber/reader.test.js create mode 100644 node_modules/fsevents/node_modules/asn1/tst/ber/writer.test.js create mode 100644 node_modules/fsevents/node_modules/assert-plus/AUTHORS create mode 100644 node_modules/fsevents/node_modules/assert-plus/CHANGES.md create mode 100644 node_modules/fsevents/node_modules/assert-plus/README.md create mode 100644 node_modules/fsevents/node_modules/assert-plus/assert.js create mode 100644 node_modules/fsevents/node_modules/assert-plus/package.json create mode 100644 node_modules/fsevents/node_modules/asynckit/LICENSE create mode 100644 node_modules/fsevents/node_modules/asynckit/README.md create mode 100644 node_modules/fsevents/node_modules/asynckit/bench.js create mode 100644 node_modules/fsevents/node_modules/asynckit/index.js create mode 100644 node_modules/fsevents/node_modules/asynckit/lib/abort.js create mode 100644 node_modules/fsevents/node_modules/asynckit/lib/async.js create mode 100644 node_modules/fsevents/node_modules/asynckit/lib/defer.js create mode 100644 node_modules/fsevents/node_modules/asynckit/lib/iterate.js create mode 100644 node_modules/fsevents/node_modules/asynckit/lib/readable_asynckit.js create mode 100644 node_modules/fsevents/node_modules/asynckit/lib/readable_parallel.js create mode 100644 node_modules/fsevents/node_modules/asynckit/lib/readable_serial.js create mode 100644 node_modules/fsevents/node_modules/asynckit/lib/readable_serial_ordered.js create mode 100644 node_modules/fsevents/node_modules/asynckit/lib/state.js create mode 100644 node_modules/fsevents/node_modules/asynckit/lib/streamify.js create mode 100644 node_modules/fsevents/node_modules/asynckit/lib/terminator.js create mode 100644 node_modules/fsevents/node_modules/asynckit/package.json create mode 100644 node_modules/fsevents/node_modules/asynckit/parallel.js create mode 100644 node_modules/fsevents/node_modules/asynckit/serial.js create mode 100644 node_modules/fsevents/node_modules/asynckit/serialOrdered.js create mode 100644 node_modules/fsevents/node_modules/asynckit/stream.js create mode 100644 node_modules/fsevents/node_modules/aws-sign2/LICENSE create mode 100644 node_modules/fsevents/node_modules/aws-sign2/README.md create mode 100644 node_modules/fsevents/node_modules/aws-sign2/index.js create mode 100644 node_modules/fsevents/node_modules/aws-sign2/package.json create mode 100644 node_modules/fsevents/node_modules/aws4/.npmignore create mode 100644 node_modules/fsevents/node_modules/aws4/.tern-port create mode 100644 node_modules/fsevents/node_modules/aws4/.travis.yml create mode 100644 node_modules/fsevents/node_modules/aws4/LICENSE create mode 100644 node_modules/fsevents/node_modules/aws4/README.md create mode 100644 node_modules/fsevents/node_modules/aws4/aws4.js create mode 100644 node_modules/fsevents/node_modules/aws4/lru.js create mode 100644 node_modules/fsevents/node_modules/aws4/package.json create mode 100644 node_modules/fsevents/node_modules/balanced-match/.npmignore create mode 100644 node_modules/fsevents/node_modules/balanced-match/LICENSE.md create mode 100644 node_modules/fsevents/node_modules/balanced-match/README.md create mode 100644 node_modules/fsevents/node_modules/balanced-match/index.js create mode 100644 node_modules/fsevents/node_modules/balanced-match/package.json create mode 100644 node_modules/fsevents/node_modules/bcrypt-pbkdf/README.md create mode 100644 node_modules/fsevents/node_modules/bcrypt-pbkdf/index.js create mode 100644 node_modules/fsevents/node_modules/bcrypt-pbkdf/package.json create mode 100644 node_modules/fsevents/node_modules/block-stream/LICENCE create mode 100644 node_modules/fsevents/node_modules/block-stream/LICENSE create mode 100644 node_modules/fsevents/node_modules/block-stream/README.md create mode 100644 node_modules/fsevents/node_modules/block-stream/block-stream.js create mode 100644 node_modules/fsevents/node_modules/block-stream/package.json create mode 100644 node_modules/fsevents/node_modules/boom/.npmignore create mode 100755 node_modules/fsevents/node_modules/boom/.travis.yml create mode 100644 node_modules/fsevents/node_modules/boom/CONTRIBUTING.md create mode 100755 node_modules/fsevents/node_modules/boom/LICENSE create mode 100755 node_modules/fsevents/node_modules/boom/README.md create mode 100755 node_modules/fsevents/node_modules/boom/images/boom.png create mode 100755 node_modules/fsevents/node_modules/boom/lib/index.js create mode 100644 node_modules/fsevents/node_modules/boom/package.json create mode 100755 node_modules/fsevents/node_modules/boom/test/index.js create mode 100644 node_modules/fsevents/node_modules/brace-expansion/README.md create mode 100644 node_modules/fsevents/node_modules/brace-expansion/index.js create mode 100644 node_modules/fsevents/node_modules/brace-expansion/package.json create mode 100644 node_modules/fsevents/node_modules/buffer-shims/index.js create mode 100644 node_modules/fsevents/node_modules/buffer-shims/license.md create mode 100644 node_modules/fsevents/node_modules/buffer-shims/package.json create mode 100644 node_modules/fsevents/node_modules/buffer-shims/readme.md create mode 100644 node_modules/fsevents/node_modules/caseless/LICENSE create mode 100644 node_modules/fsevents/node_modules/caseless/README.md create mode 100644 node_modules/fsevents/node_modules/caseless/index.js create mode 100644 node_modules/fsevents/node_modules/caseless/package.json create mode 100644 node_modules/fsevents/node_modules/caseless/test.js create mode 100644 node_modules/fsevents/node_modules/co/History.md create mode 100644 node_modules/fsevents/node_modules/co/LICENSE create mode 100644 node_modules/fsevents/node_modules/co/Readme.md create mode 100644 node_modules/fsevents/node_modules/co/index.js create mode 100644 node_modules/fsevents/node_modules/co/package.json create mode 100644 node_modules/fsevents/node_modules/code-point-at/index.js create mode 100644 node_modules/fsevents/node_modules/code-point-at/license create mode 100644 node_modules/fsevents/node_modules/code-point-at/package.json create mode 100644 node_modules/fsevents/node_modules/code-point-at/readme.md create mode 100644 node_modules/fsevents/node_modules/combined-stream/License create mode 100644 node_modules/fsevents/node_modules/combined-stream/Readme.md create mode 100644 node_modules/fsevents/node_modules/combined-stream/lib/combined_stream.js create mode 100644 node_modules/fsevents/node_modules/combined-stream/package.json create mode 100644 node_modules/fsevents/node_modules/concat-map/.travis.yml create mode 100644 node_modules/fsevents/node_modules/concat-map/LICENSE create mode 100644 node_modules/fsevents/node_modules/concat-map/README.markdown create mode 100644 node_modules/fsevents/node_modules/concat-map/example/map.js create mode 100644 node_modules/fsevents/node_modules/concat-map/index.js create mode 100644 node_modules/fsevents/node_modules/concat-map/package.json create mode 100644 node_modules/fsevents/node_modules/concat-map/test/map.js create mode 100644 node_modules/fsevents/node_modules/console-control-strings/LICENSE create mode 100644 node_modules/fsevents/node_modules/console-control-strings/README.md create mode 100644 node_modules/fsevents/node_modules/console-control-strings/README.md~ create mode 100644 node_modules/fsevents/node_modules/console-control-strings/index.js create mode 100644 node_modules/fsevents/node_modules/console-control-strings/package.json create mode 100644 node_modules/fsevents/node_modules/core-util-is/LICENSE create mode 100644 node_modules/fsevents/node_modules/core-util-is/README.md create mode 100644 node_modules/fsevents/node_modules/core-util-is/float.patch create mode 100644 node_modules/fsevents/node_modules/core-util-is/lib/util.js create mode 100644 node_modules/fsevents/node_modules/core-util-is/package.json create mode 100644 node_modules/fsevents/node_modules/core-util-is/test.js create mode 100644 node_modules/fsevents/node_modules/cryptiles/.npmignore create mode 100755 node_modules/fsevents/node_modules/cryptiles/.travis.yml create mode 100755 node_modules/fsevents/node_modules/cryptiles/LICENSE create mode 100644 node_modules/fsevents/node_modules/cryptiles/README.md create mode 100755 node_modules/fsevents/node_modules/cryptiles/lib/index.js create mode 100755 node_modules/fsevents/node_modules/cryptiles/package.json create mode 100755 node_modules/fsevents/node_modules/cryptiles/test/index.js create mode 100644 node_modules/fsevents/node_modules/dashdash/CHANGES.md create mode 100644 node_modules/fsevents/node_modules/dashdash/LICENSE.txt create mode 100644 node_modules/fsevents/node_modules/dashdash/README.md create mode 100644 node_modules/fsevents/node_modules/dashdash/etc/dashdash.bash_completion.in create mode 100644 node_modules/fsevents/node_modules/dashdash/lib/dashdash.js create mode 100644 node_modules/fsevents/node_modules/dashdash/node_modules/assert-plus/AUTHORS create mode 100644 node_modules/fsevents/node_modules/dashdash/node_modules/assert-plus/CHANGES.md create mode 100644 node_modules/fsevents/node_modules/dashdash/node_modules/assert-plus/README.md create mode 100644 node_modules/fsevents/node_modules/dashdash/node_modules/assert-plus/assert.js create mode 100644 node_modules/fsevents/node_modules/dashdash/node_modules/assert-plus/package.json create mode 100644 node_modules/fsevents/node_modules/dashdash/package.json create mode 100644 node_modules/fsevents/node_modules/debug/.coveralls.yml create mode 100644 node_modules/fsevents/node_modules/debug/.eslintrc create mode 100644 node_modules/fsevents/node_modules/debug/.npmignore create mode 100644 node_modules/fsevents/node_modules/debug/.travis.yml create mode 100644 node_modules/fsevents/node_modules/debug/CHANGELOG.md create mode 100644 node_modules/fsevents/node_modules/debug/LICENSE create mode 100644 node_modules/fsevents/node_modules/debug/Makefile create mode 100644 node_modules/fsevents/node_modules/debug/README.md create mode 100644 node_modules/fsevents/node_modules/debug/component.json create mode 100644 node_modules/fsevents/node_modules/debug/karma.conf.js create mode 100644 node_modules/fsevents/node_modules/debug/node.js create mode 100644 node_modules/fsevents/node_modules/debug/package.json create mode 100644 node_modules/fsevents/node_modules/debug/src/browser.js create mode 100644 node_modules/fsevents/node_modules/debug/src/debug.js create mode 100644 node_modules/fsevents/node_modules/debug/src/index.js create mode 100644 node_modules/fsevents/node_modules/debug/src/node.js create mode 100644 node_modules/fsevents/node_modules/deep-extend/CHANGELOG.md create mode 100644 node_modules/fsevents/node_modules/deep-extend/LICENSE create mode 100644 node_modules/fsevents/node_modules/deep-extend/README.md create mode 100644 node_modules/fsevents/node_modules/deep-extend/index.js create mode 100644 node_modules/fsevents/node_modules/deep-extend/lib/deep-extend.js create mode 100644 node_modules/fsevents/node_modules/deep-extend/package.json create mode 100644 node_modules/fsevents/node_modules/delayed-stream/.npmignore create mode 100644 node_modules/fsevents/node_modules/delayed-stream/License create mode 100644 node_modules/fsevents/node_modules/delayed-stream/Makefile create mode 100644 node_modules/fsevents/node_modules/delayed-stream/Readme.md create mode 100644 node_modules/fsevents/node_modules/delayed-stream/lib/delayed_stream.js create mode 100644 node_modules/fsevents/node_modules/delayed-stream/package.json create mode 100644 node_modules/fsevents/node_modules/delegates/.npmignore create mode 100644 node_modules/fsevents/node_modules/delegates/History.md create mode 100644 node_modules/fsevents/node_modules/delegates/License create mode 100644 node_modules/fsevents/node_modules/delegates/Makefile create mode 100644 node_modules/fsevents/node_modules/delegates/Readme.md create mode 100644 node_modules/fsevents/node_modules/delegates/index.js create mode 100644 node_modules/fsevents/node_modules/delegates/package.json create mode 100644 node_modules/fsevents/node_modules/delegates/test/index.js create mode 100644 node_modules/fsevents/node_modules/detect-libc/.npmignore create mode 100644 node_modules/fsevents/node_modules/detect-libc/LICENSE create mode 100644 node_modules/fsevents/node_modules/detect-libc/README.md create mode 100755 node_modules/fsevents/node_modules/detect-libc/bin/detect-libc.js create mode 100644 node_modules/fsevents/node_modules/detect-libc/lib/detect-libc.js create mode 100644 node_modules/fsevents/node_modules/detect-libc/package.json create mode 100644 node_modules/fsevents/node_modules/ecc-jsbn/.npmignore create mode 100644 node_modules/fsevents/node_modules/ecc-jsbn/LICENSE create mode 100644 node_modules/fsevents/node_modules/ecc-jsbn/README.md create mode 100644 node_modules/fsevents/node_modules/ecc-jsbn/index.js create mode 100644 node_modules/fsevents/node_modules/ecc-jsbn/lib/LICENSE-jsbn create mode 100644 node_modules/fsevents/node_modules/ecc-jsbn/lib/ec.js create mode 100644 node_modules/fsevents/node_modules/ecc-jsbn/lib/sec.js create mode 100644 node_modules/fsevents/node_modules/ecc-jsbn/package.json create mode 100644 node_modules/fsevents/node_modules/ecc-jsbn/test.js create mode 100644 node_modules/fsevents/node_modules/extend/.eslintrc create mode 100644 node_modules/fsevents/node_modules/extend/.jscs.json create mode 100644 node_modules/fsevents/node_modules/extend/.npmignore create mode 100644 node_modules/fsevents/node_modules/extend/.travis.yml create mode 100644 node_modules/fsevents/node_modules/extend/CHANGELOG.md create mode 100644 node_modules/fsevents/node_modules/extend/LICENSE create mode 100644 node_modules/fsevents/node_modules/extend/README.md create mode 100644 node_modules/fsevents/node_modules/extend/component.json create mode 100644 node_modules/fsevents/node_modules/extend/index.js create mode 100644 node_modules/fsevents/node_modules/extend/package.json create mode 100644 node_modules/fsevents/node_modules/extsprintf/.gitmodules create mode 100644 node_modules/fsevents/node_modules/extsprintf/LICENSE create mode 100644 node_modules/fsevents/node_modules/extsprintf/Makefile create mode 100644 node_modules/fsevents/node_modules/extsprintf/Makefile.deps create mode 100644 node_modules/fsevents/node_modules/extsprintf/Makefile.targ create mode 100644 node_modules/fsevents/node_modules/extsprintf/README.md create mode 100644 node_modules/fsevents/node_modules/extsprintf/examples/simple.js create mode 100644 node_modules/fsevents/node_modules/extsprintf/jsl.node.conf create mode 100644 node_modules/fsevents/node_modules/extsprintf/lib/extsprintf.js create mode 100644 node_modules/fsevents/node_modules/extsprintf/package.json create mode 100644 node_modules/fsevents/node_modules/forever-agent/LICENSE create mode 100644 node_modules/fsevents/node_modules/forever-agent/README.md create mode 100644 node_modules/fsevents/node_modules/forever-agent/index.js create mode 100644 node_modules/fsevents/node_modules/forever-agent/package.json create mode 100644 node_modules/fsevents/node_modules/form-data/License create mode 100644 node_modules/fsevents/node_modules/form-data/README.md create mode 100644 node_modules/fsevents/node_modules/form-data/lib/browser.js create mode 100644 node_modules/fsevents/node_modules/form-data/lib/form_data.js create mode 100644 node_modules/fsevents/node_modules/form-data/lib/populate.js create mode 100644 node_modules/fsevents/node_modules/form-data/package.json create mode 100644 node_modules/fsevents/node_modules/fs.realpath/LICENSE create mode 100644 node_modules/fsevents/node_modules/fs.realpath/README.md create mode 100644 node_modules/fsevents/node_modules/fs.realpath/index.js create mode 100644 node_modules/fsevents/node_modules/fs.realpath/old.js create mode 100644 node_modules/fsevents/node_modules/fs.realpath/package.json create mode 100644 node_modules/fsevents/node_modules/fstream-ignore/LICENSE create mode 100644 node_modules/fsevents/node_modules/fstream-ignore/README.md create mode 100644 node_modules/fsevents/node_modules/fstream-ignore/ignore.js create mode 100644 node_modules/fsevents/node_modules/fstream-ignore/package.json create mode 100644 node_modules/fsevents/node_modules/fstream/.npmignore create mode 100644 node_modules/fsevents/node_modules/fstream/.travis.yml create mode 100644 node_modules/fsevents/node_modules/fstream/LICENSE create mode 100644 node_modules/fsevents/node_modules/fstream/README.md create mode 100644 node_modules/fsevents/node_modules/fstream/examples/filter-pipe.js create mode 100644 node_modules/fsevents/node_modules/fstream/examples/pipe.js create mode 100644 node_modules/fsevents/node_modules/fstream/examples/reader.js create mode 100644 node_modules/fsevents/node_modules/fstream/examples/symlink-write.js create mode 100644 node_modules/fsevents/node_modules/fstream/fstream.js create mode 100644 node_modules/fsevents/node_modules/fstream/lib/abstract.js create mode 100644 node_modules/fsevents/node_modules/fstream/lib/collect.js create mode 100644 node_modules/fsevents/node_modules/fstream/lib/dir-reader.js create mode 100644 node_modules/fsevents/node_modules/fstream/lib/dir-writer.js create mode 100644 node_modules/fsevents/node_modules/fstream/lib/file-reader.js create mode 100644 node_modules/fsevents/node_modules/fstream/lib/file-writer.js create mode 100644 node_modules/fsevents/node_modules/fstream/lib/get-type.js create mode 100644 node_modules/fsevents/node_modules/fstream/lib/link-reader.js create mode 100644 node_modules/fsevents/node_modules/fstream/lib/link-writer.js create mode 100644 node_modules/fsevents/node_modules/fstream/lib/proxy-reader.js create mode 100644 node_modules/fsevents/node_modules/fstream/lib/proxy-writer.js create mode 100644 node_modules/fsevents/node_modules/fstream/lib/reader.js create mode 100644 node_modules/fsevents/node_modules/fstream/lib/socket-reader.js create mode 100644 node_modules/fsevents/node_modules/fstream/lib/writer.js create mode 100644 node_modules/fsevents/node_modules/fstream/package.json create mode 100644 node_modules/fsevents/node_modules/gauge/CHANGELOG.md create mode 100644 node_modules/fsevents/node_modules/gauge/LICENSE create mode 100644 node_modules/fsevents/node_modules/gauge/README.md create mode 100644 node_modules/fsevents/node_modules/gauge/base-theme.js create mode 100644 node_modules/fsevents/node_modules/gauge/error.js create mode 100644 node_modules/fsevents/node_modules/gauge/has-color.js create mode 100644 node_modules/fsevents/node_modules/gauge/index.js create mode 100644 node_modules/fsevents/node_modules/gauge/package.json create mode 100644 node_modules/fsevents/node_modules/gauge/plumbing.js create mode 100644 node_modules/fsevents/node_modules/gauge/process.js create mode 100644 node_modules/fsevents/node_modules/gauge/progress-bar.js create mode 100644 node_modules/fsevents/node_modules/gauge/render-template.js create mode 100644 node_modules/fsevents/node_modules/gauge/set-immediate.js create mode 100644 node_modules/fsevents/node_modules/gauge/set-interval.js create mode 100644 node_modules/fsevents/node_modules/gauge/spin.js create mode 100644 node_modules/fsevents/node_modules/gauge/template-item.js create mode 100644 node_modules/fsevents/node_modules/gauge/theme-set.js create mode 100644 node_modules/fsevents/node_modules/gauge/themes.js create mode 100644 node_modules/fsevents/node_modules/gauge/wide-truncate.js create mode 100644 node_modules/fsevents/node_modules/getpass/.npmignore create mode 100644 node_modules/fsevents/node_modules/getpass/.travis.yml create mode 100644 node_modules/fsevents/node_modules/getpass/LICENSE create mode 100644 node_modules/fsevents/node_modules/getpass/README.md create mode 100644 node_modules/fsevents/node_modules/getpass/lib/index.js create mode 100644 node_modules/fsevents/node_modules/getpass/node_modules/assert-plus/AUTHORS create mode 100644 node_modules/fsevents/node_modules/getpass/node_modules/assert-plus/CHANGES.md create mode 100644 node_modules/fsevents/node_modules/getpass/node_modules/assert-plus/README.md create mode 100644 node_modules/fsevents/node_modules/getpass/node_modules/assert-plus/assert.js create mode 100644 node_modules/fsevents/node_modules/getpass/node_modules/assert-plus/package.json create mode 100644 node_modules/fsevents/node_modules/getpass/package.json create mode 100644 node_modules/fsevents/node_modules/glob/LICENSE create mode 100644 node_modules/fsevents/node_modules/glob/README.md create mode 100644 node_modules/fsevents/node_modules/glob/changelog.md create mode 100644 node_modules/fsevents/node_modules/glob/common.js create mode 100644 node_modules/fsevents/node_modules/glob/glob.js create mode 100644 node_modules/fsevents/node_modules/glob/package.json create mode 100644 node_modules/fsevents/node_modules/glob/sync.js create mode 100644 node_modules/fsevents/node_modules/graceful-fs/LICENSE create mode 100644 node_modules/fsevents/node_modules/graceful-fs/README.md create mode 100644 node_modules/fsevents/node_modules/graceful-fs/fs.js create mode 100644 node_modules/fsevents/node_modules/graceful-fs/graceful-fs.js create mode 100644 node_modules/fsevents/node_modules/graceful-fs/legacy-streams.js create mode 100644 node_modules/fsevents/node_modules/graceful-fs/package.json create mode 100644 node_modules/fsevents/node_modules/graceful-fs/polyfills.js create mode 100644 node_modules/fsevents/node_modules/har-schema/LICENSE create mode 100644 node_modules/fsevents/node_modules/har-schema/README.md create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/afterRequest.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/beforeRequest.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/browser.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/cache.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/content.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/cookie.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/creator.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/entry.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/har.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/header.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/index.js create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/log.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/page.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/pageTimings.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/postData.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/query.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/request.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/response.json create mode 100644 node_modules/fsevents/node_modules/har-schema/lib/timings.json create mode 100644 node_modules/fsevents/node_modules/har-schema/package.json create mode 100644 node_modules/fsevents/node_modules/har-validator/LICENSE create mode 100644 node_modules/fsevents/node_modules/har-validator/README.md create mode 100644 node_modules/fsevents/node_modules/har-validator/lib/browser/async.js create mode 100644 node_modules/fsevents/node_modules/har-validator/lib/browser/error.js create mode 100644 node_modules/fsevents/node_modules/har-validator/lib/browser/promise.js create mode 100644 node_modules/fsevents/node_modules/har-validator/lib/node4/async.js create mode 100644 node_modules/fsevents/node_modules/har-validator/lib/node4/error.js create mode 100644 node_modules/fsevents/node_modules/har-validator/lib/node4/promise.js create mode 100644 node_modules/fsevents/node_modules/har-validator/lib/node6/async.js create mode 100644 node_modules/fsevents/node_modules/har-validator/lib/node6/error.js create mode 100644 node_modules/fsevents/node_modules/har-validator/lib/node6/promise.js create mode 100644 node_modules/fsevents/node_modules/har-validator/lib/node7/async.js create mode 100644 node_modules/fsevents/node_modules/har-validator/lib/node7/error.js create mode 100644 node_modules/fsevents/node_modules/har-validator/lib/node7/promise.js create mode 100644 node_modules/fsevents/node_modules/har-validator/package.json create mode 100644 node_modules/fsevents/node_modules/har-validator/src/async.js create mode 100644 node_modules/fsevents/node_modules/har-validator/src/error.js create mode 100644 node_modules/fsevents/node_modules/har-validator/src/promise.js create mode 100644 node_modules/fsevents/node_modules/has-unicode/LICENSE create mode 100644 node_modules/fsevents/node_modules/has-unicode/README.md create mode 100644 node_modules/fsevents/node_modules/has-unicode/index.js create mode 100644 node_modules/fsevents/node_modules/has-unicode/package.json create mode 100644 node_modules/fsevents/node_modules/hawk/.npmignore create mode 100755 node_modules/fsevents/node_modules/hawk/.travis.yml create mode 100755 node_modules/fsevents/node_modules/hawk/LICENSE create mode 100755 node_modules/fsevents/node_modules/hawk/README.md create mode 100644 node_modules/fsevents/node_modules/hawk/bower.json create mode 100644 node_modules/fsevents/node_modules/hawk/component.json create mode 100644 node_modules/fsevents/node_modules/hawk/dist/client.js create mode 100755 node_modules/fsevents/node_modules/hawk/example/usage.js create mode 100755 node_modules/fsevents/node_modules/hawk/images/hawk.png create mode 100755 node_modules/fsevents/node_modules/hawk/images/logo.png create mode 100755 node_modules/fsevents/node_modules/hawk/lib/browser.js create mode 100755 node_modules/fsevents/node_modules/hawk/lib/client.js create mode 100755 node_modules/fsevents/node_modules/hawk/lib/crypto.js create mode 100755 node_modules/fsevents/node_modules/hawk/lib/index.js create mode 100755 node_modules/fsevents/node_modules/hawk/lib/server.js create mode 100755 node_modules/fsevents/node_modules/hawk/lib/utils.js create mode 100755 node_modules/fsevents/node_modules/hawk/package.json create mode 100755 node_modules/fsevents/node_modules/hawk/test/browser.js create mode 100755 node_modules/fsevents/node_modules/hawk/test/client.js create mode 100755 node_modules/fsevents/node_modules/hawk/test/crypto.js create mode 100755 node_modules/fsevents/node_modules/hawk/test/index.js create mode 100755 node_modules/fsevents/node_modules/hawk/test/readme.js create mode 100755 node_modules/fsevents/node_modules/hawk/test/server.js create mode 100755 node_modules/fsevents/node_modules/hawk/test/uri.js create mode 100755 node_modules/fsevents/node_modules/hawk/test/utils.js create mode 100644 node_modules/fsevents/node_modules/hoek/.npmignore create mode 100644 node_modules/fsevents/node_modules/hoek/.travis.yml create mode 100644 node_modules/fsevents/node_modules/hoek/CONTRIBUTING.md create mode 100644 node_modules/fsevents/node_modules/hoek/LICENSE create mode 100644 node_modules/fsevents/node_modules/hoek/README.md create mode 100644 node_modules/fsevents/node_modules/hoek/images/hoek.png create mode 100644 node_modules/fsevents/node_modules/hoek/lib/escape.js create mode 100644 node_modules/fsevents/node_modules/hoek/lib/index.js create mode 100644 node_modules/fsevents/node_modules/hoek/package.json create mode 100644 node_modules/fsevents/node_modules/hoek/test/escaper.js create mode 100644 node_modules/fsevents/node_modules/hoek/test/index.js create mode 100644 node_modules/fsevents/node_modules/hoek/test/modules/ignore.txt create mode 100644 node_modules/fsevents/node_modules/hoek/test/modules/test1.js create mode 100644 node_modules/fsevents/node_modules/hoek/test/modules/test2.js create mode 100644 node_modules/fsevents/node_modules/hoek/test/modules/test3.js create mode 100644 node_modules/fsevents/node_modules/http-signature/.dir-locals.el create mode 100644 node_modules/fsevents/node_modules/http-signature/.npmignore create mode 100644 node_modules/fsevents/node_modules/http-signature/CHANGES.md create mode 100644 node_modules/fsevents/node_modules/http-signature/LICENSE create mode 100644 node_modules/fsevents/node_modules/http-signature/README.md create mode 100644 node_modules/fsevents/node_modules/http-signature/http_signing.md create mode 100644 node_modules/fsevents/node_modules/http-signature/lib/index.js create mode 100644 node_modules/fsevents/node_modules/http-signature/lib/parser.js create mode 100644 node_modules/fsevents/node_modules/http-signature/lib/signer.js create mode 100644 node_modules/fsevents/node_modules/http-signature/lib/utils.js create mode 100644 node_modules/fsevents/node_modules/http-signature/lib/verify.js create mode 100644 node_modules/fsevents/node_modules/http-signature/package.json create mode 100644 node_modules/fsevents/node_modules/inflight/LICENSE create mode 100644 node_modules/fsevents/node_modules/inflight/README.md create mode 100644 node_modules/fsevents/node_modules/inflight/inflight.js create mode 100644 node_modules/fsevents/node_modules/inflight/package.json create mode 100644 node_modules/fsevents/node_modules/inherits/LICENSE create mode 100644 node_modules/fsevents/node_modules/inherits/README.md create mode 100644 node_modules/fsevents/node_modules/inherits/inherits.js create mode 100644 node_modules/fsevents/node_modules/inherits/inherits_browser.js create mode 100644 node_modules/fsevents/node_modules/inherits/package.json create mode 100644 node_modules/fsevents/node_modules/ini/LICENSE create mode 100644 node_modules/fsevents/node_modules/ini/README.md create mode 100644 node_modules/fsevents/node_modules/ini/ini.js create mode 100644 node_modules/fsevents/node_modules/ini/package.json create mode 100644 node_modules/fsevents/node_modules/is-fullwidth-code-point/index.js create mode 100644 node_modules/fsevents/node_modules/is-fullwidth-code-point/license create mode 100644 node_modules/fsevents/node_modules/is-fullwidth-code-point/package.json create mode 100644 node_modules/fsevents/node_modules/is-fullwidth-code-point/readme.md create mode 100644 node_modules/fsevents/node_modules/is-typedarray/LICENSE.md create mode 100644 node_modules/fsevents/node_modules/is-typedarray/README.md create mode 100644 node_modules/fsevents/node_modules/is-typedarray/index.js create mode 100644 node_modules/fsevents/node_modules/is-typedarray/package.json create mode 100644 node_modules/fsevents/node_modules/is-typedarray/test.js create mode 100644 node_modules/fsevents/node_modules/isarray/.npmignore create mode 100644 node_modules/fsevents/node_modules/isarray/.travis.yml create mode 100644 node_modules/fsevents/node_modules/isarray/Makefile create mode 100644 node_modules/fsevents/node_modules/isarray/README.md create mode 100644 node_modules/fsevents/node_modules/isarray/component.json create mode 100644 node_modules/fsevents/node_modules/isarray/index.js create mode 100644 node_modules/fsevents/node_modules/isarray/package.json create mode 100644 node_modules/fsevents/node_modules/isarray/test.js create mode 100644 node_modules/fsevents/node_modules/isstream/.jshintrc create mode 100644 node_modules/fsevents/node_modules/isstream/.npmignore create mode 100644 node_modules/fsevents/node_modules/isstream/.travis.yml create mode 100644 node_modules/fsevents/node_modules/isstream/LICENSE.md create mode 100644 node_modules/fsevents/node_modules/isstream/README.md create mode 100644 node_modules/fsevents/node_modules/isstream/isstream.js create mode 100644 node_modules/fsevents/node_modules/isstream/package.json create mode 100644 node_modules/fsevents/node_modules/isstream/test.js create mode 100644 node_modules/fsevents/node_modules/jodid25519/.npmignore create mode 100644 node_modules/fsevents/node_modules/jodid25519/.travis.yml create mode 100644 node_modules/fsevents/node_modules/jodid25519/AUTHORS.md create mode 100644 node_modules/fsevents/node_modules/jodid25519/LICENSE create mode 100644 node_modules/fsevents/node_modules/jodid25519/README.md create mode 100644 node_modules/fsevents/node_modules/jodid25519/almond.0 create mode 100644 node_modules/fsevents/node_modules/jodid25519/almond.1 create mode 100644 node_modules/fsevents/node_modules/jodid25519/index.js create mode 100644 node_modules/fsevents/node_modules/jodid25519/jsdoc.json create mode 100644 node_modules/fsevents/node_modules/jodid25519/lib/core.js create mode 100644 node_modules/fsevents/node_modules/jodid25519/lib/curve255.js create mode 100644 node_modules/fsevents/node_modules/jodid25519/lib/dh.js create mode 100644 node_modules/fsevents/node_modules/jodid25519/lib/eddsa.js create mode 100644 node_modules/fsevents/node_modules/jodid25519/lib/utils.js create mode 100644 node_modules/fsevents/node_modules/jodid25519/package.json create mode 100644 node_modules/fsevents/node_modules/jsbn/.npmignore create mode 100644 node_modules/fsevents/node_modules/jsbn/LICENSE create mode 100644 node_modules/fsevents/node_modules/jsbn/README.md create mode 100644 node_modules/fsevents/node_modules/jsbn/example.html create mode 100644 node_modules/fsevents/node_modules/jsbn/example.js create mode 100644 node_modules/fsevents/node_modules/jsbn/index.js create mode 100644 node_modules/fsevents/node_modules/jsbn/package.json create mode 100644 node_modules/fsevents/node_modules/json-schema/README.md create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-00/hyper-schema create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-00/json-ref create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-00/links create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-00/schema create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-01/hyper-schema create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-01/json-ref create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-01/links create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-01/schema create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-02/hyper-schema create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-02/json-ref create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-02/links create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-02/schema create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-03/examples/address create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-03/examples/calendar create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-03/examples/card create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-03/examples/geo create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-03/examples/interfaces create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-03/hyper-schema create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-03/json-ref create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-03/links create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-03/schema create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-04/hyper-schema create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-04/links create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-04/schema create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-zyp-json-schema-03.xml create mode 100644 node_modules/fsevents/node_modules/json-schema/draft-zyp-json-schema-04.xml create mode 100644 node_modules/fsevents/node_modules/json-schema/lib/links.js create mode 100644 node_modules/fsevents/node_modules/json-schema/lib/validate.js create mode 100644 node_modules/fsevents/node_modules/json-schema/package.json create mode 100644 node_modules/fsevents/node_modules/json-schema/test/tests.js create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/.npmignore create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/.travis.yml create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/LICENSE create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/example/key_cmp.js create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/example/nested.js create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/example/str.js create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/example/value_cmp.js create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/index.js create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/package.json create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/readme.markdown create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/test/cmp.js create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/test/nested.js create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/test/replacer.js create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/test/space.js create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/test/str.js create mode 100644 node_modules/fsevents/node_modules/json-stable-stringify/test/to-json.js create mode 100644 node_modules/fsevents/node_modules/json-stringify-safe/.npmignore create mode 100644 node_modules/fsevents/node_modules/json-stringify-safe/CHANGELOG.md create mode 100644 node_modules/fsevents/node_modules/json-stringify-safe/LICENSE create mode 100644 node_modules/fsevents/node_modules/json-stringify-safe/Makefile create mode 100644 node_modules/fsevents/node_modules/json-stringify-safe/README.md create mode 100644 node_modules/fsevents/node_modules/json-stringify-safe/package.json create mode 100644 node_modules/fsevents/node_modules/json-stringify-safe/stringify.js create mode 100644 node_modules/fsevents/node_modules/json-stringify-safe/test/mocha.opts create mode 100644 node_modules/fsevents/node_modules/json-stringify-safe/test/stringify_test.js create mode 100644 node_modules/fsevents/node_modules/jsonify/README.markdown create mode 100644 node_modules/fsevents/node_modules/jsonify/index.js create mode 100644 node_modules/fsevents/node_modules/jsonify/lib/parse.js create mode 100644 node_modules/fsevents/node_modules/jsonify/lib/stringify.js create mode 100644 node_modules/fsevents/node_modules/jsonify/package.json create mode 100644 node_modules/fsevents/node_modules/jsonify/test/parse.js create mode 100644 node_modules/fsevents/node_modules/jsonify/test/stringify.js create mode 100644 node_modules/fsevents/node_modules/jsprim/CHANGES.md create mode 100644 node_modules/fsevents/node_modules/jsprim/LICENSE create mode 100644 node_modules/fsevents/node_modules/jsprim/README.md create mode 100644 node_modules/fsevents/node_modules/jsprim/lib/jsprim.js create mode 100644 node_modules/fsevents/node_modules/jsprim/node_modules/assert-plus/AUTHORS create mode 100644 node_modules/fsevents/node_modules/jsprim/node_modules/assert-plus/CHANGES.md create mode 100644 node_modules/fsevents/node_modules/jsprim/node_modules/assert-plus/README.md create mode 100644 node_modules/fsevents/node_modules/jsprim/node_modules/assert-plus/assert.js create mode 100644 node_modules/fsevents/node_modules/jsprim/node_modules/assert-plus/package.json create mode 100644 node_modules/fsevents/node_modules/jsprim/package.json create mode 100644 node_modules/fsevents/node_modules/mime-db/HISTORY.md create mode 100644 node_modules/fsevents/node_modules/mime-db/LICENSE create mode 100644 node_modules/fsevents/node_modules/mime-db/README.md create mode 100644 node_modules/fsevents/node_modules/mime-db/db.json create mode 100644 node_modules/fsevents/node_modules/mime-db/index.js create mode 100644 node_modules/fsevents/node_modules/mime-db/package.json create mode 100644 node_modules/fsevents/node_modules/mime-types/HISTORY.md create mode 100644 node_modules/fsevents/node_modules/mime-types/LICENSE create mode 100644 node_modules/fsevents/node_modules/mime-types/README.md create mode 100644 node_modules/fsevents/node_modules/mime-types/index.js create mode 100644 node_modules/fsevents/node_modules/mime-types/package.json create mode 100644 node_modules/fsevents/node_modules/minimatch/LICENSE create mode 100644 node_modules/fsevents/node_modules/minimatch/README.md create mode 100644 node_modules/fsevents/node_modules/minimatch/minimatch.js create mode 100644 node_modules/fsevents/node_modules/minimatch/package.json create mode 100644 node_modules/fsevents/node_modules/minimist/.travis.yml create mode 100644 node_modules/fsevents/node_modules/minimist/LICENSE create mode 100644 node_modules/fsevents/node_modules/minimist/example/parse.js create mode 100644 node_modules/fsevents/node_modules/minimist/index.js create mode 100644 node_modules/fsevents/node_modules/minimist/package.json create mode 100644 node_modules/fsevents/node_modules/minimist/readme.markdown create mode 100644 node_modules/fsevents/node_modules/minimist/test/dash.js create mode 100644 node_modules/fsevents/node_modules/minimist/test/default_bool.js create mode 100644 node_modules/fsevents/node_modules/minimist/test/dotted.js create mode 100644 node_modules/fsevents/node_modules/minimist/test/long.js create mode 100644 node_modules/fsevents/node_modules/minimist/test/parse.js create mode 100644 node_modules/fsevents/node_modules/minimist/test/parse_modified.js create mode 100644 node_modules/fsevents/node_modules/minimist/test/short.js create mode 100644 node_modules/fsevents/node_modules/minimist/test/whitespace.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/.travis.yml create mode 100644 node_modules/fsevents/node_modules/mkdirp/LICENSE create mode 100755 node_modules/fsevents/node_modules/mkdirp/bin/cmd.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/bin/usage.txt create mode 100644 node_modules/fsevents/node_modules/mkdirp/examples/pow.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/index.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/package.json create mode 100644 node_modules/fsevents/node_modules/mkdirp/readme.markdown create mode 100644 node_modules/fsevents/node_modules/mkdirp/test/chmod.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/test/clobber.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/test/mkdirp.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/test/opts_fs.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/test/opts_fs_sync.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/test/perm.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/test/perm_sync.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/test/race.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/test/rel.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/test/return.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/test/return_sync.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/test/root.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/test/sync.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/test/umask.js create mode 100644 node_modules/fsevents/node_modules/mkdirp/test/umask_sync.js create mode 100644 node_modules/fsevents/node_modules/ms/index.js create mode 100644 node_modules/fsevents/node_modules/ms/license.md create mode 100644 node_modules/fsevents/node_modules/ms/package.json create mode 100644 node_modules/fsevents/node_modules/ms/readme.md create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/CHANGELOG.md create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/LICENSE create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/README.md create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/appveyor.yml create mode 100755 node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp.cmd create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/contributing.md create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/build.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/clean.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/configure.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/info.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/install.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/node-pre-gyp.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/package.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/pre-binding.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/publish.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/rebuild.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/reinstall.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/reveal.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/testbinary.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/testpackage.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/unpublish.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/package.json create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/util/s3_setup.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/lib/util/versioning.js create mode 100644 node_modules/fsevents/node_modules/node-pre-gyp/package.json create mode 100644 node_modules/fsevents/node_modules/nopt/.npmignore create mode 100644 node_modules/fsevents/node_modules/nopt/.travis.yml create mode 100644 node_modules/fsevents/node_modules/nopt/CHANGELOG.md create mode 100644 node_modules/fsevents/node_modules/nopt/LICENSE create mode 100644 node_modules/fsevents/node_modules/nopt/README.md create mode 100755 node_modules/fsevents/node_modules/nopt/bin/nopt.js create mode 100755 node_modules/fsevents/node_modules/nopt/examples/my-program.js create mode 100644 node_modules/fsevents/node_modules/nopt/lib/nopt.js create mode 100644 node_modules/fsevents/node_modules/nopt/package.json create mode 100644 node_modules/fsevents/node_modules/nopt/test/basic.js create mode 100644 node_modules/fsevents/node_modules/npmlog/CHANGELOG.md create mode 100644 node_modules/fsevents/node_modules/npmlog/LICENSE create mode 100644 node_modules/fsevents/node_modules/npmlog/README.md create mode 100644 node_modules/fsevents/node_modules/npmlog/log.js create mode 100644 node_modules/fsevents/node_modules/npmlog/package.json create mode 100644 node_modules/fsevents/node_modules/number-is-nan/index.js create mode 100644 node_modules/fsevents/node_modules/number-is-nan/license create mode 100644 node_modules/fsevents/node_modules/number-is-nan/package.json create mode 100644 node_modules/fsevents/node_modules/number-is-nan/readme.md create mode 100644 node_modules/fsevents/node_modules/oauth-sign/LICENSE create mode 100644 node_modules/fsevents/node_modules/oauth-sign/README.md create mode 100644 node_modules/fsevents/node_modules/oauth-sign/index.js create mode 100644 node_modules/fsevents/node_modules/oauth-sign/package.json create mode 100644 node_modules/fsevents/node_modules/object-assign/index.js create mode 100644 node_modules/fsevents/node_modules/object-assign/license create mode 100644 node_modules/fsevents/node_modules/object-assign/package.json create mode 100644 node_modules/fsevents/node_modules/object-assign/readme.md create mode 100644 node_modules/fsevents/node_modules/once/LICENSE create mode 100644 node_modules/fsevents/node_modules/once/README.md create mode 100644 node_modules/fsevents/node_modules/once/once.js create mode 100644 node_modules/fsevents/node_modules/once/package.json create mode 100644 node_modules/fsevents/node_modules/os-homedir/index.js create mode 100644 node_modules/fsevents/node_modules/os-homedir/license create mode 100644 node_modules/fsevents/node_modules/os-homedir/package.json create mode 100644 node_modules/fsevents/node_modules/os-homedir/readme.md create mode 100644 node_modules/fsevents/node_modules/os-tmpdir/index.js create mode 100644 node_modules/fsevents/node_modules/os-tmpdir/license create mode 100644 node_modules/fsevents/node_modules/os-tmpdir/package.json create mode 100644 node_modules/fsevents/node_modules/os-tmpdir/readme.md create mode 100644 node_modules/fsevents/node_modules/osenv/.npmignore create mode 100644 node_modules/fsevents/node_modules/osenv/.travis.yml create mode 100644 node_modules/fsevents/node_modules/osenv/LICENSE create mode 100644 node_modules/fsevents/node_modules/osenv/README.md create mode 100644 node_modules/fsevents/node_modules/osenv/osenv.js create mode 100644 node_modules/fsevents/node_modules/osenv/package.json create mode 100644 node_modules/fsevents/node_modules/osenv/test/unix.js create mode 100644 node_modules/fsevents/node_modules/osenv/test/windows.js create mode 100644 node_modules/fsevents/node_modules/osenv/x.tap create mode 100644 node_modules/fsevents/node_modules/path-is-absolute/index.js create mode 100644 node_modules/fsevents/node_modules/path-is-absolute/license create mode 100644 node_modules/fsevents/node_modules/path-is-absolute/package.json create mode 100644 node_modules/fsevents/node_modules/path-is-absolute/readme.md create mode 100644 node_modules/fsevents/node_modules/performance-now/.npmignore create mode 100644 node_modules/fsevents/node_modules/performance-now/.tm_properties create mode 100644 node_modules/fsevents/node_modules/performance-now/.travis.yml create mode 100644 node_modules/fsevents/node_modules/performance-now/Makefile create mode 100644 node_modules/fsevents/node_modules/performance-now/README.md create mode 100644 node_modules/fsevents/node_modules/performance-now/lib/performance-now.js create mode 100644 node_modules/fsevents/node_modules/performance-now/license.txt create mode 100644 node_modules/fsevents/node_modules/performance-now/package.json create mode 100644 node_modules/fsevents/node_modules/performance-now/src/performance-now.coffee create mode 100644 node_modules/fsevents/node_modules/performance-now/test/mocha.opts create mode 100644 node_modules/fsevents/node_modules/performance-now/test/performance-now.coffee create mode 100644 node_modules/fsevents/node_modules/process-nextick-args/.travis.yml create mode 100644 node_modules/fsevents/node_modules/process-nextick-args/index.js create mode 100644 node_modules/fsevents/node_modules/process-nextick-args/license.md create mode 100644 node_modules/fsevents/node_modules/process-nextick-args/package.json create mode 100644 node_modules/fsevents/node_modules/process-nextick-args/readme.md create mode 100644 node_modules/fsevents/node_modules/process-nextick-args/test.js create mode 100644 node_modules/fsevents/node_modules/punycode/LICENSE-MIT.txt create mode 100644 node_modules/fsevents/node_modules/punycode/README.md create mode 100644 node_modules/fsevents/node_modules/punycode/package.json create mode 100644 node_modules/fsevents/node_modules/punycode/punycode.js create mode 100644 node_modules/fsevents/node_modules/qs/.eslintignore create mode 100644 node_modules/fsevents/node_modules/qs/.eslintrc create mode 100644 node_modules/fsevents/node_modules/qs/.jscs.json create mode 100644 node_modules/fsevents/node_modules/qs/CHANGELOG.md create mode 100644 node_modules/fsevents/node_modules/qs/LICENSE create mode 100644 node_modules/fsevents/node_modules/qs/README.md create mode 100644 node_modules/fsevents/node_modules/qs/dist/qs.js create mode 100644 node_modules/fsevents/node_modules/qs/lib/formats.js create mode 100644 node_modules/fsevents/node_modules/qs/lib/index.js create mode 100644 node_modules/fsevents/node_modules/qs/lib/parse.js create mode 100644 node_modules/fsevents/node_modules/qs/lib/stringify.js create mode 100644 node_modules/fsevents/node_modules/qs/lib/utils.js create mode 100644 node_modules/fsevents/node_modules/qs/package.json create mode 100644 node_modules/fsevents/node_modules/qs/test/.eslintrc create mode 100644 node_modules/fsevents/node_modules/qs/test/index.js create mode 100644 node_modules/fsevents/node_modules/qs/test/parse.js create mode 100644 node_modules/fsevents/node_modules/qs/test/stringify.js create mode 100644 node_modules/fsevents/node_modules/qs/test/utils.js create mode 100644 node_modules/fsevents/node_modules/rc/.npmignore create mode 100644 node_modules/fsevents/node_modules/rc/LICENSE.APACHE2 create mode 100644 node_modules/fsevents/node_modules/rc/LICENSE.BSD create mode 100644 node_modules/fsevents/node_modules/rc/LICENSE.MIT create mode 100644 node_modules/fsevents/node_modules/rc/README.md create mode 100644 node_modules/fsevents/node_modules/rc/browser.js create mode 100755 node_modules/fsevents/node_modules/rc/index.js create mode 100644 node_modules/fsevents/node_modules/rc/lib/utils.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/.travis.yml create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/LICENSE create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/example/parse.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/index.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/package.json create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/readme.markdown create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/test/all_bool.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/test/bool.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/test/dash.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/test/default_bool.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/test/dotted.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/test/kv_short.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/test/long.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/test/num.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/test/parse.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/test/parse_modified.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/test/short.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/test/stop_early.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/test/unknown.js create mode 100644 node_modules/fsevents/node_modules/rc/node_modules/minimist/test/whitespace.js create mode 100644 node_modules/fsevents/node_modules/rc/package.json create mode 100644 node_modules/fsevents/node_modules/rc/test/ini.js create mode 100644 node_modules/fsevents/node_modules/rc/test/nested-env-vars.js create mode 100644 node_modules/fsevents/node_modules/rc/test/test.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/.npmignore create mode 100644 node_modules/fsevents/node_modules/readable-stream/.travis.yml create mode 100644 node_modules/fsevents/node_modules/readable-stream/CONTRIBUTING.md create mode 100644 node_modules/fsevents/node_modules/readable-stream/GOVERNANCE.md create mode 100644 node_modules/fsevents/node_modules/readable-stream/LICENSE create mode 100644 node_modules/fsevents/node_modules/readable-stream/README.md create mode 100644 node_modules/fsevents/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md create mode 100644 node_modules/fsevents/node_modules/readable-stream/duplex-browser.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/duplex.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/lib/_stream_duplex.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/lib/_stream_passthrough.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/lib/_stream_readable.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/lib/_stream_transform.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/lib/_stream_writable.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/lib/internal/streams/BufferList.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/lib/internal/streams/stream-browser.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/lib/internal/streams/stream.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/package.json create mode 100644 node_modules/fsevents/node_modules/readable-stream/passthrough.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/readable-browser.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/readable.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/transform.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/writable-browser.js create mode 100644 node_modules/fsevents/node_modules/readable-stream/writable.js create mode 100644 node_modules/fsevents/node_modules/request/CHANGELOG.md create mode 100644 node_modules/fsevents/node_modules/request/LICENSE create mode 100644 node_modules/fsevents/node_modules/request/README.md create mode 100755 node_modules/fsevents/node_modules/request/index.js create mode 100644 node_modules/fsevents/node_modules/request/lib/auth.js create mode 100644 node_modules/fsevents/node_modules/request/lib/cookies.js create mode 100644 node_modules/fsevents/node_modules/request/lib/getProxyFromURI.js create mode 100644 node_modules/fsevents/node_modules/request/lib/har.js create mode 100644 node_modules/fsevents/node_modules/request/lib/helpers.js create mode 100644 node_modules/fsevents/node_modules/request/lib/multipart.js create mode 100644 node_modules/fsevents/node_modules/request/lib/oauth.js create mode 100644 node_modules/fsevents/node_modules/request/lib/querystring.js create mode 100644 node_modules/fsevents/node_modules/request/lib/redirect.js create mode 100644 node_modules/fsevents/node_modules/request/lib/tunnel.js create mode 100644 node_modules/fsevents/node_modules/request/package.json create mode 100644 node_modules/fsevents/node_modules/request/request.js create mode 100644 node_modules/fsevents/node_modules/rimraf/LICENSE create mode 100644 node_modules/fsevents/node_modules/rimraf/README.md create mode 100755 node_modules/fsevents/node_modules/rimraf/bin.js create mode 100644 node_modules/fsevents/node_modules/rimraf/package.json create mode 100644 node_modules/fsevents/node_modules/rimraf/rimraf.js create mode 100644 node_modules/fsevents/node_modules/safe-buffer/.travis.yml create mode 100644 node_modules/fsevents/node_modules/safe-buffer/LICENSE create mode 100644 node_modules/fsevents/node_modules/safe-buffer/README.md create mode 100644 node_modules/fsevents/node_modules/safe-buffer/browser.js create mode 100644 node_modules/fsevents/node_modules/safe-buffer/index.js create mode 100644 node_modules/fsevents/node_modules/safe-buffer/package.json create mode 100644 node_modules/fsevents/node_modules/safe-buffer/test.js create mode 100644 node_modules/fsevents/node_modules/semver/LICENSE create mode 100644 node_modules/fsevents/node_modules/semver/README.md create mode 100755 node_modules/fsevents/node_modules/semver/bin/semver create mode 100644 node_modules/fsevents/node_modules/semver/package.json create mode 100644 node_modules/fsevents/node_modules/semver/range.bnf create mode 100644 node_modules/fsevents/node_modules/semver/semver.js create mode 100644 node_modules/fsevents/node_modules/set-blocking/CHANGELOG.md create mode 100644 node_modules/fsevents/node_modules/set-blocking/LICENSE.txt create mode 100644 node_modules/fsevents/node_modules/set-blocking/README.md create mode 100644 node_modules/fsevents/node_modules/set-blocking/index.js create mode 100644 node_modules/fsevents/node_modules/set-blocking/package.json create mode 100644 node_modules/fsevents/node_modules/signal-exit/CHANGELOG.md create mode 100644 node_modules/fsevents/node_modules/signal-exit/LICENSE.txt create mode 100644 node_modules/fsevents/node_modules/signal-exit/README.md create mode 100644 node_modules/fsevents/node_modules/signal-exit/index.js create mode 100644 node_modules/fsevents/node_modules/signal-exit/package.json create mode 100644 node_modules/fsevents/node_modules/signal-exit/signals.js create mode 100644 node_modules/fsevents/node_modules/sntp/.npmignore create mode 100755 node_modules/fsevents/node_modules/sntp/.travis.yml create mode 100755 node_modules/fsevents/node_modules/sntp/LICENSE create mode 100755 node_modules/fsevents/node_modules/sntp/Makefile create mode 100755 node_modules/fsevents/node_modules/sntp/README.md create mode 100755 node_modules/fsevents/node_modules/sntp/examples/offset.js create mode 100755 node_modules/fsevents/node_modules/sntp/examples/time.js create mode 100755 node_modules/fsevents/node_modules/sntp/index.js create mode 100755 node_modules/fsevents/node_modules/sntp/lib/index.js create mode 100755 node_modules/fsevents/node_modules/sntp/package.json create mode 100755 node_modules/fsevents/node_modules/sntp/test/index.js create mode 100644 node_modules/fsevents/node_modules/sshpk/.npmignore create mode 100644 node_modules/fsevents/node_modules/sshpk/.travis.yml create mode 100644 node_modules/fsevents/node_modules/sshpk/LICENSE create mode 100644 node_modules/fsevents/node_modules/sshpk/README.md create mode 100755 node_modules/fsevents/node_modules/sshpk/bin/sshpk-conv create mode 100755 node_modules/fsevents/node_modules/sshpk/bin/sshpk-sign create mode 100755 node_modules/fsevents/node_modules/sshpk/bin/sshpk-verify create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/algs.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/certificate.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/dhe.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/ed-compat.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/errors.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/fingerprint.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/formats/auto.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/formats/openssh-cert.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/formats/pem.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/formats/pkcs1.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/formats/pkcs8.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/formats/rfc4253.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/formats/ssh-private.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/formats/ssh.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/formats/x509-pem.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/formats/x509.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/identity.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/index.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/key.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/private-key.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/signature.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/ssh-buffer.js create mode 100644 node_modules/fsevents/node_modules/sshpk/lib/utils.js create mode 100644 node_modules/fsevents/node_modules/sshpk/man/man1/sshpk-conv.1 create mode 100644 node_modules/fsevents/node_modules/sshpk/man/man1/sshpk-sign.1 create mode 100644 node_modules/fsevents/node_modules/sshpk/man/man1/sshpk-verify.1 create mode 100644 node_modules/fsevents/node_modules/sshpk/node_modules/assert-plus/AUTHORS create mode 100644 node_modules/fsevents/node_modules/sshpk/node_modules/assert-plus/CHANGES.md create mode 100644 node_modules/fsevents/node_modules/sshpk/node_modules/assert-plus/README.md create mode 100644 node_modules/fsevents/node_modules/sshpk/node_modules/assert-plus/assert.js create mode 100644 node_modules/fsevents/node_modules/sshpk/node_modules/assert-plus/package.json create mode 100644 node_modules/fsevents/node_modules/sshpk/package.json create mode 100644 node_modules/fsevents/node_modules/string-width/index.js create mode 100644 node_modules/fsevents/node_modules/string-width/license create mode 100644 node_modules/fsevents/node_modules/string-width/package.json create mode 100644 node_modules/fsevents/node_modules/string-width/readme.md create mode 100644 node_modules/fsevents/node_modules/string_decoder/.npmignore create mode 100644 node_modules/fsevents/node_modules/string_decoder/LICENSE create mode 100644 node_modules/fsevents/node_modules/string_decoder/README.md create mode 100644 node_modules/fsevents/node_modules/string_decoder/lib/string_decoder.js create mode 100644 node_modules/fsevents/node_modules/string_decoder/package.json create mode 100644 node_modules/fsevents/node_modules/stringstream/.npmignore create mode 100644 node_modules/fsevents/node_modules/stringstream/.travis.yml create mode 100644 node_modules/fsevents/node_modules/stringstream/LICENSE.txt create mode 100644 node_modules/fsevents/node_modules/stringstream/README.md create mode 100644 node_modules/fsevents/node_modules/stringstream/example.js create mode 100644 node_modules/fsevents/node_modules/stringstream/package.json create mode 100644 node_modules/fsevents/node_modules/stringstream/stringstream.js create mode 100644 node_modules/fsevents/node_modules/strip-ansi/index.js create mode 100644 node_modules/fsevents/node_modules/strip-ansi/license create mode 100644 node_modules/fsevents/node_modules/strip-ansi/package.json create mode 100644 node_modules/fsevents/node_modules/strip-ansi/readme.md create mode 100644 node_modules/fsevents/node_modules/strip-json-comments/index.js create mode 100644 node_modules/fsevents/node_modules/strip-json-comments/license create mode 100644 node_modules/fsevents/node_modules/strip-json-comments/package.json create mode 100644 node_modules/fsevents/node_modules/strip-json-comments/readme.md create mode 100644 node_modules/fsevents/node_modules/tar-pack/.npmignore create mode 100644 node_modules/fsevents/node_modules/tar-pack/.travis.yml create mode 100644 node_modules/fsevents/node_modules/tar-pack/LICENSE create mode 100644 node_modules/fsevents/node_modules/tar-pack/README.md create mode 100644 node_modules/fsevents/node_modules/tar-pack/index.js create mode 100644 node_modules/fsevents/node_modules/tar-pack/package.json create mode 100644 node_modules/fsevents/node_modules/tar-pack/test/fixtures/packed-file.txt create mode 100644 node_modules/fsevents/node_modules/tar-pack/test/fixtures/packed.tar create mode 100644 node_modules/fsevents/node_modules/tar-pack/test/fixtures/packed.tar.gz create mode 100644 node_modules/fsevents/node_modules/tar-pack/test/fixtures/to-pack/bar.txt create mode 100644 node_modules/fsevents/node_modules/tar-pack/test/fixtures/to-pack/foo.txt create mode 100644 node_modules/fsevents/node_modules/tar-pack/test/index.js create mode 100644 node_modules/fsevents/node_modules/tar/.npmignore create mode 100644 node_modules/fsevents/node_modules/tar/.travis.yml create mode 100644 node_modules/fsevents/node_modules/tar/LICENSE create mode 100644 node_modules/fsevents/node_modules/tar/README.md create mode 100644 node_modules/fsevents/node_modules/tar/examples/extracter.js create mode 100644 node_modules/fsevents/node_modules/tar/examples/packer.js create mode 100644 node_modules/fsevents/node_modules/tar/examples/reader.js create mode 100644 node_modules/fsevents/node_modules/tar/lib/buffer-entry.js create mode 100644 node_modules/fsevents/node_modules/tar/lib/entry-writer.js create mode 100644 node_modules/fsevents/node_modules/tar/lib/entry.js create mode 100644 node_modules/fsevents/node_modules/tar/lib/extended-header-writer.js create mode 100644 node_modules/fsevents/node_modules/tar/lib/extended-header.js create mode 100644 node_modules/fsevents/node_modules/tar/lib/extract.js create mode 100644 node_modules/fsevents/node_modules/tar/lib/global-header-writer.js create mode 100644 node_modules/fsevents/node_modules/tar/lib/header.js create mode 100644 node_modules/fsevents/node_modules/tar/lib/pack.js create mode 100644 node_modules/fsevents/node_modules/tar/lib/parse.js create mode 100644 node_modules/fsevents/node_modules/tar/package.json create mode 100644 node_modules/fsevents/node_modules/tar/tar.js create mode 100644 node_modules/fsevents/node_modules/tar/test/00-setup-fixtures.js create mode 100644 node_modules/fsevents/node_modules/tar/test/cb-never-called-1.0.1.tgz create mode 100644 node_modules/fsevents/node_modules/tar/test/dir-normalization.js create mode 100644 node_modules/fsevents/node_modules/tar/test/dir-normalization.tar create mode 100644 node_modules/fsevents/node_modules/tar/test/error-on-broken.js create mode 100644 node_modules/fsevents/node_modules/tar/test/extract-move.js create mode 100644 node_modules/fsevents/node_modules/tar/test/extract.js create mode 100644 node_modules/fsevents/node_modules/tar/test/fixtures.tgz create mode 100644 node_modules/fsevents/node_modules/tar/test/header.js create mode 100644 node_modules/fsevents/node_modules/tar/test/pack-no-proprietary.js create mode 100644 node_modules/fsevents/node_modules/tar/test/pack.js create mode 100644 node_modules/fsevents/node_modules/tar/test/parse-discard.js create mode 100644 node_modules/fsevents/node_modules/tar/test/parse.js create mode 100644 node_modules/fsevents/node_modules/tar/test/zz-cleanup.js create mode 100644 node_modules/fsevents/node_modules/tough-cookie/LICENSE create mode 100644 node_modules/fsevents/node_modules/tough-cookie/README.md create mode 100644 node_modules/fsevents/node_modules/tough-cookie/lib/cookie.js create mode 100644 node_modules/fsevents/node_modules/tough-cookie/lib/memstore.js create mode 100644 node_modules/fsevents/node_modules/tough-cookie/lib/pathMatch.js create mode 100644 node_modules/fsevents/node_modules/tough-cookie/lib/permuteDomain.js create mode 100644 node_modules/fsevents/node_modules/tough-cookie/lib/pubsuffix.js create mode 100644 node_modules/fsevents/node_modules/tough-cookie/lib/store.js create mode 100644 node_modules/fsevents/node_modules/tough-cookie/package.json create mode 100644 node_modules/fsevents/node_modules/tunnel-agent/LICENSE create mode 100644 node_modules/fsevents/node_modules/tunnel-agent/README.md create mode 100644 node_modules/fsevents/node_modules/tunnel-agent/index.js create mode 100644 node_modules/fsevents/node_modules/tunnel-agent/package.json create mode 100644 node_modules/fsevents/node_modules/tweetnacl/.npmignore create mode 100644 node_modules/fsevents/node_modules/tweetnacl/AUTHORS.md create mode 100644 node_modules/fsevents/node_modules/tweetnacl/CHANGELOG.md create mode 100644 node_modules/fsevents/node_modules/tweetnacl/LICENSE create mode 100644 node_modules/fsevents/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md create mode 100644 node_modules/fsevents/node_modules/tweetnacl/README.md create mode 100644 node_modules/fsevents/node_modules/tweetnacl/nacl-fast.js create mode 100644 node_modules/fsevents/node_modules/tweetnacl/nacl-fast.min.js create mode 100644 node_modules/fsevents/node_modules/tweetnacl/nacl.d.ts create mode 100644 node_modules/fsevents/node_modules/tweetnacl/nacl.js create mode 100644 node_modules/fsevents/node_modules/tweetnacl/nacl.min.js create mode 100644 node_modules/fsevents/node_modules/tweetnacl/package.json create mode 100644 node_modules/fsevents/node_modules/uid-number/LICENSE create mode 100644 node_modules/fsevents/node_modules/uid-number/README.md create mode 100755 node_modules/fsevents/node_modules/uid-number/get-uid-gid.js create mode 100644 node_modules/fsevents/node_modules/uid-number/package.json create mode 100644 node_modules/fsevents/node_modules/uid-number/uid-number.js create mode 100644 node_modules/fsevents/node_modules/util-deprecate/History.md create mode 100644 node_modules/fsevents/node_modules/util-deprecate/LICENSE create mode 100644 node_modules/fsevents/node_modules/util-deprecate/README.md create mode 100644 node_modules/fsevents/node_modules/util-deprecate/browser.js create mode 100644 node_modules/fsevents/node_modules/util-deprecate/node.js create mode 100644 node_modules/fsevents/node_modules/util-deprecate/package.json create mode 100644 node_modules/fsevents/node_modules/uuid/.npmignore create mode 100644 node_modules/fsevents/node_modules/uuid/.travis.yml create mode 100644 node_modules/fsevents/node_modules/uuid/AUTHORS create mode 100644 node_modules/fsevents/node_modules/uuid/HISTORY.md create mode 100644 node_modules/fsevents/node_modules/uuid/LICENSE.md create mode 100644 node_modules/fsevents/node_modules/uuid/README.md create mode 100755 node_modules/fsevents/node_modules/uuid/bin/uuid create mode 100644 node_modules/fsevents/node_modules/uuid/index.js create mode 100644 node_modules/fsevents/node_modules/uuid/lib/bytesToUuid.js create mode 100644 node_modules/fsevents/node_modules/uuid/lib/rng-browser.js create mode 100644 node_modules/fsevents/node_modules/uuid/lib/rng.js create mode 100644 node_modules/fsevents/node_modules/uuid/package.json create mode 100644 node_modules/fsevents/node_modules/uuid/test/mocha.opts create mode 100644 node_modules/fsevents/node_modules/uuid/test/test.js create mode 100644 node_modules/fsevents/node_modules/uuid/v1.js create mode 100644 node_modules/fsevents/node_modules/uuid/v4.js create mode 100644 node_modules/fsevents/node_modules/verror/.gitmodules create mode 100644 node_modules/fsevents/node_modules/verror/.npmignore create mode 100644 node_modules/fsevents/node_modules/verror/LICENSE create mode 100644 node_modules/fsevents/node_modules/verror/Makefile create mode 100644 node_modules/fsevents/node_modules/verror/Makefile.targ create mode 100644 node_modules/fsevents/node_modules/verror/README.md create mode 100644 node_modules/fsevents/node_modules/verror/examples/levels-verror.js create mode 100644 node_modules/fsevents/node_modules/verror/examples/levels-werror.js create mode 100644 node_modules/fsevents/node_modules/verror/examples/varargs.js create mode 100644 node_modules/fsevents/node_modules/verror/examples/verror.js create mode 100644 node_modules/fsevents/node_modules/verror/examples/werror.js create mode 100644 node_modules/fsevents/node_modules/verror/jsl.node.conf create mode 100644 node_modules/fsevents/node_modules/verror/lib/verror.js create mode 100644 node_modules/fsevents/node_modules/verror/package.json create mode 100644 node_modules/fsevents/node_modules/verror/tests/tst.inherit.js create mode 100644 node_modules/fsevents/node_modules/verror/tests/tst.verror.js create mode 100644 node_modules/fsevents/node_modules/verror/tests/tst.werror.js create mode 100644 node_modules/fsevents/node_modules/wide-align/LICENSE create mode 100644 node_modules/fsevents/node_modules/wide-align/README.md create mode 100644 node_modules/fsevents/node_modules/wide-align/align.js create mode 100644 node_modules/fsevents/node_modules/wide-align/package.json create mode 100644 node_modules/fsevents/node_modules/wrappy/LICENSE create mode 100644 node_modules/fsevents/node_modules/wrappy/README.md create mode 100644 node_modules/fsevents/node_modules/wrappy/package.json create mode 100644 node_modules/fsevents/node_modules/wrappy/wrappy.js create mode 100644 node_modules/fsevents/package.json create mode 100644 node_modules/fsevents/src/async.cc create mode 100644 node_modules/fsevents/src/constants.cc create mode 100644 node_modules/fsevents/src/locking.cc create mode 100644 node_modules/fsevents/src/methods.cc create mode 100644 node_modules/fsevents/src/storage.cc create mode 100644 node_modules/fsevents/src/thread.cc create mode 100644 node_modules/function-bind/.editorconfig create mode 100644 node_modules/function-bind/.eslintrc create mode 100644 node_modules/function-bind/.jscs.json create mode 100644 node_modules/function-bind/.npmignore create mode 100644 node_modules/function-bind/.travis.yml create mode 100644 node_modules/function-bind/LICENSE create mode 100644 node_modules/function-bind/README.md create mode 100644 node_modules/function-bind/implementation.js create mode 100644 node_modules/function-bind/index.js create mode 100644 node_modules/function-bind/package.json create mode 100644 node_modules/function-bind/test/.eslintrc create mode 100644 node_modules/function-bind/test/index.js create mode 100644 node_modules/get-stream/buffer-stream.js create mode 100644 node_modules/get-stream/index.js create mode 100644 node_modules/get-stream/license create mode 100644 node_modules/get-stream/package.json create mode 100644 node_modules/get-stream/readme.md create mode 100644 node_modules/get-value/LICENSE create mode 100644 node_modules/get-value/index.js create mode 100644 node_modules/get-value/package.json create mode 100644 node_modules/glob-parent/LICENSE create mode 100644 node_modules/glob-parent/README.md create mode 100644 node_modules/glob-parent/index.js create mode 100644 node_modules/glob-parent/node_modules/is-glob/LICENSE create mode 100644 node_modules/glob-parent/node_modules/is-glob/README.md create mode 100644 node_modules/glob-parent/node_modules/is-glob/index.js create mode 100644 node_modules/glob-parent/node_modules/is-glob/package.json create mode 100644 node_modules/glob-parent/package.json create mode 100644 node_modules/global-dirs/index.js create mode 100644 node_modules/global-dirs/license create mode 100644 node_modules/global-dirs/package.json create mode 100644 node_modules/global-dirs/readme.md create mode 100644 node_modules/got/index.js create mode 100644 node_modules/got/license create mode 100644 node_modules/got/package.json create mode 100644 node_modules/got/readme.md create mode 100644 node_modules/graceful-fs/LICENSE create mode 100644 node_modules/graceful-fs/README.md create mode 100644 node_modules/graceful-fs/fs.js create mode 100644 node_modules/graceful-fs/graceful-fs.js create mode 100644 node_modules/graceful-fs/legacy-streams.js create mode 100644 node_modules/graceful-fs/package.json create mode 100644 node_modules/graceful-fs/polyfills.js create mode 100644 node_modules/graceful-readlink/.npmignore create mode 100644 node_modules/graceful-readlink/.travis.yml create mode 100644 node_modules/graceful-readlink/LICENSE create mode 100644 node_modules/graceful-readlink/README.md create mode 100644 node_modules/graceful-readlink/index.js create mode 100644 node_modules/graceful-readlink/package.json create mode 100644 node_modules/has-flag/index.js create mode 100644 node_modules/has-flag/license create mode 100644 node_modules/has-flag/package.json create mode 100644 node_modules/has-flag/readme.md create mode 100644 node_modules/has-value/LICENSE create mode 100644 node_modules/has-value/README.md create mode 100644 node_modules/has-value/index.js create mode 100644 node_modules/has-value/package.json create mode 100644 node_modules/has-values/LICENSE create mode 100644 node_modules/has-values/README.md create mode 100644 node_modules/has-values/index.js create mode 100644 node_modules/has-values/node_modules/kind-of/LICENSE create mode 100644 node_modules/has-values/node_modules/kind-of/README.md create mode 100644 node_modules/has-values/node_modules/kind-of/index.js create mode 100644 node_modules/has-values/node_modules/kind-of/package.json create mode 100644 node_modules/has-values/package.json create mode 100644 node_modules/has/.jshintrc create mode 100644 node_modules/has/.npmignore create mode 100644 node_modules/has/LICENSE-MIT create mode 100644 node_modules/has/README.mkd create mode 100644 node_modules/has/package.json create mode 100644 node_modules/has/src/index.js create mode 100644 node_modules/has/test/.jshintrc create mode 100644 node_modules/has/test/index.js create mode 100644 node_modules/http-errors/HISTORY.md create mode 100644 node_modules/http-errors/LICENSE create mode 100644 node_modules/http-errors/README.md create mode 100644 node_modules/http-errors/index.js create mode 100644 node_modules/http-errors/node_modules/depd/History.md create mode 100644 node_modules/http-errors/node_modules/depd/LICENSE create mode 100644 node_modules/http-errors/node_modules/depd/Readme.md create mode 100644 node_modules/http-errors/node_modules/depd/index.js create mode 100644 node_modules/http-errors/node_modules/depd/lib/browser/index.js create mode 100644 node_modules/http-errors/node_modules/depd/lib/compat/callsite-tostring.js create mode 100644 node_modules/http-errors/node_modules/depd/lib/compat/event-listener-count.js create mode 100644 node_modules/http-errors/node_modules/depd/lib/compat/index.js create mode 100644 node_modules/http-errors/node_modules/depd/package.json create mode 100644 node_modules/http-errors/package.json create mode 100644 node_modules/iconv-lite/.npmignore create mode 100644 node_modules/iconv-lite/.travis.yml create mode 100644 node_modules/iconv-lite/Changelog.md create mode 100644 node_modules/iconv-lite/LICENSE create mode 100644 node_modules/iconv-lite/README.md create mode 100644 node_modules/iconv-lite/encodings/dbcs-codec.js create mode 100644 node_modules/iconv-lite/encodings/dbcs-data.js create mode 100644 node_modules/iconv-lite/encodings/index.js create mode 100644 node_modules/iconv-lite/encodings/internal.js create mode 100644 node_modules/iconv-lite/encodings/sbcs-codec.js create mode 100644 node_modules/iconv-lite/encodings/sbcs-data-generated.js create mode 100644 node_modules/iconv-lite/encodings/sbcs-data.js create mode 100644 node_modules/iconv-lite/encodings/tables/big5-added.json create mode 100644 node_modules/iconv-lite/encodings/tables/cp936.json create mode 100644 node_modules/iconv-lite/encodings/tables/cp949.json create mode 100644 node_modules/iconv-lite/encodings/tables/cp950.json create mode 100644 node_modules/iconv-lite/encodings/tables/eucjp.json create mode 100644 node_modules/iconv-lite/encodings/tables/gb18030-ranges.json create mode 100644 node_modules/iconv-lite/encodings/tables/gbk-added.json create mode 100644 node_modules/iconv-lite/encodings/tables/shiftjis.json create mode 100644 node_modules/iconv-lite/encodings/utf16.js create mode 100644 node_modules/iconv-lite/encodings/utf7.js create mode 100644 node_modules/iconv-lite/lib/bom-handling.js create mode 100644 node_modules/iconv-lite/lib/extend-node.js create mode 100644 node_modules/iconv-lite/lib/index.d.ts create mode 100644 node_modules/iconv-lite/lib/index.js create mode 100644 node_modules/iconv-lite/lib/streams.js create mode 100644 node_modules/iconv-lite/package.json create mode 100644 node_modules/ignore-by-default/LICENSE create mode 100644 node_modules/ignore-by-default/README.md create mode 100644 node_modules/ignore-by-default/index.js create mode 100644 node_modules/ignore-by-default/package.json create mode 100644 node_modules/import-lazy/index.js create mode 100644 node_modules/import-lazy/license create mode 100644 node_modules/import-lazy/package.json create mode 100644 node_modules/import-lazy/readme.md create mode 100644 node_modules/imurmurhash/README.md create mode 100644 node_modules/imurmurhash/imurmurhash.js create mode 100644 node_modules/imurmurhash/imurmurhash.min.js create mode 100644 node_modules/imurmurhash/package.json create mode 100644 node_modules/inherits/LICENSE create mode 100644 node_modules/inherits/README.md create mode 100644 node_modules/inherits/inherits.js create mode 100644 node_modules/inherits/inherits_browser.js create mode 100644 node_modules/inherits/package.json create mode 100644 node_modules/ini/LICENSE create mode 100644 node_modules/ini/README.md create mode 100644 node_modules/ini/ini.js create mode 100644 node_modules/ini/package.json create mode 100644 node_modules/ipaddr.js/.npmignore create mode 100644 node_modules/ipaddr.js/.travis.yml create mode 100644 node_modules/ipaddr.js/Cakefile create mode 100644 node_modules/ipaddr.js/LICENSE create mode 100644 node_modules/ipaddr.js/README.md create mode 100644 node_modules/ipaddr.js/bower.json create mode 100644 node_modules/ipaddr.js/ipaddr.min.js create mode 100644 node_modules/ipaddr.js/lib/ipaddr.js create mode 100644 node_modules/ipaddr.js/package.json create mode 100644 node_modules/ipaddr.js/src/ipaddr.coffee create mode 100644 node_modules/ipaddr.js/test/ipaddr.test.coffee create mode 100644 node_modules/is-accessor-descriptor/LICENSE create mode 100644 node_modules/is-accessor-descriptor/README.md create mode 100644 node_modules/is-accessor-descriptor/index.js create mode 100644 node_modules/is-accessor-descriptor/node_modules/kind-of/CHANGELOG.md create mode 100644 node_modules/is-accessor-descriptor/node_modules/kind-of/LICENSE create mode 100644 node_modules/is-accessor-descriptor/node_modules/kind-of/README.md create mode 100644 node_modules/is-accessor-descriptor/node_modules/kind-of/index.js create mode 100644 node_modules/is-accessor-descriptor/node_modules/kind-of/package.json create mode 100644 node_modules/is-accessor-descriptor/package.json create mode 100644 node_modules/is-binary-path/index.js create mode 100644 node_modules/is-binary-path/license create mode 100644 node_modules/is-binary-path/package.json create mode 100644 node_modules/is-binary-path/readme.md create mode 100644 node_modules/is-buffer/LICENSE create mode 100644 node_modules/is-buffer/README.md create mode 100644 node_modules/is-buffer/index.js create mode 100644 node_modules/is-buffer/package.json create mode 100644 node_modules/is-buffer/test/basic.js create mode 100644 node_modules/is-data-descriptor/LICENSE create mode 100644 node_modules/is-data-descriptor/README.md create mode 100644 node_modules/is-data-descriptor/index.js create mode 100644 node_modules/is-data-descriptor/node_modules/kind-of/CHANGELOG.md create mode 100644 node_modules/is-data-descriptor/node_modules/kind-of/LICENSE create mode 100644 node_modules/is-data-descriptor/node_modules/kind-of/README.md create mode 100644 node_modules/is-data-descriptor/node_modules/kind-of/index.js create mode 100644 node_modules/is-data-descriptor/node_modules/kind-of/package.json create mode 100644 node_modules/is-data-descriptor/package.json create mode 100644 node_modules/is-descriptor/LICENSE create mode 100644 node_modules/is-descriptor/README.md create mode 100644 node_modules/is-descriptor/index.js create mode 100644 node_modules/is-descriptor/node_modules/kind-of/CHANGELOG.md create mode 100644 node_modules/is-descriptor/node_modules/kind-of/LICENSE create mode 100644 node_modules/is-descriptor/node_modules/kind-of/README.md create mode 100644 node_modules/is-descriptor/node_modules/kind-of/index.js create mode 100644 node_modules/is-descriptor/node_modules/kind-of/package.json create mode 100644 node_modules/is-descriptor/package.json create mode 100644 node_modules/is-expression/.npmignore create mode 100644 node_modules/is-expression/.travis.yml create mode 100644 node_modules/is-expression/CHANGELOG.md create mode 100644 node_modules/is-expression/LICENSE.md create mode 100644 node_modules/is-expression/README.md create mode 100644 node_modules/is-expression/index.js create mode 120000 node_modules/is-expression/node_modules/.bin/acorn create mode 100644 node_modules/is-expression/node_modules/acorn/.npmignore create mode 100644 node_modules/is-expression/node_modules/acorn/AUTHORS create mode 100644 node_modules/is-expression/node_modules/acorn/CHANGELOG.md create mode 100644 node_modules/is-expression/node_modules/acorn/LICENSE create mode 100644 node_modules/is-expression/node_modules/acorn/README.md create mode 100755 node_modules/is-expression/node_modules/acorn/bin/acorn create mode 100644 node_modules/is-expression/node_modules/acorn/dist/.keep create mode 100644 node_modules/is-expression/node_modules/acorn/dist/acorn.es.js create mode 100644 node_modules/is-expression/node_modules/acorn/dist/acorn.js create mode 100644 node_modules/is-expression/node_modules/acorn/dist/acorn_loose.es.js create mode 100644 node_modules/is-expression/node_modules/acorn/dist/acorn_loose.js create mode 100644 node_modules/is-expression/node_modules/acorn/dist/walk.es.js create mode 100644 node_modules/is-expression/node_modules/acorn/dist/walk.js create mode 100644 node_modules/is-expression/node_modules/acorn/package.json create mode 100644 node_modules/is-expression/node_modules/acorn/src/bin/acorn.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/expression.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/identifier.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/index.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/location.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/locutil.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/loose/expression.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/loose/index.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/loose/parseutil.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/loose/state.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/loose/statement.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/loose/tokenize.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/lval.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/node.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/options.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/parseutil.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/state.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/statement.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/tokencontext.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/tokenize.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/tokentype.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/util.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/walk/index.js create mode 100644 node_modules/is-expression/node_modules/acorn/src/whitespace.js create mode 100644 node_modules/is-expression/package.json create mode 100644 node_modules/is-expression/test.js create mode 100644 node_modules/is-extendable/LICENSE create mode 100644 node_modules/is-extendable/README.md create mode 100644 node_modules/is-extendable/index.js create mode 100644 node_modules/is-extendable/package.json create mode 100644 node_modules/is-extglob/LICENSE create mode 100644 node_modules/is-extglob/README.md create mode 100644 node_modules/is-extglob/index.js create mode 100644 node_modules/is-extglob/package.json create mode 100644 node_modules/is-fullwidth-code-point/index.js create mode 100644 node_modules/is-fullwidth-code-point/license create mode 100644 node_modules/is-fullwidth-code-point/package.json create mode 100644 node_modules/is-fullwidth-code-point/readme.md create mode 100644 node_modules/is-glob/LICENSE create mode 100644 node_modules/is-glob/README.md create mode 100644 node_modules/is-glob/index.js create mode 100644 node_modules/is-glob/package.json create mode 100644 node_modules/is-installed-globally/index.js create mode 100644 node_modules/is-installed-globally/license create mode 100644 node_modules/is-installed-globally/package.json create mode 100644 node_modules/is-installed-globally/readme.md create mode 100644 node_modules/is-npm/index.js create mode 100644 node_modules/is-npm/package.json create mode 100644 node_modules/is-npm/readme.md create mode 100644 node_modules/is-number/LICENSE create mode 100644 node_modules/is-number/README.md create mode 100644 node_modules/is-number/index.js create mode 100644 node_modules/is-number/package.json create mode 100644 node_modules/is-obj/index.js create mode 100644 node_modules/is-obj/license create mode 100644 node_modules/is-obj/package.json create mode 100644 node_modules/is-obj/readme.md create mode 100644 node_modules/is-odd/LICENSE create mode 100644 node_modules/is-odd/README.md create mode 100644 node_modules/is-odd/index.js create mode 100644 node_modules/is-odd/node_modules/is-number/LICENSE create mode 100644 node_modules/is-odd/node_modules/is-number/README.md create mode 100644 node_modules/is-odd/node_modules/is-number/index.js create mode 100644 node_modules/is-odd/node_modules/is-number/package.json create mode 100644 node_modules/is-odd/package.json create mode 100644 node_modules/is-path-inside/index.js create mode 100644 node_modules/is-path-inside/license create mode 100644 node_modules/is-path-inside/package.json create mode 100644 node_modules/is-path-inside/readme.md create mode 100644 node_modules/is-plain-object/LICENSE create mode 100644 node_modules/is-plain-object/README.md create mode 100644 node_modules/is-plain-object/index.d.ts create mode 100644 node_modules/is-plain-object/index.js create mode 100644 node_modules/is-plain-object/package.json create mode 100644 node_modules/is-promise/.npmignore create mode 100644 node_modules/is-promise/.travis.yml create mode 100644 node_modules/is-promise/LICENSE create mode 100644 node_modules/is-promise/index.js create mode 100644 node_modules/is-promise/package.json create mode 100644 node_modules/is-promise/readme.md create mode 100644 node_modules/is-redirect/index.js create mode 100644 node_modules/is-redirect/license create mode 100644 node_modules/is-redirect/package.json create mode 100644 node_modules/is-redirect/readme.md create mode 100644 node_modules/is-regex/.eslintrc create mode 100644 node_modules/is-regex/.jscs.json create mode 100644 node_modules/is-regex/.npmignore create mode 100644 node_modules/is-regex/.travis.yml create mode 100644 node_modules/is-regex/CHANGELOG.md create mode 100644 node_modules/is-regex/LICENSE create mode 100644 node_modules/is-regex/Makefile create mode 100644 node_modules/is-regex/README.md create mode 100644 node_modules/is-regex/index.js create mode 100644 node_modules/is-regex/package.json create mode 100644 node_modules/is-regex/test.js create mode 100644 node_modules/is-retry-allowed/index.js create mode 100644 node_modules/is-retry-allowed/license create mode 100644 node_modules/is-retry-allowed/package.json create mode 100644 node_modules/is-retry-allowed/readme.md create mode 100644 node_modules/is-stream/index.js create mode 100644 node_modules/is-stream/license create mode 100644 node_modules/is-stream/package.json create mode 100644 node_modules/is-stream/readme.md create mode 100644 node_modules/is-windows/LICENSE create mode 100644 node_modules/is-windows/README.md create mode 100644 node_modules/is-windows/index.js create mode 100644 node_modules/is-windows/package.json create mode 100644 node_modules/isarray/.npmignore create mode 100644 node_modules/isarray/.travis.yml create mode 100644 node_modules/isarray/Makefile create mode 100644 node_modules/isarray/README.md create mode 100644 node_modules/isarray/component.json create mode 100644 node_modules/isarray/index.js create mode 100644 node_modules/isarray/package.json create mode 100644 node_modules/isarray/test.js create mode 100644 node_modules/isexe/.npmignore create mode 100644 node_modules/isexe/LICENSE create mode 100644 node_modules/isexe/README.md create mode 100644 node_modules/isexe/index.js create mode 100644 node_modules/isexe/mode.js create mode 100644 node_modules/isexe/package.json create mode 100644 node_modules/isexe/test/basic.js create mode 100644 node_modules/isexe/windows.js create mode 100644 node_modules/isobject/LICENSE create mode 100644 node_modules/isobject/README.md create mode 100644 node_modules/isobject/index.d.ts create mode 100644 node_modules/isobject/index.js create mode 100644 node_modules/isobject/package.json create mode 100644 node_modules/js-stringify/.npmignore create mode 100644 node_modules/js-stringify/.travis.yml create mode 100644 node_modules/js-stringify/LICENSE create mode 100644 node_modules/js-stringify/README.md create mode 100644 node_modules/js-stringify/index.js create mode 100644 node_modules/js-stringify/package.json create mode 100644 node_modules/js-stringify/test/index.js create mode 100644 node_modules/jstransformer/CHANGELOG.md create mode 100644 node_modules/jstransformer/LICENSE.md create mode 100644 node_modules/jstransformer/README.md create mode 100644 node_modules/jstransformer/index.js create mode 100644 node_modules/jstransformer/package.json create mode 100644 node_modules/kareem/.travis.yml create mode 100644 node_modules/kareem/LICENSE create mode 100644 node_modules/kareem/Makefile create mode 100644 node_modules/kareem/README.md create mode 100644 node_modules/kareem/docs.js create mode 100644 node_modules/kareem/gulpfile.js create mode 100644 node_modules/kareem/index.js create mode 100644 node_modules/kareem/package.json create mode 100644 node_modules/kareem/test/examples.test.js create mode 100644 node_modules/kareem/test/post.test.js create mode 100644 node_modules/kareem/test/pre.test.js create mode 100644 node_modules/kareem/test/wrap.test.js create mode 100644 node_modules/kind-of/LICENSE create mode 100644 node_modules/kind-of/README.md create mode 100644 node_modules/kind-of/index.js create mode 100644 node_modules/kind-of/package.json create mode 100644 node_modules/latest-version/index.js create mode 100644 node_modules/latest-version/license create mode 100644 node_modules/latest-version/package.json create mode 100644 node_modules/latest-version/readme.md create mode 100644 node_modules/lazy-cache/LICENSE create mode 100644 node_modules/lazy-cache/README.md create mode 100644 node_modules/lazy-cache/index.js create mode 100644 node_modules/lazy-cache/package.json create mode 100644 node_modules/lodash.get/LICENSE create mode 100644 node_modules/lodash.get/README.md create mode 100644 node_modules/lodash.get/index.js create mode 100644 node_modules/lodash.get/package.json create mode 100644 node_modules/lodash/LICENSE create mode 100644 node_modules/lodash/README.md create mode 100644 node_modules/lodash/_DataView.js create mode 100644 node_modules/lodash/_Hash.js create mode 100644 node_modules/lodash/_LazyWrapper.js create mode 100644 node_modules/lodash/_ListCache.js create mode 100644 node_modules/lodash/_LodashWrapper.js create mode 100644 node_modules/lodash/_Map.js create mode 100644 node_modules/lodash/_MapCache.js create mode 100644 node_modules/lodash/_Promise.js create mode 100644 node_modules/lodash/_Set.js create mode 100644 node_modules/lodash/_SetCache.js create mode 100644 node_modules/lodash/_Stack.js create mode 100644 node_modules/lodash/_Symbol.js create mode 100644 node_modules/lodash/_Uint8Array.js create mode 100644 node_modules/lodash/_WeakMap.js create mode 100644 node_modules/lodash/_apply.js create mode 100644 node_modules/lodash/_arrayAggregator.js create mode 100644 node_modules/lodash/_arrayEach.js create mode 100644 node_modules/lodash/_arrayEachRight.js create mode 100644 node_modules/lodash/_arrayEvery.js create mode 100644 node_modules/lodash/_arrayFilter.js create mode 100644 node_modules/lodash/_arrayIncludes.js create mode 100644 node_modules/lodash/_arrayIncludesWith.js create mode 100644 node_modules/lodash/_arrayLikeKeys.js create mode 100644 node_modules/lodash/_arrayMap.js create mode 100644 node_modules/lodash/_arrayPush.js create mode 100644 node_modules/lodash/_arrayReduce.js create mode 100644 node_modules/lodash/_arrayReduceRight.js create mode 100644 node_modules/lodash/_arraySample.js create mode 100644 node_modules/lodash/_arraySampleSize.js create mode 100644 node_modules/lodash/_arrayShuffle.js create mode 100644 node_modules/lodash/_arraySome.js create mode 100644 node_modules/lodash/_asciiSize.js create mode 100644 node_modules/lodash/_asciiToArray.js create mode 100644 node_modules/lodash/_asciiWords.js create mode 100644 node_modules/lodash/_assignMergeValue.js create mode 100644 node_modules/lodash/_assignValue.js create mode 100644 node_modules/lodash/_assocIndexOf.js create mode 100644 node_modules/lodash/_baseAggregator.js create mode 100644 node_modules/lodash/_baseAssign.js create mode 100644 node_modules/lodash/_baseAssignIn.js create mode 100644 node_modules/lodash/_baseAssignValue.js create mode 100644 node_modules/lodash/_baseAt.js create mode 100644 node_modules/lodash/_baseClamp.js create mode 100644 node_modules/lodash/_baseClone.js create mode 100644 node_modules/lodash/_baseConforms.js create mode 100644 node_modules/lodash/_baseConformsTo.js create mode 100644 node_modules/lodash/_baseCreate.js create mode 100644 node_modules/lodash/_baseDelay.js create mode 100644 node_modules/lodash/_baseDifference.js create mode 100644 node_modules/lodash/_baseEach.js create mode 100644 node_modules/lodash/_baseEachRight.js create mode 100644 node_modules/lodash/_baseEvery.js create mode 100644 node_modules/lodash/_baseExtremum.js create mode 100644 node_modules/lodash/_baseFill.js create mode 100644 node_modules/lodash/_baseFilter.js create mode 100644 node_modules/lodash/_baseFindIndex.js create mode 100644 node_modules/lodash/_baseFindKey.js create mode 100644 node_modules/lodash/_baseFlatten.js create mode 100644 node_modules/lodash/_baseFor.js create mode 100644 node_modules/lodash/_baseForOwn.js create mode 100644 node_modules/lodash/_baseForOwnRight.js create mode 100644 node_modules/lodash/_baseForRight.js create mode 100644 node_modules/lodash/_baseFunctions.js create mode 100644 node_modules/lodash/_baseGet.js create mode 100644 node_modules/lodash/_baseGetAllKeys.js create mode 100644 node_modules/lodash/_baseGetTag.js create mode 100644 node_modules/lodash/_baseGt.js create mode 100644 node_modules/lodash/_baseHas.js create mode 100644 node_modules/lodash/_baseHasIn.js create mode 100644 node_modules/lodash/_baseInRange.js create mode 100644 node_modules/lodash/_baseIndexOf.js create mode 100644 node_modules/lodash/_baseIndexOfWith.js create mode 100644 node_modules/lodash/_baseIntersection.js create mode 100644 node_modules/lodash/_baseInverter.js create mode 100644 node_modules/lodash/_baseInvoke.js create mode 100644 node_modules/lodash/_baseIsArguments.js create mode 100644 node_modules/lodash/_baseIsArrayBuffer.js create mode 100644 node_modules/lodash/_baseIsDate.js create mode 100644 node_modules/lodash/_baseIsEqual.js create mode 100644 node_modules/lodash/_baseIsEqualDeep.js create mode 100644 node_modules/lodash/_baseIsMap.js create mode 100644 node_modules/lodash/_baseIsMatch.js create mode 100644 node_modules/lodash/_baseIsNaN.js create mode 100644 node_modules/lodash/_baseIsNative.js create mode 100644 node_modules/lodash/_baseIsRegExp.js create mode 100644 node_modules/lodash/_baseIsSet.js create mode 100644 node_modules/lodash/_baseIsTypedArray.js create mode 100644 node_modules/lodash/_baseIteratee.js create mode 100644 node_modules/lodash/_baseKeys.js create mode 100644 node_modules/lodash/_baseKeysIn.js create mode 100644 node_modules/lodash/_baseLodash.js create mode 100644 node_modules/lodash/_baseLt.js create mode 100644 node_modules/lodash/_baseMap.js create mode 100644 node_modules/lodash/_baseMatches.js create mode 100644 node_modules/lodash/_baseMatchesProperty.js create mode 100644 node_modules/lodash/_baseMean.js create mode 100644 node_modules/lodash/_baseMerge.js create mode 100644 node_modules/lodash/_baseMergeDeep.js create mode 100644 node_modules/lodash/_baseNth.js create mode 100644 node_modules/lodash/_baseOrderBy.js create mode 100644 node_modules/lodash/_basePick.js create mode 100644 node_modules/lodash/_basePickBy.js create mode 100644 node_modules/lodash/_baseProperty.js create mode 100644 node_modules/lodash/_basePropertyDeep.js create mode 100644 node_modules/lodash/_basePropertyOf.js create mode 100644 node_modules/lodash/_basePullAll.js create mode 100644 node_modules/lodash/_basePullAt.js create mode 100644 node_modules/lodash/_baseRandom.js create mode 100644 node_modules/lodash/_baseRange.js create mode 100644 node_modules/lodash/_baseReduce.js create mode 100644 node_modules/lodash/_baseRepeat.js create mode 100644 node_modules/lodash/_baseRest.js create mode 100644 node_modules/lodash/_baseSample.js create mode 100644 node_modules/lodash/_baseSampleSize.js create mode 100644 node_modules/lodash/_baseSet.js create mode 100644 node_modules/lodash/_baseSetData.js create mode 100644 node_modules/lodash/_baseSetToString.js create mode 100644 node_modules/lodash/_baseShuffle.js create mode 100644 node_modules/lodash/_baseSlice.js create mode 100644 node_modules/lodash/_baseSome.js create mode 100644 node_modules/lodash/_baseSortBy.js create mode 100644 node_modules/lodash/_baseSortedIndex.js create mode 100644 node_modules/lodash/_baseSortedIndexBy.js create mode 100644 node_modules/lodash/_baseSortedUniq.js create mode 100644 node_modules/lodash/_baseSum.js create mode 100644 node_modules/lodash/_baseTimes.js create mode 100644 node_modules/lodash/_baseToNumber.js create mode 100644 node_modules/lodash/_baseToPairs.js create mode 100644 node_modules/lodash/_baseToString.js create mode 100644 node_modules/lodash/_baseUnary.js create mode 100644 node_modules/lodash/_baseUniq.js create mode 100644 node_modules/lodash/_baseUnset.js create mode 100644 node_modules/lodash/_baseUpdate.js create mode 100644 node_modules/lodash/_baseValues.js create mode 100644 node_modules/lodash/_baseWhile.js create mode 100644 node_modules/lodash/_baseWrapperValue.js create mode 100644 node_modules/lodash/_baseXor.js create mode 100644 node_modules/lodash/_baseZipObject.js create mode 100644 node_modules/lodash/_cacheHas.js create mode 100644 node_modules/lodash/_castArrayLikeObject.js create mode 100644 node_modules/lodash/_castFunction.js create mode 100644 node_modules/lodash/_castPath.js create mode 100644 node_modules/lodash/_castRest.js create mode 100644 node_modules/lodash/_castSlice.js create mode 100644 node_modules/lodash/_charsEndIndex.js create mode 100644 node_modules/lodash/_charsStartIndex.js create mode 100644 node_modules/lodash/_cloneArrayBuffer.js create mode 100644 node_modules/lodash/_cloneBuffer.js create mode 100644 node_modules/lodash/_cloneDataView.js create mode 100644 node_modules/lodash/_cloneRegExp.js create mode 100644 node_modules/lodash/_cloneSymbol.js create mode 100644 node_modules/lodash/_cloneTypedArray.js create mode 100644 node_modules/lodash/_compareAscending.js create mode 100644 node_modules/lodash/_compareMultiple.js create mode 100644 node_modules/lodash/_composeArgs.js create mode 100644 node_modules/lodash/_composeArgsRight.js create mode 100644 node_modules/lodash/_copyArray.js create mode 100644 node_modules/lodash/_copyObject.js create mode 100644 node_modules/lodash/_copySymbols.js create mode 100644 node_modules/lodash/_copySymbolsIn.js create mode 100644 node_modules/lodash/_coreJsData.js create mode 100644 node_modules/lodash/_countHolders.js create mode 100644 node_modules/lodash/_createAggregator.js create mode 100644 node_modules/lodash/_createAssigner.js create mode 100644 node_modules/lodash/_createBaseEach.js create mode 100644 node_modules/lodash/_createBaseFor.js create mode 100644 node_modules/lodash/_createBind.js create mode 100644 node_modules/lodash/_createCaseFirst.js create mode 100644 node_modules/lodash/_createCompounder.js create mode 100644 node_modules/lodash/_createCtor.js create mode 100644 node_modules/lodash/_createCurry.js create mode 100644 node_modules/lodash/_createFind.js create mode 100644 node_modules/lodash/_createFlow.js create mode 100644 node_modules/lodash/_createHybrid.js create mode 100644 node_modules/lodash/_createInverter.js create mode 100644 node_modules/lodash/_createMathOperation.js create mode 100644 node_modules/lodash/_createOver.js create mode 100644 node_modules/lodash/_createPadding.js create mode 100644 node_modules/lodash/_createPartial.js create mode 100644 node_modules/lodash/_createRange.js create mode 100644 node_modules/lodash/_createRecurry.js create mode 100644 node_modules/lodash/_createRelationalOperation.js create mode 100644 node_modules/lodash/_createRound.js create mode 100644 node_modules/lodash/_createSet.js create mode 100644 node_modules/lodash/_createToPairs.js create mode 100644 node_modules/lodash/_createWrap.js create mode 100644 node_modules/lodash/_customDefaultsAssignIn.js create mode 100644 node_modules/lodash/_customDefaultsMerge.js create mode 100644 node_modules/lodash/_customOmitClone.js create mode 100644 node_modules/lodash/_deburrLetter.js create mode 100644 node_modules/lodash/_defineProperty.js create mode 100644 node_modules/lodash/_equalArrays.js create mode 100644 node_modules/lodash/_equalByTag.js create mode 100644 node_modules/lodash/_equalObjects.js create mode 100644 node_modules/lodash/_escapeHtmlChar.js create mode 100644 node_modules/lodash/_escapeStringChar.js create mode 100644 node_modules/lodash/_flatRest.js create mode 100644 node_modules/lodash/_freeGlobal.js create mode 100644 node_modules/lodash/_getAllKeys.js create mode 100644 node_modules/lodash/_getAllKeysIn.js create mode 100644 node_modules/lodash/_getData.js create mode 100644 node_modules/lodash/_getFuncName.js create mode 100644 node_modules/lodash/_getHolder.js create mode 100644 node_modules/lodash/_getMapData.js create mode 100644 node_modules/lodash/_getMatchData.js create mode 100644 node_modules/lodash/_getNative.js create mode 100644 node_modules/lodash/_getPrototype.js create mode 100644 node_modules/lodash/_getRawTag.js create mode 100644 node_modules/lodash/_getSymbols.js create mode 100644 node_modules/lodash/_getSymbolsIn.js create mode 100644 node_modules/lodash/_getTag.js create mode 100644 node_modules/lodash/_getValue.js create mode 100644 node_modules/lodash/_getView.js create mode 100644 node_modules/lodash/_getWrapDetails.js create mode 100644 node_modules/lodash/_hasPath.js create mode 100644 node_modules/lodash/_hasUnicode.js create mode 100644 node_modules/lodash/_hasUnicodeWord.js create mode 100644 node_modules/lodash/_hashClear.js create mode 100644 node_modules/lodash/_hashDelete.js create mode 100644 node_modules/lodash/_hashGet.js create mode 100644 node_modules/lodash/_hashHas.js create mode 100644 node_modules/lodash/_hashSet.js create mode 100644 node_modules/lodash/_initCloneArray.js create mode 100644 node_modules/lodash/_initCloneByTag.js create mode 100644 node_modules/lodash/_initCloneObject.js create mode 100644 node_modules/lodash/_insertWrapDetails.js create mode 100644 node_modules/lodash/_isFlattenable.js create mode 100644 node_modules/lodash/_isIndex.js create mode 100644 node_modules/lodash/_isIterateeCall.js create mode 100644 node_modules/lodash/_isKey.js create mode 100644 node_modules/lodash/_isKeyable.js create mode 100644 node_modules/lodash/_isLaziable.js create mode 100644 node_modules/lodash/_isMaskable.js create mode 100644 node_modules/lodash/_isMasked.js create mode 100644 node_modules/lodash/_isPrototype.js create mode 100644 node_modules/lodash/_isStrictComparable.js create mode 100644 node_modules/lodash/_iteratorToArray.js create mode 100644 node_modules/lodash/_lazyClone.js create mode 100644 node_modules/lodash/_lazyReverse.js create mode 100644 node_modules/lodash/_lazyValue.js create mode 100644 node_modules/lodash/_listCacheClear.js create mode 100644 node_modules/lodash/_listCacheDelete.js create mode 100644 node_modules/lodash/_listCacheGet.js create mode 100644 node_modules/lodash/_listCacheHas.js create mode 100644 node_modules/lodash/_listCacheSet.js create mode 100644 node_modules/lodash/_mapCacheClear.js create mode 100644 node_modules/lodash/_mapCacheDelete.js create mode 100644 node_modules/lodash/_mapCacheGet.js create mode 100644 node_modules/lodash/_mapCacheHas.js create mode 100644 node_modules/lodash/_mapCacheSet.js create mode 100644 node_modules/lodash/_mapToArray.js create mode 100644 node_modules/lodash/_matchesStrictComparable.js create mode 100644 node_modules/lodash/_memoizeCapped.js create mode 100644 node_modules/lodash/_mergeData.js create mode 100644 node_modules/lodash/_metaMap.js create mode 100644 node_modules/lodash/_nativeCreate.js create mode 100644 node_modules/lodash/_nativeKeys.js create mode 100644 node_modules/lodash/_nativeKeysIn.js create mode 100644 node_modules/lodash/_nodeUtil.js create mode 100644 node_modules/lodash/_objectToString.js create mode 100644 node_modules/lodash/_overArg.js create mode 100644 node_modules/lodash/_overRest.js create mode 100644 node_modules/lodash/_parent.js create mode 100644 node_modules/lodash/_reEscape.js create mode 100644 node_modules/lodash/_reEvaluate.js create mode 100644 node_modules/lodash/_reInterpolate.js create mode 100644 node_modules/lodash/_realNames.js create mode 100644 node_modules/lodash/_reorder.js create mode 100644 node_modules/lodash/_replaceHolders.js create mode 100644 node_modules/lodash/_root.js create mode 100644 node_modules/lodash/_safeGet.js create mode 100644 node_modules/lodash/_setCacheAdd.js create mode 100644 node_modules/lodash/_setCacheHas.js create mode 100644 node_modules/lodash/_setData.js create mode 100644 node_modules/lodash/_setToArray.js create mode 100644 node_modules/lodash/_setToPairs.js create mode 100644 node_modules/lodash/_setToString.js create mode 100644 node_modules/lodash/_setWrapToString.js create mode 100644 node_modules/lodash/_shortOut.js create mode 100644 node_modules/lodash/_shuffleSelf.js create mode 100644 node_modules/lodash/_stackClear.js create mode 100644 node_modules/lodash/_stackDelete.js create mode 100644 node_modules/lodash/_stackGet.js create mode 100644 node_modules/lodash/_stackHas.js create mode 100644 node_modules/lodash/_stackSet.js create mode 100644 node_modules/lodash/_strictIndexOf.js create mode 100644 node_modules/lodash/_strictLastIndexOf.js create mode 100644 node_modules/lodash/_stringSize.js create mode 100644 node_modules/lodash/_stringToArray.js create mode 100644 node_modules/lodash/_stringToPath.js create mode 100644 node_modules/lodash/_toKey.js create mode 100644 node_modules/lodash/_toSource.js create mode 100644 node_modules/lodash/_unescapeHtmlChar.js create mode 100644 node_modules/lodash/_unicodeSize.js create mode 100644 node_modules/lodash/_unicodeToArray.js create mode 100644 node_modules/lodash/_unicodeWords.js create mode 100644 node_modules/lodash/_updateWrapDetails.js create mode 100644 node_modules/lodash/_wrapperClone.js create mode 100644 node_modules/lodash/add.js create mode 100644 node_modules/lodash/after.js create mode 100644 node_modules/lodash/array.js create mode 100644 node_modules/lodash/ary.js create mode 100644 node_modules/lodash/assign.js create mode 100644 node_modules/lodash/assignIn.js create mode 100644 node_modules/lodash/assignInWith.js create mode 100644 node_modules/lodash/assignWith.js create mode 100644 node_modules/lodash/at.js create mode 100644 node_modules/lodash/attempt.js create mode 100644 node_modules/lodash/before.js create mode 100644 node_modules/lodash/bind.js create mode 100644 node_modules/lodash/bindAll.js create mode 100644 node_modules/lodash/bindKey.js create mode 100644 node_modules/lodash/camelCase.js create mode 100644 node_modules/lodash/capitalize.js create mode 100644 node_modules/lodash/castArray.js create mode 100644 node_modules/lodash/ceil.js create mode 100644 node_modules/lodash/chain.js create mode 100644 node_modules/lodash/chunk.js create mode 100644 node_modules/lodash/clamp.js create mode 100644 node_modules/lodash/clone.js create mode 100644 node_modules/lodash/cloneDeep.js create mode 100644 node_modules/lodash/cloneDeepWith.js create mode 100644 node_modules/lodash/cloneWith.js create mode 100644 node_modules/lodash/collection.js create mode 100644 node_modules/lodash/commit.js create mode 100644 node_modules/lodash/compact.js create mode 100644 node_modules/lodash/concat.js create mode 100644 node_modules/lodash/cond.js create mode 100644 node_modules/lodash/conforms.js create mode 100644 node_modules/lodash/conformsTo.js create mode 100644 node_modules/lodash/constant.js create mode 100644 node_modules/lodash/core.js create mode 100644 node_modules/lodash/core.min.js create mode 100644 node_modules/lodash/countBy.js create mode 100644 node_modules/lodash/create.js create mode 100644 node_modules/lodash/curry.js create mode 100644 node_modules/lodash/curryRight.js create mode 100644 node_modules/lodash/date.js create mode 100644 node_modules/lodash/debounce.js create mode 100644 node_modules/lodash/deburr.js create mode 100644 node_modules/lodash/defaultTo.js create mode 100644 node_modules/lodash/defaults.js create mode 100644 node_modules/lodash/defaultsDeep.js create mode 100644 node_modules/lodash/defer.js create mode 100644 node_modules/lodash/delay.js create mode 100644 node_modules/lodash/difference.js create mode 100644 node_modules/lodash/differenceBy.js create mode 100644 node_modules/lodash/differenceWith.js create mode 100644 node_modules/lodash/divide.js create mode 100644 node_modules/lodash/drop.js create mode 100644 node_modules/lodash/dropRight.js create mode 100644 node_modules/lodash/dropRightWhile.js create mode 100644 node_modules/lodash/dropWhile.js create mode 100644 node_modules/lodash/each.js create mode 100644 node_modules/lodash/eachRight.js create mode 100644 node_modules/lodash/endsWith.js create mode 100644 node_modules/lodash/entries.js create mode 100644 node_modules/lodash/entriesIn.js create mode 100644 node_modules/lodash/eq.js create mode 100644 node_modules/lodash/escape.js create mode 100644 node_modules/lodash/escapeRegExp.js create mode 100644 node_modules/lodash/every.js create mode 100644 node_modules/lodash/extend.js create mode 100644 node_modules/lodash/extendWith.js create mode 100644 node_modules/lodash/fill.js create mode 100644 node_modules/lodash/filter.js create mode 100644 node_modules/lodash/find.js create mode 100644 node_modules/lodash/findIndex.js create mode 100644 node_modules/lodash/findKey.js create mode 100644 node_modules/lodash/findLast.js create mode 100644 node_modules/lodash/findLastIndex.js create mode 100644 node_modules/lodash/findLastKey.js create mode 100644 node_modules/lodash/first.js create mode 100644 node_modules/lodash/flatMap.js create mode 100644 node_modules/lodash/flatMapDeep.js create mode 100644 node_modules/lodash/flatMapDepth.js create mode 100644 node_modules/lodash/flatten.js create mode 100644 node_modules/lodash/flattenDeep.js create mode 100644 node_modules/lodash/flattenDepth.js create mode 100644 node_modules/lodash/flip.js create mode 100644 node_modules/lodash/floor.js create mode 100644 node_modules/lodash/flow.js create mode 100644 node_modules/lodash/flowRight.js create mode 100644 node_modules/lodash/forEach.js create mode 100644 node_modules/lodash/forEachRight.js create mode 100644 node_modules/lodash/forIn.js create mode 100644 node_modules/lodash/forInRight.js create mode 100644 node_modules/lodash/forOwn.js create mode 100644 node_modules/lodash/forOwnRight.js create mode 100644 node_modules/lodash/fp.js create mode 100644 node_modules/lodash/fp/F.js create mode 100644 node_modules/lodash/fp/T.js create mode 100644 node_modules/lodash/fp/__.js create mode 100644 node_modules/lodash/fp/_baseConvert.js create mode 100644 node_modules/lodash/fp/_convertBrowser.js create mode 100644 node_modules/lodash/fp/_falseOptions.js create mode 100644 node_modules/lodash/fp/_mapping.js create mode 100644 node_modules/lodash/fp/_util.js create mode 100644 node_modules/lodash/fp/add.js create mode 100644 node_modules/lodash/fp/after.js create mode 100644 node_modules/lodash/fp/all.js create mode 100644 node_modules/lodash/fp/allPass.js create mode 100644 node_modules/lodash/fp/always.js create mode 100644 node_modules/lodash/fp/any.js create mode 100644 node_modules/lodash/fp/anyPass.js create mode 100644 node_modules/lodash/fp/apply.js create mode 100644 node_modules/lodash/fp/array.js create mode 100644 node_modules/lodash/fp/ary.js create mode 100644 node_modules/lodash/fp/assign.js create mode 100644 node_modules/lodash/fp/assignAll.js create mode 100644 node_modules/lodash/fp/assignAllWith.js create mode 100644 node_modules/lodash/fp/assignIn.js create mode 100644 node_modules/lodash/fp/assignInAll.js create mode 100644 node_modules/lodash/fp/assignInAllWith.js create mode 100644 node_modules/lodash/fp/assignInWith.js create mode 100644 node_modules/lodash/fp/assignWith.js create mode 100644 node_modules/lodash/fp/assoc.js create mode 100644 node_modules/lodash/fp/assocPath.js create mode 100644 node_modules/lodash/fp/at.js create mode 100644 node_modules/lodash/fp/attempt.js create mode 100644 node_modules/lodash/fp/before.js create mode 100644 node_modules/lodash/fp/bind.js create mode 100644 node_modules/lodash/fp/bindAll.js create mode 100644 node_modules/lodash/fp/bindKey.js create mode 100644 node_modules/lodash/fp/camelCase.js create mode 100644 node_modules/lodash/fp/capitalize.js create mode 100644 node_modules/lodash/fp/castArray.js create mode 100644 node_modules/lodash/fp/ceil.js create mode 100644 node_modules/lodash/fp/chain.js create mode 100644 node_modules/lodash/fp/chunk.js create mode 100644 node_modules/lodash/fp/clamp.js create mode 100644 node_modules/lodash/fp/clone.js create mode 100644 node_modules/lodash/fp/cloneDeep.js create mode 100644 node_modules/lodash/fp/cloneDeepWith.js create mode 100644 node_modules/lodash/fp/cloneWith.js create mode 100644 node_modules/lodash/fp/collection.js create mode 100644 node_modules/lodash/fp/commit.js create mode 100644 node_modules/lodash/fp/compact.js create mode 100644 node_modules/lodash/fp/complement.js create mode 100644 node_modules/lodash/fp/compose.js create mode 100644 node_modules/lodash/fp/concat.js create mode 100644 node_modules/lodash/fp/cond.js create mode 100644 node_modules/lodash/fp/conforms.js create mode 100644 node_modules/lodash/fp/conformsTo.js create mode 100644 node_modules/lodash/fp/constant.js create mode 100644 node_modules/lodash/fp/contains.js create mode 100644 node_modules/lodash/fp/convert.js create mode 100644 node_modules/lodash/fp/countBy.js create mode 100644 node_modules/lodash/fp/create.js create mode 100644 node_modules/lodash/fp/curry.js create mode 100644 node_modules/lodash/fp/curryN.js create mode 100644 node_modules/lodash/fp/curryRight.js create mode 100644 node_modules/lodash/fp/curryRightN.js create mode 100644 node_modules/lodash/fp/date.js create mode 100644 node_modules/lodash/fp/debounce.js create mode 100644 node_modules/lodash/fp/deburr.js create mode 100644 node_modules/lodash/fp/defaultTo.js create mode 100644 node_modules/lodash/fp/defaults.js create mode 100644 node_modules/lodash/fp/defaultsAll.js create mode 100644 node_modules/lodash/fp/defaultsDeep.js create mode 100644 node_modules/lodash/fp/defaultsDeepAll.js create mode 100644 node_modules/lodash/fp/defer.js create mode 100644 node_modules/lodash/fp/delay.js create mode 100644 node_modules/lodash/fp/difference.js create mode 100644 node_modules/lodash/fp/differenceBy.js create mode 100644 node_modules/lodash/fp/differenceWith.js create mode 100644 node_modules/lodash/fp/dissoc.js create mode 100644 node_modules/lodash/fp/dissocPath.js create mode 100644 node_modules/lodash/fp/divide.js create mode 100644 node_modules/lodash/fp/drop.js create mode 100644 node_modules/lodash/fp/dropLast.js create mode 100644 node_modules/lodash/fp/dropLastWhile.js create mode 100644 node_modules/lodash/fp/dropRight.js create mode 100644 node_modules/lodash/fp/dropRightWhile.js create mode 100644 node_modules/lodash/fp/dropWhile.js create mode 100644 node_modules/lodash/fp/each.js create mode 100644 node_modules/lodash/fp/eachRight.js create mode 100644 node_modules/lodash/fp/endsWith.js create mode 100644 node_modules/lodash/fp/entries.js create mode 100644 node_modules/lodash/fp/entriesIn.js create mode 100644 node_modules/lodash/fp/eq.js create mode 100644 node_modules/lodash/fp/equals.js create mode 100644 node_modules/lodash/fp/escape.js create mode 100644 node_modules/lodash/fp/escapeRegExp.js create mode 100644 node_modules/lodash/fp/every.js create mode 100644 node_modules/lodash/fp/extend.js create mode 100644 node_modules/lodash/fp/extendAll.js create mode 100644 node_modules/lodash/fp/extendAllWith.js create mode 100644 node_modules/lodash/fp/extendWith.js create mode 100644 node_modules/lodash/fp/fill.js create mode 100644 node_modules/lodash/fp/filter.js create mode 100644 node_modules/lodash/fp/find.js create mode 100644 node_modules/lodash/fp/findFrom.js create mode 100644 node_modules/lodash/fp/findIndex.js create mode 100644 node_modules/lodash/fp/findIndexFrom.js create mode 100644 node_modules/lodash/fp/findKey.js create mode 100644 node_modules/lodash/fp/findLast.js create mode 100644 node_modules/lodash/fp/findLastFrom.js create mode 100644 node_modules/lodash/fp/findLastIndex.js create mode 100644 node_modules/lodash/fp/findLastIndexFrom.js create mode 100644 node_modules/lodash/fp/findLastKey.js create mode 100644 node_modules/lodash/fp/first.js create mode 100644 node_modules/lodash/fp/flatMap.js create mode 100644 node_modules/lodash/fp/flatMapDeep.js create mode 100644 node_modules/lodash/fp/flatMapDepth.js create mode 100644 node_modules/lodash/fp/flatten.js create mode 100644 node_modules/lodash/fp/flattenDeep.js create mode 100644 node_modules/lodash/fp/flattenDepth.js create mode 100644 node_modules/lodash/fp/flip.js create mode 100644 node_modules/lodash/fp/floor.js create mode 100644 node_modules/lodash/fp/flow.js create mode 100644 node_modules/lodash/fp/flowRight.js create mode 100644 node_modules/lodash/fp/forEach.js create mode 100644 node_modules/lodash/fp/forEachRight.js create mode 100644 node_modules/lodash/fp/forIn.js create mode 100644 node_modules/lodash/fp/forInRight.js create mode 100644 node_modules/lodash/fp/forOwn.js create mode 100644 node_modules/lodash/fp/forOwnRight.js create mode 100644 node_modules/lodash/fp/fromPairs.js create mode 100644 node_modules/lodash/fp/function.js create mode 100644 node_modules/lodash/fp/functions.js create mode 100644 node_modules/lodash/fp/functionsIn.js create mode 100644 node_modules/lodash/fp/get.js create mode 100644 node_modules/lodash/fp/getOr.js create mode 100644 node_modules/lodash/fp/groupBy.js create mode 100644 node_modules/lodash/fp/gt.js create mode 100644 node_modules/lodash/fp/gte.js create mode 100644 node_modules/lodash/fp/has.js create mode 100644 node_modules/lodash/fp/hasIn.js create mode 100644 node_modules/lodash/fp/head.js create mode 100644 node_modules/lodash/fp/identical.js create mode 100644 node_modules/lodash/fp/identity.js create mode 100644 node_modules/lodash/fp/inRange.js create mode 100644 node_modules/lodash/fp/includes.js create mode 100644 node_modules/lodash/fp/includesFrom.js create mode 100644 node_modules/lodash/fp/indexBy.js create mode 100644 node_modules/lodash/fp/indexOf.js create mode 100644 node_modules/lodash/fp/indexOfFrom.js create mode 100644 node_modules/lodash/fp/init.js create mode 100644 node_modules/lodash/fp/initial.js create mode 100644 node_modules/lodash/fp/intersection.js create mode 100644 node_modules/lodash/fp/intersectionBy.js create mode 100644 node_modules/lodash/fp/intersectionWith.js create mode 100644 node_modules/lodash/fp/invert.js create mode 100644 node_modules/lodash/fp/invertBy.js create mode 100644 node_modules/lodash/fp/invertObj.js create mode 100644 node_modules/lodash/fp/invoke.js create mode 100644 node_modules/lodash/fp/invokeArgs.js create mode 100644 node_modules/lodash/fp/invokeArgsMap.js create mode 100644 node_modules/lodash/fp/invokeMap.js create mode 100644 node_modules/lodash/fp/isArguments.js create mode 100644 node_modules/lodash/fp/isArray.js create mode 100644 node_modules/lodash/fp/isArrayBuffer.js create mode 100644 node_modules/lodash/fp/isArrayLike.js create mode 100644 node_modules/lodash/fp/isArrayLikeObject.js create mode 100644 node_modules/lodash/fp/isBoolean.js create mode 100644 node_modules/lodash/fp/isBuffer.js create mode 100644 node_modules/lodash/fp/isDate.js create mode 100644 node_modules/lodash/fp/isElement.js create mode 100644 node_modules/lodash/fp/isEmpty.js create mode 100644 node_modules/lodash/fp/isEqual.js create mode 100644 node_modules/lodash/fp/isEqualWith.js create mode 100644 node_modules/lodash/fp/isError.js create mode 100644 node_modules/lodash/fp/isFinite.js create mode 100644 node_modules/lodash/fp/isFunction.js create mode 100644 node_modules/lodash/fp/isInteger.js create mode 100644 node_modules/lodash/fp/isLength.js create mode 100644 node_modules/lodash/fp/isMap.js create mode 100644 node_modules/lodash/fp/isMatch.js create mode 100644 node_modules/lodash/fp/isMatchWith.js create mode 100644 node_modules/lodash/fp/isNaN.js create mode 100644 node_modules/lodash/fp/isNative.js create mode 100644 node_modules/lodash/fp/isNil.js create mode 100644 node_modules/lodash/fp/isNull.js create mode 100644 node_modules/lodash/fp/isNumber.js create mode 100644 node_modules/lodash/fp/isObject.js create mode 100644 node_modules/lodash/fp/isObjectLike.js create mode 100644 node_modules/lodash/fp/isPlainObject.js create mode 100644 node_modules/lodash/fp/isRegExp.js create mode 100644 node_modules/lodash/fp/isSafeInteger.js create mode 100644 node_modules/lodash/fp/isSet.js create mode 100644 node_modules/lodash/fp/isString.js create mode 100644 node_modules/lodash/fp/isSymbol.js create mode 100644 node_modules/lodash/fp/isTypedArray.js create mode 100644 node_modules/lodash/fp/isUndefined.js create mode 100644 node_modules/lodash/fp/isWeakMap.js create mode 100644 node_modules/lodash/fp/isWeakSet.js create mode 100644 node_modules/lodash/fp/iteratee.js create mode 100644 node_modules/lodash/fp/join.js create mode 100644 node_modules/lodash/fp/juxt.js create mode 100644 node_modules/lodash/fp/kebabCase.js create mode 100644 node_modules/lodash/fp/keyBy.js create mode 100644 node_modules/lodash/fp/keys.js create mode 100644 node_modules/lodash/fp/keysIn.js create mode 100644 node_modules/lodash/fp/lang.js create mode 100644 node_modules/lodash/fp/last.js create mode 100644 node_modules/lodash/fp/lastIndexOf.js create mode 100644 node_modules/lodash/fp/lastIndexOfFrom.js create mode 100644 node_modules/lodash/fp/lowerCase.js create mode 100644 node_modules/lodash/fp/lowerFirst.js create mode 100644 node_modules/lodash/fp/lt.js create mode 100644 node_modules/lodash/fp/lte.js create mode 100644 node_modules/lodash/fp/map.js create mode 100644 node_modules/lodash/fp/mapKeys.js create mode 100644 node_modules/lodash/fp/mapValues.js create mode 100644 node_modules/lodash/fp/matches.js create mode 100644 node_modules/lodash/fp/matchesProperty.js create mode 100644 node_modules/lodash/fp/math.js create mode 100644 node_modules/lodash/fp/max.js create mode 100644 node_modules/lodash/fp/maxBy.js create mode 100644 node_modules/lodash/fp/mean.js create mode 100644 node_modules/lodash/fp/meanBy.js create mode 100644 node_modules/lodash/fp/memoize.js create mode 100644 node_modules/lodash/fp/merge.js create mode 100644 node_modules/lodash/fp/mergeAll.js create mode 100644 node_modules/lodash/fp/mergeAllWith.js create mode 100644 node_modules/lodash/fp/mergeWith.js create mode 100644 node_modules/lodash/fp/method.js create mode 100644 node_modules/lodash/fp/methodOf.js create mode 100644 node_modules/lodash/fp/min.js create mode 100644 node_modules/lodash/fp/minBy.js create mode 100644 node_modules/lodash/fp/mixin.js create mode 100644 node_modules/lodash/fp/multiply.js create mode 100644 node_modules/lodash/fp/nAry.js create mode 100644 node_modules/lodash/fp/negate.js create mode 100644 node_modules/lodash/fp/next.js create mode 100644 node_modules/lodash/fp/noop.js create mode 100644 node_modules/lodash/fp/now.js create mode 100644 node_modules/lodash/fp/nth.js create mode 100644 node_modules/lodash/fp/nthArg.js create mode 100644 node_modules/lodash/fp/number.js create mode 100644 node_modules/lodash/fp/object.js create mode 100644 node_modules/lodash/fp/omit.js create mode 100644 node_modules/lodash/fp/omitAll.js create mode 100644 node_modules/lodash/fp/omitBy.js create mode 100644 node_modules/lodash/fp/once.js create mode 100644 node_modules/lodash/fp/orderBy.js create mode 100644 node_modules/lodash/fp/over.js create mode 100644 node_modules/lodash/fp/overArgs.js create mode 100644 node_modules/lodash/fp/overEvery.js create mode 100644 node_modules/lodash/fp/overSome.js create mode 100644 node_modules/lodash/fp/pad.js create mode 100644 node_modules/lodash/fp/padChars.js create mode 100644 node_modules/lodash/fp/padCharsEnd.js create mode 100644 node_modules/lodash/fp/padCharsStart.js create mode 100644 node_modules/lodash/fp/padEnd.js create mode 100644 node_modules/lodash/fp/padStart.js create mode 100644 node_modules/lodash/fp/parseInt.js create mode 100644 node_modules/lodash/fp/partial.js create mode 100644 node_modules/lodash/fp/partialRight.js create mode 100644 node_modules/lodash/fp/partition.js create mode 100644 node_modules/lodash/fp/path.js create mode 100644 node_modules/lodash/fp/pathEq.js create mode 100644 node_modules/lodash/fp/pathOr.js create mode 100644 node_modules/lodash/fp/paths.js create mode 100644 node_modules/lodash/fp/pick.js create mode 100644 node_modules/lodash/fp/pickAll.js create mode 100644 node_modules/lodash/fp/pickBy.js create mode 100644 node_modules/lodash/fp/pipe.js create mode 100644 node_modules/lodash/fp/placeholder.js create mode 100644 node_modules/lodash/fp/plant.js create mode 100644 node_modules/lodash/fp/pluck.js create mode 100644 node_modules/lodash/fp/prop.js create mode 100644 node_modules/lodash/fp/propEq.js create mode 100644 node_modules/lodash/fp/propOr.js create mode 100644 node_modules/lodash/fp/property.js create mode 100644 node_modules/lodash/fp/propertyOf.js create mode 100644 node_modules/lodash/fp/props.js create mode 100644 node_modules/lodash/fp/pull.js create mode 100644 node_modules/lodash/fp/pullAll.js create mode 100644 node_modules/lodash/fp/pullAllBy.js create mode 100644 node_modules/lodash/fp/pullAllWith.js create mode 100644 node_modules/lodash/fp/pullAt.js create mode 100644 node_modules/lodash/fp/random.js create mode 100644 node_modules/lodash/fp/range.js create mode 100644 node_modules/lodash/fp/rangeRight.js create mode 100644 node_modules/lodash/fp/rangeStep.js create mode 100644 node_modules/lodash/fp/rangeStepRight.js create mode 100644 node_modules/lodash/fp/rearg.js create mode 100644 node_modules/lodash/fp/reduce.js create mode 100644 node_modules/lodash/fp/reduceRight.js create mode 100644 node_modules/lodash/fp/reject.js create mode 100644 node_modules/lodash/fp/remove.js create mode 100644 node_modules/lodash/fp/repeat.js create mode 100644 node_modules/lodash/fp/replace.js create mode 100644 node_modules/lodash/fp/rest.js create mode 100644 node_modules/lodash/fp/restFrom.js create mode 100644 node_modules/lodash/fp/result.js create mode 100644 node_modules/lodash/fp/reverse.js create mode 100644 node_modules/lodash/fp/round.js create mode 100644 node_modules/lodash/fp/sample.js create mode 100644 node_modules/lodash/fp/sampleSize.js create mode 100644 node_modules/lodash/fp/seq.js create mode 100644 node_modules/lodash/fp/set.js create mode 100644 node_modules/lodash/fp/setWith.js create mode 100644 node_modules/lodash/fp/shuffle.js create mode 100644 node_modules/lodash/fp/size.js create mode 100644 node_modules/lodash/fp/slice.js create mode 100644 node_modules/lodash/fp/snakeCase.js create mode 100644 node_modules/lodash/fp/some.js create mode 100644 node_modules/lodash/fp/sortBy.js create mode 100644 node_modules/lodash/fp/sortedIndex.js create mode 100644 node_modules/lodash/fp/sortedIndexBy.js create mode 100644 node_modules/lodash/fp/sortedIndexOf.js create mode 100644 node_modules/lodash/fp/sortedLastIndex.js create mode 100644 node_modules/lodash/fp/sortedLastIndexBy.js create mode 100644 node_modules/lodash/fp/sortedLastIndexOf.js create mode 100644 node_modules/lodash/fp/sortedUniq.js create mode 100644 node_modules/lodash/fp/sortedUniqBy.js create mode 100644 node_modules/lodash/fp/split.js create mode 100644 node_modules/lodash/fp/spread.js create mode 100644 node_modules/lodash/fp/spreadFrom.js create mode 100644 node_modules/lodash/fp/startCase.js create mode 100644 node_modules/lodash/fp/startsWith.js create mode 100644 node_modules/lodash/fp/string.js create mode 100644 node_modules/lodash/fp/stubArray.js create mode 100644 node_modules/lodash/fp/stubFalse.js create mode 100644 node_modules/lodash/fp/stubObject.js create mode 100644 node_modules/lodash/fp/stubString.js create mode 100644 node_modules/lodash/fp/stubTrue.js create mode 100644 node_modules/lodash/fp/subtract.js create mode 100644 node_modules/lodash/fp/sum.js create mode 100644 node_modules/lodash/fp/sumBy.js create mode 100644 node_modules/lodash/fp/symmetricDifference.js create mode 100644 node_modules/lodash/fp/symmetricDifferenceBy.js create mode 100644 node_modules/lodash/fp/symmetricDifferenceWith.js create mode 100644 node_modules/lodash/fp/tail.js create mode 100644 node_modules/lodash/fp/take.js create mode 100644 node_modules/lodash/fp/takeLast.js create mode 100644 node_modules/lodash/fp/takeLastWhile.js create mode 100644 node_modules/lodash/fp/takeRight.js create mode 100644 node_modules/lodash/fp/takeRightWhile.js create mode 100644 node_modules/lodash/fp/takeWhile.js create mode 100644 node_modules/lodash/fp/tap.js create mode 100644 node_modules/lodash/fp/template.js create mode 100644 node_modules/lodash/fp/templateSettings.js create mode 100644 node_modules/lodash/fp/throttle.js create mode 100644 node_modules/lodash/fp/thru.js create mode 100644 node_modules/lodash/fp/times.js create mode 100644 node_modules/lodash/fp/toArray.js create mode 100644 node_modules/lodash/fp/toFinite.js create mode 100644 node_modules/lodash/fp/toInteger.js create mode 100644 node_modules/lodash/fp/toIterator.js create mode 100644 node_modules/lodash/fp/toJSON.js create mode 100644 node_modules/lodash/fp/toLength.js create mode 100644 node_modules/lodash/fp/toLower.js create mode 100644 node_modules/lodash/fp/toNumber.js create mode 100644 node_modules/lodash/fp/toPairs.js create mode 100644 node_modules/lodash/fp/toPairsIn.js create mode 100644 node_modules/lodash/fp/toPath.js create mode 100644 node_modules/lodash/fp/toPlainObject.js create mode 100644 node_modules/lodash/fp/toSafeInteger.js create mode 100644 node_modules/lodash/fp/toString.js create mode 100644 node_modules/lodash/fp/toUpper.js create mode 100644 node_modules/lodash/fp/transform.js create mode 100644 node_modules/lodash/fp/trim.js create mode 100644 node_modules/lodash/fp/trimChars.js create mode 100644 node_modules/lodash/fp/trimCharsEnd.js create mode 100644 node_modules/lodash/fp/trimCharsStart.js create mode 100644 node_modules/lodash/fp/trimEnd.js create mode 100644 node_modules/lodash/fp/trimStart.js create mode 100644 node_modules/lodash/fp/truncate.js create mode 100644 node_modules/lodash/fp/unapply.js create mode 100644 node_modules/lodash/fp/unary.js create mode 100644 node_modules/lodash/fp/unescape.js create mode 100644 node_modules/lodash/fp/union.js create mode 100644 node_modules/lodash/fp/unionBy.js create mode 100644 node_modules/lodash/fp/unionWith.js create mode 100644 node_modules/lodash/fp/uniq.js create mode 100644 node_modules/lodash/fp/uniqBy.js create mode 100644 node_modules/lodash/fp/uniqWith.js create mode 100644 node_modules/lodash/fp/uniqueId.js create mode 100644 node_modules/lodash/fp/unnest.js create mode 100644 node_modules/lodash/fp/unset.js create mode 100644 node_modules/lodash/fp/unzip.js create mode 100644 node_modules/lodash/fp/unzipWith.js create mode 100644 node_modules/lodash/fp/update.js create mode 100644 node_modules/lodash/fp/updateWith.js create mode 100644 node_modules/lodash/fp/upperCase.js create mode 100644 node_modules/lodash/fp/upperFirst.js create mode 100644 node_modules/lodash/fp/useWith.js create mode 100644 node_modules/lodash/fp/util.js create mode 100644 node_modules/lodash/fp/value.js create mode 100644 node_modules/lodash/fp/valueOf.js create mode 100644 node_modules/lodash/fp/values.js create mode 100644 node_modules/lodash/fp/valuesIn.js create mode 100644 node_modules/lodash/fp/where.js create mode 100644 node_modules/lodash/fp/whereEq.js create mode 100644 node_modules/lodash/fp/without.js create mode 100644 node_modules/lodash/fp/words.js create mode 100644 node_modules/lodash/fp/wrap.js create mode 100644 node_modules/lodash/fp/wrapperAt.js create mode 100644 node_modules/lodash/fp/wrapperChain.js create mode 100644 node_modules/lodash/fp/wrapperLodash.js create mode 100644 node_modules/lodash/fp/wrapperReverse.js create mode 100644 node_modules/lodash/fp/wrapperValue.js create mode 100644 node_modules/lodash/fp/xor.js create mode 100644 node_modules/lodash/fp/xorBy.js create mode 100644 node_modules/lodash/fp/xorWith.js create mode 100644 node_modules/lodash/fp/zip.js create mode 100644 node_modules/lodash/fp/zipAll.js create mode 100644 node_modules/lodash/fp/zipObj.js create mode 100644 node_modules/lodash/fp/zipObject.js create mode 100644 node_modules/lodash/fp/zipObjectDeep.js create mode 100644 node_modules/lodash/fp/zipWith.js create mode 100644 node_modules/lodash/fromPairs.js create mode 100644 node_modules/lodash/function.js create mode 100644 node_modules/lodash/functions.js create mode 100644 node_modules/lodash/functionsIn.js create mode 100644 node_modules/lodash/get.js create mode 100644 node_modules/lodash/groupBy.js create mode 100644 node_modules/lodash/gt.js create mode 100644 node_modules/lodash/gte.js create mode 100644 node_modules/lodash/has.js create mode 100644 node_modules/lodash/hasIn.js create mode 100644 node_modules/lodash/head.js create mode 100644 node_modules/lodash/identity.js create mode 100644 node_modules/lodash/inRange.js create mode 100644 node_modules/lodash/includes.js create mode 100644 node_modules/lodash/index.js create mode 100644 node_modules/lodash/indexOf.js create mode 100644 node_modules/lodash/initial.js create mode 100644 node_modules/lodash/intersection.js create mode 100644 node_modules/lodash/intersectionBy.js create mode 100644 node_modules/lodash/intersectionWith.js create mode 100644 node_modules/lodash/invert.js create mode 100644 node_modules/lodash/invertBy.js create mode 100644 node_modules/lodash/invoke.js create mode 100644 node_modules/lodash/invokeMap.js create mode 100644 node_modules/lodash/isArguments.js create mode 100644 node_modules/lodash/isArray.js create mode 100644 node_modules/lodash/isArrayBuffer.js create mode 100644 node_modules/lodash/isArrayLike.js create mode 100644 node_modules/lodash/isArrayLikeObject.js create mode 100644 node_modules/lodash/isBoolean.js create mode 100644 node_modules/lodash/isBuffer.js create mode 100644 node_modules/lodash/isDate.js create mode 100644 node_modules/lodash/isElement.js create mode 100644 node_modules/lodash/isEmpty.js create mode 100644 node_modules/lodash/isEqual.js create mode 100644 node_modules/lodash/isEqualWith.js create mode 100644 node_modules/lodash/isError.js create mode 100644 node_modules/lodash/isFinite.js create mode 100644 node_modules/lodash/isFunction.js create mode 100644 node_modules/lodash/isInteger.js create mode 100644 node_modules/lodash/isLength.js create mode 100644 node_modules/lodash/isMap.js create mode 100644 node_modules/lodash/isMatch.js create mode 100644 node_modules/lodash/isMatchWith.js create mode 100644 node_modules/lodash/isNaN.js create mode 100644 node_modules/lodash/isNative.js create mode 100644 node_modules/lodash/isNil.js create mode 100644 node_modules/lodash/isNull.js create mode 100644 node_modules/lodash/isNumber.js create mode 100644 node_modules/lodash/isObject.js create mode 100644 node_modules/lodash/isObjectLike.js create mode 100644 node_modules/lodash/isPlainObject.js create mode 100644 node_modules/lodash/isRegExp.js create mode 100644 node_modules/lodash/isSafeInteger.js create mode 100644 node_modules/lodash/isSet.js create mode 100644 node_modules/lodash/isString.js create mode 100644 node_modules/lodash/isSymbol.js create mode 100644 node_modules/lodash/isTypedArray.js create mode 100644 node_modules/lodash/isUndefined.js create mode 100644 node_modules/lodash/isWeakMap.js create mode 100644 node_modules/lodash/isWeakSet.js create mode 100644 node_modules/lodash/iteratee.js create mode 100644 node_modules/lodash/join.js create mode 100644 node_modules/lodash/kebabCase.js create mode 100644 node_modules/lodash/keyBy.js create mode 100644 node_modules/lodash/keys.js create mode 100644 node_modules/lodash/keysIn.js create mode 100644 node_modules/lodash/lang.js create mode 100644 node_modules/lodash/last.js create mode 100644 node_modules/lodash/lastIndexOf.js create mode 100644 node_modules/lodash/lodash.js create mode 100644 node_modules/lodash/lodash.min.js create mode 100644 node_modules/lodash/lowerCase.js create mode 100644 node_modules/lodash/lowerFirst.js create mode 100644 node_modules/lodash/lt.js create mode 100644 node_modules/lodash/lte.js create mode 100644 node_modules/lodash/map.js create mode 100644 node_modules/lodash/mapKeys.js create mode 100644 node_modules/lodash/mapValues.js create mode 100644 node_modules/lodash/matches.js create mode 100644 node_modules/lodash/matchesProperty.js create mode 100644 node_modules/lodash/math.js create mode 100644 node_modules/lodash/max.js create mode 100644 node_modules/lodash/maxBy.js create mode 100644 node_modules/lodash/mean.js create mode 100644 node_modules/lodash/meanBy.js create mode 100644 node_modules/lodash/memoize.js create mode 100644 node_modules/lodash/merge.js create mode 100644 node_modules/lodash/mergeWith.js create mode 100644 node_modules/lodash/method.js create mode 100644 node_modules/lodash/methodOf.js create mode 100644 node_modules/lodash/min.js create mode 100644 node_modules/lodash/minBy.js create mode 100644 node_modules/lodash/mixin.js create mode 100644 node_modules/lodash/multiply.js create mode 100644 node_modules/lodash/negate.js create mode 100644 node_modules/lodash/next.js create mode 100644 node_modules/lodash/noop.js create mode 100644 node_modules/lodash/now.js create mode 100644 node_modules/lodash/nth.js create mode 100644 node_modules/lodash/nthArg.js create mode 100644 node_modules/lodash/number.js create mode 100644 node_modules/lodash/object.js create mode 100644 node_modules/lodash/omit.js create mode 100644 node_modules/lodash/omitBy.js create mode 100644 node_modules/lodash/once.js create mode 100644 node_modules/lodash/orderBy.js create mode 100644 node_modules/lodash/over.js create mode 100644 node_modules/lodash/overArgs.js create mode 100644 node_modules/lodash/overEvery.js create mode 100644 node_modules/lodash/overSome.js create mode 100644 node_modules/lodash/package.json create mode 100644 node_modules/lodash/pad.js create mode 100644 node_modules/lodash/padEnd.js create mode 100644 node_modules/lodash/padStart.js create mode 100644 node_modules/lodash/parseInt.js create mode 100644 node_modules/lodash/partial.js create mode 100644 node_modules/lodash/partialRight.js create mode 100644 node_modules/lodash/partition.js create mode 100644 node_modules/lodash/pick.js create mode 100644 node_modules/lodash/pickBy.js create mode 100644 node_modules/lodash/plant.js create mode 100644 node_modules/lodash/property.js create mode 100644 node_modules/lodash/propertyOf.js create mode 100644 node_modules/lodash/pull.js create mode 100644 node_modules/lodash/pullAll.js create mode 100644 node_modules/lodash/pullAllBy.js create mode 100644 node_modules/lodash/pullAllWith.js create mode 100644 node_modules/lodash/pullAt.js create mode 100644 node_modules/lodash/random.js create mode 100644 node_modules/lodash/range.js create mode 100644 node_modules/lodash/rangeRight.js create mode 100644 node_modules/lodash/rearg.js create mode 100644 node_modules/lodash/reduce.js create mode 100644 node_modules/lodash/reduceRight.js create mode 100644 node_modules/lodash/reject.js create mode 100644 node_modules/lodash/remove.js create mode 100644 node_modules/lodash/repeat.js create mode 100644 node_modules/lodash/replace.js create mode 100644 node_modules/lodash/rest.js create mode 100644 node_modules/lodash/result.js create mode 100644 node_modules/lodash/reverse.js create mode 100644 node_modules/lodash/round.js create mode 100644 node_modules/lodash/sample.js create mode 100644 node_modules/lodash/sampleSize.js create mode 100644 node_modules/lodash/seq.js create mode 100644 node_modules/lodash/set.js create mode 100644 node_modules/lodash/setWith.js create mode 100644 node_modules/lodash/shuffle.js create mode 100644 node_modules/lodash/size.js create mode 100644 node_modules/lodash/slice.js create mode 100644 node_modules/lodash/snakeCase.js create mode 100644 node_modules/lodash/some.js create mode 100644 node_modules/lodash/sortBy.js create mode 100644 node_modules/lodash/sortedIndex.js create mode 100644 node_modules/lodash/sortedIndexBy.js create mode 100644 node_modules/lodash/sortedIndexOf.js create mode 100644 node_modules/lodash/sortedLastIndex.js create mode 100644 node_modules/lodash/sortedLastIndexBy.js create mode 100644 node_modules/lodash/sortedLastIndexOf.js create mode 100644 node_modules/lodash/sortedUniq.js create mode 100644 node_modules/lodash/sortedUniqBy.js create mode 100644 node_modules/lodash/split.js create mode 100644 node_modules/lodash/spread.js create mode 100644 node_modules/lodash/startCase.js create mode 100644 node_modules/lodash/startsWith.js create mode 100644 node_modules/lodash/string.js create mode 100644 node_modules/lodash/stubArray.js create mode 100644 node_modules/lodash/stubFalse.js create mode 100644 node_modules/lodash/stubObject.js create mode 100644 node_modules/lodash/stubString.js create mode 100644 node_modules/lodash/stubTrue.js create mode 100644 node_modules/lodash/subtract.js create mode 100644 node_modules/lodash/sum.js create mode 100644 node_modules/lodash/sumBy.js create mode 100644 node_modules/lodash/tail.js create mode 100644 node_modules/lodash/take.js create mode 100644 node_modules/lodash/takeRight.js create mode 100644 node_modules/lodash/takeRightWhile.js create mode 100644 node_modules/lodash/takeWhile.js create mode 100644 node_modules/lodash/tap.js create mode 100644 node_modules/lodash/template.js create mode 100644 node_modules/lodash/templateSettings.js create mode 100644 node_modules/lodash/throttle.js create mode 100644 node_modules/lodash/thru.js create mode 100644 node_modules/lodash/times.js create mode 100644 node_modules/lodash/toArray.js create mode 100644 node_modules/lodash/toFinite.js create mode 100644 node_modules/lodash/toInteger.js create mode 100644 node_modules/lodash/toIterator.js create mode 100644 node_modules/lodash/toJSON.js create mode 100644 node_modules/lodash/toLength.js create mode 100644 node_modules/lodash/toLower.js create mode 100644 node_modules/lodash/toNumber.js create mode 100644 node_modules/lodash/toPairs.js create mode 100644 node_modules/lodash/toPairsIn.js create mode 100644 node_modules/lodash/toPath.js create mode 100644 node_modules/lodash/toPlainObject.js create mode 100644 node_modules/lodash/toSafeInteger.js create mode 100644 node_modules/lodash/toString.js create mode 100644 node_modules/lodash/toUpper.js create mode 100644 node_modules/lodash/transform.js create mode 100644 node_modules/lodash/trim.js create mode 100644 node_modules/lodash/trimEnd.js create mode 100644 node_modules/lodash/trimStart.js create mode 100644 node_modules/lodash/truncate.js create mode 100644 node_modules/lodash/unary.js create mode 100644 node_modules/lodash/unescape.js create mode 100644 node_modules/lodash/union.js create mode 100644 node_modules/lodash/unionBy.js create mode 100644 node_modules/lodash/unionWith.js create mode 100644 node_modules/lodash/uniq.js create mode 100644 node_modules/lodash/uniqBy.js create mode 100644 node_modules/lodash/uniqWith.js create mode 100644 node_modules/lodash/uniqueId.js create mode 100644 node_modules/lodash/unset.js create mode 100644 node_modules/lodash/unzip.js create mode 100644 node_modules/lodash/unzipWith.js create mode 100644 node_modules/lodash/update.js create mode 100644 node_modules/lodash/updateWith.js create mode 100644 node_modules/lodash/upperCase.js create mode 100644 node_modules/lodash/upperFirst.js create mode 100644 node_modules/lodash/util.js create mode 100644 node_modules/lodash/value.js create mode 100644 node_modules/lodash/valueOf.js create mode 100644 node_modules/lodash/values.js create mode 100644 node_modules/lodash/valuesIn.js create mode 100644 node_modules/lodash/without.js create mode 100644 node_modules/lodash/words.js create mode 100644 node_modules/lodash/wrap.js create mode 100644 node_modules/lodash/wrapperAt.js create mode 100644 node_modules/lodash/wrapperChain.js create mode 100644 node_modules/lodash/wrapperLodash.js create mode 100644 node_modules/lodash/wrapperReverse.js create mode 100644 node_modules/lodash/wrapperValue.js create mode 100644 node_modules/lodash/xor.js create mode 100644 node_modules/lodash/xorBy.js create mode 100644 node_modules/lodash/xorWith.js create mode 100644 node_modules/lodash/zip.js create mode 100644 node_modules/lodash/zipObject.js create mode 100644 node_modules/lodash/zipObjectDeep.js create mode 100644 node_modules/lodash/zipWith.js create mode 100644 node_modules/longest/LICENSE create mode 100644 node_modules/longest/README.md create mode 100644 node_modules/longest/index.js create mode 100644 node_modules/longest/package.json create mode 100644 node_modules/lowercase-keys/index.js create mode 100644 node_modules/lowercase-keys/package.json create mode 100644 node_modules/lowercase-keys/readme.md create mode 100644 node_modules/lru-cache/LICENSE create mode 100644 node_modules/lru-cache/README.md create mode 100644 node_modules/lru-cache/index.js create mode 100644 node_modules/lru-cache/package.json create mode 100644 node_modules/make-dir/index.js create mode 100644 node_modules/make-dir/license create mode 100644 node_modules/make-dir/package.json create mode 100644 node_modules/make-dir/readme.md create mode 100644 node_modules/map-cache/LICENSE create mode 100644 node_modules/map-cache/README.md create mode 100644 node_modules/map-cache/index.js create mode 100644 node_modules/map-cache/package.json create mode 100644 node_modules/map-stream/.npmignore create mode 100644 node_modules/map-stream/.travis.yml create mode 100644 node_modules/map-stream/LICENCE create mode 100644 node_modules/map-stream/examples/pretty.js create mode 100644 node_modules/map-stream/index.js create mode 100644 node_modules/map-stream/package.json create mode 100644 node_modules/map-stream/readme.markdown create mode 100644 node_modules/map-stream/test/simple-map.asynct.js create mode 100644 node_modules/map-visit/LICENSE create mode 100644 node_modules/map-visit/README.md create mode 100644 node_modules/map-visit/index.js create mode 100644 node_modules/map-visit/package.json create mode 100644 node_modules/media-typer/HISTORY.md create mode 100644 node_modules/media-typer/LICENSE create mode 100644 node_modules/media-typer/README.md create mode 100644 node_modules/media-typer/index.js create mode 100644 node_modules/media-typer/package.json create mode 100644 node_modules/merge-descriptors/HISTORY.md create mode 100644 node_modules/merge-descriptors/LICENSE create mode 100644 node_modules/merge-descriptors/README.md create mode 100644 node_modules/merge-descriptors/index.js create mode 100644 node_modules/merge-descriptors/package.json create mode 100644 node_modules/methods/HISTORY.md create mode 100644 node_modules/methods/LICENSE create mode 100644 node_modules/methods/README.md create mode 100644 node_modules/methods/index.js create mode 100644 node_modules/methods/package.json create mode 100644 node_modules/micromatch/CHANGELOG.md create mode 100755 node_modules/micromatch/LICENSE create mode 100644 node_modules/micromatch/README.md create mode 100644 node_modules/micromatch/index.js create mode 100644 node_modules/micromatch/lib/cache.js create mode 100644 node_modules/micromatch/lib/compilers.js create mode 100644 node_modules/micromatch/lib/parsers.js create mode 100644 node_modules/micromatch/lib/utils.js create mode 100644 node_modules/micromatch/node_modules/kind-of/CHANGELOG.md create mode 100644 node_modules/micromatch/node_modules/kind-of/LICENSE create mode 100644 node_modules/micromatch/node_modules/kind-of/README.md create mode 100644 node_modules/micromatch/node_modules/kind-of/index.js create mode 100644 node_modules/micromatch/node_modules/kind-of/package.json create mode 100644 node_modules/micromatch/package.json create mode 100644 node_modules/mime-db/HISTORY.md create mode 100644 node_modules/mime-db/LICENSE create mode 100644 node_modules/mime-db/README.md create mode 100644 node_modules/mime-db/db.json create mode 100644 node_modules/mime-db/index.js create mode 100644 node_modules/mime-db/package.json create mode 100644 node_modules/mime-types/HISTORY.md create mode 100644 node_modules/mime-types/LICENSE create mode 100644 node_modules/mime-types/README.md create mode 100644 node_modules/mime-types/index.js create mode 100644 node_modules/mime-types/package.json create mode 100644 node_modules/mime/.npmignore create mode 100644 node_modules/mime/LICENSE create mode 100644 node_modules/mime/README.md create mode 100644 node_modules/mime/build/build.js create mode 100644 node_modules/mime/build/test.js create mode 100755 node_modules/mime/cli.js create mode 100644 node_modules/mime/mime.js create mode 100644 node_modules/mime/package.json create mode 100644 node_modules/mime/types.json create mode 100644 node_modules/minimatch/LICENSE create mode 100644 node_modules/minimatch/README.md create mode 100644 node_modules/minimatch/minimatch.js create mode 100644 node_modules/minimatch/package.json create mode 100644 node_modules/minimist/.travis.yml create mode 100644 node_modules/minimist/LICENSE create mode 100644 node_modules/minimist/example/parse.js create mode 100644 node_modules/minimist/index.js create mode 100644 node_modules/minimist/package.json create mode 100644 node_modules/minimist/readme.markdown create mode 100644 node_modules/minimist/test/all_bool.js create mode 100644 node_modules/minimist/test/bool.js create mode 100644 node_modules/minimist/test/dash.js create mode 100644 node_modules/minimist/test/default_bool.js create mode 100644 node_modules/minimist/test/dotted.js create mode 100644 node_modules/minimist/test/kv_short.js create mode 100644 node_modules/minimist/test/long.js create mode 100644 node_modules/minimist/test/num.js create mode 100644 node_modules/minimist/test/parse.js create mode 100644 node_modules/minimist/test/parse_modified.js create mode 100644 node_modules/minimist/test/short.js create mode 100644 node_modules/minimist/test/stop_early.js create mode 100644 node_modules/minimist/test/unknown.js create mode 100644 node_modules/minimist/test/whitespace.js create mode 100644 node_modules/mixin-deep/LICENSE create mode 100644 node_modules/mixin-deep/README.md create mode 100644 node_modules/mixin-deep/index.js create mode 100644 node_modules/mixin-deep/node_modules/is-extendable/LICENSE create mode 100644 node_modules/mixin-deep/node_modules/is-extendable/README.md create mode 100644 node_modules/mixin-deep/node_modules/is-extendable/index.d.ts create mode 100644 node_modules/mixin-deep/node_modules/is-extendable/index.js create mode 100644 node_modules/mixin-deep/node_modules/is-extendable/package.json create mode 100644 node_modules/mixin-deep/package.json create mode 100644 node_modules/mongodb-core/.coveralls.yml create mode 100644 node_modules/mongodb-core/.eslintrc create mode 100644 node_modules/mongodb-core/HISTORY.md create mode 100644 node_modules/mongodb-core/LICENSE create mode 100644 node_modules/mongodb-core/Makefile create mode 100644 node_modules/mongodb-core/README.md create mode 100644 node_modules/mongodb-core/THIRD-PARTY-NOTICES create mode 100644 node_modules/mongodb-core/conf.json create mode 100644 node_modules/mongodb-core/index.js create mode 100644 node_modules/mongodb-core/lib/auth/gssapi.js create mode 100644 node_modules/mongodb-core/lib/auth/mongocr.js create mode 100644 node_modules/mongodb-core/lib/auth/plain.js create mode 100644 node_modules/mongodb-core/lib/auth/scram.js create mode 100644 node_modules/mongodb-core/lib/auth/sspi.js create mode 100644 node_modules/mongodb-core/lib/auth/x509.js create mode 100644 node_modules/mongodb-core/lib/connection/command_result.js create mode 100644 node_modules/mongodb-core/lib/connection/commands.js create mode 100644 node_modules/mongodb-core/lib/connection/connection.js create mode 100644 node_modules/mongodb-core/lib/connection/logger.js create mode 100644 node_modules/mongodb-core/lib/connection/pool.js create mode 100644 node_modules/mongodb-core/lib/connection/utils.js create mode 100644 node_modules/mongodb-core/lib/cursor.js create mode 100644 node_modules/mongodb-core/lib/error.js create mode 100644 node_modules/mongodb-core/lib/sessions.js create mode 100644 node_modules/mongodb-core/lib/tools/smoke_plugin.js create mode 100644 node_modules/mongodb-core/lib/topologies/mongos.js create mode 100644 node_modules/mongodb-core/lib/topologies/read_preference.js create mode 100644 node_modules/mongodb-core/lib/topologies/replset.js create mode 100644 node_modules/mongodb-core/lib/topologies/replset_state.js create mode 100644 node_modules/mongodb-core/lib/topologies/server.js create mode 100644 node_modules/mongodb-core/lib/topologies/shared.js create mode 100644 node_modules/mongodb-core/lib/uri_parser.js create mode 100644 node_modules/mongodb-core/lib/utils.js create mode 100644 node_modules/mongodb-core/lib/wireprotocol/2_6_support.js create mode 100644 node_modules/mongodb-core/lib/wireprotocol/3_2_support.js create mode 100644 node_modules/mongodb-core/lib/wireprotocol/compression.js create mode 100644 node_modules/mongodb-core/lib/wireprotocol/shared.js create mode 100644 node_modules/mongodb-core/package.json create mode 100644 node_modules/mongodb-core/yarn.lock create mode 100644 node_modules/mongodb/.coveralls.yml create mode 100644 node_modules/mongodb/.eslintrc create mode 100644 node_modules/mongodb/CHANGES_3.0.0.md create mode 100644 node_modules/mongodb/HISTORY.md create mode 100644 node_modules/mongodb/LICENSE create mode 100644 node_modules/mongodb/Makefile create mode 100644 node_modules/mongodb/README.md create mode 100644 node_modules/mongodb/THIRD-PARTY-NOTICES create mode 100644 node_modules/mongodb/boot_auth.js create mode 100644 node_modules/mongodb/conf.json create mode 100644 node_modules/mongodb/index.js create mode 100644 node_modules/mongodb/insert_bench.js create mode 100644 node_modules/mongodb/lib/admin.js create mode 100644 node_modules/mongodb/lib/aggregation_cursor.js create mode 100644 node_modules/mongodb/lib/apm.js create mode 100644 node_modules/mongodb/lib/authenticate.js create mode 100644 node_modules/mongodb/lib/bulk/common.js create mode 100644 node_modules/mongodb/lib/bulk/ordered.js create mode 100644 node_modules/mongodb/lib/bulk/unordered.js create mode 100644 node_modules/mongodb/lib/change_stream.js create mode 100644 node_modules/mongodb/lib/collection.js create mode 100644 node_modules/mongodb/lib/command_cursor.js create mode 100644 node_modules/mongodb/lib/cursor.js create mode 100644 node_modules/mongodb/lib/db.js create mode 100644 node_modules/mongodb/lib/gridfs-stream/download.js create mode 100644 node_modules/mongodb/lib/gridfs-stream/index.js create mode 100644 node_modules/mongodb/lib/gridfs-stream/upload.js create mode 100644 node_modules/mongodb/lib/gridfs/chunk.js create mode 100644 node_modules/mongodb/lib/gridfs/grid_store.js create mode 100644 node_modules/mongodb/lib/metadata.js create mode 100644 node_modules/mongodb/lib/mongo_client.js create mode 100644 node_modules/mongodb/lib/topologies/mongos.js create mode 100644 node_modules/mongodb/lib/topologies/replset.js create mode 100644 node_modules/mongodb/lib/topologies/server.js create mode 100644 node_modules/mongodb/lib/topologies/topology_base.js create mode 100644 node_modules/mongodb/lib/url_parser.js create mode 100644 node_modules/mongodb/lib/utils.js create mode 100644 node_modules/mongodb/package.json create mode 100644 node_modules/mongodb/yarn.lock create mode 100644 node_modules/mongoose-legacy-pluralize/LICENSE create mode 100644 node_modules/mongoose-legacy-pluralize/README.md create mode 100644 node_modules/mongoose-legacy-pluralize/index.js create mode 100644 node_modules/mongoose-legacy-pluralize/package.json create mode 100644 node_modules/mongoose/.eslintignore create mode 100644 node_modules/mongoose/.github/ISSUE_TEMPLATE.md create mode 100644 node_modules/mongoose/.github/PULL_REQUEST_TEMPLATE.md create mode 100644 node_modules/mongoose/.travis.yml create mode 100644 node_modules/mongoose/CONTRIBUTING.md create mode 100644 node_modules/mongoose/History.md create mode 100644 node_modules/mongoose/README.md create mode 100644 node_modules/mongoose/browser.js create mode 100644 node_modules/mongoose/examples/README.md create mode 100644 node_modules/mongoose/examples/aggregate/aggregate.js create mode 100644 node_modules/mongoose/examples/aggregate/package.json create mode 100644 node_modules/mongoose/examples/aggregate/person.js create mode 100644 node_modules/mongoose/examples/doc-methods.js create mode 100644 node_modules/mongoose/examples/express/README.md create mode 100644 node_modules/mongoose/examples/express/connection-sharing/README.md create mode 100644 node_modules/mongoose/examples/express/connection-sharing/app.js create mode 100644 node_modules/mongoose/examples/express/connection-sharing/modelA.js create mode 100644 node_modules/mongoose/examples/express/connection-sharing/package.json create mode 100644 node_modules/mongoose/examples/express/connection-sharing/routes.js create mode 100644 node_modules/mongoose/examples/geospatial/geoJSONSchema.js create mode 100644 node_modules/mongoose/examples/geospatial/geoJSONexample.js create mode 100644 node_modules/mongoose/examples/geospatial/geospatial.js create mode 100644 node_modules/mongoose/examples/geospatial/package.json create mode 100644 node_modules/mongoose/examples/geospatial/person.js create mode 100644 node_modules/mongoose/examples/globalschemas/gs_example.js create mode 100644 node_modules/mongoose/examples/globalschemas/person.js create mode 100644 node_modules/mongoose/examples/lean/lean.js create mode 100644 node_modules/mongoose/examples/lean/package.json create mode 100644 node_modules/mongoose/examples/lean/person.js create mode 100644 node_modules/mongoose/examples/mapreduce/mapreduce.js create mode 100644 node_modules/mongoose/examples/mapreduce/package.json create mode 100644 node_modules/mongoose/examples/mapreduce/person.js create mode 100644 node_modules/mongoose/examples/population/population-across-three-collections.js create mode 100644 node_modules/mongoose/examples/population/population-basic.js create mode 100644 node_modules/mongoose/examples/population/population-of-existing-doc.js create mode 100644 node_modules/mongoose/examples/population/population-of-multiple-existing-docs.js create mode 100644 node_modules/mongoose/examples/population/population-options.js create mode 100644 node_modules/mongoose/examples/population/population-plain-objects.js create mode 100644 node_modules/mongoose/examples/promises/package.json create mode 100644 node_modules/mongoose/examples/promises/person.js create mode 100644 node_modules/mongoose/examples/promises/promise.js create mode 100644 node_modules/mongoose/examples/querybuilder/package.json create mode 100644 node_modules/mongoose/examples/querybuilder/person.js create mode 100644 node_modules/mongoose/examples/querybuilder/querybuilder.js create mode 100644 node_modules/mongoose/examples/replicasets/package.json create mode 100644 node_modules/mongoose/examples/replicasets/person.js create mode 100644 node_modules/mongoose/examples/replicasets/replica-sets.js create mode 100644 node_modules/mongoose/examples/schema/schema.js create mode 100644 node_modules/mongoose/examples/schema/storing-schemas-as-json/index.js create mode 100644 node_modules/mongoose/examples/schema/storing-schemas-as-json/schema.json create mode 100644 node_modules/mongoose/examples/statics/person.js create mode 100644 node_modules/mongoose/examples/statics/statics.js create mode 100644 node_modules/mongoose/index.js create mode 100644 node_modules/mongoose/lib/aggregate.js create mode 100644 node_modules/mongoose/lib/browser.js create mode 100644 node_modules/mongoose/lib/browserDocument.js create mode 100644 node_modules/mongoose/lib/cast.js create mode 100644 node_modules/mongoose/lib/collection.js create mode 100644 node_modules/mongoose/lib/connection.js create mode 100644 node_modules/mongoose/lib/connectionstate.js create mode 100644 node_modules/mongoose/lib/cursor/AggregationCursor.js create mode 100644 node_modules/mongoose/lib/cursor/ChangeStream.js create mode 100644 node_modules/mongoose/lib/cursor/QueryCursor.js create mode 100644 node_modules/mongoose/lib/document.js create mode 100644 node_modules/mongoose/lib/document_provider.js create mode 100644 node_modules/mongoose/lib/drivers/SPEC.md create mode 100644 node_modules/mongoose/lib/drivers/browser/ReadPreference.js create mode 100644 node_modules/mongoose/lib/drivers/browser/binary.js create mode 100644 node_modules/mongoose/lib/drivers/browser/decimal128.js create mode 100644 node_modules/mongoose/lib/drivers/browser/index.js create mode 100644 node_modules/mongoose/lib/drivers/browser/objectid.js create mode 100644 node_modules/mongoose/lib/drivers/index.js create mode 100644 node_modules/mongoose/lib/drivers/index.web.js create mode 100644 node_modules/mongoose/lib/drivers/node-mongodb-native/ReadPreference.js create mode 100644 node_modules/mongoose/lib/drivers/node-mongodb-native/binary.js create mode 100644 node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js create mode 100644 node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js create mode 100644 node_modules/mongoose/lib/drivers/node-mongodb-native/decimal128.js create mode 100644 node_modules/mongoose/lib/drivers/node-mongodb-native/index.js create mode 100644 node_modules/mongoose/lib/drivers/node-mongodb-native/objectid.js create mode 100644 node_modules/mongoose/lib/error/browserMissingSchema.js create mode 100644 node_modules/mongoose/lib/error/cast.js create mode 100644 node_modules/mongoose/lib/error/disconnected.js create mode 100644 node_modules/mongoose/lib/error/divergentArray.js create mode 100644 node_modules/mongoose/lib/error/index.js create mode 100644 node_modules/mongoose/lib/error/messages.js create mode 100644 node_modules/mongoose/lib/error/missingSchema.js create mode 100644 node_modules/mongoose/lib/error/notFound.js create mode 100644 node_modules/mongoose/lib/error/objectExpected.js create mode 100644 node_modules/mongoose/lib/error/objectParameter.js create mode 100644 node_modules/mongoose/lib/error/overwriteModel.js create mode 100644 node_modules/mongoose/lib/error/strict.js create mode 100644 node_modules/mongoose/lib/error/validation.js create mode 100644 node_modules/mongoose/lib/error/validator.js create mode 100644 node_modules/mongoose/lib/error/version.js create mode 100644 node_modules/mongoose/lib/index.js create mode 100644 node_modules/mongoose/lib/internal.js create mode 100644 node_modules/mongoose/lib/model.js create mode 100644 node_modules/mongoose/lib/options.js create mode 100644 node_modules/mongoose/lib/plugins/idGetter.js create mode 100644 node_modules/mongoose/lib/plugins/removeSubdocs.js create mode 100644 node_modules/mongoose/lib/plugins/saveSubdocs.js create mode 100644 node_modules/mongoose/lib/plugins/sharding.js create mode 100644 node_modules/mongoose/lib/plugins/validateBeforeSave.js create mode 100644 node_modules/mongoose/lib/promise_provider.js create mode 100644 node_modules/mongoose/lib/query.js create mode 100644 node_modules/mongoose/lib/queryhelpers.js create mode 100644 node_modules/mongoose/lib/schema.js create mode 100644 node_modules/mongoose/lib/schema/array.js create mode 100644 node_modules/mongoose/lib/schema/boolean.js create mode 100644 node_modules/mongoose/lib/schema/buffer.js create mode 100644 node_modules/mongoose/lib/schema/date.js create mode 100644 node_modules/mongoose/lib/schema/decimal128.js create mode 100644 node_modules/mongoose/lib/schema/documentarray.js create mode 100644 node_modules/mongoose/lib/schema/embedded.js create mode 100644 node_modules/mongoose/lib/schema/index.js create mode 100644 node_modules/mongoose/lib/schema/mixed.js create mode 100644 node_modules/mongoose/lib/schema/number.js create mode 100644 node_modules/mongoose/lib/schema/objectid.js create mode 100644 node_modules/mongoose/lib/schema/operators/bitwise.js create mode 100644 node_modules/mongoose/lib/schema/operators/exists.js create mode 100644 node_modules/mongoose/lib/schema/operators/geospatial.js create mode 100644 node_modules/mongoose/lib/schema/operators/helpers.js create mode 100644 node_modules/mongoose/lib/schema/operators/type.js create mode 100644 node_modules/mongoose/lib/schema/string.js create mode 100644 node_modules/mongoose/lib/schematype.js create mode 100644 node_modules/mongoose/lib/services/common.js create mode 100644 node_modules/mongoose/lib/services/cursor/eachAsync.js create mode 100644 node_modules/mongoose/lib/services/document/cleanModifiedSubpaths.js create mode 100644 node_modules/mongoose/lib/services/document/compile.js create mode 100644 node_modules/mongoose/lib/services/model/applyHooks.js create mode 100644 node_modules/mongoose/lib/services/model/applyMethods.js create mode 100644 node_modules/mongoose/lib/services/model/applyStatics.js create mode 100644 node_modules/mongoose/lib/services/model/discriminator.js create mode 100644 node_modules/mongoose/lib/services/populate/getSchemaTypes.js create mode 100644 node_modules/mongoose/lib/services/projection/isDefiningProjection.js create mode 100644 node_modules/mongoose/lib/services/projection/isExclusive.js create mode 100644 node_modules/mongoose/lib/services/projection/isInclusive.js create mode 100644 node_modules/mongoose/lib/services/projection/isPathSelectedInclusive.js create mode 100644 node_modules/mongoose/lib/services/query/castUpdate.js create mode 100644 node_modules/mongoose/lib/services/query/hasDollarKeys.js create mode 100644 node_modules/mongoose/lib/services/query/selectPopulatedFields.js create mode 100644 node_modules/mongoose/lib/services/setDefaultsOnInsert.js create mode 100644 node_modules/mongoose/lib/services/updateValidators.js create mode 100644 node_modules/mongoose/lib/statemachine.js create mode 100644 node_modules/mongoose/lib/types/array.js create mode 100644 node_modules/mongoose/lib/types/buffer.js create mode 100644 node_modules/mongoose/lib/types/decimal128.js create mode 100644 node_modules/mongoose/lib/types/documentarray.js create mode 100644 node_modules/mongoose/lib/types/embedded.js create mode 100644 node_modules/mongoose/lib/types/index.js create mode 100644 node_modules/mongoose/lib/types/objectid.js create mode 100644 node_modules/mongoose/lib/types/subdocument.js create mode 100644 node_modules/mongoose/lib/utils.js create mode 100644 node_modules/mongoose/lib/virtualtype.js create mode 100644 node_modules/mongoose/migrating_to_5.md create mode 100644 node_modules/mongoose/package.json create mode 100644 node_modules/mongoose/release-items.md create mode 100644 node_modules/mongoose/static.js create mode 100644 node_modules/mongoose/tools/auth.js create mode 100644 node_modules/mongoose/tools/repl.js create mode 100644 node_modules/mongoose/tools/sharded.js create mode 100644 node_modules/mongoose/website.js create mode 100644 node_modules/morgan/HISTORY.md create mode 100644 node_modules/morgan/LICENSE create mode 100644 node_modules/morgan/README.md create mode 100644 node_modules/morgan/index.js create mode 100644 node_modules/morgan/package.json create mode 100644 node_modules/mpath/.npmignore create mode 100644 node_modules/mpath/.travis.yml create mode 100644 node_modules/mpath/History.md create mode 100644 node_modules/mpath/LICENSE create mode 100644 node_modules/mpath/Makefile create mode 100644 node_modules/mpath/README.md create mode 100644 node_modules/mpath/bench.js create mode 100644 node_modules/mpath/bench.log create mode 100644 node_modules/mpath/bench.out create mode 100644 node_modules/mpath/component.json create mode 100644 node_modules/mpath/index.js create mode 100644 node_modules/mpath/lib/index.js create mode 100644 node_modules/mpath/package.json create mode 100644 node_modules/mpath/test/index.js create mode 100644 node_modules/mquery/.travis.yml create mode 100644 node_modules/mquery/History.md create mode 100644 node_modules/mquery/LICENSE create mode 100644 node_modules/mquery/Makefile create mode 100644 node_modules/mquery/README.md create mode 100644 node_modules/mquery/lib/collection/collection.js create mode 100644 node_modules/mquery/lib/collection/index.js create mode 100644 node_modules/mquery/lib/collection/node.js create mode 100644 node_modules/mquery/lib/env.js create mode 100644 node_modules/mquery/lib/mquery.js create mode 100644 node_modules/mquery/lib/permissions.js create mode 100644 node_modules/mquery/lib/utils.js create mode 100644 node_modules/mquery/node_modules/sliced/.npmignore create mode 100644 node_modules/mquery/node_modules/sliced/.travis.yml create mode 100644 node_modules/mquery/node_modules/sliced/History.md create mode 100644 node_modules/mquery/node_modules/sliced/LICENSE create mode 100644 node_modules/mquery/node_modules/sliced/Makefile create mode 100644 node_modules/mquery/node_modules/sliced/README.md create mode 100644 node_modules/mquery/node_modules/sliced/bench.js create mode 100644 node_modules/mquery/node_modules/sliced/component.json create mode 100644 node_modules/mquery/node_modules/sliced/index.js create mode 100644 node_modules/mquery/node_modules/sliced/lib/sliced.js create mode 100644 node_modules/mquery/node_modules/sliced/package.json create mode 100644 node_modules/mquery/node_modules/sliced/test/index.js create mode 100644 node_modules/mquery/package.json create mode 100644 node_modules/mquery/test/collection/browser.js create mode 100644 node_modules/mquery/test/collection/mongo.js create mode 100644 node_modules/mquery/test/collection/node.js create mode 100644 node_modules/mquery/test/env.js create mode 100644 node_modules/mquery/test/index.js create mode 100644 node_modules/mquery/test/utils.test.js create mode 100644 node_modules/ms/index.js create mode 100644 node_modules/ms/license.md create mode 100644 node_modules/ms/package.json create mode 100644 node_modules/ms/readme.md create mode 100644 node_modules/nan/CHANGELOG.md create mode 100644 node_modules/nan/LICENSE.md create mode 100644 node_modules/nan/README.md create mode 100644 node_modules/nan/doc/asyncworker.md create mode 100644 node_modules/nan/doc/buffers.md create mode 100644 node_modules/nan/doc/callback.md create mode 100644 node_modules/nan/doc/converters.md create mode 100644 node_modules/nan/doc/errors.md create mode 100644 node_modules/nan/doc/json.md create mode 100644 node_modules/nan/doc/maybe_types.md create mode 100644 node_modules/nan/doc/methods.md create mode 100644 node_modules/nan/doc/new.md create mode 100644 node_modules/nan/doc/node_misc.md create mode 100644 node_modules/nan/doc/object_wrappers.md create mode 100644 node_modules/nan/doc/persistent.md create mode 100644 node_modules/nan/doc/scopes.md create mode 100644 node_modules/nan/doc/script.md create mode 100644 node_modules/nan/doc/string_bytes.md create mode 100644 node_modules/nan/doc/v8_internals.md create mode 100644 node_modules/nan/doc/v8_misc.md create mode 100644 node_modules/nan/include_dirs.js create mode 100644 node_modules/nan/nan.h create mode 100644 node_modules/nan/nan_callbacks.h create mode 100644 node_modules/nan/nan_callbacks_12_inl.h create mode 100644 node_modules/nan/nan_callbacks_pre_12_inl.h create mode 100644 node_modules/nan/nan_converters.h create mode 100644 node_modules/nan/nan_converters_43_inl.h create mode 100644 node_modules/nan/nan_converters_pre_43_inl.h create mode 100644 node_modules/nan/nan_implementation_12_inl.h create mode 100644 node_modules/nan/nan_implementation_pre_12_inl.h create mode 100644 node_modules/nan/nan_json.h create mode 100644 node_modules/nan/nan_maybe_43_inl.h create mode 100644 node_modules/nan/nan_maybe_pre_43_inl.h create mode 100644 node_modules/nan/nan_new.h create mode 100644 node_modules/nan/nan_object_wrap.h create mode 100644 node_modules/nan/nan_persistent_12_inl.h create mode 100644 node_modules/nan/nan_persistent_pre_12_inl.h create mode 100644 node_modules/nan/nan_private.h create mode 100644 node_modules/nan/nan_string_bytes.h create mode 100644 node_modules/nan/nan_typedarray_contents.h create mode 100644 node_modules/nan/nan_weak.h create mode 100644 node_modules/nan/package.json create mode 100755 node_modules/nan/tools/1to2.js create mode 100644 node_modules/nan/tools/README.md create mode 100644 node_modules/nan/tools/package.json create mode 100644 node_modules/nanomatch/CHANGELOG.md create mode 100644 node_modules/nanomatch/LICENSE create mode 100644 node_modules/nanomatch/README.md create mode 100644 node_modules/nanomatch/index.js create mode 100644 node_modules/nanomatch/lib/cache.js create mode 100644 node_modules/nanomatch/lib/compiler2.js create mode 100644 node_modules/nanomatch/lib/compilers.js create mode 100644 node_modules/nanomatch/lib/parsers.js create mode 100644 node_modules/nanomatch/lib/utils.js create mode 100644 node_modules/nanomatch/node_modules/kind-of/CHANGELOG.md create mode 100644 node_modules/nanomatch/node_modules/kind-of/LICENSE create mode 100644 node_modules/nanomatch/node_modules/kind-of/README.md create mode 100644 node_modules/nanomatch/node_modules/kind-of/index.js create mode 100644 node_modules/nanomatch/node_modules/kind-of/package.json create mode 100644 node_modules/nanomatch/package.json create mode 100644 node_modules/negotiator/HISTORY.md create mode 100644 node_modules/negotiator/LICENSE create mode 100644 node_modules/negotiator/README.md create mode 100644 node_modules/negotiator/index.js create mode 100644 node_modules/negotiator/lib/charset.js create mode 100644 node_modules/negotiator/lib/encoding.js create mode 100644 node_modules/negotiator/lib/language.js create mode 100644 node_modules/negotiator/lib/mediaType.js create mode 100644 node_modules/negotiator/package.json create mode 100644 node_modules/nodemon/.github/CONTRIBUTING.md create mode 100644 node_modules/nodemon/.github/ISSUE_TEMPLATE.md create mode 100644 node_modules/nodemon/.github/no-response.yml create mode 100644 node_modules/nodemon/.github/oliver.yml create mode 100644 node_modules/nodemon/.github/stale.yml create mode 100644 node_modules/nodemon/.jscsrc create mode 100644 node_modules/nodemon/.jshintrc create mode 100644 node_modules/nodemon/.travis.yml create mode 100644 node_modules/nodemon/CODE_OF_CONDUCT.md create mode 100644 node_modules/nodemon/README.md create mode 100755 node_modules/nodemon/bin/nodemon.js create mode 100644 node_modules/nodemon/commitlint.config.js create mode 100644 node_modules/nodemon/doc/arch.md create mode 100644 node_modules/nodemon/doc/cli/authors.txt create mode 100644 node_modules/nodemon/doc/cli/config.txt create mode 100644 node_modules/nodemon/doc/cli/help.txt create mode 100644 node_modules/nodemon/doc/cli/logo.txt create mode 100644 node_modules/nodemon/doc/cli/options.txt create mode 100644 node_modules/nodemon/doc/cli/topics.txt create mode 100644 node_modules/nodemon/doc/cli/usage.txt create mode 100644 node_modules/nodemon/doc/cli/whoami.txt create mode 100644 node_modules/nodemon/doc/events.md create mode 100644 node_modules/nodemon/doc/option-parsing-logic.md create mode 100644 node_modules/nodemon/doc/requireable.md create mode 100644 node_modules/nodemon/doc/rules.md create mode 100644 node_modules/nodemon/doc/sample-nodemon.md create mode 100644 node_modules/nodemon/faq.md create mode 100644 node_modules/nodemon/lib/cli/index.js create mode 100644 node_modules/nodemon/lib/cli/parse.js create mode 100644 node_modules/nodemon/lib/config/command.js create mode 100644 node_modules/nodemon/lib/config/defaults.js create mode 100644 node_modules/nodemon/lib/config/exec.js create mode 100644 node_modules/nodemon/lib/config/index.js create mode 100644 node_modules/nodemon/lib/config/load.js create mode 100644 node_modules/nodemon/lib/help/index.js create mode 100644 node_modules/nodemon/lib/index.js create mode 100644 node_modules/nodemon/lib/monitor/index.js create mode 100644 node_modules/nodemon/lib/monitor/match.js create mode 100644 node_modules/nodemon/lib/monitor/run.js create mode 100644 node_modules/nodemon/lib/monitor/signals.js create mode 100644 node_modules/nodemon/lib/monitor/watch.js create mode 100644 node_modules/nodemon/lib/nodemon.js create mode 100644 node_modules/nodemon/lib/rules/add.js create mode 100644 node_modules/nodemon/lib/rules/index.js create mode 100644 node_modules/nodemon/lib/rules/parse.js create mode 100644 node_modules/nodemon/lib/spawn.js create mode 100644 node_modules/nodemon/lib/utils/bus.js create mode 100644 node_modules/nodemon/lib/utils/clone.js create mode 100644 node_modules/nodemon/lib/utils/colour.js create mode 100644 node_modules/nodemon/lib/utils/index.js create mode 100644 node_modules/nodemon/lib/utils/log.js create mode 100644 node_modules/nodemon/lib/utils/merge.js create mode 100644 node_modules/nodemon/lib/version.js create mode 100644 node_modules/nodemon/node_modules/debug/.coveralls.yml create mode 100644 node_modules/nodemon/node_modules/debug/.eslintrc create mode 100644 node_modules/nodemon/node_modules/debug/.npmignore create mode 100644 node_modules/nodemon/node_modules/debug/.travis.yml create mode 100644 node_modules/nodemon/node_modules/debug/CHANGELOG.md create mode 100644 node_modules/nodemon/node_modules/debug/LICENSE create mode 100644 node_modules/nodemon/node_modules/debug/Makefile create mode 100644 node_modules/nodemon/node_modules/debug/README.md create mode 100644 node_modules/nodemon/node_modules/debug/karma.conf.js create mode 100644 node_modules/nodemon/node_modules/debug/node.js create mode 100644 node_modules/nodemon/node_modules/debug/package.json create mode 100644 node_modules/nodemon/node_modules/debug/src/browser.js create mode 100644 node_modules/nodemon/node_modules/debug/src/debug.js create mode 100644 node_modules/nodemon/node_modules/debug/src/index.js create mode 100644 node_modules/nodemon/node_modules/debug/src/node.js create mode 100644 node_modules/nodemon/package.json create mode 100644 node_modules/nodemon/website/index.html create mode 100644 node_modules/nodemon/website/mixmax.png create mode 100644 node_modules/nodemon/website/nodemon.png create mode 100644 node_modules/nodemon/website/nodemon.svg create mode 100644 node_modules/nodemon/website/sparkpost.png create mode 100644 node_modules/nodemon/website/sparkpost.svg create mode 100644 node_modules/nopt/.npmignore create mode 100644 node_modules/nopt/LICENSE create mode 100644 node_modules/nopt/README.md create mode 100755 node_modules/nopt/bin/nopt.js create mode 100755 node_modules/nopt/examples/my-program.js create mode 100644 node_modules/nopt/lib/nopt.js create mode 100644 node_modules/nopt/package.json create mode 100644 node_modules/normalize-path/LICENSE create mode 100644 node_modules/normalize-path/README.md create mode 100644 node_modules/normalize-path/index.js create mode 100644 node_modules/normalize-path/package.json create mode 100644 node_modules/npm-run-path/index.js create mode 100644 node_modules/npm-run-path/license create mode 100644 node_modules/npm-run-path/package.json create mode 100644 node_modules/npm-run-path/readme.md create mode 100644 node_modules/object-assign/index.js create mode 100644 node_modules/object-assign/license create mode 100644 node_modules/object-assign/package.json create mode 100644 node_modules/object-assign/readme.md create mode 100644 node_modules/object-copy/LICENSE create mode 100644 node_modules/object-copy/index.js create mode 100644 node_modules/object-copy/node_modules/define-property/LICENSE create mode 100644 node_modules/object-copy/node_modules/define-property/README.md create mode 100644 node_modules/object-copy/node_modules/define-property/index.js create mode 100644 node_modules/object-copy/node_modules/define-property/package.json create mode 100644 node_modules/object-copy/node_modules/is-accessor-descriptor/LICENSE create mode 100644 node_modules/object-copy/node_modules/is-accessor-descriptor/README.md create mode 100644 node_modules/object-copy/node_modules/is-accessor-descriptor/index.js create mode 100644 node_modules/object-copy/node_modules/is-accessor-descriptor/package.json create mode 100644 node_modules/object-copy/node_modules/is-data-descriptor/LICENSE create mode 100644 node_modules/object-copy/node_modules/is-data-descriptor/README.md create mode 100644 node_modules/object-copy/node_modules/is-data-descriptor/index.js create mode 100644 node_modules/object-copy/node_modules/is-data-descriptor/package.json create mode 100644 node_modules/object-copy/node_modules/is-descriptor/LICENSE create mode 100644 node_modules/object-copy/node_modules/is-descriptor/README.md create mode 100644 node_modules/object-copy/node_modules/is-descriptor/index.js create mode 100644 node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/LICENSE create mode 100644 node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/README.md create mode 100644 node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/index.js create mode 100644 node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/package.json create mode 100644 node_modules/object-copy/node_modules/is-descriptor/package.json create mode 100644 node_modules/object-copy/package.json create mode 100644 node_modules/object-visit/LICENSE create mode 100644 node_modules/object-visit/README.md create mode 100644 node_modules/object-visit/index.js create mode 100644 node_modules/object-visit/package.json create mode 100644 node_modules/object.pick/LICENSE create mode 100644 node_modules/object.pick/README.md create mode 100644 node_modules/object.pick/index.js create mode 100644 node_modules/object.pick/package.json create mode 100644 node_modules/on-finished/HISTORY.md create mode 100644 node_modules/on-finished/LICENSE create mode 100644 node_modules/on-finished/README.md create mode 100644 node_modules/on-finished/index.js create mode 100644 node_modules/on-finished/package.json create mode 100644 node_modules/on-headers/HISTORY.md create mode 100644 node_modules/on-headers/LICENSE create mode 100644 node_modules/on-headers/README.md create mode 100644 node_modules/on-headers/index.js create mode 100644 node_modules/on-headers/package.json create mode 100644 node_modules/p-finally/index.js create mode 100644 node_modules/p-finally/license create mode 100644 node_modules/p-finally/package.json create mode 100644 node_modules/p-finally/readme.md create mode 100644 node_modules/package-json/index.js create mode 100644 node_modules/package-json/license create mode 100644 node_modules/package-json/package.json create mode 100644 node_modules/package-json/readme.md create mode 100644 node_modules/parseurl/HISTORY.md create mode 100644 node_modules/parseurl/LICENSE create mode 100644 node_modules/parseurl/README.md create mode 100644 node_modules/parseurl/index.js create mode 100644 node_modules/parseurl/package.json create mode 100644 node_modules/pascalcase/LICENSE create mode 100644 node_modules/pascalcase/README.md create mode 100644 node_modules/pascalcase/index.js create mode 100644 node_modules/pascalcase/package.json create mode 100644 node_modules/path-dirname/index.js create mode 100644 node_modules/path-dirname/license create mode 100644 node_modules/path-dirname/package.json create mode 100644 node_modules/path-dirname/readme.md create mode 100644 node_modules/path-is-absolute/index.js create mode 100644 node_modules/path-is-absolute/license create mode 100644 node_modules/path-is-absolute/package.json create mode 100644 node_modules/path-is-absolute/readme.md create mode 100644 node_modules/path-is-inside/LICENSE.txt create mode 100644 node_modules/path-is-inside/lib/path-is-inside.js create mode 100644 node_modules/path-is-inside/package.json create mode 100644 node_modules/path-key/index.js create mode 100644 node_modules/path-key/license create mode 100644 node_modules/path-key/package.json create mode 100644 node_modules/path-key/readme.md create mode 100644 node_modules/path-parse/.travis.yml create mode 100644 node_modules/path-parse/README.md create mode 100644 node_modules/path-parse/index.js create mode 100644 node_modules/path-parse/index.min.js create mode 100644 node_modules/path-parse/package.json create mode 100644 node_modules/path-parse/test.js create mode 100644 node_modules/path-parse/test.min.js create mode 100644 node_modules/path-to-regexp/History.md create mode 100644 node_modules/path-to-regexp/LICENSE create mode 100644 node_modules/path-to-regexp/Readme.md create mode 100644 node_modules/path-to-regexp/index.js create mode 100644 node_modules/path-to-regexp/package.json create mode 100644 node_modules/pause-stream/.npmignore create mode 100644 node_modules/pause-stream/LICENSE create mode 100644 node_modules/pause-stream/index.js create mode 100644 node_modules/pause-stream/package.json create mode 100644 node_modules/pause-stream/readme.markdown create mode 100644 node_modules/pause-stream/test/index.js create mode 100644 node_modules/pause-stream/test/pause-end.js create mode 100644 node_modules/pify/index.js create mode 100644 node_modules/pify/license create mode 100644 node_modules/pify/package.json create mode 100644 node_modules/pify/readme.md create mode 100644 node_modules/posix-character-classes/LICENSE create mode 100644 node_modules/posix-character-classes/README.md create mode 100644 node_modules/posix-character-classes/index.js create mode 100644 node_modules/posix-character-classes/package.json create mode 100644 node_modules/prepend-http/index.js create mode 100644 node_modules/prepend-http/license create mode 100644 node_modules/prepend-http/package.json create mode 100644 node_modules/prepend-http/readme.md create mode 100644 node_modules/process-nextick-args/index.js create mode 100644 node_modules/process-nextick-args/license.md create mode 100644 node_modules/process-nextick-args/package.json create mode 100644 node_modules/process-nextick-args/readme.md create mode 100644 node_modules/promise/.jshintrc create mode 100644 node_modules/promise/.npmignore create mode 100644 node_modules/promise/LICENSE create mode 100644 node_modules/promise/Readme.md create mode 100644 node_modules/promise/build.js create mode 100644 node_modules/promise/core.js create mode 100644 node_modules/promise/domains/core.js create mode 100644 node_modules/promise/domains/done.js create mode 100644 node_modules/promise/domains/es6-extensions.js create mode 100644 node_modules/promise/domains/finally.js create mode 100644 node_modules/promise/domains/index.js create mode 100644 node_modules/promise/domains/node-extensions.js create mode 100644 node_modules/promise/domains/rejection-tracking.js create mode 100644 node_modules/promise/domains/synchronous.js create mode 100644 node_modules/promise/index.d.ts create mode 100644 node_modules/promise/index.js create mode 100644 node_modules/promise/lib/core.js create mode 100644 node_modules/promise/lib/done.js create mode 100644 node_modules/promise/lib/es6-extensions.js create mode 100644 node_modules/promise/lib/finally.js create mode 100644 node_modules/promise/lib/index.js create mode 100644 node_modules/promise/lib/node-extensions.js create mode 100644 node_modules/promise/lib/rejection-tracking.js create mode 100644 node_modules/promise/lib/synchronous.js create mode 100644 node_modules/promise/package.json create mode 100644 node_modules/promise/polyfill-done.js create mode 100644 node_modules/promise/polyfill.js create mode 100644 node_modules/promise/setimmediate/core.js create mode 100644 node_modules/promise/setimmediate/done.js create mode 100644 node_modules/promise/setimmediate/es6-extensions.js create mode 100644 node_modules/promise/setimmediate/finally.js create mode 100644 node_modules/promise/setimmediate/index.js create mode 100644 node_modules/promise/setimmediate/node-extensions.js create mode 100644 node_modules/promise/setimmediate/rejection-tracking.js create mode 100644 node_modules/promise/setimmediate/synchronous.js create mode 100644 node_modules/promise/src/core.js create mode 100644 node_modules/promise/src/done.js create mode 100644 node_modules/promise/src/es6-extensions.js create mode 100644 node_modules/promise/src/finally.js create mode 100644 node_modules/promise/src/index.js create mode 100644 node_modules/promise/src/node-extensions.js create mode 100644 node_modules/promise/src/rejection-tracking.js create mode 100644 node_modules/promise/src/synchronous.js create mode 100644 node_modules/proxy-addr/HISTORY.md create mode 100644 node_modules/proxy-addr/LICENSE create mode 100644 node_modules/proxy-addr/README.md create mode 100644 node_modules/proxy-addr/index.js create mode 100644 node_modules/proxy-addr/package.json create mode 100644 node_modules/ps-tree/.appveyor.yml create mode 100644 node_modules/ps-tree/.npmignore create mode 100644 node_modules/ps-tree/.travis.yml create mode 100644 node_modules/ps-tree/LICENSE create mode 100644 node_modules/ps-tree/README.md create mode 100644 node_modules/ps-tree/bin/ps-tree.js create mode 100755 node_modules/ps-tree/index.js create mode 100644 node_modules/ps-tree/package.json create mode 100644 node_modules/ps-tree/test/direct.js create mode 100644 node_modules/ps-tree/test/exec/child.js create mode 100644 node_modules/ps-tree/test/exec/parent.js create mode 100644 node_modules/ps-tree/test/test.js create mode 100644 node_modules/pseudomap/LICENSE create mode 100644 node_modules/pseudomap/README.md create mode 100644 node_modules/pseudomap/map.js create mode 100644 node_modules/pseudomap/package.json create mode 100644 node_modules/pseudomap/pseudomap.js create mode 100644 node_modules/pseudomap/test/basic.js create mode 100644 node_modules/pstree.remy/.travis.yml create mode 100644 node_modules/pstree.remy/lib/index.js create mode 100644 node_modules/pstree.remy/lib/utils.js create mode 100644 node_modules/pstree.remy/package.json create mode 100644 node_modules/pstree.remy/tests/fixtures/out1 create mode 100644 node_modules/pstree.remy/tests/fixtures/out2 create mode 100644 node_modules/pstree.remy/tests/index.test.js create mode 100644 node_modules/pug-attrs/LICENSE create mode 100644 node_modules/pug-attrs/README.md create mode 100644 node_modules/pug-attrs/index.js create mode 100644 node_modules/pug-attrs/package.json create mode 100644 node_modules/pug-attrs/test/index.test.js create mode 100644 node_modules/pug-code-gen/HISTORY.md create mode 100644 node_modules/pug-code-gen/LICENSE create mode 100644 node_modules/pug-code-gen/README.md create mode 100644 node_modules/pug-code-gen/index.js create mode 100644 node_modules/pug-code-gen/package.json create mode 100644 node_modules/pug-error/LICENSE create mode 100644 node_modules/pug-error/README.md create mode 100644 node_modules/pug-error/index.js create mode 100644 node_modules/pug-error/package.json create mode 100644 node_modules/pug-filters/CHANGELOG.md create mode 100644 node_modules/pug-filters/LICENSE create mode 100644 node_modules/pug-filters/README.md create mode 100644 node_modules/pug-filters/index.js create mode 100644 node_modules/pug-filters/lib/handle-filters.js create mode 100644 node_modules/pug-filters/lib/run-filter.js create mode 100644 node_modules/pug-filters/package.json create mode 100644 node_modules/pug-filters/test/__snapshots__/filter-aliases.test.js.snap create mode 100644 node_modules/pug-filters/test/__snapshots__/index.test.js.snap create mode 100644 node_modules/pug-filters/test/__snapshots__/per-filter-options-applied-to-nested-filters.test.js.snap create mode 100644 node_modules/pug-filters/test/cases/filters-empty.input.json create mode 100644 node_modules/pug-filters/test/cases/filters.cdata.input.json create mode 100644 node_modules/pug-filters/test/cases/filters.coffeescript.input.json create mode 100644 node_modules/pug-filters/test/cases/filters.custom.input.json create mode 100644 node_modules/pug-filters/test/cases/filters.include.custom.input.json create mode 100644 node_modules/pug-filters/test/cases/filters.include.custom.pug create mode 100644 node_modules/pug-filters/test/cases/filters.include.input.json create mode 100644 node_modules/pug-filters/test/cases/filters.inline.input.json create mode 100644 node_modules/pug-filters/test/cases/filters.less.input.json create mode 100644 node_modules/pug-filters/test/cases/filters.markdown.input.json create mode 100644 node_modules/pug-filters/test/cases/filters.nested.input.json create mode 100644 node_modules/pug-filters/test/cases/filters.stylus.input.json create mode 100644 node_modules/pug-filters/test/cases/include-filter-coffee.coffee create mode 100644 node_modules/pug-filters/test/cases/some.md create mode 100644 node_modules/pug-filters/test/custom-filters.js create mode 100644 node_modules/pug-filters/test/errors-src/dynamic-option.jade create mode 100644 node_modules/pug-filters/test/errors/dynamic-option.input.json create mode 100644 node_modules/pug-filters/test/filter-aliases.test.js create mode 100644 node_modules/pug-filters/test/index.test.js create mode 100644 node_modules/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js create mode 100644 node_modules/pug-filters/test/update-test-cases.js create mode 100644 node_modules/pug-lexer/History.md create mode 100644 node_modules/pug-lexer/LICENSE create mode 100644 node_modules/pug-lexer/README.md create mode 100644 node_modules/pug-lexer/index.js create mode 100644 node_modules/pug-lexer/package.json create mode 100644 node_modules/pug-lexer/test/__snapshots__/index.test.js.snap create mode 100644 node_modules/pug-lexer/test/cases/attr-es2015.pug create mode 100644 node_modules/pug-lexer/test/cases/attrs-data.pug create mode 100644 node_modules/pug-lexer/test/cases/attrs.js.pug create mode 100644 node_modules/pug-lexer/test/cases/attrs.pug create mode 100644 node_modules/pug-lexer/test/cases/attrs.unescaped.pug create mode 100644 node_modules/pug-lexer/test/cases/basic.pug create mode 100644 node_modules/pug-lexer/test/cases/blanks.pug create mode 100644 node_modules/pug-lexer/test/cases/block-code.pug create mode 100644 node_modules/pug-lexer/test/cases/block-expansion.pug create mode 100644 node_modules/pug-lexer/test/cases/block-expansion.shorthands.pug create mode 100644 node_modules/pug-lexer/test/cases/blockquote.pug create mode 100644 node_modules/pug-lexer/test/cases/blocks-in-blocks.pug create mode 100644 node_modules/pug-lexer/test/cases/blocks-in-if.pug create mode 100644 node_modules/pug-lexer/test/cases/case-blocks.pug create mode 100644 node_modules/pug-lexer/test/cases/case.pug create mode 100644 node_modules/pug-lexer/test/cases/classes-empty.pug create mode 100644 node_modules/pug-lexer/test/cases/classes.pug create mode 100644 node_modules/pug-lexer/test/cases/code.conditionals.pug create mode 100644 node_modules/pug-lexer/test/cases/code.escape.pug create mode 100644 node_modules/pug-lexer/test/cases/code.iteration.pug create mode 100644 node_modules/pug-lexer/test/cases/code.pug create mode 100644 node_modules/pug-lexer/test/cases/comments-in-case.pug create mode 100644 node_modules/pug-lexer/test/cases/comments.pug create mode 100644 node_modules/pug-lexer/test/cases/comments.source.pug create mode 100644 node_modules/pug-lexer/test/cases/doctype.custom.pug create mode 100644 node_modules/pug-lexer/test/cases/doctype.default.pug create mode 100644 node_modules/pug-lexer/test/cases/doctype.keyword.pug create mode 100644 node_modules/pug-lexer/test/cases/each.else.pug create mode 100644 node_modules/pug-lexer/test/cases/escape-chars.pug create mode 100644 node_modules/pug-lexer/test/cases/escape-test.pug create mode 100644 node_modules/pug-lexer/test/cases/escaping-class-attribute.pug create mode 100644 node_modules/pug-lexer/test/cases/filter-in-include.pug create mode 100644 node_modules/pug-lexer/test/cases/filters-empty.pug create mode 100644 node_modules/pug-lexer/test/cases/filters.coffeescript.pug create mode 100644 node_modules/pug-lexer/test/cases/filters.custom.pug create mode 100644 node_modules/pug-lexer/test/cases/filters.include.custom.pug create mode 100644 node_modules/pug-lexer/test/cases/filters.include.pug create mode 100644 node_modules/pug-lexer/test/cases/filters.inline.pug create mode 100644 node_modules/pug-lexer/test/cases/filters.less.pug create mode 100644 node_modules/pug-lexer/test/cases/filters.markdown.pug create mode 100644 node_modules/pug-lexer/test/cases/filters.nested.pug create mode 100644 node_modules/pug-lexer/test/cases/filters.stylus.pug create mode 100644 node_modules/pug-lexer/test/cases/filters.verbatim.pug create mode 100644 node_modules/pug-lexer/test/cases/html.pug create mode 100644 node_modules/pug-lexer/test/cases/html5.pug create mode 100644 node_modules/pug-lexer/test/cases/include-extends-from-root.pug create mode 100644 node_modules/pug-lexer/test/cases/include-extends-of-common-template.pug create mode 100644 node_modules/pug-lexer/test/cases/include-extends-relative.pug create mode 100644 node_modules/pug-lexer/test/cases/include-only-text-body.pug create mode 100644 node_modules/pug-lexer/test/cases/include-only-text.pug create mode 100644 node_modules/pug-lexer/test/cases/include-with-text-head.pug create mode 100644 node_modules/pug-lexer/test/cases/include-with-text.pug create mode 100644 node_modules/pug-lexer/test/cases/include.script.pug create mode 100644 node_modules/pug-lexer/test/cases/include.yield.nested.pug create mode 100644 node_modules/pug-lexer/test/cases/includes-with-ext-js.pug create mode 100644 node_modules/pug-lexer/test/cases/includes.pug create mode 100644 node_modules/pug-lexer/test/cases/inheritance.alert-dialog.pug create mode 100644 node_modules/pug-lexer/test/cases/inheritance.defaults.pug create mode 100644 node_modules/pug-lexer/test/cases/inheritance.extend.include.pug create mode 100644 node_modules/pug-lexer/test/cases/inheritance.extend.mixins.block.pug create mode 100644 node_modules/pug-lexer/test/cases/inheritance.extend.mixins.pug create mode 100644 node_modules/pug-lexer/test/cases/inheritance.extend.pug create mode 100644 node_modules/pug-lexer/test/cases/inheritance.extend.recursive.pug create mode 100644 node_modules/pug-lexer/test/cases/inheritance.extend.whitespace.pug create mode 100644 node_modules/pug-lexer/test/cases/inheritance.pug create mode 100644 node_modules/pug-lexer/test/cases/inline-block-comment.pug create mode 100644 node_modules/pug-lexer/test/cases/inline-tag.pug create mode 100644 node_modules/pug-lexer/test/cases/intepolated-elements.pug create mode 100644 node_modules/pug-lexer/test/cases/interpolated-mixin.pug create mode 100644 node_modules/pug-lexer/test/cases/interpolation.escape.pug create mode 100644 node_modules/pug-lexer/test/cases/javascript-new-lines.js create mode 100644 node_modules/pug-lexer/test/cases/layout.append.pug create mode 100644 node_modules/pug-lexer/test/cases/layout.append.without-block.pug create mode 100644 node_modules/pug-lexer/test/cases/layout.multi.append.prepend.block.pug create mode 100644 node_modules/pug-lexer/test/cases/layout.prepend.pug create mode 100644 node_modules/pug-lexer/test/cases/layout.prepend.without-block.pug create mode 100644 node_modules/pug-lexer/test/cases/mixin-at-end-of-file.pug create mode 100644 node_modules/pug-lexer/test/cases/mixin-block-with-space.pug create mode 100644 node_modules/pug-lexer/test/cases/mixin-hoist.pug create mode 100644 node_modules/pug-lexer/test/cases/mixin-via-include.pug create mode 100644 node_modules/pug-lexer/test/cases/mixin.attrs.pug create mode 100644 node_modules/pug-lexer/test/cases/mixin.block-tag-behaviour.pug create mode 100644 node_modules/pug-lexer/test/cases/mixin.blocks.pug create mode 100644 node_modules/pug-lexer/test/cases/mixin.merge.pug create mode 100644 node_modules/pug-lexer/test/cases/mixins-unused.pug create mode 100644 node_modules/pug-lexer/test/cases/mixins.pug create mode 100644 node_modules/pug-lexer/test/cases/mixins.rest-args.pug create mode 100644 node_modules/pug-lexer/test/cases/namespaces.pug create mode 100644 node_modules/pug-lexer/test/cases/nesting.pug create mode 100644 node_modules/pug-lexer/test/cases/pipeless-comments.pug create mode 100644 node_modules/pug-lexer/test/cases/pipeless-filters.pug create mode 100644 node_modules/pug-lexer/test/cases/pipeless-tag.pug create mode 100644 node_modules/pug-lexer/test/cases/pre.pug create mode 100644 node_modules/pug-lexer/test/cases/quotes.pug create mode 100644 node_modules/pug-lexer/test/cases/regression.1794.pug create mode 100644 node_modules/pug-lexer/test/cases/regression.784.pug create mode 100644 node_modules/pug-lexer/test/cases/script.whitespace.pug create mode 100644 node_modules/pug-lexer/test/cases/scripts.non-js.pug create mode 100644 node_modules/pug-lexer/test/cases/scripts.pug create mode 100644 node_modules/pug-lexer/test/cases/self-closing-html.pug create mode 100644 node_modules/pug-lexer/test/cases/single-period.pug create mode 100644 node_modules/pug-lexer/test/cases/source.pug create mode 100644 node_modules/pug-lexer/test/cases/styles.pug create mode 100644 node_modules/pug-lexer/test/cases/tag-blocks.pug create mode 100644 node_modules/pug-lexer/test/cases/tag.interpolation.pug create mode 100644 node_modules/pug-lexer/test/cases/tags.self-closing.pug create mode 100644 node_modules/pug-lexer/test/cases/template.pug create mode 100644 node_modules/pug-lexer/test/cases/text-block.pug create mode 100644 node_modules/pug-lexer/test/cases/text.pug create mode 100644 node_modules/pug-lexer/test/cases/utf8bom.pug create mode 100644 node_modules/pug-lexer/test/cases/vars.pug create mode 100644 node_modules/pug-lexer/test/cases/while.pug create mode 100644 node_modules/pug-lexer/test/cases/xml.pug create mode 100644 node_modules/pug-lexer/test/cases/yield-before-conditional-head.pug create mode 100644 node_modules/pug-lexer/test/cases/yield-before-conditional.pug create mode 100644 node_modules/pug-lexer/test/cases/yield-head.pug create mode 100644 node_modules/pug-lexer/test/cases/yield-title-head.pug create mode 100644 node_modules/pug-lexer/test/cases/yield-title.pug create mode 100644 node_modules/pug-lexer/test/cases/yield.pug create mode 100644 node_modules/pug-lexer/test/check-lexer-functions.test.js create mode 100644 node_modules/pug-lexer/test/errors/attribute-invalid-expression.pug create mode 100644 node_modules/pug-lexer/test/errors/case-with-invalid-expression.pug create mode 100644 node_modules/pug-lexer/test/errors/case-with-no-expression.pug create mode 100644 node_modules/pug-lexer/test/errors/default-with-expression.pug create mode 100644 node_modules/pug-lexer/test/errors/else-with-condition.pug create mode 100644 node_modules/pug-lexer/test/errors/extends-no-path.pug create mode 100644 node_modules/pug-lexer/test/errors/include-filter-no-path-2.pug create mode 100644 node_modules/pug-lexer/test/errors/include-filter-no-path.pug create mode 100644 node_modules/pug-lexer/test/errors/include-filter-no-space.pug create mode 100644 node_modules/pug-lexer/test/errors/include-no-path.pug create mode 100644 node_modules/pug-lexer/test/errors/inconsistent-indentation.pug create mode 100644 node_modules/pug-lexer/test/errors/interpolated-call.pug create mode 100644 node_modules/pug-lexer/test/errors/invalid-class-name-1.pug create mode 100644 node_modules/pug-lexer/test/errors/invalid-class-name-2.pug create mode 100644 node_modules/pug-lexer/test/errors/invalid-class-name-3.pug create mode 100644 node_modules/pug-lexer/test/errors/invalid-id.pug create mode 100644 node_modules/pug-lexer/test/errors/malformed-each.pug create mode 100644 node_modules/pug-lexer/test/errors/malformed-extend.pug create mode 100644 node_modules/pug-lexer/test/errors/malformed-include.pug create mode 100644 node_modules/pug-lexer/test/errors/mismatched-inline-tag.pug create mode 100644 node_modules/pug-lexer/test/errors/mismatched-tag-interpolation.pug create mode 100644 node_modules/pug-lexer/test/errors/multi-line-interpolation.pug create mode 100644 node_modules/pug-lexer/test/errors/old-prefixed-each.pug create mode 100644 node_modules/pug-lexer/test/errors/open-interpolation.pug create mode 100644 node_modules/pug-lexer/test/errors/when-with-no-expression.pug create mode 100644 node_modules/pug-lexer/test/errors/while-with-no-expression.pug create mode 100644 node_modules/pug-lexer/test/index.test.js create mode 100644 node_modules/pug-linker/HISTORY.md create mode 100644 node_modules/pug-linker/LICENSE create mode 100644 node_modules/pug-linker/README.md create mode 100644 node_modules/pug-linker/index.js create mode 100644 node_modules/pug-linker/package.json create mode 100644 node_modules/pug-linker/test/__snapshots__/index.test.js.snap create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/1794-extends.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/1794-include.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/blocks-in-blocks-layout.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/dialog.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/empty-block.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/escapes.html create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/extends-empty-block-1.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/extends-empty-block-2.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/extends-from-root.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/extends-relative.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/filter-in-include.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/includable.js create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/include-from-root.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.mixin.block.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.recursive-grand-grandparent.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.recursive-grandparent.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.recursive-parent.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/layout.include.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/layout.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/mixin-at-end-of-file.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/mixins.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/pet.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/smile.html create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/window.pug create mode 100644 node_modules/pug-linker/test/cases-src/auxiliary/yield-nested.pug create mode 100644 node_modules/pug-linker/test/cases-src/include-extends-from-root.pug create mode 100644 node_modules/pug-linker/test/cases-src/include-extends-of-common-template.pug create mode 100644 node_modules/pug-linker/test/cases-src/include-extends-relative.pug create mode 100644 node_modules/pug-linker/test/cases-src/include-filter-coffee.coffee create mode 100644 node_modules/pug-linker/test/cases-src/include-filter-stylus.pug create mode 100644 node_modules/pug-linker/test/cases-src/include-filter.pug create mode 100644 node_modules/pug-linker/test/cases-src/include-only-text-body.pug create mode 100644 node_modules/pug-linker/test/cases-src/include-only-text.pug create mode 100644 node_modules/pug-linker/test/cases-src/include-with-text-head.pug create mode 100644 node_modules/pug-linker/test/cases-src/include-with-text.pug create mode 100644 node_modules/pug-linker/test/cases-src/include.script.pug create mode 100644 node_modules/pug-linker/test/cases-src/include.yield.nested.pug create mode 100644 node_modules/pug-linker/test/cases-src/includes-with-ext-js.pug create mode 100644 node_modules/pug-linker/test/cases-src/includes.pug create mode 100644 node_modules/pug-linker/test/cases-src/javascript-new-lines.js create mode 100644 node_modules/pug-linker/test/cases-src/layout.append.pug create mode 100644 node_modules/pug-linker/test/cases-src/layout.append.without-block.pug create mode 100644 node_modules/pug-linker/test/cases-src/layout.multi.append.prepend.block.pug create mode 100644 node_modules/pug-linker/test/cases-src/layout.prepend.pug create mode 100644 node_modules/pug-linker/test/cases-src/layout.prepend.without-block.pug create mode 100644 node_modules/pug-linker/test/cases-src/some-included.styl create mode 100644 node_modules/pug-linker/test/cases-src/some.md create mode 100644 node_modules/pug-linker/test/cases-src/some.styl create mode 100644 node_modules/pug-linker/test/cases/include-extends-from-root.input.json create mode 100644 node_modules/pug-linker/test/cases/include-extends-of-common-template.input.json create mode 100644 node_modules/pug-linker/test/cases/include-extends-relative.input.json create mode 100644 node_modules/pug-linker/test/cases/include-filter-stylus.input.json create mode 100644 node_modules/pug-linker/test/cases/include-filter.input.json create mode 100644 node_modules/pug-linker/test/cases/include-only-text-body.input.json create mode 100644 node_modules/pug-linker/test/cases/include-only-text.input.json create mode 100644 node_modules/pug-linker/test/cases/include-with-text-head.input.json create mode 100644 node_modules/pug-linker/test/cases/include-with-text.input.json create mode 100644 node_modules/pug-linker/test/cases/include.script.input.json create mode 100644 node_modules/pug-linker/test/cases/include.yield.nested.input.json create mode 100644 node_modules/pug-linker/test/cases/includes-with-ext-js.input.json create mode 100644 node_modules/pug-linker/test/cases/includes.input.json create mode 100644 node_modules/pug-linker/test/cases/layout.append.input.json create mode 100644 node_modules/pug-linker/test/cases/layout.append.without-block.input.json create mode 100644 node_modules/pug-linker/test/cases/layout.multi.append.prepend.block.input.json create mode 100644 node_modules/pug-linker/test/cases/layout.prepend.input.json create mode 100644 node_modules/pug-linker/test/cases/layout.prepend.without-block.input.json create mode 100644 node_modules/pug-linker/test/errors-src/child-with-tags.pug create mode 100644 node_modules/pug-linker/test/errors-src/extends-not-first.pug create mode 100644 node_modules/pug-linker/test/errors-src/unexpected-block.pug create mode 100644 node_modules/pug-linker/test/errors/child-with-tags.input.json create mode 100644 node_modules/pug-linker/test/errors/extends-not-first.input.json create mode 100644 node_modules/pug-linker/test/errors/unexpected-block.input.json create mode 100644 node_modules/pug-linker/test/fixtures/append-without-block/app-layout.pug create mode 100644 node_modules/pug-linker/test/fixtures/append-without-block/layout.pug create mode 100644 node_modules/pug-linker/test/fixtures/append-without-block/page.pug create mode 100644 node_modules/pug-linker/test/fixtures/append/app-layout.pug create mode 100644 node_modules/pug-linker/test/fixtures/append/layout.pug create mode 100644 node_modules/pug-linker/test/fixtures/append/page.html create mode 100644 node_modules/pug-linker/test/fixtures/append/page.pug create mode 100644 node_modules/pug-linker/test/fixtures/empty.pug create mode 100644 node_modules/pug-linker/test/fixtures/layout.pug create mode 100644 node_modules/pug-linker/test/fixtures/mixins.pug create mode 100644 node_modules/pug-linker/test/fixtures/multi-append-prepend-block/redefine.pug create mode 100644 node_modules/pug-linker/test/fixtures/multi-append-prepend-block/root.pug create mode 100644 node_modules/pug-linker/test/fixtures/prepend-without-block/app-layout.pug create mode 100644 node_modules/pug-linker/test/fixtures/prepend-without-block/layout.pug create mode 100644 node_modules/pug-linker/test/fixtures/prepend-without-block/page.html create mode 100644 node_modules/pug-linker/test/fixtures/prepend-without-block/page.pug create mode 100644 node_modules/pug-linker/test/fixtures/prepend/app-layout.pug create mode 100644 node_modules/pug-linker/test/fixtures/prepend/layout.pug create mode 100644 node_modules/pug-linker/test/fixtures/prepend/page.html create mode 100644 node_modules/pug-linker/test/fixtures/prepend/page.pug create mode 100644 node_modules/pug-linker/test/index.test.js create mode 100644 node_modules/pug-linker/test/special-cases-src/extending-empty.pug create mode 100644 node_modules/pug-linker/test/special-cases-src/extending-include.pug create mode 100644 node_modules/pug-linker/test/special-cases-src/root-mixin.pug create mode 100644 node_modules/pug-linker/test/special-cases/extending-empty.input.json create mode 100644 node_modules/pug-linker/test/special-cases/extending-include.input.json create mode 100644 node_modules/pug-linker/test/special-cases/root-mixin.input.json create mode 100644 node_modules/pug-load/HISTORY.md create mode 100644 node_modules/pug-load/LICENSE create mode 100644 node_modules/pug-load/README.md create mode 100644 node_modules/pug-load/index.js create mode 100644 node_modules/pug-load/package.json create mode 100644 node_modules/pug-load/test/__snapshots__/index.test.js.snap create mode 100644 node_modules/pug-load/test/bar.pug create mode 100644 node_modules/pug-load/test/bing.pug create mode 100644 node_modules/pug-load/test/foo.pug create mode 100644 node_modules/pug-load/test/index.test.js create mode 100644 node_modules/pug-load/test/script.js create mode 100644 node_modules/pug-parser/HISTORY.md create mode 100644 node_modules/pug-parser/LICENSE create mode 100644 node_modules/pug-parser/README.md create mode 100644 node_modules/pug-parser/index.js create mode 100644 node_modules/pug-parser/lib/inline-tags.js create mode 100644 node_modules/pug-parser/package.json create mode 100644 node_modules/pug-parser/test/__snapshots__/index.test.js.snap create mode 100644 node_modules/pug-parser/test/cases/attr-es2015.tokens.json create mode 100644 node_modules/pug-parser/test/cases/attrs-data.tokens.json create mode 100644 node_modules/pug-parser/test/cases/attrs.js.tokens.json create mode 100644 node_modules/pug-parser/test/cases/attrs.tokens.json create mode 100644 node_modules/pug-parser/test/cases/attrs.unescaped.tokens.json create mode 100644 node_modules/pug-parser/test/cases/basic.tokens.json create mode 100644 node_modules/pug-parser/test/cases/blanks.tokens.json create mode 100644 node_modules/pug-parser/test/cases/block-code.tokens.json create mode 100644 node_modules/pug-parser/test/cases/block-expansion.shorthands.tokens.json create mode 100644 node_modules/pug-parser/test/cases/block-expansion.tokens.json create mode 100644 node_modules/pug-parser/test/cases/blockquote.tokens.json create mode 100644 node_modules/pug-parser/test/cases/blocks-in-blocks.tokens.json create mode 100644 node_modules/pug-parser/test/cases/blocks-in-if.tokens.json create mode 100644 node_modules/pug-parser/test/cases/case-blocks.tokens.json create mode 100644 node_modules/pug-parser/test/cases/case.tokens.json create mode 100644 node_modules/pug-parser/test/cases/classes-empty.tokens.json create mode 100644 node_modules/pug-parser/test/cases/classes.tokens.json create mode 100644 node_modules/pug-parser/test/cases/code.conditionals.tokens.json create mode 100644 node_modules/pug-parser/test/cases/code.escape.tokens.json create mode 100644 node_modules/pug-parser/test/cases/code.iteration.tokens.json create mode 100644 node_modules/pug-parser/test/cases/code.tokens.json create mode 100644 node_modules/pug-parser/test/cases/comments-in-case.tokens.json create mode 100644 node_modules/pug-parser/test/cases/comments.source.tokens.json create mode 100644 node_modules/pug-parser/test/cases/comments.tokens.json create mode 100644 node_modules/pug-parser/test/cases/doctype.custom.tokens.json create mode 100644 node_modules/pug-parser/test/cases/doctype.default.tokens.json create mode 100644 node_modules/pug-parser/test/cases/doctype.keyword.tokens.json create mode 100644 node_modules/pug-parser/test/cases/each.else.tokens.json create mode 100644 node_modules/pug-parser/test/cases/escape-chars.tokens.json create mode 100644 node_modules/pug-parser/test/cases/escape-test.tokens.json create mode 100644 node_modules/pug-parser/test/cases/escaping-class-attribute.tokens.json create mode 100644 node_modules/pug-parser/test/cases/filter-in-include.tokens.json create mode 100644 node_modules/pug-parser/test/cases/filters-empty.tokens.json create mode 100644 node_modules/pug-parser/test/cases/filters.coffeescript.tokens.json create mode 100644 node_modules/pug-parser/test/cases/filters.custom.tokens.json create mode 100644 node_modules/pug-parser/test/cases/filters.include.custom.tokens.json create mode 100644 node_modules/pug-parser/test/cases/filters.include.tokens.json create mode 100644 node_modules/pug-parser/test/cases/filters.inline.tokens.json create mode 100644 node_modules/pug-parser/test/cases/filters.less.tokens.json create mode 100644 node_modules/pug-parser/test/cases/filters.markdown.tokens.json create mode 100644 node_modules/pug-parser/test/cases/filters.nested.tokens.json create mode 100644 node_modules/pug-parser/test/cases/filters.stylus.tokens.json create mode 100644 node_modules/pug-parser/test/cases/html.tokens.json create mode 100644 node_modules/pug-parser/test/cases/html5.tokens.json create mode 100644 node_modules/pug-parser/test/cases/include-extends-from-root.tokens.json create mode 100644 node_modules/pug-parser/test/cases/include-extends-of-common-template.tokens.json create mode 100644 node_modules/pug-parser/test/cases/include-extends-relative.tokens.json create mode 100644 node_modules/pug-parser/test/cases/include-only-text-body.tokens.json create mode 100644 node_modules/pug-parser/test/cases/include-only-text.tokens.json create mode 100644 node_modules/pug-parser/test/cases/include-with-text-head.tokens.json create mode 100644 node_modules/pug-parser/test/cases/include-with-text.tokens.json create mode 100644 node_modules/pug-parser/test/cases/include.script.tokens.json create mode 100644 node_modules/pug-parser/test/cases/include.yield.nested.tokens.json create mode 100644 node_modules/pug-parser/test/cases/includes-with-ext-js.tokens.json create mode 100644 node_modules/pug-parser/test/cases/includes.tokens.json create mode 100644 node_modules/pug-parser/test/cases/inheritance.alert-dialog.tokens.json create mode 100644 node_modules/pug-parser/test/cases/inheritance.defaults.tokens.json create mode 100644 node_modules/pug-parser/test/cases/inheritance.extend.include.tokens.json create mode 100644 node_modules/pug-parser/test/cases/inheritance.extend.mixins.block.tokens.json create mode 100644 node_modules/pug-parser/test/cases/inheritance.extend.mixins.tokens.json create mode 100644 node_modules/pug-parser/test/cases/inheritance.extend.recursive.tokens.json create mode 100644 node_modules/pug-parser/test/cases/inheritance.extend.tokens.json create mode 100644 node_modules/pug-parser/test/cases/inheritance.extend.whitespace.tokens.json create mode 100644 node_modules/pug-parser/test/cases/inheritance.tokens.json create mode 100644 node_modules/pug-parser/test/cases/inline-block-comment.tokens.json create mode 100644 node_modules/pug-parser/test/cases/inline-tag.tokens.json create mode 100644 node_modules/pug-parser/test/cases/intepolated-elements.tokens.json create mode 100644 node_modules/pug-parser/test/cases/interpolated-mixin.tokens.json create mode 100644 node_modules/pug-parser/test/cases/interpolation.escape.tokens.json create mode 100644 node_modules/pug-parser/test/cases/layout.append.tokens.json create mode 100644 node_modules/pug-parser/test/cases/layout.append.without-block.tokens.json create mode 100644 node_modules/pug-parser/test/cases/layout.multi.append.prepend.block.tokens.json create mode 100644 node_modules/pug-parser/test/cases/layout.prepend.tokens.json create mode 100644 node_modules/pug-parser/test/cases/layout.prepend.without-block.tokens.json create mode 100644 node_modules/pug-parser/test/cases/mixin-at-end-of-file.tokens.json create mode 100644 node_modules/pug-parser/test/cases/mixin-block-with-space.tokens.json create mode 100644 node_modules/pug-parser/test/cases/mixin-hoist.tokens.json create mode 100644 node_modules/pug-parser/test/cases/mixin-via-include.tokens.json create mode 100644 node_modules/pug-parser/test/cases/mixin.attrs.tokens.json create mode 100644 node_modules/pug-parser/test/cases/mixin.block-tag-behaviour.tokens.json create mode 100644 node_modules/pug-parser/test/cases/mixin.blocks.tokens.json create mode 100644 node_modules/pug-parser/test/cases/mixin.merge.tokens.json create mode 100644 node_modules/pug-parser/test/cases/mixins-unused.tokens.json create mode 100644 node_modules/pug-parser/test/cases/mixins.rest-args.tokens.json create mode 100644 node_modules/pug-parser/test/cases/mixins.tokens.json create mode 100644 node_modules/pug-parser/test/cases/namespaces.tokens.json create mode 100644 node_modules/pug-parser/test/cases/nesting.tokens.json create mode 100644 node_modules/pug-parser/test/cases/pipeless-comments.tokens.json create mode 100644 node_modules/pug-parser/test/cases/pipeless-filters.tokens.json create mode 100644 node_modules/pug-parser/test/cases/pipeless-tag.tokens.json create mode 100644 node_modules/pug-parser/test/cases/pre.tokens.json create mode 100644 node_modules/pug-parser/test/cases/quotes.tokens.json create mode 100644 node_modules/pug-parser/test/cases/regression.1794.tokens.json create mode 100644 node_modules/pug-parser/test/cases/regression.784.tokens.json create mode 100644 node_modules/pug-parser/test/cases/script.whitespace.tokens.json create mode 100644 node_modules/pug-parser/test/cases/scripts.non-js.tokens.json create mode 100644 node_modules/pug-parser/test/cases/scripts.tokens.json create mode 100644 node_modules/pug-parser/test/cases/self-closing-html.tokens.json create mode 100644 node_modules/pug-parser/test/cases/single-period.tokens.json create mode 100644 node_modules/pug-parser/test/cases/source.tokens.json create mode 100644 node_modules/pug-parser/test/cases/styles.tokens.json create mode 100644 node_modules/pug-parser/test/cases/tag-blocks.tokens.json create mode 100644 node_modules/pug-parser/test/cases/tag.interpolation.tokens.json create mode 100644 node_modules/pug-parser/test/cases/tags.self-closing.tokens.json create mode 100644 node_modules/pug-parser/test/cases/template.tokens.json create mode 100644 node_modules/pug-parser/test/cases/text-block.tokens.json create mode 100644 node_modules/pug-parser/test/cases/text.tokens.json create mode 100644 node_modules/pug-parser/test/cases/utf8bom.tokens.json create mode 100644 node_modules/pug-parser/test/cases/vars.tokens.json create mode 100644 node_modules/pug-parser/test/cases/while.tokens.json create mode 100644 node_modules/pug-parser/test/cases/xml.tokens.json create mode 100644 node_modules/pug-parser/test/cases/yield-before-conditional-head.tokens.json create mode 100644 node_modules/pug-parser/test/cases/yield-before-conditional.tokens.json create mode 100644 node_modules/pug-parser/test/cases/yield-head.tokens.json create mode 100644 node_modules/pug-parser/test/cases/yield-title-head.tokens.json create mode 100644 node_modules/pug-parser/test/cases/yield-title.tokens.json create mode 100644 node_modules/pug-parser/test/cases/yield.tokens.json create mode 100644 node_modules/pug-parser/test/index.test.js create mode 100644 node_modules/pug-runtime/CHANGELOG.md create mode 100644 node_modules/pug-runtime/LICENSE create mode 100644 node_modules/pug-runtime/README.md create mode 100644 node_modules/pug-runtime/build.js create mode 100644 node_modules/pug-runtime/index.js create mode 100644 node_modules/pug-runtime/lib/dependencies.js create mode 100644 node_modules/pug-runtime/lib/internals.js create mode 100644 node_modules/pug-runtime/lib/sources.js create mode 100644 node_modules/pug-runtime/package.json create mode 100644 node_modules/pug-runtime/wrap.js create mode 100644 node_modules/pug-strip-comments/CHANGELOG.md create mode 100644 node_modules/pug-strip-comments/LICENSE.md create mode 100644 node_modules/pug-strip-comments/README.md create mode 100644 node_modules/pug-strip-comments/index.js create mode 100644 node_modules/pug-strip-comments/package.json create mode 100644 node_modules/pug-strip-comments/test/__snapshots__/index.test.js.snap create mode 100644 node_modules/pug-strip-comments/test/cases/comments-in-case.input.json create mode 100644 node_modules/pug-strip-comments/test/cases/comments.input.json create mode 100644 node_modules/pug-strip-comments/test/cases/comments.source.input.json create mode 100644 node_modules/pug-strip-comments/test/errors/comment-in-comment.input.json create mode 100644 node_modules/pug-strip-comments/test/errors/end.input.json create mode 100644 node_modules/pug-strip-comments/test/errors/startstart.input.json create mode 100644 node_modules/pug-strip-comments/test/index.test.js create mode 100644 node_modules/pug-walk/HISTORY.md create mode 100644 node_modules/pug-walk/LICENSE create mode 100644 node_modules/pug-walk/README.md create mode 100644 node_modules/pug-walk/index.js create mode 100644 node_modules/pug-walk/package.json create mode 100644 node_modules/pug/History.md create mode 100644 node_modules/pug/LICENSE create mode 100644 node_modules/pug/README.md create mode 100644 node_modules/pug/examples/README.md create mode 100644 node_modules/pug/examples/attributes.js create mode 100644 node_modules/pug/examples/attributes.pug create mode 100644 node_modules/pug/examples/code.js create mode 100644 node_modules/pug/examples/code.pug create mode 100644 node_modules/pug/examples/dynamicscript.js create mode 100644 node_modules/pug/examples/dynamicscript.pug create mode 100644 node_modules/pug/examples/each.js create mode 100644 node_modules/pug/examples/each.pug create mode 100644 node_modules/pug/examples/extend-layout.pug create mode 100644 node_modules/pug/examples/extend.js create mode 100644 node_modules/pug/examples/extend.pug create mode 100644 node_modules/pug/examples/form.js create mode 100644 node_modules/pug/examples/form.pug create mode 100644 node_modules/pug/examples/includes.js create mode 100644 node_modules/pug/examples/includes.pug create mode 100644 node_modules/pug/examples/includes/foot.pug create mode 100644 node_modules/pug/examples/includes/head.pug create mode 100644 node_modules/pug/examples/includes/scripts.pug create mode 100644 node_modules/pug/examples/includes/style.css create mode 100644 node_modules/pug/examples/layout-debug.js create mode 100644 node_modules/pug/examples/layout.js create mode 100644 node_modules/pug/examples/layout.pug create mode 100644 node_modules/pug/examples/mixins.js create mode 100644 node_modules/pug/examples/mixins.pug create mode 100644 node_modules/pug/examples/mixins/dialog.pug create mode 100644 node_modules/pug/examples/mixins/profile.pug create mode 100644 node_modules/pug/examples/pet.pug create mode 100644 node_modules/pug/examples/rss.js create mode 100644 node_modules/pug/examples/rss.pug create mode 100644 node_modules/pug/examples/text.js create mode 100644 node_modules/pug/examples/text.pug create mode 100644 node_modules/pug/examples/whitespace.js create mode 100644 node_modules/pug/examples/whitespace.pug create mode 100644 node_modules/pug/lib/index.js create mode 100644 node_modules/pug/package.json create mode 100644 node_modules/pug/register.js create mode 100644 node_modules/pug/support/benchmark.js create mode 100644 node_modules/pug/test/README.md create mode 100644 node_modules/pug/test/anti-cases/attrs.unescaped.pug create mode 100644 node_modules/pug/test/anti-cases/case-when.pug create mode 100644 node_modules/pug/test/anti-cases/case-without-with.pug create mode 100644 node_modules/pug/test/anti-cases/else-condition.pug create mode 100644 node_modules/pug/test/anti-cases/else-without-if.pug create mode 100644 node_modules/pug/test/anti-cases/inlining-a-mixin-after-a-tag.pug create mode 100644 node_modules/pug/test/anti-cases/key-char-ending-badly.pug create mode 100644 node_modules/pug/test/anti-cases/key-ending-badly.pug create mode 100644 node_modules/pug/test/anti-cases/mismatched-inline-tag.pug create mode 100644 node_modules/pug/test/anti-cases/mixin-args-syntax-error.pug create mode 100644 node_modules/pug/test/anti-cases/mixins-blocks-with-bodies.pug create mode 100644 node_modules/pug/test/anti-cases/multiple-non-nested-tags-on-a-line.pug create mode 100644 node_modules/pug/test/anti-cases/non-existant-filter.pug create mode 100644 node_modules/pug/test/anti-cases/non-mixin-block.pug create mode 100644 node_modules/pug/test/anti-cases/open-brace-in-attributes.pug create mode 100644 node_modules/pug/test/anti-cases/readme.md create mode 100644 node_modules/pug/test/anti-cases/self-closing-tag-with-block.pug create mode 100644 node_modules/pug/test/anti-cases/self-closing-tag-with-body.pug create mode 100644 node_modules/pug/test/anti-cases/self-closing-tag-with-code.pug create mode 100644 node_modules/pug/test/anti-cases/tabs-and-spaces.pug create mode 100644 node_modules/pug/test/anti-cases/unclosed-interpolated-call.pug create mode 100644 node_modules/pug/test/anti-cases/unclosed-interpolated-tag.pug create mode 100644 node_modules/pug/test/anti-cases/unclosed-interpolation.pug create mode 100644 node_modules/pug/test/browser/index.html create mode 100644 node_modules/pug/test/browser/index.pug create mode 100644 node_modules/pug/test/cases-es2015/attr.html create mode 100644 node_modules/pug/test/cases-es2015/attr.pug create mode 100644 node_modules/pug/test/cases/attrs-data.html create mode 100644 node_modules/pug/test/cases/attrs-data.pug create mode 100644 node_modules/pug/test/cases/attrs.html create mode 100644 node_modules/pug/test/cases/attrs.js.html create mode 100644 node_modules/pug/test/cases/attrs.js.pug create mode 100644 node_modules/pug/test/cases/attrs.pug create mode 100644 node_modules/pug/test/cases/attrs.unescaped.html create mode 100644 node_modules/pug/test/cases/attrs.unescaped.pug create mode 100644 node_modules/pug/test/cases/auxiliary/1794-extends.pug create mode 100644 node_modules/pug/test/cases/auxiliary/1794-include.pug create mode 100644 node_modules/pug/test/cases/auxiliary/blocks-in-blocks-layout.pug create mode 100644 node_modules/pug/test/cases/auxiliary/dialog.pug create mode 100644 node_modules/pug/test/cases/auxiliary/empty-block.pug create mode 100644 node_modules/pug/test/cases/auxiliary/escapes.html create mode 100644 node_modules/pug/test/cases/auxiliary/extends-empty-block-1.pug create mode 100644 node_modules/pug/test/cases/auxiliary/extends-empty-block-2.pug create mode 100644 node_modules/pug/test/cases/auxiliary/extends-from-root.pug create mode 100644 node_modules/pug/test/cases/auxiliary/extends-relative.pug create mode 100644 node_modules/pug/test/cases/auxiliary/filter-in-include.pug create mode 100644 node_modules/pug/test/cases/auxiliary/includable.js create mode 100644 node_modules/pug/test/cases/auxiliary/include-from-root.pug create mode 100644 node_modules/pug/test/cases/auxiliary/inheritance.extend.mixin.block.pug create mode 100644 node_modules/pug/test/cases/auxiliary/inheritance.extend.recursive-grand-grandparent.pug create mode 100644 node_modules/pug/test/cases/auxiliary/inheritance.extend.recursive-grandparent.pug create mode 100644 node_modules/pug/test/cases/auxiliary/inheritance.extend.recursive-parent.pug create mode 100644 node_modules/pug/test/cases/auxiliary/layout.include.pug create mode 100644 node_modules/pug/test/cases/auxiliary/layout.pug create mode 100644 node_modules/pug/test/cases/auxiliary/mixin-at-end-of-file.pug create mode 100644 node_modules/pug/test/cases/auxiliary/mixins.pug create mode 100644 node_modules/pug/test/cases/auxiliary/pet.pug create mode 100644 node_modules/pug/test/cases/auxiliary/smile.html create mode 100644 node_modules/pug/test/cases/auxiliary/window.pug create mode 100644 node_modules/pug/test/cases/auxiliary/yield-nested.pug create mode 100644 node_modules/pug/test/cases/basic.html create mode 100644 node_modules/pug/test/cases/basic.pug create mode 100644 node_modules/pug/test/cases/blanks.html create mode 100644 node_modules/pug/test/cases/blanks.pug create mode 100644 node_modules/pug/test/cases/block-code.html create mode 100644 node_modules/pug/test/cases/block-code.pug create mode 100644 node_modules/pug/test/cases/block-expansion.html create mode 100644 node_modules/pug/test/cases/block-expansion.pug create mode 100644 node_modules/pug/test/cases/block-expansion.shorthands.html create mode 100644 node_modules/pug/test/cases/block-expansion.shorthands.pug create mode 100644 node_modules/pug/test/cases/blockquote.html create mode 100644 node_modules/pug/test/cases/blockquote.pug create mode 100644 node_modules/pug/test/cases/blocks-in-blocks.html create mode 100644 node_modules/pug/test/cases/blocks-in-blocks.pug create mode 100644 node_modules/pug/test/cases/blocks-in-if.html create mode 100644 node_modules/pug/test/cases/blocks-in-if.pug create mode 100644 node_modules/pug/test/cases/case-blocks.html create mode 100644 node_modules/pug/test/cases/case-blocks.pug create mode 100644 node_modules/pug/test/cases/case.html create mode 100644 node_modules/pug/test/cases/case.pug create mode 100644 node_modules/pug/test/cases/classes-empty.html create mode 100644 node_modules/pug/test/cases/classes-empty.pug create mode 100644 node_modules/pug/test/cases/classes.html create mode 100644 node_modules/pug/test/cases/classes.pug create mode 100644 node_modules/pug/test/cases/code.conditionals.html create mode 100644 node_modules/pug/test/cases/code.conditionals.pug create mode 100644 node_modules/pug/test/cases/code.escape.html create mode 100644 node_modules/pug/test/cases/code.escape.pug create mode 100644 node_modules/pug/test/cases/code.html create mode 100644 node_modules/pug/test/cases/code.iteration.html create mode 100644 node_modules/pug/test/cases/code.iteration.pug create mode 100644 node_modules/pug/test/cases/code.pug create mode 100644 node_modules/pug/test/cases/comments-in-case.html create mode 100644 node_modules/pug/test/cases/comments-in-case.pug create mode 100644 node_modules/pug/test/cases/comments.html create mode 100644 node_modules/pug/test/cases/comments.pug create mode 100644 node_modules/pug/test/cases/comments.source.html create mode 100644 node_modules/pug/test/cases/comments.source.pug create mode 100644 node_modules/pug/test/cases/doctype.custom.html create mode 100644 node_modules/pug/test/cases/doctype.custom.pug create mode 100644 node_modules/pug/test/cases/doctype.default.html create mode 100644 node_modules/pug/test/cases/doctype.default.pug create mode 100644 node_modules/pug/test/cases/doctype.keyword.html create mode 100644 node_modules/pug/test/cases/doctype.keyword.pug create mode 100644 node_modules/pug/test/cases/each.else.html create mode 100644 node_modules/pug/test/cases/each.else.pug create mode 100644 node_modules/pug/test/cases/escape-chars.html create mode 100644 node_modules/pug/test/cases/escape-chars.pug create mode 100644 node_modules/pug/test/cases/escape-test.html create mode 100644 node_modules/pug/test/cases/escape-test.pug create mode 100644 node_modules/pug/test/cases/escaping-class-attribute.html create mode 100644 node_modules/pug/test/cases/escaping-class-attribute.pug create mode 100644 node_modules/pug/test/cases/filter-in-include.html create mode 100644 node_modules/pug/test/cases/filter-in-include.pug create mode 100644 node_modules/pug/test/cases/filters-empty.html create mode 100644 node_modules/pug/test/cases/filters-empty.pug create mode 100644 node_modules/pug/test/cases/filters.coffeescript.html create mode 100644 node_modules/pug/test/cases/filters.coffeescript.pug create mode 100644 node_modules/pug/test/cases/filters.custom.html create mode 100644 node_modules/pug/test/cases/filters.custom.pug create mode 100644 node_modules/pug/test/cases/filters.include.custom.html create mode 100644 node_modules/pug/test/cases/filters.include.custom.pug create mode 100644 node_modules/pug/test/cases/filters.include.html create mode 100644 node_modules/pug/test/cases/filters.include.pug create mode 100644 node_modules/pug/test/cases/filters.inline.html create mode 100644 node_modules/pug/test/cases/filters.inline.pug create mode 100644 node_modules/pug/test/cases/filters.less.html create mode 100644 node_modules/pug/test/cases/filters.less.pug create mode 100644 node_modules/pug/test/cases/filters.markdown.html create mode 100644 node_modules/pug/test/cases/filters.markdown.pug create mode 100644 node_modules/pug/test/cases/filters.nested.html create mode 100644 node_modules/pug/test/cases/filters.nested.pug create mode 100644 node_modules/pug/test/cases/filters.stylus.html create mode 100644 node_modules/pug/test/cases/filters.stylus.pug create mode 100644 node_modules/pug/test/cases/html.html create mode 100644 node_modules/pug/test/cases/html.pug create mode 100644 node_modules/pug/test/cases/html5.html create mode 100644 node_modules/pug/test/cases/html5.pug create mode 100644 node_modules/pug/test/cases/include-extends-from-root.html create mode 100644 node_modules/pug/test/cases/include-extends-from-root.pug create mode 100644 node_modules/pug/test/cases/include-extends-of-common-template.html create mode 100644 node_modules/pug/test/cases/include-extends-of-common-template.pug create mode 100644 node_modules/pug/test/cases/include-extends-relative.html create mode 100644 node_modules/pug/test/cases/include-extends-relative.pug create mode 100644 node_modules/pug/test/cases/include-filter-coffee.coffee create mode 100644 node_modules/pug/test/cases/include-only-text-body.html create mode 100644 node_modules/pug/test/cases/include-only-text-body.pug create mode 100644 node_modules/pug/test/cases/include-only-text.html create mode 100644 node_modules/pug/test/cases/include-only-text.pug create mode 100644 node_modules/pug/test/cases/include-with-text-head.html create mode 100644 node_modules/pug/test/cases/include-with-text-head.pug create mode 100644 node_modules/pug/test/cases/include-with-text.html create mode 100644 node_modules/pug/test/cases/include-with-text.pug create mode 100644 node_modules/pug/test/cases/include.script.html create mode 100644 node_modules/pug/test/cases/include.script.pug create mode 100644 node_modules/pug/test/cases/include.yield.nested.html create mode 100644 node_modules/pug/test/cases/include.yield.nested.pug create mode 100644 node_modules/pug/test/cases/includes-with-ext-js.html create mode 100644 node_modules/pug/test/cases/includes-with-ext-js.pug create mode 100644 node_modules/pug/test/cases/includes.html create mode 100644 node_modules/pug/test/cases/includes.pug create mode 100644 node_modules/pug/test/cases/inheritance.alert-dialog.html create mode 100644 node_modules/pug/test/cases/inheritance.alert-dialog.pug create mode 100644 node_modules/pug/test/cases/inheritance.defaults.html create mode 100644 node_modules/pug/test/cases/inheritance.defaults.pug create mode 100644 node_modules/pug/test/cases/inheritance.extend.html create mode 100644 node_modules/pug/test/cases/inheritance.extend.include.html create mode 100644 node_modules/pug/test/cases/inheritance.extend.include.pug create mode 100644 node_modules/pug/test/cases/inheritance.extend.mixins.block.html create mode 100644 node_modules/pug/test/cases/inheritance.extend.mixins.block.pug create mode 100644 node_modules/pug/test/cases/inheritance.extend.mixins.html create mode 100644 node_modules/pug/test/cases/inheritance.extend.mixins.pug create mode 100644 node_modules/pug/test/cases/inheritance.extend.pug create mode 100644 node_modules/pug/test/cases/inheritance.extend.recursive.html create mode 100644 node_modules/pug/test/cases/inheritance.extend.recursive.pug create mode 100644 node_modules/pug/test/cases/inheritance.extend.whitespace.html create mode 100644 node_modules/pug/test/cases/inheritance.extend.whitespace.pug create mode 100644 node_modules/pug/test/cases/inheritance.html create mode 100644 node_modules/pug/test/cases/inheritance.pug create mode 100644 node_modules/pug/test/cases/inline-tag.html create mode 100644 node_modules/pug/test/cases/inline-tag.pug create mode 100644 node_modules/pug/test/cases/intepolated-elements.html create mode 100644 node_modules/pug/test/cases/intepolated-elements.pug create mode 100644 node_modules/pug/test/cases/interpolated-mixin.html create mode 100644 node_modules/pug/test/cases/interpolated-mixin.pug create mode 100644 node_modules/pug/test/cases/interpolation.escape.html create mode 100644 node_modules/pug/test/cases/interpolation.escape.pug create mode 100644 node_modules/pug/test/cases/javascript-new-lines.js create mode 100644 node_modules/pug/test/cases/layout.append.html create mode 100644 node_modules/pug/test/cases/layout.append.pug create mode 100644 node_modules/pug/test/cases/layout.append.without-block.html create mode 100644 node_modules/pug/test/cases/layout.append.without-block.pug create mode 100644 node_modules/pug/test/cases/layout.multi.append.prepend.block.html create mode 100644 node_modules/pug/test/cases/layout.multi.append.prepend.block.pug create mode 100644 node_modules/pug/test/cases/layout.prepend.html create mode 100644 node_modules/pug/test/cases/layout.prepend.pug create mode 100644 node_modules/pug/test/cases/layout.prepend.without-block.html create mode 100644 node_modules/pug/test/cases/layout.prepend.without-block.pug create mode 100644 node_modules/pug/test/cases/mixin-at-end-of-file.html create mode 100644 node_modules/pug/test/cases/mixin-at-end-of-file.pug create mode 100644 node_modules/pug/test/cases/mixin-block-with-space.html create mode 100644 node_modules/pug/test/cases/mixin-block-with-space.pug create mode 100644 node_modules/pug/test/cases/mixin-hoist.html create mode 100644 node_modules/pug/test/cases/mixin-hoist.pug create mode 100644 node_modules/pug/test/cases/mixin-via-include.html create mode 100644 node_modules/pug/test/cases/mixin-via-include.pug create mode 100644 node_modules/pug/test/cases/mixin.attrs.html create mode 100644 node_modules/pug/test/cases/mixin.attrs.pug create mode 100644 node_modules/pug/test/cases/mixin.block-tag-behaviour.html create mode 100644 node_modules/pug/test/cases/mixin.block-tag-behaviour.pug create mode 100644 node_modules/pug/test/cases/mixin.blocks.html create mode 100644 node_modules/pug/test/cases/mixin.blocks.pug create mode 100644 node_modules/pug/test/cases/mixin.merge.html create mode 100644 node_modules/pug/test/cases/mixin.merge.pug create mode 100644 node_modules/pug/test/cases/mixins-unused.html create mode 100644 node_modules/pug/test/cases/mixins-unused.pug create mode 100644 node_modules/pug/test/cases/mixins.html create mode 100644 node_modules/pug/test/cases/mixins.pug create mode 100644 node_modules/pug/test/cases/mixins.rest-args.html create mode 100644 node_modules/pug/test/cases/mixins.rest-args.pug create mode 100644 node_modules/pug/test/cases/namespaces.html create mode 100644 node_modules/pug/test/cases/namespaces.pug create mode 100644 node_modules/pug/test/cases/nesting.html create mode 100644 node_modules/pug/test/cases/nesting.pug create mode 100644 node_modules/pug/test/cases/pipeless-comments.html create mode 100644 node_modules/pug/test/cases/pipeless-comments.pug create mode 100644 node_modules/pug/test/cases/pipeless-filters.html create mode 100644 node_modules/pug/test/cases/pipeless-filters.pug create mode 100644 node_modules/pug/test/cases/pipeless-tag.html create mode 100644 node_modules/pug/test/cases/pipeless-tag.pug create mode 100644 node_modules/pug/test/cases/pre.html create mode 100644 node_modules/pug/test/cases/pre.pug create mode 100644 node_modules/pug/test/cases/quotes.html create mode 100644 node_modules/pug/test/cases/quotes.pug create mode 100644 node_modules/pug/test/cases/regression.1794.html create mode 100644 node_modules/pug/test/cases/regression.1794.pug create mode 100644 node_modules/pug/test/cases/regression.784.html create mode 100644 node_modules/pug/test/cases/regression.784.pug create mode 100644 node_modules/pug/test/cases/script.whitespace.html create mode 100644 node_modules/pug/test/cases/script.whitespace.pug create mode 100644 node_modules/pug/test/cases/scripts.html create mode 100644 node_modules/pug/test/cases/scripts.non-js.html create mode 100644 node_modules/pug/test/cases/scripts.non-js.pug create mode 100644 node_modules/pug/test/cases/scripts.pug create mode 100644 node_modules/pug/test/cases/self-closing-html.html create mode 100644 node_modules/pug/test/cases/self-closing-html.pug create mode 100644 node_modules/pug/test/cases/single-period.html create mode 100644 node_modules/pug/test/cases/single-period.pug create mode 100644 node_modules/pug/test/cases/some-included.styl create mode 100644 node_modules/pug/test/cases/some.md create mode 100644 node_modules/pug/test/cases/some.styl create mode 100644 node_modules/pug/test/cases/source.html create mode 100644 node_modules/pug/test/cases/source.pug create mode 100644 node_modules/pug/test/cases/styles.html create mode 100644 node_modules/pug/test/cases/styles.pug create mode 100644 node_modules/pug/test/cases/tag.interpolation.html create mode 100644 node_modules/pug/test/cases/tag.interpolation.pug create mode 100644 node_modules/pug/test/cases/tags.self-closing.html create mode 100644 node_modules/pug/test/cases/tags.self-closing.pug create mode 100644 node_modules/pug/test/cases/template.html create mode 100644 node_modules/pug/test/cases/template.pug create mode 100644 node_modules/pug/test/cases/text-block.html create mode 100644 node_modules/pug/test/cases/text-block.pug create mode 100644 node_modules/pug/test/cases/text.html create mode 100644 node_modules/pug/test/cases/text.pug create mode 100644 node_modules/pug/test/cases/utf8bom.html create mode 100644 node_modules/pug/test/cases/utf8bom.pug create mode 100644 node_modules/pug/test/cases/vars.html create mode 100644 node_modules/pug/test/cases/vars.pug create mode 100644 node_modules/pug/test/cases/while.html create mode 100644 node_modules/pug/test/cases/while.pug create mode 100644 node_modules/pug/test/cases/xml.html create mode 100644 node_modules/pug/test/cases/xml.pug create mode 100644 node_modules/pug/test/cases/yield-before-conditional-head.html create mode 100644 node_modules/pug/test/cases/yield-before-conditional-head.pug create mode 100644 node_modules/pug/test/cases/yield-before-conditional.html create mode 100644 node_modules/pug/test/cases/yield-before-conditional.pug create mode 100644 node_modules/pug/test/cases/yield-head.html create mode 100644 node_modules/pug/test/cases/yield-head.pug create mode 100644 node_modules/pug/test/cases/yield-title-head.html create mode 100644 node_modules/pug/test/cases/yield-title-head.pug create mode 100644 node_modules/pug/test/cases/yield-title.html create mode 100644 node_modules/pug/test/cases/yield-title.pug create mode 100644 node_modules/pug/test/cases/yield.html create mode 100644 node_modules/pug/test/cases/yield.pug create mode 100644 node_modules/pug/test/dependencies/dependency1.pug create mode 100644 node_modules/pug/test/dependencies/dependency2.pug create mode 100644 node_modules/pug/test/dependencies/dependency3.pug create mode 100644 node_modules/pug/test/dependencies/extends1.pug create mode 100644 node_modules/pug/test/dependencies/extends2.pug create mode 100644 node_modules/pug/test/dependencies/include1.pug create mode 100644 node_modules/pug/test/dependencies/include2.pug create mode 100644 node_modules/pug/test/duplicate-block/__snapshots__/index.test.js.snap create mode 100644 node_modules/pug/test/duplicate-block/index.pug create mode 100644 node_modules/pug/test/duplicate-block/index.test.js create mode 100644 node_modules/pug/test/duplicate-block/layout-with-duplicate-block.pug create mode 100644 node_modules/pug/test/error.reporting.test.js create mode 100644 node_modules/pug/test/examples.test.js create mode 100644 node_modules/pug/test/fixtures/append-without-block/app-layout.pug create mode 100644 node_modules/pug/test/fixtures/append-without-block/layout.pug create mode 100644 node_modules/pug/test/fixtures/append-without-block/page.pug create mode 100644 node_modules/pug/test/fixtures/append/app-layout.pug create mode 100644 node_modules/pug/test/fixtures/append/layout.pug create mode 100644 node_modules/pug/test/fixtures/append/page.html create mode 100644 node_modules/pug/test/fixtures/append/page.pug create mode 100644 node_modules/pug/test/fixtures/compile.with.include.locals.error.pug create mode 100644 node_modules/pug/test/fixtures/compile.with.include.syntax.error.pug create mode 100644 node_modules/pug/test/fixtures/compile.with.layout.locals.error.pug create mode 100644 node_modules/pug/test/fixtures/compile.with.layout.syntax.error.pug create mode 100644 node_modules/pug/test/fixtures/compile.with.layout.with.include.locals.error.pug create mode 100644 node_modules/pug/test/fixtures/compile.with.layout.with.include.syntax.error.pug create mode 100644 node_modules/pug/test/fixtures/element-with-multiple-attributes.pug create mode 100644 node_modules/pug/test/fixtures/include.locals.error.pug create mode 100644 node_modules/pug/test/fixtures/include.syntax.error.pug create mode 100644 node_modules/pug/test/fixtures/invalid-block-in-extends.pug create mode 100644 node_modules/pug/test/fixtures/issue-1593/include-layout.pug create mode 100644 node_modules/pug/test/fixtures/issue-1593/include.pug create mode 100644 node_modules/pug/test/fixtures/issue-1593/index.pug create mode 100644 node_modules/pug/test/fixtures/issue-1593/layout.pug create mode 100644 node_modules/pug/test/fixtures/layout.locals.error.pug create mode 100644 node_modules/pug/test/fixtures/layout.pug create mode 100644 node_modules/pug/test/fixtures/layout.syntax.error.pug create mode 100644 node_modules/pug/test/fixtures/layout.with.runtime.error.pug create mode 100644 node_modules/pug/test/fixtures/mixin-include.pug create mode 100644 node_modules/pug/test/fixtures/mixin.error.pug create mode 100644 node_modules/pug/test/fixtures/multi-append-prepend-block/redefine.pug create mode 100644 node_modules/pug/test/fixtures/multi-append-prepend-block/root.pug create mode 100644 node_modules/pug/test/fixtures/perf.pug create mode 100644 node_modules/pug/test/fixtures/prepend-without-block/app-layout.pug create mode 100644 node_modules/pug/test/fixtures/prepend-without-block/layout.pug create mode 100644 node_modules/pug/test/fixtures/prepend-without-block/page.html create mode 100644 node_modules/pug/test/fixtures/prepend-without-block/page.pug create mode 100644 node_modules/pug/test/fixtures/prepend/app-layout.pug create mode 100644 node_modules/pug/test/fixtures/prepend/layout.pug create mode 100644 node_modules/pug/test/fixtures/prepend/page.html create mode 100644 node_modules/pug/test/fixtures/prepend/page.pug create mode 100644 node_modules/pug/test/fixtures/runtime.error.pug create mode 100644 node_modules/pug/test/fixtures/runtime.layout.error.pug create mode 100644 node_modules/pug/test/fixtures/runtime.with.mixin.error.pug create mode 100644 node_modules/pug/test/fixtures/scripts.pug create mode 100644 node_modules/pug/test/output-es2015/attr.html create mode 100644 node_modules/pug/test/output-es2015/attr.js create mode 100644 node_modules/pug/test/output/attrs-data.html create mode 100644 node_modules/pug/test/output/attrs-data.js create mode 100644 node_modules/pug/test/output/attrs.html create mode 100644 node_modules/pug/test/output/attrs.js create mode 100644 node_modules/pug/test/output/attrs.js.html create mode 100644 node_modules/pug/test/output/attrs.js.js create mode 100644 node_modules/pug/test/output/attrs.unescaped.html create mode 100644 node_modules/pug/test/output/attrs.unescaped.js create mode 100644 node_modules/pug/test/output/basic.html create mode 100644 node_modules/pug/test/output/basic.js create mode 100644 node_modules/pug/test/output/blanks.html create mode 100644 node_modules/pug/test/output/blanks.js create mode 100644 node_modules/pug/test/output/block-code.html create mode 100644 node_modules/pug/test/output/block-code.js create mode 100644 node_modules/pug/test/output/block-expansion.html create mode 100644 node_modules/pug/test/output/block-expansion.js create mode 100644 node_modules/pug/test/output/block-expansion.shorthands.html create mode 100644 node_modules/pug/test/output/block-expansion.shorthands.js create mode 100644 node_modules/pug/test/output/blockquote.html create mode 100644 node_modules/pug/test/output/blockquote.js create mode 100644 node_modules/pug/test/output/blocks-in-blocks.html create mode 100644 node_modules/pug/test/output/blocks-in-blocks.js create mode 100644 node_modules/pug/test/output/blocks-in-if.html create mode 100644 node_modules/pug/test/output/blocks-in-if.js create mode 100644 node_modules/pug/test/output/case-blocks.html create mode 100644 node_modules/pug/test/output/case-blocks.js create mode 100644 node_modules/pug/test/output/case.html create mode 100644 node_modules/pug/test/output/case.js create mode 100644 node_modules/pug/test/output/classes-empty.html create mode 100644 node_modules/pug/test/output/classes-empty.js create mode 100644 node_modules/pug/test/output/classes.html create mode 100644 node_modules/pug/test/output/classes.js create mode 100644 node_modules/pug/test/output/code.conditionals.html create mode 100644 node_modules/pug/test/output/code.conditionals.js create mode 100644 node_modules/pug/test/output/code.escape.html create mode 100644 node_modules/pug/test/output/code.escape.js create mode 100644 node_modules/pug/test/output/code.html create mode 100644 node_modules/pug/test/output/code.iteration.html create mode 100644 node_modules/pug/test/output/code.iteration.js create mode 100644 node_modules/pug/test/output/code.js create mode 100644 node_modules/pug/test/output/comments-in-case.html create mode 100644 node_modules/pug/test/output/comments-in-case.js create mode 100644 node_modules/pug/test/output/comments.html create mode 100644 node_modules/pug/test/output/comments.js create mode 100644 node_modules/pug/test/output/comments.source.html create mode 100644 node_modules/pug/test/output/comments.source.js create mode 100644 node_modules/pug/test/output/doctype.custom.html create mode 100644 node_modules/pug/test/output/doctype.custom.js create mode 100644 node_modules/pug/test/output/doctype.default.html create mode 100644 node_modules/pug/test/output/doctype.default.js create mode 100644 node_modules/pug/test/output/doctype.keyword.html create mode 100644 node_modules/pug/test/output/doctype.keyword.js create mode 100644 node_modules/pug/test/output/each.else.html create mode 100644 node_modules/pug/test/output/each.else.js create mode 100644 node_modules/pug/test/output/escape-chars.html create mode 100644 node_modules/pug/test/output/escape-chars.js create mode 100644 node_modules/pug/test/output/escape-test.html create mode 100644 node_modules/pug/test/output/escape-test.js create mode 100644 node_modules/pug/test/output/escaping-class-attribute.html create mode 100644 node_modules/pug/test/output/escaping-class-attribute.js create mode 100644 node_modules/pug/test/output/filter-in-include.html create mode 100644 node_modules/pug/test/output/filter-in-include.js create mode 100644 node_modules/pug/test/output/filters-empty.html create mode 100644 node_modules/pug/test/output/filters-empty.js create mode 100644 node_modules/pug/test/output/filters.coffeescript.html create mode 100644 node_modules/pug/test/output/filters.coffeescript.js create mode 100644 node_modules/pug/test/output/filters.custom.html create mode 100644 node_modules/pug/test/output/filters.custom.js create mode 100644 node_modules/pug/test/output/filters.include.custom.html create mode 100644 node_modules/pug/test/output/filters.include.custom.js create mode 100644 node_modules/pug/test/output/filters.include.html create mode 100644 node_modules/pug/test/output/filters.include.js create mode 100644 node_modules/pug/test/output/filters.inline.html create mode 100644 node_modules/pug/test/output/filters.inline.js create mode 100644 node_modules/pug/test/output/filters.less.html create mode 100644 node_modules/pug/test/output/filters.less.js create mode 100644 node_modules/pug/test/output/filters.markdown.html create mode 100644 node_modules/pug/test/output/filters.markdown.js create mode 100644 node_modules/pug/test/output/filters.nested.html create mode 100644 node_modules/pug/test/output/filters.nested.js create mode 100644 node_modules/pug/test/output/filters.stylus.html create mode 100644 node_modules/pug/test/output/filters.stylus.js create mode 100644 node_modules/pug/test/output/html.html create mode 100644 node_modules/pug/test/output/html.js create mode 100644 node_modules/pug/test/output/html5.html create mode 100644 node_modules/pug/test/output/html5.js create mode 100644 node_modules/pug/test/output/include-extends-from-root.html create mode 100644 node_modules/pug/test/output/include-extends-from-root.js create mode 100644 node_modules/pug/test/output/include-extends-of-common-template.html create mode 100644 node_modules/pug/test/output/include-extends-of-common-template.js create mode 100644 node_modules/pug/test/output/include-extends-relative.html create mode 100644 node_modules/pug/test/output/include-extends-relative.js create mode 100644 node_modules/pug/test/output/include-only-text-body.html create mode 100644 node_modules/pug/test/output/include-only-text-body.js create mode 100644 node_modules/pug/test/output/include-only-text.html create mode 100644 node_modules/pug/test/output/include-only-text.js create mode 100644 node_modules/pug/test/output/include-with-text-head.html create mode 100644 node_modules/pug/test/output/include-with-text-head.js create mode 100644 node_modules/pug/test/output/include-with-text.html create mode 100644 node_modules/pug/test/output/include-with-text.js create mode 100644 node_modules/pug/test/output/include.script.html create mode 100644 node_modules/pug/test/output/include.script.js create mode 100644 node_modules/pug/test/output/include.yield.nested.html create mode 100644 node_modules/pug/test/output/include.yield.nested.js create mode 100644 node_modules/pug/test/output/includes-with-ext-js.html create mode 100644 node_modules/pug/test/output/includes-with-ext-js.js create mode 100644 node_modules/pug/test/output/includes.html create mode 100644 node_modules/pug/test/output/includes.js create mode 100644 node_modules/pug/test/output/inheritance.alert-dialog.html create mode 100644 node_modules/pug/test/output/inheritance.alert-dialog.js create mode 100644 node_modules/pug/test/output/inheritance.defaults.html create mode 100644 node_modules/pug/test/output/inheritance.defaults.js create mode 100644 node_modules/pug/test/output/inheritance.extend.html create mode 100644 node_modules/pug/test/output/inheritance.extend.include.html create mode 100644 node_modules/pug/test/output/inheritance.extend.include.js create mode 100644 node_modules/pug/test/output/inheritance.extend.js create mode 100644 node_modules/pug/test/output/inheritance.extend.mixins.block.html create mode 100644 node_modules/pug/test/output/inheritance.extend.mixins.block.js create mode 100644 node_modules/pug/test/output/inheritance.extend.mixins.html create mode 100644 node_modules/pug/test/output/inheritance.extend.mixins.js create mode 100644 node_modules/pug/test/output/inheritance.extend.recursive.html create mode 100644 node_modules/pug/test/output/inheritance.extend.recursive.js create mode 100644 node_modules/pug/test/output/inheritance.extend.whitespace.html create mode 100644 node_modules/pug/test/output/inheritance.extend.whitespace.js create mode 100644 node_modules/pug/test/output/inheritance.html create mode 100644 node_modules/pug/test/output/inheritance.js create mode 100644 node_modules/pug/test/output/inline-tag.html create mode 100644 node_modules/pug/test/output/inline-tag.js create mode 100644 node_modules/pug/test/output/intepolated-elements.html create mode 100644 node_modules/pug/test/output/intepolated-elements.js create mode 100644 node_modules/pug/test/output/interpolated-mixin.html create mode 100644 node_modules/pug/test/output/interpolated-mixin.js create mode 100644 node_modules/pug/test/output/interpolation.escape.html create mode 100644 node_modules/pug/test/output/interpolation.escape.js create mode 100644 node_modules/pug/test/output/layout.append.html create mode 100644 node_modules/pug/test/output/layout.append.js create mode 100644 node_modules/pug/test/output/layout.append.without-block.html create mode 100644 node_modules/pug/test/output/layout.append.without-block.js create mode 100644 node_modules/pug/test/output/layout.multi.append.prepend.block.html create mode 100644 node_modules/pug/test/output/layout.multi.append.prepend.block.js create mode 100644 node_modules/pug/test/output/layout.prepend.html create mode 100644 node_modules/pug/test/output/layout.prepend.js create mode 100644 node_modules/pug/test/output/layout.prepend.without-block.html create mode 100644 node_modules/pug/test/output/layout.prepend.without-block.js create mode 100644 node_modules/pug/test/output/mixin-at-end-of-file.html create mode 100644 node_modules/pug/test/output/mixin-at-end-of-file.js create mode 100644 node_modules/pug/test/output/mixin-block-with-space.html create mode 100644 node_modules/pug/test/output/mixin-block-with-space.js create mode 100644 node_modules/pug/test/output/mixin-hoist.html create mode 100644 node_modules/pug/test/output/mixin-hoist.js create mode 100644 node_modules/pug/test/output/mixin-via-include.html create mode 100644 node_modules/pug/test/output/mixin-via-include.js create mode 100644 node_modules/pug/test/output/mixin.attrs.html create mode 100644 node_modules/pug/test/output/mixin.attrs.js create mode 100644 node_modules/pug/test/output/mixin.block-tag-behaviour.html create mode 100644 node_modules/pug/test/output/mixin.block-tag-behaviour.js create mode 100644 node_modules/pug/test/output/mixin.blocks.html create mode 100644 node_modules/pug/test/output/mixin.blocks.js create mode 100644 node_modules/pug/test/output/mixin.merge.html create mode 100644 node_modules/pug/test/output/mixin.merge.js create mode 100644 node_modules/pug/test/output/mixins-unused.html create mode 100644 node_modules/pug/test/output/mixins-unused.js create mode 100644 node_modules/pug/test/output/mixins.html create mode 100644 node_modules/pug/test/output/mixins.js create mode 100644 node_modules/pug/test/output/mixins.rest-args.html create mode 100644 node_modules/pug/test/output/mixins.rest-args.js create mode 100644 node_modules/pug/test/output/namespaces.html create mode 100644 node_modules/pug/test/output/namespaces.js create mode 100644 node_modules/pug/test/output/nesting.html create mode 100644 node_modules/pug/test/output/nesting.js create mode 100644 node_modules/pug/test/output/pipeless-comments.html create mode 100644 node_modules/pug/test/output/pipeless-comments.js create mode 100644 node_modules/pug/test/output/pipeless-filters.html create mode 100644 node_modules/pug/test/output/pipeless-filters.js create mode 100644 node_modules/pug/test/output/pipeless-tag.html create mode 100644 node_modules/pug/test/output/pipeless-tag.js create mode 100644 node_modules/pug/test/output/pre.html create mode 100644 node_modules/pug/test/output/pre.js create mode 100644 node_modules/pug/test/output/quotes.html create mode 100644 node_modules/pug/test/output/quotes.js create mode 100644 node_modules/pug/test/output/regression.1794.html create mode 100644 node_modules/pug/test/output/regression.1794.js create mode 100644 node_modules/pug/test/output/regression.784.html create mode 100644 node_modules/pug/test/output/regression.784.js create mode 100644 node_modules/pug/test/output/script.whitespace.html create mode 100644 node_modules/pug/test/output/script.whitespace.js create mode 100644 node_modules/pug/test/output/scripts.html create mode 100644 node_modules/pug/test/output/scripts.js create mode 100644 node_modules/pug/test/output/scripts.non-js.html create mode 100644 node_modules/pug/test/output/scripts.non-js.js create mode 100644 node_modules/pug/test/output/self-closing-html.html create mode 100644 node_modules/pug/test/output/self-closing-html.js create mode 100644 node_modules/pug/test/output/single-period.html create mode 100644 node_modules/pug/test/output/single-period.js create mode 100644 node_modules/pug/test/output/source.html create mode 100644 node_modules/pug/test/output/source.js create mode 100644 node_modules/pug/test/output/styles.html create mode 100644 node_modules/pug/test/output/styles.js create mode 100644 node_modules/pug/test/output/tag.interpolation.html create mode 100644 node_modules/pug/test/output/tag.interpolation.js create mode 100644 node_modules/pug/test/output/tags.self-closing.html create mode 100644 node_modules/pug/test/output/tags.self-closing.js create mode 100644 node_modules/pug/test/output/template.html create mode 100644 node_modules/pug/test/output/template.js create mode 100644 node_modules/pug/test/output/text-block.html create mode 100644 node_modules/pug/test/output/text-block.js create mode 100644 node_modules/pug/test/output/text.html create mode 100644 node_modules/pug/test/output/text.js create mode 100644 node_modules/pug/test/output/utf8bom.html create mode 100644 node_modules/pug/test/output/utf8bom.js create mode 100644 node_modules/pug/test/output/vars.html create mode 100644 node_modules/pug/test/output/vars.js create mode 100644 node_modules/pug/test/output/while.html create mode 100644 node_modules/pug/test/output/while.js create mode 100644 node_modules/pug/test/output/xml.html create mode 100644 node_modules/pug/test/output/xml.js create mode 100644 node_modules/pug/test/output/yield-before-conditional-head.html create mode 100644 node_modules/pug/test/output/yield-before-conditional-head.js create mode 100644 node_modules/pug/test/output/yield-before-conditional.html create mode 100644 node_modules/pug/test/output/yield-before-conditional.js create mode 100644 node_modules/pug/test/output/yield-head.html create mode 100644 node_modules/pug/test/output/yield-head.js create mode 100644 node_modules/pug/test/output/yield-title-head.html create mode 100644 node_modules/pug/test/output/yield-title-head.js create mode 100644 node_modules/pug/test/output/yield-title.html create mode 100644 node_modules/pug/test/output/yield-title.js create mode 100644 node_modules/pug/test/output/yield.html create mode 100644 node_modules/pug/test/output/yield.js create mode 100644 node_modules/pug/test/pug.test.js create mode 100644 node_modules/pug/test/run-es2015.test.js create mode 100644 node_modules/pug/test/run-syntax-errors.test.js create mode 100644 node_modules/pug/test/run-utils.js create mode 100644 node_modules/pug/test/run.test.js create mode 100644 node_modules/pug/test/temp/input-compileFile.pug create mode 100644 node_modules/pug/test/temp/input-compileFileClient.pug create mode 100644 node_modules/pug/test/temp/input-renderFile.pug create mode 100644 node_modules/qs/.editorconfig create mode 100644 node_modules/qs/.eslintignore create mode 100644 node_modules/qs/.eslintrc create mode 100644 node_modules/qs/CHANGELOG.md create mode 100644 node_modules/qs/LICENSE create mode 100644 node_modules/qs/README.md create mode 100644 node_modules/qs/dist/qs.js create mode 100644 node_modules/qs/lib/formats.js create mode 100644 node_modules/qs/lib/index.js create mode 100644 node_modules/qs/lib/parse.js create mode 100644 node_modules/qs/lib/stringify.js create mode 100644 node_modules/qs/lib/utils.js create mode 100644 node_modules/qs/package.json create mode 100644 node_modules/qs/test/.eslintrc create mode 100644 node_modules/qs/test/index.js create mode 100644 node_modules/qs/test/parse.js create mode 100644 node_modules/qs/test/stringify.js create mode 100644 node_modules/qs/test/utils.js create mode 100644 node_modules/range-parser/HISTORY.md create mode 100644 node_modules/range-parser/LICENSE create mode 100644 node_modules/range-parser/README.md create mode 100644 node_modules/range-parser/index.js create mode 100644 node_modules/range-parser/package.json create mode 100644 node_modules/raw-body/HISTORY.md create mode 100644 node_modules/raw-body/LICENSE create mode 100644 node_modules/raw-body/README.md create mode 100644 node_modules/raw-body/index.d.ts create mode 100644 node_modules/raw-body/index.js create mode 100644 node_modules/raw-body/package.json create mode 100644 node_modules/rc/.npmignore create mode 100644 node_modules/rc/LICENSE.APACHE2 create mode 100644 node_modules/rc/LICENSE.BSD create mode 100644 node_modules/rc/LICENSE.MIT create mode 100644 node_modules/rc/README.md create mode 100644 node_modules/rc/browser.js create mode 100755 node_modules/rc/cli.js create mode 100755 node_modules/rc/index.js create mode 100644 node_modules/rc/lib/utils.js create mode 100644 node_modules/rc/package.json create mode 100644 node_modules/rc/test/ini.js create mode 100644 node_modules/rc/test/nested-env-vars.js create mode 100644 node_modules/rc/test/test.js create mode 100644 node_modules/readable-stream/.travis.yml create mode 100644 node_modules/readable-stream/CONTRIBUTING.md create mode 100644 node_modules/readable-stream/GOVERNANCE.md create mode 100644 node_modules/readable-stream/LICENSE create mode 100644 node_modules/readable-stream/README.md create mode 100644 node_modules/readable-stream/doc/wg-meetings/2015-01-30.md create mode 100644 node_modules/readable-stream/duplex-browser.js create mode 100644 node_modules/readable-stream/duplex.js create mode 100644 node_modules/readable-stream/lib/_stream_duplex.js create mode 100644 node_modules/readable-stream/lib/_stream_passthrough.js create mode 100644 node_modules/readable-stream/lib/_stream_readable.js create mode 100644 node_modules/readable-stream/lib/_stream_transform.js create mode 100644 node_modules/readable-stream/lib/_stream_writable.js create mode 100644 node_modules/readable-stream/lib/internal/streams/BufferList.js create mode 100644 node_modules/readable-stream/lib/internal/streams/destroy.js create mode 100644 node_modules/readable-stream/lib/internal/streams/stream-browser.js create mode 100644 node_modules/readable-stream/lib/internal/streams/stream.js create mode 100644 node_modules/readable-stream/package.json create mode 100644 node_modules/readable-stream/passthrough.js create mode 100644 node_modules/readable-stream/readable-browser.js create mode 100644 node_modules/readable-stream/readable.js create mode 100644 node_modules/readable-stream/transform.js create mode 100644 node_modules/readable-stream/writable-browser.js create mode 100644 node_modules/readable-stream/writable.js create mode 100644 node_modules/readdirp/.npmignore create mode 100644 node_modules/readdirp/.travis.yml create mode 100644 node_modules/readdirp/LICENSE create mode 100644 node_modules/readdirp/README.md create mode 100644 node_modules/readdirp/examples/Readme.md create mode 100644 node_modules/readdirp/examples/callback-api.js create mode 100644 node_modules/readdirp/examples/grep.js create mode 100644 node_modules/readdirp/examples/package.json create mode 100644 node_modules/readdirp/examples/stream-api-pipe.js create mode 100644 node_modules/readdirp/examples/stream-api.js create mode 100644 node_modules/readdirp/package.json create mode 100644 node_modules/readdirp/readdirp.js create mode 100644 node_modules/readdirp/stream-api.js create mode 100644 node_modules/readdirp/test/bed/root_dir1/root_dir1_file1.ext1 create mode 100644 node_modules/readdirp/test/bed/root_dir1/root_dir1_file2.ext2 create mode 100644 node_modules/readdirp/test/bed/root_dir1/root_dir1_file3.ext3 create mode 100644 node_modules/readdirp/test/bed/root_dir1/root_dir1_subdir1/root1_dir1_subdir1_file1.ext1 create mode 100644 node_modules/readdirp/test/bed/root_dir2/root_dir2_file1.ext1 create mode 100644 node_modules/readdirp/test/bed/root_dir2/root_dir2_file2.ext2 create mode 100644 node_modules/readdirp/test/bed/root_file1.ext1 create mode 100644 node_modules/readdirp/test/bed/root_file2.ext2 create mode 100644 node_modules/readdirp/test/bed/root_file3.ext3 create mode 100644 node_modules/readdirp/test/readdirp-stream.js create mode 100644 node_modules/readdirp/test/readdirp.js create mode 100644 node_modules/regenerator-runtime/README.md create mode 100644 node_modules/regenerator-runtime/package.json create mode 100644 node_modules/regenerator-runtime/path.js create mode 100644 node_modules/regenerator-runtime/runtime-module.js create mode 100644 node_modules/regenerator-runtime/runtime.js create mode 100644 node_modules/regex-not/LICENSE create mode 100644 node_modules/regex-not/README.md create mode 100644 node_modules/regex-not/index.js create mode 100644 node_modules/regex-not/package.json create mode 100644 node_modules/regexp-clone/.npmignore create mode 100644 node_modules/regexp-clone/.travis.yml create mode 100644 node_modules/regexp-clone/History.md create mode 100644 node_modules/regexp-clone/LICENSE create mode 100644 node_modules/regexp-clone/Makefile create mode 100644 node_modules/regexp-clone/README.md create mode 100644 node_modules/regexp-clone/index.js create mode 100644 node_modules/regexp-clone/package.json create mode 100644 node_modules/regexp-clone/test/index.js create mode 100644 node_modules/registry-auth-token/CHANGELOG.md create mode 100644 node_modules/registry-auth-token/LICENSE create mode 100644 node_modules/registry-auth-token/README.md create mode 100644 node_modules/registry-auth-token/base64.js create mode 100644 node_modules/registry-auth-token/index.js create mode 100644 node_modules/registry-auth-token/package.json create mode 100644 node_modules/registry-auth-token/registry-url.js create mode 100644 node_modules/registry-auth-token/test/auth-token.test.js create mode 100644 node_modules/registry-auth-token/test/registry-url.test.js create mode 100644 node_modules/registry-auth-token/yarn.lock create mode 100644 node_modules/registry-url/index.js create mode 100644 node_modules/registry-url/license create mode 100644 node_modules/registry-url/package.json create mode 100644 node_modules/registry-url/readme.md create mode 100644 node_modules/remove-trailing-separator/history.md create mode 100644 node_modules/remove-trailing-separator/index.js create mode 100644 node_modules/remove-trailing-separator/license create mode 100644 node_modules/remove-trailing-separator/package.json create mode 100644 node_modules/remove-trailing-separator/readme.md create mode 100644 node_modules/repeat-element/LICENSE create mode 100644 node_modules/repeat-element/README.md create mode 100644 node_modules/repeat-element/index.js create mode 100644 node_modules/repeat-element/package.json create mode 100644 node_modules/repeat-string/LICENSE create mode 100644 node_modules/repeat-string/README.md create mode 100644 node_modules/repeat-string/index.js create mode 100644 node_modules/repeat-string/package.json create mode 100644 node_modules/require_optional/.npmignore create mode 100644 node_modules/require_optional/.travis.yml create mode 100644 node_modules/require_optional/HISTORY.md create mode 100644 node_modules/require_optional/LICENSE create mode 100644 node_modules/require_optional/README.md create mode 100644 node_modules/require_optional/index.js create mode 100644 node_modules/require_optional/package.json create mode 100644 node_modules/require_optional/test/nestedTest/index.js create mode 100644 node_modules/require_optional/test/nestedTest/package.json create mode 100644 node_modules/require_optional/test/require_optional_tests.js create mode 100644 node_modules/resolve-from/index.js create mode 100644 node_modules/resolve-from/license create mode 100644 node_modules/resolve-from/package.json create mode 100644 node_modules/resolve-from/readme.md create mode 100644 node_modules/resolve-url/.jshintrc create mode 100644 node_modules/resolve-url/LICENSE create mode 100644 node_modules/resolve-url/bower.json create mode 100644 node_modules/resolve-url/changelog.md create mode 100644 node_modules/resolve-url/component.json create mode 100644 node_modules/resolve-url/package.json create mode 100644 node_modules/resolve-url/readme.md create mode 100644 node_modules/resolve-url/resolve-url.js create mode 100644 node_modules/resolve-url/test/resolve-url.js create mode 100644 node_modules/resolve/.editorconfig create mode 100644 node_modules/resolve/.eslintignore create mode 100644 node_modules/resolve/.eslintrc create mode 100644 node_modules/resolve/.travis.yml create mode 100644 node_modules/resolve/LICENSE create mode 100644 node_modules/resolve/appveyor.yml create mode 100644 node_modules/resolve/example/async.js create mode 100644 node_modules/resolve/example/sync.js create mode 100644 node_modules/resolve/index.js create mode 100644 node_modules/resolve/lib/async.js create mode 100644 node_modules/resolve/lib/caller.js create mode 100644 node_modules/resolve/lib/core.js create mode 100644 node_modules/resolve/lib/core.json create mode 100644 node_modules/resolve/lib/node-modules-paths.js create mode 100644 node_modules/resolve/lib/sync.js create mode 100644 node_modules/resolve/package.json create mode 100644 node_modules/resolve/readme.markdown create mode 100644 node_modules/resolve/test/core.js create mode 100644 node_modules/resolve/test/dotdot.js create mode 100644 node_modules/resolve/test/dotdot/abc/index.js create mode 100644 node_modules/resolve/test/dotdot/index.js create mode 100644 node_modules/resolve/test/faulty_basedir.js create mode 100644 node_modules/resolve/test/filter.js create mode 100644 node_modules/resolve/test/filter_sync.js create mode 100644 node_modules/resolve/test/mock.js create mode 100644 node_modules/resolve/test/mock_sync.js create mode 100644 node_modules/resolve/test/module_dir.js create mode 100644 node_modules/resolve/test/module_dir/xmodules/aaa/index.js create mode 100644 node_modules/resolve/test/module_dir/ymodules/aaa/index.js create mode 100644 node_modules/resolve/test/module_dir/zmodules/bbb/main.js create mode 100644 node_modules/resolve/test/module_dir/zmodules/bbb/package.json create mode 100644 node_modules/resolve/test/node-modules-paths.js create mode 100644 node_modules/resolve/test/node_path.js create mode 100644 node_modules/resolve/test/node_path/x/aaa/index.js create mode 100644 node_modules/resolve/test/node_path/x/ccc/index.js create mode 100644 node_modules/resolve/test/node_path/y/bbb/index.js create mode 100644 node_modules/resolve/test/node_path/y/ccc/index.js create mode 100644 node_modules/resolve/test/nonstring.js create mode 100644 node_modules/resolve/test/pathfilter.js create mode 100644 node_modules/resolve/test/pathfilter/deep_ref/main.js create mode 100644 node_modules/resolve/test/precedence.js create mode 100644 node_modules/resolve/test/precedence/aaa.js create mode 100644 node_modules/resolve/test/precedence/aaa/index.js create mode 100644 node_modules/resolve/test/precedence/aaa/main.js create mode 100644 node_modules/resolve/test/precedence/bbb.js create mode 100644 node_modules/resolve/test/precedence/bbb/main.js create mode 100644 node_modules/resolve/test/resolver.js create mode 100644 node_modules/resolve/test/resolver/baz/doom.js create mode 100644 node_modules/resolve/test/resolver/baz/package.json create mode 100644 node_modules/resolve/test/resolver/baz/quux.js create mode 100644 node_modules/resolve/test/resolver/cup.coffee create mode 100644 node_modules/resolve/test/resolver/dot_main/index.js create mode 100644 node_modules/resolve/test/resolver/dot_main/package.json create mode 100644 node_modules/resolve/test/resolver/dot_slash_main/index.js create mode 100644 node_modules/resolve/test/resolver/dot_slash_main/package.json create mode 100644 node_modules/resolve/test/resolver/foo.js create mode 100644 node_modules/resolve/test/resolver/incorrect_main/index.js create mode 100644 node_modules/resolve/test/resolver/incorrect_main/package.json create mode 100644 node_modules/resolve/test/resolver/mug.coffee create mode 100644 node_modules/resolve/test/resolver/mug.js create mode 100644 node_modules/resolve/test/resolver/other_path/lib/other-lib.js create mode 100644 node_modules/resolve/test/resolver/other_path/root.js create mode 100644 node_modules/resolve/test/resolver/quux/foo/index.js create mode 100644 node_modules/resolve/test/resolver/same_names/foo.js create mode 100644 node_modules/resolve/test/resolver/same_names/foo/index.js create mode 100644 node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep create mode 100644 node_modules/resolve/test/resolver/without_basedir/main.js create mode 100644 node_modules/resolve/test/resolver_sync.js create mode 100644 node_modules/resolve/test/subdirs.js create mode 100644 node_modules/resolve/test/symlinks.js create mode 100644 node_modules/ret/LICENSE create mode 100644 node_modules/ret/README.md create mode 100644 node_modules/ret/lib/index.js create mode 100644 node_modules/ret/lib/positions.js create mode 100644 node_modules/ret/lib/sets.js create mode 100644 node_modules/ret/lib/types.js create mode 100644 node_modules/ret/lib/util.js create mode 100644 node_modules/ret/package.json create mode 100644 node_modules/right-align/LICENSE create mode 100644 node_modules/right-align/README.md create mode 100644 node_modules/right-align/index.js create mode 100644 node_modules/right-align/package.json create mode 100644 node_modules/safe-buffer/.travis.yml create mode 100644 node_modules/safe-buffer/LICENSE create mode 100644 node_modules/safe-buffer/README.md create mode 100644 node_modules/safe-buffer/index.js create mode 100644 node_modules/safe-buffer/package.json create mode 100644 node_modules/safe-buffer/test.js create mode 100644 node_modules/safe-regex/.travis.yml create mode 100644 node_modules/safe-regex/LICENSE create mode 100644 node_modules/safe-regex/example/safe.js create mode 100644 node_modules/safe-regex/index.js create mode 100644 node_modules/safe-regex/package.json create mode 100644 node_modules/safe-regex/readme.markdown create mode 100644 node_modules/safe-regex/test/regex.js create mode 100644 node_modules/semver-diff/index.js create mode 100644 node_modules/semver-diff/license create mode 100644 node_modules/semver-diff/package.json create mode 100644 node_modules/semver-diff/readme.md create mode 100644 node_modules/semver/LICENSE create mode 100644 node_modules/semver/README.md create mode 100755 node_modules/semver/bin/semver create mode 100644 node_modules/semver/package.json create mode 100644 node_modules/semver/range.bnf create mode 100644 node_modules/semver/semver.js create mode 100644 node_modules/send/HISTORY.md create mode 100644 node_modules/send/LICENSE create mode 100644 node_modules/send/README.md create mode 100644 node_modules/send/index.js create mode 100644 node_modules/send/node_modules/statuses/HISTORY.md create mode 100644 node_modules/send/node_modules/statuses/LICENSE create mode 100644 node_modules/send/node_modules/statuses/README.md create mode 100644 node_modules/send/node_modules/statuses/codes.json create mode 100644 node_modules/send/node_modules/statuses/index.js create mode 100644 node_modules/send/node_modules/statuses/package.json create mode 100644 node_modules/send/package.json create mode 100644 node_modules/serve-favicon/HISTORY.md create mode 100644 node_modules/serve-favicon/LICENSE create mode 100644 node_modules/serve-favicon/README.md create mode 100644 node_modules/serve-favicon/index.js create mode 100644 node_modules/serve-favicon/package.json create mode 100644 node_modules/serve-static/HISTORY.md create mode 100644 node_modules/serve-static/LICENSE create mode 100644 node_modules/serve-static/README.md create mode 100644 node_modules/serve-static/index.js create mode 100644 node_modules/serve-static/package.json create mode 100644 node_modules/set-immediate-shim/index.js create mode 100644 node_modules/set-immediate-shim/package.json create mode 100644 node_modules/set-immediate-shim/readme.md create mode 100644 node_modules/set-value/LICENSE create mode 100644 node_modules/set-value/README.md create mode 100644 node_modules/set-value/index.js create mode 100644 node_modules/set-value/node_modules/extend-shallow/LICENSE create mode 100644 node_modules/set-value/node_modules/extend-shallow/README.md create mode 100644 node_modules/set-value/node_modules/extend-shallow/index.js create mode 100644 node_modules/set-value/node_modules/extend-shallow/package.json create mode 100644 node_modules/set-value/package.json create mode 100644 node_modules/setprototypeof/LICENSE create mode 100644 node_modules/setprototypeof/README.md create mode 100644 node_modules/setprototypeof/index.js create mode 100644 node_modules/setprototypeof/package.json create mode 100644 node_modules/shebang-command/index.js create mode 100644 node_modules/shebang-command/license create mode 100644 node_modules/shebang-command/package.json create mode 100644 node_modules/shebang-command/readme.md create mode 100644 node_modules/shebang-regex/index.js create mode 100644 node_modules/shebang-regex/license create mode 100644 node_modules/shebang-regex/package.json create mode 100644 node_modules/shebang-regex/readme.md create mode 100644 node_modules/signal-exit/CHANGELOG.md create mode 100644 node_modules/signal-exit/LICENSE.txt create mode 100644 node_modules/signal-exit/README.md create mode 100644 node_modules/signal-exit/index.js create mode 100644 node_modules/signal-exit/package.json create mode 100644 node_modules/signal-exit/signals.js create mode 100644 node_modules/sliced/History.md create mode 100644 node_modules/sliced/LICENSE create mode 100644 node_modules/sliced/README.md create mode 100644 node_modules/sliced/index.js create mode 100644 node_modules/sliced/package.json create mode 100644 node_modules/snapdragon-node/LICENSE create mode 100644 node_modules/snapdragon-node/README.md create mode 100644 node_modules/snapdragon-node/index.js create mode 100644 node_modules/snapdragon-node/node_modules/define-property/LICENSE create mode 100644 node_modules/snapdragon-node/node_modules/define-property/README.md create mode 100644 node_modules/snapdragon-node/node_modules/define-property/index.js create mode 100644 node_modules/snapdragon-node/node_modules/define-property/package.json create mode 100644 node_modules/snapdragon-node/package.json create mode 100644 node_modules/snapdragon-util/LICENSE create mode 100644 node_modules/snapdragon-util/README.md create mode 100644 node_modules/snapdragon-util/index.js create mode 100644 node_modules/snapdragon-util/package.json create mode 100644 node_modules/snapdragon/LICENSE create mode 100644 node_modules/snapdragon/README.md create mode 100644 node_modules/snapdragon/index.js create mode 100644 node_modules/snapdragon/lib/compiler.js create mode 100644 node_modules/snapdragon/lib/parser.js create mode 100644 node_modules/snapdragon/lib/position.js create mode 100644 node_modules/snapdragon/lib/source-maps.js create mode 100644 node_modules/snapdragon/lib/utils.js create mode 100644 node_modules/snapdragon/node_modules/define-property/LICENSE create mode 100644 node_modules/snapdragon/node_modules/define-property/README.md create mode 100644 node_modules/snapdragon/node_modules/define-property/index.js create mode 100644 node_modules/snapdragon/node_modules/define-property/package.json create mode 100644 node_modules/snapdragon/node_modules/extend-shallow/LICENSE create mode 100644 node_modules/snapdragon/node_modules/extend-shallow/README.md create mode 100644 node_modules/snapdragon/node_modules/extend-shallow/index.js create mode 100644 node_modules/snapdragon/node_modules/extend-shallow/package.json create mode 100644 node_modules/snapdragon/node_modules/is-accessor-descriptor/LICENSE create mode 100644 node_modules/snapdragon/node_modules/is-accessor-descriptor/README.md create mode 100644 node_modules/snapdragon/node_modules/is-accessor-descriptor/index.js create mode 100644 node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/LICENSE create mode 100644 node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/README.md create mode 100644 node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js create mode 100644 node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/package.json create mode 100644 node_modules/snapdragon/node_modules/is-accessor-descriptor/package.json create mode 100644 node_modules/snapdragon/node_modules/is-data-descriptor/LICENSE create mode 100644 node_modules/snapdragon/node_modules/is-data-descriptor/README.md create mode 100644 node_modules/snapdragon/node_modules/is-data-descriptor/index.js create mode 100644 node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/LICENSE create mode 100644 node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/README.md create mode 100644 node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/index.js create mode 100644 node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/package.json create mode 100644 node_modules/snapdragon/node_modules/is-data-descriptor/package.json create mode 100644 node_modules/snapdragon/node_modules/is-descriptor/LICENSE create mode 100644 node_modules/snapdragon/node_modules/is-descriptor/README.md create mode 100644 node_modules/snapdragon/node_modules/is-descriptor/index.js create mode 100644 node_modules/snapdragon/node_modules/is-descriptor/package.json create mode 100644 node_modules/snapdragon/node_modules/kind-of/LICENSE create mode 100644 node_modules/snapdragon/node_modules/kind-of/README.md create mode 100644 node_modules/snapdragon/node_modules/kind-of/index.js create mode 100644 node_modules/snapdragon/node_modules/kind-of/package.json create mode 100644 node_modules/snapdragon/node_modules/source-map/CHANGELOG.md create mode 100644 node_modules/snapdragon/node_modules/source-map/LICENSE create mode 100644 node_modules/snapdragon/node_modules/source-map/README.md create mode 100644 node_modules/snapdragon/node_modules/source-map/dist/source-map.debug.js create mode 100644 node_modules/snapdragon/node_modules/source-map/dist/source-map.js create mode 100644 node_modules/snapdragon/node_modules/source-map/dist/source-map.min.js create mode 100644 node_modules/snapdragon/node_modules/source-map/dist/source-map.min.js.map create mode 100644 node_modules/snapdragon/node_modules/source-map/lib/array-set.js create mode 100644 node_modules/snapdragon/node_modules/source-map/lib/base64-vlq.js create mode 100644 node_modules/snapdragon/node_modules/source-map/lib/base64.js create mode 100644 node_modules/snapdragon/node_modules/source-map/lib/binary-search.js create mode 100644 node_modules/snapdragon/node_modules/source-map/lib/mapping-list.js create mode 100644 node_modules/snapdragon/node_modules/source-map/lib/quick-sort.js create mode 100644 node_modules/snapdragon/node_modules/source-map/lib/source-map-consumer.js create mode 100644 node_modules/snapdragon/node_modules/source-map/lib/source-map-generator.js create mode 100644 node_modules/snapdragon/node_modules/source-map/lib/source-node.js create mode 100644 node_modules/snapdragon/node_modules/source-map/lib/util.js create mode 100644 node_modules/snapdragon/node_modules/source-map/package.json create mode 100644 node_modules/snapdragon/node_modules/source-map/source-map.js create mode 100644 node_modules/snapdragon/package.json create mode 100644 node_modules/source-map-resolve/.jshintrc create mode 100644 node_modules/source-map-resolve/.travis.yml create mode 100644 node_modules/source-map-resolve/LICENSE create mode 100644 node_modules/source-map-resolve/bower.json create mode 100644 node_modules/source-map-resolve/changelog.md create mode 100644 node_modules/source-map-resolve/component.json create mode 100644 node_modules/source-map-resolve/generate-source-map-resolve.js create mode 100644 node_modules/source-map-resolve/lib/decode-uri-component.js create mode 100644 node_modules/source-map-resolve/lib/resolve-url.js create mode 100644 node_modules/source-map-resolve/lib/source-map-resolve-node.js create mode 100644 node_modules/source-map-resolve/package.json create mode 100644 node_modules/source-map-resolve/readme.md create mode 100644 node_modules/source-map-resolve/source-map-resolve.js create mode 100644 node_modules/source-map-resolve/source-map-resolve.js.template create mode 100644 node_modules/source-map-resolve/x-package.json5 create mode 100644 node_modules/source-map-url/.jshintrc create mode 100644 node_modules/source-map-url/LICENSE create mode 100644 node_modules/source-map-url/bower.json create mode 100644 node_modules/source-map-url/changelog.md create mode 100644 node_modules/source-map-url/component.json create mode 100644 node_modules/source-map-url/package.json create mode 100644 node_modules/source-map-url/readme.md create mode 100644 node_modules/source-map-url/source-map-url.js create mode 100644 node_modules/source-map-url/test/source-map-url.js create mode 100644 node_modules/source-map-url/x-package.json5 create mode 100644 node_modules/source-map/README.md create mode 100644 node_modules/source-map/build/assert-shim.js create mode 100644 node_modules/source-map/build/mini-require.js create mode 100644 node_modules/source-map/build/prefix-source-map.jsm create mode 100644 node_modules/source-map/build/prefix-utils.jsm create mode 100644 node_modules/source-map/build/suffix-browser.js create mode 100644 node_modules/source-map/build/suffix-source-map.jsm create mode 100644 node_modules/source-map/build/suffix-utils.jsm create mode 100644 node_modules/source-map/build/test-prefix.js create mode 100644 node_modules/source-map/build/test-suffix.js create mode 100644 node_modules/source-map/lib/source-map.js create mode 100644 node_modules/source-map/lib/source-map/array-set.js create mode 100644 node_modules/source-map/lib/source-map/base64-vlq.js create mode 100644 node_modules/source-map/lib/source-map/base64.js create mode 100644 node_modules/source-map/lib/source-map/binary-search.js create mode 100644 node_modules/source-map/lib/source-map/mapping-list.js create mode 100644 node_modules/source-map/lib/source-map/quick-sort.js create mode 100644 node_modules/source-map/lib/source-map/source-map-consumer.js create mode 100644 node_modules/source-map/lib/source-map/source-map-generator.js create mode 100644 node_modules/source-map/lib/source-map/source-node.js create mode 100644 node_modules/source-map/lib/source-map/util.js create mode 100644 node_modules/source-map/package.json create mode 100644 node_modules/split-string/LICENSE create mode 100644 node_modules/split-string/README.md create mode 100644 node_modules/split-string/index.js create mode 100644 node_modules/split-string/package.json create mode 100644 node_modules/split/.npmignore create mode 100644 node_modules/split/.travis.yml create mode 100644 node_modules/split/LICENCE create mode 100644 node_modules/split/examples/pretty.js create mode 100644 node_modules/split/index.js create mode 100644 node_modules/split/package.json create mode 100644 node_modules/split/readme.markdown create mode 100644 node_modules/split/test/options.asynct.js create mode 100644 node_modules/split/test/partitioned_unicode.js create mode 100644 node_modules/split/test/split.asynct.js create mode 100644 node_modules/split/test/try_catch.asynct.js create mode 100644 node_modules/static-extend/LICENSE create mode 100644 node_modules/static-extend/index.js create mode 100644 node_modules/static-extend/node_modules/define-property/LICENSE create mode 100644 node_modules/static-extend/node_modules/define-property/README.md create mode 100644 node_modules/static-extend/node_modules/define-property/index.js create mode 100644 node_modules/static-extend/node_modules/define-property/package.json create mode 100644 node_modules/static-extend/node_modules/is-accessor-descriptor/LICENSE create mode 100644 node_modules/static-extend/node_modules/is-accessor-descriptor/README.md create mode 100644 node_modules/static-extend/node_modules/is-accessor-descriptor/index.js create mode 100644 node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/LICENSE create mode 100644 node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/README.md create mode 100644 node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js create mode 100644 node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/package.json create mode 100644 node_modules/static-extend/node_modules/is-accessor-descriptor/package.json create mode 100644 node_modules/static-extend/node_modules/is-data-descriptor/LICENSE create mode 100644 node_modules/static-extend/node_modules/is-data-descriptor/README.md create mode 100644 node_modules/static-extend/node_modules/is-data-descriptor/index.js create mode 100644 node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/LICENSE create mode 100644 node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/README.md create mode 100644 node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/index.js create mode 100644 node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/package.json create mode 100644 node_modules/static-extend/node_modules/is-data-descriptor/package.json create mode 100644 node_modules/static-extend/node_modules/is-descriptor/LICENSE create mode 100644 node_modules/static-extend/node_modules/is-descriptor/README.md create mode 100644 node_modules/static-extend/node_modules/is-descriptor/index.js create mode 100644 node_modules/static-extend/node_modules/is-descriptor/package.json create mode 100644 node_modules/static-extend/node_modules/kind-of/LICENSE create mode 100644 node_modules/static-extend/node_modules/kind-of/README.md create mode 100644 node_modules/static-extend/node_modules/kind-of/index.js create mode 100644 node_modules/static-extend/node_modules/kind-of/package.json create mode 100644 node_modules/static-extend/package.json create mode 100644 node_modules/statuses/HISTORY.md create mode 100644 node_modules/statuses/LICENSE create mode 100644 node_modules/statuses/README.md create mode 100644 node_modules/statuses/codes.json create mode 100644 node_modules/statuses/index.js create mode 100644 node_modules/statuses/package.json create mode 100644 node_modules/stream-combiner/.npmignore create mode 100644 node_modules/stream-combiner/.travis.yml create mode 100644 node_modules/stream-combiner/LICENSE create mode 100644 node_modules/stream-combiner/README.md create mode 100644 node_modules/stream-combiner/index.js create mode 100644 node_modules/stream-combiner/package.json create mode 100644 node_modules/stream-combiner/test/index.js create mode 100644 node_modules/string-width/index.js create mode 100644 node_modules/string-width/license create mode 100644 node_modules/string-width/package.json create mode 100644 node_modules/string-width/readme.md create mode 100644 node_modules/string_decoder/.npmignore create mode 100644 node_modules/string_decoder/LICENSE create mode 100644 node_modules/string_decoder/README.md create mode 100644 node_modules/string_decoder/lib/string_decoder.js create mode 100644 node_modules/string_decoder/package.json create mode 100644 node_modules/strip-ansi/index.js create mode 100644 node_modules/strip-ansi/license create mode 100644 node_modules/strip-ansi/package.json create mode 100644 node_modules/strip-ansi/readme.md create mode 100644 node_modules/strip-eof/index.js create mode 100644 node_modules/strip-eof/license create mode 100644 node_modules/strip-eof/package.json create mode 100644 node_modules/strip-eof/readme.md create mode 100644 node_modules/strip-json-comments/index.js create mode 100644 node_modules/strip-json-comments/license create mode 100644 node_modules/strip-json-comments/package.json create mode 100644 node_modules/strip-json-comments/readme.md create mode 100644 node_modules/supports-color/browser.js create mode 100644 node_modules/supports-color/index.js create mode 100644 node_modules/supports-color/license create mode 100644 node_modules/supports-color/package.json create mode 100644 node_modules/supports-color/readme.md create mode 100644 node_modules/term-size/index.js create mode 100644 node_modules/term-size/license create mode 100644 node_modules/term-size/package.json create mode 100644 node_modules/term-size/readme.md create mode 100755 node_modules/term-size/vendor/macos/term-size create mode 100644 node_modules/term-size/vendor/windows/term-size.exe create mode 100644 node_modules/through/.travis.yml create mode 100644 node_modules/through/LICENSE.APACHE2 create mode 100644 node_modules/through/LICENSE.MIT create mode 100644 node_modules/through/index.js create mode 100644 node_modules/through/package.json create mode 100644 node_modules/through/readme.markdown create mode 100644 node_modules/through/test/async.js create mode 100644 node_modules/through/test/auto-destroy.js create mode 100644 node_modules/through/test/buffering.js create mode 100644 node_modules/through/test/end.js create mode 100644 node_modules/through/test/index.js create mode 100644 node_modules/timed-out/index.js create mode 100644 node_modules/timed-out/license create mode 100644 node_modules/timed-out/package.json create mode 100644 node_modules/timed-out/readme.md create mode 100644 node_modules/to-fast-properties/index.js create mode 100644 node_modules/to-fast-properties/license create mode 100644 node_modules/to-fast-properties/package.json create mode 100644 node_modules/to-fast-properties/readme.md create mode 100644 node_modules/to-object-path/LICENSE create mode 100644 node_modules/to-object-path/README.md create mode 100644 node_modules/to-object-path/index.js create mode 100644 node_modules/to-object-path/package.json create mode 100644 node_modules/to-regex-range/LICENSE create mode 100644 node_modules/to-regex-range/README.md create mode 100644 node_modules/to-regex-range/index.js create mode 100644 node_modules/to-regex-range/package.json create mode 100644 node_modules/to-regex/LICENSE create mode 100644 node_modules/to-regex/README.md create mode 100644 node_modules/to-regex/index.js create mode 100644 node_modules/to-regex/package.json create mode 100644 node_modules/token-stream/.npmignore create mode 100644 node_modules/token-stream/.travis.yml create mode 100644 node_modules/token-stream/LICENSE create mode 100644 node_modules/token-stream/README.md create mode 100644 node_modules/token-stream/index.js create mode 100644 node_modules/token-stream/package.json create mode 100644 node_modules/token-stream/test/index.js create mode 100644 node_modules/touch/LICENSE create mode 100644 node_modules/touch/README.md create mode 100755 node_modules/touch/bin/nodetouch.js create mode 100644 node_modules/touch/index.js create mode 100644 node_modules/touch/package.json create mode 100644 node_modules/type-is/HISTORY.md create mode 100644 node_modules/type-is/LICENSE create mode 100644 node_modules/type-is/README.md create mode 100644 node_modules/type-is/index.js create mode 100644 node_modules/type-is/package.json create mode 100644 node_modules/uglify-js/LICENSE create mode 100644 node_modules/uglify-js/README.md create mode 100644 node_modules/uglify-js/bin/extract-props.js create mode 100755 node_modules/uglify-js/bin/uglifyjs create mode 100644 node_modules/uglify-js/lib/ast.js create mode 100644 node_modules/uglify-js/lib/compress.js create mode 100644 node_modules/uglify-js/lib/mozilla-ast.js create mode 100644 node_modules/uglify-js/lib/output.js create mode 100644 node_modules/uglify-js/lib/parse.js create mode 100644 node_modules/uglify-js/lib/propmangle.js create mode 100644 node_modules/uglify-js/lib/scope.js create mode 100644 node_modules/uglify-js/lib/sourcemap.js create mode 100644 node_modules/uglify-js/lib/transform.js create mode 100644 node_modules/uglify-js/lib/utils.js create mode 100644 node_modules/uglify-js/node_modules/source-map/CHANGELOG.md create mode 100644 node_modules/uglify-js/node_modules/source-map/LICENSE create mode 100644 node_modules/uglify-js/node_modules/source-map/README.md create mode 100644 node_modules/uglify-js/node_modules/source-map/dist/source-map.debug.js create mode 100644 node_modules/uglify-js/node_modules/source-map/dist/source-map.js create mode 100644 node_modules/uglify-js/node_modules/source-map/dist/source-map.min.js create mode 100644 node_modules/uglify-js/node_modules/source-map/dist/source-map.min.js.map create mode 100644 node_modules/uglify-js/node_modules/source-map/lib/array-set.js create mode 100644 node_modules/uglify-js/node_modules/source-map/lib/base64-vlq.js create mode 100644 node_modules/uglify-js/node_modules/source-map/lib/base64.js create mode 100644 node_modules/uglify-js/node_modules/source-map/lib/binary-search.js create mode 100644 node_modules/uglify-js/node_modules/source-map/lib/mapping-list.js create mode 100644 node_modules/uglify-js/node_modules/source-map/lib/quick-sort.js create mode 100644 node_modules/uglify-js/node_modules/source-map/lib/source-map-consumer.js create mode 100644 node_modules/uglify-js/node_modules/source-map/lib/source-map-generator.js create mode 100644 node_modules/uglify-js/node_modules/source-map/lib/source-node.js create mode 100644 node_modules/uglify-js/node_modules/source-map/lib/util.js create mode 100644 node_modules/uglify-js/node_modules/source-map/package.json create mode 100644 node_modules/uglify-js/node_modules/source-map/source-map.js create mode 100644 node_modules/uglify-js/package.json create mode 100644 node_modules/uglify-js/tools/domprops.json create mode 100644 node_modules/uglify-js/tools/exports.js create mode 100644 node_modules/uglify-js/tools/node.js create mode 100644 node_modules/uglify-js/tools/props.html create mode 100644 node_modules/uglify-to-browserify/.npmignore create mode 100644 node_modules/uglify-to-browserify/.travis.yml create mode 100644 node_modules/uglify-to-browserify/LICENSE create mode 100644 node_modules/uglify-to-browserify/README.md create mode 100644 node_modules/uglify-to-browserify/index.js create mode 100644 node_modules/uglify-to-browserify/package.json create mode 100644 node_modules/uglify-to-browserify/test/index.js create mode 100644 node_modules/undefsafe/.jscsrc create mode 100644 node_modules/undefsafe/.jshintrc create mode 100644 node_modules/undefsafe/.npmignore create mode 100644 node_modules/undefsafe/.travis.yml create mode 100644 node_modules/undefsafe/LICENSE create mode 100644 node_modules/undefsafe/README.md create mode 100644 node_modules/undefsafe/example.js create mode 100644 node_modules/undefsafe/lib/undefsafe.js create mode 100644 node_modules/undefsafe/package.json create mode 100644 node_modules/union-value/LICENSE create mode 100644 node_modules/union-value/README.md create mode 100644 node_modules/union-value/index.js create mode 100644 node_modules/union-value/node_modules/extend-shallow/LICENSE create mode 100644 node_modules/union-value/node_modules/extend-shallow/README.md create mode 100644 node_modules/union-value/node_modules/extend-shallow/index.js create mode 100644 node_modules/union-value/node_modules/extend-shallow/package.json create mode 100644 node_modules/union-value/node_modules/set-value/LICENSE create mode 100644 node_modules/union-value/node_modules/set-value/README.md create mode 100644 node_modules/union-value/node_modules/set-value/index.js create mode 100644 node_modules/union-value/node_modules/set-value/package.json create mode 100644 node_modules/union-value/package.json create mode 100644 node_modules/unique-string/index.js create mode 100644 node_modules/unique-string/license create mode 100644 node_modules/unique-string/package.json create mode 100644 node_modules/unique-string/readme.md create mode 100644 node_modules/unpipe/HISTORY.md create mode 100644 node_modules/unpipe/LICENSE create mode 100644 node_modules/unpipe/README.md create mode 100644 node_modules/unpipe/index.js create mode 100644 node_modules/unpipe/package.json create mode 100644 node_modules/unset-value/LICENSE create mode 100644 node_modules/unset-value/README.md create mode 100644 node_modules/unset-value/index.js create mode 100644 node_modules/unset-value/node_modules/has-value/LICENSE create mode 100644 node_modules/unset-value/node_modules/has-value/README.md create mode 100644 node_modules/unset-value/node_modules/has-value/index.js create mode 100644 node_modules/unset-value/node_modules/has-value/node_modules/isobject/LICENSE create mode 100644 node_modules/unset-value/node_modules/has-value/node_modules/isobject/README.md create mode 100644 node_modules/unset-value/node_modules/has-value/node_modules/isobject/index.js create mode 100644 node_modules/unset-value/node_modules/has-value/node_modules/isobject/package.json create mode 100644 node_modules/unset-value/node_modules/has-value/package.json create mode 100644 node_modules/unset-value/node_modules/has-values/LICENSE create mode 100644 node_modules/unset-value/node_modules/has-values/README.md create mode 100644 node_modules/unset-value/node_modules/has-values/index.js create mode 100644 node_modules/unset-value/node_modules/has-values/package.json create mode 100644 node_modules/unset-value/package.json create mode 100644 node_modules/unzip-response/index.js create mode 100644 node_modules/unzip-response/license create mode 100644 node_modules/unzip-response/package.json create mode 100644 node_modules/unzip-response/readme.md create mode 100755 node_modules/upath/LICENSE create mode 100644 node_modules/upath/build/code/upath.js create mode 100644 node_modules/upath/package.json create mode 100644 node_modules/upath/readme.md create mode 100644 node_modules/upath/upath.d.ts create mode 100644 node_modules/update-notifier/check.js create mode 100644 node_modules/update-notifier/index.js create mode 100644 node_modules/update-notifier/package.json create mode 100644 node_modules/update-notifier/readme.md create mode 100644 node_modules/urix/.jshintrc create mode 100644 node_modules/urix/LICENSE create mode 100644 node_modules/urix/index.js create mode 100644 node_modules/urix/package.json create mode 100644 node_modules/urix/readme.md create mode 100644 node_modules/urix/test/index.js create mode 100644 node_modules/url-parse-lax/index.js create mode 100644 node_modules/url-parse-lax/license create mode 100644 node_modules/url-parse-lax/package.json create mode 100644 node_modules/url-parse-lax/readme.md create mode 100644 node_modules/use/LICENSE create mode 100644 node_modules/use/README.md create mode 100644 node_modules/use/index.js create mode 100644 node_modules/use/node_modules/kind-of/CHANGELOG.md create mode 100644 node_modules/use/node_modules/kind-of/LICENSE create mode 100644 node_modules/use/node_modules/kind-of/README.md create mode 100644 node_modules/use/node_modules/kind-of/index.js create mode 100644 node_modules/use/node_modules/kind-of/package.json create mode 100644 node_modules/use/package.json create mode 100644 node_modules/util-deprecate/History.md create mode 100644 node_modules/util-deprecate/LICENSE create mode 100644 node_modules/util-deprecate/README.md create mode 100644 node_modules/util-deprecate/browser.js create mode 100644 node_modules/util-deprecate/node.js create mode 100644 node_modules/util-deprecate/package.json create mode 100644 node_modules/utils-merge/.travis.yml create mode 100644 node_modules/utils-merge/LICENSE create mode 100644 node_modules/utils-merge/README.md create mode 100644 node_modules/utils-merge/index.js create mode 100644 node_modules/utils-merge/package.json create mode 100644 node_modules/vary/HISTORY.md create mode 100644 node_modules/vary/LICENSE create mode 100644 node_modules/vary/README.md create mode 100644 node_modules/vary/index.js create mode 100644 node_modules/vary/package.json create mode 100644 node_modules/void-elements/.gitattributes create mode 100644 node_modules/void-elements/.npmignore create mode 100644 node_modules/void-elements/.travis.yml create mode 100644 node_modules/void-elements/LICENSE create mode 100644 node_modules/void-elements/README.md create mode 100644 node_modules/void-elements/index.js create mode 100644 node_modules/void-elements/package.json create mode 100644 node_modules/void-elements/pre-publish.js create mode 100644 node_modules/void-elements/test/index.js create mode 100644 node_modules/which/CHANGELOG.md create mode 100644 node_modules/which/LICENSE create mode 100644 node_modules/which/README.md create mode 100755 node_modules/which/bin/which create mode 100644 node_modules/which/package.json create mode 100644 node_modules/which/which.js create mode 100644 node_modules/widest-line/index.js create mode 100644 node_modules/widest-line/license create mode 100644 node_modules/widest-line/package.json create mode 100644 node_modules/widest-line/readme.md create mode 100644 node_modules/window-size/LICENSE-MIT create mode 100644 node_modules/window-size/README.md create mode 100644 node_modules/window-size/index.js create mode 100644 node_modules/window-size/package.json create mode 100644 node_modules/with/.npmignore create mode 100644 node_modules/with/LICENSE create mode 100644 node_modules/with/README.md create mode 100644 node_modules/with/index.js create mode 100644 node_modules/with/package.json create mode 100644 node_modules/wordwrap/.npmignore create mode 100644 node_modules/wordwrap/README.markdown create mode 100644 node_modules/wordwrap/example/center.js create mode 100644 node_modules/wordwrap/example/meat.js create mode 100644 node_modules/wordwrap/index.js create mode 100644 node_modules/wordwrap/package.json create mode 100644 node_modules/wordwrap/test/break.js create mode 100644 node_modules/wordwrap/test/idleness.txt create mode 100644 node_modules/wordwrap/test/wrap.js create mode 100644 node_modules/write-file-atomic/LICENSE create mode 100644 node_modules/write-file-atomic/README.md create mode 100644 node_modules/write-file-atomic/index.js create mode 100644 node_modules/write-file-atomic/package.json create mode 100644 node_modules/xdg-basedir/index.js create mode 100644 node_modules/xdg-basedir/license create mode 100644 node_modules/xdg-basedir/package.json create mode 100644 node_modules/xdg-basedir/readme.md create mode 100644 node_modules/yallist/LICENSE create mode 100644 node_modules/yallist/README.md create mode 100644 node_modules/yallist/iterator.js create mode 100644 node_modules/yallist/package.json create mode 100644 node_modules/yallist/yallist.js create mode 100644 node_modules/yargs/CHANGELOG.md create mode 100644 node_modules/yargs/LICENSE create mode 100644 node_modules/yargs/README.md create mode 100644 node_modules/yargs/completion.sh.hbs create mode 100644 node_modules/yargs/index.js create mode 100644 node_modules/yargs/lib/completion.js create mode 100644 node_modules/yargs/lib/parser.js create mode 100644 node_modules/yargs/lib/usage.js create mode 100644 node_modules/yargs/lib/validation.js create mode 100644 node_modules/yargs/package.json create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 public/stylesheets/style.css create mode 100644 routes/index.js create mode 100644 routes/users.js create mode 100644 views/error.pug create mode 100644 views/index.pug create mode 100644 views/layout.pug diff --git a/TODO.txt b/TODO.txt new file mode 100644 index 0000000..9ac199e --- /dev/null +++ b/TODO.txt @@ -0,0 +1,2 @@ +TODO LIST: +- remove mongoose in package.json after switching to postgres \ No newline at end of file diff --git a/app.js b/app.js new file mode 100644 index 0000000..ce4e963 --- /dev/null +++ b/app.js @@ -0,0 +1,56 @@ +var express = require('express'); +var path = require('path'); +var favicon = require('serve-favicon'); +var logger = require('morgan'); +var cookieParser = require('cookie-parser'); +var bodyParser = require('body-parser'); + +var index = require('./routes/index'); +var users = require('./routes/users'); + +var app = express(); + +// Set up mongoose connection +// TODO: REPLACE WITH POSTGRES CONNECTION +var mongoose = require('mongoose'); +var mongoDB = 'mongodb://cooluser:coolpassword@ds012538.mlab.com:12538/friendb'; +mongoose.connect(mongoDB); +mongoose.Promise = global.Promise; +var db = mongoose.connection; +db.on('error', console.error.bind(console, 'MongoDB connection error:')); +// this creates the default connection to the database and binds to the error event (so the errors will print to th econsole) + +// view engine setup +app.set('views', path.join(__dirname, 'views')); +app.set('view engine', 'pug'); + +// uncomment after placing your favicon in /public +//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); +app.use(logger('dev')); +app.use(bodyParser.json()); +app.use(bodyParser.urlencoded({ extended: false })); +app.use(cookieParser()); +app.use(express.static(path.join(__dirname, 'public'))); + +app.use('/', index); +app.use('/users', users); + +// catch 404 and forward to error handler +app.use(function(req, res, next) { + var err = new Error('Not Found'); + err.status = 404; + next(err); +}); + +// error handler +app.use(function(err, req, res, next) { + // set locals, only providing error in development + res.locals.message = err.message; + res.locals.error = req.app.get('env') === 'development' ? err : {}; + + // render the error page + res.status(err.status || 500); + res.render('error'); +}); + +module.exports = app; diff --git a/bin/www b/bin/www new file mode 100755 index 0000000..fda5377 --- /dev/null +++ b/bin/www @@ -0,0 +1,90 @@ +#!/usr/bin/env node + +/** + * Module dependencies. + */ + +var app = require('../app'); +var debug = require('debug')('friendb:server'); +var http = require('http'); + +/** + * Get port from environment and store in Express. + */ + +var port = normalizePort(process.env.PORT || '3000'); +app.set('port', port); + +/** + * Create HTTP server. + */ + +var server = http.createServer(app); + +/** + * Listen on provided port, on all network interfaces. + */ + +server.listen(port); +server.on('error', onError); +server.on('listening', onListening); + +/** + * Normalize a port into a number, string, or false. + */ + +function normalizePort(val) { + var port = parseInt(val, 10); + + if (isNaN(port)) { + // named pipe + return val; + } + + if (port >= 0) { + // port number + return port; + } + + return false; +} + +/** + * Event listener for HTTP server "error" event. + */ + +function onError(error) { + if (error.syscall !== 'listen') { + throw error; + } + + var bind = typeof port === 'string' + ? 'Pipe ' + port + : 'Port ' + port; + + // handle specific listen errors with friendly messages + switch (error.code) { + case 'EACCES': + console.error(bind + ' requires elevated privileges'); + process.exit(1); + break; + case 'EADDRINUSE': + console.error(bind + ' is already in use'); + process.exit(1); + break; + default: + throw error; + } +} + +/** + * Event listener for HTTP server "listening" event. + */ + +function onListening() { + var addr = server.address(); + var bind = typeof addr === 'string' + ? 'pipe ' + addr + : 'port ' + addr.port; + debug('Listening on ' + bind); +} diff --git a/node_modules/.bin/acorn b/node_modules/.bin/acorn new file mode 120000 index 0000000..cf76760 --- /dev/null +++ b/node_modules/.bin/acorn @@ -0,0 +1 @@ +../acorn/bin/acorn \ No newline at end of file diff --git a/node_modules/.bin/atob b/node_modules/.bin/atob new file mode 120000 index 0000000..a68344a --- /dev/null +++ b/node_modules/.bin/atob @@ -0,0 +1 @@ +../atob/bin/atob.js \ No newline at end of file diff --git a/node_modules/.bin/babylon b/node_modules/.bin/babylon new file mode 120000 index 0000000..c2adc01 --- /dev/null +++ b/node_modules/.bin/babylon @@ -0,0 +1 @@ +../babylon/bin/babylon.js \ No newline at end of file diff --git a/node_modules/.bin/cleancss b/node_modules/.bin/cleancss new file mode 120000 index 0000000..2a3439e --- /dev/null +++ b/node_modules/.bin/cleancss @@ -0,0 +1 @@ +../clean-css/bin/cleancss \ No newline at end of file diff --git a/node_modules/.bin/mime b/node_modules/.bin/mime new file mode 120000 index 0000000..fbb7ee0 --- /dev/null +++ b/node_modules/.bin/mime @@ -0,0 +1 @@ +../mime/cli.js \ No newline at end of file diff --git a/node_modules/.bin/nodemon b/node_modules/.bin/nodemon new file mode 120000 index 0000000..1056ddc --- /dev/null +++ b/node_modules/.bin/nodemon @@ -0,0 +1 @@ +../nodemon/bin/nodemon.js \ No newline at end of file diff --git a/node_modules/.bin/nodetouch b/node_modules/.bin/nodetouch new file mode 120000 index 0000000..3409fdb --- /dev/null +++ b/node_modules/.bin/nodetouch @@ -0,0 +1 @@ +../touch/bin/nodetouch.js \ No newline at end of file diff --git a/node_modules/.bin/nopt b/node_modules/.bin/nopt new file mode 120000 index 0000000..6b6566e --- /dev/null +++ b/node_modules/.bin/nopt @@ -0,0 +1 @@ +../nopt/bin/nopt.js \ No newline at end of file diff --git a/node_modules/.bin/rc b/node_modules/.bin/rc new file mode 120000 index 0000000..48b3cda --- /dev/null +++ b/node_modules/.bin/rc @@ -0,0 +1 @@ +../rc/cli.js \ No newline at end of file diff --git a/node_modules/.bin/semver b/node_modules/.bin/semver new file mode 120000 index 0000000..317eb29 --- /dev/null +++ b/node_modules/.bin/semver @@ -0,0 +1 @@ +../semver/bin/semver \ No newline at end of file diff --git a/node_modules/.bin/uglifyjs b/node_modules/.bin/uglifyjs new file mode 120000 index 0000000..fef3468 --- /dev/null +++ b/node_modules/.bin/uglifyjs @@ -0,0 +1 @@ +../uglify-js/bin/uglifyjs \ No newline at end of file diff --git a/node_modules/.bin/which b/node_modules/.bin/which new file mode 120000 index 0000000..f62471c --- /dev/null +++ b/node_modules/.bin/which @@ -0,0 +1 @@ +../which/bin/which \ No newline at end of file diff --git a/node_modules/@types/babel-types/LICENSE b/node_modules/@types/babel-types/LICENSE new file mode 100644 index 0000000..2107107 --- /dev/null +++ b/node_modules/@types/babel-types/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/babel-types/README.md b/node_modules/@types/babel-types/README.md new file mode 100644 index 0000000..1aea8bc --- /dev/null +++ b/node_modules/@types/babel-types/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/babel-types` + +# Summary +This package contains type definitions for babel-types (https://github.com/babel/babel/tree/master/packages/babel-types). + +# Details +Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel-types + +Additional Details + * Last updated: Mon, 26 Feb 2018 19:08:08 GMT + * Dependencies: none + * Global values: none + +# Credits +These definitions were written by Troy Gerwien , Sam Baxter , Marvin Hagemeister , Boris Cherny . diff --git a/node_modules/@types/babel-types/index.d.ts b/node_modules/@types/babel-types/index.d.ts new file mode 100644 index 0000000..b1de338 --- /dev/null +++ b/node_modules/@types/babel-types/index.d.ts @@ -0,0 +1,1992 @@ +// Type definitions for babel-types 7.0 +// Project: https://github.com/babel/babel/tree/master/packages/babel-types +// Definitions by: Troy Gerwien +// Sam Baxter +// Marvin Hagemeister +// Boris Cherny +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +export interface Comment { + value: string; + start: number; + end: number; + loc: SourceLocation; +} + +export interface CommentBlock extends Comment { + type: "CommentBlock"; +} + +export interface CommentLine extends Comment { + type: "CommentLine"; +} + +export interface SourceLocation { + start: { + line: number; + column: number; + }; + + end: { + line: number; + column: number; + }; +} + +export interface Node { + type: string; + leadingComments?: Comment[]; + innerComments?: Comment[]; + trailingComments?: Comment[]; + start: number; + end: number; + loc: SourceLocation; +} + +export interface ArrayExpression extends Node { + type: "ArrayExpression"; + elements: Array; +} + +export interface AssignmentExpression extends Node { + type: "AssignmentExpression"; + operator: "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&="; + left: LVal; + right: Expression; +} + +export interface BinaryExpression extends Node { + type: "BinaryExpression"; + operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<="; + left: Expression; + right: Expression; +} + +export interface Directive extends Node { + type: "Directive"; + value: DirectiveLiteral; +} + +export interface DirectiveLiteral extends Node { + type: "DirectiveLiteral"; + value: string; +} + +export interface BlockStatement extends Node { + type: "BlockStatement"; + directives?: Directive[]; + body: Statement[]; +} + +export interface BreakStatement extends Node { + type: "BreakStatement"; + label: Identifier; +} + +export interface CallExpression extends Node { + type: "CallExpression"; + callee: Expression | Super; + arguments: Array; +} + +export interface CatchClause extends Node { + type: "CatchClause"; + param: Identifier; + body: BlockStatement; +} + +export interface ConditionalExpression extends Node { + type: "ConditionalExpression"; + test: Expression; + consequent: Expression; + alternate: Expression; +} + +export interface ContinueStatement extends Node { + type: "ContinueStatement"; + label: Identifier; +} + +export interface DebuggerStatement extends Node { + type: "DebuggerStatement"; +} + +export interface DoWhileStatement extends Node { + type: "DoWhileStatement"; + test: Expression; + body: Statement; +} + +export interface EmptyStatement extends Node { + type: "EmptyStatement"; +} + +export interface ExpressionStatement extends Node { + type: "ExpressionStatement"; + expression: Expression; +} + +export interface File extends Node { + type: "File"; + program: Program; + comments: Comment[]; + tokens: any[]; +} + +export interface ForInStatement extends Node { + type: "ForInStatement"; + left: VariableDeclaration | LVal; + right: Expression; + body: Statement; +} + +export interface ForStatement extends Node { + type: "ForStatement"; + init: VariableDeclaration | Expression; + test: Expression; + update: Expression; + body: Statement; +} + +export interface FunctionDeclaration extends Node { + type: "FunctionDeclaration"; + id: Identifier; + params: LVal[]; + body: BlockStatement; + generator: boolean; + async: boolean; + returnType?: TypeAnnotation; + typeParameters?: TypeParameterDeclaration; +} + +export interface FunctionExpression extends Node { + type: "FunctionExpression"; + id: Identifier; + params: LVal[]; + body: BlockStatement; + generator: boolean; + async: boolean; + returnType?: TypeAnnotation; + typeParameters?: TypeParameterDeclaration; +} + +export interface Identifier extends Node { + type: "Identifier"; + name: string; + typeAnnotation?: TypeAnnotation; +} + +export interface IfStatement extends Node { + type: "IfStatement"; + test: Expression; + consequent: Statement; + alternate: Statement; +} + +export interface LabeledStatement extends Node { + type: "LabeledStatement"; + label: Identifier; + body: Statement; +} + +export interface StringLiteral extends Node { + type: "StringLiteral"; + value: string; +} + +export interface NumericLiteral extends Node { + type: "NumericLiteral"; + value: number; +} + +export interface NullLiteral extends Node { + type: "NullLiteral"; +} + +export interface BooleanLiteral extends Node { + type: "BooleanLiteral"; + value: boolean; +} + +export interface RegExpLiteral extends Node { + type: "RegExpLiteral"; + pattern: string; + flags?: string; +} + +export interface LogicalExpression extends Node { + type: "LogicalExpression"; + operator: "||" | "&&"; + left: Expression; + right: Expression; +} + +export interface MemberExpression extends Node { + type: "MemberExpression"; + object: Expression | Super; + property: Expression; + computed: boolean; +} + +export interface NewExpression extends Node { + type: "NewExpression"; + callee: Expression | Super; + arguments: Array; +} + +export interface Program extends Node { + type: "Program"; + sourceType: "script" | "module"; + directives?: Directive[]; + body: Array; +} + +export interface ObjectExpression extends Node { + type: "ObjectExpression"; + properties: Array; +} + +export interface ObjectMethod extends Node { + type: "ObjectMethod"; + key: Expression; + kind: "get" | "set" | "method"; + shorthand: boolean; + computed: boolean; + value: Expression; + decorators?: Decorator[]; + id: Identifier; + params: LVal[]; + body: BlockStatement; + generator: boolean; + async: boolean; + returnType?: TypeAnnotation; + typeParameters?: TypeParameterDeclaration; +} + +export interface ObjectProperty extends Node { + type: "ObjectProperty"; + key: Expression; + computed: boolean; + value: Expression; + decorators?: Decorator[]; + shorthand: boolean; +} + +export interface RestElement extends Node { + type: "RestElement"; + argument: LVal; + typeAnnotation?: TypeAnnotation; +} + +export interface ReturnStatement extends Node { + type: "ReturnStatement"; + argument: Expression; +} + +export interface SequenceExpression extends Node { + type: "SequenceExpression"; + expressions: Expression[]; +} + +export interface SwitchCase extends Node { + type: "SwitchCase"; + test: Expression; + consequent: Statement[]; +} + +export interface SwitchStatement extends Node { + type: "SwitchStatement"; + discriminant: Expression; + cases: SwitchCase[]; +} + +export interface ThisExpression extends Node { + type: "ThisExpression"; +} + +export interface ThrowStatement extends Node { + type: "ThrowStatement"; + argument: Expression; +} + +export interface TryStatement extends Node { + type: "TryStatement"; + block: BlockStatement; + handler: CatchClause; + finalizer: BlockStatement; +} + +export interface UnaryExpression extends Node { + type: "UnaryExpression"; + operator: "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"; + prefix: boolean; + argument: Expression; +} + +export interface UpdateExpression extends Node { + type: "UpdateExpression"; + operator: "++" | "--"; + prefix: boolean; + argument: Expression; +} + +export interface VariableDeclaration extends Node { + type: "VariableDeclaration"; + declarations: VariableDeclarator[]; + kind: "var" | "let" | "const"; +} + +export interface VariableDeclarator extends Node { + type: "VariableDeclarator"; + id: LVal; + init: Expression; +} + +export interface WhileStatement extends Node { + type: "WhileStatement"; + test: Expression; + body: Statement; +} + +export interface WithStatement extends Node { + type: "WithStatement"; + object: Expression; + body: BlockStatement | Statement; +} + +export interface AssignmentPattern extends Node { + type: "AssignmentPattern"; + left: Identifier; + right: Expression; +} + +export interface ArrayPattern extends Node { + type: "ArrayPattern"; + elements: Expression[]; + typeAnnotation?: TypeAnnotation; +} + +export interface ArrowFunctionExpression extends Node { + type: "ArrowFunctionExpression"; + id: Identifier; + params: LVal[]; + body: BlockStatement | Expression; + generator: boolean; + async: boolean; + expression: boolean; + returnType?: TypeAnnotation; + typeParameters?: TypeParameterDeclaration; +} + +export interface ClassBody extends Node { + type: "ClassBody"; + body: Array; +} + +export interface ClassDeclaration extends Node { + type: "ClassDeclaration"; + id: Identifier; + superClass: Expression; + body: ClassBody; + decorators?: Decorator[]; + implements?: ClassImplements[]; + mixins?: any[]; + typeParameters?: TypeParameterDeclaration; + superTypeParameters?: TypeParameterInstantiation; +} + +export interface ClassExpression extends Node { + type: "ClassExpression"; + id: Identifier; + superClass: Expression; + body: ClassBody; + decorators?: Decorator[]; + implements?: ClassImplements[]; + mixins?: any[]; + typeParameters?: TypeParameterDeclaration; + superTypeParameters?: TypeParameterInstantiation; +} + +export interface ExportAllDeclaration extends Node { + type: "ExportAllDeclaration"; + source: StringLiteral; +} + +export interface ExportDefaultDeclaration extends Node { + type: "ExportDefaultDeclaration"; + declaration: Declaration | Expression; +} + +export interface ExportNamedDeclaration extends Node { + type: "ExportNamedDeclaration"; + declaration: Declaration; + specifiers: ExportSpecifier[]; + source: StringLiteral | null; +} + +export interface ExportSpecifier extends Node { + type: "ExportSpecifier"; + local: Identifier; + imported: Identifier; + exported: Identifier; +} + +export interface ForOfStatement extends Node { + type: "ForOfStatement"; + left: VariableDeclaration | LVal; + right: Expression; + body: Statement; +} + +export interface ImportDeclaration extends Node { + type: "ImportDeclaration"; + specifiers: Array; + source: StringLiteral; +} + +export interface ImportDefaultSpecifier extends Node { + type: "ImportDefaultSpecifier"; + local: Identifier; +} + +export interface ImportNamespaceSpecifier extends Node { + type: "ImportNamespaceSpecifier"; + local: Identifier; +} + +export interface ImportSpecifier extends Node { + type: "ImportSpecifier"; + local: Identifier; + imported: Identifier; +} + +export interface MetaProperty extends Node { + type: "MetaProperty"; + meta: Identifier; + property: Identifier; +} + +export interface ClassMethod extends Node { + type: "ClassMethod"; + key: Expression; + value?: FunctionExpression; + kind: "constructor" | "method" | "get" | "set"; + computed: boolean; + static: boolean; + decorators?: Decorator[]; + id: Identifier; + params: LVal[]; + body: BlockStatement; + generator: boolean; + async: boolean; + expression: boolean; + returnType?: TypeAnnotation; + typeParameters?: TypeParameterDeclaration; +} + +// See: https://github.com/babel/babel/blob/master/doc/ast/spec.md#objectpattern +export interface AssignmentProperty extends Node { + type: "ObjectProperty"; + key: Expression; + computed: boolean; + value: Pattern; + decorators?: Decorator[]; + shorthand: boolean; +} + +export interface ObjectPattern extends Node { + type: "ObjectPattern"; + properties: Array; + typeAnnotation?: TypeAnnotation; +} + +export interface SpreadElement extends Node { + type: "SpreadElement"; + argument: Expression; +} + +export interface Super extends Node { + type: "Super"; +} + +export interface TaggedTemplateExpression extends Node { + type: "TaggedTemplateExpression"; + tag: Expression; + quasi: TemplateLiteral; +} + +export interface TemplateElement extends Node { + type: "TemplateElement"; + tail: boolean; + value: { + cooked: string; + raw: string; + }; +} + +export interface TemplateLiteral extends Node { + type: "TemplateLiteral"; + quasis: TemplateElement[]; + expressions: Expression[]; +} + +export interface YieldExpression extends Node { + type: "YieldExpression"; + argument: Expression; + delegate: boolean; +} + +export interface AnyTypeAnnotation extends Node { + type: "AnyTypeAnnotation"; +} + +export interface ArrayTypeAnnotation extends Node { + type: "ArrayTypeAnnotation"; + elementType: FlowTypeAnnotation; +} + +export interface BooleanTypeAnnotation extends Node { + type: "BooleanTypeAnnotation"; +} + +export interface BooleanLiteralTypeAnnotation extends Node { + type: "BooleanLiteralTypeAnnotation"; +} + +export interface NullLiteralTypeAnnotation extends Node { + type: "NullLiteralTypeAnnotation"; +} + +export interface ClassImplements extends Node { + type: "ClassImplements"; + id: Identifier; + typeParameters: TypeParameterInstantiation; +} + +export interface ClassProperty extends Node { + type: "ClassProperty"; + key: Identifier; + value: Expression; + decorators?: Decorator[]; + typeAnnotation?: TypeAnnotation; +} + +export interface DeclareClass extends Node { + type: "DeclareClass"; + id: Identifier; + typeParameters: TypeParameterDeclaration; + extends: InterfaceExtends[]; + body: ObjectTypeAnnotation; +} + +export interface DeclareFunction extends Node { + type: "DeclareFunction"; + id: Identifier; +} + +export interface DeclareInterface extends Node { + type: "DeclareInterface"; + id: Identifier; + typeParameters: TypeParameterDeclaration; + extends: InterfaceExtends[]; + body: ObjectTypeAnnotation; +} + +export interface DeclareModule extends Node { + type: "DeclareModule"; + id: StringLiteral | Identifier; + body: BlockStatement; +} + +export interface DeclareTypeAlias extends Node { + type: "DeclareTypeAlias"; + id: Identifier; + typeParameters: TypeParameterDeclaration; + right: FlowTypeAnnotation; +} + +export interface DeclareVariable extends Node { + type: "DeclareVariable"; + id: Identifier; +} + +export interface ExistentialTypeParam extends Node { + type: "ExistentialTypeParam"; +} + +export interface FunctionTypeAnnotation extends Node { + type: "FunctionTypeAnnotation"; + typeParameters: TypeParameterDeclaration; + params: FunctionTypeParam[]; + rest: FunctionTypeParam; + returnType: FlowTypeAnnotation; +} + +export interface FunctionTypeParam extends Node { + type: "FunctionTypeParam"; + name: Identifier; + typeAnnotation: FlowTypeAnnotation; +} + +export interface GenericTypeAnnotation extends Node { + type: "GenericTypeAnnotation"; + id: Identifier; + typeParameters: TypeParameterInstantiation; +} + +export interface InterfaceExtends extends Node { + type: "InterfaceExtends"; + id: Identifier; + typeParameters: TypeParameterInstantiation; +} + +export interface InterfaceDeclaration extends Node { + type: "InterfaceDeclaration"; + id: Identifier; + typeParameters: TypeParameterDeclaration; + extends: InterfaceExtends[]; + mixins?: any[]; + body: ObjectTypeAnnotation; +} + +export interface IntersectionTypeAnnotation extends Node { + type: "IntersectionTypeAnnotation"; + types: FlowTypeAnnotation[]; +} + +export interface MixedTypeAnnotation extends Node { + type: "MixedTypeAnnotation"; +} + +export interface NullableTypeAnnotation extends Node { + type: "NullableTypeAnnotation"; + typeAnnotation: FlowTypeAnnotation; +} + +export interface NumericLiteralTypeAnnotation extends Node { + type: "NumericLiteralTypeAnnotation"; +} + +export interface NumberTypeAnnotation extends Node { + type: "NumberTypeAnnotation"; +} + +export interface StringLiteralTypeAnnotation extends Node { + type: "StringLiteralTypeAnnotation"; +} + +export interface StringTypeAnnotation extends Node { + type: "StringTypeAnnotation"; +} + +export interface ThisTypeAnnotation extends Node { + type: "ThisTypeAnnotation"; +} + +export interface TupleTypeAnnotation extends Node { + type: "TupleTypeAnnotation"; + types: FlowTypeAnnotation[]; +} + +export interface TypeofTypeAnnotation extends Node { + type: "TypeofTypeAnnotation"; + argument: FlowTypeAnnotation; +} + +export interface TypeAlias extends Node { + type: "TypeAlias"; + id: Identifier; + typeParameters: TypeParameterDeclaration; + right: FlowTypeAnnotation; +} + +export interface TypeAnnotation extends Node { + type: "TypeAnnotation"; + typeAnnotation: FlowTypeAnnotation; +} + +export interface TypeCastExpression extends Node { + type: "TypeCastExpression"; + expression: Expression; + typeAnnotation: FlowTypeAnnotation; +} + +export interface TypeParameter extends Node { + type: "TypeParameterDeclaration"; + bound: TypeAnnotation | null; + default: Flow | null; + name: string | null; +} + +export interface TypeParameterDeclaration extends Node { + type: "TypeParameterDeclaration"; + params: Identifier[]; +} + +export interface TypeParameterInstantiation extends Node { + type: "TypeParameterInstantiation"; + params: FlowTypeAnnotation[]; +} + +export interface ObjectTypeAnnotation extends Node { + type: "ObjectTypeAnnotation"; + properties: ObjectTypeProperty[]; + indexers: ObjectTypeIndexer[]; + callProperties: ObjectTypeCallProperty[]; +} + +export interface ObjectTypeCallProperty extends Node { + type: "ObjectTypeCallProperty"; + value: FlowTypeAnnotation; +} + +export interface ObjectTypeIndexer extends Node { + type: "ObjectTypeIndexer"; + id: Expression; + key: FlowTypeAnnotation; + value: FlowTypeAnnotation; +} + +export interface ObjectTypeProperty extends Node { + type: "ObjectTypeProperty"; + key: Expression; + value: FlowTypeAnnotation; +} + +export interface QualifiedTypeIdentifier extends Node { + type: "QualifiedTypeIdentifier"; + id: Identifier; + qualification: Identifier | QualifiedTypeIdentifier; +} + +export interface UnionTypeAnnotation extends Node { + type: "UnionTypeAnnotation"; + types: FlowTypeAnnotation[]; +} + +export interface VoidTypeAnnotation extends Node { + type: "VoidTypeAnnotation"; +} + +export interface JSXAttribute extends Node { + type: "JSXAttribute"; + name: JSXIdentifier | JSXNamespacedName; + value: JSXElement | StringLiteral | JSXExpressionContainer; +} + +export interface JSXClosingElement extends Node { + type: "JSXClosingElement"; + name: JSXIdentifier | JSXMemberExpression; +} + +export interface JSXElement extends Node { + type: "JSXElement"; + openingElement: JSXOpeningElement; + closingElement: JSXClosingElement; + children: Array; + selfClosing?: boolean; +} + +export interface JSXEmptyExpression extends Node { + type: "JSXEmptyExpression"; +} + +export interface JSXExpressionContainer extends Node { + type: "JSXExpressionContainer"; + expression: Expression; +} + +export interface JSXIdentifier extends Node { + type: "JSXIdentifier"; + name: string; +} + +export interface JSXMemberExpression extends Node { + type: "JSXMemberExpression"; + object: JSXMemberExpression | JSXIdentifier; + property: JSXIdentifier; +} + +export interface JSXNamespacedName extends Node { + type: "JSXNamespacedName"; + namespace: JSXIdentifier; + name: JSXIdentifier; +} + +export interface JSXOpeningElement extends Node { + type: "JSXOpeningElement"; + name: JSXIdentifier | JSXMemberExpression; + selfClosing: boolean; + attributes: JSXAttribute[]; +} + +export interface JSXSpreadAttribute extends Node { + type: "JSXSpreadAttribute"; + argument: Expression; +} + +export interface JSXText extends Node { + type: "JSXText"; + value: string; +} + +export interface Noop extends Node { + type: "Noop"; +} + +export interface ParenthesizedExpression extends Node { + type: "ParenthesizedExpression"; + expression: Expression; +} + +export interface AwaitExpression extends Node { + type: "AwaitExpression"; + argument: Expression; +} + +export interface BindExpression extends Node { + type: "BindExpression"; + object: Expression; + callee: Expression; +} + +export interface Decorator extends Node { + type: "Decorator"; + expression: Expression; +} + +export interface DoExpression extends Node { + type: "DoExpression"; + body: BlockStatement; +} + +export interface ExportDefaultSpecifier extends Node { + type: "ExportDefaultSpecifier"; + exported: Identifier; +} + +export interface ExportNamespaceSpecifier extends Node { + type: "ExportNamespaceSpecifier"; + exported: Identifier; +} + +export interface RestProperty extends Node { + type: "RestProperty"; + argument: LVal; +} + +export interface SpreadProperty extends Node { + type: "SpreadProperty"; + argument: Expression; +} + +export interface TSAnyKeyword extends Node { + type: "TSAnyKeyword"; +} + +export interface TSArrayType extends Node { + type: "TSArrayType"; + elementType: TSType; +} + +export interface TSAsExpression extends Node { + type: "TSAsExpression"; + expression: Expression; + typeAnnotation: TSType; +} + +export interface TSBooleanKeyword extends Node { + type: "TSBooleanKeyword"; +} + +export interface TSCallSignatureDeclaration extends Node { + type: "TSCallSignatureDeclaration"; + typeParameters: TypeParameterDeclaration | null; + parameters: Array | null; + typeAnnotation: TSTypeAnnotation | null; +} + +export interface TSConstructSignatureDeclaration extends Node { + type: "TSConstructSignatureDeclaration"; + typeParameters: TypeParameterDeclaration | null; + parameters: Array | null; + typeAnnotation: TSTypeAnnotation | null; +} + +export interface TSConstructorType extends Node { + type: "TSConstructorType"; + typeParameters: TypeParameterDeclaration | null; + typeAnnotation: TSTypeAnnotation | null; + parameters: Array | null; +} + +export interface TSDeclareFunction extends Node { + type: "TSDeclareFunction"; + id: Identifier | null; + typeParameters: TypeParameterDeclaration | Noop | null; + params: LVal[]; + returnType: TypeAnnotation | TSTypeAnnotation | Noop | null; + async: boolean; + declare: boolean | null; + generator: boolean; +} + +export interface TSDeclareMethod extends Node { + type: "TSDeclareMethod"; + decorators: Decorator[] | null; + key: Expression; + typeParameters: TypeParameterDeclaration | Noop | null; + params: LVal[]; + returnType: TypeAnnotation | TSTypeAnnotation | Noop | null; + abstract: boolean | null; + access: "public" | "private" | "protected" | null; + accessibility: "public" | "private" | "protected" | null; + async: boolean; + computed: boolean; + generator: boolean; + kind: "get" | "set" | "method" | "constructor"; + optional: boolean | null; + static: boolean | null; +} + +export interface TSEnumDeclaration extends Node { + type: "TSEnumDeclaration"; + id: Identifier; + members: TSEnumMember[]; + const: boolean | null; + declare: boolean | null; + initializer: Expression | null; +} + +export interface TSEnumMember extends Node { + type: "TSEnumMember"; + id: Identifier | StringLiteral; + initializer: Expression | null; +} + +export interface TSExportAssignment extends Node { + type: "TSExportAssignment"; + expression: Expression; +} + +export interface TSExpressionWithTypeArguments extends Node { + type: "TSExpressionWithTypeArguments"; + expression: TSEntityName; + typeParameters: TypeParameterInstantiation | null; +} + +export interface TSExternalModuleReference extends Node { + type: "TSExternalModuleReference"; + expression: StringLiteral; +} + +export interface TSFunctionType extends Node { + type: "TSFunctionType"; + typeParameters: TypeParameterDeclaration | null; + typeAnnotation: TSTypeAnnotation | null; + parameters: Array | null; +} + +export interface TSImportEqualsDeclaration extends Node { + type: "TSImportEqualsDeclaration"; + id: Identifier; + moduleReference: TSEntityName | TSExternalModuleReference; + isExport: boolean | null; +} + +export interface TSIndexSignature extends Node { + type: "TSIndexSignature"; + parameters: Identifier[]; + typeAnnotation: TSTypeAnnotation | null; + readonly: boolean | null; +} + +export interface TSIndexedAccessType extends Node { + type: "TSIndexedAccessType"; + objectType: TSType; + indexType: TSType; +} + +export interface TSInterfaceBody extends Node { + type: "TSInterfaceBody"; + body: TSTypeElement[]; +} + +export interface TSInterfaceDeclaration extends Node { + type: "TSInterfaceDeclaration"; + id: Identifier; + typeParameters: TypeParameterDeclaration | null; + extends: TSExpressionWithTypeArguments[] | null; + body: TSInterfaceBody; + declare: boolean | null; +} + +export interface TSIntersectionType extends Node { + type: "TSIntersectionType"; + types: TSType[]; +} + +export interface TSLiteralType extends Node { + type: "TSLiteralType"; + literal: NumericLiteral | StringLiteral | BooleanLiteral; +} + +export interface TSMappedType extends Node { + type: "TSMappedType"; + typeParameter: TypeParameter; + typeAnnotation: TSType | null; + optional: boolean | null; + readonly: boolean | null; +} + +export interface TSMethodSignature extends Node { + type: "TSMethodSignature"; + key: Expression; + typeParameters: TypeParameterDeclaration | null; + parameters: Array | null; + typeAnnotation: TSTypeAnnotation | null; + computed: boolean | null; + optional: boolean | null; +} + +export interface TSModuleBlock extends Node { + type: "TSModuleBlock"; + body: Statement[]; +} + +export interface TSModuleDeclaration extends Node { + type: "TSModuleDeclaration"; + id: Identifier | StringLiteral; + body: TSModuleBlock | TSModuleDeclaration; + declare: boolean | null; + global: boolean | null; +} + +export interface TSNamespaceExportDeclaration extends Node { + type: "TSNamespaceExportDeclaration"; + id: Identifier; +} + +export interface TSNeverKeyword extends Node { + type: "TSNeverKeyword"; +} + +export interface TSNonNullExpression extends Node { + type: "TSNonNullExpression"; + expression: Expression; +} + +export interface TSNullKeyword extends Node { + type: "TSNullKeyword"; +} + +export interface TSNumberKeyword extends Node { + type: "TSNumberKeyword"; +} + +export interface TSObjectKeyword extends Node { + type: "TSObjectKeyword"; +} + +export interface TSParameterProperty extends Node { + type: "TSParameterProperty"; + parameter: Identifier | AssignmentPattern; + accessibility: 'public' | 'private' | 'protected' | null; + readonly: boolean | null; +} + +export interface TSParenthesizedType extends Node { + type: "TSParenthesizedType"; + typeAnnotation: TSType; +} + +export interface TSPropertySignature extends Node { + type: "TSPropertySignature"; + key: Expression; + typeAnnotation: TSTypeAnnotation | null; + initializer: Expression | null; + computed: boolean | null; + optional: boolean | null; + readonly: boolean | null; +} + +export interface TSQualifiedName extends Node { + type: "TSQualifiedName"; + left: TSEntityName; + right: Identifier; +} + +export interface TSStringKeyword extends Node { + type: "TSStringKeyword"; +} + +export interface TSSymbolKeyword extends Node { + type: "TSSymbolKeyword"; +} + +export interface TSThisType extends Node { + type: "TSThisType"; +} + +export interface TSTupleType extends Node { + type: "TSTupleType"; + elementTypes: TSType[]; +} + +export interface TSTypeAliasDeclaration extends Node { + type: "TSTypeAliasDeclaration"; + id: Identifier; + typeParameters: TypeParameterDeclaration | null; + typeAnnotation: TSType; + declare: boolean | null; +} + +export interface TSTypeAnnotation extends Node { + type: "TSTypeAnnotation"; + typeAnnotation: TSType; +} + +export interface TSTypeAssertion extends Node { + type: "TSTypeAssertion"; + typeAnnotation: TSType; + expression: Expression; +} + +export interface TSTypeLiteral extends Node { + type: "TSTypeLiteral"; + members: TSTypeElement[]; +} + +export interface TSTypeOperator extends Node { + type: "TSTypeOperator"; + typeAnnotation: TSType; + operator: string | null; +} + +export interface TSTypeParameter extends Node { + type: "TSTypeParameter"; + constraint: TSType | null; + default: TSType | null; + name: string | null; +} + +export interface TSTypeParameterDeclaration extends Node { + type: "TSTypeParameterDeclaration"; + params: TSTypeParameter[]; +} + +export interface TSTypeParameterInstantiation extends Node { + type: "TSTypeParameterInstantiation"; + params: TSType[]; +} + +export interface TSTypePredicate extends Node { + type: "TSTypePredicate"; + parameterName: Identifier | TSThisType; + typeAnnotation: TSTypeAnnotation; +} + +export interface TSTypeQuery extends Node { + type: "TSTypeQuery"; + exprName: TSEntityName; +} + +export interface TSTypeReference extends Node { + type: "TSTypeReference"; + typeName: TSEntityName; + typeParameters: TypeParameterInstantiation | null; +} + +export interface TSUndefinedKeyword extends Node { + type: "TSUndefinedKeyword"; +} + +export interface TSUnionType extends Node { + type: "TSUnionType"; + types: TSType[]; +} + +export interface TSVoidKeyword extends Node { + type: "TSVoidKeyword"; +} + +export type Expression = ArrayExpression | AssignmentExpression | BinaryExpression | CallExpression + | ConditionalExpression | FunctionExpression | Identifier | StringLiteral | NumericLiteral | BooleanLiteral + | NullLiteral | RegExpLiteral | LogicalExpression | MemberExpression | NewExpression | ObjectExpression + | SequenceExpression | ThisExpression | UnaryExpression | UpdateExpression | ArrowFunctionExpression + | ClassExpression | MetaProperty | Super | TaggedTemplateExpression | TemplateLiteral | YieldExpression + | TypeCastExpression | JSXElement | JSXEmptyExpression | JSXIdentifier | JSXMemberExpression + | ParenthesizedExpression | AwaitExpression | BindExpression | DoExpression | TSAsExpression + | TSNonNullExpression | TSTypeAssertion; + +export type Binary = BinaryExpression | LogicalExpression; + +export type Scopable = BlockStatement | CatchClause | DoWhileStatement | ForInStatement | ForStatement + | FunctionDeclaration | FunctionExpression | Program | ObjectMethod | SwitchStatement | WhileStatement + | ArrowFunctionExpression | ClassDeclaration | ClassExpression | ForOfStatement | ClassMethod; + +export type BlockParent = BlockStatement | DoWhileStatement | ForInStatement | ForStatement | FunctionDeclaration + | FunctionExpression | Program | ObjectMethod | SwitchStatement | WhileStatement | ArrowFunctionExpression + | ForOfStatement | ClassMethod; + +export type Block = BlockStatement | Program; + +export type Statement = BlockStatement | BreakStatement | ContinueStatement | DebuggerStatement | DoWhileStatement + | EmptyStatement | ExpressionStatement | ForInStatement | ForStatement | FunctionDeclaration | IfStatement + | LabeledStatement | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement | VariableDeclaration + | WhileStatement | WithStatement | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration + | ExportNamedDeclaration | ForOfStatement | ImportDeclaration | DeclareClass | DeclareFunction | DeclareInterface + | DeclareModule | DeclareTypeAlias | DeclareVariable | InterfaceDeclaration | TypeAlias | TSDeclareFunction + | TSEnumDeclaration | TSExportAssignment | TSImportEqualsDeclaration | TSInterfaceDeclaration + | TSModuleDeclaration | TSNamespaceExportDeclaration | TSTypeAliasDeclaration; + +export type Terminatorless = BreakStatement | ContinueStatement | ReturnStatement | ThrowStatement | YieldExpression | AwaitExpression; +export type CompletionStatement = BreakStatement | ContinueStatement | ReturnStatement | ThrowStatement; +export type Conditional = ConditionalExpression | IfStatement; +export type Loop = DoWhileStatement | ForInStatement | ForStatement | WhileStatement | ForOfStatement; +export type While = DoWhileStatement | WhileStatement; +export type ExpressionWrapper = ExpressionStatement | TypeCastExpression | ParenthesizedExpression; +export type For = ForInStatement | ForStatement | ForOfStatement; +export type ForXStatement = ForInStatement | ForOfStatement; +export type Function = FunctionDeclaration | FunctionExpression | ObjectMethod | ArrowFunctionExpression | ClassMethod; +export type FunctionParent = FunctionDeclaration | FunctionExpression | Program | ObjectMethod | ArrowFunctionExpression | ClassMethod; +export type Pureish = FunctionDeclaration | FunctionExpression | StringLiteral | NumericLiteral | BooleanLiteral | NullLiteral | ArrowFunctionExpression | ClassDeclaration | ClassExpression; + +export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration | ExportAllDeclaration + | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration | DeclareClass | DeclareFunction + | DeclareInterface | DeclareModule | DeclareTypeAlias | DeclareVariable | InterfaceDeclaration | TypeAlias + | TSDeclareFunction | TSEnumDeclaration | TSInterfaceDeclaration | TSModuleDeclaration | TSTypeAliasDeclaration; + +export type LVal = Identifier | MemberExpression | RestElement | AssignmentPattern | ArrayPattern | ObjectPattern + | TSParameterProperty; +export type Literal = StringLiteral | NumericLiteral | BooleanLiteral | NullLiteral | RegExpLiteral | TemplateLiteral; +export type Immutable = StringLiteral | NumericLiteral | BooleanLiteral | NullLiteral | JSXAttribute | JSXClosingElement | JSXElement | JSXExpressionContainer | JSXOpeningElement; +export type UserWhitespacable = ObjectMethod | ObjectProperty | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeProperty; +export type Method = ObjectMethod | ClassMethod; +export type ObjectMember = ObjectMethod | ObjectProperty; +export type Property = ObjectProperty | ClassProperty; +export type UnaryLike = UnaryExpression | SpreadElement | RestProperty | SpreadProperty; +export type Pattern = AssignmentPattern | ArrayPattern | ObjectPattern; +export type Class = ClassDeclaration | ClassExpression; +export type ModuleDeclaration = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration; +export type ExportDeclaration = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration; +export type ModuleSpecifier = ExportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier; + +export type Flow = AnyTypeAnnotation | ArrayTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation + | ClassImplements | ClassProperty | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule + | DeclareTypeAlias | DeclareVariable | ExistentialTypeParam | FunctionTypeAnnotation | FunctionTypeParam + | GenericTypeAnnotation | InterfaceExtends | InterfaceDeclaration | IntersectionTypeAnnotation + | MixedTypeAnnotation | NullableTypeAnnotation | NumericLiteralTypeAnnotation | NumberTypeAnnotation + | StringLiteralTypeAnnotation | StringTypeAnnotation | ThisTypeAnnotation | TupleTypeAnnotation + | TypeofTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameterDeclaration + | TypeParameterInstantiation | ObjectTypeAnnotation | ObjectTypeCallProperty | ObjectTypeIndexer + | ObjectTypeProperty | QualifiedTypeIdentifier | UnionTypeAnnotation | VoidTypeAnnotation; + +export type FlowTypeAnnotation = AnyTypeAnnotation | ArrayTypeAnnotation | BooleanTypeAnnotation + | BooleanLiteralTypeAnnotation | FunctionTypeAnnotation | GenericTypeAnnotation | IntersectionTypeAnnotation + | MixedTypeAnnotation | NullableTypeAnnotation | NumericLiteralTypeAnnotation | NumberTypeAnnotation + | StringLiteralTypeAnnotation | StringTypeAnnotation | ThisTypeAnnotation | TupleTypeAnnotation + | TypeofTypeAnnotation | TypeAnnotation | ObjectTypeAnnotation | UnionTypeAnnotation | VoidTypeAnnotation; + +export type FlowBaseAnnotation = AnyTypeAnnotation | BooleanTypeAnnotation | MixedTypeAnnotation | NumberTypeAnnotation | StringTypeAnnotation | ThisTypeAnnotation | VoidTypeAnnotation; +export type FlowDeclaration = DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareTypeAlias | DeclareVariable | InterfaceDeclaration | TypeAlias; + +export type JSX = JSXAttribute | JSXClosingElement | JSXElement | JSXEmptyExpression | JSXExpressionContainer + | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXSpreadAttribute | JSXText; + +export type TSType = TSAnyKeyword | TSArrayType | TSBooleanKeyword | TSConstructorType | TSExpressionWithTypeArguments + | TSFunctionType | TSIndexedAccessType | TSIntersectionType | TSLiteralType | TSMappedType | TSNeverKeyword + | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSParenthesizedType | TSStringKeyword | TSSymbolKeyword + | TSThisType | TSTupleType | TSTypeLiteral | TSTypeOperator | TSTypePredicate | TSTypeQuery | TSTypeReference + | TSUndefinedKeyword | TSUnionType | TSVoidKeyword; + +export type TSEntityName = Identifier | TSQualifiedName; + +export type TSTypeElement = TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSIndexSignature + | TSMethodSignature | TSPropertySignature; + +export function arrayExpression(elements?: Array): ArrayExpression; +export function assignmentExpression(operator?: string, left?: LVal, right?: Expression): AssignmentExpression; +export function binaryExpression( + operator?: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=", + left?: Expression, + right?: Expression +): BinaryExpression; +export function directive(value?: DirectiveLiteral): Directive; +export function directiveLiteral(value?: string): DirectiveLiteral; +export function blockStatement(body?: Statement[], directives?: Directive[]): BlockStatement; +export function breakStatement(label?: Identifier): BreakStatement; +export function callExpression(callee?: Expression, _arguments?: Array): CallExpression; +export function catchClause(param?: Identifier, body?: BlockStatement): CatchClause; +export function conditionalExpression(test?: Expression, consequent?: Expression, alternate?: Expression): ConditionalExpression; +export function continueStatement(label?: Identifier): ContinueStatement; +export function debuggerStatement(): DebuggerStatement; +export function doWhileStatement(test?: Expression, body?: Statement): DoWhileStatement; +export function emptyStatement(): EmptyStatement; +export function expressionStatement(expression?: Expression): ExpressionStatement; +export function file(program?: Program, comments?: Comment[], tokens?: any[]): File; +export function forInStatement(left?: VariableDeclaration | LVal, right?: Expression, body?: Statement): ForInStatement; +export function forStatement(init?: VariableDeclaration | Expression, test?: Expression, update?: Expression, body?: Statement): ForStatement; +export function functionDeclaration(id?: Identifier, params?: LVal[], body?: BlockStatement, generator?: boolean, async?: boolean): FunctionDeclaration; +export function functionExpression(id?: Identifier, params?: LVal[], body?: BlockStatement, generator?: boolean, async?: boolean): FunctionExpression; +export function identifier(name?: string): Identifier; +export function ifStatement(test?: Expression, consequent?: Statement, alternate?: Statement): IfStatement; +export function labeledStatement(label?: Identifier, body?: Statement): LabeledStatement; +export function stringLiteral(value?: string): StringLiteral; +export function numericLiteral(value?: number): NumericLiteral; +export function nullLiteral(): NullLiteral; +export function booleanLiteral(value?: boolean): BooleanLiteral; +export function regExpLiteral(pattern?: string, flags?: string): RegExpLiteral; +export function logicalExpression(operator?: "||" | "&&", left?: Expression, right?: Expression): LogicalExpression; +export function memberExpression(object?: Expression | Super, property?: Expression, computed?: boolean): MemberExpression; +export function newExpression(callee?: Expression | Super, _arguments?: Array): NewExpression; +export function program(body?: Array, directives?: Directive[]): Program; +export function objectExpression(properties?: Array): ObjectExpression; +export function objectMethod(kind?: "get" | "set" | "method", key?: Expression, params?: LVal[], body?: BlockStatement, computed?: boolean): ObjectMethod; +export function objectProperty(key?: Expression, value?: Expression, computed?: boolean, shorthand?: boolean, decorators?: Decorator[]): ObjectProperty; +export function restElement(argument?: LVal, typeAnnotation?: TypeAnnotation): RestElement; +export function returnStatement(argument?: Expression): ReturnStatement; +export function sequenceExpression(expressions?: Expression[]): SequenceExpression; +export function switchCase(test?: Expression, consequent?: Statement[]): SwitchCase; +export function switchStatement(discriminant?: Expression, cases?: SwitchCase[]): SwitchStatement; +export function thisExpression(): ThisExpression; +export function throwStatement(argument?: Expression): ThrowStatement; +export function tryStatement(block?: BlockStatement, handler?: CatchClause, finalizer?: BlockStatement): TryStatement; +export function unaryExpression(operator?: "void" | "delete" | "!" | "+" | "-" | "++" | "--" | "~" | "typeof", argument?: Expression, prefix?: boolean): UnaryExpression; +export function updateExpression(operator?: "++" | "--", argument?: Expression, prefix?: boolean): UpdateExpression; +export function variableDeclaration(kind?: "var" | "let" | "const", declarations?: VariableDeclarator[]): VariableDeclaration; +export function variableDeclarator(id?: LVal, init?: Expression): VariableDeclarator; +export function whileStatement(test?: Expression, body?: BlockStatement | Statement): WhileStatement; +export function withStatement(object?: Expression, body?: BlockStatement | Statement): WithStatement; +export function assignmentPattern(left?: Identifier, right?: Expression): AssignmentPattern; +export function arrayPattern(elements?: Expression[], typeAnnotation?: TypeAnnotation): ArrayPattern; +export function arrowFunctionExpression(params?: LVal[], body?: BlockStatement | Expression, async?: boolean): ArrowFunctionExpression; +export function classBody(body?: Array): ClassBody; +export function classDeclaration(id?: Identifier, superClass?: Expression, body?: ClassBody, decorators?: Decorator[]): ClassDeclaration; +export function classExpression(id?: Identifier, superClass?: Expression, body?: ClassBody, decorators?: Decorator[]): ClassExpression; +export function exportAllDeclaration(source?: StringLiteral): ExportAllDeclaration; +export function exportDefaultDeclaration(declaration?: FunctionDeclaration | ClassDeclaration | Expression): ExportDefaultDeclaration; +export function exportNamedDeclaration(declaration?: Declaration, specifiers?: ExportSpecifier[], source?: StringLiteral): ExportNamedDeclaration; +export function exportSpecifier(local?: Identifier, exported?: Identifier): ExportSpecifier; +export function forOfStatement(left?: VariableDeclaration | LVal, right?: Expression, body?: Statement): ForOfStatement; +export function importDeclaration(specifiers?: Array, source?: StringLiteral): ImportDeclaration; +export function importDefaultSpecifier(local?: Identifier): ImportDefaultSpecifier; +export function importNamespaceSpecifier(local?: Identifier): ImportNamespaceSpecifier; +export function importSpecifier(local?: Identifier, imported?: Identifier): ImportSpecifier; +export function metaProperty(meta?: string, property?: string): MetaProperty; +export function classMethod(kind?: "constructor" | "method" | "get" | "set", key?: Expression, params?: LVal[], body?: BlockStatement, computed?: boolean, _static?: boolean): ClassMethod; +export function objectPattern(properties?: Array, typeAnnotation?: TypeAnnotation): ObjectPattern; +export function spreadElement(argument?: Expression): SpreadElement; +export function taggedTemplateExpression(tag?: Expression, quasi?: TemplateLiteral): TaggedTemplateExpression; +export function templateElement(value?: { cooked?: string; raw?: string; }, tail?: boolean): TemplateElement; +export function templateLiteral(quasis?: TemplateElement[], expressions?: Expression[]): TemplateLiteral; +export function yieldExpression(argument?: Expression, delegate?: boolean): YieldExpression; +export function anyTypeAnnotation(): AnyTypeAnnotation; +export function arrayTypeAnnotation(elementType?: FlowTypeAnnotation): ArrayTypeAnnotation; +export function booleanTypeAnnotation(): BooleanTypeAnnotation; +export function booleanLiteralTypeAnnotation(): BooleanLiteralTypeAnnotation; +export function nullLiteralTypeAnnotation(): NullLiteralTypeAnnotation; +export function classImplements(id?: Identifier, typeParameters?: TypeParameterInstantiation): ClassImplements; +export function classProperty(key?: Identifier, value?: Expression, typeAnnotation?: TypeAnnotation, decorators?: Decorator[]): ClassProperty; +export function declareClass(id?: Identifier, typeParameters?: TypeParameterDeclaration, _extends?: InterfaceExtends[], body?: ObjectTypeAnnotation): DeclareClass; +export function declareFunction(id?: Identifier): DeclareFunction; +export function declareInterface(id?: Identifier, typeParameters?: TypeParameterDeclaration, _extends?: InterfaceExtends[], body?: ObjectTypeAnnotation): DeclareInterface; +export function declareModule(id?: StringLiteral | Identifier, body?: BlockStatement): DeclareModule; +export function declareTypeAlias(id?: Identifier, typeParameters?: TypeParameterDeclaration, right?: FlowTypeAnnotation): DeclareTypeAlias; +export function declareVariable(id?: Identifier): DeclareVariable; +export function existentialTypeParam(): ExistentialTypeParam; +export function functionTypeAnnotation(typeParameters?: TypeParameterDeclaration, params?: FunctionTypeParam[], rest?: FunctionTypeParam, returnType?: FlowTypeAnnotation): FunctionTypeAnnotation; +export function functionTypeParam(name?: Identifier, typeAnnotation?: FlowTypeAnnotation): FunctionTypeParam; +export function genericTypeAnnotation(id?: Identifier, typeParameters?: TypeParameterInstantiation): GenericTypeAnnotation; +export function interfaceExtends(id?: Identifier, typeParameters?: TypeParameterInstantiation): InterfaceExtends; +export function interfaceDeclaration(id?: Identifier, typeParameters?: TypeParameterDeclaration, _extends?: InterfaceExtends[], body?: ObjectTypeAnnotation): InterfaceDeclaration; +export function intersectionTypeAnnotation(types?: FlowTypeAnnotation[]): IntersectionTypeAnnotation; +export function mixedTypeAnnotation(): MixedTypeAnnotation; +export function nullableTypeAnnotation(typeAnnotation?: FlowTypeAnnotation): NullableTypeAnnotation; +export function numericLiteralTypeAnnotation(): NumericLiteralTypeAnnotation; +export function numberTypeAnnotation(): NumberTypeAnnotation; +export function stringLiteralTypeAnnotation(): StringLiteralTypeAnnotation; +export function stringTypeAnnotation(): StringTypeAnnotation; +export function thisTypeAnnotation(): ThisTypeAnnotation; +export function tupleTypeAnnotation(types?: FlowTypeAnnotation[]): TupleTypeAnnotation; +export function typeofTypeAnnotation(argument?: FlowTypeAnnotation): TypeofTypeAnnotation; +export function typeAlias(id?: Identifier, typeParameters?: TypeParameterDeclaration, right?: FlowTypeAnnotation): TypeAlias; +export function typeAnnotation(typeAnnotation?: FlowTypeAnnotation): TypeAnnotation; +export function typeCastExpression(expression?: Expression, typeAnnotation?: FlowTypeAnnotation): TypeCastExpression; +export function typeParameter(bound?: TypeAnnotation, default_?: Flow): TypeParameter; +export function typeParameterDeclaration(params?: Identifier[]): TypeParameterDeclaration; +export function typeParameterInstantiation(params?: FlowTypeAnnotation[]): TypeParameterInstantiation; +export function objectTypeAnnotation(properties?: ObjectTypeProperty[], indexers?: ObjectTypeIndexer[], callProperties?: ObjectTypeCallProperty[]): ObjectTypeAnnotation; +export function objectTypeCallProperty(value?: FlowTypeAnnotation): ObjectTypeCallProperty; +export function objectTypeIndexer(id?: Expression, key?: FlowTypeAnnotation, value?: FlowTypeAnnotation): ObjectTypeIndexer; +export function objectTypeProperty(key?: Expression, value?: FlowTypeAnnotation): ObjectTypeProperty; +export function qualifiedTypeIdentifier(id?: Identifier, qualification?: Identifier | QualifiedTypeIdentifier): QualifiedTypeIdentifier; +export function unionTypeAnnotation(types?: FlowTypeAnnotation[]): UnionTypeAnnotation; +export function voidTypeAnnotation(): VoidTypeAnnotation; +export function jSXAttribute(name?: JSXIdentifier | JSXNamespacedName, value?: JSXElement | StringLiteral | JSXExpressionContainer): JSXAttribute; +export function jSXClosingElement(name?: JSXIdentifier | JSXMemberExpression): JSXClosingElement; +export function jSXElement(openingElement?: JSXOpeningElement, closingElement?: JSXClosingElement, children?: Array, selfClosing?: boolean): JSXElement; +export function jSXEmptyExpression(): JSXEmptyExpression; +export function jSXExpressionContainer(expression?: Expression): JSXExpressionContainer; +export function jSXIdentifier(name?: string): JSXIdentifier; +export function jSXMemberExpression(object?: JSXMemberExpression | JSXIdentifier, property?: JSXIdentifier): JSXMemberExpression; +export function jSXNamespacedName(namespace?: JSXIdentifier, name?: JSXIdentifier): JSXNamespacedName; +export function jSXOpeningElement(name?: JSXIdentifier | JSXMemberExpression, attributes?: JSXAttribute[], selfClosing?: boolean): JSXOpeningElement; +export function jSXSpreadAttribute(argument?: Expression): JSXSpreadAttribute; +export function jSXText(value?: string): JSXText; +export function noop(): Noop; +export function parenthesizedExpression(expression?: Expression): ParenthesizedExpression; +export function awaitExpression(argument?: Expression): AwaitExpression; +export function bindExpression(object?: Expression, callee?: Expression): BindExpression; +export function decorator(expression?: Expression): Decorator; +export function doExpression(body?: BlockStatement): DoExpression; +export function exportDefaultSpecifier(exported?: Identifier): ExportDefaultSpecifier; +export function exportNamespaceSpecifier(exported?: Identifier): ExportNamespaceSpecifier; +export function restProperty(argument?: LVal): RestProperty; +export function spreadProperty(argument?: Expression): SpreadProperty; + +export function TSAnyKeyword(): TSAnyKeyword; +export function TSArrayType(elementType: TSType): TSArrayType; +export function TSAsExpression(expression: Expression, typeAnnotation: TSType): TSAsExpression; +export function TSBooleanKeyword(): TSBooleanKeyword; +export function TSCallSignatureDeclaration(typeParameters?: TypeParameterDeclaration, parameters?: Array, typeAnnotation?: TSTypeAnnotation): TSCallSignatureDeclaration; +export function TSConstructSignatureDeclaration(typeParameters?: TypeParameterDeclaration, parameters?: Array, typeAnnotation?: TSTypeAnnotation): TSTypeElement; +export function TSConstructorType(typeParameters?: TypeParameterDeclaration, typeAnnotation?: TSTypeAnnotation): TSConstructorType; +export function TSDeclareFunction( + id: Identifier | undefined | null, + typeParameters: TypeParameterDeclaration | Noop | undefined | null, + params: LVal[], + returnType: TypeAnnotation | TSTypeAnnotation | Noop | undefined | null): TSDeclareFunction; +export function TSDeclareMethod( + decorators: Decorator[] | undefined | null, + key: Expression, + typeParameters: TypeParameterDeclaration | Noop | undefined | null, + params: LVal[], + returnType?: TypeAnnotation | TSTypeAnnotation | Noop): TSDeclareMethod; +export function TSEnumDeclaration(id: Identifier, members: TSEnumMember[]): TSEnumDeclaration; +export function TSEnumMember(id: Identifier | StringLiteral, initializer?: Expression): TSEnumMember; +export function TSExportAssignment(expression: Expression): TSExportAssignment; +export function TSExpressionWithTypeArguments(expression: TSEntityName, typeParameters?: TypeParameterInstantiation): TSExpressionWithTypeArguments; +export function TSExternalModuleReference(expression: StringLiteral): TSExternalModuleReference; +export function TSFunctionType(typeParameters?: TypeParameterDeclaration, typeAnnotation?: TSTypeAnnotation): TSFunctionType; +export function TSImportEqualsDeclaration(id: Identifier, moduleReference: TSEntityName | TSExternalModuleReference): TSImportEqualsDeclaration; +export function TSIndexSignature(parameters: Identifier[], typeAnnotation?: TSTypeAnnotation): TSIndexSignature; +export function TSIndexedAccessType(objectType: TSType, indexType: TSType): TSIndexedAccessType; +export function TSInterfaceBody(body: TSTypeElement[]): TSInterfaceBody; +export function TSInterfaceDeclaration( + id: Identifier, + typeParameters: TypeParameterDeclaration | undefined | null, + extends_: TSExpressionWithTypeArguments[] | undefined | null, + body: TSInterfaceBody): TSInterfaceDeclaration; +export function TSIntersectionType(types: TSType[]): TSIntersectionType; +export function TSLiteralType(literal: NumericLiteral | StringLiteral | BooleanLiteral): TSLiteralType; +export function TSMappedType(typeParameter: TypeParameter, typeAnnotation?: TSType): TSMappedType; +export function TSMethodSignature(key: Expression, typeParameters?: TypeParameterDeclaration, parameters?: Array, typeAnnotation?: TSTypeAnnotation): TSMethodSignature; +export function TSModuleBlock(body: Statement[]): TSModuleBlock; +export function TSModuleDeclaration(id: Identifier | StringLiteral, body: TSModuleBlock | TSModuleDeclaration): TSModuleDeclaration; +export function TSNamespaceExportDeclaration(id: Identifier): TSNamespaceExportDeclaration; +export function TSNeverKeyword(): TSNeverKeyword; +export function TSNonNullExpression(expression: Expression): TSNonNullExpression; +export function TSNullKeyword(): TSNullKeyword; +export function TSNumberKeyword(): TSNumberKeyword; +export function TSObjectKeyword(): TSObjectKeyword; +export function TSParameterProperty(parameter: Identifier | AssignmentPattern): TSParameterProperty; +export function TSParenthesizedType(typeAnnotation: TSType): TSParenthesizedType; +export function TSPropertySignature(key: Expression, typeAnnotation?: TSTypeAnnotation, initializer?: Expression): TSPropertySignature; +export function TSQualifiedName(left: TSEntityName, right: Identifier): TSQualifiedName; +export function TSStringKeyword(): TSStringKeyword; +export function TSSymbolKeyword(): TSSymbolKeyword; +export function TSThisType(): TSThisType; +export function TSTupleType(elementTypes: TSType[]): TSTupleType; +export function TSTypeAliasDeclaration(id: Identifier, typeParameters: TypeParameterDeclaration | undefined | null, typeAnnotation: TSType): TSTypeAliasDeclaration; +export function TSTypeAnnotation(typeAnnotation: TSType): TSTypeAnnotation; +export function TSTypeAssertion(typeAnnotation: TSType, expression: Expression): TSTypeAssertion; +export function TSTypeLiteral(members: TSTypeElement[]): TSTypeLiteral; +export function TSTypeOperator(typeAnnotation: TSType): TSTypeOperator; +export function TSTypeParameter(constraint?: TSType, default_?: TSType): TSTypeParameter; +export function TSTypeParameterDeclaration(params: TSTypeParameter[]): TSTypeParameterDeclaration; +export function TSTypeParameterInstantiation(params: TSType[]): TSTypeParameterInstantiation; +export function TSTypePredicate(parameterName: Identifier | TSThisType, typeAnnotation: TSTypeAnnotation): TSTypePredicate; +export function TSTypeQuery(exprName: TSEntityName): TSTypeQuery; +export function TSTypeReference(typeName: TSEntityName, typeParameters?: TypeParameterInstantiation): TSTypeReference; +export function TSUndefinedKeyword(): TSUndefinedKeyword; +export function TSUnionType(types: TSType[]): TSUnionType; +export function TSVoidKeyword(): TSVoidKeyword; + +export function isArrayExpression(node: object, opts?: object): node is ArrayExpression; +export function isAssignmentExpression(node: object, opts?: object): node is AssignmentExpression; +export function isBinaryExpression(node: object, opts?: object): node is BinaryExpression; +export function isDirective(node: object, opts?: object): node is Directive; +export function isDirectiveLiteral(node: object, opts?: object): node is DirectiveLiteral; +export function isBlockStatement(node: object, opts?: object): node is BlockStatement; +export function isBreakStatement(node: object, opts?: object): node is BreakStatement; +export function isCallExpression(node: object, opts?: object): node is CallExpression; +export function isCatchClause(node: object, opts?: object): node is CatchClause; +export function isConditionalExpression(node: object, opts?: object): node is ConditionalExpression; +export function isContinueStatement(node: object, opts?: object): node is ContinueStatement; +export function isDebuggerStatement(node: object, opts?: object): node is DebuggerStatement; +export function isDoWhileStatement(node: object, opts?: object): node is DoWhileStatement; +export function isEmptyStatement(node: object, opts?: object): node is EmptyStatement; +export function isExpressionStatement(node: object, opts?: object): node is ExpressionStatement; +export function isFile(node: object, opts?: object): node is File; +export function isForInStatement(node: object, opts?: object): node is ForInStatement; +export function isForStatement(node: object, opts?: object): node is ForStatement; +export function isFunctionDeclaration(node: object, opts?: object): node is FunctionDeclaration; +export function isFunctionExpression(node: object, opts?: object): node is FunctionExpression; +export function isIdentifier(node: object, opts?: object): node is Identifier; +export function isIfStatement(node: object, opts?: object): node is IfStatement; +export function isLabeledStatement(node: object, opts?: object): node is LabeledStatement; +export function isStringLiteral(node: object, opts?: object): node is StringLiteral; +export function isNumericLiteral(node: object, opts?: object): node is NumericLiteral; +export function isNullLiteral(node: object, opts?: object): node is NullLiteral; +export function isBooleanLiteral(node: object, opts?: object): node is BooleanLiteral; +export function isRegExpLiteral(node: object, opts?: object): node is RegExpLiteral; +export function isLogicalExpression(node: object, opts?: object): node is LogicalExpression; +export function isMemberExpression(node: object, opts?: object): node is MemberExpression; +export function isNewExpression(node: object, opts?: object): node is NewExpression; +export function isProgram(node: object, opts?: object): node is Program; +export function isObjectExpression(node: object, opts?: object): node is ObjectExpression; +export function isObjectMethod(node: object, opts?: object): node is ObjectMethod; +export function isObjectProperty(node: object, opts?: object): node is ObjectProperty; +export function isRestElement(node: object, opts?: object): node is RestElement; +export function isReturnStatement(node: object, opts?: object): node is ReturnStatement; +export function isSequenceExpression(node: object, opts?: object): node is SequenceExpression; +export function isSwitchCase(node: object, opts?: object): node is SwitchCase; +export function isSwitchStatement(node: object, opts?: object): node is SwitchStatement; +export function isThisExpression(node: object, opts?: object): node is ThisExpression; +export function isThrowStatement(node: object, opts?: object): node is ThrowStatement; +export function isTryStatement(node: object, opts?: object): node is TryStatement; +export function isUnaryExpression(node: object, opts?: object): node is UnaryExpression; +export function isUpdateExpression(node: object, opts?: object): node is UpdateExpression; +export function isVariableDeclaration(node: object, opts?: object): node is VariableDeclaration; +export function isVariableDeclarator(node: object, opts?: object): node is VariableDeclarator; +export function isWhileStatement(node: object, opts?: object): node is WhileStatement; +export function isWithStatement(node: object, opts?: object): node is WithStatement; +export function isAssignmentPattern(node: object, opts?: object): node is AssignmentPattern; +export function isArrayPattern(node: object, opts?: object): node is ArrayPattern; +export function isArrowFunctionExpression(node: object, opts?: object): node is ArrowFunctionExpression; +export function isClassBody(node: object, opts?: object): node is ClassBody; +export function isClassDeclaration(node: object, opts?: object): node is ClassDeclaration; +export function isClassExpression(node: object, opts?: object): node is ClassExpression; +export function isExportAllDeclaration(node: object, opts?: object): node is ExportAllDeclaration; +export function isExportDefaultDeclaration(node: object, opts?: object): node is ExportDefaultDeclaration; +export function isExportNamedDeclaration(node: object, opts?: object): node is ExportNamedDeclaration; +export function isExportSpecifier(node: object, opts?: object): node is ExportSpecifier; +export function isForOfStatement(node: object, opts?: object): node is ForOfStatement; +export function isImportDeclaration(node: object, opts?: object): node is ImportDeclaration; +export function isImportDefaultSpecifier(node: object, opts?: object): node is ImportDefaultSpecifier; +export function isImportNamespaceSpecifier(node: object, opts?: object): node is ImportNamespaceSpecifier; +export function isImportSpecifier(node: object, opts?: object): node is ImportSpecifier; +export function isMetaProperty(node: object, opts?: object): node is MetaProperty; +export function isClassMethod(node: object, opts?: object): node is ClassMethod; +export function isObjectPattern(node: object, opts?: object): node is ObjectPattern; +export function isSpreadElement(node: object, opts?: object): node is SpreadElement; +export function isSuper(node: object, opts?: object): node is Super; +export function isTaggedTemplateExpression(node: object, opts?: object): node is TaggedTemplateExpression; +export function isTemplateElement(node: object, opts?: object): node is TemplateElement; +export function isTemplateLiteral(node: object, opts?: object): node is TemplateLiteral; +export function isYieldExpression(node: object, opts?: object): node is YieldExpression; +export function isAnyTypeAnnotation(node: object, opts?: object): node is AnyTypeAnnotation; +export function isArrayTypeAnnotation(node: object, opts?: object): node is ArrayTypeAnnotation; +export function isBooleanTypeAnnotation(node: object, opts?: object): node is BooleanTypeAnnotation; +export function isBooleanLiteralTypeAnnotation(node: object, opts?: object): node is BooleanLiteralTypeAnnotation; +export function isNullLiteralTypeAnnotation(node: object, opts?: object): node is NullLiteralTypeAnnotation; +export function isClassImplements(node: object, opts?: object): node is ClassImplements; +export function isClassProperty(node: object, opts?: object): node is ClassProperty; +export function isDeclareClass(node: object, opts?: object): node is DeclareClass; +export function isDeclareFunction(node: object, opts?: object): node is DeclareFunction; +export function isDeclareInterface(node: object, opts?: object): node is DeclareInterface; +export function isDeclareModule(node: object, opts?: object): node is DeclareModule; +export function isDeclareTypeAlias(node: object, opts?: object): node is DeclareTypeAlias; +export function isDeclareVariable(node: object, opts?: object): node is DeclareVariable; +export function isExistentialTypeParam(node: object, opts?: object): node is ExistentialTypeParam; +export function isFunctionTypeAnnotation(node: object, opts?: object): node is FunctionTypeAnnotation; +export function isFunctionTypeParam(node: object, opts?: object): node is FunctionTypeParam; +export function isGenericTypeAnnotation(node: object, opts?: object): node is GenericTypeAnnotation; +export function isInterfaceExtends(node: object, opts?: object): node is InterfaceExtends; +export function isInterfaceDeclaration(node: object, opts?: object): node is InterfaceDeclaration; +export function isIntersectionTypeAnnotation(node: object, opts?: object): node is IntersectionTypeAnnotation; +export function isMixedTypeAnnotation(node: object, opts?: object): node is MixedTypeAnnotation; +export function isNullableTypeAnnotation(node: object, opts?: object): node is NullableTypeAnnotation; +export function isNumericLiteralTypeAnnotation(node: object, opts?: object): node is NumericLiteralTypeAnnotation; +export function isNumberTypeAnnotation(node: object, opts?: object): node is NumberTypeAnnotation; +export function isStringLiteralTypeAnnotation(node: object, opts?: object): node is StringLiteralTypeAnnotation; +export function isStringTypeAnnotation(node: object, opts?: object): node is StringTypeAnnotation; +export function isThisTypeAnnotation(node: object, opts?: object): node is ThisTypeAnnotation; +export function isTupleTypeAnnotation(node: object, opts?: object): node is TupleTypeAnnotation; +export function isTypeofTypeAnnotation(node: object, opts?: object): node is TypeofTypeAnnotation; +export function isTypeAlias(node: object, opts?: object): node is TypeAlias; +export function isTypeAnnotation(node: object, opts?: object): node is TypeAnnotation; +export function isTypeCastExpression(node: object, opts?: object): node is TypeCastExpression; +export function isTypeParameter(node: object, opts?: object): node is TypeParameter; +export function isTypeParameterDeclaration(node: object, opts?: object): node is TypeParameterDeclaration; +export function isTypeParameterInstantiation(node: object, opts?: object): node is TypeParameterInstantiation; +export function isObjectTypeAnnotation(node: object, opts?: object): node is ObjectTypeAnnotation; +export function isObjectTypeCallProperty(node: object, opts?: object): node is ObjectTypeCallProperty; +export function isObjectTypeIndexer(node: object, opts?: object): node is ObjectTypeIndexer; +export function isObjectTypeProperty(node: object, opts?: object): node is ObjectTypeProperty; +export function isQualifiedTypeIdentifier(node: object, opts?: object): node is QualifiedTypeIdentifier; +export function isUnionTypeAnnotation(node: object, opts?: object): node is UnionTypeAnnotation; +export function isVoidTypeAnnotation(node: object, opts?: object): node is VoidTypeAnnotation; +export function isJSXAttribute(node: object, opts?: object): node is JSXAttribute; +export function isJSXClosingElement(node: object, opts?: object): node is JSXClosingElement; +export function isJSXElement(node: object, opts?: object): node is JSXElement; +export function isJSXEmptyExpression(node: object, opts?: object): node is JSXEmptyExpression; +export function isJSXExpressionContainer(node: object, opts?: object): node is JSXExpressionContainer; +export function isJSXIdentifier(node: object, opts?: object): node is JSXIdentifier; +export function isJSXMemberExpression(node: object, opts?: object): node is JSXMemberExpression; +export function isJSXNamespacedName(node: object, opts?: object): node is JSXNamespacedName; +export function isJSXOpeningElement(node: object, opts?: object): node is JSXOpeningElement; +export function isJSXSpreadAttribute(node: object, opts?: object): node is JSXSpreadAttribute; +export function isJSXText(node: object, opts?: object): node is JSXText; +export function isNoop(node: object, opts?: object): node is Noop; +export function isParenthesizedExpression(node: object, opts?: object): node is ParenthesizedExpression; +export function isAwaitExpression(node: object, opts?: object): node is AwaitExpression; +export function isBindExpression(node: object, opts?: object): node is BindExpression; +export function isDecorator(node: object, opts?: object): node is Decorator; +export function isDoExpression(node: object, opts?: object): node is DoExpression; +export function isExportDefaultSpecifier(node: object, opts?: object): node is ExportDefaultSpecifier; +export function isExportNamespaceSpecifier(node: object, opts?: object): node is ExportNamespaceSpecifier; +export function isRestProperty(node: object, opts?: object): node is RestProperty; +export function isSpreadProperty(node: object, opts?: object): node is SpreadProperty; +export function isExpression(node: object, opts?: object): node is Expression; +export function isBinary(node: object, opts?: object): node is Binary; +export function isScopable(node: object, opts?: object): node is Scopable; +export function isBlockParent(node: object, opts?: object): node is BlockParent; +export function isBlock(node: object, opts?: object): node is Block; +export function isStatement(node: object, opts?: object): node is Statement; +export function isTerminatorless(node: object, opts?: object): node is Terminatorless; +export function isCompletionStatement(node: object, opts?: object): node is CompletionStatement; +export function isConditional(node: object, opts?: object): node is Conditional; +export function isLoop(node: object, opts?: object): node is Loop; +export function isWhile(node: object, opts?: object): node is While; +export function isExpressionWrapper(node: object, opts?: object): node is ExpressionWrapper; +export function isFor(node: object, opts?: object): node is For; +export function isForXStatement(node: object, opts?: object): node is ForXStatement; +// tslint:disable-next-line ban-types +export function isFunction(node: object, opts?: object): node is Function; +export function isFunctionParent(node: object, opts?: object): node is FunctionParent; +export function isPureish(node: object, opts?: object): node is Pureish; +export function isDeclaration(node: object, opts?: object): node is Declaration; +export function isLVal(node: object, opts?: object): node is LVal; +export function isLiteral(node: object, opts?: object): node is Literal; +export function isImmutable(node: object, opts?: object): node is Immutable; +export function isUserWhitespacable(node: object, opts?: object): node is UserWhitespacable; +export function isMethod(node: object, opts?: object): node is Method; +export function isObjectMember(node: object, opts?: object): node is ObjectMember; +export function isProperty(node: object, opts?: object): node is Property; +export function isUnaryLike(node: object, opts?: object): node is UnaryLike; +export function isPattern(node: object, opts?: object): node is Pattern; +export function isClass(node: object, opts?: object): node is Class; +export function isModuleDeclaration(node: object, opts?: object): node is ModuleDeclaration; +export function isExportDeclaration(node: object, opts?: object): node is ExportDeclaration; +export function isModuleSpecifier(node: object, opts?: object): node is ModuleSpecifier; +export function isFlow(node: object, opts?: object): node is Flow; +export function isFlowBaseAnnotation(node: object, opts?: object): node is FlowBaseAnnotation; +export function isFlowDeclaration(node: object, opts?: object): node is FlowDeclaration; +export function isJSX(node: object, opts?: object): node is JSX; +export function isNumberLiteral(node: object, opts?: object): node is NumericLiteral; +export function isRegexLiteral(node: object, opts?: object): node is RegExpLiteral; + +export function isReferencedIdentifier(node: object, opts?: object): node is Identifier | JSXIdentifier; +export function isReferencedMemberExpression(node: object, opts?: object): node is MemberExpression; +export function isBindingIdentifier(node: object, opts?: object): node is Identifier; +export function isScope(node: object, opts?: object): node is Scopable; +export function isReferenced(node: object, opts?: object): boolean; +export function isBlockScoped(node: object, opts?: object): node is FunctionDeclaration | ClassDeclaration | VariableDeclaration; +export function isVar(node: object, opts?: object): node is VariableDeclaration; +export function isUser(node: object, opts?: object): boolean; +export function isGenerated(node: object, opts?: object): boolean; +export function isPure(node: object, opts?: object): boolean; + +export function isTSAnyKeyword(node: object, opts?: object): node is TSAnyKeyword; +export function isTSArrayType(node: object, opts?: object): node is TSArrayType; +export function isTSAsExpression(node: object, opts?: object): node is TSAsExpression; +export function isTSBooleanKeyword(node: object, opts?: object): node is TSBooleanKeyword; +export function isTSCallSignatureDeclaration(node: object, opts?: object): node is TSCallSignatureDeclaration; +export function isTSConstructSignatureDeclaration(node: object, opts?: object): node is TSTypeElement; +export function isTSConstructorType(node: object, opts?: object): node is TSConstructorType; +export function isTSDeclareFunction(node: object, opts?: object): node is TSDeclareFunction; +export function isTSDeclareMethod(node: object, opts?: object): node is TSDeclareMethod; +export function isTSEnumDeclaration(node: object, opts?: object): node is TSEnumDeclaration; +export function isTSEnumMember(node: object, opts?: object): node is TSEnumMember; +export function isTSExportAssignment(node: object, opts?: object): node is TSExportAssignment; +export function isTSExpressionWithTypeArguments(node: object, opts?: object): node is TSExpressionWithTypeArguments; +export function isTSExternalModuleReference(node: object, opts?: object): node is TSExternalModuleReference; +export function isTSFunctionType(node: object, opts?: object): node is TSFunctionType; +export function isTSImportEqualsDeclaration(node: object, opts?: object): node is TSImportEqualsDeclaration; +export function isTSIndexSignature(node: object, opts?: object): node is TSIndexSignature; +export function isTSIndexedAccessType(node: object, opts?: object): node is TSIndexedAccessType; +export function isTSInterfaceBody(node: object, opts?: object): node is TSInterfaceBody; +export function isTSInterfaceDeclaration(node: object, opts?: object): node is TSInterfaceDeclaration; +export function isTSIntersectionType(node: object, opts?: object): node is TSIntersectionType; +export function isTSLiteralType(node: object, opts?: object): node is TSLiteralType; +export function isTSMappedType(node: object, opts?: object): node is TSMappedType; +export function isTSMethodSignature(node: object, opts?: object): node is TSMethodSignature; +export function isTSModuleBlock(node: object, opts?: object): node is TSModuleBlock; +export function isTSModuleDeclaration(node: object, opts?: object): node is TSModuleDeclaration; +export function isTSNamespaceExportDeclaration(node: object, opts?: object): node is TSNamespaceExportDeclaration; +export function isTSNeverKeyword(node: object, opts?: object): node is TSNeverKeyword; +export function isTSNonNullExpression(node: object, opts?: object): node is TSNonNullExpression; +export function isTSNullKeyword(node: object, opts?: object): node is TSNullKeyword; +export function isTSNumberKeyword(node: object, opts?: object): node is TSNumberKeyword; +export function isTSObjectKeyword(node: object, opts?: object): node is TSObjectKeyword; +export function isTSParameterProperty(node: object, opts?: object): node is TSParameterProperty; +export function isTSParenthesizedType(node: object, opts?: object): node is TSParenthesizedType; +export function isTSPropertySignature(node: object, opts?: object): node is TSPropertySignature; +export function isTSQualifiedName(node: object, opts?: object): node is TSQualifiedName; +export function isTSStringKeyword(node: object, opts?: object): node is TSStringKeyword; +export function isTSSymbolKeyword(node: object, opts?: object): node is TSSymbolKeyword; +export function isTSThisType(node: object, opts?: object): node is TSThisType; +export function isTSTupleType(node: object, opts?: object): node is TSTupleType; +export function isTSTypeAliasDeclaration(node: object, opts?: object): node is TSTypeAliasDeclaration; +export function isTSTypeAnnotation(node: object, opts?: object): node is TSTypeAnnotation; +export function isTSTypeAssertion(node: object, opts?: object): node is TSTypeAssertion; +export function isTSTypeLiteral(node: object, opts?: object): node is TSTypeLiteral; +export function isTSTypeOperator(node: object, opts?: object): node is TSTypeOperator; +export function isTSTypeParameter(node: object, opts?: object): node is TSTypeParameter; +export function isTSTypeParameterDeclaration(node: object, opts?: object): node is TSTypeParameterDeclaration; +export function isTSTypeParameterInstantiation(node: object, opts?: object): node is TSTypeParameterInstantiation; +export function isTSTypePredicate(node: object, opts?: object): node is TSTypePredicate; +export function isTSTypeQuery(node: object, opts?: object): node is TSTypeQuery; +export function isTSTypeReference(node: object, opts?: object): node is TSTypeReference; +export function isTSUndefinedKeyword(node: object, opts?: object): node is TSUndefinedKeyword; +export function isTSUnionType(node: object, opts?: object): node is TSUnionType; +export function isTSVoidKeyword(node: object, opts?: object): node is TSVoidKeyword; + +// React specific +export interface ReactHelpers { + isCompatTag(tagName?: string): boolean; + buildChildren(node: object): Node[]; +} +export const react: ReactHelpers; + +export function assertArrayExpression(node: object, opts?: object): void; +export function assertAssignmentExpression(node: object, opts?: object): void; +export function assertBinaryExpression(node: object, opts?: object): void; +export function assertDirective(node: object, opts?: object): void; +export function assertDirectiveLiteral(node: object, opts?: object): void; +export function assertBlockStatement(node: object, opts?: object): void; +export function assertBreakStatement(node: object, opts?: object): void; +export function assertCallExpression(node: object, opts?: object): void; +export function assertCatchClause(node: object, opts?: object): void; +export function assertConditionalExpression(node: object, opts?: object): void; +export function assertContinueStatement(node: object, opts?: object): void; +export function assertDebuggerStatement(node: object, opts?: object): void; +export function assertDoWhileStatement(node: object, opts?: object): void; +export function assertEmptyStatement(node: object, opts?: object): void; +export function assertExpressionStatement(node: object, opts?: object): void; +export function assertFile(node: object, opts?: object): void; +export function assertForInStatement(node: object, opts?: object): void; +export function assertForStatement(node: object, opts?: object): void; +export function assertFunctionDeclaration(node: object, opts?: object): void; +export function assertFunctionExpression(node: object, opts?: object): void; +export function assertIdentifier(node: object, opts?: object): void; +export function assertIfStatement(node: object, opts?: object): void; +export function assertLabeledStatement(node: object, opts?: object): void; +export function assertStringLiteral(node: object, opts?: object): void; +export function assertNumericLiteral(node: object, opts?: object): void; +export function assertNullLiteral(node: object, opts?: object): void; +export function assertBooleanLiteral(node: object, opts?: object): void; +export function assertRegExpLiteral(node: object, opts?: object): void; +export function assertLogicalExpression(node: object, opts?: object): void; +export function assertMemberExpression(node: object, opts?: object): void; +export function assertNewExpression(node: object, opts?: object): void; +export function assertProgram(node: object, opts?: object): void; +export function assertObjectExpression(node: object, opts?: object): void; +export function assertObjectMethod(node: object, opts?: object): void; +export function assertObjectProperty(node: object, opts?: object): void; +export function assertRestElement(node: object, opts?: object): void; +export function assertReturnStatement(node: object, opts?: object): void; +export function assertSequenceExpression(node: object, opts?: object): void; +export function assertSwitchCase(node: object, opts?: object): void; +export function assertSwitchStatement(node: object, opts?: object): void; +export function assertThisExpression(node: object, opts?: object): void; +export function assertThrowStatement(node: object, opts?: object): void; +export function assertTryStatement(node: object, opts?: object): void; +export function assertUnaryExpression(node: object, opts?: object): void; +export function assertUpdateExpression(node: object, opts?: object): void; +export function assertVariableDeclaration(node: object, opts?: object): void; +export function assertVariableDeclarator(node: object, opts?: object): void; +export function assertWhileStatement(node: object, opts?: object): void; +export function assertWithStatement(node: object, opts?: object): void; +export function assertAssignmentPattern(node: object, opts?: object): void; +export function assertArrayPattern(node: object, opts?: object): void; +export function assertArrowFunctionExpression(node: object, opts?: object): void; +export function assertClassBody(node: object, opts?: object): void; +export function assertClassDeclaration(node: object, opts?: object): void; +export function assertClassExpression(node: object, opts?: object): void; +export function assertExportAllDeclaration(node: object, opts?: object): void; +export function assertExportDefaultDeclaration(node: object, opts?: object): void; +export function assertExportNamedDeclaration(node: object, opts?: object): void; +export function assertExportSpecifier(node: object, opts?: object): void; +export function assertForOfStatement(node: object, opts?: object): void; +export function assertImportDeclaration(node: object, opts?: object): void; +export function assertImportDefaultSpecifier(node: object, opts?: object): void; +export function assertImportNamespaceSpecifier(node: object, opts?: object): void; +export function assertImportSpecifier(node: object, opts?: object): void; +export function assertMetaProperty(node: object, opts?: object): void; +export function assertClassMethod(node: object, opts?: object): void; +export function assertObjectPattern(node: object, opts?: object): void; +export function assertSpreadElement(node: object, opts?: object): void; +export function assertSuper(node: object, opts?: object): void; +export function assertTaggedTemplateExpression(node: object, opts?: object): void; +export function assertTemplateElement(node: object, opts?: object): void; +export function assertTemplateLiteral(node: object, opts?: object): void; +export function assertYieldExpression(node: object, opts?: object): void; +export function assertAnyTypeAnnotation(node: object, opts?: object): void; +export function assertArrayTypeAnnotation(node: object, opts?: object): void; +export function assertBooleanTypeAnnotation(node: object, opts?: object): void; +export function assertBooleanLiteralTypeAnnotation(node: object, opts?: object): void; +export function assertNullLiteralTypeAnnotation(node: object, opts?: object): void; +export function assertClassImplements(node: object, opts?: object): void; +export function assertClassProperty(node: object, opts?: object): void; +export function assertDeclareClass(node: object, opts?: object): void; +export function assertDeclareFunction(node: object, opts?: object): void; +export function assertDeclareInterface(node: object, opts?: object): void; +export function assertDeclareModule(node: object, opts?: object): void; +export function assertDeclareTypeAlias(node: object, opts?: object): void; +export function assertDeclareVariable(node: object, opts?: object): void; +export function assertExistentialTypeParam(node: object, opts?: object): void; +export function assertFunctionTypeAnnotation(node: object, opts?: object): void; +export function assertFunctionTypeParam(node: object, opts?: object): void; +export function assertGenericTypeAnnotation(node: object, opts?: object): void; +export function assertInterfaceExtends(node: object, opts?: object): void; +export function assertInterfaceDeclaration(node: object, opts?: object): void; +export function assertIntersectionTypeAnnotation(node: object, opts?: object): void; +export function assertMixedTypeAnnotation(node: object, opts?: object): void; +export function assertNullableTypeAnnotation(node: object, opts?: object): void; +export function assertNumericLiteralTypeAnnotation(node: object, opts?: object): void; +export function assertNumberTypeAnnotation(node: object, opts?: object): void; +export function assertStringLiteralTypeAnnotation(node: object, opts?: object): void; +export function assertStringTypeAnnotation(node: object, opts?: object): void; +export function assertThisTypeAnnotation(node: object, opts?: object): void; +export function assertTupleTypeAnnotation(node: object, opts?: object): void; +export function assertTypeofTypeAnnotation(node: object, opts?: object): void; +export function assertTypeAlias(node: object, opts?: object): void; +export function assertTypeAnnotation(node: object, opts?: object): void; +export function assertTypeCastExpression(node: object, opts?: object): void; +export function assertTypeParameter(node: object, opts?: object): void; +export function assertTypeParameterDeclaration(node: object, opts?: object): void; +export function assertTypeParameterInstantiation(node: object, opts?: object): void; +export function assertObjectTypeAnnotation(node: object, opts?: object): void; +export function assertObjectTypeCallProperty(node: object, opts?: object): void; +export function assertObjectTypeIndexer(node: object, opts?: object): void; +export function assertObjectTypeProperty(node: object, opts?: object): void; +export function assertQualifiedTypeIdentifier(node: object, opts?: object): void; +export function assertUnionTypeAnnotation(node: object, opts?: object): void; +export function assertVoidTypeAnnotation(node: object, opts?: object): void; +export function assertJSXAttribute(node: object, opts?: object): void; +export function assertJSXClosingElement(node: object, opts?: object): void; +export function assertJSXElement(node: object, opts?: object): void; +export function assertJSXEmptyExpression(node: object, opts?: object): void; +export function assertJSXExpressionContainer(node: object, opts?: object): void; +export function assertJSXIdentifier(node: object, opts?: object): void; +export function assertJSXMemberExpression(node: object, opts?: object): void; +export function assertJSXNamespacedName(node: object, opts?: object): void; +export function assertJSXOpeningElement(node: object, opts?: object): void; +export function assertJSXSpreadAttribute(node: object, opts?: object): void; +export function assertJSXText(node: object, opts?: object): void; +export function assertNoop(node: object, opts?: object): void; +export function assertParenthesizedExpression(node: object, opts?: object): void; +export function assertAwaitExpression(node: object, opts?: object): void; +export function assertBindExpression(node: object, opts?: object): void; +export function assertDecorator(node: object, opts?: object): void; +export function assertDoExpression(node: object, opts?: object): void; +export function assertExportDefaultSpecifier(node: object, opts?: object): void; +export function assertExportNamespaceSpecifier(node: object, opts?: object): void; +export function assertRestProperty(node: object, opts?: object): void; +export function assertSpreadProperty(node: object, opts?: object): void; +export function assertExpression(node: object, opts?: object): void; +export function assertBinary(node: object, opts?: object): void; +export function assertScopable(node: object, opts?: object): void; +export function assertBlockParent(node: object, opts?: object): void; +export function assertBlock(node: object, opts?: object): void; +export function assertStatement(node: object, opts?: object): void; +export function assertTerminatorless(node: object, opts?: object): void; +export function assertCompletionStatement(node: object, opts?: object): void; +export function assertConditional(node: object, opts?: object): void; +export function assertLoop(node: object, opts?: object): void; +export function assertWhile(node: object, opts?: object): void; +export function assertExpressionWrapper(node: object, opts?: object): void; +export function assertFor(node: object, opts?: object): void; +export function assertForXStatement(node: object, opts?: object): void; +export function assertFunction(node: object, opts?: object): void; +export function assertFunctionParent(node: object, opts?: object): void; +export function assertPureish(node: object, opts?: object): void; +export function assertDeclaration(node: object, opts?: object): void; +export function assertLVal(node: object, opts?: object): void; +export function assertLiteral(node: object, opts?: object): void; +export function assertImmutable(node: object, opts?: object): void; +export function assertUserWhitespacable(node: object, opts?: object): void; +export function assertMethod(node: object, opts?: object): void; +export function assertObjectMember(node: object, opts?: object): void; +export function assertProperty(node: object, opts?: object): void; +export function assertUnaryLike(node: object, opts?: object): void; +export function assertPattern(node: object, opts?: object): void; +export function assertClass(node: object, opts?: object): void; +export function assertModuleDeclaration(node: object, opts?: object): void; +export function assertExportDeclaration(node: object, opts?: object): void; +export function assertModuleSpecifier(node: object, opts?: object): void; +export function assertFlow(node: object, opts?: object): void; +export function assertFlowBaseAnnotation(node: object, opts?: object): void; +export function assertFlowDeclaration(node: object, opts?: object): void; +export function assertJSX(node: object, opts?: object): void; +export function assertNumberLiteral(node: object, opts?: object): void; +export function assertRegexLiteral(node: object, opts?: object): void; + +export function assertTSAnyKeyword(node: object, opts?: object): void; +export function assertTSArrayType(node: object, opts?: object): void; +export function assertTSAsExpression(node: object, opts?: object): void; +export function assertTSBooleanKeyword(node: object, opts?: object): void; +export function assertTSCallSignatureDeclaration(node: object, opts?: object): void; +export function assertTSConstructSignatureDeclaration(node: object, opts?: object): void; +export function assertTSConstructorType(node: object, opts?: object): void; +export function assertTSDeclareFunction(node: object, opts?: object): void; +export function assertTSDeclareMethod(node: object, opts?: object): void; +export function assertTSEnumDeclaration(node: object, opts?: object): void; +export function assertTSEnumMember(node: object, opts?: object): void; +export function assertTSExportAssignment(node: object, opts?: object): void; +export function assertTSExpressionWithTypeArguments(node: object, opts?: object): void; +export function assertTSExternalModuleReference(node: object, opts?: object): void; +export function assertTSFunctionType(node: object, opts?: object): void; +export function assertTSImportEqualsDeclaration(node: object, opts?: object): void; +export function assertTSIndexSignature(node: object, opts?: object): void; +export function assertTSIndexedAccessType(node: object, opts?: object): void; +export function assertTSInterfaceBody(node: object, opts?: object): void; +export function assertTSInterfaceDeclaration(node: object, opts?: object): void; +export function assertTSIntersectionType(node: object, opts?: object): void; +export function assertTSLiteralType(node: object, opts?: object): void; +export function assertTSMappedType(node: object, opts?: object): void; +export function assertTSMethodSignature(node: object, opts?: object): void; +export function assertTSModuleBlock(node: object, opts?: object): void; +export function assertTSModuleDeclaration(node: object, opts?: object): void; +export function assertTSNamespaceExportDeclaration(node: object, opts?: object): void; +export function assertTSNeverKeyword(node: object, opts?: object): void; +export function assertTSNonNullExpression(node: object, opts?: object): void; +export function assertTSNullKeyword(node: object, opts?: object): void; +export function assertTSNumberKeyword(node: object, opts?: object): void; +export function assertTSObjectKeyword(node: object, opts?: object): void; +export function assertTSParameterProperty(node: object, opts?: object): void; +export function assertTSParenthesizedType(node: object, opts?: object): void; +export function assertTSPropertySignature(node: object, opts?: object): void; +export function assertTSQualifiedName(node: object, opts?: object): void; +export function assertTSStringKeyword(node: object, opts?: object): void; +export function assertTSSymbolKeyword(node: object, opts?: object): void; +export function assertTSThisType(node: object, opts?: object): void; +export function assertTSTupleType(node: object, opts?: object): void; +export function assertTSTypeAliasDeclaration(node: object, opts?: object): void; +export function assertTSTypeAnnotation(node: object, opts?: object): void; +export function assertTSTypeAssertion(node: object, opts?: object): void; +export function assertTSTypeLiteral(node: object, opts?: object): void; +export function assertTSTypeOperator(node: object, opts?: object): void; +export function assertTSTypeParameter(node: object, opts?: object): void; +export function assertTSTypeParameterDeclaration(node: object, opts?: object): void; +export function assertTSTypeParameterInstantiation(node: object, opts?: object): void; +export function assertTSTypePredicate(node: object, opts?: object): void; +export function assertTSTypeQuery(node: object, opts?: object): void; +export function assertTSTypeReference(node: object, opts?: object): void; +export function assertTSUndefinedKeyword(node: object, opts?: object): void; +export function assertTSUnionType(node: object, opts?: object): void; +export function assertTSVoidKeyword(node: object, opts?: object): void; diff --git a/node_modules/@types/babel-types/package.json b/node_modules/@types/babel-types/package.json new file mode 100644 index 0000000..5a29fbf --- /dev/null +++ b/node_modules/@types/babel-types/package.json @@ -0,0 +1,60 @@ +{ + "_from": "@types/babel-types@^7.0.0", + "_id": "@types/babel-types@7.0.1", + "_inBundle": false, + "_integrity": "sha512-EkcOk09rjhivbovP8WreGRbXW20YRfe/qdgXOGq3it3u3aAOWDRNsQhL/XPAWFF7zhZZ+uR+nT+3b+TCkIap1w==", + "_location": "/@types/babel-types", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@types/babel-types@^7.0.0", + "name": "@types/babel-types", + "escapedName": "@types%2fbabel-types", + "scope": "@types", + "rawSpec": "^7.0.0", + "saveSpec": null, + "fetchSpec": "^7.0.0" + }, + "_requiredBy": [ + "/@types/babylon", + "/constantinople" + ], + "_resolved": "https://registry.npmjs.org/@types/babel-types/-/babel-types-7.0.1.tgz", + "_shasum": "1405e5396968c4302994b0161ce405b72b874257", + "_spec": "@types/babel-types@^7.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/constantinople", + "bundleDependencies": false, + "contributors": [ + { + "name": "Troy Gerwien", + "url": "https://github.com/yortus" + }, + { + "name": "Sam Baxter", + "url": "https://github.com/baxtersa" + }, + { + "name": "Marvin Hagemeister", + "url": "https://github.com/marvinhagemeister" + }, + { + "name": "Boris Cherny", + "url": "https://github.com/bcherny" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "TypeScript definitions for babel-types", + "license": "MIT", + "main": "", + "name": "@types/babel-types", + "repository": { + "type": "git", + "url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" + }, + "scripts": {}, + "typeScriptVersion": "2.3", + "typesPublisherContentHash": "a5de1a38d3cceab0881836704a5b7070940f5517f6e7265ba7b112b898b44d40", + "version": "7.0.1" +} diff --git a/node_modules/@types/babylon/LICENSE b/node_modules/@types/babylon/LICENSE new file mode 100644 index 0000000..4b1ad51 --- /dev/null +++ b/node_modules/@types/babylon/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/babylon/README.md b/node_modules/@types/babylon/README.md new file mode 100644 index 0000000..471d7d1 --- /dev/null +++ b/node_modules/@types/babylon/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/babylon` + +# Summary +This package contains type definitions for babylon (https://github.com/babel/babylon). + +# Details +Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babylon + +Additional Details + * Last updated: Thu, 20 Jul 2017 13:50:42 GMT + * Dependencies: babel-types + * Global values: none + +# Credits +These definitions were written by Troy Gerwien , Marvin Hagemeister . diff --git a/node_modules/@types/babylon/index.d.ts b/node_modules/@types/babylon/index.d.ts new file mode 100644 index 0000000..8943605 --- /dev/null +++ b/node_modules/@types/babylon/index.d.ts @@ -0,0 +1,58 @@ +// Type definitions for babylon 6.16 +// Project: https://github.com/babel/babylon +// Definitions by: Troy Gerwien +// Marvin Hagemeister +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { File, Expression } from 'babel-types'; + +export function parse(code: string, opts?: BabylonOptions): File; + +export function parseExpression(input: string, options?: BabylonOptions): Expression; + +export interface BabylonOptions { + /** + * 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. + */ + allowImportExportEverywhere?: boolean; + + /** + * By default, a return statement at the top level raises an error. Set this to true to accept such code. + */ + allowReturnOutsideFunction?: boolean; + + allowSuperOutsideMethod?: boolean; + + /** + * Indicate the mode the code should be parsed in. Can be either "script" or "module". + */ + sourceType?: 'script' | 'module'; + + /** + * Correlate output AST nodes with their source filename. Useful when + * generating code and source maps from the ASTs of multiple input files. + */ + sourceFilename?: string; + + /** + * Array containing the plugins that you want to enable. + */ + plugins?: PluginName[]; +} + +export type PluginName = + 'estree' | + 'jsx' | + 'flow' | + 'classConstructorCall' | + 'doExpressions' | + 'objectRestSpread' | + 'decorators' | + 'classProperties' | + 'exportExtensions' | + 'asyncGenerators' | + 'functionBind' | + 'functionSent' | + 'dynamicImport'; diff --git a/node_modules/@types/babylon/package.json b/node_modules/@types/babylon/package.json new file mode 100644 index 0000000..bbfbb10 --- /dev/null +++ b/node_modules/@types/babylon/package.json @@ -0,0 +1,54 @@ +{ + "_from": "@types/babylon@^6.16.2", + "_id": "@types/babylon@6.16.2", + "_inBundle": false, + "_integrity": "sha512-+Jty46mPaWe1VAyZbfvgJM4BAdklLWxrT5tc/RjvCgLrtk6gzRY6AOnoWFv4p6hVxhJshDdr2hGVn56alBp97Q==", + "_location": "/@types/babylon", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@types/babylon@^6.16.2", + "name": "@types/babylon", + "escapedName": "@types%2fbabylon", + "scope": "@types", + "rawSpec": "^6.16.2", + "saveSpec": null, + "fetchSpec": "^6.16.2" + }, + "_requiredBy": [ + "/constantinople" + ], + "_resolved": "https://registry.npmjs.org/@types/babylon/-/babylon-6.16.2.tgz", + "_shasum": "062ce63b693d9af1c246f5aedf928bc9c30589c8", + "_spec": "@types/babylon@^6.16.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/constantinople", + "bundleDependencies": false, + "contributors": [ + { + "name": "Troy Gerwien", + "url": "https://github.com/yortus" + }, + { + "name": "Marvin Hagemeister", + "url": "https://github.com/marvinhagemeister" + } + ], + "dependencies": { + "@types/babel-types": "*" + }, + "deprecated": false, + "description": "TypeScript definitions for babylon", + "license": "MIT", + "main": "", + "name": "@types/babylon", + "peerDependencies": {}, + "repository": { + "type": "git", + "url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" + }, + "scripts": {}, + "typeScriptVersion": "2.3", + "typesPublisherContentHash": "9db531ab1438202c176c2bf38211cdf5a4137d0e001bc1908e8ff3ee8317f237", + "version": "6.16.2" +} diff --git a/node_modules/abbrev/LICENSE b/node_modules/abbrev/LICENSE new file mode 100644 index 0000000..9bcfa9d --- /dev/null +++ b/node_modules/abbrev/LICENSE @@ -0,0 +1,46 @@ +This software is dual-licensed under the ISC and MIT licenses. +You may use this software under EITHER of the following licenses. + +---------- + +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. + +---------- + +Copyright Isaac Z. Schlueter and Contributors +All rights reserved. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/abbrev/README.md b/node_modules/abbrev/README.md new file mode 100644 index 0000000..99746fe --- /dev/null +++ b/node_modules/abbrev/README.md @@ -0,0 +1,23 @@ +# abbrev-js + +Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev). + +Usage: + + var abbrev = require("abbrev"); + abbrev("foo", "fool", "folding", "flop"); + + // returns: + { fl: 'flop' + , flo: 'flop' + , flop: 'flop' + , fol: 'folding' + , fold: 'folding' + , foldi: 'folding' + , foldin: 'folding' + , folding: 'folding' + , foo: 'foo' + , fool: 'fool' + } + +This is handy for command-line scripts, or other cases where you want to be able to accept shorthands. diff --git a/node_modules/abbrev/abbrev.js b/node_modules/abbrev/abbrev.js new file mode 100644 index 0000000..7b1dc5d --- /dev/null +++ b/node_modules/abbrev/abbrev.js @@ -0,0 +1,61 @@ +module.exports = exports = abbrev.abbrev = abbrev + +abbrev.monkeyPatch = monkeyPatch + +function monkeyPatch () { + Object.defineProperty(Array.prototype, 'abbrev', { + value: function () { return abbrev(this) }, + enumerable: false, configurable: true, writable: true + }) + + Object.defineProperty(Object.prototype, 'abbrev', { + value: function () { return abbrev(Object.keys(this)) }, + enumerable: false, configurable: true, writable: true + }) +} + +function abbrev (list) { + if (arguments.length !== 1 || !Array.isArray(list)) { + list = Array.prototype.slice.call(arguments, 0) + } + for (var i = 0, l = list.length, args = [] ; i < l ; i ++) { + args[i] = typeof list[i] === "string" ? list[i] : String(list[i]) + } + + // sort them lexicographically, so that they're next to their nearest kin + args = args.sort(lexSort) + + // walk through each, seeing how much it has in common with the next and previous + var abbrevs = {} + , prev = "" + for (var i = 0, l = args.length ; i < l ; i ++) { + var current = args[i] + , next = args[i + 1] || "" + , nextMatches = true + , prevMatches = true + if (current === next) continue + for (var j = 0, cl = current.length ; j < cl ; j ++) { + var curChar = current.charAt(j) + nextMatches = nextMatches && curChar === next.charAt(j) + prevMatches = prevMatches && curChar === prev.charAt(j) + if (!nextMatches && !prevMatches) { + j ++ + break + } + } + prev = current + if (j === cl) { + abbrevs[current] = current + continue + } + for (var a = current.substr(0, j) ; j <= cl ; j ++) { + abbrevs[a] = current + a += current.charAt(j) + } + } + return abbrevs +} + +function lexSort (a, b) { + return a === b ? 0 : a > b ? 1 : -1 +} diff --git a/node_modules/abbrev/package.json b/node_modules/abbrev/package.json new file mode 100644 index 0000000..2bd7e1d --- /dev/null +++ b/node_modules/abbrev/package.json @@ -0,0 +1,56 @@ +{ + "_from": "abbrev@1", + "_id": "abbrev@1.1.1", + "_inBundle": false, + "_integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "_location": "/abbrev", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "abbrev@1", + "name": "abbrev", + "escapedName": "abbrev", + "rawSpec": "1", + "saveSpec": null, + "fetchSpec": "1" + }, + "_requiredBy": [ + "/nopt" + ], + "_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "_shasum": "f8f2c887ad10bf67f634f005b6987fed3179aac8", + "_spec": "abbrev@1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/nopt", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me" + }, + "bugs": { + "url": "https://github.com/isaacs/abbrev-js/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Like ruby's abbrev module, but in js", + "devDependencies": { + "tap": "^10.1" + }, + "files": [ + "abbrev.js" + ], + "homepage": "https://github.com/isaacs/abbrev-js#readme", + "license": "ISC", + "main": "abbrev.js", + "name": "abbrev", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/isaacs/abbrev-js.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test.js --100" + }, + "version": "1.1.1" +} diff --git a/node_modules/accepts/HISTORY.md b/node_modules/accepts/HISTORY.md new file mode 100644 index 0000000..f16c17a --- /dev/null +++ b/node_modules/accepts/HISTORY.md @@ -0,0 +1,224 @@ +1.3.5 / 2018-02-28 +================== + + * deps: mime-types@~2.1.18 + - deps: mime-db@~1.33.0 + +1.3.4 / 2017-08-22 +================== + + * deps: mime-types@~2.1.16 + - deps: mime-db@~1.29.0 + +1.3.3 / 2016-05-02 +================== + + * deps: mime-types@~2.1.11 + - deps: mime-db@~1.23.0 + * deps: negotiator@0.6.1 + - perf: improve `Accept` parsing speed + - perf: improve `Accept-Charset` parsing speed + - perf: improve `Accept-Encoding` parsing speed + - perf: improve `Accept-Language` parsing speed + +1.3.2 / 2016-03-08 +================== + + * deps: mime-types@~2.1.10 + - Fix extension of `application/dash+xml` + - Update primary extension for `audio/mp4` + - deps: mime-db@~1.22.0 + +1.3.1 / 2016-01-19 +================== + + * deps: mime-types@~2.1.9 + - deps: mime-db@~1.21.0 + +1.3.0 / 2015-09-29 +================== + + * deps: mime-types@~2.1.7 + - deps: mime-db@~1.19.0 + * deps: negotiator@0.6.0 + - Fix including type extensions in parameters in `Accept` parsing + - Fix parsing `Accept` parameters with quoted equals + - Fix parsing `Accept` parameters with quoted semicolons + - Lazy-load modules from main entry point + - perf: delay type concatenation until needed + - perf: enable strict mode + - perf: hoist regular expressions + - perf: remove closures getting spec properties + - perf: remove a closure from media type parsing + - perf: remove property delete from media type parsing + +1.2.13 / 2015-09-06 +=================== + + * deps: mime-types@~2.1.6 + - deps: mime-db@~1.18.0 + +1.2.12 / 2015-07-30 +=================== + + * deps: mime-types@~2.1.4 + - deps: mime-db@~1.16.0 + +1.2.11 / 2015-07-16 +=================== + + * deps: mime-types@~2.1.3 + - deps: mime-db@~1.15.0 + +1.2.10 / 2015-07-01 +=================== + + * deps: mime-types@~2.1.2 + - deps: mime-db@~1.14.0 + +1.2.9 / 2015-06-08 +================== + + * deps: mime-types@~2.1.1 + - perf: fix deopt during mapping + +1.2.8 / 2015-06-07 +================== + + * deps: mime-types@~2.1.0 + - deps: mime-db@~1.13.0 + * perf: avoid argument reassignment & argument slice + * perf: avoid negotiator recursive construction + * perf: enable strict mode + * perf: remove unnecessary bitwise operator + +1.2.7 / 2015-05-10 +================== + + * deps: negotiator@0.5.3 + - Fix media type parameter matching to be case-insensitive + +1.2.6 / 2015-05-07 +================== + + * deps: mime-types@~2.0.11 + - deps: mime-db@~1.9.1 + * deps: negotiator@0.5.2 + - Fix comparing media types with quoted values + - Fix splitting media types with quoted commas + +1.2.5 / 2015-03-13 +================== + + * deps: mime-types@~2.0.10 + - deps: mime-db@~1.8.0 + +1.2.4 / 2015-02-14 +================== + + * Support Node.js 0.6 + * deps: mime-types@~2.0.9 + - deps: mime-db@~1.7.0 + * deps: negotiator@0.5.1 + - Fix preference sorting to be stable for long acceptable lists + +1.2.3 / 2015-01-31 +================== + + * deps: mime-types@~2.0.8 + - deps: mime-db@~1.6.0 + +1.2.2 / 2014-12-30 +================== + + * deps: mime-types@~2.0.7 + - deps: mime-db@~1.5.0 + +1.2.1 / 2014-12-30 +================== + + * deps: mime-types@~2.0.5 + - deps: mime-db@~1.3.1 + +1.2.0 / 2014-12-19 +================== + + * deps: negotiator@0.5.0 + - Fix list return order when large accepted list + - Fix missing identity encoding when q=0 exists + - Remove dynamic building of Negotiator class + +1.1.4 / 2014-12-10 +================== + + * deps: mime-types@~2.0.4 + - deps: mime-db@~1.3.0 + +1.1.3 / 2014-11-09 +================== + + * deps: mime-types@~2.0.3 + - deps: mime-db@~1.2.0 + +1.1.2 / 2014-10-14 +================== + + * deps: negotiator@0.4.9 + - Fix error when media type has invalid parameter + +1.1.1 / 2014-09-28 +================== + + * deps: mime-types@~2.0.2 + - deps: mime-db@~1.1.0 + * deps: negotiator@0.4.8 + - Fix all negotiations to be case-insensitive + - Stable sort preferences of same quality according to client order + +1.1.0 / 2014-09-02 +================== + + * update `mime-types` + +1.0.7 / 2014-07-04 +================== + + * Fix wrong type returned from `type` when match after unknown extension + +1.0.6 / 2014-06-24 +================== + + * deps: negotiator@0.4.7 + +1.0.5 / 2014-06-20 +================== + + * fix crash when unknown extension given + +1.0.4 / 2014-06-19 +================== + + * use `mime-types` + +1.0.3 / 2014-06-11 +================== + + * deps: negotiator@0.4.6 + - Order by specificity when quality is the same + +1.0.2 / 2014-05-29 +================== + + * Fix interpretation when header not in request + * deps: pin negotiator@0.4.5 + +1.0.1 / 2014-01-18 +================== + + * Identity encoding isn't always acceptable + * deps: negotiator@~0.4.0 + +1.0.0 / 2013-12-27 +================== + + * Genesis diff --git a/node_modules/accepts/LICENSE b/node_modules/accepts/LICENSE new file mode 100644 index 0000000..0616607 --- /dev/null +++ b/node_modules/accepts/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/accepts/README.md b/node_modules/accepts/README.md new file mode 100644 index 0000000..6a2749a --- /dev/null +++ b/node_modules/accepts/README.md @@ -0,0 +1,143 @@ +# accepts + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator). +Extracted from [koa](https://www.npmjs.com/package/koa) for general use. + +In addition to negotiator, it allows: + +- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])` + as well as `('text/html', 'application/json')`. +- Allows type shorthands such as `json`. +- Returns `false` when no types match +- Treats non-existent headers as `*` + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install accepts +``` + +## API + + + +```js +var accepts = require('accepts') +``` + +### accepts(req) + +Create a new `Accepts` object for the given `req`. + +#### .charset(charsets) + +Return the first accepted charset. If nothing in `charsets` is accepted, +then `false` is returned. + +#### .charsets() + +Return the charsets that the request accepts, in the order of the client's +preference (most preferred first). + +#### .encoding(encodings) + +Return the first accepted encoding. If nothing in `encodings` is accepted, +then `false` is returned. + +#### .encodings() + +Return the encodings that the request accepts, in the order of the client's +preference (most preferred first). + +#### .language(languages) + +Return the first accepted language. If nothing in `languages` is accepted, +then `false` is returned. + +#### .languages() + +Return the languages that the request accepts, in the order of the client's +preference (most preferred first). + +#### .type(types) + +Return the first accepted type (and it is returned as the same text as what +appears in the `types` array). If nothing in `types` is accepted, then `false` +is returned. + +The `types` array can contain full MIME types or file extensions. Any value +that is not a full MIME types is passed to `require('mime-types').lookup`. + +#### .types() + +Return the types that the request accepts, in the order of the client's +preference (most preferred first). + +## Examples + +### Simple type negotiation + +This simple example shows how to use `accepts` to return a different typed +respond body based on what the client wants to accept. The server lists it's +preferences in order and will get back the best match between the client and +server. + +```js +var accepts = require('accepts') +var http = require('http') + +function app (req, res) { + var accept = accepts(req) + + // the order of this list is significant; should be server preferred order + switch (accept.type(['json', 'html'])) { + case 'json': + res.setHeader('Content-Type', 'application/json') + res.write('{"hello":"world!"}') + break + case 'html': + res.setHeader('Content-Type', 'text/html') + res.write('hello, world!') + break + default: + // the fallback is text/plain, so no need to specify it above + res.setHeader('Content-Type', 'text/plain') + res.write('hello, world!') + break + } + + res.end() +} + +http.createServer(app).listen(3000) +``` + +You can test this out with the cURL program: +```sh +curl -I -H'Accept: text/html' http://localhost:3000/ +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/accepts.svg +[npm-url]: https://npmjs.org/package/accepts +[node-version-image]: https://img.shields.io/node/v/accepts.svg +[node-version-url]: https://nodejs.org/en/download/ +[travis-image]: https://img.shields.io/travis/jshttp/accepts/master.svg +[travis-url]: https://travis-ci.org/jshttp/accepts +[coveralls-image]: https://img.shields.io/coveralls/jshttp/accepts/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/accepts +[downloads-image]: https://img.shields.io/npm/dm/accepts.svg +[downloads-url]: https://npmjs.org/package/accepts diff --git a/node_modules/accepts/index.js b/node_modules/accepts/index.js new file mode 100644 index 0000000..e9b2f63 --- /dev/null +++ b/node_modules/accepts/index.js @@ -0,0 +1,238 @@ +/*! + * accepts + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var Negotiator = require('negotiator') +var mime = require('mime-types') + +/** + * Module exports. + * @public + */ + +module.exports = Accepts + +/** + * Create a new Accepts object for the given req. + * + * @param {object} req + * @public + */ + +function Accepts (req) { + if (!(this instanceof Accepts)) { + return new Accepts(req) + } + + this.headers = req.headers + this.negotiator = new Negotiator(req) +} + +/** + * Check if the given `type(s)` is acceptable, returning + * the best match when true, otherwise `undefined`, in which + * case you should respond with 406 "Not Acceptable". + * + * The `type` value may be a single mime type string + * such as "application/json", the extension name + * such as "json" or an array `["json", "html", "text/plain"]`. When a list + * or array is given the _best_ match, if any is returned. + * + * Examples: + * + * // Accept: text/html + * this.types('html'); + * // => "html" + * + * // Accept: text/*, application/json + * this.types('html'); + * // => "html" + * this.types('text/html'); + * // => "text/html" + * this.types('json', 'text'); + * // => "json" + * this.types('application/json'); + * // => "application/json" + * + * // Accept: text/*, application/json + * this.types('image/png'); + * this.types('png'); + * // => undefined + * + * // Accept: text/*;q=.5, application/json + * this.types(['html', 'json']); + * this.types('html', 'json'); + * // => "json" + * + * @param {String|Array} types... + * @return {String|Array|Boolean} + * @public + */ + +Accepts.prototype.type = +Accepts.prototype.types = function (types_) { + var types = types_ + + // support flattened arguments + if (types && !Array.isArray(types)) { + types = new Array(arguments.length) + for (var i = 0; i < types.length; i++) { + types[i] = arguments[i] + } + } + + // no types, return all requested types + if (!types || types.length === 0) { + return this.negotiator.mediaTypes() + } + + // no accept header, return first given type + if (!this.headers.accept) { + return types[0] + } + + var mimes = types.map(extToMime) + var accepts = this.negotiator.mediaTypes(mimes.filter(validMime)) + var first = accepts[0] + + return first + ? types[mimes.indexOf(first)] + : false +} + +/** + * Return accepted encodings or best fit based on `encodings`. + * + * Given `Accept-Encoding: gzip, deflate` + * an array sorted by quality is returned: + * + * ['gzip', 'deflate'] + * + * @param {String|Array} encodings... + * @return {String|Array} + * @public + */ + +Accepts.prototype.encoding = +Accepts.prototype.encodings = function (encodings_) { + var encodings = encodings_ + + // support flattened arguments + if (encodings && !Array.isArray(encodings)) { + encodings = new Array(arguments.length) + for (var i = 0; i < encodings.length; i++) { + encodings[i] = arguments[i] + } + } + + // no encodings, return all requested encodings + if (!encodings || encodings.length === 0) { + return this.negotiator.encodings() + } + + return this.negotiator.encodings(encodings)[0] || false +} + +/** + * Return accepted charsets or best fit based on `charsets`. + * + * Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5` + * an array sorted by quality is returned: + * + * ['utf-8', 'utf-7', 'iso-8859-1'] + * + * @param {String|Array} charsets... + * @return {String|Array} + * @public + */ + +Accepts.prototype.charset = +Accepts.prototype.charsets = function (charsets_) { + var charsets = charsets_ + + // support flattened arguments + if (charsets && !Array.isArray(charsets)) { + charsets = new Array(arguments.length) + for (var i = 0; i < charsets.length; i++) { + charsets[i] = arguments[i] + } + } + + // no charsets, return all requested charsets + if (!charsets || charsets.length === 0) { + return this.negotiator.charsets() + } + + return this.negotiator.charsets(charsets)[0] || false +} + +/** + * Return accepted languages or best fit based on `langs`. + * + * Given `Accept-Language: en;q=0.8, es, pt` + * an array sorted by quality is returned: + * + * ['es', 'pt', 'en'] + * + * @param {String|Array} langs... + * @return {Array|String} + * @public + */ + +Accepts.prototype.lang = +Accepts.prototype.langs = +Accepts.prototype.language = +Accepts.prototype.languages = function (languages_) { + var languages = languages_ + + // support flattened arguments + if (languages && !Array.isArray(languages)) { + languages = new Array(arguments.length) + for (var i = 0; i < languages.length; i++) { + languages[i] = arguments[i] + } + } + + // no languages, return all requested languages + if (!languages || languages.length === 0) { + return this.negotiator.languages() + } + + return this.negotiator.languages(languages)[0] || false +} + +/** + * Convert extnames to mime. + * + * @param {String} type + * @return {String} + * @private + */ + +function extToMime (type) { + return type.indexOf('/') === -1 + ? mime.lookup(type) + : type +} + +/** + * Check if mime is valid. + * + * @param {String} type + * @return {String} + * @private + */ + +function validMime (type) { + return typeof type === 'string' +} diff --git a/node_modules/accepts/package.json b/node_modules/accepts/package.json new file mode 100644 index 0000000..9d5ef0d --- /dev/null +++ b/node_modules/accepts/package.json @@ -0,0 +1,85 @@ +{ + "_from": "accepts@~1.3.3", + "_id": "accepts@1.3.5", + "_inBundle": false, + "_integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "_location": "/accepts", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "accepts@~1.3.3", + "name": "accepts", + "escapedName": "accepts", + "rawSpec": "~1.3.3", + "saveSpec": null, + "fetchSpec": "~1.3.3" + }, + "_requiredBy": [ + "/express" + ], + "_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "_shasum": "eb777df6011723a3b14e8a72c0805c8e86746bd2", + "_spec": "accepts@~1.3.3", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/express", + "bugs": { + "url": "https://github.com/jshttp/accepts/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com" + } + ], + "dependencies": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + }, + "deprecated": false, + "description": "Higher-level content negotiation", + "devDependencies": { + "eslint": "4.18.1", + "eslint-config-standard": "11.0.0", + "eslint-plugin-import": "2.9.0", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-node": "6.0.1", + "eslint-plugin-promise": "3.6.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "mocha": "~1.21.5" + }, + "engines": { + "node": ">= 0.6" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "index.js" + ], + "homepage": "https://github.com/jshttp/accepts#readme", + "keywords": [ + "content", + "negotiation", + "accept", + "accepts" + ], + "license": "MIT", + "name": "accepts", + "repository": { + "type": "git", + "url": "git+https://github.com/jshttp/accepts.git" + }, + "scripts": { + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + }, + "version": "1.3.5" +} diff --git a/node_modules/acorn-globals/LICENSE b/node_modules/acorn-globals/LICENSE new file mode 100644 index 0000000..27cc9f3 --- /dev/null +++ b/node_modules/acorn-globals/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 Forbes Lindesay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/acorn-globals/README.md b/node_modules/acorn-globals/README.md new file mode 100644 index 0000000..d8cd372 --- /dev/null +++ b/node_modules/acorn-globals/README.md @@ -0,0 +1,76 @@ +# acorn-globals + +Detect global variables in JavaScript using acorn + +[![Build Status](https://img.shields.io/travis/ForbesLindesay/acorn-globals/master.svg)](https://travis-ci.org/ForbesLindesay/acorn-globals) +[![Dependency Status](https://img.shields.io/david/ForbesLindesay/acorn-globals.svg)](https://david-dm.org/ForbesLindesay/acorn-globals) +[![NPM version](https://img.shields.io/npm/v/acorn-globals.svg)](https://www.npmjs.org/package/acorn-globals) + +## Installation + + npm install acorn-globals + +## Usage + +detect.js + +```js +var fs = require('fs'); +var detect = require('acorn-globals'); + +var src = fs.readFileSync(__dirname + '/input.js', 'utf8'); + +var scope = detect(src); +console.dir(scope); +``` + +input.js + +```js +var x = 5; +var y = 3, z = 2; + +w.foo(); +w = 2; + +RAWR=444; +RAWR.foo(); + +BLARG=3; + +foo(function () { + var BAR = 3; + process.nextTick(function (ZZZZZZZZZZZZ) { + console.log('beep boop'); + var xyz = 4; + x += 10; + x.zzzzzz; + ZZZ=6; + }); + function doom () { + } + ZZZ.foo(); + +}); + +console.log(xyz); +``` + +output: + +``` +$ node example/detect.js +[ { name: 'BLARG', nodes: [ [Object] ] }, + { name: 'RAWR', nodes: [ [Object], [Object] ] }, + { name: 'ZZZ', nodes: [ [Object], [Object] ] }, + { name: 'console', nodes: [ [Object], [Object] ] }, + { name: 'foo', nodes: [ [Object] ] }, + { name: 'process', nodes: [ [Object] ] }, + { name: 'w', nodes: [ [Object], [Object] ] }, + { name: 'xyz', nodes: [ [Object] ] } ] +``` + + +## License + + MIT diff --git a/node_modules/acorn-globals/index.js b/node_modules/acorn-globals/index.js new file mode 100644 index 0000000..fc95182 --- /dev/null +++ b/node_modules/acorn-globals/index.js @@ -0,0 +1,163 @@ +'use strict'; + +var acorn = require('acorn'); +var walk = require('acorn/dist/walk'); + +function isScope(node) { + return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration' || node.type === 'ArrowFunctionExpression' || node.type === 'Program'; +} +function isBlockScope(node) { + return node.type === 'BlockStatement' || isScope(node); +} + +function declaresArguments(node) { + return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration'; +} + +function declaresThis(node) { + return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration'; +} + +function reallyParse(source) { + return acorn.parse(source, { + allowReturnOutsideFunction: true, + allowImportExportEverywhere: true, + allowHashBang: true + }); +} +module.exports = findGlobals; +module.exports.parse = reallyParse; +function findGlobals(source) { + var globals = []; + var ast; + // istanbul ignore else + if (typeof source === 'string') { + ast = reallyParse(source); + } else { + ast = source; + } + // istanbul ignore if + if (!(ast && typeof ast === 'object' && ast.type === 'Program')) { + throw new TypeError('Source must be either a string of JavaScript or an acorn AST'); + } + var declareFunction = function (node) { + var fn = node; + fn.locals = fn.locals || {}; + node.params.forEach(function (node) { + declarePattern(node, fn); + }); + if (node.id) { + fn.locals[node.id.name] = true; + } + } + var declarePattern = function (node, parent) { + switch (node.type) { + case 'Identifier': + parent.locals[node.name] = true; + break; + case 'ObjectPattern': + node.properties.forEach(function (node) { + declarePattern(node.value, parent); + }); + break; + case 'ArrayPattern': + node.elements.forEach(function (node) { + if (node) declarePattern(node, parent); + }); + break; + case 'RestElement': + declarePattern(node.argument, parent); + break; + case 'AssignmentPattern': + declarePattern(node.left, parent); + break; + // istanbul ignore next + default: + throw new Error('Unrecognized pattern type: ' + node.type); + } + } + var declareModuleSpecifier = function (node, parents) { + ast.locals = ast.locals || {}; + ast.locals[node.local.name] = true; + } + walk.ancestor(ast, { + 'VariableDeclaration': function (node, parents) { + var parent = null; + for (var i = parents.length - 1; i >= 0 && parent === null; i--) { + if (node.kind === 'var' ? isScope(parents[i]) : isBlockScope(parents[i])) { + parent = parents[i]; + } + } + parent.locals = parent.locals || {}; + node.declarations.forEach(function (declaration) { + declarePattern(declaration.id, parent); + }); + }, + 'FunctionDeclaration': function (node, parents) { + var parent = null; + for (var i = parents.length - 2; i >= 0 && parent === null; i--) { + if (isScope(parents[i])) { + parent = parents[i]; + } + } + parent.locals = parent.locals || {}; + parent.locals[node.id.name] = true; + declareFunction(node); + }, + 'Function': declareFunction, + 'ClassDeclaration': function (node, parents) { + var parent = null; + for (var i = parents.length - 2; i >= 0 && parent === null; i--) { + if (isScope(parents[i])) { + parent = parents[i]; + } + } + parent.locals = parent.locals || {}; + parent.locals[node.id.name] = true; + }, + 'TryStatement': function (node) { + if (node.handler === null) return; + node.handler.locals = node.handler.locals || {}; + node.handler.locals[node.handler.param.name] = true; + }, + 'ImportDefaultSpecifier': declareModuleSpecifier, + 'ImportSpecifier': declareModuleSpecifier, + 'ImportNamespaceSpecifier': declareModuleSpecifier + }); + function identifier(node, parents) { + var name = node.name; + if (name === 'undefined') return; + for (var i = 0; i < parents.length; i++) { + if (name === 'arguments' && declaresArguments(parents[i])) { + return; + } + if (parents[i].locals && name in parents[i].locals) { + return; + } + } + node.parents = parents; + globals.push(node); + } + walk.ancestor(ast, { + 'VariablePattern': identifier, + 'Identifier': identifier, + 'ThisExpression': function (node, parents) { + for (var i = 0; i < parents.length; i++) { + if (declaresThis(parents[i])) { + return; + } + } + node.parents = parents; + globals.push(node); + } + }); + var groupedGlobals = {}; + globals.forEach(function (node) { + var name = node.type === 'ThisExpression' ? 'this' : node.name; + groupedGlobals[name] = (groupedGlobals[name] || []); + groupedGlobals[name].push(node); + }); + return Object.keys(groupedGlobals).sort().map(function (name) { + return {name: name, nodes: groupedGlobals[name]}; + }); +} diff --git a/node_modules/acorn-globals/node_modules/.bin/acorn b/node_modules/acorn-globals/node_modules/.bin/acorn new file mode 120000 index 0000000..cf76760 --- /dev/null +++ b/node_modules/acorn-globals/node_modules/.bin/acorn @@ -0,0 +1 @@ +../acorn/bin/acorn \ No newline at end of file diff --git a/node_modules/acorn-globals/node_modules/acorn/.npmignore b/node_modules/acorn-globals/node_modules/acorn/.npmignore new file mode 100644 index 0000000..eb3644b --- /dev/null +++ b/node_modules/acorn-globals/node_modules/acorn/.npmignore @@ -0,0 +1,10 @@ +/.tern-port +/test +/local +/rollup +/bin/generate-identifier-regex.js +/bin/update_authors.sh +.editorconfig +.gitattributes +.tern-project +.travis.yml diff --git a/node_modules/acorn-globals/node_modules/acorn/AUTHORS b/node_modules/acorn-globals/node_modules/acorn/AUTHORS new file mode 100644 index 0000000..ab64891 --- /dev/null +++ b/node_modules/acorn-globals/node_modules/acorn/AUTHORS @@ -0,0 +1,62 @@ +List of Acorn contributors. Updated before every release. + +Adrian Rakovsky +Alistair Braidwood +Amila Welihinda +Andres Suarez +Angelo +Aparajita Fishman +Arian Stolwijk +Artem Govorov +Brandon Mills +Charles Hughes +Conrad Irwin +Daniel Tschinder +David Bonnet +Domenico Matteo +Forbes Lindesay +Gilad Peleg +impinball +Ingvar Stepanyan +Jackson Ray Hamilton +Jesse McCarthy +Jiaxing Wang +Joel Kemp +Johannes Herr +Jordan Klassen +Jürg Lehni +Kai Cataldo +keeyipchan +Keheliya Gallaba +Kevin Irish +Kevin Kwok +krator +Marijn Haverbeke +Martin Carlberg +Mat Garcia +Mathias Bynens +Mathieu 'p01' Henri +Matthew Bastien +Max Schaefer +Max Zerzouri +Mihai Bazon +Mike Rennie +naoh +Nicholas C. Zakas +Nick Fitzgerald +Olivier Thomann +Oskar Schöldström +Paul Harper +Peter Rust +PlNG +Prayag Verma +ReadmeCritic +r-e-d +Richard Gibson +Rich Harris +Sebastian McKenzie +Simen Bekkhus +Timothy Gu +Toru Nagashima +Wexpo Lyu +zsjforcn diff --git a/node_modules/acorn-globals/node_modules/acorn/CHANGELOG.md b/node_modules/acorn-globals/node_modules/acorn/CHANGELOG.md new file mode 100644 index 0000000..f6d1fa8 --- /dev/null +++ b/node_modules/acorn-globals/node_modules/acorn/CHANGELOG.md @@ -0,0 +1,286 @@ +## 4.0.11 (2017-02-07) + +### Bug fixes + +Allow all forms of member expressions to be parenthesized as lvalue. + +## 4.0.10 (2017-02-07) + +### Bug fixes + +Don't expect semicolons after default-exported functions or classes, +even when they are expressions. + +Check for use of `'use strict'` directives in non-simple parameter +functions, even when already in strict mode. + +## 4.0.9 (2017-02-06) + +### Bug fixes + +Fix incorrect error raised for parenthesized simple assignment +targets, so that `(x) = 1` parses again. + +## 4.0.8 (2017-02-03) + +### Bug fixes + +Solve spurious parenthesized pattern errors by temporarily erring on +the side of accepting programs that our delayed errors don't handle +correctly yet. + +## 4.0.7 (2017-02-02) + +### Bug fixes + +Accept invalidly rejected code like `(x).y = 2` again. + +Don't raise an error when a function _inside_ strict code has a +non-simple parameter list. + +## 4.0.6 (2017-02-02) + +### Bug fixes + +Fix exponential behavior (manifesting itself as a complete hang for +even relatively small source files) introduced by the new 'use strict' +check. + +## 4.0.5 (2017-02-02) + +### Bug fixes + +Disallow parenthesized pattern expressions. + +Allow keywords as export names. + +Don't allow the `async` keyword to be parenthesized. + +Properly raise an error when a keyword contains a character escape. + +Allow `"use strict"` to appear after other string literal expressions. + +Disallow labeled declarations. + +## 4.0.4 (2016-12-19) + +### Bug fixes + +Fix issue with loading acorn_loose.js with an AMD loader. + +Fix crash when `export` was followed by a keyword that can't be +exported. + +## 4.0.3 (2016-08-16) + +### Bug fixes + +Allow regular function declarations inside single-statement `if` +branches in loose mode. Forbid them entirely in strict mode. + +Properly parse properties named `async` in ES2017 mode. + +Fix bug where reserved words were broken in ES2017 mode. + +## 4.0.2 (2016-08-11) + +### Bug fixes + +Don't ignore period or 'e' characters after octal numbers. + +Fix broken parsing for call expressions in default parameter values +of arrow functions. + +## 4.0.1 (2016-08-08) + +### Bug fixes + +Fix false positives in duplicated export name errors. + +## 4.0.0 (2016-08-07) + +### Breaking changes + +The default `ecmaVersion` option value is now 7. + +A number of internal method signatures changed, so plugins might need +to be updated. + +### Bug fixes + +The parser now raises errors on duplicated export names. + +`arguments` and `eval` can now be used in shorthand properties. + +Duplicate parameter names in non-simple argument lists now always +produce an error. + +### New features + +The `ecmaVersion` option now also accepts year-style version numbers +(2015, etc). + +Support for `async`/`await` syntax when `ecmaVersion` is >= 8. + +Support for trailing commas in call expressions when `ecmaVersion` +is >= 8. + +## 3.3.0 (2016-07-25) + +### Bug fixes + +Fix bug in tokenizing of regexp operator after a function declaration. + +Fix parser crash when parsing an array pattern with a hole. + +### New features + +Implement check against complex argument lists in functions that +enable strict mode in ES7. + +## 3.2.0 (2016-06-07) + +### Bug fixes + +Improve handling of lack of unicode regexp support in host +environment. + +Properly reject shorthand properties whose name is a keyword. + +Don't crash when the loose parser is called without options object. + +### New features + +Visitors created with `visit.make` now have their base as _prototype_, +rather than copying properties into a fresh object. + +Make it possible to use `visit.ancestor` with a walk state. + +## 3.1.0 (2016-04-18) + +### Bug fixes + +Fix issue where the loose parser created invalid TemplateElement nodes +for unclosed template literals. + +Properly tokenize the division operator directly after a function +expression. + +Allow trailing comma in destructuring arrays. + +### New features + +The walker now allows defining handlers for `CatchClause` nodes. + +## 3.0.4 (2016-02-25) + +### Fixes + +Allow update expressions as left-hand-side of the ES7 exponential +operator. + +## 3.0.2 (2016-02-10) + +### Fixes + +Fix bug that accidentally made `undefined` a reserved word when +parsing ES7. + +## 3.0.0 (2016-02-10) + +### Breaking changes + +The default value of the `ecmaVersion` option is now 6 (used to be 5). + +Support for comprehension syntax (which was dropped from the draft +spec) has been removed. + +### Fixes + +`let` and `yield` are now “contextual keywords”, meaning you can +mostly use them as identifiers in ES5 non-strict code. + +A parenthesized class or function expression after `export default` is +now parsed correctly. + +### New features + +When `ecmaVersion` is set to 7, Acorn will parse the exponentiation +operator (`**`). + +The identifier character ranges are now based on Unicode 8.0.0. + +Plugins can now override the `raiseRecoverable` method to override the +way non-critical errors are handled. + +## 2.7.0 (2016-01-04) + +### Fixes + +Stop allowing rest parameters in setters. + +Make sure the loose parser always attaches a `local` property to +`ImportNamespaceSpecifier` nodes. + +Disallow `y` rexexp flag in ES5. + +Disallow `\00` and `\000` escapes in strict mode. + +Raise an error when an import name is a reserved word. + +## 2.6.4 (2015-11-12) + +### Fixes + +Fix crash in loose parser when parsing invalid object pattern. + +### New features + +Support plugins in the loose parser. + +## 2.6.2 (2015-11-10) + +### Fixes + +Don't crash when no options object is passed. + +## 2.6.0 (2015-11-09) + +### Fixes + +Add `await` as a reserved word in module sources. + +Disallow `yield` in a parameter default value for a generator. + +Forbid using a comma after a rest pattern in an array destructuring. + +### New features + +Support parsing stdin in command-line tool. + +## 2.5.2 (2015-10-27) + +### Fixes + +Fix bug where the walker walked an exported `let` statement as an +expression. + +## 2.5.0 (2015-10-27) + +### Fixes + +Fix tokenizer support in the command-line tool. + +In the loose parser, don't allow non-string-literals as import +sources. + +Stop allowing `new.target` outside of functions. + +Remove legacy `guard` and `guardedHandler` properties from try nodes. + +Stop allowing multiple `__proto__` properties on an object literal in +strict mode. + +Don't allow rest parameters to be non-identifier patterns. + +Check for duplicate paramter names in arrow functions. diff --git a/node_modules/acorn-globals/node_modules/acorn/LICENSE b/node_modules/acorn-globals/node_modules/acorn/LICENSE new file mode 100644 index 0000000..a35ebf4 --- /dev/null +++ b/node_modules/acorn-globals/node_modules/acorn/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2012-2016 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/node_modules/acorn-globals/node_modules/acorn/README.md b/node_modules/acorn-globals/node_modules/acorn/README.md new file mode 100644 index 0000000..b7efe23 --- /dev/null +++ b/node_modules/acorn-globals/node_modules/acorn/README.md @@ -0,0 +1,409 @@ +# Acorn + +[![Build Status](https://travis-ci.org/ternjs/acorn.svg?branch=master)](https://travis-ci.org/ternjs/acorn) +[![NPM version](https://img.shields.io/npm/v/acorn.svg)](https://www.npmjs.com/package/acorn) +[![CDNJS](https://img.shields.io/cdnjs/v/acorn.svg)](https://cdnjs.com/libraries/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. + +## Community + +Acorn is open source software released under an +[MIT license](https://github.com/ternjs/acorn/blob/master/LICENSE). + +You are welcome to +[report bugs](https://github.com/ternjs/acorn/issues) or create pull +requests on [github](https://github.com/ternjs/acorn). For questions +and discussion, please use the +[Tern discussion forum](https://discuss.ternjs.net). + +## Installation + +The easiest way to install acorn is with [`npm`][npm]. + +[npm]: https://www.npmjs.com/ + +```sh +npm install acorn +``` + +Alternately, download the source. + +```sh +git clone https://github.com/ternjs/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 +[ESTree spec][estree]. + +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. + +[estree]: https://github.com/estree/estree + +- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be + either 3, 5, 6 (2015), 7 (2016), or 8 (2017). This influences support for strict + mode, the set of reserved words, and support for new syntax features. + Default is 7. + + **NOTE**: Only 'stage 4' (finalized) ECMAScript features are being + implemented by Acorn. + +- **sourceType**: Indicate the mode the code should be parsed in. Can be + either `"script"` or `"module"`. This influences global strict mode + and parsing of `import` and `export` declarations. + +- **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` for `ecmaVersion` 3, `false` for higher + versions. 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 tokens returned from + `tokenizer().getToken()`. + + 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", + "start": Number, + "end": Number, + // If `locations` option is on: + "loc": { + "start": {line: Number, column: Number} + "end": {line: Number, column: Number} + }, + // If `ranges` option is on: + "range": [Number, Number] + } + ``` + + 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 (regardless of the `location` option) 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.tokenizer(str)) { + // iterate over the tokens +} + +// transform code to array of tokens: +var tokens = [...acorn.tokenizer(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/estools/escodegen + +### dist/acorn_loose.js ### + +This file implements an error-tolerant parser. It exposes a single +function. The loose parser is accessible in node.js via `require("acorn/dist/acorn_loose")`. + +**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 +[ESTree spec][estree]. 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 is 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 the callbacks as a third 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` and `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|--ecma7`: Sets the ECMAScript version to parse. Default is + version 5. + +- `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise. + +- `--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("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 +`plugins` 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. + +Similarly, the loose parser allows plugins to register themselves via +`acorn.pluginsLoose`. The extension mechanism is the same as for the +normal parser: + +```javascript +looseParser.extend("readToken", function(nextMethod) { + return function() { + console.log("Reading a token in the loose parser!") + return nextMethod.call(this) + } +}) +``` + +### Existing plugins + + - [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx) + - [`acorn-es7-plugin`](https://github.com/MatAtBread/acorn-es7-plugin/): Parse [async/await syntax proposal](https://github.com/tc39/ecmascript-asyncawait) + - [`acorn-object-spread`](https://github.com/UXtemple/acorn-object-spread): Parse [object spread syntax proposal](https://github.com/sebmarkbage/ecmascript-rest-spread) + - [`acorn-es7`](https://www.npmjs.com/package/acorn-es7): Parse [decorator syntax proposal](https://github.com/wycats/javascript-decorators) + - [`acorn-objj`](https://www.npmjs.com/package/acorn-objj): [Objective-J](http://www.cappuccino-project.org/learn/objective-j.html) language parser built as Acorn plugin diff --git a/node_modules/acorn-globals/node_modules/acorn/bin/acorn b/node_modules/acorn-globals/node_modules/acorn/bin/acorn new file mode 100755 index 0000000..78ebd4f --- /dev/null +++ b/node_modules/acorn-globals/node_modules/acorn/bin/acorn @@ -0,0 +1,67 @@ +#!/usr/bin/env node +'use strict'; + +var path = require('path'); +var fs = require('fs'); +var acorn = require('../dist/acorn.js'); + +var infile; +var forceFile; +var silent = false; +var compact = false; +var tokenize = false; +var options = {} + +function help(status) { + var print = (status == 0) ? console.log : console.error + print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|...|--ecma2015|--ecma2016|...]") + print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]") + process.exit(status) +} + +for (var i = 2; i < process.argv.length; ++i) { + var arg = process.argv[i] + if ((arg == "-" || arg[0] != "-") && !infile) infile = arg + else if (arg == "--" && !infile && i + 2 == process.argv.length) forceFile = infile = process.argv[++i] + 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 if (arg == "--module") options.sourceType = 'module' + else { + var match = arg.match(/^--ecma(\d+)$/) + if (match) + options.ecmaVersion = +match[1] + else + help(1) + } +} + +function run(code) { + var result + if (!tokenize) { + try { result = acorn.parse(code, options) } + catch(e) { console.error(e.message); process.exit(1) } + } else { + result = [] + var tokenizer = acorn.tokenizer(code, options), token + while (true) { + try { token = tokenizer.getToken() } + catch(e) { console.error(e.message); process.exit(1) } + result.push(token) + if (token.type == acorn.tokTypes.eof) break + } + } + if (!silent) console.log(JSON.stringify(result, null, compact ? null : 2)) +} + +if (forceFile || infile && infile != "-") { + run(fs.readFileSync(infile, "utf8")) +} else { + var code = "" + process.stdin.resume() + process.stdin.on("data", function (chunk) { return code += chunk; }) + process.stdin.on("end", function () { return run(code); }) +} \ No newline at end of file diff --git a/node_modules/acorn-globals/node_modules/acorn/dist/.keep b/node_modules/acorn-globals/node_modules/acorn/dist/.keep new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/acorn-globals/node_modules/acorn/dist/acorn.es.js b/node_modules/acorn-globals/node_modules/acorn/dist/acorn.es.js new file mode 100644 index 0000000..2b34af0 --- /dev/null +++ b/node_modules/acorn-globals/node_modules/acorn/dist/acorn.es.js @@ -0,0 +1,3401 @@ +// Reserved word lists for various dialects of the language + +var reservedWords = { + 3: "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: "class enum extends super const export import", + 6: "enum", + strict: "implements interface let package private protected public static yield", + strictBind: "eval arguments" +} + +// 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: ecma5AndLessKeywords, + 6: ecma5AndLessKeywords + " const class extends export import super" +} + +// ## 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 `bin/generate-identifier-regex.js`. + +var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fd5\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ae\ua7b0-\ua7b7\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab65\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc" +var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d4-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d01-\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1cf8\u1cf9\u1dc0-\u1df5\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua900-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f" + +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 bin/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,19,35,5,35,5,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,66,18,2,1,11,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,56,50,14,50,785,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,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,60,67,1213,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,3,5761,10591,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,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,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,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,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 = 0x10000 + 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 + } +} + +// Test whether a given character code starts an identifier. + +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 <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) + if (astral === false) return false + return isInAstralSet(code, astralIdentifierStartCodes) +} + +// Test whether a given character is part of an identifier. + +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 <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)) + if (astral === false) return false + return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes) +} + +// ## Token types + +// The assignment of fine-grained, information-carrying type objects +// allows the tokenizer to store the information it has about a +// token in a way that is very cheap for the parser to look up. + +// All token type variables start with an underscore, to make them +// easy to recognize. + +// The `beforeExpr` property is used to disambiguate between regular +// expressions and divisions. It is set on all token types that can +// be followed by an expression (thus, a slash after them would be a +// regular expression). +// +// The `startsExpr` property is used to check if the token ends a +// `yield` expression. It is set on all token types that either can +// directly start an expression (like a quotation mark) or can +// continue an expression (like the body of a string). +// +// `isLoop` marks a keyword as starting a loop, which is important +// to know when parsing a label, in order to allow or disallow +// continue jumps to that label. + +var TokenType = function TokenType(label, conf) { + if ( conf === void 0 ) conf = {}; + + this.label = label + this.keyword = conf.keyword + this.beforeExpr = !!conf.beforeExpr + this.startsExpr = !!conf.startsExpr + this.isLoop = !!conf.isLoop + this.isAssign = !!conf.isAssign + this.prefix = !!conf.prefix + this.postfix = !!conf.postfix + this.binop = conf.binop || null + this.updateContext = null +}; + +function binop(name, prec) { + return new TokenType(name, {beforeExpr: true, binop: prec}) +} +var beforeExpr = {beforeExpr: true}; +var startsExpr = {startsExpr: true}; +// Map keyword names to token types. + +var keywordTypes = {} + +// Succinct definitions of keyword token types +function kw(name, options) { + if ( options === void 0 ) options = {}; + + options.keyword = name + return keywordTypes[name] = new TokenType(name, options) +} + +var tt = { + num: new TokenType("num", startsExpr), + regexp: new TokenType("regexp", startsExpr), + string: new TokenType("string", startsExpr), + name: new TokenType("name", startsExpr), + eof: new TokenType("eof"), + + // Punctuation token types. + bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}), + bracketR: new TokenType("]"), + braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}), + braceR: new TokenType("}"), + parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}), + parenR: new TokenType(")"), + comma: new TokenType(",", beforeExpr), + semi: new TokenType(";", beforeExpr), + colon: new TokenType(":", beforeExpr), + dot: new TokenType("."), + question: new TokenType("?", beforeExpr), + arrow: new TokenType("=>", beforeExpr), + template: new TokenType("template"), + ellipsis: new TokenType("...", beforeExpr), + backQuote: new TokenType("`", startsExpr), + dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}), + + // Operators. These carry several kinds of properties to help the + // parser use them properly (the presence of these properties is + // what categorizes them as operators). + // + // `binop`, when present, specifies that this operator is a binary + // operator, and will refer to its precedence. + // + // `prefix` and `postfix` mark the operator as a prefix or postfix + // unary operator. + // + // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as + // binary operators with a very low precedence, that should result + // in AssignmentExpression nodes. + + eq: new TokenType("=", {beforeExpr: true, isAssign: true}), + assign: new TokenType("_=", {beforeExpr: true, isAssign: true}), + incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}), + prefix: new TokenType("prefix", {beforeExpr: true, prefix: true, startsExpr: true}), + logicalOR: binop("||", 1), + logicalAND: binop("&&", 2), + bitwiseOR: binop("|", 3), + bitwiseXOR: binop("^", 4), + bitwiseAND: binop("&", 5), + equality: binop("==/!=", 6), + relational: binop("", 7), + bitShift: binop("<>", 8), + plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}), + modulo: binop("%", 10), + star: binop("*", 10), + slash: binop("/", 10), + starstar: new TokenType("**", {beforeExpr: true}), + + // Keyword token types. + _break: kw("break"), + _case: kw("case", beforeExpr), + _catch: kw("catch"), + _continue: kw("continue"), + _debugger: kw("debugger"), + _default: kw("default", beforeExpr), + _do: kw("do", {isLoop: true, beforeExpr: true}), + _else: kw("else", beforeExpr), + _finally: kw("finally"), + _for: kw("for", {isLoop: true}), + _function: kw("function", startsExpr), + _if: kw("if"), + _return: kw("return", beforeExpr), + _switch: kw("switch"), + _throw: kw("throw", beforeExpr), + _try: kw("try"), + _var: kw("var"), + _const: kw("const"), + _while: kw("while", {isLoop: true}), + _with: kw("with"), + _new: kw("new", {beforeExpr: true, startsExpr: true}), + _this: kw("this", startsExpr), + _super: kw("super", startsExpr), + _class: kw("class"), + _extends: kw("extends", beforeExpr), + _export: kw("export"), + _import: kw("import"), + _null: kw("null", startsExpr), + _true: kw("true", startsExpr), + _false: kw("false", startsExpr), + _in: kw("in", {beforeExpr: true, binop: 7}), + _instanceof: kw("instanceof", {beforeExpr: true, binop: 7}), + _typeof: kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true}), + _void: kw("void", {beforeExpr: true, prefix: true, startsExpr: true}), + _delete: kw("delete", {beforeExpr: true, prefix: true, startsExpr: true}) +} + +// Matches a whole line break (where CRLF is considered a single +// line break). Used to count lines. + +var lineBreak = /\r\n?|\n|\u2028|\u2029/ +var lineBreakG = new RegExp(lineBreak.source, "g") + +function isNewLine(code) { + return code === 10 || code === 13 || code === 0x2028 || code === 0x2029 +} + +var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/ + +var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g + +function isArray(obj) { + return Object.prototype.toString.call(obj) === "[object Array]" +} + +// Checks if an object has a property. + +function has(obj, propName) { + return Object.prototype.hasOwnProperty.call(obj, propName) +} + +// These are used when `options.locations` is on, for the +// `startLoc` and `endLoc` properties. + +var Position = function Position(line, col) { + this.line = line + this.column = col +}; + +Position.prototype.offset = function offset (n) { + return new Position(this.line, this.column + n) +}; + +var SourceLocation = function SourceLocation(p, start, end) { + this.start = start + this.end = end + if (p.sourceFile !== null) this.source = p.sourceFile +}; + +// 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. + +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) + } + } +} + +// 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, 5, 6 (2015), 7 (2016), or 8 (2017). This influences support + // for strict mode, the set of reserved words, and support for + // new syntax features. The default is 7. + ecmaVersion: 7, + // `sourceType` indicates the mode the code should be parsed in. + // Can be either `"script"` or `"module"`. This influences global + // strict mode and parsing of `import` and `export` declarations. + 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 only enforced if ecmaVersion >= 5. + // Set `allowReserved` to a boolean value to explicitly turn this on + // an off. When this option has the value "never", reserved words + // and keywords can also not be used as property names. + allowReserved: null, + // 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 tokens returned from `tokenizer().getToken()`. 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: {} +} + +// Interpret and default an options object + +function getOptions(opts) { + var options = {} + + for (var opt in defaultOptions) + options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt] + + if (options.ecmaVersion >= 2015) + options.ecmaVersion -= 2009 + + if (options.allowReserved == null) + options.allowReserved = options.ecmaVersion < 5 + + if (isArray(options.onToken)) { + 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) + } +} + +// Registered plugins +var plugins = {} + +function keywordRegexp(words) { + return new RegExp("^(" + words.replace(/ /g, "|") + ")$") +} + +var Parser = function Parser(options, input, startPos) { + this.options = options = getOptions(options) + this.sourceFile = options.sourceFile + this.keywords = keywordRegexp(keywords[options.ecmaVersion >= 6 ? 6 : 5]) + var reserved = "" + if (!options.allowReserved) { + for (var v = options.ecmaVersion;; v--) + if (reserved = reservedWords[v]) break + if (options.sourceType == "module") reserved += " await" + } + this.reservedWords = keywordRegexp(reserved) + var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict + this.reservedWordsStrict = keywordRegexp(reservedStrict) + this.reservedWordsStrictBind = keywordRegexp(reservedStrict + " " + reservedWords.strictBind) + this.input = String(input) + + // Used to signal to callers of `readWord1` whether the word + // contained any escape sequences. This is needed because words with + // escape sequences must not be interpreted as keywords. + this.containsEsc = false + + // Load plugins + this.loadPlugins(options.plugins) + + // Set up token state + + // The current position of the tokenizer in the input. + if (startPos) { + this.pos = startPos + this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1 + 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 = this.curPosition() + + // 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.inModule = options.sourceType === "module" + this.strict = this.inModule || this.strictDirective(this.pos) + + // Used to signify the start of a potential arrow function + this.potentialArrowAt = -1 + + // Flags to track whether we are in a function, a generator, an async function. + this.inFunction = this.inGenerator = this.inAsync = false + // Positions to delayed-check that yield/await does not exist in default parameters. + this.yieldPos = this.awaitPos = 0 + // Labels in scope. + this.labels = [] + + // If enabled, skip leading hashbang line. + if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === '#!') + this.skipLineComment(2) +}; + +// DEPRECATED Kept for backwards compatibility until 3.0 in case a plugin uses them +Parser.prototype.isKeyword = function isKeyword (word) { return this.keywords.test(word) }; +Parser.prototype.isReservedWord = function isReservedWord (word) { return this.reservedWords.test(word) }; + +Parser.prototype.extend = function extend (name, f) { + this[name] = f(this[name]) +}; + +Parser.prototype.loadPlugins = function loadPlugins (pluginConfigs) { + var this$1 = this; + + for (var name in pluginConfigs) { + var plugin = plugins[name] + if (!plugin) throw new Error("Plugin '" + name + "' not found") + plugin(this$1, pluginConfigs[name]) + } +}; + +Parser.prototype.parse = function parse () { + var node = this.options.program || this.startNode() + this.nextToken() + return this.parseTopLevel(node) +}; + +var pp = Parser.prototype + +// ## Parser utilities + +var literal = /^(?:'((?:[^\']|\.)*)'|"((?:[^\"]|\.)*)"|;)/ +pp.strictDirective = function(start) { + var this$1 = this; + + for (;;) { + skipWhiteSpace.lastIndex = start + start += skipWhiteSpace.exec(this$1.input)[0].length + var match = literal.exec(this$1.input.slice(start)) + if (!match) return false + if ((match[1] || match[2]) == "use strict") return true + start += match[0].length + } +} + +// 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, notNext) { + if (this.type == tokType) { + if (this.options.onTrailingComma) + this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc) + if (!notNext) + 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") +} + +var DestructuringErrors = function DestructuringErrors() { + this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = -1 +}; + +pp.checkPatternErrors = function(refDestructuringErrors, isAssign) { + if (!refDestructuringErrors) return + if (refDestructuringErrors.trailingComma > -1) + this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element") + var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind + if (parens > -1) this.raiseRecoverable(parens, "Parenthesized pattern") +} + +pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) { + var pos = refDestructuringErrors ? refDestructuringErrors.shorthandAssign : -1 + if (!andThrow) return pos >= 0 + if (pos > -1) this.raise(pos, "Shorthand property assignments are valid only in destructuring patterns") +} + +pp.checkYieldAwaitInDefaultParams = function() { + if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos)) + this.raise(this.yieldPos, "Yield expression cannot be a default value") + if (this.awaitPos) + this.raise(this.awaitPos, "Await expression cannot be a default value") +} + +pp.isSimpleAssignTarget = function(expr) { + if (expr.type === "ParenthesizedExpression") + return this.isSimpleAssignTarget(expr.expression) + return expr.type === "Identifier" || expr.type === "MemberExpression" +} + +var pp$1 = 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$1.parseTopLevel = function(node) { + var this$1 = this; + + var exports = {} + if (!node.body) node.body = [] + while (this.type !== tt.eof) { + var stmt = this$1.parseStatement(true, true, exports) + node.body.push(stmt) + } + this.next() + if (this.options.ecmaVersion >= 6) { + node.sourceType = this.options.sourceType + } + return this.finishNode(node, "Program") +} + +var loopLabel = {kind: "loop"}; +var switchLabel = {kind: "switch"}; +pp$1.isLet = function() { + if (this.type !== tt.name || this.options.ecmaVersion < 6 || this.value != "let") return false + skipWhiteSpace.lastIndex = this.pos + var skip = skipWhiteSpace.exec(this.input) + var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next) + if (nextCh === 91 || nextCh == 123) return true // '{' and '[' + if (isIdentifierStart(nextCh, true)) { + for (var pos = next + 1; isIdentifierChar(this.input.charCodeAt(pos), true); ++pos) {} + var ident = this.input.slice(next, pos) + if (!this.isKeyword(ident)) return true + } + return false +} + +// check 'async [no LineTerminator here] function' +// - 'async /*foo*/ function' is OK. +// - 'async /*\n*/ function' is invalid. +pp$1.isAsyncFunction = function() { + if (this.type !== tt.name || this.options.ecmaVersion < 8 || this.value != "async") + return false + + skipWhiteSpace.lastIndex = this.pos + var skip = skipWhiteSpace.exec(this.input) + var next = this.pos + skip[0].length + return !lineBreak.test(this.input.slice(this.pos, next)) && + this.input.slice(next, next + 8) === "function" && + (next + 8 == this.input.length || !isIdentifierChar(this.input.charAt(next + 8))) +} + +// 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$1.parseStatement = function(declaration, topLevel, exports) { + var starttype = this.type, node = this.startNode(), kind + + if (this.isLet()) { + starttype = tt._var + kind = "let" + } + + // 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, false) + 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._const: case tt._var: + kind = kind || this.value + if (!declaration && kind != "var") this.unexpected() + return this.parseVarStatement(node, kind) + 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, exports) + + // 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: + if (this.isAsyncFunction() && declaration) { + this.next() + return this.parseFunctionStatement(node, true) + } + + 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$1.parseBreakContinueStatement = function(node, keyword) { + var this$1 = this; + + 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$1.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$1.parseDebuggerStatement = function(node) { + this.next() + this.semicolon() + return this.finishNode(node, "DebuggerStatement") +} + +pp$1.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$1.parseForStatement = function(node) { + this.next() + this.labels.push(loopLabel) + this.expect(tt.parenL) + if (this.type === tt.semi) return this.parseFor(node, null) + var isLet = this.isLet() + if (this.type === tt._var || this.type === tt._const || isLet) { + var init$1 = this.startNode(), kind = isLet ? "let" : this.value + this.next() + this.parseVar(init$1, true, kind) + this.finishNode(init$1, "VariableDeclaration") + if ((this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1 && + !(kind !== "var" && init$1.declarations[0].init)) + return this.parseForIn(node, init$1) + return this.parseFor(node, init$1) + } + var refDestructuringErrors = new DestructuringErrors + var init = this.parseExpression(true, refDestructuringErrors) + if (this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) { + this.toAssignable(init) + this.checkLVal(init) + this.checkPatternErrors(refDestructuringErrors, true) + return this.parseForIn(node, init) + } else { + this.checkExpressionErrors(refDestructuringErrors, true) + } + return this.parseFor(node, init) +} + +pp$1.parseFunctionStatement = function(node, isAsync) { + this.next() + return this.parseFunction(node, true, false, isAsync) +} + +pp$1.isFunction = function() { + return this.type === tt._function || this.isAsyncFunction() +} + +pp$1.parseIfStatement = function(node) { + this.next() + node.test = this.parseParenExpression() + // allow function declarations in branches, but only in non-strict mode + node.consequent = this.parseStatement(!this.strict && this.isFunction()) + node.alternate = this.eat(tt._else) ? this.parseStatement(!this.strict && this.isFunction()) : null + return this.finishNode(node, "IfStatement") +} + +pp$1.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$1.parseSwitchStatement = function(node) { + var this$1 = this; + + 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 = false; this.type != tt.braceR;) { + if (this$1.type === tt._case || this$1.type === tt._default) { + var isCase = this$1.type === tt._case + if (cur) this$1.finishNode(cur, "SwitchCase") + node.cases.push(cur = this$1.startNode()) + cur.consequent = [] + this$1.next() + if (isCase) { + cur.test = this$1.parseExpression() + } else { + if (sawDefault) this$1.raiseRecoverable(this$1.lastTokStart, "Multiple default clauses") + sawDefault = true + cur.test = null + } + this$1.expect(tt.colon) + } else { + if (!cur) this$1.unexpected() + cur.consequent.push(this$1.parseStatement(true)) + } + } + if (cur) this.finishNode(cur, "SwitchCase") + this.next() // Closing brace + this.labels.pop() + return this.finishNode(node, "SwitchStatement") +} + +pp$1.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$1.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.body = this.parseBlock() + node.handler = this.finishNode(clause, "CatchClause") + } + 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$1.parseVarStatement = function(node, kind) { + this.next() + this.parseVar(node, false, kind) + this.semicolon() + return this.finishNode(node, "VariableDeclaration") +} + +pp$1.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$1.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$1.parseEmptyStatement = function(node) { + this.next() + return this.finishNode(node, "EmptyStatement") +} + +pp$1.parseLabeledStatement = function(node, maybeName, expr) { + var this$1 = this; + + for (var i = 0; i < this.labels.length; ++i) + if (this$1.labels[i].name === maybeName) this$1.raise(expr.start, "Label '" + maybeName + "' is already declared") + var kind = this.type.isLoop ? "loop" : this.type === tt._switch ? "switch" : null + for (var i$1 = this.labels.length - 1; i$1 >= 0; i$1--) { + var label = this$1.labels[i$1] + if (label.statementStart == node.start) { + label.statementStart = this$1.start + label.kind = kind + } else break + } + this.labels.push({name: maybeName, kind: kind, statementStart: this.start}) + node.body = this.parseStatement(true) + if (node.body.type == "ClassDeclaration" || + node.body.type == "VariableDeclaration" && (this.strict || node.body.kind != "var") || + node.body.type == "FunctionDeclaration" && (this.strict || node.body.generator)) + this.raiseRecoverable(node.body.start, "Invalid labeled declaration") + this.labels.pop() + node.label = expr + return this.finishNode(node, "LabeledStatement") +} + +pp$1.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$1.parseBlock = function() { + var this$1 = this; + + var node = this.startNode() + node.body = [] + this.expect(tt.braceL) + while (!this.eat(tt.braceR)) { + var stmt = this$1.parseStatement(true) + node.body.push(stmt) + } + 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$1.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$1.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$1.parseVar = function(node, isFor, kind) { + var this$1 = this; + + node.declarations = [] + node.kind = kind + for (;;) { + var decl = this$1.startNode() + this$1.parseVarId(decl) + if (this$1.eat(tt.eq)) { + decl.init = this$1.parseMaybeAssign(isFor) + } else if (kind === "const" && !(this$1.type === tt._in || (this$1.options.ecmaVersion >= 6 && this$1.isContextual("of")))) { + this$1.unexpected() + } else if (decl.id.type != "Identifier" && !(isFor && (this$1.type === tt._in || this$1.isContextual("of")))) { + this$1.raise(this$1.lastTokEnd, "Complex binding patterns require an initialization value") + } else { + decl.init = null + } + node.declarations.push(this$1.finishNode(decl, "VariableDeclarator")) + if (!this$1.eat(tt.comma)) break + } + return node +} + +pp$1.parseVarId = function(decl) { + decl.id = this.parseBindingAtom() + this.checkLVal(decl.id, true) +} + +// Parse a function declaration or literal (depending on the +// `isStatement` parameter). + +pp$1.parseFunction = function(node, isStatement, allowExpressionBody, isAsync) { + this.initFunction(node) + if (this.options.ecmaVersion >= 6 && !isAsync) + node.generator = this.eat(tt.star) + if (this.options.ecmaVersion >= 8) + node.async = !!isAsync + + if (isStatement == null) + isStatement = this.type == tt.name + if (isStatement) + node.id = this.parseIdent() + + var oldInGen = this.inGenerator, oldInAsync = this.inAsync, + oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunction + this.inGenerator = node.generator + this.inAsync = node.async + this.yieldPos = 0 + this.awaitPos = 0 + this.inFunction = true + + if (!isStatement && this.type === tt.name) + node.id = this.parseIdent() + this.parseFunctionParams(node) + this.parseFunctionBody(node, allowExpressionBody) + + this.inGenerator = oldInGen + this.inAsync = oldInAsync + this.yieldPos = oldYieldPos + this.awaitPos = oldAwaitPos + this.inFunction = oldInFunc + return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression") +} + +pp$1.parseFunctionParams = function(node) { + this.expect(tt.parenL) + node.params = this.parseBindingList(tt.parenR, false, this.options.ecmaVersion >= 8, true) + this.checkYieldAwaitInDefaultParams() +} + +// Parse a class declaration or literal (depending on the +// `isStatement` parameter). + +pp$1.parseClass = function(node, isStatement) { + var this$1 = this; + + this.next() + if (isStatement == null) isStatement = this.type === tt.name + 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$1.eat(tt.semi)) continue + var method = this$1.startNode() + var isGenerator = this$1.eat(tt.star) + var isAsync = false + var isMaybeStatic = this$1.type === tt.name && this$1.value === "static" + this$1.parsePropertyName(method) + method.static = isMaybeStatic && this$1.type !== tt.parenL + if (method.static) { + if (isGenerator) this$1.unexpected() + isGenerator = this$1.eat(tt.star) + this$1.parsePropertyName(method) + } + if (this$1.options.ecmaVersion >= 8 && !isGenerator && !method.computed && + method.key.type === "Identifier" && method.key.name === "async" && this$1.type !== tt.parenL && + !this$1.canInsertSemicolon()) { + isAsync = true + this$1.parsePropertyName(method) + } + method.kind = "method" + var isGetSet = false + if (!method.computed) { + var key = method.key; + if (!isGenerator && !isAsync && key.type === "Identifier" && this$1.type !== tt.parenL && (key.name === "get" || key.name === "set")) { + isGetSet = true + method.kind = key.name + key = this$1.parsePropertyName(method) + } + if (!method.static && (key.type === "Identifier" && key.name === "constructor" || + key.type === "Literal" && key.value === "constructor")) { + if (hadConstructor) this$1.raise(key.start, "Duplicate constructor in the same class") + if (isGetSet) this$1.raise(key.start, "Constructor can't have get/set modifier") + if (isGenerator) this$1.raise(key.start, "Constructor can't be a generator") + if (isAsync) this$1.raise(key.start, "Constructor can't be an async method") + method.kind = "constructor" + hadConstructor = true + } + } + this$1.parseClassMethod(classBody, method, isGenerator, isAsync) + if (isGetSet) { + var paramCount = method.kind === "get" ? 0 : 1 + if (method.value.params.length !== paramCount) { + var start = method.value.start + if (method.kind === "get") + this$1.raiseRecoverable(start, "getter should have no params") + else + this$1.raiseRecoverable(start, "setter should have exactly one param") + } else { + if (method.kind === "set" && method.value.params[0].type === "RestElement") + this$1.raiseRecoverable(method.value.params[0].start, "Setter cannot use rest params") + } + } + } + node.body = this.finishNode(classBody, "ClassBody") + return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression") +} + +pp$1.parseClassMethod = function(classBody, method, isGenerator, isAsync) { + method.value = this.parseMethod(isGenerator, isAsync) + classBody.body.push(this.finishNode(method, "MethodDefinition")) +} + +pp$1.parseClassId = function(node, isStatement) { + node.id = this.type === tt.name ? this.parseIdent() : isStatement ? this.unexpected() : null +} + +pp$1.parseClassSuper = function(node) { + node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null +} + +// Parses module export declaration. + +pp$1.parseExport = function(node, exports) { + var this$1 = this; + + 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 ... + this.checkExport(exports, "default", this.lastTokStart) + var isAsync + if (this.type === tt._function || (isAsync = this.isAsyncFunction())) { + var fNode = this.startNode() + this.next() + if (isAsync) this.next() + node.declaration = this.parseFunction(fNode, null, false, isAsync) + } else if (this.type === tt._class) { + var cNode = this.startNode() + node.declaration = this.parseClass(cNode, null) + } else { + node.declaration = this.parseMaybeAssign() + this.semicolon() + } + return this.finishNode(node, "ExportDefaultDeclaration") + } + // export var|const|let|function|class ... + if (this.shouldParseExportStatement()) { + node.declaration = this.parseStatement(true) + if (node.declaration.type === "VariableDeclaration") + this.checkVariableExport(exports, node.declaration.declarations) + else + this.checkExport(exports, node.declaration.id.name, node.declaration.id.start) + node.specifiers = [] + node.source = null + } else { // export { x, y as z } [from '...'] + node.declaration = null + node.specifiers = this.parseExportSpecifiers(exports) + if (this.eatContextual("from")) { + node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected() + } else { + // check for keywords used as local names + for (var i = 0; i < node.specifiers.length; i++) { + if (this$1.keywords.test(node.specifiers[i].local.name) || this$1.reservedWords.test(node.specifiers[i].local.name)) { + this$1.unexpected(node.specifiers[i].local.start) + } + } + + node.source = null + } + this.semicolon() + } + return this.finishNode(node, "ExportNamedDeclaration") +} + +pp$1.checkExport = function(exports, name, pos) { + if (!exports) return + if (Object.prototype.hasOwnProperty.call(exports, name)) + this.raiseRecoverable(pos, "Duplicate export '" + name + "'") + exports[name] = true +} + +pp$1.checkPatternExport = function(exports, pat) { + var this$1 = this; + + var type = pat.type + if (type == "Identifier") + this.checkExport(exports, pat.name, pat.start) + else if (type == "ObjectPattern") + for (var i = 0; i < pat.properties.length; ++i) + this$1.checkPatternExport(exports, pat.properties[i].value) + else if (type == "ArrayPattern") + for (var i$1 = 0; i$1 < pat.elements.length; ++i$1) { + var elt = pat.elements[i$1] + if (elt) this$1.checkPatternExport(exports, elt) + } + else if (type == "AssignmentPattern") + this.checkPatternExport(exports, pat.left) + else if (type == "ParenthesizedExpression") + this.checkPatternExport(exports, pat.expression) +} + +pp$1.checkVariableExport = function(exports, decls) { + var this$1 = this; + + if (!exports) return + for (var i = 0; i < decls.length; i++) + this$1.checkPatternExport(exports, decls[i].id) +} + +pp$1.shouldParseExportStatement = function() { + return this.type.keyword === "var" + || this.type.keyword === "const" + || this.type.keyword === "class" + || this.type.keyword === "function" + || this.isLet() + || this.isAsyncFunction() +} + +// Parses a comma-separated list of module exports. + +pp$1.parseExportSpecifiers = function(exports) { + var this$1 = this; + + var nodes = [], first = true + // export { x, y as z } [from '...'] + this.expect(tt.braceL) + while (!this.eat(tt.braceR)) { + if (!first) { + this$1.expect(tt.comma) + if (this$1.afterTrailingComma(tt.braceR)) break + } else first = false + + var node = this$1.startNode() + node.local = this$1.parseIdent(true) + node.exported = this$1.eatContextual("as") ? this$1.parseIdent(true) : node.local + this$1.checkExport(exports, node.exported.name, node.exported.start) + nodes.push(this$1.finishNode(node, "ExportSpecifier")) + } + return nodes +} + +// Parses import declaration. + +pp$1.parseImport = function(node) { + this.next() + // import '...' + if (this.type === tt.string) { + node.specifiers = empty + node.source = this.parseExprAtom() + } 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$1.parseImportSpecifiers = function() { + var this$1 = this; + + 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$1 = this.startNode() + this.next() + this.expectContextual("as") + node$1.local = this.parseIdent() + this.checkLVal(node$1.local, true) + nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier")) + return nodes + } + this.expect(tt.braceL) + while (!this.eat(tt.braceR)) { + if (!first) { + this$1.expect(tt.comma) + if (this$1.afterTrailingComma(tt.braceR)) break + } else first = false + + var node$2 = this$1.startNode() + node$2.imported = this$1.parseIdent(true) + if (this$1.eatContextual("as")) { + node$2.local = this$1.parseIdent() + } else { + node$2.local = node$2.imported + if (this$1.isKeyword(node$2.local.name)) this$1.unexpected(node$2.local.start) + if (this$1.reservedWordsStrict.test(node$2.local.name)) this$1.raiseRecoverable(node$2.local.start, "The keyword '" + node$2.local.name + "' is reserved") + } + this$1.checkLVal(node$2.local, true) + nodes.push(this$1.finishNode(node$2, "ImportSpecifier")) + } + return nodes +} + +var pp$2 = Parser.prototype + +// Convert existing expression atom to assignable pattern +// if possible. + +pp$2.toAssignable = function(node, isBinding) { + var this$1 = this; + + if (this.options.ecmaVersion >= 6 && node) { + switch (node.type) { + case "Identifier": + if (this.inAsync && node.name === "await") + this.raise(node.start, "Can not use 'await' as identifier inside an async function") + break + + case "ObjectPattern": + case "ArrayPattern": + 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$1.raise(prop.key.start, "Object pattern can't contain getter or setter") + this$1.toAssignable(prop.value, isBinding) + } + break + + case "ArrayExpression": + node.type = "ArrayPattern" + this.toAssignableList(node.elements, isBinding) + break + + case "AssignmentExpression": + if (node.operator === "=") { + node.type = "AssignmentPattern" + delete node.operator + this.toAssignable(node.left, isBinding) + // falls through to AssignmentPattern + } else { + this.raise(node.left.end, "Only '=' operator can be used for specifying default value.") + break + } + + case "AssignmentPattern": + 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$2.toAssignableList = function(exprList, isBinding) { + var this$1 = this; + + 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 + } + + if (isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier") + this.unexpected(last.argument.start) + } + for (var i = 0; i < end; i++) { + var elt = exprList[i] + if (elt) this$1.toAssignable(elt, isBinding) + } + return exprList +} + +// Parses spread element. + +pp$2.parseSpread = function(refDestructuringErrors) { + var node = this.startNode() + this.next() + node.argument = this.parseMaybeAssign(false, refDestructuringErrors) + return this.finishNode(node, "SpreadElement") +} + +pp$2.parseRest = function(allowNonIdent) { + var node = this.startNode() + this.next() + + // RestElement inside of a function parameter must be an identifier + if (allowNonIdent) node.argument = this.type === tt.name ? this.parseIdent() : this.unexpected() + else node.argument = this.type === tt.name || this.type === tt.bracketL ? this.parseBindingAtom() : this.unexpected() + + return this.finishNode(node, "RestElement") +} + +// Parses lvalue (assignable) atom. + +pp$2.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$2.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowNonIdent) { + var this$1 = this; + + var elts = [], first = true + while (!this.eat(close)) { + if (first) first = false + else this$1.expect(tt.comma) + if (allowEmpty && this$1.type === tt.comma) { + elts.push(null) + } else if (allowTrailingComma && this$1.afterTrailingComma(close)) { + break + } else if (this$1.type === tt.ellipsis) { + var rest = this$1.parseRest(allowNonIdent) + this$1.parseBindingListItem(rest) + elts.push(rest) + if (this$1.type === tt.comma) this$1.raise(this$1.start, "Comma is not permitted after the rest element") + this$1.expect(close) + break + } else { + var elem = this$1.parseMaybeDefault(this$1.start, this$1.startLoc) + this$1.parseBindingListItem(elem) + elts.push(elem) + } + } + return elts +} + +pp$2.parseBindingListItem = function(param) { + return param +} + +// Parses assignment pattern around given atom if possible. + +pp$2.parseMaybeDefault = function(startPos, startLoc, left) { + left = left || this.parseBindingAtom() + if (this.options.ecmaVersion < 6 || !this.eat(tt.eq)) return left + var node = this.startNodeAt(startPos, startLoc) + 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$2.checkLVal = function(expr, isBinding, checkClashes) { + var this$1 = this; + + switch (expr.type) { + case "Identifier": + if (this.strict && this.reservedWordsStrictBind.test(expr.name)) + this.raiseRecoverable(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode") + if (checkClashes) { + if (has(checkClashes, expr.name)) + this.raiseRecoverable(expr.start, "Argument name clash") + checkClashes[expr.name] = true + } + break + + case "MemberExpression": + if (isBinding) this.raiseRecoverable(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression") + break + + case "ObjectPattern": + for (var i = 0; i < expr.properties.length; i++) + this$1.checkLVal(expr.properties[i].value, isBinding, checkClashes) + break + + case "ArrayPattern": + for (var i$1 = 0; i$1 < expr.elements.length; i$1++) { + var elem = expr.elements[i$1] + if (elem) this$1.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") + } +} + +// 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 + +var pp$3 = 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$3.checkPropClash = function(prop, propHash) { + if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand)) + return + var key = prop.key; + var name + switch (key.type) { + case "Identifier": name = key.name; break + case "Literal": name = String(key.value); break + default: return + } + var kind = prop.kind; + if (this.options.ecmaVersion >= 6) { + if (name === "__proto__" && kind === "init") { + if (propHash.proto) this.raiseRecoverable(key.start, "Redefinition of __proto__ property") + propHash.proto = true + } + return + } + name = "$" + name + var other = propHash[name] + if (other) { + var isGetSet = kind !== "init" + if ((this.strict || isGetSet) && other[kind] || !(isGetSet ^ other.init)) + this.raiseRecoverable(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$3.parseExpression = function(noIn, refDestructuringErrors) { + var this$1 = this; + + var startPos = this.start, startLoc = this.startLoc + var expr = this.parseMaybeAssign(noIn, refDestructuringErrors) + if (this.type === tt.comma) { + var node = this.startNodeAt(startPos, startLoc) + node.expressions = [expr] + while (this.eat(tt.comma)) node.expressions.push(this$1.parseMaybeAssign(noIn, refDestructuringErrors)) + return this.finishNode(node, "SequenceExpression") + } + return expr +} + +// Parse an assignment expression. This includes applications of +// operators like `+=`. + +pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) { + if (this.inGenerator && this.isContextual("yield")) return this.parseYield() + + var ownDestructuringErrors = false, oldParenAssign = -1 + if (refDestructuringErrors) { + oldParenAssign = refDestructuringErrors.parenthesizedAssign + refDestructuringErrors.parenthesizedAssign = -1 + } else { + refDestructuringErrors = new DestructuringErrors + ownDestructuringErrors = true + } + + 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, refDestructuringErrors) + if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc) + if (this.type.isAssign) { + this.checkPatternErrors(refDestructuringErrors, true) + if (!ownDestructuringErrors) DestructuringErrors.call(refDestructuringErrors) + var node = this.startNodeAt(startPos, startLoc) + node.operator = this.value + node.left = this.type === tt.eq ? this.toAssignable(left) : left + refDestructuringErrors.shorthandAssign = -1 // reset because shorthand default was used correctly + this.checkLVal(left) + this.next() + node.right = this.parseMaybeAssign(noIn) + return this.finishNode(node, "AssignmentExpression") + } else { + if (ownDestructuringErrors) this.checkExpressionErrors(refDestructuringErrors, true) + } + if (oldParenAssign > -1) refDestructuringErrors.parenthesizedAssign = oldParenAssign + return left +} + +// Parse a ternary conditional (`?:`) operator. + +pp$3.parseMaybeConditional = function(noIn, refDestructuringErrors) { + var startPos = this.start, startLoc = this.startLoc + var expr = this.parseExprOps(noIn, refDestructuringErrors) + if (this.checkExpressionErrors(refDestructuringErrors)) 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$3.parseExprOps = function(noIn, refDestructuringErrors) { + var startPos = this.start, startLoc = this.startLoc + var expr = this.parseMaybeUnary(refDestructuringErrors, false) + if (this.checkExpressionErrors(refDestructuringErrors)) 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$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) { + var prec = this.type.binop + if (prec != null && (!noIn || this.type !== tt._in)) { + if (prec > minPrec) { + var logical = this.type === tt.logicalOR || this.type === tt.logicalAND + var op = this.value + this.next() + var startPos = this.start, startLoc = this.startLoc + var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn) + var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical) + return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn) + } + } + return left +} + +pp$3.buildBinary = function(startPos, startLoc, left, right, op, logical) { + var node = this.startNodeAt(startPos, startLoc) + node.left = left + node.operator = op + node.right = right + return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression") +} + +// Parse unary operators, both prefix and postfix. + +pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) { + var this$1 = this; + + var startPos = this.start, startLoc = this.startLoc, expr + if (this.inAsync && this.isContextual("await")) { + expr = this.parseAwait(refDestructuringErrors) + sawUnary = true + } else 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(null, true) + this.checkExpressionErrors(refDestructuringErrors, true) + if (update) this.checkLVal(node.argument) + else if (this.strict && node.operator === "delete" && + node.argument.type === "Identifier") + this.raiseRecoverable(node.start, "Deleting local variable in strict mode") + else sawUnary = true + expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression") + } else { + expr = this.parseExprSubscripts(refDestructuringErrors) + if (this.checkExpressionErrors(refDestructuringErrors)) return expr + while (this.type.postfix && !this.canInsertSemicolon()) { + var node$1 = this$1.startNodeAt(startPos, startLoc) + node$1.operator = this$1.value + node$1.prefix = false + node$1.argument = expr + this$1.checkLVal(expr) + this$1.next() + expr = this$1.finishNode(node$1, "UpdateExpression") + } + } + + if (!sawUnary && this.eat(tt.starstar)) + return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false) + else + return expr +} + +// Parse call, dot, and `[]`-subscript expressions. + +pp$3.parseExprSubscripts = function(refDestructuringErrors) { + var startPos = this.start, startLoc = this.startLoc + var expr = this.parseExprAtom(refDestructuringErrors) + var skipArrowSubscripts = expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")" + if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) return expr + var result = this.parseSubscripts(expr, startPos, startLoc) + if (refDestructuringErrors && result.type === "MemberExpression") { + if (refDestructuringErrors.parenthesizedAssign >= result.start) refDestructuringErrors.parenthesizedAssign = -1 + if (refDestructuringErrors.parenthesizedBind >= result.start) refDestructuringErrors.parenthesizedBind = -1 + } + return result +} + +pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) { + var this$1 = this; + + var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && + this.lastTokEnd == base.end && !this.canInsertSemicolon() + for (var computed;;) { + if ((computed = this$1.eat(tt.bracketL)) || this$1.eat(tt.dot)) { + var node = this$1.startNodeAt(startPos, startLoc) + node.object = base + node.property = computed ? this$1.parseExpression() : this$1.parseIdent(true) + node.computed = !!computed + if (computed) this$1.expect(tt.bracketR) + base = this$1.finishNode(node, "MemberExpression") + } else if (!noCalls && this$1.eat(tt.parenL)) { + var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this$1.yieldPos, oldAwaitPos = this$1.awaitPos + this$1.yieldPos = 0 + this$1.awaitPos = 0 + var exprList = this$1.parseExprList(tt.parenR, this$1.options.ecmaVersion >= 8, false, refDestructuringErrors) + if (maybeAsyncArrow && !this$1.canInsertSemicolon() && this$1.eat(tt.arrow)) { + this$1.checkPatternErrors(refDestructuringErrors, false) + this$1.checkYieldAwaitInDefaultParams() + this$1.yieldPos = oldYieldPos + this$1.awaitPos = oldAwaitPos + return this$1.parseArrowExpression(this$1.startNodeAt(startPos, startLoc), exprList, true) + } + this$1.checkExpressionErrors(refDestructuringErrors, true) + this$1.yieldPos = oldYieldPos || this$1.yieldPos + this$1.awaitPos = oldAwaitPos || this$1.awaitPos + var node$1 = this$1.startNodeAt(startPos, startLoc) + node$1.callee = base + node$1.arguments = exprList + base = this$1.finishNode(node$1, "CallExpression") + } else if (this$1.type === tt.backQuote) { + var node$2 = this$1.startNodeAt(startPos, startLoc) + node$2.tag = base + node$2.quasi = this$1.parseTemplate() + base = this$1.finishNode(node$2, "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$3.parseExprAtom = function(refDestructuringErrors) { + var node, canBeArrow = this.potentialArrowAt == this.start + switch (this.type) { + case tt._super: + if (!this.inFunction) + this.raise(this.start, "'super' outside of function or class") + + case tt._this: + var type = this.type === tt._this ? "ThisExpression" : "Super" + node = this.startNode() + this.next() + return this.finishNode(node, type) + + case tt.name: + var startPos = this.start, startLoc = this.startLoc + var id = this.parseIdent(this.type !== tt.name) + if (this.options.ecmaVersion >= 8 && id.name === "async" && !this.canInsertSemicolon() && this.eat(tt._function)) + return this.parseFunction(this.startNodeAt(startPos, startLoc), false, false, true) + if (canBeArrow && !this.canInsertSemicolon()) { + if (this.eat(tt.arrow)) + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false) + if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === tt.name) { + id = this.parseIdent() + if (this.canInsertSemicolon() || !this.eat(tt.arrow)) + this.unexpected() + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true) + } + } + 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: + var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow) + if (refDestructuringErrors) { + if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr)) + refDestructuringErrors.parenthesizedAssign = start + if (refDestructuringErrors.parenthesizedBind < 0) + refDestructuringErrors.parenthesizedBind = start + } + return expr + + case tt.bracketL: + node = this.startNode() + this.next() + node.elements = this.parseExprList(tt.bracketR, true, true, refDestructuringErrors) + return this.finishNode(node, "ArrayExpression") + + case tt.braceL: + return this.parseObj(false, refDestructuringErrors) + + 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$3.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$3.parseParenExpression = function() { + this.expect(tt.parenL) + var val = this.parseExpression() + this.expect(tt.parenR) + return val +} + +pp$3.parseParenAndDistinguishExpression = function(canBeArrow) { + var this$1 = this; + + var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8 + if (this.options.ecmaVersion >= 6) { + this.next() + + var innerStartPos = this.start, innerStartLoc = this.startLoc + var exprList = [], first = true, lastIsComma = false + var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart, innerParenStart + this.yieldPos = 0 + this.awaitPos = 0 + while (this.type !== tt.parenR) { + first ? first = false : this$1.expect(tt.comma) + if (allowTrailingComma && this$1.afterTrailingComma(tt.parenR, true)) { + lastIsComma = true + break + } else if (this$1.type === tt.ellipsis) { + spreadStart = this$1.start + exprList.push(this$1.parseParenItem(this$1.parseRest())) + if (this$1.type === tt.comma) this$1.raise(this$1.start, "Comma is not permitted after the rest element") + break + } else { + if (this$1.type === tt.parenL && !innerParenStart) { + innerParenStart = this$1.start + } + exprList.push(this$1.parseMaybeAssign(false, refDestructuringErrors, this$1.parseParenItem)) + } + } + var innerEndPos = this.start, innerEndLoc = this.startLoc + this.expect(tt.parenR) + + if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) { + this.checkPatternErrors(refDestructuringErrors, false) + this.checkYieldAwaitInDefaultParams() + if (innerParenStart) this.unexpected(innerParenStart) + this.yieldPos = oldYieldPos + this.awaitPos = oldAwaitPos + return this.parseParenArrowList(startPos, startLoc, exprList) + } + + if (!exprList.length || lastIsComma) this.unexpected(this.lastTokStart) + if (spreadStart) this.unexpected(spreadStart) + this.checkExpressionErrors(refDestructuringErrors, true) + this.yieldPos = oldYieldPos || this.yieldPos + this.awaitPos = oldAwaitPos || this.awaitPos + + 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$3.parseParenItem = function(item) { + return item +} + +pp$3.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 noCalls +// argument to parseSubscripts to prevent it from consuming the +// argument list. + +var empty$1 = [] + +pp$3.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.raiseRecoverable(node.property.start, "The only valid meta property for new is new.target") + if (!this.inFunction) + this.raiseRecoverable(node.start, "new.target can only be used in functions") + 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, this.options.ecmaVersion >= 8, false) + else node.arguments = empty$1 + return this.finishNode(node, "NewExpression") +} + +// Parse template expression. + +pp$3.parseTemplateElement = function() { + var elem = this.startNode() + elem.value = { + raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, '\n'), + cooked: this.value + } + this.next() + elem.tail = this.type === tt.backQuote + return this.finishNode(elem, "TemplateElement") +} + +pp$3.parseTemplate = function() { + var this$1 = this; + + var node = this.startNode() + this.next() + node.expressions = [] + var curElt = this.parseTemplateElement() + node.quasis = [curElt] + while (!curElt.tail) { + this$1.expect(tt.dollarBraceL) + node.expressions.push(this$1.parseExpression()) + this$1.expect(tt.braceR) + node.quasis.push(curElt = this$1.parseTemplateElement()) + } + this.next() + return this.finishNode(node, "TemplateLiteral") +} + +// Parse an object literal or binding pattern. + +pp$3.parseObj = function(isPattern, refDestructuringErrors) { + var this$1 = this; + + var node = this.startNode(), first = true, propHash = {} + node.properties = [] + this.next() + while (!this.eat(tt.braceR)) { + if (!first) { + this$1.expect(tt.comma) + if (this$1.afterTrailingComma(tt.braceR)) break + } else first = false + + var prop = this$1.startNode(), isGenerator, isAsync, startPos, startLoc + if (this$1.options.ecmaVersion >= 6) { + prop.method = false + prop.shorthand = false + if (isPattern || refDestructuringErrors) { + startPos = this$1.start + startLoc = this$1.startLoc + } + if (!isPattern) + isGenerator = this$1.eat(tt.star) + } + this$1.parsePropertyName(prop) + if (!isPattern && this$1.options.ecmaVersion >= 8 && !isGenerator && !prop.computed && + prop.key.type === "Identifier" && prop.key.name === "async" && this$1.type !== tt.parenL && + this$1.type !== tt.colon && !this$1.canInsertSemicolon()) { + isAsync = true + this$1.parsePropertyName(prop, refDestructuringErrors) + } else { + isAsync = false + } + this$1.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors) + this$1.checkPropClash(prop, propHash) + node.properties.push(this$1.finishNode(prop, "Property")) + } + return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression") +} + +pp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors) { + if ((isGenerator || isAsync) && this.type === tt.colon) + this.unexpected() + + if (this.eat(tt.colon)) { + prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors) + 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, isAsync) + } 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 || isAsync || isPattern) this.unexpected() + prop.kind = prop.key.name + this.parsePropertyName(prop) + prop.value = this.parseMethod(false) + var paramCount = prop.kind === "get" ? 0 : 1 + if (prop.value.params.length !== paramCount) { + var start = prop.value.start + if (prop.kind === "get") + this.raiseRecoverable(start, "getter should have no params") + else + this.raiseRecoverable(start, "setter should have exactly one param") + } else { + if (prop.kind === "set" && prop.value.params[0].type === "RestElement") + this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params") + } + } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") { + if (this.keywords.test(prop.key.name) || + (this.strict ? this.reservedWordsStrict : this.reservedWords).test(prop.key.name) || + (this.inGenerator && prop.key.name == "yield") || + (this.inAsync && prop.key.name == "await")) + this.raiseRecoverable(prop.key.start, "'" + prop.key.name + "' can not be used as shorthand property") + prop.kind = "init" + if (isPattern) { + prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key) + } else if (this.type === tt.eq && refDestructuringErrors) { + if (refDestructuringErrors.shorthandAssign < 0) + refDestructuringErrors.shorthandAssign = this.start + prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key) + } else { + prop.value = prop.key + } + prop.shorthand = true + } else this.unexpected() +} + +pp$3.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$3.initFunction = function(node) { + node.id = null + if (this.options.ecmaVersion >= 6) { + node.generator = false + node.expression = false + } + if (this.options.ecmaVersion >= 8) + node.async = false +} + +// Parse object or class method. + +pp$3.parseMethod = function(isGenerator, isAsync) { + var node = this.startNode(), oldInGen = this.inGenerator, oldInAsync = this.inAsync, + oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunction + + this.initFunction(node) + if (this.options.ecmaVersion >= 6) + node.generator = isGenerator + if (this.options.ecmaVersion >= 8) + node.async = !!isAsync + + this.inGenerator = node.generator + this.inAsync = node.async + this.yieldPos = 0 + this.awaitPos = 0 + this.inFunction = true + + this.expect(tt.parenL) + node.params = this.parseBindingList(tt.parenR, false, this.options.ecmaVersion >= 8) + this.checkYieldAwaitInDefaultParams() + this.parseFunctionBody(node, false) + + this.inGenerator = oldInGen + this.inAsync = oldInAsync + this.yieldPos = oldYieldPos + this.awaitPos = oldAwaitPos + this.inFunction = oldInFunc + return this.finishNode(node, "FunctionExpression") +} + +// Parse arrow function expression with given parameters. + +pp$3.parseArrowExpression = function(node, params, isAsync) { + var oldInGen = this.inGenerator, oldInAsync = this.inAsync, + oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldInFunc = this.inFunction + + this.initFunction(node) + if (this.options.ecmaVersion >= 8) + node.async = !!isAsync + + this.inGenerator = false + this.inAsync = node.async + this.yieldPos = 0 + this.awaitPos = 0 + this.inFunction = true + + node.params = this.toAssignableList(params, true) + this.parseFunctionBody(node, true) + + this.inGenerator = oldInGen + this.inAsync = oldInAsync + this.yieldPos = oldYieldPos + this.awaitPos = oldAwaitPos + this.inFunction = oldInFunc + return this.finishNode(node, "ArrowFunctionExpression") +} + +// Parse function body and check parameters. + +pp$3.parseFunctionBody = function(node, isArrowFunction) { + var isExpression = isArrowFunction && this.type !== tt.braceL + var oldStrict = this.strict, useStrict = false + + if (isExpression) { + node.body = this.parseMaybeAssign() + node.expression = true + } else { + var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params) + if (!oldStrict || nonSimple) { + useStrict = this.strictDirective(this.end) + // 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 (useStrict && nonSimple) + this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list") + } + // Start a new scope with regard to labels and the `inFunction` + // flag (restore them to their old value afterwards). + var oldLabels = this.labels + this.labels = [] + if (useStrict) this.strict = true + node.body = this.parseBlock(true) + node.expression = false + this.labels = oldLabels + } + + if (oldStrict || useStrict) { + this.strict = true + if (node.id) + this.checkLVal(node.id, true) + this.checkParams(node) + this.strict = oldStrict + } else if (isArrowFunction || !this.isSimpleParamList(node.params)) { + this.checkParams(node) + } +} + +pp$3.isSimpleParamList = function(params) { + for (var i = 0; i < params.length; i++) + if (params[i].type !== "Identifier") return false + return true +} + +// Checks function params for various disallowed patterns such as using "eval" +// or "arguments" and duplicate parameters. + +pp$3.checkParams = function(node) { + var this$1 = this; + + var nameHash = {} + for (var i = 0; i < node.params.length; i++) this$1.checkLVal(node.params[i], true, nameHash) +} + +// 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$3.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) { + var this$1 = this; + + var elts = [], first = true + while (!this.eat(close)) { + if (!first) { + this$1.expect(tt.comma) + if (allowTrailingComma && this$1.afterTrailingComma(close)) break + } else first = false + + var elt + if (allowEmpty && this$1.type === tt.comma) + elt = null + else if (this$1.type === tt.ellipsis) { + elt = this$1.parseSpread(refDestructuringErrors) + if (refDestructuringErrors && this$1.type === tt.comma && refDestructuringErrors.trailingComma < 0) + refDestructuringErrors.trailingComma = this$1.start + } else { + elt = this$1.parseMaybeAssign(false, refDestructuringErrors) + } + elts.push(elt) + } + 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$3.parseIdent = function(liberal) { + var node = this.startNode() + if (liberal && this.options.allowReserved == "never") liberal = false + if (this.type === tt.name) { + if (!liberal && (this.strict ? this.reservedWordsStrict : this.reservedWords).test(this.value) && + (this.options.ecmaVersion >= 6 || + this.input.slice(this.start, this.end).indexOf("\\") == -1)) + this.raiseRecoverable(this.start, "The keyword '" + this.value + "' is reserved") + if (this.inGenerator && this.value === "yield") + this.raiseRecoverable(this.start, "Can not use 'yield' as identifier inside a generator") + if (this.inAsync && this.value === "await") + this.raiseRecoverable(this.start, "Can not use 'await' as identifier inside an async function") + 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$3.parseYield = function() { + if (!this.yieldPos) this.yieldPos = this.start + + 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") +} + +pp$3.parseAwait = function() { + if (!this.awaitPos) this.awaitPos = this.start + + var node = this.startNode() + this.next() + node.argument = this.parseMaybeUnary(null, true) + return this.finishNode(node, "AwaitExpression") +} + +var pp$4 = 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$4.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$4.raiseRecoverable = pp$4.raise + +pp$4.curPosition = function() { + if (this.options.locations) { + return new Position(this.curLine, this.pos - this.lineStart) + } +} + +var Node = function Node(parser, pos, loc) { + this.type = "" + this.start = pos + this.end = 0 + if (parser.options.locations) + this.loc = new SourceLocation(parser, loc) + if (parser.options.directSourceFile) + this.sourceFile = parser.options.directSourceFile + if (parser.options.ranges) + this.range = [pos, 0] +}; + +// Start an AST node, attaching a start offset. + +var pp$5 = Parser.prototype + +pp$5.startNode = function() { + return new Node(this, this.start, this.startLoc) +} + +pp$5.startNodeAt = function(pos, loc) { + return new Node(this, pos, loc) +} + +// Finish an AST node, adding `type` and `end` properties. + +function finishNodeAt(node, type, pos, loc) { + node.type = type + node.end = pos + if (this.options.locations) + node.loc.end = loc + if (this.options.ranges) + node.range[1] = pos + return node +} + +pp$5.finishNode = function(node, type) { + return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc) +} + +// Finish node at given position + +pp$5.finishNodeAt = function(node, type, pos, loc) { + return finishNodeAt.call(this, node, type, pos, loc) +} + +// 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 TokContext = function TokContext(token, isExpr, preserveSpace, override) { + 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) +} + +var pp$6 = Parser.prototype + +pp$6.initialContext = function() { + return [types.b_stat] +} + +pp$6.braceIsBlock = function(prevType) { + if (prevType === tt.colon) { + var parent = this.curContext() + if (parent === types.b_stat || parent === types.b_expr) + 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 || prevType === tt.parenR) + return true + if (prevType == tt.braceL) + return this.curContext() === types.b_stat + return !this.exprAllowed +} + +pp$6.updateContext = function(prevType) { + var update, 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() { + // tokExprAllowed stays unchanged +} + +tt._function.updateContext = function(prevType) { + if (prevType.beforeExpr && prevType !== tt.semi && prevType !== tt._else && + !((prevType === tt.colon || prevType === tt.braceL) && 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 +} + +// 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 = function Token(p) { + 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$7 = Parser.prototype + +// Are we running under Rhino? +var isRhino = typeof Packages == "object" && Object.prototype.toString.call(Packages) == "[object JavaPackage]" + +// Move to the next token + +pp$7.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$7.getToken = function() { + this.next() + return new Token(this) +} + +// If we're in an ES6 environment, make parsers iterable +if (typeof Symbol !== "undefined") + pp$7[Symbol.iterator] = function () { + var self = this + return {next: function () { + 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$7.curContext = function() { + return this.context[this.context.length - 1] +} + +// Read a single token, updating the parser object's token-related +// properties. + +pp$7.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$7.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$7.fullCharCodeAtPos = function() { + var code = this.input.charCodeAt(this.pos) + if (code <= 0xd7ff || code >= 0xe000) return code + var next = this.input.charCodeAt(this.pos + 1) + return (code << 10) + next - 0x35fdc00 +} + +pp$7.skipBlockComment = function() { + var this$1 = this; + + var startLoc = this.options.onComment && 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 + while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) { + ++this$1.curLine + this$1.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.curPosition()) +} + +pp$7.skipLineComment = function(startSkip) { + var this$1 = this; + + var start = this.pos + var startLoc = this.options.onComment && 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$1.pos + ch = this$1.input.charCodeAt(this$1.pos) + } + if (this.options.onComment) + this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos, + startLoc, this.curPosition()) +} + +// Called at the start of the parse and after every token. Skips +// whitespace and comments, and. + +pp$7.skipSpace = function() { + var this$1 = this; + + loop: while (this.pos < this.input.length) { + var ch = this$1.input.charCodeAt(this$1.pos) + switch (ch) { + case 32: case 160: // ' ' + ++this$1.pos + break + case 13: + if (this$1.input.charCodeAt(this$1.pos + 1) === 10) { + ++this$1.pos + } + case 10: case 8232: case 8233: + ++this$1.pos + if (this$1.options.locations) { + ++this$1.curLine + this$1.lineStart = this$1.pos + } + break + case 47: // '/' + switch (this$1.input.charCodeAt(this$1.pos + 1)) { + case 42: // '*' + this$1.skipBlockComment() + break + case 47: + this$1.skipLineComment(2) + break + default: + break loop + } + break + default: + if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { + ++this$1.pos + } else { + break loop + } + } + } +} + +// 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$7.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$7.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$7.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$7.readToken_mult_modulo_exp = function(code) { // '%*' + var next = this.input.charCodeAt(this.pos + 1) + var size = 1 + var tokentype = code === 42 ? tt.star : tt.modulo + + // exponentiation operator ** and **= + if (this.options.ecmaVersion >= 7 && next === 42) { + ++size + tokentype = tt.starstar + next = this.input.charCodeAt(this.pos + 2) + } + + if (next === 61) return this.finishOp(tt.assign, size + 1) + return this.finishOp(tokentype, size) +} + +pp$7.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$7.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$7.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$7.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$7.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() + // `` 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$7.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$7.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() + // ` + +### anyTypeAnnotation +```javascript +t.anyTypeAnnotation() +``` + +See also `t.isAnyTypeAnnotation(node, opts)` and `t.assertAnyTypeAnnotation(node, opts)`. + +Aliases: `Flow`, `FlowBaseAnnotation` + + +--- + +### arrayExpression +```javascript +t.arrayExpression(elements) +``` + +See also `t.isArrayExpression(node, opts)` and `t.assertArrayExpression(node, opts)`. + +Aliases: `Expression` + + - `elements`: `Array` (default: `[]`) + +--- + +### arrayPattern +```javascript +t.arrayPattern(elements, typeAnnotation) +``` + +See also `t.isArrayPattern(node, opts)` and `t.assertArrayPattern(node, opts)`. + +Aliases: `Pattern`, `LVal` + + - `elements`: `Array` (required) + - `typeAnnotation` (required) + - `decorators`: `Array` (default: `null`) + +--- + +### arrayTypeAnnotation +```javascript +t.arrayTypeAnnotation(elementType) +``` + +See also `t.isArrayTypeAnnotation(node, opts)` and `t.assertArrayTypeAnnotation(node, opts)`. + +Aliases: `Flow` + + - `elementType` (required) + +--- + +### arrowFunctionExpression +```javascript +t.arrowFunctionExpression(params, body, async) +``` + +See also `t.isArrowFunctionExpression(node, opts)` and `t.assertArrowFunctionExpression(node, opts)`. + +Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Expression`, `Pureish` + + - `params`: `Array` (required) + - `body`: `BlockStatement | Expression` (required) + - `async`: `boolean` (default: `false`) + - `returnType` (default: `null`) + - `typeParameters` (default: `null`) + +--- + +### assignmentExpression +```javascript +t.assignmentExpression(operator, left, right) +``` + +See also `t.isAssignmentExpression(node, opts)` and `t.assertAssignmentExpression(node, opts)`. + +Aliases: `Expression` + + - `operator`: `string` (required) + - `left`: `LVal` (required) + - `right`: `Expression` (required) + +--- + +### assignmentPattern +```javascript +t.assignmentPattern(left, right) +``` + +See also `t.isAssignmentPattern(node, opts)` and `t.assertAssignmentPattern(node, opts)`. + +Aliases: `Pattern`, `LVal` + + - `left`: `Identifier` (required) + - `right`: `Expression` (required) + - `decorators`: `Array` (default: `null`) + +--- + +### awaitExpression +```javascript +t.awaitExpression(argument) +``` + +See also `t.isAwaitExpression(node, opts)` and `t.assertAwaitExpression(node, opts)`. + +Aliases: `Expression`, `Terminatorless` + + - `argument`: `Expression` (required) + +--- + +### binaryExpression +```javascript +t.binaryExpression(operator, left, right) +``` + +See also `t.isBinaryExpression(node, opts)` and `t.assertBinaryExpression(node, opts)`. + +Aliases: `Binary`, `Expression` + + - `operator`: `'+' | '-' | '/' | '%' | '*' | '**' | '&' | '|' | '>>' | '>>>' | '<<' | '^' | '==' | '===' | '!=' | '!==' | 'in' | 'instanceof' | '>' | '<' | '>=' | '<='` (required) + - `left`: `Expression` (required) + - `right`: `Expression` (required) + +--- + +### bindExpression +```javascript +t.bindExpression(object, callee) +``` + +See also `t.isBindExpression(node, opts)` and `t.assertBindExpression(node, opts)`. + +Aliases: `Expression` + + - `object` (required) + - `callee` (required) + +--- + +### blockStatement +```javascript +t.blockStatement(body, directives) +``` + +See also `t.isBlockStatement(node, opts)` and `t.assertBlockStatement(node, opts)`. + +Aliases: `Scopable`, `BlockParent`, `Block`, `Statement` + + - `body`: `Array` (required) + - `directives`: `Array` (default: `[]`) + +--- + +### booleanLiteral +```javascript +t.booleanLiteral(value) +``` + +See also `t.isBooleanLiteral(node, opts)` and `t.assertBooleanLiteral(node, opts)`. + +Aliases: `Expression`, `Pureish`, `Literal`, `Immutable` + + - `value`: `boolean` (required) + +--- + +### booleanLiteralTypeAnnotation +```javascript +t.booleanLiteralTypeAnnotation() +``` + +See also `t.isBooleanLiteralTypeAnnotation(node, opts)` and `t.assertBooleanLiteralTypeAnnotation(node, opts)`. + +Aliases: `Flow` + + +--- + +### booleanTypeAnnotation +```javascript +t.booleanTypeAnnotation() +``` + +See also `t.isBooleanTypeAnnotation(node, opts)` and `t.assertBooleanTypeAnnotation(node, opts)`. + +Aliases: `Flow`, `FlowBaseAnnotation` + + +--- + +### breakStatement +```javascript +t.breakStatement(label) +``` + +See also `t.isBreakStatement(node, opts)` and `t.assertBreakStatement(node, opts)`. + +Aliases: `Statement`, `Terminatorless`, `CompletionStatement` + + - `label`: `Identifier` (default: `null`) + +--- + +### callExpression +```javascript +t.callExpression(callee, arguments) +``` + +See also `t.isCallExpression(node, opts)` and `t.assertCallExpression(node, opts)`. + +Aliases: `Expression` + + - `callee`: `Expression` (required) + - `arguments`: `Array` (required) + +--- + +### catchClause +```javascript +t.catchClause(param, body) +``` + +See also `t.isCatchClause(node, opts)` and `t.assertCatchClause(node, opts)`. + +Aliases: `Scopable` + + - `param`: `Identifier` (required) + - `body`: `BlockStatement` (required) + +--- + +### classBody +```javascript +t.classBody(body) +``` + +See also `t.isClassBody(node, opts)` and `t.assertClassBody(node, opts)`. + + - `body`: `Array` (required) + +--- + +### classDeclaration +```javascript +t.classDeclaration(id, superClass, body, decorators) +``` + +See also `t.isClassDeclaration(node, opts)` and `t.assertClassDeclaration(node, opts)`. + +Aliases: `Scopable`, `Class`, `Statement`, `Declaration`, `Pureish` + + - `id`: `Identifier` (required) + - `superClass`: `Expression` (default: `null`) + - `body`: `ClassBody` (required) + - `decorators`: `Array` (required) + - `implements` (default: `null`) + - `mixins` (default: `null`) + - `superTypeParameters` (default: `null`) + - `typeParameters` (default: `null`) + +--- + +### classExpression +```javascript +t.classExpression(id, superClass, body, decorators) +``` + +See also `t.isClassExpression(node, opts)` and `t.assertClassExpression(node, opts)`. + +Aliases: `Scopable`, `Class`, `Expression`, `Pureish` + + - `id`: `Identifier` (default: `null`) + - `superClass`: `Expression` (default: `null`) + - `body`: `ClassBody` (required) + - `decorators`: `Array` (required) + - `implements` (default: `null`) + - `mixins` (default: `null`) + - `superTypeParameters` (default: `null`) + - `typeParameters` (default: `null`) + +--- + +### classImplements +```javascript +t.classImplements(id, typeParameters) +``` + +See also `t.isClassImplements(node, opts)` and `t.assertClassImplements(node, opts)`. + +Aliases: `Flow` + + - `id` (required) + - `typeParameters` (required) + +--- + +### classMethod +```javascript +t.classMethod(kind, key, params, body, computed, static) +``` + +See also `t.isClassMethod(node, opts)` and `t.assertClassMethod(node, opts)`. + +Aliases: `Function`, `Scopable`, `BlockParent`, `FunctionParent`, `Method` + + - `kind`: `"get" | "set" | "method" | "constructor"` (default: `'method'`) + - `key`if computed then `Expression` else `Identifier | Literal` (required) + - `params`: `Array` (required) + - `body`: `BlockStatement` (required) + - `computed`: `boolean` (default: `false`) + - `static`: `boolean` (default: `false`) + - `async`: `boolean` (default: `false`) + - `decorators` (default: `null`) + - `generator`: `boolean` (default: `false`) + - `returnType` (default: `null`) + - `typeParameters` (default: `null`) + +--- + +### classProperty +```javascript +t.classProperty(key, value, typeAnnotation, decorators, computed) +``` + +See also `t.isClassProperty(node, opts)` and `t.assertClassProperty(node, opts)`. + +Aliases: `Property` + + - `key` (required) + - `value` (required) + - `typeAnnotation` (required) + - `decorators` (required) + - `computed`: `boolean` (default: `false`) + +--- + +### conditionalExpression +```javascript +t.conditionalExpression(test, consequent, alternate) +``` + +See also `t.isConditionalExpression(node, opts)` and `t.assertConditionalExpression(node, opts)`. + +Aliases: `Expression`, `Conditional` + + - `test`: `Expression` (required) + - `consequent`: `Expression` (required) + - `alternate`: `Expression` (required) + +--- + +### continueStatement +```javascript +t.continueStatement(label) +``` + +See also `t.isContinueStatement(node, opts)` and `t.assertContinueStatement(node, opts)`. + +Aliases: `Statement`, `Terminatorless`, `CompletionStatement` + + - `label`: `Identifier` (default: `null`) + +--- + +### debuggerStatement +```javascript +t.debuggerStatement() +``` + +See also `t.isDebuggerStatement(node, opts)` and `t.assertDebuggerStatement(node, opts)`. + +Aliases: `Statement` + + +--- + +### declareClass +```javascript +t.declareClass(id, typeParameters, extends, body) +``` + +See also `t.isDeclareClass(node, opts)` and `t.assertDeclareClass(node, opts)`. + +Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` + + - `id` (required) + - `typeParameters` (required) + - `extends` (required) + - `body` (required) + +--- + +### declareExportDeclaration +```javascript +t.declareExportDeclaration(declaration, specifiers, source) +``` + +See also `t.isDeclareExportDeclaration(node, opts)` and `t.assertDeclareExportDeclaration(node, opts)`. + +Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` + + - `declaration` (required) + - `specifiers` (required) + - `source` (required) + +--- + +### declareFunction +```javascript +t.declareFunction(id) +``` + +See also `t.isDeclareFunction(node, opts)` and `t.assertDeclareFunction(node, opts)`. + +Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` + + - `id` (required) + +--- + +### declareInterface +```javascript +t.declareInterface(id, typeParameters, extends, body) +``` + +See also `t.isDeclareInterface(node, opts)` and `t.assertDeclareInterface(node, opts)`. + +Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` + + - `id` (required) + - `typeParameters` (required) + - `extends` (required) + - `body` (required) + +--- + +### declareModule +```javascript +t.declareModule(id, body) +``` + +See also `t.isDeclareModule(node, opts)` and `t.assertDeclareModule(node, opts)`. + +Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` + + - `id` (required) + - `body` (required) + +--- + +### declareModuleExports +```javascript +t.declareModuleExports(typeAnnotation) +``` + +See also `t.isDeclareModuleExports(node, opts)` and `t.assertDeclareModuleExports(node, opts)`. + +Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` + + - `typeAnnotation` (required) + +--- + +### declareOpaqueType +```javascript +t.declareOpaqueType(id, typeParameters, supertype) +``` + +See also `t.isDeclareOpaqueType(node, opts)` and `t.assertDeclareOpaqueType(node, opts)`. + +Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` + + - `id` (required) + - `typeParameters` (required) + - `supertype` (required) + +--- + +### declareTypeAlias +```javascript +t.declareTypeAlias(id, typeParameters, right) +``` + +See also `t.isDeclareTypeAlias(node, opts)` and `t.assertDeclareTypeAlias(node, opts)`. + +Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` + + - `id` (required) + - `typeParameters` (required) + - `right` (required) + +--- + +### declareVariable +```javascript +t.declareVariable(id) +``` + +See also `t.isDeclareVariable(node, opts)` and `t.assertDeclareVariable(node, opts)`. + +Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` + + - `id` (required) + +--- + +### decorator +```javascript +t.decorator(expression) +``` + +See also `t.isDecorator(node, opts)` and `t.assertDecorator(node, opts)`. + + - `expression`: `Expression` (required) + +--- + +### directive +```javascript +t.directive(value) +``` + +See also `t.isDirective(node, opts)` and `t.assertDirective(node, opts)`. + + - `value`: `DirectiveLiteral` (required) + +--- + +### directiveLiteral +```javascript +t.directiveLiteral(value) +``` + +See also `t.isDirectiveLiteral(node, opts)` and `t.assertDirectiveLiteral(node, opts)`. + + - `value`: `string` (required) + +--- + +### doExpression +```javascript +t.doExpression(body) +``` + +See also `t.isDoExpression(node, opts)` and `t.assertDoExpression(node, opts)`. + +Aliases: `Expression` + + - `body`: `BlockStatement` (required) + +--- + +### doWhileStatement +```javascript +t.doWhileStatement(test, body) +``` + +See also `t.isDoWhileStatement(node, opts)` and `t.assertDoWhileStatement(node, opts)`. + +Aliases: `Statement`, `BlockParent`, `Loop`, `While`, `Scopable` + + - `test`: `Expression` (required) + - `body`: `Statement` (required) + +--- + +### emptyStatement +```javascript +t.emptyStatement() +``` + +See also `t.isEmptyStatement(node, opts)` and `t.assertEmptyStatement(node, opts)`. + +Aliases: `Statement` + + +--- + +### emptyTypeAnnotation +```javascript +t.emptyTypeAnnotation() +``` + +See also `t.isEmptyTypeAnnotation(node, opts)` and `t.assertEmptyTypeAnnotation(node, opts)`. + +Aliases: `Flow`, `FlowBaseAnnotation` + + +--- + +### existentialTypeParam +```javascript +t.existentialTypeParam() +``` + +See also `t.isExistentialTypeParam(node, opts)` and `t.assertExistentialTypeParam(node, opts)`. + +Aliases: `Flow` + + +--- + +### exportAllDeclaration +```javascript +t.exportAllDeclaration(source) +``` + +See also `t.isExportAllDeclaration(node, opts)` and `t.assertExportAllDeclaration(node, opts)`. + +Aliases: `Statement`, `Declaration`, `ModuleDeclaration`, `ExportDeclaration` + + - `source`: `StringLiteral` (required) + +--- + +### exportDefaultDeclaration +```javascript +t.exportDefaultDeclaration(declaration) +``` + +See also `t.isExportDefaultDeclaration(node, opts)` and `t.assertExportDefaultDeclaration(node, opts)`. + +Aliases: `Statement`, `Declaration`, `ModuleDeclaration`, `ExportDeclaration` + + - `declaration`: `FunctionDeclaration | ClassDeclaration | Expression` (required) + +--- + +### exportDefaultSpecifier +```javascript +t.exportDefaultSpecifier(exported) +``` + +See also `t.isExportDefaultSpecifier(node, opts)` and `t.assertExportDefaultSpecifier(node, opts)`. + +Aliases: `ModuleSpecifier` + + - `exported`: `Identifier` (required) + +--- + +### exportNamedDeclaration +```javascript +t.exportNamedDeclaration(declaration, specifiers, source) +``` + +See also `t.isExportNamedDeclaration(node, opts)` and `t.assertExportNamedDeclaration(node, opts)`. + +Aliases: `Statement`, `Declaration`, `ModuleDeclaration`, `ExportDeclaration` + + - `declaration`: `Declaration` (default: `null`) + - `specifiers`: `Array` (required) + - `source`: `StringLiteral` (default: `null`) + +--- + +### exportNamespaceSpecifier +```javascript +t.exportNamespaceSpecifier(exported) +``` + +See also `t.isExportNamespaceSpecifier(node, opts)` and `t.assertExportNamespaceSpecifier(node, opts)`. + +Aliases: `ModuleSpecifier` + + - `exported`: `Identifier` (required) + +--- + +### exportSpecifier +```javascript +t.exportSpecifier(local, exported) +``` + +See also `t.isExportSpecifier(node, opts)` and `t.assertExportSpecifier(node, opts)`. + +Aliases: `ModuleSpecifier` + + - `local`: `Identifier` (required) + - `exported`: `Identifier` (required) + +--- + +### expressionStatement +```javascript +t.expressionStatement(expression) +``` + +See also `t.isExpressionStatement(node, opts)` and `t.assertExpressionStatement(node, opts)`. + +Aliases: `Statement`, `ExpressionWrapper` + + - `expression`: `Expression` (required) + +--- + +### file +```javascript +t.file(program, comments, tokens) +``` + +See also `t.isFile(node, opts)` and `t.assertFile(node, opts)`. + + - `program`: `Program` (required) + - `comments` (required) + - `tokens` (required) + +--- + +### forAwaitStatement +```javascript +t.forAwaitStatement(left, right, body) +``` + +See also `t.isForAwaitStatement(node, opts)` and `t.assertForAwaitStatement(node, opts)`. + +Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement` + + - `left`: `VariableDeclaration | LVal` (required) + - `right`: `Expression` (required) + - `body`: `Statement` (required) + +--- + +### forInStatement +```javascript +t.forInStatement(left, right, body) +``` + +See also `t.isForInStatement(node, opts)` and `t.assertForInStatement(node, opts)`. + +Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement` + + - `left`: `VariableDeclaration | LVal` (required) + - `right`: `Expression` (required) + - `body`: `Statement` (required) + +--- + +### forOfStatement +```javascript +t.forOfStatement(left, right, body) +``` + +See also `t.isForOfStatement(node, opts)` and `t.assertForOfStatement(node, opts)`. + +Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement` + + - `left`: `VariableDeclaration | LVal` (required) + - `right`: `Expression` (required) + - `body`: `Statement` (required) + +--- + +### forStatement +```javascript +t.forStatement(init, test, update, body) +``` + +See also `t.isForStatement(node, opts)` and `t.assertForStatement(node, opts)`. + +Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop` + + - `init`: `VariableDeclaration | Expression` (default: `null`) + - `test`: `Expression` (default: `null`) + - `update`: `Expression` (default: `null`) + - `body`: `Statement` (required) + +--- + +### functionDeclaration +```javascript +t.functionDeclaration(id, params, body, generator, async) +``` + +See also `t.isFunctionDeclaration(node, opts)` and `t.assertFunctionDeclaration(node, opts)`. + +Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Statement`, `Pureish`, `Declaration` + + - `id`: `Identifier` (required) + - `params`: `Array` (required) + - `body`: `BlockStatement` (required) + - `generator`: `boolean` (default: `false`) + - `async`: `boolean` (default: `false`) + - `returnType` (default: `null`) + - `typeParameters` (default: `null`) + +--- + +### functionExpression +```javascript +t.functionExpression(id, params, body, generator, async) +``` + +See also `t.isFunctionExpression(node, opts)` and `t.assertFunctionExpression(node, opts)`. + +Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Expression`, `Pureish` + + - `id`: `Identifier` (default: `null`) + - `params`: `Array` (required) + - `body`: `BlockStatement` (required) + - `generator`: `boolean` (default: `false`) + - `async`: `boolean` (default: `false`) + - `returnType` (default: `null`) + - `typeParameters` (default: `null`) + +--- + +### functionTypeAnnotation +```javascript +t.functionTypeAnnotation(typeParameters, params, rest, returnType) +``` + +See also `t.isFunctionTypeAnnotation(node, opts)` and `t.assertFunctionTypeAnnotation(node, opts)`. + +Aliases: `Flow` + + - `typeParameters` (required) + - `params` (required) + - `rest` (required) + - `returnType` (required) + +--- + +### functionTypeParam +```javascript +t.functionTypeParam(name, typeAnnotation) +``` + +See also `t.isFunctionTypeParam(node, opts)` and `t.assertFunctionTypeParam(node, opts)`. + +Aliases: `Flow` + + - `name` (required) + - `typeAnnotation` (required) + +--- + +### genericTypeAnnotation +```javascript +t.genericTypeAnnotation(id, typeParameters) +``` + +See also `t.isGenericTypeAnnotation(node, opts)` and `t.assertGenericTypeAnnotation(node, opts)`. + +Aliases: `Flow` + + - `id` (required) + - `typeParameters` (required) + +--- + +### identifier +```javascript +t.identifier(name) +``` + +See also `t.isIdentifier(node, opts)` and `t.assertIdentifier(node, opts)`. + +Aliases: `Expression`, `LVal` + + - `name``string` (required) + - `decorators`: `Array` (default: `null`) + - `typeAnnotation` (default: `null`) + +--- + +### ifStatement +```javascript +t.ifStatement(test, consequent, alternate) +``` + +See also `t.isIfStatement(node, opts)` and `t.assertIfStatement(node, opts)`. + +Aliases: `Statement`, `Conditional` + + - `test`: `Expression` (required) + - `consequent`: `Statement` (required) + - `alternate`: `Statement` (default: `null`) + +--- + +### import +```javascript +t.import() +``` + +See also `t.isImport(node, opts)` and `t.assertImport(node, opts)`. + +Aliases: `Expression` + + +--- + +### importDeclaration +```javascript +t.importDeclaration(specifiers, source) +``` + +See also `t.isImportDeclaration(node, opts)` and `t.assertImportDeclaration(node, opts)`. + +Aliases: `Statement`, `Declaration`, `ModuleDeclaration` + + - `specifiers`: `Array` (required) + - `source`: `StringLiteral` (required) + +--- + +### importDefaultSpecifier +```javascript +t.importDefaultSpecifier(local) +``` + +See also `t.isImportDefaultSpecifier(node, opts)` and `t.assertImportDefaultSpecifier(node, opts)`. + +Aliases: `ModuleSpecifier` + + - `local`: `Identifier` (required) + +--- + +### importNamespaceSpecifier +```javascript +t.importNamespaceSpecifier(local) +``` + +See also `t.isImportNamespaceSpecifier(node, opts)` and `t.assertImportNamespaceSpecifier(node, opts)`. + +Aliases: `ModuleSpecifier` + + - `local`: `Identifier` (required) + +--- + +### importSpecifier +```javascript +t.importSpecifier(local, imported) +``` + +See also `t.isImportSpecifier(node, opts)` and `t.assertImportSpecifier(node, opts)`. + +Aliases: `ModuleSpecifier` + + - `local`: `Identifier` (required) + - `imported`: `Identifier` (required) + - `importKind`: `null | 'type' | 'typeof'` (default: `null`) + +--- + +### interfaceDeclaration +```javascript +t.interfaceDeclaration(id, typeParameters, extends, body) +``` + +See also `t.isInterfaceDeclaration(node, opts)` and `t.assertInterfaceDeclaration(node, opts)`. + +Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` + + - `id` (required) + - `typeParameters` (required) + - `extends` (required) + - `body` (required) + +--- + +### interfaceExtends +```javascript +t.interfaceExtends(id, typeParameters) +``` + +See also `t.isInterfaceExtends(node, opts)` and `t.assertInterfaceExtends(node, opts)`. + +Aliases: `Flow` + + - `id` (required) + - `typeParameters` (required) + +--- + +### intersectionTypeAnnotation +```javascript +t.intersectionTypeAnnotation(types) +``` + +See also `t.isIntersectionTypeAnnotation(node, opts)` and `t.assertIntersectionTypeAnnotation(node, opts)`. + +Aliases: `Flow` + + - `types` (required) + +--- + +### jSXAttribute +```javascript +t.jSXAttribute(name, value) +``` + +See also `t.isJSXAttribute(node, opts)` and `t.assertJSXAttribute(node, opts)`. + +Aliases: `JSX`, `Immutable` + + - `name`: `JSXIdentifier | JSXNamespacedName` (required) + - `value`: `JSXElement | StringLiteral | JSXExpressionContainer` (default: `null`) + +--- + +### jSXClosingElement +```javascript +t.jSXClosingElement(name) +``` + +See also `t.isJSXClosingElement(node, opts)` and `t.assertJSXClosingElement(node, opts)`. + +Aliases: `JSX`, `Immutable` + + - `name`: `JSXIdentifier | JSXMemberExpression` (required) + +--- + +### jSXElement +```javascript +t.jSXElement(openingElement, closingElement, children, selfClosing) +``` + +See also `t.isJSXElement(node, opts)` and `t.assertJSXElement(node, opts)`. + +Aliases: `JSX`, `Immutable`, `Expression` + + - `openingElement`: `JSXOpeningElement` (required) + - `closingElement`: `JSXClosingElement` (default: `null`) + - `children`: `Array` (required) + - `selfClosing` (required) + +--- + +### jSXEmptyExpression +```javascript +t.jSXEmptyExpression() +``` + +See also `t.isJSXEmptyExpression(node, opts)` and `t.assertJSXEmptyExpression(node, opts)`. + +Aliases: `JSX`, `Expression` + + +--- + +### jSXExpressionContainer +```javascript +t.jSXExpressionContainer(expression) +``` + +See also `t.isJSXExpressionContainer(node, opts)` and `t.assertJSXExpressionContainer(node, opts)`. + +Aliases: `JSX`, `Immutable` + + - `expression`: `Expression` (required) + +--- + +### jSXIdentifier +```javascript +t.jSXIdentifier(name) +``` + +See also `t.isJSXIdentifier(node, opts)` and `t.assertJSXIdentifier(node, opts)`. + +Aliases: `JSX`, `Expression` + + - `name`: `string` (required) + +--- + +### jSXMemberExpression +```javascript +t.jSXMemberExpression(object, property) +``` + +See also `t.isJSXMemberExpression(node, opts)` and `t.assertJSXMemberExpression(node, opts)`. + +Aliases: `JSX`, `Expression` + + - `object`: `JSXMemberExpression | JSXIdentifier` (required) + - `property`: `JSXIdentifier` (required) + +--- + +### jSXNamespacedName +```javascript +t.jSXNamespacedName(namespace, name) +``` + +See also `t.isJSXNamespacedName(node, opts)` and `t.assertJSXNamespacedName(node, opts)`. + +Aliases: `JSX` + + - `namespace`: `JSXIdentifier` (required) + - `name`: `JSXIdentifier` (required) + +--- + +### jSXOpeningElement +```javascript +t.jSXOpeningElement(name, attributes, selfClosing) +``` + +See also `t.isJSXOpeningElement(node, opts)` and `t.assertJSXOpeningElement(node, opts)`. + +Aliases: `JSX`, `Immutable` + + - `name`: `JSXIdentifier | JSXMemberExpression` (required) + - `attributes`: `Array` (required) + - `selfClosing`: `boolean` (default: `false`) + +--- + +### jSXSpreadAttribute +```javascript +t.jSXSpreadAttribute(argument) +``` + +See also `t.isJSXSpreadAttribute(node, opts)` and `t.assertJSXSpreadAttribute(node, opts)`. + +Aliases: `JSX` + + - `argument`: `Expression` (required) + +--- + +### jSXSpreadChild +```javascript +t.jSXSpreadChild(expression) +``` + +See also `t.isJSXSpreadChild(node, opts)` and `t.assertJSXSpreadChild(node, opts)`. + +Aliases: `JSX`, `Immutable` + + - `expression`: `Expression` (required) + +--- + +### jSXText +```javascript +t.jSXText(value) +``` + +See also `t.isJSXText(node, opts)` and `t.assertJSXText(node, opts)`. + +Aliases: `JSX`, `Immutable` + + - `value`: `string` (required) + +--- + +### labeledStatement +```javascript +t.labeledStatement(label, body) +``` + +See also `t.isLabeledStatement(node, opts)` and `t.assertLabeledStatement(node, opts)`. + +Aliases: `Statement` + + - `label`: `Identifier` (required) + - `body`: `Statement` (required) + +--- + +### logicalExpression +```javascript +t.logicalExpression(operator, left, right) +``` + +See also `t.isLogicalExpression(node, opts)` and `t.assertLogicalExpression(node, opts)`. + +Aliases: `Binary`, `Expression` + + - `operator`: `'||' | '&&'` (required) + - `left`: `Expression` (required) + - `right`: `Expression` (required) + +--- + +### memberExpression +```javascript +t.memberExpression(object, property, computed) +``` + +See also `t.isMemberExpression(node, opts)` and `t.assertMemberExpression(node, opts)`. + +Aliases: `Expression`, `LVal` + + - `object`: `Expression` (required) + - `property`if computed then `Expression` else `Identifier` (required) + - `computed`: `boolean` (default: `false`) + +--- + +### metaProperty +```javascript +t.metaProperty(meta, property) +``` + +See also `t.isMetaProperty(node, opts)` and `t.assertMetaProperty(node, opts)`. + +Aliases: `Expression` + + - `meta`: `string` (required) + - `property`: `string` (required) + +--- + +### mixedTypeAnnotation +```javascript +t.mixedTypeAnnotation() +``` + +See also `t.isMixedTypeAnnotation(node, opts)` and `t.assertMixedTypeAnnotation(node, opts)`. + +Aliases: `Flow`, `FlowBaseAnnotation` + + +--- + +### newExpression +```javascript +t.newExpression(callee, arguments) +``` + +See also `t.isNewExpression(node, opts)` and `t.assertNewExpression(node, opts)`. + +Aliases: `Expression` + + - `callee`: `Expression` (required) + - `arguments`: `Array` (required) + +--- + +### noop +```javascript +t.noop() +``` + +See also `t.isNoop(node, opts)` and `t.assertNoop(node, opts)`. + + +--- + +### nullLiteral +```javascript +t.nullLiteral() +``` + +See also `t.isNullLiteral(node, opts)` and `t.assertNullLiteral(node, opts)`. + +Aliases: `Expression`, `Pureish`, `Literal`, `Immutable` + + +--- + +### nullLiteralTypeAnnotation +```javascript +t.nullLiteralTypeAnnotation() +``` + +See also `t.isNullLiteralTypeAnnotation(node, opts)` and `t.assertNullLiteralTypeAnnotation(node, opts)`. + +Aliases: `Flow`, `FlowBaseAnnotation` + + +--- + +### nullableTypeAnnotation +```javascript +t.nullableTypeAnnotation(typeAnnotation) +``` + +See also `t.isNullableTypeAnnotation(node, opts)` and `t.assertNullableTypeAnnotation(node, opts)`. + +Aliases: `Flow` + + - `typeAnnotation` (required) + +--- + +### numberTypeAnnotation +```javascript +t.numberTypeAnnotation() +``` + +See also `t.isNumberTypeAnnotation(node, opts)` and `t.assertNumberTypeAnnotation(node, opts)`. + +Aliases: `Flow`, `FlowBaseAnnotation` + + +--- + +### numericLiteral +```javascript +t.numericLiteral(value) +``` + +See also `t.isNumericLiteral(node, opts)` and `t.assertNumericLiteral(node, opts)`. + +Aliases: `Expression`, `Pureish`, `Literal`, `Immutable` + + - `value`: `number` (required) + +--- + +### numericLiteralTypeAnnotation +```javascript +t.numericLiteralTypeAnnotation() +``` + +See also `t.isNumericLiteralTypeAnnotation(node, opts)` and `t.assertNumericLiteralTypeAnnotation(node, opts)`. + +Aliases: `Flow` + + +--- + +### objectExpression +```javascript +t.objectExpression(properties) +``` + +See also `t.isObjectExpression(node, opts)` and `t.assertObjectExpression(node, opts)`. + +Aliases: `Expression` + + - `properties`: `Array` (required) + +--- + +### objectMethod +```javascript +t.objectMethod(kind, key, params, body, computed) +``` + +See also `t.isObjectMethod(node, opts)` and `t.assertObjectMethod(node, opts)`. + +Aliases: `UserWhitespacable`, `Function`, `Scopable`, `BlockParent`, `FunctionParent`, `Method`, `ObjectMember` + + - `kind`: `"method" | "get" | "set"` (default: `'method'`) + - `key`if computed then `Expression` else `Identifier | Literal` (required) + - `params` (required) + - `body`: `BlockStatement` (required) + - `computed`: `boolean` (default: `false`) + - `async`: `boolean` (default: `false`) + - `decorators`: `Array` (default: `null`) + - `generator`: `boolean` (default: `false`) + - `returnType` (default: `null`) + - `typeParameters` (default: `null`) + +--- + +### objectPattern +```javascript +t.objectPattern(properties, typeAnnotation) +``` + +See also `t.isObjectPattern(node, opts)` and `t.assertObjectPattern(node, opts)`. + +Aliases: `Pattern`, `LVal` + + - `properties`: `Array` (required) + - `typeAnnotation` (required) + - `decorators`: `Array` (default: `null`) + +--- + +### objectProperty +```javascript +t.objectProperty(key, value, computed, shorthand, decorators) +``` + +See also `t.isObjectProperty(node, opts)` and `t.assertObjectProperty(node, opts)`. + +Aliases: `UserWhitespacable`, `Property`, `ObjectMember` + + - `key`if computed then `Expression` else `Identifier | Literal` (required) + - `value`: `Expression | Pattern | RestElement` (required) + - `computed`: `boolean` (default: `false`) + - `shorthand`: `boolean` (default: `false`) + - `decorators`: `Array` (default: `null`) + +--- + +### objectTypeAnnotation +```javascript +t.objectTypeAnnotation(properties, indexers, callProperties) +``` + +See also `t.isObjectTypeAnnotation(node, opts)` and `t.assertObjectTypeAnnotation(node, opts)`. + +Aliases: `Flow` + + - `properties` (required) + - `indexers` (required) + - `callProperties` (required) + +--- + +### objectTypeCallProperty +```javascript +t.objectTypeCallProperty(value) +``` + +See also `t.isObjectTypeCallProperty(node, opts)` and `t.assertObjectTypeCallProperty(node, opts)`. + +Aliases: `Flow`, `UserWhitespacable` + + - `value` (required) + +--- + +### objectTypeIndexer +```javascript +t.objectTypeIndexer(id, key, value) +``` + +See also `t.isObjectTypeIndexer(node, opts)` and `t.assertObjectTypeIndexer(node, opts)`. + +Aliases: `Flow`, `UserWhitespacable` + + - `id` (required) + - `key` (required) + - `value` (required) + +--- + +### objectTypeProperty +```javascript +t.objectTypeProperty(key, value) +``` + +See also `t.isObjectTypeProperty(node, opts)` and `t.assertObjectTypeProperty(node, opts)`. + +Aliases: `Flow`, `UserWhitespacable` + + - `key` (required) + - `value` (required) + +--- + +### objectTypeSpreadProperty +```javascript +t.objectTypeSpreadProperty(argument) +``` + +See also `t.isObjectTypeSpreadProperty(node, opts)` and `t.assertObjectTypeSpreadProperty(node, opts)`. + +Aliases: `Flow`, `UserWhitespacable` + + - `argument` (required) + +--- + +### opaqueType +```javascript +t.opaqueType(id, typeParameters, impltype, supertype) +``` + +See also `t.isOpaqueType(node, opts)` and `t.assertOpaqueType(node, opts)`. + +Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` + + - `id` (required) + - `typeParameters` (required) + - `impltype` (required) + - `supertype` (required) + +--- + +### parenthesizedExpression +```javascript +t.parenthesizedExpression(expression) +``` + +See also `t.isParenthesizedExpression(node, opts)` and `t.assertParenthesizedExpression(node, opts)`. + +Aliases: `Expression`, `ExpressionWrapper` + + - `expression`: `Expression` (required) + +--- + +### program +```javascript +t.program(body, directives) +``` + +See also `t.isProgram(node, opts)` and `t.assertProgram(node, opts)`. + +Aliases: `Scopable`, `BlockParent`, `Block`, `FunctionParent` + + - `body`: `Array` (required) + - `directives`: `Array` (default: `[]`) + +--- + +### qualifiedTypeIdentifier +```javascript +t.qualifiedTypeIdentifier(id, qualification) +``` + +See also `t.isQualifiedTypeIdentifier(node, opts)` and `t.assertQualifiedTypeIdentifier(node, opts)`. + +Aliases: `Flow` + + - `id` (required) + - `qualification` (required) + +--- + +### regExpLiteral +```javascript +t.regExpLiteral(pattern, flags) +``` + +See also `t.isRegExpLiteral(node, opts)` and `t.assertRegExpLiteral(node, opts)`. + +Aliases: `Expression`, `Literal` + + - `pattern`: `string` (required) + - `flags`: `string` (default: `''`) + +--- + +### restElement +```javascript +t.restElement(argument, typeAnnotation) +``` + +See also `t.isRestElement(node, opts)` and `t.assertRestElement(node, opts)`. + +Aliases: `LVal` + + - `argument`: `LVal` (required) + - `typeAnnotation` (required) + - `decorators`: `Array` (default: `null`) + +--- + +### restProperty +```javascript +t.restProperty(argument) +``` + +See also `t.isRestProperty(node, opts)` and `t.assertRestProperty(node, opts)`. + +Aliases: `UnaryLike` + + - `argument`: `LVal` (required) + +--- + +### returnStatement +```javascript +t.returnStatement(argument) +``` + +See also `t.isReturnStatement(node, opts)` and `t.assertReturnStatement(node, opts)`. + +Aliases: `Statement`, `Terminatorless`, `CompletionStatement` + + - `argument`: `Expression` (default: `null`) + +--- + +### sequenceExpression +```javascript +t.sequenceExpression(expressions) +``` + +See also `t.isSequenceExpression(node, opts)` and `t.assertSequenceExpression(node, opts)`. + +Aliases: `Expression` + + - `expressions`: `Array` (required) + +--- + +### spreadElement +```javascript +t.spreadElement(argument) +``` + +See also `t.isSpreadElement(node, opts)` and `t.assertSpreadElement(node, opts)`. + +Aliases: `UnaryLike` + + - `argument`: `Expression` (required) + +--- + +### spreadProperty +```javascript +t.spreadProperty(argument) +``` + +See also `t.isSpreadProperty(node, opts)` and `t.assertSpreadProperty(node, opts)`. + +Aliases: `UnaryLike` + + - `argument`: `Expression` (required) + +--- + +### stringLiteral +```javascript +t.stringLiteral(value) +``` + +See also `t.isStringLiteral(node, opts)` and `t.assertStringLiteral(node, opts)`. + +Aliases: `Expression`, `Pureish`, `Literal`, `Immutable` + + - `value`: `string` (required) + +--- + +### stringLiteralTypeAnnotation +```javascript +t.stringLiteralTypeAnnotation() +``` + +See also `t.isStringLiteralTypeAnnotation(node, opts)` and `t.assertStringLiteralTypeAnnotation(node, opts)`. + +Aliases: `Flow` + + +--- + +### stringTypeAnnotation +```javascript +t.stringTypeAnnotation() +``` + +See also `t.isStringTypeAnnotation(node, opts)` and `t.assertStringTypeAnnotation(node, opts)`. + +Aliases: `Flow`, `FlowBaseAnnotation` + + +--- + +### super +```javascript +t.super() +``` + +See also `t.isSuper(node, opts)` and `t.assertSuper(node, opts)`. + +Aliases: `Expression` + + +--- + +### switchCase +```javascript +t.switchCase(test, consequent) +``` + +See also `t.isSwitchCase(node, opts)` and `t.assertSwitchCase(node, opts)`. + + - `test`: `Expression` (default: `null`) + - `consequent`: `Array` (required) + +--- + +### switchStatement +```javascript +t.switchStatement(discriminant, cases) +``` + +See also `t.isSwitchStatement(node, opts)` and `t.assertSwitchStatement(node, opts)`. + +Aliases: `Statement`, `BlockParent`, `Scopable` + + - `discriminant`: `Expression` (required) + - `cases`: `Array` (required) + +--- + +### taggedTemplateExpression +```javascript +t.taggedTemplateExpression(tag, quasi) +``` + +See also `t.isTaggedTemplateExpression(node, opts)` and `t.assertTaggedTemplateExpression(node, opts)`. + +Aliases: `Expression` + + - `tag`: `Expression` (required) + - `quasi`: `TemplateLiteral` (required) + +--- + +### templateElement +```javascript +t.templateElement(value, tail) +``` + +See also `t.isTemplateElement(node, opts)` and `t.assertTemplateElement(node, opts)`. + + - `value` (required) + - `tail`: `boolean` (default: `false`) + +--- + +### templateLiteral +```javascript +t.templateLiteral(quasis, expressions) +``` + +See also `t.isTemplateLiteral(node, opts)` and `t.assertTemplateLiteral(node, opts)`. + +Aliases: `Expression`, `Literal` + + - `quasis`: `Array` (required) + - `expressions`: `Array` (required) + +--- + +### thisExpression +```javascript +t.thisExpression() +``` + +See also `t.isThisExpression(node, opts)` and `t.assertThisExpression(node, opts)`. + +Aliases: `Expression` + + +--- + +### thisTypeAnnotation +```javascript +t.thisTypeAnnotation() +``` + +See also `t.isThisTypeAnnotation(node, opts)` and `t.assertThisTypeAnnotation(node, opts)`. + +Aliases: `Flow`, `FlowBaseAnnotation` + + +--- + +### throwStatement +```javascript +t.throwStatement(argument) +``` + +See also `t.isThrowStatement(node, opts)` and `t.assertThrowStatement(node, opts)`. + +Aliases: `Statement`, `Terminatorless`, `CompletionStatement` + + - `argument`: `Expression` (required) + +--- + +### tryStatement +```javascript +t.tryStatement(block, handler, finalizer) +``` + +See also `t.isTryStatement(node, opts)` and `t.assertTryStatement(node, opts)`. + +Aliases: `Statement` + + - `block` (required) + - `handler` (default: `null`) + - `finalizer`: `BlockStatement` (default: `null`) + - `body`: `BlockStatement` (default: `null`) + +--- + +### tupleTypeAnnotation +```javascript +t.tupleTypeAnnotation(types) +``` + +See also `t.isTupleTypeAnnotation(node, opts)` and `t.assertTupleTypeAnnotation(node, opts)`. + +Aliases: `Flow` + + - `types` (required) + +--- + +### typeAlias +```javascript +t.typeAlias(id, typeParameters, right) +``` + +See also `t.isTypeAlias(node, opts)` and `t.assertTypeAlias(node, opts)`. + +Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` + + - `id` (required) + - `typeParameters` (required) + - `right` (required) + +--- + +### typeAnnotation +```javascript +t.typeAnnotation(typeAnnotation) +``` + +See also `t.isTypeAnnotation(node, opts)` and `t.assertTypeAnnotation(node, opts)`. + +Aliases: `Flow` + + - `typeAnnotation` (required) + +--- + +### typeCastExpression +```javascript +t.typeCastExpression(expression, typeAnnotation) +``` + +See also `t.isTypeCastExpression(node, opts)` and `t.assertTypeCastExpression(node, opts)`. + +Aliases: `Flow`, `ExpressionWrapper`, `Expression` + + - `expression` (required) + - `typeAnnotation` (required) + +--- + +### typeParameter +```javascript +t.typeParameter(bound) +``` + +See also `t.isTypeParameter(node, opts)` and `t.assertTypeParameter(node, opts)`. + +Aliases: `Flow` + + - `bound` (required) + +--- + +### typeParameterDeclaration +```javascript +t.typeParameterDeclaration(params) +``` + +See also `t.isTypeParameterDeclaration(node, opts)` and `t.assertTypeParameterDeclaration(node, opts)`. + +Aliases: `Flow` + + - `params` (required) + +--- + +### typeParameterInstantiation +```javascript +t.typeParameterInstantiation(params) +``` + +See also `t.isTypeParameterInstantiation(node, opts)` and `t.assertTypeParameterInstantiation(node, opts)`. + +Aliases: `Flow` + + - `params` (required) + +--- + +### typeofTypeAnnotation +```javascript +t.typeofTypeAnnotation(argument) +``` + +See also `t.isTypeofTypeAnnotation(node, opts)` and `t.assertTypeofTypeAnnotation(node, opts)`. + +Aliases: `Flow` + + - `argument` (required) + +--- + +### unaryExpression +```javascript +t.unaryExpression(operator, argument, prefix) +``` + +See also `t.isUnaryExpression(node, opts)` and `t.assertUnaryExpression(node, opts)`. + +Aliases: `UnaryLike`, `Expression` + + - `operator`: `'void' | 'delete' | '!' | '+' | '-' | '++' | '--' | '~' | 'typeof'` (required) + - `argument`: `Expression` (required) + - `prefix`: `boolean` (default: `true`) + +--- + +### unionTypeAnnotation +```javascript +t.unionTypeAnnotation(types) +``` + +See also `t.isUnionTypeAnnotation(node, opts)` and `t.assertUnionTypeAnnotation(node, opts)`. + +Aliases: `Flow` + + - `types` (required) + +--- + +### updateExpression +```javascript +t.updateExpression(operator, argument, prefix) +``` + +See also `t.isUpdateExpression(node, opts)` and `t.assertUpdateExpression(node, opts)`. + +Aliases: `Expression` + + - `operator`: `'++' | '--'` (required) + - `argument`: `Expression` (required) + - `prefix`: `boolean` (default: `false`) + +--- + +### variableDeclaration +```javascript +t.variableDeclaration(kind, declarations) +``` + +See also `t.isVariableDeclaration(node, opts)` and `t.assertVariableDeclaration(node, opts)`. + +Aliases: `Statement`, `Declaration` + + - `kind`: `"var" | "let" | "const"` (required) + - `declarations`: `Array` (required) + +--- + +### variableDeclarator +```javascript +t.variableDeclarator(id, init) +``` + +See also `t.isVariableDeclarator(node, opts)` and `t.assertVariableDeclarator(node, opts)`. + + - `id`: `LVal` (required) + - `init`: `Expression` (default: `null`) + +--- + +### voidTypeAnnotation +```javascript +t.voidTypeAnnotation() +``` + +See also `t.isVoidTypeAnnotation(node, opts)` and `t.assertVoidTypeAnnotation(node, opts)`. + +Aliases: `Flow`, `FlowBaseAnnotation` + + +--- + +### whileStatement +```javascript +t.whileStatement(test, body) +``` + +See also `t.isWhileStatement(node, opts)` and `t.assertWhileStatement(node, opts)`. + +Aliases: `Statement`, `BlockParent`, `Loop`, `While`, `Scopable` + + - `test`: `Expression` (required) + - `body`: `BlockStatement | Statement` (required) + +--- + +### withStatement +```javascript +t.withStatement(object, body) +``` + +See also `t.isWithStatement(node, opts)` and `t.assertWithStatement(node, opts)`. + +Aliases: `Statement` + + - `object` (required) + - `body`: `BlockStatement | Statement` (required) + +--- + +### yieldExpression +```javascript +t.yieldExpression(argument, delegate) +``` + +See also `t.isYieldExpression(node, opts)` and `t.assertYieldExpression(node, opts)`. + +Aliases: `Expression`, `Terminatorless` + + - `argument`: `Expression` (default: `null`) + - `delegate`: `boolean` (default: `false`) + +--- + + + + diff --git a/node_modules/babel-types/lib/constants.js b/node_modules/babel-types/lib/constants.js new file mode 100644 index 0000000..ba15090 --- /dev/null +++ b/node_modules/babel-types/lib/constants.js @@ -0,0 +1,38 @@ +"use strict"; + +exports.__esModule = true; +exports.NOT_LOCAL_BINDING = exports.BLOCK_SCOPED_SYMBOL = exports.INHERIT_KEYS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = exports.BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.UPDATE_OPERATORS = exports.LOGICAL_OPERATORS = exports.COMMENT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = undefined; + +var _for = require("babel-runtime/core-js/symbol/for"); + +var _for2 = _interopRequireDefault(_for); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var STATEMENT_OR_BLOCK_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"]; +var FLATTENABLE_KEYS = exports.FLATTENABLE_KEYS = ["body", "expressions"]; +var FOR_INIT_KEYS = exports.FOR_INIT_KEYS = ["left", "init"]; +var COMMENT_KEYS = exports.COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"]; + +var LOGICAL_OPERATORS = exports.LOGICAL_OPERATORS = ["||", "&&"]; +var UPDATE_OPERATORS = exports.UPDATE_OPERATORS = ["++", "--"]; + +var BOOLEAN_NUMBER_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="]; +var EQUALITY_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="]; +var COMPARISON_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = [].concat(EQUALITY_BINARY_OPERATORS, ["in", "instanceof"]); +var BOOLEAN_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = [].concat(COMPARISON_BINARY_OPERATORS, BOOLEAN_NUMBER_BINARY_OPERATORS); +var NUMBER_BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"]; +var BINARY_OPERATORS = exports.BINARY_OPERATORS = ["+"].concat(NUMBER_BINARY_OPERATORS, BOOLEAN_BINARY_OPERATORS); + +var BOOLEAN_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = ["delete", "!"]; +var NUMBER_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = ["+", "-", "++", "--", "~"]; +var STRING_UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = ["typeof"]; +var UNARY_OPERATORS = exports.UNARY_OPERATORS = ["void"].concat(BOOLEAN_UNARY_OPERATORS, NUMBER_UNARY_OPERATORS, STRING_UNARY_OPERATORS); + +var INHERIT_KEYS = exports.INHERIT_KEYS = { + optional: ["typeAnnotation", "typeParameters", "returnType"], + force: ["start", "loc", "end"] +}; + +var BLOCK_SCOPED_SYMBOL = exports.BLOCK_SCOPED_SYMBOL = (0, _for2.default)("var used to be block scoped"); +var NOT_LOCAL_BINDING = exports.NOT_LOCAL_BINDING = (0, _for2.default)("should not be considered a local binding"); \ No newline at end of file diff --git a/node_modules/babel-types/lib/converters.js b/node_modules/babel-types/lib/converters.js new file mode 100644 index 0000000..bd0a3c6 --- /dev/null +++ b/node_modules/babel-types/lib/converters.js @@ -0,0 +1,350 @@ +"use strict"; + +exports.__esModule = true; + +var _maxSafeInteger = require("babel-runtime/core-js/number/max-safe-integer"); + +var _maxSafeInteger2 = _interopRequireDefault(_maxSafeInteger); + +var _stringify = require("babel-runtime/core-js/json/stringify"); + +var _stringify2 = _interopRequireDefault(_stringify); + +var _getIterator2 = require("babel-runtime/core-js/get-iterator"); + +var _getIterator3 = _interopRequireDefault(_getIterator2); + +exports.toComputedKey = toComputedKey; +exports.toSequenceExpression = toSequenceExpression; +exports.toKeyAlias = toKeyAlias; +exports.toIdentifier = toIdentifier; +exports.toBindingIdentifierName = toBindingIdentifierName; +exports.toStatement = toStatement; +exports.toExpression = toExpression; +exports.toBlock = toBlock; +exports.valueToNode = valueToNode; + +var _isPlainObject = require("lodash/isPlainObject"); + +var _isPlainObject2 = _interopRequireDefault(_isPlainObject); + +var _isRegExp = require("lodash/isRegExp"); + +var _isRegExp2 = _interopRequireDefault(_isRegExp); + +var _index = require("./index"); + +var t = _interopRequireWildcard(_index); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function toComputedKey(node) { + var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : node.key || node.property; + + if (!node.computed) { + if (t.isIdentifier(key)) key = t.stringLiteral(key.name); + } + return key; +} + +function gatherSequenceExpressions(nodes, scope, declars) { + var exprs = []; + var ensureLastUndefined = true; + + for (var _iterator = nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var node = _ref; + + ensureLastUndefined = false; + + if (t.isExpression(node)) { + exprs.push(node); + } else if (t.isExpressionStatement(node)) { + exprs.push(node.expression); + } else if (t.isVariableDeclaration(node)) { + if (node.kind !== "var") return; + + for (var _iterator2 = node.declarations, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var declar = _ref2; + + var bindings = t.getBindingIdentifiers(declar); + for (var key in bindings) { + declars.push({ + kind: node.kind, + id: bindings[key] + }); + } + + if (declar.init) { + exprs.push(t.assignmentExpression("=", declar.id, declar.init)); + } + } + + ensureLastUndefined = true; + } else if (t.isIfStatement(node)) { + var consequent = node.consequent ? gatherSequenceExpressions([node.consequent], scope, declars) : scope.buildUndefinedNode(); + var alternate = node.alternate ? gatherSequenceExpressions([node.alternate], scope, declars) : scope.buildUndefinedNode(); + if (!consequent || !alternate) return; + + exprs.push(t.conditionalExpression(node.test, consequent, alternate)); + } else if (t.isBlockStatement(node)) { + var body = gatherSequenceExpressions(node.body, scope, declars); + if (!body) return; + + exprs.push(body); + } else if (t.isEmptyStatement(node)) { + ensureLastUndefined = true; + } else { + return; + } + } + + if (ensureLastUndefined) { + exprs.push(scope.buildUndefinedNode()); + } + + if (exprs.length === 1) { + return exprs[0]; + } else { + return t.sequenceExpression(exprs); + } +} + +function toSequenceExpression(nodes, scope) { + if (!nodes || !nodes.length) return; + + var declars = []; + var result = gatherSequenceExpressions(nodes, scope, declars); + if (!result) return; + + for (var _iterator3 = declars, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var declar = _ref3; + + scope.push(declar); + } + + return result; +} + +function toKeyAlias(node) { + var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : node.key; + + var alias = void 0; + + if (node.kind === "method") { + return toKeyAlias.increment() + ""; + } else if (t.isIdentifier(key)) { + alias = key.name; + } else if (t.isStringLiteral(key)) { + alias = (0, _stringify2.default)(key.value); + } else { + alias = (0, _stringify2.default)(t.removePropertiesDeep(t.cloneDeep(key))); + } + + if (node.computed) { + alias = "[" + alias + "]"; + } + + if (node.static) { + alias = "static:" + alias; + } + + return alias; +} + +toKeyAlias.uid = 0; + +toKeyAlias.increment = function () { + if (toKeyAlias.uid >= _maxSafeInteger2.default) { + return toKeyAlias.uid = 0; + } else { + return toKeyAlias.uid++; + } +}; + +function toIdentifier(name) { + name = name + ""; + + name = name.replace(/[^a-zA-Z0-9$_]/g, "-"); + + name = name.replace(/^[-0-9]+/, ""); + + name = name.replace(/[-\s]+(.)?/g, function (match, c) { + return c ? c.toUpperCase() : ""; + }); + + if (!t.isValidIdentifier(name)) { + name = "_" + name; + } + + return name || "_"; +} + +function toBindingIdentifierName(name) { + name = toIdentifier(name); + if (name === "eval" || name === "arguments") name = "_" + name; + return name; +} + +function toStatement(node, ignore) { + if (t.isStatement(node)) { + return node; + } + + var mustHaveId = false; + var newType = void 0; + + if (t.isClass(node)) { + mustHaveId = true; + newType = "ClassDeclaration"; + } else if (t.isFunction(node)) { + mustHaveId = true; + newType = "FunctionDeclaration"; + } else if (t.isAssignmentExpression(node)) { + return t.expressionStatement(node); + } + + if (mustHaveId && !node.id) { + newType = false; + } + + if (!newType) { + if (ignore) { + return false; + } else { + throw new Error("cannot turn " + node.type + " to a statement"); + } + } + + node.type = newType; + + return node; +} + +function toExpression(node) { + if (t.isExpressionStatement(node)) { + node = node.expression; + } + + if (t.isExpression(node)) { + return node; + } + + if (t.isClass(node)) { + node.type = "ClassExpression"; + } else if (t.isFunction(node)) { + node.type = "FunctionExpression"; + } + + if (!t.isExpression(node)) { + throw new Error("cannot turn " + node.type + " to an expression"); + } + + return node; +} + +function toBlock(node, parent) { + if (t.isBlockStatement(node)) { + return node; + } + + if (t.isEmptyStatement(node)) { + node = []; + } + + if (!Array.isArray(node)) { + if (!t.isStatement(node)) { + if (t.isFunction(parent)) { + node = t.returnStatement(node); + } else { + node = t.expressionStatement(node); + } + } + + node = [node]; + } + + return t.blockStatement(node); +} + +function valueToNode(value) { + if (value === undefined) { + return t.identifier("undefined"); + } + + if (value === true || value === false) { + return t.booleanLiteral(value); + } + + if (value === null) { + return t.nullLiteral(); + } + + if (typeof value === "string") { + return t.stringLiteral(value); + } + + if (typeof value === "number") { + return t.numericLiteral(value); + } + + if ((0, _isRegExp2.default)(value)) { + var pattern = value.source; + var flags = value.toString().match(/\/([a-z]+|)$/)[1]; + return t.regExpLiteral(pattern, flags); + } + + if (Array.isArray(value)) { + return t.arrayExpression(value.map(t.valueToNode)); + } + + if ((0, _isPlainObject2.default)(value)) { + var props = []; + for (var key in value) { + var nodeKey = void 0; + if (t.isValidIdentifier(key)) { + nodeKey = t.identifier(key); + } else { + nodeKey = t.stringLiteral(key); + } + props.push(t.objectProperty(nodeKey, t.valueToNode(value[key]))); + } + return t.objectExpression(props); + } + + throw new Error("don't know how to turn this value into a node"); +} \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/core.js b/node_modules/babel-types/lib/definitions/core.js new file mode 100644 index 0000000..413faf8 --- /dev/null +++ b/node_modules/babel-types/lib/definitions/core.js @@ -0,0 +1,701 @@ +"use strict"; + +var _index = require("../index"); + +var t = _interopRequireWildcard(_index); + +var _constants = require("../constants"); + +var _index2 = require("./index"); + +var _index3 = _interopRequireDefault(_index2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +(0, _index3.default)("ArrayExpression", { + fields: { + elements: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeOrValueType)("null", "Expression", "SpreadElement"))), + default: [] + } + }, + visitor: ["elements"], + aliases: ["Expression"] +}); + +(0, _index3.default)("AssignmentExpression", { + fields: { + operator: { + validate: (0, _index2.assertValueType)("string") + }, + left: { + validate: (0, _index2.assertNodeType)("LVal") + }, + right: { + validate: (0, _index2.assertNodeType)("Expression") + } + }, + builder: ["operator", "left", "right"], + visitor: ["left", "right"], + aliases: ["Expression"] +}); + +(0, _index3.default)("BinaryExpression", { + builder: ["operator", "left", "right"], + fields: { + operator: { + validate: _index2.assertOneOf.apply(undefined, _constants.BINARY_OPERATORS) + }, + left: { + validate: (0, _index2.assertNodeType)("Expression") + }, + right: { + validate: (0, _index2.assertNodeType)("Expression") + } + }, + visitor: ["left", "right"], + aliases: ["Binary", "Expression"] +}); + +(0, _index3.default)("Directive", { + visitor: ["value"], + fields: { + value: { + validate: (0, _index2.assertNodeType)("DirectiveLiteral") + } + } +}); + +(0, _index3.default)("DirectiveLiteral", { + builder: ["value"], + fields: { + value: { + validate: (0, _index2.assertValueType)("string") + } + } +}); + +(0, _index3.default)("BlockStatement", { + builder: ["body", "directives"], + visitor: ["directives", "body"], + fields: { + directives: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Directive"))), + default: [] + }, + body: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Statement"))) + } + }, + aliases: ["Scopable", "BlockParent", "Block", "Statement"] +}); + +(0, _index3.default)("BreakStatement", { + visitor: ["label"], + fields: { + label: { + validate: (0, _index2.assertNodeType)("Identifier"), + optional: true + } + }, + aliases: ["Statement", "Terminatorless", "CompletionStatement"] +}); + +(0, _index3.default)("CallExpression", { + visitor: ["callee", "arguments"], + fields: { + callee: { + validate: (0, _index2.assertNodeType)("Expression") + }, + arguments: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Expression", "SpreadElement"))) + } + }, + aliases: ["Expression"] +}); + +(0, _index3.default)("CatchClause", { + visitor: ["param", "body"], + fields: { + param: { + validate: (0, _index2.assertNodeType)("Identifier") + }, + body: { + validate: (0, _index2.assertNodeType)("BlockStatement") + } + }, + aliases: ["Scopable"] +}); + +(0, _index3.default)("ConditionalExpression", { + visitor: ["test", "consequent", "alternate"], + fields: { + test: { + validate: (0, _index2.assertNodeType)("Expression") + }, + consequent: { + validate: (0, _index2.assertNodeType)("Expression") + }, + alternate: { + validate: (0, _index2.assertNodeType)("Expression") + } + }, + aliases: ["Expression", "Conditional"] +}); + +(0, _index3.default)("ContinueStatement", { + visitor: ["label"], + fields: { + label: { + validate: (0, _index2.assertNodeType)("Identifier"), + optional: true + } + }, + aliases: ["Statement", "Terminatorless", "CompletionStatement"] +}); + +(0, _index3.default)("DebuggerStatement", { + aliases: ["Statement"] +}); + +(0, _index3.default)("DoWhileStatement", { + visitor: ["test", "body"], + fields: { + test: { + validate: (0, _index2.assertNodeType)("Expression") + }, + body: { + validate: (0, _index2.assertNodeType)("Statement") + } + }, + aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"] +}); + +(0, _index3.default)("EmptyStatement", { + aliases: ["Statement"] +}); + +(0, _index3.default)("ExpressionStatement", { + visitor: ["expression"], + fields: { + expression: { + validate: (0, _index2.assertNodeType)("Expression") + } + }, + aliases: ["Statement", "ExpressionWrapper"] +}); + +(0, _index3.default)("File", { + builder: ["program", "comments", "tokens"], + visitor: ["program"], + fields: { + program: { + validate: (0, _index2.assertNodeType)("Program") + } + } +}); + +(0, _index3.default)("ForInStatement", { + visitor: ["left", "right", "body"], + aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], + fields: { + left: { + validate: (0, _index2.assertNodeType)("VariableDeclaration", "LVal") + }, + right: { + validate: (0, _index2.assertNodeType)("Expression") + }, + body: { + validate: (0, _index2.assertNodeType)("Statement") + } + } +}); + +(0, _index3.default)("ForStatement", { + visitor: ["init", "test", "update", "body"], + aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop"], + fields: { + init: { + validate: (0, _index2.assertNodeType)("VariableDeclaration", "Expression"), + optional: true + }, + test: { + validate: (0, _index2.assertNodeType)("Expression"), + optional: true + }, + update: { + validate: (0, _index2.assertNodeType)("Expression"), + optional: true + }, + body: { + validate: (0, _index2.assertNodeType)("Statement") + } + } +}); + +(0, _index3.default)("FunctionDeclaration", { + builder: ["id", "params", "body", "generator", "async"], + visitor: ["id", "params", "body", "returnType", "typeParameters"], + fields: { + id: { + validate: (0, _index2.assertNodeType)("Identifier") + }, + params: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("LVal"))) + }, + body: { + validate: (0, _index2.assertNodeType)("BlockStatement") + }, + generator: { + default: false, + validate: (0, _index2.assertValueType)("boolean") + }, + async: { + default: false, + validate: (0, _index2.assertValueType)("boolean") + } + }, + aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Statement", "Pureish", "Declaration"] +}); + +(0, _index3.default)("FunctionExpression", { + inherits: "FunctionDeclaration", + aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"], + fields: { + id: { + validate: (0, _index2.assertNodeType)("Identifier"), + optional: true + }, + params: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("LVal"))) + }, + body: { + validate: (0, _index2.assertNodeType)("BlockStatement") + }, + generator: { + default: false, + validate: (0, _index2.assertValueType)("boolean") + }, + async: { + default: false, + validate: (0, _index2.assertValueType)("boolean") + } + } +}); + +(0, _index3.default)("Identifier", { + builder: ["name"], + visitor: ["typeAnnotation"], + aliases: ["Expression", "LVal"], + fields: { + name: { + validate: function validate(node, key, val) { + if (!t.isValidIdentifier(val)) {} + } + }, + decorators: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator"))) + } + } +}); + +(0, _index3.default)("IfStatement", { + visitor: ["test", "consequent", "alternate"], + aliases: ["Statement", "Conditional"], + fields: { + test: { + validate: (0, _index2.assertNodeType)("Expression") + }, + consequent: { + validate: (0, _index2.assertNodeType)("Statement") + }, + alternate: { + optional: true, + validate: (0, _index2.assertNodeType)("Statement") + } + } +}); + +(0, _index3.default)("LabeledStatement", { + visitor: ["label", "body"], + aliases: ["Statement"], + fields: { + label: { + validate: (0, _index2.assertNodeType)("Identifier") + }, + body: { + validate: (0, _index2.assertNodeType)("Statement") + } + } +}); + +(0, _index3.default)("StringLiteral", { + builder: ["value"], + fields: { + value: { + validate: (0, _index2.assertValueType)("string") + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] +}); + +(0, _index3.default)("NumericLiteral", { + builder: ["value"], + deprecatedAlias: "NumberLiteral", + fields: { + value: { + validate: (0, _index2.assertValueType)("number") + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] +}); + +(0, _index3.default)("NullLiteral", { + aliases: ["Expression", "Pureish", "Literal", "Immutable"] +}); + +(0, _index3.default)("BooleanLiteral", { + builder: ["value"], + fields: { + value: { + validate: (0, _index2.assertValueType)("boolean") + } + }, + aliases: ["Expression", "Pureish", "Literal", "Immutable"] +}); + +(0, _index3.default)("RegExpLiteral", { + builder: ["pattern", "flags"], + deprecatedAlias: "RegexLiteral", + aliases: ["Expression", "Literal"], + fields: { + pattern: { + validate: (0, _index2.assertValueType)("string") + }, + flags: { + validate: (0, _index2.assertValueType)("string"), + default: "" + } + } +}); + +(0, _index3.default)("LogicalExpression", { + builder: ["operator", "left", "right"], + visitor: ["left", "right"], + aliases: ["Binary", "Expression"], + fields: { + operator: { + validate: _index2.assertOneOf.apply(undefined, _constants.LOGICAL_OPERATORS) + }, + left: { + validate: (0, _index2.assertNodeType)("Expression") + }, + right: { + validate: (0, _index2.assertNodeType)("Expression") + } + } +}); + +(0, _index3.default)("MemberExpression", { + builder: ["object", "property", "computed"], + visitor: ["object", "property"], + aliases: ["Expression", "LVal"], + fields: { + object: { + validate: (0, _index2.assertNodeType)("Expression") + }, + property: { + validate: function validate(node, key, val) { + var expectedType = node.computed ? "Expression" : "Identifier"; + (0, _index2.assertNodeType)(expectedType)(node, key, val); + } + }, + computed: { + default: false + } + } +}); + +(0, _index3.default)("NewExpression", { + visitor: ["callee", "arguments"], + aliases: ["Expression"], + fields: { + callee: { + validate: (0, _index2.assertNodeType)("Expression") + }, + arguments: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Expression", "SpreadElement"))) + } + } +}); + +(0, _index3.default)("Program", { + visitor: ["directives", "body"], + builder: ["body", "directives"], + fields: { + directives: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Directive"))), + default: [] + }, + body: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Statement"))) + } + }, + aliases: ["Scopable", "BlockParent", "Block", "FunctionParent"] +}); + +(0, _index3.default)("ObjectExpression", { + visitor: ["properties"], + aliases: ["Expression"], + fields: { + properties: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("ObjectMethod", "ObjectProperty", "SpreadProperty"))) + } + } +}); + +(0, _index3.default)("ObjectMethod", { + builder: ["kind", "key", "params", "body", "computed"], + fields: { + kind: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("string"), (0, _index2.assertOneOf)("method", "get", "set")), + default: "method" + }, + computed: { + validate: (0, _index2.assertValueType)("boolean"), + default: false + }, + key: { + validate: function validate(node, key, val) { + var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; + _index2.assertNodeType.apply(undefined, expectedTypes)(node, key, val); + } + }, + decorators: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator"))) + }, + body: { + validate: (0, _index2.assertNodeType)("BlockStatement") + }, + generator: { + default: false, + validate: (0, _index2.assertValueType)("boolean") + }, + async: { + default: false, + validate: (0, _index2.assertValueType)("boolean") + } + }, + visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], + aliases: ["UserWhitespacable", "Function", "Scopable", "BlockParent", "FunctionParent", "Method", "ObjectMember"] +}); + +(0, _index3.default)("ObjectProperty", { + builder: ["key", "value", "computed", "shorthand", "decorators"], + fields: { + computed: { + validate: (0, _index2.assertValueType)("boolean"), + default: false + }, + key: { + validate: function validate(node, key, val) { + var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; + _index2.assertNodeType.apply(undefined, expectedTypes)(node, key, val); + } + }, + value: { + validate: (0, _index2.assertNodeType)("Expression", "Pattern", "RestElement") + }, + shorthand: { + validate: (0, _index2.assertValueType)("boolean"), + default: false + }, + decorators: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator"))), + optional: true + } + }, + visitor: ["key", "value", "decorators"], + aliases: ["UserWhitespacable", "Property", "ObjectMember"] +}); + +(0, _index3.default)("RestElement", { + visitor: ["argument", "typeAnnotation"], + aliases: ["LVal"], + fields: { + argument: { + validate: (0, _index2.assertNodeType)("LVal") + }, + decorators: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator"))) + } + } +}); + +(0, _index3.default)("ReturnStatement", { + visitor: ["argument"], + aliases: ["Statement", "Terminatorless", "CompletionStatement"], + fields: { + argument: { + validate: (0, _index2.assertNodeType)("Expression"), + optional: true + } + } +}); + +(0, _index3.default)("SequenceExpression", { + visitor: ["expressions"], + fields: { + expressions: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Expression"))) + } + }, + aliases: ["Expression"] +}); + +(0, _index3.default)("SwitchCase", { + visitor: ["test", "consequent"], + fields: { + test: { + validate: (0, _index2.assertNodeType)("Expression"), + optional: true + }, + consequent: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Statement"))) + } + } +}); + +(0, _index3.default)("SwitchStatement", { + visitor: ["discriminant", "cases"], + aliases: ["Statement", "BlockParent", "Scopable"], + fields: { + discriminant: { + validate: (0, _index2.assertNodeType)("Expression") + }, + cases: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("SwitchCase"))) + } + } +}); + +(0, _index3.default)("ThisExpression", { + aliases: ["Expression"] +}); + +(0, _index3.default)("ThrowStatement", { + visitor: ["argument"], + aliases: ["Statement", "Terminatorless", "CompletionStatement"], + fields: { + argument: { + validate: (0, _index2.assertNodeType)("Expression") + } + } +}); + +(0, _index3.default)("TryStatement", { + visitor: ["block", "handler", "finalizer"], + aliases: ["Statement"], + fields: { + body: { + validate: (0, _index2.assertNodeType)("BlockStatement") + }, + handler: { + optional: true, + handler: (0, _index2.assertNodeType)("BlockStatement") + }, + finalizer: { + optional: true, + validate: (0, _index2.assertNodeType)("BlockStatement") + } + } +}); + +(0, _index3.default)("UnaryExpression", { + builder: ["operator", "argument", "prefix"], + fields: { + prefix: { + default: true + }, + argument: { + validate: (0, _index2.assertNodeType)("Expression") + }, + operator: { + validate: _index2.assertOneOf.apply(undefined, _constants.UNARY_OPERATORS) + } + }, + visitor: ["argument"], + aliases: ["UnaryLike", "Expression"] +}); + +(0, _index3.default)("UpdateExpression", { + builder: ["operator", "argument", "prefix"], + fields: { + prefix: { + default: false + }, + argument: { + validate: (0, _index2.assertNodeType)("Expression") + }, + operator: { + validate: _index2.assertOneOf.apply(undefined, _constants.UPDATE_OPERATORS) + } + }, + visitor: ["argument"], + aliases: ["Expression"] +}); + +(0, _index3.default)("VariableDeclaration", { + builder: ["kind", "declarations"], + visitor: ["declarations"], + aliases: ["Statement", "Declaration"], + fields: { + kind: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("string"), (0, _index2.assertOneOf)("var", "let", "const")) + }, + declarations: { + validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("VariableDeclarator"))) + } + } +}); + +(0, _index3.default)("VariableDeclarator", { + visitor: ["id", "init"], + fields: { + id: { + validate: (0, _index2.assertNodeType)("LVal") + }, + init: { + optional: true, + validate: (0, _index2.assertNodeType)("Expression") + } + } +}); + +(0, _index3.default)("WhileStatement", { + visitor: ["test", "body"], + aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"], + fields: { + test: { + validate: (0, _index2.assertNodeType)("Expression") + }, + body: { + validate: (0, _index2.assertNodeType)("BlockStatement", "Statement") + } + } +}); + +(0, _index3.default)("WithStatement", { + visitor: ["object", "body"], + aliases: ["Statement"], + fields: { + object: { + object: (0, _index2.assertNodeType)("Expression") + }, + body: { + validate: (0, _index2.assertNodeType)("BlockStatement", "Statement") + } + } +}); \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/es2015.js b/node_modules/babel-types/lib/definitions/es2015.js new file mode 100644 index 0000000..5f57b44 --- /dev/null +++ b/node_modules/babel-types/lib/definitions/es2015.js @@ -0,0 +1,354 @@ +"use strict"; + +var _index = require("./index"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _index2.default)("AssignmentPattern", { + visitor: ["left", "right"], + aliases: ["Pattern", "LVal"], + fields: { + left: { + validate: (0, _index.assertNodeType)("Identifier") + }, + right: { + validate: (0, _index.assertNodeType)("Expression") + }, + decorators: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))) + } + } +}); + +(0, _index2.default)("ArrayPattern", { + visitor: ["elements", "typeAnnotation"], + aliases: ["Pattern", "LVal"], + fields: { + elements: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Identifier", "Pattern", "RestElement"))) + }, + decorators: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))) + } + } +}); + +(0, _index2.default)("ArrowFunctionExpression", { + builder: ["params", "body", "async"], + visitor: ["params", "body", "returnType", "typeParameters"], + aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"], + fields: { + params: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("LVal"))) + }, + body: { + validate: (0, _index.assertNodeType)("BlockStatement", "Expression") + }, + async: { + validate: (0, _index.assertValueType)("boolean"), + default: false + } + } +}); + +(0, _index2.default)("ClassBody", { + visitor: ["body"], + fields: { + body: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ClassMethod", "ClassProperty"))) + } + } +}); + +(0, _index2.default)("ClassDeclaration", { + builder: ["id", "superClass", "body", "decorators"], + visitor: ["id", "body", "superClass", "mixins", "typeParameters", "superTypeParameters", "implements", "decorators"], + aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"], + fields: { + id: { + validate: (0, _index.assertNodeType)("Identifier") + }, + body: { + validate: (0, _index.assertNodeType)("ClassBody") + }, + superClass: { + optional: true, + validate: (0, _index.assertNodeType)("Expression") + }, + decorators: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))) + } + } +}); + +(0, _index2.default)("ClassExpression", { + inherits: "ClassDeclaration", + aliases: ["Scopable", "Class", "Expression", "Pureish"], + fields: { + id: { + optional: true, + validate: (0, _index.assertNodeType)("Identifier") + }, + body: { + validate: (0, _index.assertNodeType)("ClassBody") + }, + superClass: { + optional: true, + validate: (0, _index.assertNodeType)("Expression") + }, + decorators: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))) + } + } +}); + +(0, _index2.default)("ExportAllDeclaration", { + visitor: ["source"], + aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"], + fields: { + source: { + validate: (0, _index.assertNodeType)("StringLiteral") + } + } +}); + +(0, _index2.default)("ExportDefaultDeclaration", { + visitor: ["declaration"], + aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"], + fields: { + declaration: { + validate: (0, _index.assertNodeType)("FunctionDeclaration", "ClassDeclaration", "Expression") + } + } +}); + +(0, _index2.default)("ExportNamedDeclaration", { + visitor: ["declaration", "specifiers", "source"], + aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"], + fields: { + declaration: { + validate: (0, _index.assertNodeType)("Declaration"), + optional: true + }, + specifiers: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ExportSpecifier"))) + }, + source: { + validate: (0, _index.assertNodeType)("StringLiteral"), + optional: true + } + } +}); + +(0, _index2.default)("ExportSpecifier", { + visitor: ["local", "exported"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: (0, _index.assertNodeType)("Identifier") + }, + exported: { + validate: (0, _index.assertNodeType)("Identifier") + } + } +}); + +(0, _index2.default)("ForOfStatement", { + visitor: ["left", "right", "body"], + aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], + fields: { + left: { + validate: (0, _index.assertNodeType)("VariableDeclaration", "LVal") + }, + right: { + validate: (0, _index.assertNodeType)("Expression") + }, + body: { + validate: (0, _index.assertNodeType)("Statement") + } + } +}); + +(0, _index2.default)("ImportDeclaration", { + visitor: ["specifiers", "source"], + aliases: ["Statement", "Declaration", "ModuleDeclaration"], + fields: { + specifiers: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ImportSpecifier", "ImportDefaultSpecifier", "ImportNamespaceSpecifier"))) + }, + source: { + validate: (0, _index.assertNodeType)("StringLiteral") + } + } +}); + +(0, _index2.default)("ImportDefaultSpecifier", { + visitor: ["local"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: (0, _index.assertNodeType)("Identifier") + } + } +}); + +(0, _index2.default)("ImportNamespaceSpecifier", { + visitor: ["local"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: (0, _index.assertNodeType)("Identifier") + } + } +}); + +(0, _index2.default)("ImportSpecifier", { + visitor: ["local", "imported"], + aliases: ["ModuleSpecifier"], + fields: { + local: { + validate: (0, _index.assertNodeType)("Identifier") + }, + imported: { + validate: (0, _index.assertNodeType)("Identifier") + }, + importKind: { + validate: (0, _index.assertOneOf)(null, "type", "typeof") + } + } +}); + +(0, _index2.default)("MetaProperty", { + visitor: ["meta", "property"], + aliases: ["Expression"], + fields: { + meta: { + validate: (0, _index.assertValueType)("string") + }, + property: { + validate: (0, _index.assertValueType)("string") + } + } +}); + +(0, _index2.default)("ClassMethod", { + aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"], + builder: ["kind", "key", "params", "body", "computed", "static"], + visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], + fields: { + kind: { + validate: (0, _index.chain)((0, _index.assertValueType)("string"), (0, _index.assertOneOf)("get", "set", "method", "constructor")), + default: "method" + }, + computed: { + default: false, + validate: (0, _index.assertValueType)("boolean") + }, + static: { + default: false, + validate: (0, _index.assertValueType)("boolean") + }, + key: { + validate: function validate(node, key, val) { + var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; + _index.assertNodeType.apply(undefined, expectedTypes)(node, key, val); + } + }, + params: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("LVal"))) + }, + body: { + validate: (0, _index.assertNodeType)("BlockStatement") + }, + generator: { + default: false, + validate: (0, _index.assertValueType)("boolean") + }, + async: { + default: false, + validate: (0, _index.assertValueType)("boolean") + } + } +}); + +(0, _index2.default)("ObjectPattern", { + visitor: ["properties", "typeAnnotation"], + aliases: ["Pattern", "LVal"], + fields: { + properties: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("RestProperty", "Property"))) + }, + decorators: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))) + } + } +}); + +(0, _index2.default)("SpreadElement", { + visitor: ["argument"], + aliases: ["UnaryLike"], + fields: { + argument: { + validate: (0, _index.assertNodeType)("Expression") + } + } +}); + +(0, _index2.default)("Super", { + aliases: ["Expression"] +}); + +(0, _index2.default)("TaggedTemplateExpression", { + visitor: ["tag", "quasi"], + aliases: ["Expression"], + fields: { + tag: { + validate: (0, _index.assertNodeType)("Expression") + }, + quasi: { + validate: (0, _index.assertNodeType)("TemplateLiteral") + } + } +}); + +(0, _index2.default)("TemplateElement", { + builder: ["value", "tail"], + fields: { + value: {}, + tail: { + validate: (0, _index.assertValueType)("boolean"), + default: false + } + } +}); + +(0, _index2.default)("TemplateLiteral", { + visitor: ["quasis", "expressions"], + aliases: ["Expression", "Literal"], + fields: { + quasis: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("TemplateElement"))) + }, + expressions: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Expression"))) + } + } +}); + +(0, _index2.default)("YieldExpression", { + builder: ["argument", "delegate"], + visitor: ["argument"], + aliases: ["Expression", "Terminatorless"], + fields: { + delegate: { + validate: (0, _index.assertValueType)("boolean"), + default: false + }, + argument: { + optional: true, + validate: (0, _index.assertNodeType)("Expression") + } + } +}); \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/experimental.js b/node_modules/babel-types/lib/definitions/experimental.js new file mode 100644 index 0000000..d65d609 --- /dev/null +++ b/node_modules/babel-types/lib/definitions/experimental.js @@ -0,0 +1,103 @@ +"use strict"; + +var _index = require("./index"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _index2.default)("AwaitExpression", { + builder: ["argument"], + visitor: ["argument"], + aliases: ["Expression", "Terminatorless"], + fields: { + argument: { + validate: (0, _index.assertNodeType)("Expression") + } + } +}); + +(0, _index2.default)("ForAwaitStatement", { + visitor: ["left", "right", "body"], + aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], + fields: { + left: { + validate: (0, _index.assertNodeType)("VariableDeclaration", "LVal") + }, + right: { + validate: (0, _index.assertNodeType)("Expression") + }, + body: { + validate: (0, _index.assertNodeType)("Statement") + } + } +}); + +(0, _index2.default)("BindExpression", { + visitor: ["object", "callee"], + aliases: ["Expression"], + fields: {} +}); + +(0, _index2.default)("Import", { + aliases: ["Expression"] +}); + +(0, _index2.default)("Decorator", { + visitor: ["expression"], + fields: { + expression: { + validate: (0, _index.assertNodeType)("Expression") + } + } +}); + +(0, _index2.default)("DoExpression", { + visitor: ["body"], + aliases: ["Expression"], + fields: { + body: { + validate: (0, _index.assertNodeType)("BlockStatement") + } + } +}); + +(0, _index2.default)("ExportDefaultSpecifier", { + visitor: ["exported"], + aliases: ["ModuleSpecifier"], + fields: { + exported: { + validate: (0, _index.assertNodeType)("Identifier") + } + } +}); + +(0, _index2.default)("ExportNamespaceSpecifier", { + visitor: ["exported"], + aliases: ["ModuleSpecifier"], + fields: { + exported: { + validate: (0, _index.assertNodeType)("Identifier") + } + } +}); + +(0, _index2.default)("RestProperty", { + visitor: ["argument"], + aliases: ["UnaryLike"], + fields: { + argument: { + validate: (0, _index.assertNodeType)("LVal") + } + } +}); + +(0, _index2.default)("SpreadProperty", { + visitor: ["argument"], + aliases: ["UnaryLike"], + fields: { + argument: { + validate: (0, _index.assertNodeType)("Expression") + } + } +}); \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/flow.js b/node_modules/babel-types/lib/definitions/flow.js new file mode 100644 index 0000000..89c6302 --- /dev/null +++ b/node_modules/babel-types/lib/definitions/flow.js @@ -0,0 +1,285 @@ +"use strict"; + +var _index = require("./index"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _index2.default)("AnyTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"], + fields: {} +}); + +(0, _index2.default)("ArrayTypeAnnotation", { + visitor: ["elementType"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("BooleanTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"], + fields: {} +}); + +(0, _index2.default)("BooleanLiteralTypeAnnotation", { + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("NullLiteralTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"], + fields: {} +}); + +(0, _index2.default)("ClassImplements", { + visitor: ["id", "typeParameters"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("ClassProperty", { + visitor: ["key", "value", "typeAnnotation", "decorators"], + builder: ["key", "value", "typeAnnotation", "decorators", "computed"], + aliases: ["Property"], + fields: { + computed: { + validate: (0, _index.assertValueType)("boolean"), + default: false + } + } +}); + +(0, _index2.default)("DeclareClass", { + visitor: ["id", "typeParameters", "extends", "body"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} +}); + +(0, _index2.default)("DeclareFunction", { + visitor: ["id"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} +}); + +(0, _index2.default)("DeclareInterface", { + visitor: ["id", "typeParameters", "extends", "body"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} +}); + +(0, _index2.default)("DeclareModule", { + visitor: ["id", "body"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} +}); + +(0, _index2.default)("DeclareModuleExports", { + visitor: ["typeAnnotation"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} +}); + +(0, _index2.default)("DeclareTypeAlias", { + visitor: ["id", "typeParameters", "right"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} +}); + +(0, _index2.default)("DeclareOpaqueType", { + visitor: ["id", "typeParameters", "supertype"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} +}); + +(0, _index2.default)("DeclareVariable", { + visitor: ["id"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} +}); + +(0, _index2.default)("DeclareExportDeclaration", { + visitor: ["declaration", "specifiers", "source"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} +}); + +(0, _index2.default)("ExistentialTypeParam", { + aliases: ["Flow"] +}); + +(0, _index2.default)("FunctionTypeAnnotation", { + visitor: ["typeParameters", "params", "rest", "returnType"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("FunctionTypeParam", { + visitor: ["name", "typeAnnotation"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("GenericTypeAnnotation", { + visitor: ["id", "typeParameters"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("InterfaceExtends", { + visitor: ["id", "typeParameters"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("InterfaceDeclaration", { + visitor: ["id", "typeParameters", "extends", "body"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} +}); + +(0, _index2.default)("IntersectionTypeAnnotation", { + visitor: ["types"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("MixedTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"] +}); + +(0, _index2.default)("EmptyTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"] +}); + +(0, _index2.default)("NullableTypeAnnotation", { + visitor: ["typeAnnotation"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("NumericLiteralTypeAnnotation", { + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("NumberTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"], + fields: {} +}); + +(0, _index2.default)("StringLiteralTypeAnnotation", { + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("StringTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"], + fields: {} +}); + +(0, _index2.default)("ThisTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"], + fields: {} +}); + +(0, _index2.default)("TupleTypeAnnotation", { + visitor: ["types"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("TypeofTypeAnnotation", { + visitor: ["argument"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("TypeAlias", { + visitor: ["id", "typeParameters", "right"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} +}); + +(0, _index2.default)("OpaqueType", { + visitor: ["id", "typeParameters", "impltype", "supertype"], + aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], + fields: {} +}); + +(0, _index2.default)("TypeAnnotation", { + visitor: ["typeAnnotation"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("TypeCastExpression", { + visitor: ["expression", "typeAnnotation"], + aliases: ["Flow", "ExpressionWrapper", "Expression"], + fields: {} +}); + +(0, _index2.default)("TypeParameter", { + visitor: ["bound"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("TypeParameterDeclaration", { + visitor: ["params"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("TypeParameterInstantiation", { + visitor: ["params"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("ObjectTypeAnnotation", { + visitor: ["properties", "indexers", "callProperties"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("ObjectTypeCallProperty", { + visitor: ["value"], + aliases: ["Flow", "UserWhitespacable"], + fields: {} +}); + +(0, _index2.default)("ObjectTypeIndexer", { + visitor: ["id", "key", "value"], + aliases: ["Flow", "UserWhitespacable"], + fields: {} +}); + +(0, _index2.default)("ObjectTypeProperty", { + visitor: ["key", "value"], + aliases: ["Flow", "UserWhitespacable"], + fields: {} +}); + +(0, _index2.default)("ObjectTypeSpreadProperty", { + visitor: ["argument"], + aliases: ["Flow", "UserWhitespacable"], + fields: {} +}); + +(0, _index2.default)("QualifiedTypeIdentifier", { + visitor: ["id", "qualification"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("UnionTypeAnnotation", { + visitor: ["types"], + aliases: ["Flow"], + fields: {} +}); + +(0, _index2.default)("VoidTypeAnnotation", { + aliases: ["Flow", "FlowBaseAnnotation"], + fields: {} +}); \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/index.js b/node_modules/babel-types/lib/definitions/index.js new file mode 100644 index 0000000..d512114 --- /dev/null +++ b/node_modules/babel-types/lib/definitions/index.js @@ -0,0 +1,249 @@ +"use strict"; + +exports.__esModule = true; +exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.NODE_FIELDS = exports.ALIAS_KEYS = exports.VISITOR_KEYS = undefined; + +var _getIterator2 = require("babel-runtime/core-js/get-iterator"); + +var _getIterator3 = _interopRequireDefault(_getIterator2); + +var _stringify = require("babel-runtime/core-js/json/stringify"); + +var _stringify2 = _interopRequireDefault(_stringify); + +var _typeof2 = require("babel-runtime/helpers/typeof"); + +var _typeof3 = _interopRequireDefault(_typeof2); + +exports.assertEach = assertEach; +exports.assertOneOf = assertOneOf; +exports.assertNodeType = assertNodeType; +exports.assertNodeOrValueType = assertNodeOrValueType; +exports.assertValueType = assertValueType; +exports.chain = chain; +exports.default = defineType; + +var _index = require("../index"); + +var t = _interopRequireWildcard(_index); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var VISITOR_KEYS = exports.VISITOR_KEYS = {}; +var ALIAS_KEYS = exports.ALIAS_KEYS = {}; +var NODE_FIELDS = exports.NODE_FIELDS = {}; +var BUILDER_KEYS = exports.BUILDER_KEYS = {}; +var DEPRECATED_KEYS = exports.DEPRECATED_KEYS = {}; + +function getType(val) { + if (Array.isArray(val)) { + return "array"; + } else if (val === null) { + return "null"; + } else if (val === undefined) { + return "undefined"; + } else { + return typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val); + } +} + +function assertEach(callback) { + function validator(node, key, val) { + if (!Array.isArray(val)) return; + + for (var i = 0; i < val.length; i++) { + callback(node, key + "[" + i + "]", val[i]); + } + } + validator.each = callback; + return validator; +} + +function assertOneOf() { + for (var _len = arguments.length, vals = Array(_len), _key = 0; _key < _len; _key++) { + vals[_key] = arguments[_key]; + } + + function validate(node, key, val) { + if (vals.indexOf(val) < 0) { + throw new TypeError("Property " + key + " expected value to be one of " + (0, _stringify2.default)(vals) + " but got " + (0, _stringify2.default)(val)); + } + } + + validate.oneOf = vals; + + return validate; +} + +function assertNodeType() { + for (var _len2 = arguments.length, types = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + types[_key2] = arguments[_key2]; + } + + function validate(node, key, val) { + var valid = false; + + for (var _iterator = types, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var type = _ref; + + if (t.is(type, val)) { + valid = true; + break; + } + } + + if (!valid) { + throw new TypeError("Property " + key + " of " + node.type + " expected node to be of a type " + (0, _stringify2.default)(types) + " " + ("but instead got " + (0, _stringify2.default)(val && val.type))); + } + } + + validate.oneOfNodeTypes = types; + + return validate; +} + +function assertNodeOrValueType() { + for (var _len3 = arguments.length, types = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + types[_key3] = arguments[_key3]; + } + + function validate(node, key, val) { + var valid = false; + + for (var _iterator2 = types, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var type = _ref2; + + if (getType(val) === type || t.is(type, val)) { + valid = true; + break; + } + } + + if (!valid) { + throw new TypeError("Property " + key + " of " + node.type + " expected node to be of a type " + (0, _stringify2.default)(types) + " " + ("but instead got " + (0, _stringify2.default)(val && val.type))); + } + } + + validate.oneOfNodeOrValueTypes = types; + + return validate; +} + +function assertValueType(type) { + function validate(node, key, val) { + var valid = getType(val) === type; + + if (!valid) { + throw new TypeError("Property " + key + " expected type of " + type + " but got " + getType(val)); + } + } + + validate.type = type; + + return validate; +} + +function chain() { + for (var _len4 = arguments.length, fns = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + fns[_key4] = arguments[_key4]; + } + + function validate() { + for (var _iterator3 = fns, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var fn = _ref3; + + fn.apply(undefined, arguments); + } + } + validate.chainOf = fns; + return validate; +} + +function defineType(type) { + var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + var inherits = opts.inherits && store[opts.inherits] || {}; + + opts.fields = opts.fields || inherits.fields || {}; + opts.visitor = opts.visitor || inherits.visitor || []; + opts.aliases = opts.aliases || inherits.aliases || []; + opts.builder = opts.builder || inherits.builder || opts.visitor || []; + + if (opts.deprecatedAlias) { + DEPRECATED_KEYS[opts.deprecatedAlias] = type; + } + + for (var _iterator4 = opts.visitor.concat(opts.builder), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { + var _ref4; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref4 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref4 = _i4.value; + } + + var _key5 = _ref4; + + opts.fields[_key5] = opts.fields[_key5] || {}; + } + + for (var key in opts.fields) { + var field = opts.fields[key]; + + if (opts.builder.indexOf(key) === -1) { + field.optional = true; + } + if (field.default === undefined) { + field.default = null; + } else if (!field.validate) { + field.validate = assertValueType(getType(field.default)); + } + } + + VISITOR_KEYS[type] = opts.visitor; + BUILDER_KEYS[type] = opts.builder; + NODE_FIELDS[type] = opts.fields; + ALIAS_KEYS[type] = opts.aliases; + + store[type] = opts; +} + +var store = {}; \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/init.js b/node_modules/babel-types/lib/definitions/init.js new file mode 100644 index 0000000..a3334fe --- /dev/null +++ b/node_modules/babel-types/lib/definitions/init.js @@ -0,0 +1,15 @@ +"use strict"; + +require("./index"); + +require("./core"); + +require("./es2015"); + +require("./flow"); + +require("./jsx"); + +require("./misc"); + +require("./experimental"); \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/jsx.js b/node_modules/babel-types/lib/definitions/jsx.js new file mode 100644 index 0000000..1c0c066 --- /dev/null +++ b/node_modules/babel-types/lib/definitions/jsx.js @@ -0,0 +1,147 @@ +"use strict"; + +var _index = require("./index"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _index2.default)("JSXAttribute", { + visitor: ["name", "value"], + aliases: ["JSX", "Immutable"], + fields: { + name: { + validate: (0, _index.assertNodeType)("JSXIdentifier", "JSXNamespacedName") + }, + value: { + optional: true, + validate: (0, _index.assertNodeType)("JSXElement", "StringLiteral", "JSXExpressionContainer") + } + } +}); + +(0, _index2.default)("JSXClosingElement", { + visitor: ["name"], + aliases: ["JSX", "Immutable"], + fields: { + name: { + validate: (0, _index.assertNodeType)("JSXIdentifier", "JSXMemberExpression") + } + } +}); + +(0, _index2.default)("JSXElement", { + builder: ["openingElement", "closingElement", "children", "selfClosing"], + visitor: ["openingElement", "children", "closingElement"], + aliases: ["JSX", "Immutable", "Expression"], + fields: { + openingElement: { + validate: (0, _index.assertNodeType)("JSXOpeningElement") + }, + closingElement: { + optional: true, + validate: (0, _index.assertNodeType)("JSXClosingElement") + }, + children: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement"))) + } + } +}); + +(0, _index2.default)("JSXEmptyExpression", { + aliases: ["JSX", "Expression"] +}); + +(0, _index2.default)("JSXExpressionContainer", { + visitor: ["expression"], + aliases: ["JSX", "Immutable"], + fields: { + expression: { + validate: (0, _index.assertNodeType)("Expression") + } + } +}); + +(0, _index2.default)("JSXSpreadChild", { + visitor: ["expression"], + aliases: ["JSX", "Immutable"], + fields: { + expression: { + validate: (0, _index.assertNodeType)("Expression") + } + } +}); + +(0, _index2.default)("JSXIdentifier", { + builder: ["name"], + aliases: ["JSX", "Expression"], + fields: { + name: { + validate: (0, _index.assertValueType)("string") + } + } +}); + +(0, _index2.default)("JSXMemberExpression", { + visitor: ["object", "property"], + aliases: ["JSX", "Expression"], + fields: { + object: { + validate: (0, _index.assertNodeType)("JSXMemberExpression", "JSXIdentifier") + }, + property: { + validate: (0, _index.assertNodeType)("JSXIdentifier") + } + } +}); + +(0, _index2.default)("JSXNamespacedName", { + visitor: ["namespace", "name"], + aliases: ["JSX"], + fields: { + namespace: { + validate: (0, _index.assertNodeType)("JSXIdentifier") + }, + name: { + validate: (0, _index.assertNodeType)("JSXIdentifier") + } + } +}); + +(0, _index2.default)("JSXOpeningElement", { + builder: ["name", "attributes", "selfClosing"], + visitor: ["name", "attributes"], + aliases: ["JSX", "Immutable"], + fields: { + name: { + validate: (0, _index.assertNodeType)("JSXIdentifier", "JSXMemberExpression") + }, + selfClosing: { + default: false, + validate: (0, _index.assertValueType)("boolean") + }, + attributes: { + validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("JSXAttribute", "JSXSpreadAttribute"))) + } + } +}); + +(0, _index2.default)("JSXSpreadAttribute", { + visitor: ["argument"], + aliases: ["JSX"], + fields: { + argument: { + validate: (0, _index.assertNodeType)("Expression") + } + } +}); + +(0, _index2.default)("JSXText", { + aliases: ["JSX", "Immutable"], + builder: ["value"], + fields: { + value: { + validate: (0, _index.assertValueType)("string") + } + } +}); \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/misc.js b/node_modules/babel-types/lib/definitions/misc.js new file mode 100644 index 0000000..f982b9a --- /dev/null +++ b/node_modules/babel-types/lib/definitions/misc.js @@ -0,0 +1,21 @@ +"use strict"; + +var _index = require("./index"); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _index2.default)("Noop", { + visitor: [] +}); + +(0, _index2.default)("ParenthesizedExpression", { + visitor: ["expression"], + aliases: ["Expression", "ExpressionWrapper"], + fields: { + expression: { + validate: (0, _index.assertNodeType)("Expression") + } + } +}); \ No newline at end of file diff --git a/node_modules/babel-types/lib/flow.js b/node_modules/babel-types/lib/flow.js new file mode 100644 index 0000000..2857915 --- /dev/null +++ b/node_modules/babel-types/lib/flow.js @@ -0,0 +1,108 @@ +"use strict"; + +exports.__esModule = true; +exports.createUnionTypeAnnotation = createUnionTypeAnnotation; +exports.removeTypeDuplicates = removeTypeDuplicates; +exports.createTypeAnnotationBasedOnTypeof = createTypeAnnotationBasedOnTypeof; + +var _index = require("./index"); + +var t = _interopRequireWildcard(_index); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function createUnionTypeAnnotation(types) { + var flattened = removeTypeDuplicates(types); + + if (flattened.length === 1) { + return flattened[0]; + } else { + return t.unionTypeAnnotation(flattened); + } +} + +function removeTypeDuplicates(nodes) { + var generics = {}; + var bases = {}; + + var typeGroups = []; + + var types = []; + + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + if (!node) continue; + + if (types.indexOf(node) >= 0) { + continue; + } + + if (t.isAnyTypeAnnotation(node)) { + return [node]; + } + + if (t.isFlowBaseAnnotation(node)) { + bases[node.type] = node; + continue; + } + + if (t.isUnionTypeAnnotation(node)) { + if (typeGroups.indexOf(node.types) < 0) { + nodes = nodes.concat(node.types); + typeGroups.push(node.types); + } + continue; + } + + if (t.isGenericTypeAnnotation(node)) { + var name = node.id.name; + + if (generics[name]) { + var existing = generics[name]; + if (existing.typeParameters) { + if (node.typeParameters) { + existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params.concat(node.typeParameters.params)); + } + } else { + existing = node.typeParameters; + } + } else { + generics[name] = node; + } + + continue; + } + + types.push(node); + } + + for (var type in bases) { + types.push(bases[type]); + } + + for (var _name in generics) { + types.push(generics[_name]); + } + + return types; +} + +function createTypeAnnotationBasedOnTypeof(type) { + if (type === "string") { + return t.stringTypeAnnotation(); + } else if (type === "number") { + return t.numberTypeAnnotation(); + } else if (type === "undefined") { + return t.voidTypeAnnotation(); + } else if (type === "boolean") { + return t.booleanTypeAnnotation(); + } else if (type === "function") { + return t.genericTypeAnnotation(t.identifier("Function")); + } else if (type === "object") { + return t.genericTypeAnnotation(t.identifier("Object")); + } else if (type === "symbol") { + return t.genericTypeAnnotation(t.identifier("Symbol")); + } else { + throw new Error("Invalid typeof value"); + } +} \ No newline at end of file diff --git a/node_modules/babel-types/lib/index.js b/node_modules/babel-types/lib/index.js new file mode 100644 index 0000000..4c00703 --- /dev/null +++ b/node_modules/babel-types/lib/index.js @@ -0,0 +1,835 @@ +"use strict"; + +exports.__esModule = true; +exports.createTypeAnnotationBasedOnTypeof = exports.removeTypeDuplicates = exports.createUnionTypeAnnotation = exports.valueToNode = exports.toBlock = exports.toExpression = exports.toStatement = exports.toBindingIdentifierName = exports.toIdentifier = exports.toKeyAlias = exports.toSequenceExpression = exports.toComputedKey = exports.isNodesEquivalent = exports.isImmutable = exports.isScope = exports.isSpecifierDefault = exports.isVar = exports.isBlockScoped = exports.isLet = exports.isValidIdentifier = exports.isReferenced = exports.isBinding = exports.getOuterBindingIdentifiers = exports.getBindingIdentifiers = exports.TYPES = exports.react = exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.NODE_FIELDS = exports.ALIAS_KEYS = exports.VISITOR_KEYS = exports.NOT_LOCAL_BINDING = exports.BLOCK_SCOPED_SYMBOL = exports.INHERIT_KEYS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = exports.BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.UPDATE_OPERATORS = exports.LOGICAL_OPERATORS = exports.COMMENT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = undefined; + +var _getOwnPropertySymbols = require("babel-runtime/core-js/object/get-own-property-symbols"); + +var _getOwnPropertySymbols2 = _interopRequireDefault(_getOwnPropertySymbols); + +var _getIterator2 = require("babel-runtime/core-js/get-iterator"); + +var _getIterator3 = _interopRequireDefault(_getIterator2); + +var _keys = require("babel-runtime/core-js/object/keys"); + +var _keys2 = _interopRequireDefault(_keys); + +var _stringify = require("babel-runtime/core-js/json/stringify"); + +var _stringify2 = _interopRequireDefault(_stringify); + +var _constants = require("./constants"); + +Object.defineProperty(exports, "STATEMENT_OR_BLOCK_KEYS", { + enumerable: true, + get: function get() { + return _constants.STATEMENT_OR_BLOCK_KEYS; + } +}); +Object.defineProperty(exports, "FLATTENABLE_KEYS", { + enumerable: true, + get: function get() { + return _constants.FLATTENABLE_KEYS; + } +}); +Object.defineProperty(exports, "FOR_INIT_KEYS", { + enumerable: true, + get: function get() { + return _constants.FOR_INIT_KEYS; + } +}); +Object.defineProperty(exports, "COMMENT_KEYS", { + enumerable: true, + get: function get() { + return _constants.COMMENT_KEYS; + } +}); +Object.defineProperty(exports, "LOGICAL_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.LOGICAL_OPERATORS; + } +}); +Object.defineProperty(exports, "UPDATE_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.UPDATE_OPERATORS; + } +}); +Object.defineProperty(exports, "BOOLEAN_NUMBER_BINARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.BOOLEAN_NUMBER_BINARY_OPERATORS; + } +}); +Object.defineProperty(exports, "EQUALITY_BINARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.EQUALITY_BINARY_OPERATORS; + } +}); +Object.defineProperty(exports, "COMPARISON_BINARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.COMPARISON_BINARY_OPERATORS; + } +}); +Object.defineProperty(exports, "BOOLEAN_BINARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.BOOLEAN_BINARY_OPERATORS; + } +}); +Object.defineProperty(exports, "NUMBER_BINARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.NUMBER_BINARY_OPERATORS; + } +}); +Object.defineProperty(exports, "BINARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.BINARY_OPERATORS; + } +}); +Object.defineProperty(exports, "BOOLEAN_UNARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.BOOLEAN_UNARY_OPERATORS; + } +}); +Object.defineProperty(exports, "NUMBER_UNARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.NUMBER_UNARY_OPERATORS; + } +}); +Object.defineProperty(exports, "STRING_UNARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.STRING_UNARY_OPERATORS; + } +}); +Object.defineProperty(exports, "UNARY_OPERATORS", { + enumerable: true, + get: function get() { + return _constants.UNARY_OPERATORS; + } +}); +Object.defineProperty(exports, "INHERIT_KEYS", { + enumerable: true, + get: function get() { + return _constants.INHERIT_KEYS; + } +}); +Object.defineProperty(exports, "BLOCK_SCOPED_SYMBOL", { + enumerable: true, + get: function get() { + return _constants.BLOCK_SCOPED_SYMBOL; + } +}); +Object.defineProperty(exports, "NOT_LOCAL_BINDING", { + enumerable: true, + get: function get() { + return _constants.NOT_LOCAL_BINDING; + } +}); +exports.is = is; +exports.isType = isType; +exports.validate = validate; +exports.shallowEqual = shallowEqual; +exports.appendToMemberExpression = appendToMemberExpression; +exports.prependToMemberExpression = prependToMemberExpression; +exports.ensureBlock = ensureBlock; +exports.clone = clone; +exports.cloneWithoutLoc = cloneWithoutLoc; +exports.cloneDeep = cloneDeep; +exports.buildMatchMemberExpression = buildMatchMemberExpression; +exports.removeComments = removeComments; +exports.inheritsComments = inheritsComments; +exports.inheritTrailingComments = inheritTrailingComments; +exports.inheritLeadingComments = inheritLeadingComments; +exports.inheritInnerComments = inheritInnerComments; +exports.inherits = inherits; +exports.assertNode = assertNode; +exports.isNode = isNode; +exports.traverseFast = traverseFast; +exports.removeProperties = removeProperties; +exports.removePropertiesDeep = removePropertiesDeep; + +var _retrievers = require("./retrievers"); + +Object.defineProperty(exports, "getBindingIdentifiers", { + enumerable: true, + get: function get() { + return _retrievers.getBindingIdentifiers; + } +}); +Object.defineProperty(exports, "getOuterBindingIdentifiers", { + enumerable: true, + get: function get() { + return _retrievers.getOuterBindingIdentifiers; + } +}); + +var _validators = require("./validators"); + +Object.defineProperty(exports, "isBinding", { + enumerable: true, + get: function get() { + return _validators.isBinding; + } +}); +Object.defineProperty(exports, "isReferenced", { + enumerable: true, + get: function get() { + return _validators.isReferenced; + } +}); +Object.defineProperty(exports, "isValidIdentifier", { + enumerable: true, + get: function get() { + return _validators.isValidIdentifier; + } +}); +Object.defineProperty(exports, "isLet", { + enumerable: true, + get: function get() { + return _validators.isLet; + } +}); +Object.defineProperty(exports, "isBlockScoped", { + enumerable: true, + get: function get() { + return _validators.isBlockScoped; + } +}); +Object.defineProperty(exports, "isVar", { + enumerable: true, + get: function get() { + return _validators.isVar; + } +}); +Object.defineProperty(exports, "isSpecifierDefault", { + enumerable: true, + get: function get() { + return _validators.isSpecifierDefault; + } +}); +Object.defineProperty(exports, "isScope", { + enumerable: true, + get: function get() { + return _validators.isScope; + } +}); +Object.defineProperty(exports, "isImmutable", { + enumerable: true, + get: function get() { + return _validators.isImmutable; + } +}); +Object.defineProperty(exports, "isNodesEquivalent", { + enumerable: true, + get: function get() { + return _validators.isNodesEquivalent; + } +}); + +var _converters = require("./converters"); + +Object.defineProperty(exports, "toComputedKey", { + enumerable: true, + get: function get() { + return _converters.toComputedKey; + } +}); +Object.defineProperty(exports, "toSequenceExpression", { + enumerable: true, + get: function get() { + return _converters.toSequenceExpression; + } +}); +Object.defineProperty(exports, "toKeyAlias", { + enumerable: true, + get: function get() { + return _converters.toKeyAlias; + } +}); +Object.defineProperty(exports, "toIdentifier", { + enumerable: true, + get: function get() { + return _converters.toIdentifier; + } +}); +Object.defineProperty(exports, "toBindingIdentifierName", { + enumerable: true, + get: function get() { + return _converters.toBindingIdentifierName; + } +}); +Object.defineProperty(exports, "toStatement", { + enumerable: true, + get: function get() { + return _converters.toStatement; + } +}); +Object.defineProperty(exports, "toExpression", { + enumerable: true, + get: function get() { + return _converters.toExpression; + } +}); +Object.defineProperty(exports, "toBlock", { + enumerable: true, + get: function get() { + return _converters.toBlock; + } +}); +Object.defineProperty(exports, "valueToNode", { + enumerable: true, + get: function get() { + return _converters.valueToNode; + } +}); + +var _flow = require("./flow"); + +Object.defineProperty(exports, "createUnionTypeAnnotation", { + enumerable: true, + get: function get() { + return _flow.createUnionTypeAnnotation; + } +}); +Object.defineProperty(exports, "removeTypeDuplicates", { + enumerable: true, + get: function get() { + return _flow.removeTypeDuplicates; + } +}); +Object.defineProperty(exports, "createTypeAnnotationBasedOnTypeof", { + enumerable: true, + get: function get() { + return _flow.createTypeAnnotationBasedOnTypeof; + } +}); + +var _toFastProperties = require("to-fast-properties"); + +var _toFastProperties2 = _interopRequireDefault(_toFastProperties); + +var _clone = require("lodash/clone"); + +var _clone2 = _interopRequireDefault(_clone); + +var _uniq = require("lodash/uniq"); + +var _uniq2 = _interopRequireDefault(_uniq); + +require("./definitions/init"); + +var _definitions = require("./definitions"); + +var _react2 = require("./react"); + +var _react = _interopRequireWildcard(_react2); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var t = exports; + +function registerType(type) { + var is = t["is" + type]; + if (!is) { + is = t["is" + type] = function (node, opts) { + return t.is(type, node, opts); + }; + } + + t["assert" + type] = function (node, opts) { + opts = opts || {}; + if (!is(node, opts)) { + throw new Error("Expected type " + (0, _stringify2.default)(type) + " with option " + (0, _stringify2.default)(opts)); + } + }; +} + +exports.VISITOR_KEYS = _definitions.VISITOR_KEYS; +exports.ALIAS_KEYS = _definitions.ALIAS_KEYS; +exports.NODE_FIELDS = _definitions.NODE_FIELDS; +exports.BUILDER_KEYS = _definitions.BUILDER_KEYS; +exports.DEPRECATED_KEYS = _definitions.DEPRECATED_KEYS; +exports.react = _react; + + +for (var type in t.VISITOR_KEYS) { + registerType(type); +} + +t.FLIPPED_ALIAS_KEYS = {}; + +(0, _keys2.default)(t.ALIAS_KEYS).forEach(function (type) { + t.ALIAS_KEYS[type].forEach(function (alias) { + var types = t.FLIPPED_ALIAS_KEYS[alias] = t.FLIPPED_ALIAS_KEYS[alias] || []; + types.push(type); + }); +}); + +(0, _keys2.default)(t.FLIPPED_ALIAS_KEYS).forEach(function (type) { + t[type.toUpperCase() + "_TYPES"] = t.FLIPPED_ALIAS_KEYS[type]; + registerType(type); +}); + +var TYPES = exports.TYPES = (0, _keys2.default)(t.VISITOR_KEYS).concat((0, _keys2.default)(t.FLIPPED_ALIAS_KEYS)).concat((0, _keys2.default)(t.DEPRECATED_KEYS)); + +function is(type, node, opts) { + if (!node) return false; + + var matches = isType(node.type, type); + if (!matches) return false; + + if (typeof opts === "undefined") { + return true; + } else { + return t.shallowEqual(node, opts); + } +} + +function isType(nodeType, targetType) { + if (nodeType === targetType) return true; + + if (t.ALIAS_KEYS[targetType]) return false; + + var aliases = t.FLIPPED_ALIAS_KEYS[targetType]; + if (aliases) { + if (aliases[0] === nodeType) return true; + + for (var _iterator = aliases, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var alias = _ref; + + if (nodeType === alias) return true; + } + } + + return false; +} + +(0, _keys2.default)(t.BUILDER_KEYS).forEach(function (type) { + var keys = t.BUILDER_KEYS[type]; + + function builder() { + if (arguments.length > keys.length) { + throw new Error("t." + type + ": Too many arguments passed. Received " + arguments.length + " but can receive " + ("no more than " + keys.length)); + } + + var node = {}; + node.type = type; + + var i = 0; + + for (var _iterator2 = keys, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var _key = _ref2; + + var field = t.NODE_FIELDS[type][_key]; + + var arg = arguments[i++]; + if (arg === undefined) arg = (0, _clone2.default)(field.default); + + node[_key] = arg; + } + + for (var key in node) { + validate(node, key, node[key]); + } + + return node; + } + + t[type] = builder; + t[type[0].toLowerCase() + type.slice(1)] = builder; +}); + +var _loop = function _loop(_type) { + var newType = t.DEPRECATED_KEYS[_type]; + + function proxy(fn) { + return function () { + console.trace("The node type " + _type + " has been renamed to " + newType); + return fn.apply(this, arguments); + }; + } + + t[_type] = t[_type[0].toLowerCase() + _type.slice(1)] = proxy(t[newType]); + t["is" + _type] = proxy(t["is" + newType]); + t["assert" + _type] = proxy(t["assert" + newType]); +}; + +for (var _type in t.DEPRECATED_KEYS) { + _loop(_type); +} + +function validate(node, key, val) { + if (!node) return; + + var fields = t.NODE_FIELDS[node.type]; + if (!fields) return; + + var field = fields[key]; + if (!field || !field.validate) return; + if (field.optional && val == null) return; + + field.validate(node, key, val); +} + +function shallowEqual(actual, expected) { + var keys = (0, _keys2.default)(expected); + + for (var _iterator3 = keys, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + var key = _ref3; + + if (actual[key] !== expected[key]) { + return false; + } + } + + return true; +} + +function appendToMemberExpression(member, append, computed) { + member.object = t.memberExpression(member.object, member.property, member.computed); + member.property = append; + member.computed = !!computed; + return member; +} + +function prependToMemberExpression(member, prepend) { + member.object = t.memberExpression(prepend, member.object); + return member; +} + +function ensureBlock(node) { + var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "body"; + + return node[key] = t.toBlock(node[key], node); +} + +function clone(node) { + if (!node) return node; + var newNode = {}; + for (var key in node) { + if (key[0] === "_") continue; + newNode[key] = node[key]; + } + return newNode; +} + +function cloneWithoutLoc(node) { + var newNode = clone(node); + delete newNode.loc; + return newNode; +} + +function cloneDeep(node) { + if (!node) return node; + var newNode = {}; + + for (var key in node) { + if (key[0] === "_") continue; + + var val = node[key]; + + if (val) { + if (val.type) { + val = t.cloneDeep(val); + } else if (Array.isArray(val)) { + val = val.map(t.cloneDeep); + } + } + + newNode[key] = val; + } + + return newNode; +} + +function buildMatchMemberExpression(match, allowPartial) { + var parts = match.split("."); + + return function (member) { + if (!t.isMemberExpression(member)) return false; + + var search = [member]; + var i = 0; + + while (search.length) { + var node = search.shift(); + + if (allowPartial && i === parts.length) { + return true; + } + + if (t.isIdentifier(node)) { + if (parts[i] !== node.name) return false; + } else if (t.isStringLiteral(node)) { + if (parts[i] !== node.value) return false; + } else if (t.isMemberExpression(node)) { + if (node.computed && !t.isStringLiteral(node.property)) { + return false; + } else { + search.push(node.object); + search.push(node.property); + continue; + } + } else { + return false; + } + + if (++i > parts.length) { + return false; + } + } + + return true; + }; +} + +function removeComments(node) { + for (var _iterator4 = t.COMMENT_KEYS, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { + var _ref4; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref4 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref4 = _i4.value; + } + + var key = _ref4; + + delete node[key]; + } + return node; +} + +function inheritsComments(child, parent) { + inheritTrailingComments(child, parent); + inheritLeadingComments(child, parent); + inheritInnerComments(child, parent); + return child; +} + +function inheritTrailingComments(child, parent) { + _inheritComments("trailingComments", child, parent); +} + +function inheritLeadingComments(child, parent) { + _inheritComments("leadingComments", child, parent); +} + +function inheritInnerComments(child, parent) { + _inheritComments("innerComments", child, parent); +} + +function _inheritComments(key, child, parent) { + if (child && parent) { + child[key] = (0, _uniq2.default)([].concat(child[key], parent[key]).filter(Boolean)); + } +} + +function inherits(child, parent) { + if (!child || !parent) return child; + + for (var _iterator5 = t.INHERIT_KEYS.optional, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) { + var _ref5; + + if (_isArray5) { + if (_i5 >= _iterator5.length) break; + _ref5 = _iterator5[_i5++]; + } else { + _i5 = _iterator5.next(); + if (_i5.done) break; + _ref5 = _i5.value; + } + + var _key2 = _ref5; + + if (child[_key2] == null) { + child[_key2] = parent[_key2]; + } + } + + for (var key in parent) { + if (key[0] === "_") child[key] = parent[key]; + } + + for (var _iterator6 = t.INHERIT_KEYS.force, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) { + var _ref6; + + if (_isArray6) { + if (_i6 >= _iterator6.length) break; + _ref6 = _iterator6[_i6++]; + } else { + _i6 = _iterator6.next(); + if (_i6.done) break; + _ref6 = _i6.value; + } + + var _key3 = _ref6; + + child[_key3] = parent[_key3]; + } + + t.inheritsComments(child, parent); + + return child; +} + +function assertNode(node) { + if (!isNode(node)) { + throw new TypeError("Not a valid node " + (node && node.type)); + } +} + +function isNode(node) { + return !!(node && _definitions.VISITOR_KEYS[node.type]); +} + +(0, _toFastProperties2.default)(t); +(0, _toFastProperties2.default)(t.VISITOR_KEYS); + +function traverseFast(node, enter, opts) { + if (!node) return; + + var keys = t.VISITOR_KEYS[node.type]; + if (!keys) return; + + opts = opts || {}; + enter(node, opts); + + for (var _iterator7 = keys, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) { + var _ref7; + + if (_isArray7) { + if (_i7 >= _iterator7.length) break; + _ref7 = _iterator7[_i7++]; + } else { + _i7 = _iterator7.next(); + if (_i7.done) break; + _ref7 = _i7.value; + } + + var key = _ref7; + + var subNode = node[key]; + + if (Array.isArray(subNode)) { + for (var _iterator8 = subNode, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : (0, _getIterator3.default)(_iterator8);;) { + var _ref8; + + if (_isArray8) { + if (_i8 >= _iterator8.length) break; + _ref8 = _iterator8[_i8++]; + } else { + _i8 = _iterator8.next(); + if (_i8.done) break; + _ref8 = _i8.value; + } + + var _node = _ref8; + + traverseFast(_node, enter, opts); + } + } else { + traverseFast(subNode, enter, opts); + } + } +} + +var CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"]; + +var CLEAR_KEYS_PLUS_COMMENTS = t.COMMENT_KEYS.concat(["comments"]).concat(CLEAR_KEYS); + +function removeProperties(node, opts) { + opts = opts || {}; + var map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS; + for (var _iterator9 = map, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : (0, _getIterator3.default)(_iterator9);;) { + var _ref9; + + if (_isArray9) { + if (_i9 >= _iterator9.length) break; + _ref9 = _iterator9[_i9++]; + } else { + _i9 = _iterator9.next(); + if (_i9.done) break; + _ref9 = _i9.value; + } + + var _key4 = _ref9; + + if (node[_key4] != null) node[_key4] = undefined; + } + + for (var key in node) { + if (key[0] === "_" && node[key] != null) node[key] = undefined; + } + + var syms = (0, _getOwnPropertySymbols2.default)(node); + for (var _iterator10 = syms, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : (0, _getIterator3.default)(_iterator10);;) { + var _ref10; + + if (_isArray10) { + if (_i10 >= _iterator10.length) break; + _ref10 = _iterator10[_i10++]; + } else { + _i10 = _iterator10.next(); + if (_i10.done) break; + _ref10 = _i10.value; + } + + var sym = _ref10; + + node[sym] = null; + } +} + +function removePropertiesDeep(tree, opts) { + traverseFast(tree, removeProperties, opts); + return tree; +} \ No newline at end of file diff --git a/node_modules/babel-types/lib/react.js b/node_modules/babel-types/lib/react.js new file mode 100644 index 0000000..923ee12 --- /dev/null +++ b/node_modules/babel-types/lib/react.js @@ -0,0 +1,80 @@ +"use strict"; + +exports.__esModule = true; +exports.isReactComponent = undefined; +exports.isCompatTag = isCompatTag; +exports.buildChildren = buildChildren; + +var _index = require("./index"); + +var t = _interopRequireWildcard(_index); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +var isReactComponent = exports.isReactComponent = t.buildMatchMemberExpression("React.Component"); + +function isCompatTag(tagName) { + return !!tagName && /^[a-z]|\-/.test(tagName); +} + +function cleanJSXElementLiteralChild(child, args) { + var lines = child.value.split(/\r\n|\n|\r/); + + var lastNonEmptyLine = 0; + + for (var i = 0; i < lines.length; i++) { + if (lines[i].match(/[^ \t]/)) { + lastNonEmptyLine = i; + } + } + + var str = ""; + + for (var _i = 0; _i < lines.length; _i++) { + var line = lines[_i]; + + var isFirstLine = _i === 0; + var isLastLine = _i === lines.length - 1; + var isLastNonEmptyLine = _i === lastNonEmptyLine; + + var trimmedLine = line.replace(/\t/g, " "); + + if (!isFirstLine) { + trimmedLine = trimmedLine.replace(/^[ ]+/, ""); + } + + if (!isLastLine) { + trimmedLine = trimmedLine.replace(/[ ]+$/, ""); + } + + if (trimmedLine) { + if (!isLastNonEmptyLine) { + trimmedLine += " "; + } + + str += trimmedLine; + } + } + + if (str) args.push(t.stringLiteral(str)); +} + +function buildChildren(node) { + var elems = []; + + for (var i = 0; i < node.children.length; i++) { + var child = node.children[i]; + + if (t.isJSXText(child)) { + cleanJSXElementLiteralChild(child, elems); + continue; + } + + if (t.isJSXExpressionContainer(child)) child = child.expression; + if (t.isJSXEmptyExpression(child)) continue; + + elems.push(child); + } + + return elems; +} \ No newline at end of file diff --git a/node_modules/babel-types/lib/retrievers.js b/node_modules/babel-types/lib/retrievers.js new file mode 100644 index 0000000..ae7987f --- /dev/null +++ b/node_modules/babel-types/lib/retrievers.js @@ -0,0 +1,116 @@ +"use strict"; + +exports.__esModule = true; + +var _create = require("babel-runtime/core-js/object/create"); + +var _create2 = _interopRequireDefault(_create); + +exports.getBindingIdentifiers = getBindingIdentifiers; +exports.getOuterBindingIdentifiers = getOuterBindingIdentifiers; + +var _index = require("./index"); + +var t = _interopRequireWildcard(_index); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function getBindingIdentifiers(node, duplicates, outerOnly) { + var search = [].concat(node); + var ids = (0, _create2.default)(null); + + while (search.length) { + var id = search.shift(); + if (!id) continue; + + var keys = t.getBindingIdentifiers.keys[id.type]; + + if (t.isIdentifier(id)) { + if (duplicates) { + var _ids = ids[id.name] = ids[id.name] || []; + _ids.push(id); + } else { + ids[id.name] = id; + } + continue; + } + + if (t.isExportDeclaration(id)) { + if (t.isDeclaration(id.declaration)) { + search.push(id.declaration); + } + continue; + } + + if (outerOnly) { + if (t.isFunctionDeclaration(id)) { + search.push(id.id); + continue; + } + + if (t.isFunctionExpression(id)) { + continue; + } + } + + if (keys) { + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (id[key]) { + search = search.concat(id[key]); + } + } + } + } + + return ids; +} + +getBindingIdentifiers.keys = { + DeclareClass: ["id"], + DeclareFunction: ["id"], + DeclareModule: ["id"], + DeclareVariable: ["id"], + InterfaceDeclaration: ["id"], + TypeAlias: ["id"], + OpaqueType: ["id"], + + CatchClause: ["param"], + LabeledStatement: ["label"], + UnaryExpression: ["argument"], + AssignmentExpression: ["left"], + + ImportSpecifier: ["local"], + ImportNamespaceSpecifier: ["local"], + ImportDefaultSpecifier: ["local"], + ImportDeclaration: ["specifiers"], + + ExportSpecifier: ["exported"], + ExportNamespaceSpecifier: ["exported"], + ExportDefaultSpecifier: ["exported"], + + FunctionDeclaration: ["id", "params"], + FunctionExpression: ["id", "params"], + + ClassDeclaration: ["id"], + ClassExpression: ["id"], + + RestElement: ["argument"], + UpdateExpression: ["argument"], + + RestProperty: ["argument"], + ObjectProperty: ["value"], + + AssignmentPattern: ["left"], + ArrayPattern: ["elements"], + ObjectPattern: ["properties"], + + VariableDeclaration: ["declarations"], + VariableDeclarator: ["id"] +}; + +function getOuterBindingIdentifiers(node, duplicates) { + return getBindingIdentifiers(node, duplicates, true); +} \ No newline at end of file diff --git a/node_modules/babel-types/lib/validators.js b/node_modules/babel-types/lib/validators.js new file mode 100644 index 0000000..ec30e55 --- /dev/null +++ b/node_modules/babel-types/lib/validators.js @@ -0,0 +1,265 @@ +"use strict"; + +exports.__esModule = true; + +var _keys = require("babel-runtime/core-js/object/keys"); + +var _keys2 = _interopRequireDefault(_keys); + +var _typeof2 = require("babel-runtime/helpers/typeof"); + +var _typeof3 = _interopRequireDefault(_typeof2); + +var _getIterator2 = require("babel-runtime/core-js/get-iterator"); + +var _getIterator3 = _interopRequireDefault(_getIterator2); + +exports.isBinding = isBinding; +exports.isReferenced = isReferenced; +exports.isValidIdentifier = isValidIdentifier; +exports.isLet = isLet; +exports.isBlockScoped = isBlockScoped; +exports.isVar = isVar; +exports.isSpecifierDefault = isSpecifierDefault; +exports.isScope = isScope; +exports.isImmutable = isImmutable; +exports.isNodesEquivalent = isNodesEquivalent; + +var _retrievers = require("./retrievers"); + +var _esutils = require("esutils"); + +var _esutils2 = _interopRequireDefault(_esutils); + +var _index = require("./index"); + +var t = _interopRequireWildcard(_index); + +var _constants = require("./constants"); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isBinding(node, parent) { + var keys = _retrievers.getBindingIdentifiers.keys[parent.type]; + if (keys) { + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var val = parent[key]; + if (Array.isArray(val)) { + if (val.indexOf(node) >= 0) return true; + } else { + if (val === node) return true; + } + } + } + + return false; +} + +function isReferenced(node, parent) { + switch (parent.type) { + case "BindExpression": + return parent.object === node || parent.callee === node; + + case "MemberExpression": + case "JSXMemberExpression": + if (parent.property === node && parent.computed) { + return true; + } else if (parent.object === node) { + return true; + } else { + return false; + } + + case "MetaProperty": + return false; + + case "ObjectProperty": + if (parent.key === node) { + return parent.computed; + } + + case "VariableDeclarator": + return parent.id !== node; + + case "ArrowFunctionExpression": + case "FunctionDeclaration": + case "FunctionExpression": + for (var _iterator = parent.params, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var param = _ref; + + if (param === node) return false; + } + + return parent.id !== node; + + case "ExportSpecifier": + if (parent.source) { + return false; + } else { + return parent.local === node; + } + + case "ExportNamespaceSpecifier": + case "ExportDefaultSpecifier": + return false; + + case "JSXAttribute": + return parent.name !== node; + + case "ClassProperty": + if (parent.key === node) { + return parent.computed; + } else { + return parent.value === node; + } + + case "ImportDefaultSpecifier": + case "ImportNamespaceSpecifier": + case "ImportSpecifier": + return false; + + case "ClassDeclaration": + case "ClassExpression": + return parent.id !== node; + + case "ClassMethod": + case "ObjectMethod": + return parent.key === node && parent.computed; + + case "LabeledStatement": + return false; + + case "CatchClause": + return parent.param !== node; + + case "RestElement": + return false; + + case "AssignmentExpression": + return parent.right === node; + + case "AssignmentPattern": + return parent.right === node; + + case "ObjectPattern": + case "ArrayPattern": + return false; + } + + return true; +} + +function isValidIdentifier(name) { + if (typeof name !== "string" || _esutils2.default.keyword.isReservedWordES6(name, true)) { + return false; + } else if (name === "await") { + return false; + } else { + return _esutils2.default.keyword.isIdentifierNameES6(name); + } +} + +function isLet(node) { + return t.isVariableDeclaration(node) && (node.kind !== "var" || node[_constants.BLOCK_SCOPED_SYMBOL]); +} + +function isBlockScoped(node) { + return t.isFunctionDeclaration(node) || t.isClassDeclaration(node) || t.isLet(node); +} + +function isVar(node) { + return t.isVariableDeclaration(node, { kind: "var" }) && !node[_constants.BLOCK_SCOPED_SYMBOL]; +} + +function isSpecifierDefault(specifier) { + return t.isImportDefaultSpecifier(specifier) || t.isIdentifier(specifier.imported || specifier.exported, { name: "default" }); +} + +function isScope(node, parent) { + if (t.isBlockStatement(node) && t.isFunction(parent, { body: node })) { + return false; + } + + return t.isScopable(node); +} + +function isImmutable(node) { + if (t.isType(node.type, "Immutable")) return true; + + if (t.isIdentifier(node)) { + if (node.name === "undefined") { + return true; + } else { + return false; + } + } + + return false; +} + +function isNodesEquivalent(a, b) { + if ((typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a)) !== "object" || (typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a)) !== "object" || a == null || b == null) { + return a === b; + } + + if (a.type !== b.type) { + return false; + } + + var fields = (0, _keys2.default)(t.NODE_FIELDS[a.type] || a.type); + + for (var _iterator2 = fields, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var field = _ref2; + + if ((0, _typeof3.default)(a[field]) !== (0, _typeof3.default)(b[field])) { + return false; + } + + if (Array.isArray(a[field])) { + if (!Array.isArray(b[field])) { + return false; + } + if (a[field].length !== b[field].length) { + return false; + } + + for (var i = 0; i < a[field].length; i++) { + if (!isNodesEquivalent(a[field][i], b[field][i])) { + return false; + } + } + continue; + } + + if (!isNodesEquivalent(a[field], b[field])) { + return false; + } + } + + return true; +} \ No newline at end of file diff --git a/node_modules/babel-types/package-lock.json b/node_modules/babel-types/package-lock.json new file mode 100644 index 0000000..49fefe9 --- /dev/null +++ b/node_modules/babel-types/package-lock.json @@ -0,0 +1,29 @@ +{ + "name": "babel-types", + "version": "6.25.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" + }, + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=" + } + } +} diff --git a/node_modules/babel-types/package.json b/node_modules/babel-types/package.json new file mode 100644 index 0000000..80fc344 --- /dev/null +++ b/node_modules/babel-types/package.json @@ -0,0 +1,51 @@ +{ + "_from": "babel-types@^6.26.0", + "_id": "babel-types@6.26.0", + "_inBundle": false, + "_integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "_location": "/babel-types", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "babel-types@^6.26.0", + "name": "babel-types", + "escapedName": "babel-types", + "rawSpec": "^6.26.0", + "saveSpec": null, + "fetchSpec": "^6.26.0" + }, + "_requiredBy": [ + "/constantinople" + ], + "_resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "_shasum": "a3b073f94ab49eb6fa55cd65227a334380632497", + "_spec": "babel-types@^6.26.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/constantinople", + "author": { + "name": "Sebastian McKenzie", + "email": "sebmck@gmail.com" + }, + "bundleDependencies": false, + "dependencies": { + "babel-runtime": "^6.26.0", + "esutils": "^2.0.2", + "lodash": "^4.17.4", + "to-fast-properties": "^1.0.3" + }, + "deprecated": false, + "description": "Babel Types is a Lodash-esque utility library for AST nodes", + "devDependencies": { + "babel-generator": "^6.26.0", + "babylon": "^6.18.0" + }, + "homepage": "https://babeljs.io/", + "license": "MIT", + "main": "lib/index.js", + "name": "babel-types", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel/tree/master/packages/babel-types" + }, + "version": "6.26.0" +} diff --git a/node_modules/babylon/CHANGELOG.md b/node_modules/babylon/CHANGELOG.md new file mode 100644 index 0000000..f5f1794 --- /dev/null +++ b/node_modules/babylon/CHANGELOG.md @@ -0,0 +1,979 @@ +# Changelog + +> **Tags:** +> - :boom: [Breaking Change] +> - :eyeglasses: [Spec Compliancy] +> - :rocket: [New Feature] +> - :bug: [Bug Fix] +> - :memo: [Documentation] +> - :house: [Internal] +> - :nail_care: [Polish] + +> Semver Policy: https://github.com/babel/babylon#semver + +_Note: Gaps between patch versions are faulty, broken or test releases._ + +See the [Babel Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md) for the pre-6.8.0 version Changelog. + +## 6.17.4 (2017-06-18) + + * Fix comment attachment for call expressions (#575) (aardito2) + * Correctly put typeParameters on FunctionExpression (#585) (Daniel Tschinder) + +## 6.17.3 (2017-06-09) + + * Fix location info on FunctionTypeParam nodes (#565) (#571) (Michal Srb) + * Fix stmt value being the raw value (#557) (#558) (Daniel Tschinder) + +## 6.17.2 (2017-05-31) + + * Fixed disappearing comments following a trailing comma on the last property of an object literal or the last argument of a call expression (#478) (aardito2) + * Fix #437: only prohibit 'export type from "module" ' when flow is enabled (#438) (Kevin Gibbons) + * Fix handling of anonymous parameters in `flowParseObjectTypeMethodish`. (#526) (Max Schaefer) + * Convert argument of SpreadElement correctly to assignable (#518) (Daniel Tschinder) + +## 6.17.1 (2017-05-10) + + * Fix typo in flow spread operator error (Brian Ng) + * Fixed invalid number literal parsing ([#473](https://github.com/babel/babylon/pull/473)) (Alex Kuzmenko) + * Fix number parser ([#433](https://github.com/babel/babylon/pull/433)) (Alex Kuzmenko) + * Ensure non pattern shorthand props are checked for reserved words ([#479](https://github.com/babel/babylon/pull/479)) (Brian Ng) + * Remove jsx context when parsing arrow functions ([#475](https://github.com/babel/babylon/pull/475)) (Brian Ng) + * Allow super in class properties ([#499](https://github.com/babel/babylon/pull/499)) (Brian Ng) + * Allow flow class field to be named constructor ([#510](https://github.com/babel/babylon/pull/510)) (Brian Ng) + +## 6.17.0 (2017-04-20) + + * Cherry-pick #418 to 6.x ([#476](https://github.com/babel/babylon/pull/476)) (Sebastian McKenzie) + * Add support for invalid escapes in tagged templates ([#274](https://github.com/babel/babylon/pull/274)) (Kevin Gibbons) + * Throw error if new.target is used outside of a function ([#402](https://github.com/babel/babylon/pull/402)) (Brian Ng) + * Fix parsing of class properties ([#351](https://github.com/babel/babylon/pull/351)) (Kevin Gibbons) + * Fix parsing yield with dynamicImport ([#383](https://github.com/babel/babylon/pull/383)) (Brian Ng) + * Ensure consistent start args for parseParenItem ([#386](https://github.com/babel/babylon/pull/386)) (Brian Ng) + +## 6.16.0 (2017-02-23) + +### :rocket: New Feature + +***ESTree*** compatibility as plugin ([#277](https://github.com/babel/babylon/pull/277)) (Daniel Tschinder) + +We finally introduce a new compatibility layer for ESTree. To put babylon into ESTree-compatible mode the new plugin `estree` can be enabled. In this mode the parser will output an AST that is compliant to the specs of [ESTree](https://github.com/estree/estree/) + +We highly recommend everyone who uses babylon outside of babel to use this plugin. This will make it much easier for users to switch between different ESTree-compatible parsers. We so far tested several projects with different parsers and exchanged their parser to babylon and in nearly all cases it worked out of the box. Some other estree-compatible parsers include `acorn`, `esprima`, `espree`, `flow-parser`, etc. + +To enable `estree` mode simply add the plugin in the config: +```json +{ + "plugins": [ "estree" ] +} +``` + +If you want to migrate your project from non-ESTree mode to ESTree, have a look at our [Readme](https://github.com/babel/babylon/#output), where all deviations are mentioned. + +Add a parseExpression public method ([#213](https://github.com/babel/babylon/pull/213)) (jeromew) + +Babylon exports a new function to parse a single expression + +```js +import { parseExpression } from 'babylon'; + +const ast = parseExpression('x || y && z', options); +``` + +The returned AST will only consist of the expression. The options are the same as for `parse()` + +Add startLine option ([#346](https://github.com/babel/babylon/pull/346)) (Raphael Mu) + +A new option was added to babylon allowing to change the intial linenumber for the first line which is usually `1`. +Changing this for example to `100` will make line `1` of the input source to be marked as line `100`, line `2` as `101`, line `3` as `102`, ... + +Function predicate declaration ([#103](https://github.com/babel/babylon/pull/103)) (Panagiotis Vekris) + +Added support for function predicates which flow introduced in version 0.33.0 + +```js +declare function is_number(x: mixed): boolean %checks(typeof x === "number"); +``` + +Allow imports in declare module ([#315](https://github.com/babel/babylon/pull/315)) (Daniel Tschinder) + +Added support for imports within module declarations which flow introduced in version 0.37.0 + +```js +declare module "C" { + import type { DT } from "D"; + declare export type CT = { D: DT }; +} +``` + +### :eyeglasses: Spec Compliancy + +Forbid semicolons after decorators in classes ([#352](https://github.com/babel/babylon/pull/352)) (Kevin Gibbons) + +This example now correctly throws an error when there is a semicolon after the decorator: + +```js +class A { +@a; +foo(){} +} +``` + +Keywords are not allowed as local specifier ([#307](https://github.com/babel/babylon/pull/307)) (Daniel Tschinder) + +Using keywords in imports is not allowed anymore: + +```js +import { default } from "foo"; +import { a as debugger } from "foo"; +``` + +Do not allow overwritting of primitive types ([#314](https://github.com/babel/babylon/pull/314)) (Daniel Tschinder) + +In flow it is now forbidden to overwrite the primitve types `"any"`, `"mixed"`, `"empty"`, `"bool"`, `"boolean"`, `"number"`, `"string"`, `"void"` and `"null"` with your own type declaration. + +Disallow import type { type a } from … ([#305](https://github.com/babel/babylon/pull/305)) (Daniel Tschinder) + +The following code now correctly throws an error + +```js +import type { type a } from "foo"; +``` + +Don't parse class properties without initializers when classProperties is disabled and Flow is enabled ([#300](https://github.com/babel/babylon/pull/300)) (Andrew Levine) + +Ensure that you enable the `classProperties` plugin in order to enable correct parsing of class properties. Prior to this version it was possible to parse them by enabling the `flow` plugin but this was not intended the behaviour. + +If you enable the flow plugin you can only define the type of the class properties, but not initialize them. + +Fix export default async function to be FunctionDeclaration ([#324](https://github.com/babel/babylon/pull/324)) (Daniel Tschinder) + +Parsing the following code now returns a `FunctionDeclaration` AST node instead of `FunctionExpression`. + +```js +export default async function bar() {}; +``` + +### :nail_care: Polish + +Improve error message on attempt to destructure named import ([#288](https://github.com/babel/babylon/pull/288)) (Brian Ng) + +### :bug: Bug Fix + +Fix negative number literal typeannotations ([#366](https://github.com/babel/babylon/pull/366)) (Daniel Tschinder) + +Ensure takeDecorators is called on exported class ([#358](https://github.com/babel/babylon/pull/358)) (Brian Ng) + +ESTree: correctly change literals in all cases ([#368](https://github.com/babel/babylon/pull/368)) (Daniel Tschinder) + +Correctly convert RestProperty to Assignable ([#339](https://github.com/babel/babylon/pull/339)) (Daniel Tschinder) + +Fix #321 by allowing question marks in type params ([#338](https://github.com/babel/babylon/pull/338)) (Daniel Tschinder) + +Fix #336 by correctly setting arrow-param ([#337](https://github.com/babel/babylon/pull/337)) (Daniel Tschinder) + +Fix parse error when destructuring `set` with default value ([#317](https://github.com/babel/babylon/pull/317)) (Brian Ng) + +Fix ObjectTypeCallProperty static ([#298](https://github.com/babel/babylon/pull/298)) (Dan Harper) + + +### :house: Internal + +Fix generator-method-with-computed-name spec ([#360](https://github.com/babel/babylon/pull/360)) (Alex Rattray) + +Fix flow type-parameter-declaration test with unintended semantic ([#361](https://github.com/babel/babylon/pull/361)) (Alex Rattray) + +Cleanup and splitup parser functions ([#295](https://github.com/babel/babylon/pull/295)) (Daniel Tschinder) + +chore(package): update flow-bin to version 0.38.0 ([#313](https://github.com/babel/babylon/pull/313)) (greenkeeper[bot]) + +Call inner function instead of 1:1 copy to plugin ([#294](https://github.com/babel/babylon/pull/294)) (Daniel Tschinder) + +Update eslint-config-babel to the latest version 🚀 ([#299](https://github.com/babel/babylon/pull/299)) (greenkeeper[bot]) + +Update eslint-config-babel to the latest version 🚀 ([#293](https://github.com/babel/babylon/pull/293)) (greenkeeper[bot]) + +devDeps: remove eslint-plugin-babel ([#292](https://github.com/babel/babylon/pull/292)) (Kai Cataldo) + +Correct indent eslint rule config ([#276](https://github.com/babel/babylon/pull/276)) (Daniel Tschinder) + +Fail tests that have expected.json and throws-option ([#285](https://github.com/babel/babylon/pull/285)) (Daniel Tschinder) + +### :memo: Documentation + +Update contributing with more test info [skip ci] ([#355](https://github.com/babel/babylon/pull/355)) (Brian Ng) + +Update API documentation ([#330](https://github.com/babel/babylon/pull/330)) (Timothy Gu) + +Added keywords to package.json ([#323](https://github.com/babel/babylon/pull/323)) (Dmytro) + +AST spec: fix casing of `RegExpLiteral` ([#318](https://github.com/babel/babylon/pull/318)) (Mathias Bynens) + +## 6.15.0 (2017-01-10) + +### :eyeglasses: Spec Compliancy + +Add support for Flow shorthand import type ([#267](https://github.com/babel/babylon/pull/267)) (Jeff Morrison) + +This change implements flows new shorthand import syntax +and where previously you had to write this code: + +```js +import {someValue} from "blah"; +import type {someType} from "blah"; +import typeof {someOtherValue} from "blah"; +``` + +you can now write it like this: + +```js +import { + someValue, + type someType, + typeof someOtherValue, +} from "blah"; +``` + +For more information look at [this](https://github.com/facebook/flow/pull/2890) pull request. + +flow: allow leading pipes in all positions ([#256](https://github.com/babel/babylon/pull/256)) (Vladimir Kurchatkin) + +This change now allows a leading pipe everywhere types can be used: +```js +var f = (x): | 1 | 2 => 1; +``` + +Throw error when exporting non-declaration ([#241](https://github.com/babel/babylon/pull/241)) (Kai Cataldo) + +Previously babylon parsed the following exports, although they are not valid: +```js +export typeof foo; +export new Foo(); +export function() {}; +export for (;;); +export while(foo); +``` + +### :bug: Bug Fix + +Don't set inType flag when parsing property names ([#266](https://github.com/babel/babylon/pull/266)) (Vladimir Kurchatkin) + +This fixes parsing of this case: + +```js +const map = { + [age <= 17] : 'Too young' +}; +``` + +Fix source location for JSXEmptyExpression nodes (fixes #248) ([#249](https://github.com/babel/babylon/pull/249)) (James Long) + +The following case produced an invalid AST +```js +
{/* foo */}
+``` + +Use fromCodePoint to convert high value unicode entities ([#243](https://github.com/babel/babylon/pull/243)) (Ryan Duffy) + +When high value unicode entities (e.g. 💩) were used in the input source code they are now correctly encoded in the resulting AST. + +Rename folder to avoid Windows-illegal characters ([#281](https://github.com/babel/babylon/pull/281)) (Ryan Plant) + +Allow this.state.clone() when parsing decorators ([#262](https://github.com/babel/babylon/pull/262)) (Alex Rattray) + +### :house: Internal + +User external-helpers ([#254](https://github.com/babel/babylon/pull/254)) (Daniel Tschinder) + +Add watch script for dev ([#234](https://github.com/babel/babylon/pull/234)) (Kai Cataldo) + +Freeze current plugins list for "*" option, and remove from README.md ([#245](https://github.com/babel/babylon/pull/245)) (Andrew Levine) + +Prepare tests for multiple fixture runners. ([#240](https://github.com/babel/babylon/pull/240)) (Daniel Tschinder) + +Add some test coverage for decorators stage-0 plugin ([#250](https://github.com/babel/babylon/pull/250)) (Andrew Levine) + +Refactor tokenizer types file ([#263](https://github.com/babel/babylon/pull/263)) (Sven SAULEAU) + +Update eslint-config-babel to the latest version 🚀 ([#273](https://github.com/babel/babylon/pull/273)) (greenkeeper[bot]) + +chore(package): update rollup to version 0.41.0 ([#272](https://github.com/babel/babylon/pull/272)) (greenkeeper[bot]) + +chore(package): update flow-bin to version 0.37.0 ([#255](https://github.com/babel/babylon/pull/255)) (greenkeeper[bot]) + +## 6.14.1 (2016-11-17) + +### :bug: Bug Fix + +Allow `"plugins": ["*"]` ([#229](https://github.com/babel/babylon/pull/229)) (Daniel Tschinder) + +```js +{ + "plugins": ["*"] +} +``` + +Will include all parser plugins instead of specifying each one individually. Useful for tools like babel-eslint, jscodeshift, and ast-explorer. + +## 6.14.0 (2016-11-16) + +### :eyeglasses: Spec Compliancy + +Throw error for reserved words `enum` and `await` ([#195](https://github.com/babel/babylon/pull/195)) (Kai Cataldo) + +[11.6.2.2 Future Reserved Words](http://www.ecma-international.org/ecma-262/6.0/#sec-future-reserved-words) + +Babylon will throw for more reserved words such as `enum` or `await` (in strict mode). + +``` +class enum {} // throws +class await {} // throws in strict mode (module) +``` + +Optional names for function types and object type indexers ([#197](https://github.com/babel/babylon/pull/197)) (Gabe Levi) + +So where you used to have to write + +```js +type A = (x: string, y: boolean) => number; +type B = (z: string) => number; +type C = { [key: string]: number }; +``` + +you can now write (with flow 0.34.0) + +```js +type A = (string, boolean) => number; +type B = string => number; +type C = { [string]: number }; +``` + +Parse flow nested array type annotations like `number[][]` ([#219](https://github.com/babel/babylon/pull/219)) (Bernhard Häussner) + +Supports these form now of specifying array types: + +```js +var a: number[][][][]; +var b: string[][]; +``` + +### :bug: Bug Fix + +Correctly eat semicolon at the end of `DelcareModuleExports` ([#223](https://github.com/babel/babylon/pull/223)) (Daniel Tschinder) + +``` +declare module "foo" { declare module.exports: number } +declare module "foo" { declare module.exports: number; } // also allowed now +``` + +### :house: Internal + + * Count Babel tests towards Babylon code coverage ([#182](https://github.com/babel/babylon/pull/182)) (Moti Zilberman) + * Fix strange line endings ([#214](https://github.com/babel/babylon/pull/214)) (Thomas Grainger) + * Add node 7 (Daniel Tschinder) + * chore(package): update flow-bin to version 0.34.0 ([#204](https://github.com/babel/babylon/pull/204)) (Greenkeeper) + +## v6.13.1 (2016-10-26) + +### :nail_care: Polish + +- Use rollup for bundling to speed up startup time ([#190](https://github.com/babel/babylon/pull/190)) ([@drewml](https://github.com/DrewML)) + +```js +const babylon = require('babylon'); +const ast = babylon.parse('var foo = "lol";'); +``` + +With that test case, there was a ~95ms savings by removing the need for node to build/traverse the dependency graph. + +**Without bundling** +![image](https://cloud.githubusercontent.com/assets/5233399/19420264/3133497e-93ad-11e6-9a6a-2da59c4f5c13.png) + +**With bundling** +![image](https://cloud.githubusercontent.com/assets/5233399/19420267/388f556e-93ad-11e6-813e-7c5c396be322.png) + +- add clean command [skip ci] ([#201](https://github.com/babel/babylon/pull/201)) (Henry Zhu) +- add ForAwaitStatement (async generator already added) [skip ci] ([#196](https://github.com/babel/babylon/pull/196)) (Henry Zhu) + +## v6.13.0 (2016-10-21) + +### :eyeglasses: Spec Compliancy + +Property variance type annotations for Flow plugin ([#161](https://github.com/babel/babylon/pull/161)) (Sam Goldman) + +> See https://flowtype.org/docs/variance.html for more information + +```js +type T = { +p: T }; +interface T { -p: T }; +declare class T { +[k:K]: V }; +class T { -[k:K]: V }; +class C2 { +p: T = e }; +``` + +Raise error on duplicate definition of __proto__ ([#183](https://github.com/babel/babylon/pull/183)) (Moti Zilberman) + +```js +({ __proto__: 1, __proto__: 2 }) // Throws an error now +``` + +### :bug: Bug Fix + +Flow: Allow class properties to be named `static` ([#184](https://github.com/babel/babylon/pull/184)) (Moti Zilberman) + +```js +declare class A { + static: T; +} +``` + +Allow "async" as identifier for object literal property shorthand ([#187](https://github.com/babel/babylon/pull/187)) (Andrew Levine) + +```js +var foo = { async, bar }; +``` + +### :nail_care: Polish + +Fix flowtype and add inType to state ([#189](https://github.com/babel/babylon/pull/189)) (Daniel Tschinder) + +> This improves the performance slightly (because of hidden classes) + +### :house: Internal + +Fix .gitattributes line ending setting ([#191](https://github.com/babel/babylon/pull/191)) (Moti Zilberman) + +Increase test coverage ([#175](https://github.com/babel/babylon/pull/175) (Moti Zilberman) + +Readd missin .eslinignore for IDEs (Daniel Tschinder) + +Error on missing expected.json fixture in CI ([#188](https://github.com/babel/babylon/pull/188)) (Moti Zilberman) + +Add .gitattributes and .editorconfig for LF line endings ([#179](https://github.com/babel/babylon/pull/179)) (Moti Zilberman) + +Fixes two tests that are failing after the merge of #172 ([#177](https://github.com/babel/babylon/pull/177)) (Moti Zilberman) + +## v6.12.0 (2016-10-14) + +### :eyeglasses: Spec Compliancy + +Implement import() syntax ([#163](https://github.com/babel/babylon/pull/163)) (Jordan Gensler) + +#### Dynamic Import + +- Proposal Repo: https://github.com/domenic/proposal-dynamic-import +- Championed by [@domenic](https://github.com/domenic) +- stage-2 +- [sept-28 tc39 notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-09/sept-28.md#113a-import) + +> This repository contains a proposal for adding a "function-like" import() module loading syntactic form to JavaScript + +```js +import(`./section-modules/${link.dataset.entryModule}.js`) +.then(module => { + module.loadPageInto(main); +}) +``` + +Add EmptyTypeAnnotation ([#171](https://github.com/babel/babylon/pull/171)) (Sam Goldman) + +#### EmptyTypeAnnotation + +Just wasn't covered before. + +```js +type T = empty; +``` + +### :bug: Bug Fix + +Fix crash when exporting with destructuring and sparse array ([#170](https://github.com/babel/babylon/pull/170)) (Jeroen Engels) + +```js +// was failing due to sparse array +export const { foo: [ ,, qux7 ] } = bar; +``` + +Allow keyword in Flow object declaration property names with type parameters ([#146](https://github.com/babel/babylon/pull/146)) (Dan Harper) + +```js +declare class X { + foobar(): void; + static foobar(): void; +} +``` + +Allow keyword in object/class property names with Flow type parameters ([#145](https://github.com/babel/babylon/pull/145)) (Dan Harper) + +```js +class Foo { + delete(item: T): T { + return item; + } +} +``` + +Allow typeAnnotations for yield expressions ([#174](https://github.com/babel/babylon/pull/174))) (Daniel Tschinder) + +```js +function *foo() { + const x = (yield 5: any); +} +``` + +### :nail_care: Polish + +Annotate more errors with expected token ([#172](https://github.com/babel/babylon/pull/172))) (Moti Zilberman) + +```js +// Unexpected token, expected ; (1:6) +{ set 1 } +``` + +### :house: Internal + +Remove kcheck ([#173](https://github.com/babel/babylon/pull/173))) (Daniel Tschinder) + +Also run flow, linting, babel tests on seperate instances (add back node 0.10) + +## v6.11.6 (2016-10-12) + +### :bug: Bug Fix/Regression + +Fix crash when exporting with destructuring and sparse array ([#170](https://github.com/babel/babylon/pull/170)) (Jeroen Engels) + +```js +// was failing with `Cannot read property 'type' of null` because of null identifiers +export const { foo: [ ,, qux7 ] } = bar; +``` + +## v6.11.5 (2016-10-12) + +### :eyeglasses: Spec Compliancy + +Fix: Check for duplicate named exports in exported destructuring assignments ([#144](https://github.com/babel/babylon/pull/144)) (Kai Cataldo) + +```js +// `foo` has already been exported. Exported identifiers must be unique. (2:20) +export function foo() {}; +export const { a: [{foo}] } = bar; +``` + +Fix: Check for duplicate named exports in exported rest elements/properties ([#164](https://github.com/babel/babylon/pull/164)) (Kai Cataldo) + +```js +// `foo` has already been exported. Exported identifiers must be unique. (2:22) +export const foo = 1; +export const [bar, ...foo] = baz; +``` + +### :bug: Bug Fix + +Fix: Allow identifier `async` for default param in arrow expression ([#165](https://github.com/babel/babylon/pull/165)) (Kai Cataldo) + +```js +// this is ok now +const test = ({async = true}) => {}; +``` + +### :nail_care: Polish + +Babylon will now print out the token it's expecting if there's a `SyntaxError` ([#150](https://github.com/babel/babylon/pull/150)) (Daniel Tschinder) + +```bash +# So in the case of a missing ending curly (`}`) +Module build failed: SyntaxError: Unexpected token, expected } (30:0) + 28 | } + 29 | +> 30 | + | ^ +``` + +## v6.11.4 (2016-10-03) + +Temporary rollback for erroring on trailing comma with spread (#154) (Henry Zhu) + +## v6.11.3 (2016-10-01) + +### :eyeglasses: Spec Compliancy + +Add static errors for object rest (#149) ([@danez](https://github.com/danez)) + +> https://github.com/sebmarkbage/ecmascript-rest-spread + +Object rest copies the *rest* of properties from the right hand side `obj` starting from the left to right. + +```js +let { x, y, ...z } = { x: 1, y: 2, z: 3 }; +// x = 1 +// y = 2 +// z = { z: 3 } +``` + +#### New Syntax Errors: + +**SyntaxError**: The rest element has to be the last element when destructuring (1:10) +```bash +> 1 | let { ...x, y, z } = { x: 1, y: 2, z: 3}; + | ^ +# Previous behavior: +# x = { x: 1, y: 2, z: 3 } +# y = 2 +# z = 3 +``` + +Before, this was just a more verbose way of shallow copying `obj` since it doesn't actually do what you think. + +**SyntaxError**: Cannot have multiple rest elements when destructuring (1:13) + +```bash +> 1 | let { x, ...y, ...z } = { x: 1, y: 2, z: 3}; + | ^ +# Previous behavior: +# x = 1 +# y = { y: 2, z: 3 } +# z = { y: 2, z: 3 } +``` + +Before y and z would just be the same value anyway so there is no reason to need to have both. + +**SyntaxError**: A trailing comma is not permitted after the rest element (1:16) + +```js +let { x, y, ...z, } = obj; +``` + +The rationale for this is that the use case for trailing comma is that you can add something at the end without affecting the line above. Since a RestProperty always has to be the last property it doesn't make sense. + +--- + +get / set are valid property names in default assignment (#142) ([@jezell](https://github.com/jezell)) + +```js +// valid +function something({ set = null, get = null }) {} +``` + +## v6.11.2 (2016-09-23) + +### Bug Fix + +- [#139](https://github.com/babel/babylon/issues/139) Don't do the duplicate check if not an identifier (#140) @hzoo + +```js +// regression with duplicate export check +SyntaxError: ./typography.js: `undefined` has already been exported. Exported identifiers must be unique. (22:13) + 20 | + 21 | export const { rhythm } = typography; +> 22 | export const { TypographyStyle } = typography +``` + +Bail out for now, and make a change to account for destructuring in the next release. + +## 6.11.1 (2016-09-22) + +### Bug Fix +- [#137](https://github.com/babel/babylon/pull/137) - Fix a regression with duplicate exports - it was erroring on all keys in `Object.prototype`. @danez + +```javascript +export toString from './toString'; +``` + +```bash +`toString` has already been exported. Exported identifiers must be unique. (1:7) +> 1 | export toString from './toString'; + | ^ + 2 | +``` + +## 6.11.0 (2016-09-22) + +### Spec Compliancy (will break CI) + +- Disallow duplicate named exports ([#107](https://github.com/babel/babylon/pull/107)) @kaicataldo + +```js +// Only one default export allowed per module. (2:9) +export default function() {}; +export { foo as default }; + +// Only one default export allowed per module. (2:0) +export default {}; +export default function() {}; + +// `Foo` has already been exported. Exported identifiers must be unique. (2:0) +export { Foo }; +export class Foo {}; +``` + +### New Feature (Syntax) + +- Add support for computed class property names ([#121](https://github.com/babel/babylon/pull/121)) @motiz88 + +```js +// AST +interface ClassProperty <: Node { + type: "ClassProperty"; + key: Identifier; + value: Expression; + computed: boolean; // added +} +``` + +```js +// with "plugins": ["classProperties"] +class Foo { + [x] + ['y'] +} + +class Bar { + [p] + [m] () {} +} + ``` + +### Bug Fix + +- Fix `static` property falling through in the declare class Flow AST ([#135](https://github.com/babel/babylon/pull/135)) @danharper + +```js +declare class X { + a: number; + static b: number; // static + c: number; // this was being marked as static in the AST as well +} +``` + +### Polish + +- Rephrase "assigning/binding to rvalue" errors to include context ([#119](https://github.com/babel/babylon/pull/119)) @motiz88 + +```js +// Used to error with: +// SyntaxError: Assigning to rvalue (1:0) + +// Now: +// Invalid left-hand side in assignment expression (1:0) +3 = 4 + +// Invalid left-hand side in for-in statement (1:5) +for (+i in {}); +``` + +### Internal + +- Fix call to `this.parseMaybeAssign` with correct arguments ([#133](https://github.com/babel/babylon/pull/133)) @danez +- Add semver note to changelog ([#131](https://github.com/babel/babylon/pull/131)) @hzoo + +## 6.10.0 (2016-09-19) + +> We plan to include some spec compliancy bugs in patch versions. An example was the multiple default exports issue. + +### Spec Compliancy + +* Implement ES2016 check for simple parameter list in strict mode ([#106](https://github.com/babel/babylon/pull/106)) (Timothy Gu) + +> It is a Syntax Error if ContainsUseStrict of FunctionBody is true and IsSimpleParameterList of FormalParameters is false. https://tc39.github.io/ecma262/2016/#sec-function-definitions-static-semantics-early-errors + +More Context: [tc39-notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2015-07/july-29.md#611-the-scope-of-use-strict-with-respect-to-destructuring-in-parameter-lists) + +For example: + +```js +// this errors because it uses destructuring and default parameters +// in a function with a "use strict" directive +function a([ option1, option2 ] = []) { + "use strict"; +} + ``` + +The solution would be to use a top level "use strict" or to remove the destructuring or default parameters when using a function + "use strict" or to. + +### New Feature + +* Exact object type annotations for Flow plugin ([#104](https://github.com/babel/babylon/pull/104)) (Basil Hosmer) + +Added to flow in https://github.com/facebook/flow/commit/c710c40aa2a115435098d6c0dfeaadb023cd39b8 + +Looks like: + +```js +var a : {| x: number, y: string |} = { x: 0, y: 'foo' }; +``` + +### Bug Fixes + +* Include `typeParameter` location in `ArrowFunctionExpression` ([#126](https://github.com/babel/babylon/pull/126)) (Daniel Tschinder) +* Error on invalid flow type annotation with default assignment ([#122](https://github.com/babel/babylon/pull/122)) (Dan Harper) +* Fix Flow return types on arrow functions ([#124](https://github.com/babel/babylon/pull/124)) (Dan Harper) + +### Misc + +* Add tests for export extensions ([#127](https://github.com/babel/babylon/pull/127)) (Daniel Tschinder) +* Fix Contributing guidelines [skip ci] (Daniel Tschinder) + +## 6.9.2 (2016-09-09) + +The only change is to remove the `babel-runtime` dependency by compiling with Babel's ES2015 loose mode. So using babylon standalone should be smaller. + +## 6.9.1 (2016-08-23) + +This release contains mainly small bugfixes but also updates babylons default mode to es2017. The features for `exponentiationOperator`, `asyncFunctions` and `trailingFunctionCommas` which previously needed to be activated via plugin are now enabled by default and the plugins are now no-ops. + +### Bug Fixes + +- Fix issues with default object params in async functions ([#96](https://github.com/babel/babylon/pull/96)) @danez +- Fix issues with flow-types and async function ([#95](https://github.com/babel/babylon/pull/95)) @danez +- Fix arrow functions with destructuring, types & default value ([#94](https://github.com/babel/babylon/pull/94)) @danharper +- Fix declare class with qualified type identifier ([#97](https://github.com/babel/babylon/pull/97)) @danez +- Remove exponentiationOperator, asyncFunctions, trailingFunctionCommas plugins and enable them by default ([#98](https://github.com/babel/babylon/pull/98)) @danez + +## 6.9.0 (2016-08-16) + +### New syntax support + +- Add JSX spread children ([#42](https://github.com/babel/babylon/pull/42)) @calebmer + +(Be aware that React is not going to support this syntax) + +```js +
+ {...todos.map(todo => )} +
+``` + +- Add support for declare module.exports ([#72](https://github.com/babel/babylon/pull/72)) @danez + +```js +declare module "foo" { + declare module.exports: {} +} +``` + +### New Features + +- If supplied, attach filename property to comment node loc. ([#80](https://github.com/babel/babylon/pull/80)) @divmain +- Add identifier name to node loc field ([#90](https://github.com/babel/babylon/pull/90)) @kittens + +### Bug Fixes + +- Fix exponential operator to behave according to spec ([#75](https://github.com/babel/babylon/pull/75)) @danez +- Fix lookahead to not add comments to arrays which are not cloned ([#76](https://github.com/babel/babylon/pull/76)) @danez +- Fix accidental fall-through in Flow type parsing. ([#82](https://github.com/babel/babylon/pull/82)) @xiemaisi +- Only allow declares inside declare module ([#73](https://github.com/babel/babylon/pull/73)) @danez +- Small fix for parsing type parameter declarations ([#83](https://github.com/babel/babylon/pull/83)) @gabelevi +- Fix arrow param locations with flow types ([#57](https://github.com/babel/babylon/pull/57)) @danez +- Fixes SyntaxError position with flow optional type ([#65](https://github.com/babel/babylon/pull/65)) @danez + +### Internal + +- Add codecoverage to tests @danez +- Fix tests to not save expected output if we expect the test to fail @danez +- Make a shallow clone of babel for testing @danez +- chore(package): update cross-env to version 2.0.0 ([#77](https://github.com/babel/babylon/pull/77)) @greenkeeperio-bot +- chore(package): update ava to version 0.16.0 ([#86](https://github.com/babel/babylon/pull/86)) @greenkeeperio-bot +- chore(package): update babel-plugin-istanbul to version 2.0.0 ([#89](https://github.com/babel/babylon/pull/89)) @greenkeeperio-bot +- chore(package): update nyc to version 8.0.0 ([#88](https://github.com/babel/babylon/pull/88)) @greenkeeperio-bot + +## 6.8.4 (2016-07-06) + +### Bug Fixes + +- Fix the location of params, when flow and default value used ([#68](https://github.com/babel/babylon/pull/68)) @danez + +## 6.8.3 (2016-07-02) + +### Bug Fixes + +- Fix performance regression introduced in 6.8.2 with conditionals ([#63](https://github.com/babel/babylon/pull/63)) @danez + +## 6.8.2 (2016-06-24) + +### Bug Fixes + +- Fix parse error with yielding jsx elements in generators `function* it() { yield ; }` ([#31](https://github.com/babel/babylon/pull/31)) @eldereal +- When cloning nodes do not clone its comments ([#24](https://github.com/babel/babylon/pull/24)) @danez +- Fix parse errors when using arrow functions with an spread element and return type `(...props): void => {}` ([#10](https://github.com/babel/babylon/pull/10)) @danez +- Fix leading comments added from previous node ([#23](https://github.com/babel/babylon/pull/23)) @danez +- Fix parse errors with flow's optional arguments `(arg?) => {}` ([#19](https://github.com/babel/babylon/pull/19)) @danez +- Support negative numeric type literals @kittens +- Remove line terminator restriction after await keyword @kittens +- Remove grouped type arrow restriction as it seems flow no longer has it @kittens +- Fix parse error with generic methods that have the name `get` or `set` `class foo { get() {} }` ([#55](https://github.com/babel/babylon/pull/55)) @vkurchatkin +- Fix parse error with arrow functions that have flow type parameter declarations `(x: T): T => x;` ([#54](https://github.com/babel/babylon/pull/54)) @gabelevi + +### Documentation + +- Document AST differences from ESTree ([#41](https://github.com/babel/babylon/pull/41)) @nene +- Move ast spec from babel/babel ([#46](https://github.com/babel/babylon/pull/46)) @hzoo + +### Internal + +- Enable skipped tests ([#16](https://github.com/babel/babylon/pull/16)) @danez +- Add script to test latest version of babylon with babel ([#21](https://github.com/babel/babylon/pull/21)) @danez +- Upgrade test runner ava @kittens +- Add missing generate-identifier-regex script @kittens +- Rename parser context types @kittens +- Add node v6 to travis testing @hzoo +- Update to Unicode v9 ([#45](https://github.com/babel/babylon/pull/45)) @mathiasbynens + +## 6.8.1 (2016-06-06) + +### New Feature + +- Parse type parameter declarations with defaults like `type Foo = T` + +### Bug Fixes +- Type parameter declarations need 1 or more type parameters. +- The existential type `*` is not a valid type parameter. +- The existential type `*` is a primary type + +### Spec Compliancy +- The param list for type parameter declarations now consists of `TypeParameter` nodes +- New `TypeParameter` AST Node (replaces using the `Identifier` node before) + +``` +interface TypeParameter <: Node { + bound: TypeAnnotation; + default: TypeAnnotation; + name: string; + variance: "plus" | "minus"; +} +``` + +## 6.8.0 (2016-05-02) + +#### New Feature + +##### Parse Method Parameter Decorators ([#12](https://github.com/babel/babylon/pull/12)) + +> [Method Parameter Decorators](https://goo.gl/8MmCMG) is now a TC39 [stage 0 proposal](https://github.com/tc39/ecma262/blob/master/stage0.md). + +Examples: + +```js +class Foo { + constructor(@foo() x, @bar({ a: 123 }) @baz() y) {} +} + +export default function func(@foo() x, @bar({ a: 123 }) @baz() y) {} + +var obj = { + method(@foo() x, @bar({ a: 123 }) @baz() y) {} +}; +``` + +##### Parse for-await statements (w/ `asyncGenerators` plugin) ([#17](https://github.com/babel/babylon/pull/17)) + +There is also a new node type, `ForAwaitStatement`. + +> [Async generators and for-await](https://github.com/tc39/proposal-async-iteration) are now a [stage 2 proposal](https://github.com/tc39/ecma262#current-proposals). + +Example: + +```js +async function f() { + for await (let x of y); +} +``` diff --git a/node_modules/babylon/LICENSE b/node_modules/babylon/LICENSE new file mode 100644 index 0000000..d4c7fc5 --- /dev/null +++ b/node_modules/babylon/LICENSE @@ -0,0 +1,19 @@ +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/node_modules/babylon/README.md b/node_modules/babylon/README.md new file mode 100644 index 0000000..ad2a8fd --- /dev/null +++ b/node_modules/babylon/README.md @@ -0,0 +1,134 @@ +

+ babylon +

+ +

+ Babylon is a JavaScript parser used in Babel. +

+ +

+ Travis Status + Codecov Status +

+ + - The latest ECMAScript version enabled by default (ES2017). + - Comment attachment. + - Support for JSX and Flow. + - Support for experimental language proposals (accepting PRs for anything at least [stage-0](https://github.com/tc39/proposals/blob/master/stage-0-proposals.md)). + +## Credits + +Heavily based on [acorn](https://github.com/marijnh/acorn) and [acorn-jsx](https://github.com/RReverser/acorn-jsx), +thanks to the awesome work of [@RReverser](https://github.com/RReverser) and [@marijnh](https://github.com/marijnh). + +Significant diversions are expected to occur in the future such as streaming, EBNF definitions, sweet.js integration, interspatial parsing and more. + +## API + +### `babylon.parse(code, [options])` + +### `babylon.parseExpression(code, [options])` + +`parse()` parses the provided `code` as an entire ECMAScript program, while +`parseExpression()` tries to parse a single Expression with performance in +mind. When in doubt, use `.parse()`. + +### Options + +- **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. + +- **allowReturnOutsideFunction**: By default, a return statement at + the top level raises an error. Set this to `true` to accept such + code. + +- **allowSuperOutsideMethod**: TODO + +- **sourceType**: Indicate the mode the code should be parsed in. Can be + either `"script"` or `"module"`. + +- **sourceFilename**: Correlate output AST nodes with their source filename. Useful when generating code and source maps from the ASTs of multiple input files. + +- **startLine**: By default, the first line of code parsed is treated as line 1. You can provide a line number to alternatively start with. Useful for integration with other source tools. + +- **plugins**: Array containing the plugins that you want to enable. + +- **strictMode**: TODO + +### Output + +Babylon generates AST according to [Babel AST format][]. +It is based on [ESTree spec][] with the following deviations: + +> There is now an `estree` plugin which reverts these deviations + +- [Literal][] token is replaced with [StringLiteral][], [NumericLiteral][], [BooleanLiteral][], [NullLiteral][], [RegExpLiteral][] +- [Property][] token is replaced with [ObjectProperty][] and [ObjectMethod][] +- [MethodDefinition][] is replaced with [ClassMethod][] +- [Program][] and [BlockStatement][] contain additional `directives` field with [Directive][] and [DirectiveLiteral][] +- [ClassMethod][], [ObjectProperty][], and [ObjectMethod][] value property's properties in [FunctionExpression][] is coerced/brought into the main method node. + +AST for JSX code is based on [Facebook JSX AST][] with the addition of one node type: + +- `JSXText` + +[Babel AST format]: https://github.com/babel/babylon/blob/master/ast/spec.md +[ESTree spec]: https://github.com/estree/estree + +[Literal]: https://github.com/estree/estree/blob/master/es5.md#literal +[Property]: https://github.com/estree/estree/blob/master/es5.md#property +[MethodDefinition]: https://github.com/estree/estree/blob/master/es2015.md#methoddefinition + +[StringLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#stringliteral +[NumericLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#numericliteral +[BooleanLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#booleanliteral +[NullLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#nullliteral +[RegExpLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#regexpliteral +[ObjectProperty]: https://github.com/babel/babylon/blob/master/ast/spec.md#objectproperty +[ObjectMethod]: https://github.com/babel/babylon/blob/master/ast/spec.md#objectmethod +[ClassMethod]: https://github.com/babel/babylon/blob/master/ast/spec.md#classmethod +[Program]: https://github.com/babel/babylon/blob/master/ast/spec.md#programs +[BlockStatement]: https://github.com/babel/babylon/blob/master/ast/spec.md#blockstatement +[Directive]: https://github.com/babel/babylon/blob/master/ast/spec.md#directive +[DirectiveLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#directiveliteral +[FunctionExpression]: https://github.com/babel/babylon/blob/master/ast/spec.md#functionexpression + +[Facebook JSX AST]: https://github.com/facebook/jsx/blob/master/AST.md + +### Semver + +Babylon follows semver in most situations. The only thing to note is that some spec-compliancy bug fixes may be released under patch versions. + +For example: We push a fix to early error on something like [#107](https://github.com/babel/babylon/pull/107) - multiple default exports per file. That would be considered a bug fix even though it would cause a build to fail. + +### Example + +```javascript +require("babylon").parse("code", { + // parse in strict mode and allow module declarations + sourceType: "module", + + plugins: [ + // enable jsx and flow syntax + "jsx", + "flow" + ] +}); +``` + +### Plugins + + - `estree` + - `jsx` + - `flow` + - `doExpressions` + - `objectRestSpread` + - `decorators` (Based on an outdated version of the Decorators proposal. Will be removed in a future version of `Babylon`) + - `classProperties` + - `exportExtensions` + - `asyncGenerators` + - `functionBind` + - `functionSent` + - `dynamicImport` + - `templateInvalidEscapes` diff --git a/node_modules/babylon/bin/babylon.js b/node_modules/babylon/bin/babylon.js new file mode 100755 index 0000000..449ddfe --- /dev/null +++ b/node_modules/babylon/bin/babylon.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node +/* eslint no-var: 0 */ + +var babylon = require(".."); +var fs = require("fs"); + +var filename = process.argv[2]; +if (!filename) { + console.error("no filename specified"); + process.exit(0); +} + +var file = fs.readFileSync(filename, "utf8"); +var ast = babylon.parse(file); + +console.log(JSON.stringify(ast, null, " ")); diff --git a/node_modules/babylon/bin/generate-identifier-regex.js b/node_modules/babylon/bin/generate-identifier-regex.js new file mode 100644 index 0000000..9b0ae7d --- /dev/null +++ b/node_modules/babylon/bin/generate-identifier-regex.js @@ -0,0 +1,62 @@ +"use strict"; + +// Which Unicode version should be used? +const version = "9.0.0"; + +const start = require("unicode-" + version + "/Binary_Property/ID_Start/code-points.js") + .filter(function(ch) { return ch > 0x7f; }); +let last = -1; +const cont = [0x200c, 0x200d].concat( + require("unicode-" + version + "/Binary_Property/ID_Continue/code-points.js") + .filter(function(ch) { + return ch > 0x7f && search(start, ch, last + 1) == -1; + }) + ); + +function search(arr, ch, starting) { + for (let i = starting; arr[i] <= ch && i < arr.length; last = i++) + if (arr[i] === ch) + return i; + return -1; +} + +function pad(str, width) { + while (str.length < width) str = "0" + str; + return str; +} + +function esc(code) { + const hex = code.toString(16); + if (hex.length <= 2) return "\\x" + pad(hex, 2); + else return "\\u" + pad(hex, 4); +} + +function generate(chars) { + const astral = []; + let re = ""; + for (let i = 0, at = 0x10000; i < chars.length; i++) { + const from = chars[i]; + let 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 }; +} + +const startData = generate(start); +const contData = generate(cont); + +console.log("let nonASCIIidentifierStartChars = \"" + startData.nonASCII + "\";"); +console.log("let nonASCIIidentifierChars = \"" + contData.nonASCII + "\";"); +console.log("const astralIdentifierStartCodes = " + JSON.stringify(startData.astral) + ";"); +console.log("const astralIdentifierCodes = " + JSON.stringify(contData.astral) + ";"); diff --git a/node_modules/babylon/lib/index.js b/node_modules/babylon/lib/index.js new file mode 100644 index 0000000..a914ac5 --- /dev/null +++ b/node_modules/babylon/lib/index.js @@ -0,0 +1,7318 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +/* eslint max-len: 0 */ + +// 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(" "); + return function (str) { + return words.indexOf(str) >= 0; + }; +} + +// Reserved word lists for various dialects of the language + +var reservedWords = { + 6: makePredicate("enum await"), + strict: makePredicate("implements interface let package private protected public static yield"), + strictBind: makePredicate("eval arguments") +}; + +// And the keywords + +var isKeyword = makePredicate("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 let const class extends export import yield super"); + +// ## 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 `bin/generate-identifier-regex.js`. + +var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC"; +var nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F"; + +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 `bin/generate-identifier-regex.js`. +// eslint-disable-next-line comma-spacing +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, 19, 35, 5, 35, 5, 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, 66, 18, 2, 1, 11, 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, 56, 50, 14, 50, 785, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 54, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 86, 25, 391, 63, 32, 0, 449, 56, 264, 8, 2, 36, 18, 0, 50, 29, 881, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 65, 0, 32, 6124, 20, 754, 9486, 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, 60, 67, 1213, 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, 3, 5761, 10591, 541]; +// eslint-disable-next-line comma-spacing +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, 10, 2, 4, 9, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 87, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 423, 9, 838, 7, 2, 7, 17, 9, 57, 21, 2, 13, 19882, 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, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 2214, 6, 110, 6, 6, 9, 792487, 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 = 0x10000; + 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; + } +} + +// Test whether a given character code starts an identifier. + +function isIdentifierStart(code) { + if (code < 65) return code === 36; + if (code < 91) return true; + if (code < 97) return code === 95; + if (code < 123) return true; + if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); + return isInAstralSet(code, astralIdentifierStartCodes); +} + +// Test whether a given character is part of an identifier. + +function isIdentifierChar(code) { + 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 <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); + return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); +} + +// A second optional argument can be given to further configure +var defaultOptions = { + // Source type ("script" or "module") for different semantics + sourceType: "script", + // Source filename. + sourceFilename: undefined, + // Line from which to start counting source. Useful for + // integration with other tools. + startLine: 1, + // 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, + // TODO + allowSuperOutsideMethod: false, + // An array of plugins to enable + plugins: [], + // TODO + strictMode: null +}; + +// Interpret and default an options object + +function getOptions(opts) { + var options = {}; + for (var key in defaultOptions) { + options[key] = opts && key in opts ? opts[key] : defaultOptions[key]; + } + return options; +} + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; +} : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; +}; + + + + + + + + + + + +var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; + + + + + + + + + + + +var inherits = function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; +}; + + + + + + + + + + + +var possibleConstructorReturn = function (self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return call && (typeof call === "object" || typeof call === "function") ? call : self; +}; + +// ## Token types + +// The assignment of fine-grained, information-carrying type objects +// allows the tokenizer to store the information it has about a +// token in a way that is very cheap for the parser to look up. + +// All token type variables start with an underscore, to make them +// easy to recognize. + +// The `beforeExpr` property is used to disambiguate between regular +// expressions and divisions. It is set on all token types that can +// be followed by an expression (thus, a slash after them would be a +// regular expression). +// +// `isLoop` marks a keyword as starting a loop, which is important +// to know when parsing a label, in order to allow or disallow +// continue jumps to that label. + +var beforeExpr = true; +var startsExpr = true; +var isLoop = true; +var isAssign = true; +var prefix = true; +var postfix = true; + +var TokenType = function TokenType(label) { + var conf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + classCallCheck(this, TokenType); + + this.label = label; + this.keyword = conf.keyword; + this.beforeExpr = !!conf.beforeExpr; + this.startsExpr = !!conf.startsExpr; + this.rightAssociative = !!conf.rightAssociative; + this.isLoop = !!conf.isLoop; + this.isAssign = !!conf.isAssign; + this.prefix = !!conf.prefix; + this.postfix = !!conf.postfix; + this.binop = conf.binop || null; + this.updateContext = null; +}; + +var KeywordTokenType = function (_TokenType) { + inherits(KeywordTokenType, _TokenType); + + function KeywordTokenType(name) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + classCallCheck(this, KeywordTokenType); + + options.keyword = name; + + return possibleConstructorReturn(this, _TokenType.call(this, name, options)); + } + + return KeywordTokenType; +}(TokenType); + +var BinopTokenType = function (_TokenType2) { + inherits(BinopTokenType, _TokenType2); + + function BinopTokenType(name, prec) { + classCallCheck(this, BinopTokenType); + return possibleConstructorReturn(this, _TokenType2.call(this, name, { beforeExpr: beforeExpr, binop: prec })); + } + + return BinopTokenType; +}(TokenType); + +var types = { + num: new TokenType("num", { startsExpr: startsExpr }), + regexp: new TokenType("regexp", { startsExpr: startsExpr }), + string: new TokenType("string", { startsExpr: startsExpr }), + name: new TokenType("name", { startsExpr: startsExpr }), + eof: new TokenType("eof"), + + // Punctuation token types. + bracketL: new TokenType("[", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + bracketR: new TokenType("]"), + braceL: new TokenType("{", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + braceBarL: new TokenType("{|", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + braceR: new TokenType("}"), + braceBarR: new TokenType("|}"), + parenL: new TokenType("(", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + parenR: new TokenType(")"), + comma: new TokenType(",", { beforeExpr: beforeExpr }), + semi: new TokenType(";", { beforeExpr: beforeExpr }), + colon: new TokenType(":", { beforeExpr: beforeExpr }), + doubleColon: new TokenType("::", { beforeExpr: beforeExpr }), + dot: new TokenType("."), + question: new TokenType("?", { beforeExpr: beforeExpr }), + arrow: new TokenType("=>", { beforeExpr: beforeExpr }), + template: new TokenType("template"), + ellipsis: new TokenType("...", { beforeExpr: beforeExpr }), + backQuote: new TokenType("`", { startsExpr: startsExpr }), + dollarBraceL: new TokenType("${", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + at: new TokenType("@"), + + // Operators. These carry several kinds of properties to help the + // parser use them properly (the presence of these properties is + // what categorizes them as operators). + // + // `binop`, when present, specifies that this operator is a binary + // operator, and will refer to its precedence. + // + // `prefix` and `postfix` mark the operator as a prefix or postfix + // unary operator. + // + // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as + // binary operators with a very low precedence, that should result + // in AssignmentExpression nodes. + + eq: new TokenType("=", { beforeExpr: beforeExpr, isAssign: isAssign }), + assign: new TokenType("_=", { beforeExpr: beforeExpr, isAssign: isAssign }), + incDec: new TokenType("++/--", { prefix: prefix, postfix: postfix, startsExpr: startsExpr }), + prefix: new TokenType("prefix", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }), + logicalOR: new BinopTokenType("||", 1), + logicalAND: new BinopTokenType("&&", 2), + bitwiseOR: new BinopTokenType("|", 3), + bitwiseXOR: new BinopTokenType("^", 4), + bitwiseAND: new BinopTokenType("&", 5), + equality: new BinopTokenType("==/!=", 6), + relational: new BinopTokenType("", 7), + bitShift: new BinopTokenType("<>", 8), + plusMin: new TokenType("+/-", { beforeExpr: beforeExpr, binop: 9, prefix: prefix, startsExpr: startsExpr }), + modulo: new BinopTokenType("%", 10), + star: new BinopTokenType("*", 10), + slash: new BinopTokenType("/", 10), + exponent: new TokenType("**", { beforeExpr: beforeExpr, binop: 11, rightAssociative: true }) +}; + +var keywords = { + "break": new KeywordTokenType("break"), + "case": new KeywordTokenType("case", { beforeExpr: beforeExpr }), + "catch": new KeywordTokenType("catch"), + "continue": new KeywordTokenType("continue"), + "debugger": new KeywordTokenType("debugger"), + "default": new KeywordTokenType("default", { beforeExpr: beforeExpr }), + "do": new KeywordTokenType("do", { isLoop: isLoop, beforeExpr: beforeExpr }), + "else": new KeywordTokenType("else", { beforeExpr: beforeExpr }), + "finally": new KeywordTokenType("finally"), + "for": new KeywordTokenType("for", { isLoop: isLoop }), + "function": new KeywordTokenType("function", { startsExpr: startsExpr }), + "if": new KeywordTokenType("if"), + "return": new KeywordTokenType("return", { beforeExpr: beforeExpr }), + "switch": new KeywordTokenType("switch"), + "throw": new KeywordTokenType("throw", { beforeExpr: beforeExpr }), + "try": new KeywordTokenType("try"), + "var": new KeywordTokenType("var"), + "let": new KeywordTokenType("let"), + "const": new KeywordTokenType("const"), + "while": new KeywordTokenType("while", { isLoop: isLoop }), + "with": new KeywordTokenType("with"), + "new": new KeywordTokenType("new", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + "this": new KeywordTokenType("this", { startsExpr: startsExpr }), + "super": new KeywordTokenType("super", { startsExpr: startsExpr }), + "class": new KeywordTokenType("class"), + "extends": new KeywordTokenType("extends", { beforeExpr: beforeExpr }), + "export": new KeywordTokenType("export"), + "import": new KeywordTokenType("import", { startsExpr: startsExpr }), + "yield": new KeywordTokenType("yield", { beforeExpr: beforeExpr, startsExpr: startsExpr }), + "null": new KeywordTokenType("null", { startsExpr: startsExpr }), + "true": new KeywordTokenType("true", { startsExpr: startsExpr }), + "false": new KeywordTokenType("false", { startsExpr: startsExpr }), + "in": new KeywordTokenType("in", { beforeExpr: beforeExpr, binop: 7 }), + "instanceof": new KeywordTokenType("instanceof", { beforeExpr: beforeExpr, binop: 7 }), + "typeof": new KeywordTokenType("typeof", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }), + "void": new KeywordTokenType("void", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }), + "delete": new KeywordTokenType("delete", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }) +}; + +// Map keyword names to token types. +Object.keys(keywords).forEach(function (name) { + types["_" + name] = keywords[name]; +}); + +// Matches a whole line break (where CRLF is considered a single +// line break). Used to count lines. + +var lineBreak = /\r\n?|\n|\u2028|\u2029/; +var lineBreakG = new RegExp(lineBreak.source, "g"); + +function isNewLine(code) { + return code === 10 || code === 13 || code === 0x2028 || code === 0x2029; +} + +var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/; + +// 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 TokContext = function TokContext(token, isExpr, preserveSpace, override) { + classCallCheck(this, TokContext); + + this.token = token; + this.isExpr = !!isExpr; + this.preserveSpace = !!preserveSpace; + this.override = override; +}; + +var types$1 = { + braceStatement: new TokContext("{", false), + braceExpression: new TokContext("{", true), + templateQuasi: new TokContext("${", true), + parenStatement: new TokContext("(", false), + parenExpression: new TokContext("(", true), + template: new TokContext("`", true, true, function (p) { + return p.readTmplToken(); + }), + functionExpression: new TokContext("function", true) +}; + +// Token-specific context update code + +types.parenR.updateContext = types.braceR.updateContext = function () { + if (this.state.context.length === 1) { + this.state.exprAllowed = true; + return; + } + + var out = this.state.context.pop(); + if (out === types$1.braceStatement && this.curContext() === types$1.functionExpression) { + this.state.context.pop(); + this.state.exprAllowed = false; + } else if (out === types$1.templateQuasi) { + this.state.exprAllowed = true; + } else { + this.state.exprAllowed = !out.isExpr; + } +}; + +types.name.updateContext = function (prevType) { + this.state.exprAllowed = false; + + if (prevType === types._let || prevType === types._const || prevType === types._var) { + if (lineBreak.test(this.input.slice(this.state.end))) { + this.state.exprAllowed = true; + } + } +}; + +types.braceL.updateContext = function (prevType) { + this.state.context.push(this.braceIsBlock(prevType) ? types$1.braceStatement : types$1.braceExpression); + this.state.exprAllowed = true; +}; + +types.dollarBraceL.updateContext = function () { + this.state.context.push(types$1.templateQuasi); + this.state.exprAllowed = true; +}; + +types.parenL.updateContext = function (prevType) { + var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while; + this.state.context.push(statementParens ? types$1.parenStatement : types$1.parenExpression); + this.state.exprAllowed = true; +}; + +types.incDec.updateContext = function () { + // tokExprAllowed stays unchanged +}; + +types._function.updateContext = function () { + if (this.curContext() !== types$1.braceStatement) { + this.state.context.push(types$1.functionExpression); + } + + this.state.exprAllowed = false; +}; + +types.backQuote.updateContext = function () { + if (this.curContext() === types$1.template) { + this.state.context.pop(); + } else { + this.state.context.push(types$1.template); + } + this.state.exprAllowed = false; +}; + +// These are used when `options.locations` is on, for the +// `startLoc` and `endLoc` properties. + +var Position = function Position(line, col) { + classCallCheck(this, Position); + + this.line = line; + this.column = col; +}; + +var SourceLocation = function SourceLocation(start, end) { + classCallCheck(this, SourceLocation); + + this.start = start; + this.end = end; +}; + +// 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. + +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 State = function () { + function State() { + classCallCheck(this, State); + } + + State.prototype.init = function init(options, input) { + this.strict = options.strictMode === false ? false : options.sourceType === "module"; + + this.input = input; + + this.potentialArrowAt = -1; + + this.inMethod = this.inFunction = this.inGenerator = this.inAsync = this.inPropertyName = this.inType = this.inClassProperty = this.noAnonFunctionType = false; + + this.labels = []; + + this.decorators = []; + + this.tokens = []; + + this.comments = []; + + this.trailingComments = []; + this.leadingComments = []; + this.commentStack = []; + + this.pos = this.lineStart = 0; + this.curLine = options.startLine; + + this.type = types.eof; + this.value = null; + this.start = this.end = this.pos; + this.startLoc = this.endLoc = this.curPosition(); + + this.lastTokEndLoc = this.lastTokStartLoc = null; + this.lastTokStart = this.lastTokEnd = this.pos; + + this.context = [types$1.braceStatement]; + this.exprAllowed = true; + + this.containsEsc = this.containsOctal = false; + this.octalPosition = null; + + this.invalidTemplateEscapePosition = null; + + this.exportedIdentifiers = []; + + return this; + }; + + // TODO + + + // TODO + + + // Used to signify the start of a potential arrow function + + + // Flags to track whether we are in a function, a generator. + + + // Labels in scope. + + + // Leading decorators. + + + // Token store. + + + // Comment store. + + + // Comment attachment store + + + // The current position of the tokenizer in the input. + + + // Properties of the current token: + // Its type + + + // For tokens that include more information than their type, the value + + + // Its start and end offset + + + // And, if locations are used, the {line, column} object + // corresponding to those offsets + + + // Position information for the previous token + + + // The context stack is used to superficially track syntactic + // context to predict whether a regular expression is allowed in a + // given position. + + + // Used to signal to callers of `readWord1` whether the word + // contained any escape sequences. This is needed because words with + // escape sequences must not be interpreted as keywords. + + + // TODO + + + // Names of exports store. `default` is stored as a name for both + // `export default foo;` and `export { foo as default };`. + + + State.prototype.curPosition = function curPosition() { + return new Position(this.curLine, this.pos - this.lineStart); + }; + + State.prototype.clone = function clone(skipArrays) { + var state = new State(); + for (var key in this) { + var val = this[key]; + + if ((!skipArrays || key === "context") && Array.isArray(val)) { + val = val.slice(); + } + + state[key] = val; + } + return state; + }; + + return State; +}(); + +// 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 = function Token(state) { + classCallCheck(this, Token); + + this.type = state.type; + this.value = state.value; + this.start = state.start; + this.end = state.end; + this.loc = new SourceLocation(state.startLoc, state.endLoc); +}; + +// ## Tokenizer + +function codePointToString(code) { + // UTF-16 Decoding + if (code <= 0xFFFF) { + return String.fromCharCode(code); + } else { + return String.fromCharCode((code - 0x10000 >> 10) + 0xD800, (code - 0x10000 & 1023) + 0xDC00); + } +} + +var Tokenizer = function () { + function Tokenizer(options, input) { + classCallCheck(this, Tokenizer); + + this.state = new State(); + this.state.init(options, input); + } + + // Move to the next token + + Tokenizer.prototype.next = function next() { + if (!this.isLookahead) { + this.state.tokens.push(new Token(this.state)); + } + + this.state.lastTokEnd = this.state.end; + this.state.lastTokStart = this.state.start; + this.state.lastTokEndLoc = this.state.endLoc; + this.state.lastTokStartLoc = this.state.startLoc; + this.nextToken(); + }; + + // TODO + + Tokenizer.prototype.eat = function eat(type) { + if (this.match(type)) { + this.next(); + return true; + } else { + return false; + } + }; + + // TODO + + Tokenizer.prototype.match = function match(type) { + return this.state.type === type; + }; + + // TODO + + Tokenizer.prototype.isKeyword = function isKeyword$$1(word) { + return isKeyword(word); + }; + + // TODO + + Tokenizer.prototype.lookahead = function lookahead() { + var old = this.state; + this.state = old.clone(true); + + this.isLookahead = true; + this.next(); + this.isLookahead = false; + + var curr = this.state.clone(true); + this.state = old; + return curr; + }; + + // Toggle strict mode. Re-reads the next number or string to please + // pedantic tests (`"use strict"; 010;` should fail). + + Tokenizer.prototype.setStrict = function setStrict(strict) { + this.state.strict = strict; + if (!this.match(types.num) && !this.match(types.string)) return; + this.state.pos = this.state.start; + while (this.state.pos < this.state.lineStart) { + this.state.lineStart = this.input.lastIndexOf("\n", this.state.lineStart - 2) + 1; + --this.state.curLine; + } + this.nextToken(); + }; + + Tokenizer.prototype.curContext = function curContext() { + return this.state.context[this.state.context.length - 1]; + }; + + // Read a single token, updating the parser object's token-related + // properties. + + Tokenizer.prototype.nextToken = function nextToken() { + var curContext = this.curContext(); + if (!curContext || !curContext.preserveSpace) this.skipSpace(); + + this.state.containsOctal = false; + this.state.octalPosition = null; + this.state.start = this.state.pos; + this.state.startLoc = this.state.curPosition(); + if (this.state.pos >= this.input.length) return this.finishToken(types.eof); + + if (curContext.override) { + return curContext.override(this); + } else { + return this.readToken(this.fullCharCodeAtPos()); + } + }; + + Tokenizer.prototype.readToken = function readToken(code) { + // Identifier or keyword. '\uXXXX' sequences are allowed in + // identifiers, so '\' also dispatches to that. + if (isIdentifierStart(code) || code === 92 /* '\' */) { + return this.readWord(); + } else { + return this.getTokenFromCode(code); + } + }; + + Tokenizer.prototype.fullCharCodeAtPos = function fullCharCodeAtPos() { + var code = this.input.charCodeAt(this.state.pos); + if (code <= 0xd7ff || code >= 0xe000) return code; + + var next = this.input.charCodeAt(this.state.pos + 1); + return (code << 10) + next - 0x35fdc00; + }; + + Tokenizer.prototype.pushComment = function pushComment(block, text, start, end, startLoc, endLoc) { + var comment = { + type: block ? "CommentBlock" : "CommentLine", + value: text, + start: start, + end: end, + loc: new SourceLocation(startLoc, endLoc) + }; + + if (!this.isLookahead) { + this.state.tokens.push(comment); + this.state.comments.push(comment); + this.addComment(comment); + } + }; + + Tokenizer.prototype.skipBlockComment = function skipBlockComment() { + var startLoc = this.state.curPosition(); + var start = this.state.pos; + var end = this.input.indexOf("*/", this.state.pos += 2); + if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment"); + + this.state.pos = end + 2; + lineBreakG.lastIndex = start; + var match = void 0; + while ((match = lineBreakG.exec(this.input)) && match.index < this.state.pos) { + ++this.state.curLine; + this.state.lineStart = match.index + match[0].length; + } + + this.pushComment(true, this.input.slice(start + 2, end), start, this.state.pos, startLoc, this.state.curPosition()); + }; + + Tokenizer.prototype.skipLineComment = function skipLineComment(startSkip) { + var start = this.state.pos; + var startLoc = this.state.curPosition(); + var ch = this.input.charCodeAt(this.state.pos += startSkip); + while (this.state.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) { + ++this.state.pos; + ch = this.input.charCodeAt(this.state.pos); + } + + this.pushComment(false, this.input.slice(start + startSkip, this.state.pos), start, this.state.pos, startLoc, this.state.curPosition()); + }; + + // Called at the start of the parse and after every token. Skips + // whitespace and comments, and. + + Tokenizer.prototype.skipSpace = function skipSpace() { + loop: while (this.state.pos < this.input.length) { + var ch = this.input.charCodeAt(this.state.pos); + switch (ch) { + case 32:case 160: + // ' ' + ++this.state.pos; + break; + + case 13: + if (this.input.charCodeAt(this.state.pos + 1) === 10) { + ++this.state.pos; + } + + case 10:case 8232:case 8233: + ++this.state.pos; + ++this.state.curLine; + this.state.lineStart = this.state.pos; + break; + + case 47: + // '/' + switch (this.input.charCodeAt(this.state.pos + 1)) { + case 42: + // '*' + this.skipBlockComment(); + break; + + case 47: + this.skipLineComment(2); + break; + + default: + break loop; + } + break; + + default: + if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { + ++this.state.pos; + } else { + break loop; + } + } + } + }; + + // 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. + + Tokenizer.prototype.finishToken = function finishToken(type, val) { + this.state.end = this.state.pos; + this.state.endLoc = this.state.curPosition(); + var prevType = this.state.type; + this.state.type = type; + this.state.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. + // + + + Tokenizer.prototype.readToken_dot = function readToken_dot() { + var next = this.input.charCodeAt(this.state.pos + 1); + if (next >= 48 && next <= 57) { + return this.readNumber(true); + } + + var next2 = this.input.charCodeAt(this.state.pos + 2); + if (next === 46 && next2 === 46) { + // 46 = dot '.' + this.state.pos += 3; + return this.finishToken(types.ellipsis); + } else { + ++this.state.pos; + return this.finishToken(types.dot); + } + }; + + Tokenizer.prototype.readToken_slash = function readToken_slash() { + // '/' + if (this.state.exprAllowed) { + ++this.state.pos; + return this.readRegexp(); + } + + var next = this.input.charCodeAt(this.state.pos + 1); + if (next === 61) { + return this.finishOp(types.assign, 2); + } else { + return this.finishOp(types.slash, 1); + } + }; + + Tokenizer.prototype.readToken_mult_modulo = function readToken_mult_modulo(code) { + // '%*' + var type = code === 42 ? types.star : types.modulo; + var width = 1; + var next = this.input.charCodeAt(this.state.pos + 1); + + if (next === 42) { + // '*' + width++; + next = this.input.charCodeAt(this.state.pos + 2); + type = types.exponent; + } + + if (next === 61) { + width++; + type = types.assign; + } + + return this.finishOp(type, width); + }; + + Tokenizer.prototype.readToken_pipe_amp = function readToken_pipe_amp(code) { + // '|&' + var next = this.input.charCodeAt(this.state.pos + 1); + if (next === code) return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2); + if (next === 61) return this.finishOp(types.assign, 2); + if (code === 124 && next === 125 && this.hasPlugin("flow")) return this.finishOp(types.braceBarR, 2); + return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1); + }; + + Tokenizer.prototype.readToken_caret = function readToken_caret() { + // '^' + var next = this.input.charCodeAt(this.state.pos + 1); + if (next === 61) { + return this.finishOp(types.assign, 2); + } else { + return this.finishOp(types.bitwiseXOR, 1); + } + }; + + Tokenizer.prototype.readToken_plus_min = function readToken_plus_min(code) { + // '+-' + var next = this.input.charCodeAt(this.state.pos + 1); + + if (next === code) { + if (next === 45 && this.input.charCodeAt(this.state.pos + 2) === 62 && lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.pos))) { + // A `-->` line comment + this.skipLineComment(3); + this.skipSpace(); + return this.nextToken(); + } + return this.finishOp(types.incDec, 2); + } + + if (next === 61) { + return this.finishOp(types.assign, 2); + } else { + return this.finishOp(types.plusMin, 1); + } + }; + + Tokenizer.prototype.readToken_lt_gt = function readToken_lt_gt(code) { + // '<>' + var next = this.input.charCodeAt(this.state.pos + 1); + var size = 1; + + if (next === code) { + size = code === 62 && this.input.charCodeAt(this.state.pos + 2) === 62 ? 3 : 2; + if (this.input.charCodeAt(this.state.pos + size) === 61) return this.finishOp(types.assign, size + 1); + return this.finishOp(types.bitShift, size); + } + + if (next === 33 && code === 60 && this.input.charCodeAt(this.state.pos + 2) === 45 && this.input.charCodeAt(this.state.pos + 3) === 45) { + if (this.inModule) this.unexpected(); + // ` + +```js +var auth = require('basic-auth') +``` + +### auth(req) + +Get the basic auth credentials from the given request. The `Authorization` +header is parsed and if the header is invalid, `undefined` is returned, +otherwise an object with `name` and `pass` properties. + +### auth.parse(string) + +Parse a basic auth authorization header string. This will return an object +with `name` and `pass` properties, or `undefined` if the string is invalid. + +## Example + +Pass a Node.js request object to the module export. If parsing fails +`undefined` is returned, otherwise an object with `.name` and `.pass`. + + + +```js +var auth = require('basic-auth') +var user = auth(req) +// => { name: 'something', pass: 'whatever' } +``` + +A header string from any other location can also be parsed with +`auth.parse`, for example a `Proxy-Authorization` header: + + + +```js +var auth = require('basic-auth') +var user = auth.parse(req.getHeader('Proxy-Authorization')) +``` + +### With vanilla node.js http server + +```js +var http = require('http') +var auth = require('basic-auth') + +// Create server +var server = http.createServer(function (req, res) { + var credentials = auth(req) + + if (!credentials || credentials.name !== 'john' || credentials.pass !== 'secret') { + res.statusCode = 401 + res.setHeader('WWW-Authenticate', 'Basic realm="example"') + res.end('Access denied') + } else { + res.end('Access granted') + } +}) + +// Listen +server.listen(3000) +``` + +# License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/basic-auth.svg +[npm-url]: https://npmjs.org/package/basic-auth +[node-version-image]: https://img.shields.io/node/v/basic-auth.svg +[node-version-url]: https://nodejs.org/en/download +[travis-image]: https://img.shields.io/travis/jshttp/basic-auth/master.svg +[travis-url]: https://travis-ci.org/jshttp/basic-auth +[coveralls-image]: https://img.shields.io/coveralls/jshttp/basic-auth/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/basic-auth?branch=master +[downloads-image]: https://img.shields.io/npm/dm/basic-auth.svg +[downloads-url]: https://npmjs.org/package/basic-auth diff --git a/node_modules/basic-auth/index.js b/node_modules/basic-auth/index.js new file mode 100644 index 0000000..9106e64 --- /dev/null +++ b/node_modules/basic-auth/index.js @@ -0,0 +1,133 @@ +/*! + * basic-auth + * Copyright(c) 2013 TJ Holowaychuk + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015-2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var Buffer = require('safe-buffer').Buffer + +/** + * Module exports. + * @public + */ + +module.exports = auth +module.exports.parse = parse + +/** + * RegExp for basic auth credentials + * + * credentials = auth-scheme 1*SP token68 + * auth-scheme = "Basic" ; case insensitive + * token68 = 1*( ALPHA / DIGIT / "-" / "." / "_" / "~" / "+" / "/" ) *"=" + * @private + */ + +var CREDENTIALS_REGEXP = /^ *(?:[Bb][Aa][Ss][Ii][Cc]) +([A-Za-z0-9._~+/-]+=*) *$/ + +/** + * RegExp for basic auth user/pass + * + * user-pass = userid ":" password + * userid = * + * password = *TEXT + * @private + */ + +var USER_PASS_REGEXP = /^([^:]*):(.*)$/ + +/** + * Parse the Authorization header field of a request. + * + * @param {object} req + * @return {object} with .name and .pass + * @public + */ + +function auth (req) { + if (!req) { + throw new TypeError('argument req is required') + } + + if (typeof req !== 'object') { + throw new TypeError('argument req is required to be an object') + } + + // get header + var header = getAuthorization(req) + + // parse header + return parse(header) +} + +/** + * Decode base64 string. + * @private + */ + +function decodeBase64 (str) { + return Buffer.from(str, 'base64').toString() +} + +/** + * Get the Authorization header from request object. + * @private + */ + +function getAuthorization (req) { + if (!req.headers || typeof req.headers !== 'object') { + throw new TypeError('argument req is required to have headers property') + } + + return req.headers.authorization +} + +/** + * Parse basic auth to object. + * + * @param {string} string + * @return {object} + * @public + */ + +function parse (string) { + if (typeof string !== 'string') { + return undefined + } + + // parse header + var match = CREDENTIALS_REGEXP.exec(string) + + if (!match) { + return undefined + } + + // decode user pass + var userPass = USER_PASS_REGEXP.exec(decodeBase64(match[1])) + + if (!userPass) { + return undefined + } + + // return credentials object + return new Credentials(userPass[1], userPass[2]) +} + +/** + * Object to represent user credentials. + * @private + */ + +function Credentials (name, pass) { + this.name = name + this.pass = pass +} diff --git a/node_modules/basic-auth/package.json b/node_modules/basic-auth/package.json new file mode 100644 index 0000000..884a912 --- /dev/null +++ b/node_modules/basic-auth/package.json @@ -0,0 +1,73 @@ +{ + "_from": "basic-auth@~2.0.0", + "_id": "basic-auth@2.0.0", + "_inBundle": false, + "_integrity": "sha1-AV2z81PgLlY3d1X5YnQuiYHnu7o=", + "_location": "/basic-auth", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "basic-auth@~2.0.0", + "name": "basic-auth", + "escapedName": "basic-auth", + "rawSpec": "~2.0.0", + "saveSpec": null, + "fetchSpec": "~2.0.0" + }, + "_requiredBy": [ + "/morgan" + ], + "_resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.0.tgz", + "_shasum": "015db3f353e02e56377755f962742e8981e7bbba", + "_spec": "basic-auth@~2.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/morgan", + "bugs": { + "url": "https://github.com/jshttp/basic-auth/issues" + }, + "bundleDependencies": false, + "dependencies": { + "safe-buffer": "5.1.1" + }, + "deprecated": false, + "description": "node.js basic auth parser", + "devDependencies": { + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.7.0", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-node": "5.1.1", + "eslint-plugin-promise": "3.5.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "mocha": "2.5.3" + }, + "engines": { + "node": ">= 0.8" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "index.js" + ], + "homepage": "https://github.com/jshttp/basic-auth#readme", + "keywords": [ + "basic", + "auth", + "authorization", + "basicauth" + ], + "license": "MIT", + "name": "basic-auth", + "repository": { + "type": "git", + "url": "git+https://github.com/jshttp/basic-auth.git" + }, + "scripts": { + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --check-leaks --reporter spec --bail", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + }, + "version": "2.0.0" +} diff --git a/node_modules/binary-extensions/binary-extensions.json b/node_modules/binary-extensions/binary-extensions.json new file mode 100644 index 0000000..0126061 --- /dev/null +++ b/node_modules/binary-extensions/binary-extensions.json @@ -0,0 +1,246 @@ +[ + "3ds", + "3g2", + "3gp", + "7z", + "a", + "aac", + "adp", + "ai", + "aif", + "aiff", + "alz", + "ape", + "apk", + "ar", + "arj", + "asf", + "au", + "avi", + "bak", + "baml", + "bh", + "bin", + "bk", + "bmp", + "btif", + "bz2", + "bzip2", + "cab", + "caf", + "cgm", + "class", + "cmx", + "cpio", + "cr2", + "csv", + "cur", + "dat", + "dcm", + "deb", + "dex", + "djvu", + "dll", + "dmg", + "dng", + "doc", + "docm", + "docx", + "dot", + "dotm", + "dra", + "DS_Store", + "dsk", + "dts", + "dtshd", + "dvb", + "dwg", + "dxf", + "ecelp4800", + "ecelp7470", + "ecelp9600", + "egg", + "eol", + "eot", + "epub", + "exe", + "f4v", + "fbs", + "fh", + "fla", + "flac", + "fli", + "flv", + "fpx", + "fst", + "fvt", + "g3", + "gif", + "graffle", + "gz", + "gzip", + "h261", + "h263", + "h264", + "icns", + "ico", + "ief", + "img", + "ipa", + "iso", + "jar", + "jpeg", + "jpg", + "jpgv", + "jpm", + "jxr", + "key", + "ktx", + "lha", + "lib", + "lvp", + "lz", + "lzh", + "lzma", + "lzo", + "m3u", + "m4a", + "m4v", + "mar", + "mdi", + "mht", + "mid", + "midi", + "mj2", + "mka", + "mkv", + "mmr", + "mng", + "mobi", + "mov", + "movie", + "mp3", + "mp4", + "mp4a", + "mpeg", + "mpg", + "mpga", + "mxu", + "nef", + "npx", + "numbers", + "o", + "oga", + "ogg", + "ogv", + "otf", + "pages", + "pbm", + "pcx", + "pdb", + "pdf", + "pea", + "pgm", + "pic", + "png", + "pnm", + "pot", + "potm", + "potx", + "ppa", + "ppam", + "ppm", + "pps", + "ppsm", + "ppsx", + "ppt", + "pptm", + "pptx", + "psd", + "pya", + "pyc", + "pyo", + "pyv", + "qt", + "rar", + "ras", + "raw", + "resources", + "rgb", + "rip", + "rlc", + "rmf", + "rmvb", + "rtf", + "rz", + "s3m", + "s7z", + "scpt", + "sgi", + "shar", + "sil", + "sketch", + "slk", + "smv", + "so", + "sub", + "swf", + "tar", + "tbz", + "tbz2", + "tga", + "tgz", + "thmx", + "tif", + "tiff", + "tlz", + "ttc", + "ttf", + "txz", + "udf", + "uvh", + "uvi", + "uvm", + "uvp", + "uvs", + "uvu", + "viv", + "vob", + "war", + "wav", + "wax", + "wbmp", + "wdp", + "weba", + "webm", + "webp", + "whl", + "wim", + "wm", + "wma", + "wmv", + "wmx", + "woff", + "woff2", + "wvx", + "xbm", + "xif", + "xla", + "xlam", + "xls", + "xlsb", + "xlsm", + "xlsx", + "xlt", + "xltm", + "xltx", + "xm", + "xmind", + "xpi", + "xpm", + "xwd", + "xz", + "z", + "zip", + "zipx" +] diff --git a/node_modules/binary-extensions/license b/node_modules/binary-extensions/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/binary-extensions/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/binary-extensions/package.json b/node_modules/binary-extensions/package.json new file mode 100644 index 0000000..df859ab --- /dev/null +++ b/node_modules/binary-extensions/package.json @@ -0,0 +1,68 @@ +{ + "_from": "binary-extensions@^1.0.0", + "_id": "binary-extensions@1.11.0", + "_inBundle": false, + "_integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=", + "_location": "/binary-extensions", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "binary-extensions@^1.0.0", + "name": "binary-extensions", + "escapedName": "binary-extensions", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/is-binary-path" + ], + "_resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", + "_shasum": "46aa1751fb6a2f93ee5e689bb1087d4b14c6c205", + "_spec": "binary-extensions@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/is-binary-path", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/binary-extensions/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "List of binary file extensions", + "devDependencies": { + "ava": "0.16.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "binary-extensions.json" + ], + "homepage": "https://github.com/sindresorhus/binary-extensions#readme", + "keywords": [ + "bin", + "binary", + "ext", + "extensions", + "extension", + "file", + "json", + "list", + "array" + ], + "license": "MIT", + "main": "binary-extensions.json", + "name": "binary-extensions", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/binary-extensions.git" + }, + "scripts": { + "test": "ava" + }, + "version": "1.11.0" +} diff --git a/node_modules/binary-extensions/readme.md b/node_modules/binary-extensions/readme.md new file mode 100644 index 0000000..c0b5348 --- /dev/null +++ b/node_modules/binary-extensions/readme.md @@ -0,0 +1,33 @@ +# binary-extensions [![Build Status](https://travis-ci.org/sindresorhus/binary-extensions.svg?branch=master)](https://travis-ci.org/sindresorhus/binary-extensions) + +> List of binary file extensions + +The list is just a [JSON file](binary-extensions.json) and can be used wherever. + + +## Install + +``` +$ npm install binary-extensions +``` + + +## Usage + +```js +const binaryExtensions = require('binary-extensions'); + +console.log(binaryExtensions); +//=> ['3ds', '3g2', …] +``` + + +## Related + +- [is-binary-path](https://github.com/sindresorhus/is-binary-path) - Check if a filepath is a binary file +- [text-extensions](https://github.com/sindresorhus/text-extensions) - List of text file extensions + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/bluebird/LICENSE b/node_modules/bluebird/LICENSE new file mode 100644 index 0000000..ae732d5 --- /dev/null +++ b/node_modules/bluebird/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013-2017 Petka Antonov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/bluebird/README.md b/node_modules/bluebird/README.md new file mode 100644 index 0000000..b7e02b1 --- /dev/null +++ b/node_modules/bluebird/README.md @@ -0,0 +1,51 @@ + + Promises/A+ logo + +[![Build Status](https://travis-ci.org/petkaantonov/bluebird.svg?branch=master)](https://travis-ci.org/petkaantonov/bluebird) +[![coverage-98%](http://img.shields.io/badge/coverage-98%-brightgreen.svg?style=flat)](http://petkaantonov.github.io/bluebird/coverage/debug/index.html) + +**Got a question?** Join us on [stackoverflow](http://stackoverflow.com/questions/tagged/bluebird), the [mailing list](https://groups.google.com/forum/#!forum/bluebird-js) or chat on [IRC](https://webchat.freenode.net/?channels=#promises) + +# Introduction + +Bluebird is a fully featured promise library with focus on innovative features and performance + +See the [**bluebird website**](http://bluebirdjs.com/docs/getting-started.html) for further documentation, references and instructions. See the [**API reference**](http://bluebirdjs.com/docs/api-reference.html) here. + +For bluebird 2.x documentation and files, see the [2.x tree](https://github.com/petkaantonov/bluebird/tree/2.x). + +# Questions and issues + +The [github issue tracker](https://github.com/petkaantonov/bluebird/issues) is **_only_** for bug reports and feature requests. Anything else, such as questions for help in using the library, should be posted in [StackOverflow](http://stackoverflow.com/questions/tagged/bluebird) under tags `promise` and `bluebird`. + + + +## Thanks + +Thanks to BrowserStack for providing us with a free account which lets us support old browsers like IE8. + +# License + +The MIT License (MIT) + +Copyright (c) 2013-2017 Petka Antonov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/node_modules/bluebird/changelog.md b/node_modules/bluebird/changelog.md new file mode 100644 index 0000000..73b2eb6 --- /dev/null +++ b/node_modules/bluebird/changelog.md @@ -0,0 +1 @@ +[http://bluebirdjs.com/docs/changelog.html](http://bluebirdjs.com/docs/changelog.html) diff --git a/node_modules/bluebird/js/browser/bluebird.core.js b/node_modules/bluebird/js/browser/bluebird.core.js new file mode 100644 index 0000000..c94f3c2 --- /dev/null +++ b/node_modules/bluebird/js/browser/bluebird.core.js @@ -0,0 +1,3777 @@ +/* @preserve + * The MIT License (MIT) + * + * Copyright (c) 2013-2017 Petka Antonov + * + * 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. + * + */ +/** + * bluebird build version 3.5.0 + * Features enabled: core + * Features disabled: race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each +*/ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o 0) { + var fn = queue.shift(); + if (typeof fn !== "function") { + fn._settlePromises(); + continue; + } + var receiver = queue.shift(); + var arg = queue.shift(); + fn.call(receiver, arg); + } +}; + +Async.prototype._drainQueues = function () { + this._drainQueue(this._normalQueue); + this._reset(); + this._haveDrainedQueues = true; + this._drainQueue(this._lateQueue); +}; + +Async.prototype._queueTick = function () { + if (!this._isTickUsed) { + this._isTickUsed = true; + this._schedule(this.drainQueues); + } +}; + +Async.prototype._reset = function () { + this._isTickUsed = false; +}; + +module.exports = Async; +module.exports.firstLineError = firstLineError; + +},{"./queue":17,"./schedule":18,"./util":21}],2:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) { +var calledBind = false; +var rejectThis = function(_, e) { + this._reject(e); +}; + +var targetRejected = function(e, context) { + context.promiseRejectionQueued = true; + context.bindingPromise._then(rejectThis, rejectThis, null, this, e); +}; + +var bindingResolved = function(thisArg, context) { + if (((this._bitField & 50397184) === 0)) { + this._resolveCallback(context.target); + } +}; + +var bindingRejected = function(e, context) { + if (!context.promiseRejectionQueued) this._reject(e); +}; + +Promise.prototype.bind = function (thisArg) { + if (!calledBind) { + calledBind = true; + Promise.prototype._propagateFrom = debug.propagateFromFunction(); + Promise.prototype._boundValue = debug.boundValueFunction(); + } + var maybePromise = tryConvertToPromise(thisArg); + var ret = new Promise(INTERNAL); + ret._propagateFrom(this, 1); + var target = this._target(); + ret._setBoundTo(maybePromise); + if (maybePromise instanceof Promise) { + var context = { + promiseRejectionQueued: false, + promise: ret, + target: target, + bindingPromise: maybePromise + }; + target._then(INTERNAL, targetRejected, undefined, ret, context); + maybePromise._then( + bindingResolved, bindingRejected, undefined, ret, context); + ret._setOnCancel(maybePromise); + } else { + ret._resolveCallback(target); + } + return ret; +}; + +Promise.prototype._setBoundTo = function (obj) { + if (obj !== undefined) { + this._bitField = this._bitField | 2097152; + this._boundTo = obj; + } else { + this._bitField = this._bitField & (~2097152); + } +}; + +Promise.prototype._isBound = function () { + return (this._bitField & 2097152) === 2097152; +}; + +Promise.bind = function (thisArg, value) { + return Promise.resolve(value).bind(thisArg); +}; +}; + +},{}],3:[function(_dereq_,module,exports){ +"use strict"; +var old; +if (typeof Promise !== "undefined") old = Promise; +function noConflict() { + try { if (Promise === bluebird) Promise = old; } + catch (e) {} + return bluebird; +} +var bluebird = _dereq_("./promise")(); +bluebird.noConflict = noConflict; +module.exports = bluebird; + +},{"./promise":15}],4:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, PromiseArray, apiRejection, debug) { +var util = _dereq_("./util"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var async = Promise._async; + +Promise.prototype["break"] = Promise.prototype.cancel = function() { + if (!debug.cancellation()) return this._warn("cancellation is disabled"); + + var promise = this; + var child = promise; + while (promise._isCancellable()) { + if (!promise._cancelBy(child)) { + if (child._isFollowing()) { + child._followee().cancel(); + } else { + child._cancelBranched(); + } + break; + } + + var parent = promise._cancellationParent; + if (parent == null || !parent._isCancellable()) { + if (promise._isFollowing()) { + promise._followee().cancel(); + } else { + promise._cancelBranched(); + } + break; + } else { + if (promise._isFollowing()) promise._followee().cancel(); + promise._setWillBeCancelled(); + child = promise; + promise = parent; + } + } +}; + +Promise.prototype._branchHasCancelled = function() { + this._branchesRemainingToCancel--; +}; + +Promise.prototype._enoughBranchesHaveCancelled = function() { + return this._branchesRemainingToCancel === undefined || + this._branchesRemainingToCancel <= 0; +}; + +Promise.prototype._cancelBy = function(canceller) { + if (canceller === this) { + this._branchesRemainingToCancel = 0; + this._invokeOnCancel(); + return true; + } else { + this._branchHasCancelled(); + if (this._enoughBranchesHaveCancelled()) { + this._invokeOnCancel(); + return true; + } + } + return false; +}; + +Promise.prototype._cancelBranched = function() { + if (this._enoughBranchesHaveCancelled()) { + this._cancel(); + } +}; + +Promise.prototype._cancel = function() { + if (!this._isCancellable()) return; + this._setCancelled(); + async.invoke(this._cancelPromises, this, undefined); +}; + +Promise.prototype._cancelPromises = function() { + if (this._length() > 0) this._settlePromises(); +}; + +Promise.prototype._unsetOnCancel = function() { + this._onCancelField = undefined; +}; + +Promise.prototype._isCancellable = function() { + return this.isPending() && !this._isCancelled(); +}; + +Promise.prototype.isCancellable = function() { + return this.isPending() && !this.isCancelled(); +}; + +Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) { + if (util.isArray(onCancelCallback)) { + for (var i = 0; i < onCancelCallback.length; ++i) { + this._doInvokeOnCancel(onCancelCallback[i], internalOnly); + } + } else if (onCancelCallback !== undefined) { + if (typeof onCancelCallback === "function") { + if (!internalOnly) { + var e = tryCatch(onCancelCallback).call(this._boundValue()); + if (e === errorObj) { + this._attachExtraTrace(e.e); + async.throwLater(e.e); + } + } + } else { + onCancelCallback._resultCancelled(this); + } + } +}; + +Promise.prototype._invokeOnCancel = function() { + var onCancelCallback = this._onCancel(); + this._unsetOnCancel(); + async.invoke(this._doInvokeOnCancel, this, onCancelCallback); +}; + +Promise.prototype._invokeInternalOnCancel = function() { + if (this._isCancellable()) { + this._doInvokeOnCancel(this._onCancel(), true); + this._unsetOnCancel(); + } +}; + +Promise.prototype._resultCancelled = function() { + this.cancel(); +}; + +}; + +},{"./util":21}],5:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(NEXT_FILTER) { +var util = _dereq_("./util"); +var getKeys = _dereq_("./es5").keys; +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; + +function catchFilter(instances, cb, promise) { + return function(e) { + var boundTo = promise._boundValue(); + predicateLoop: for (var i = 0; i < instances.length; ++i) { + var item = instances[i]; + + if (item === Error || + (item != null && item.prototype instanceof Error)) { + if (e instanceof item) { + return tryCatch(cb).call(boundTo, e); + } + } else if (typeof item === "function") { + var matchesPredicate = tryCatch(item).call(boundTo, e); + if (matchesPredicate === errorObj) { + return matchesPredicate; + } else if (matchesPredicate) { + return tryCatch(cb).call(boundTo, e); + } + } else if (util.isObject(e)) { + var keys = getKeys(item); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + if (item[key] != e[key]) { + continue predicateLoop; + } + } + return tryCatch(cb).call(boundTo, e); + } + } + return NEXT_FILTER; + }; +} + +return catchFilter; +}; + +},{"./es5":10,"./util":21}],6:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise) { +var longStackTraces = false; +var contextStack = []; + +Promise.prototype._promiseCreated = function() {}; +Promise.prototype._pushContext = function() {}; +Promise.prototype._popContext = function() {return null;}; +Promise._peekContext = Promise.prototype._peekContext = function() {}; + +function Context() { + this._trace = new Context.CapturedTrace(peekContext()); +} +Context.prototype._pushContext = function () { + if (this._trace !== undefined) { + this._trace._promiseCreated = null; + contextStack.push(this._trace); + } +}; + +Context.prototype._popContext = function () { + if (this._trace !== undefined) { + var trace = contextStack.pop(); + var ret = trace._promiseCreated; + trace._promiseCreated = null; + return ret; + } + return null; +}; + +function createContext() { + if (longStackTraces) return new Context(); +} + +function peekContext() { + var lastIndex = contextStack.length - 1; + if (lastIndex >= 0) { + return contextStack[lastIndex]; + } + return undefined; +} +Context.CapturedTrace = null; +Context.create = createContext; +Context.deactivateLongStackTraces = function() {}; +Context.activateLongStackTraces = function() { + var Promise_pushContext = Promise.prototype._pushContext; + var Promise_popContext = Promise.prototype._popContext; + var Promise_PeekContext = Promise._peekContext; + var Promise_peekContext = Promise.prototype._peekContext; + var Promise_promiseCreated = Promise.prototype._promiseCreated; + Context.deactivateLongStackTraces = function() { + Promise.prototype._pushContext = Promise_pushContext; + Promise.prototype._popContext = Promise_popContext; + Promise._peekContext = Promise_PeekContext; + Promise.prototype._peekContext = Promise_peekContext; + Promise.prototype._promiseCreated = Promise_promiseCreated; + longStackTraces = false; + }; + longStackTraces = true; + Promise.prototype._pushContext = Context.prototype._pushContext; + Promise.prototype._popContext = Context.prototype._popContext; + Promise._peekContext = Promise.prototype._peekContext = peekContext; + Promise.prototype._promiseCreated = function() { + var ctx = this._peekContext(); + if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this; + }; +}; +return Context; +}; + +},{}],7:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, Context) { +var getDomain = Promise._getDomain; +var async = Promise._async; +var Warning = _dereq_("./errors").Warning; +var util = _dereq_("./util"); +var canAttachTrace = util.canAttachTrace; +var unhandledRejectionHandled; +var possiblyUnhandledRejection; +var bluebirdFramePattern = + /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/; +var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/; +var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/; +var stackFramePattern = null; +var formatStack = null; +var indentStackFrames = false; +var printWarning; +var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 && + (true || + util.env("BLUEBIRD_DEBUG") || + util.env("NODE_ENV") === "development")); + +var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 && + (debugging || util.env("BLUEBIRD_WARNINGS"))); + +var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && + (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES"))); + +var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && + (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN")); + +Promise.prototype.suppressUnhandledRejections = function() { + var target = this._target(); + target._bitField = ((target._bitField & (~1048576)) | + 524288); +}; + +Promise.prototype._ensurePossibleRejectionHandled = function () { + if ((this._bitField & 524288) !== 0) return; + this._setRejectionIsUnhandled(); + async.invokeLater(this._notifyUnhandledRejection, this, undefined); +}; + +Promise.prototype._notifyUnhandledRejectionIsHandled = function () { + fireRejectionEvent("rejectionHandled", + unhandledRejectionHandled, undefined, this); +}; + +Promise.prototype._setReturnedNonUndefined = function() { + this._bitField = this._bitField | 268435456; +}; + +Promise.prototype._returnedNonUndefined = function() { + return (this._bitField & 268435456) !== 0; +}; + +Promise.prototype._notifyUnhandledRejection = function () { + if (this._isRejectionUnhandled()) { + var reason = this._settledValue(); + this._setUnhandledRejectionIsNotified(); + fireRejectionEvent("unhandledRejection", + possiblyUnhandledRejection, reason, this); + } +}; + +Promise.prototype._setUnhandledRejectionIsNotified = function () { + this._bitField = this._bitField | 262144; +}; + +Promise.prototype._unsetUnhandledRejectionIsNotified = function () { + this._bitField = this._bitField & (~262144); +}; + +Promise.prototype._isUnhandledRejectionNotified = function () { + return (this._bitField & 262144) > 0; +}; + +Promise.prototype._setRejectionIsUnhandled = function () { + this._bitField = this._bitField | 1048576; +}; + +Promise.prototype._unsetRejectionIsUnhandled = function () { + this._bitField = this._bitField & (~1048576); + if (this._isUnhandledRejectionNotified()) { + this._unsetUnhandledRejectionIsNotified(); + this._notifyUnhandledRejectionIsHandled(); + } +}; + +Promise.prototype._isRejectionUnhandled = function () { + return (this._bitField & 1048576) > 0; +}; + +Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) { + return warn(message, shouldUseOwnTrace, promise || this); +}; + +Promise.onPossiblyUnhandledRejection = function (fn) { + var domain = getDomain(); + possiblyUnhandledRejection = + typeof fn === "function" ? (domain === null ? + fn : util.domainBind(domain, fn)) + : undefined; +}; + +Promise.onUnhandledRejectionHandled = function (fn) { + var domain = getDomain(); + unhandledRejectionHandled = + typeof fn === "function" ? (domain === null ? + fn : util.domainBind(domain, fn)) + : undefined; +}; + +var disableLongStackTraces = function() {}; +Promise.longStackTraces = function () { + if (async.haveItemsQueued() && !config.longStackTraces) { + throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + if (!config.longStackTraces && longStackTracesIsSupported()) { + var Promise_captureStackTrace = Promise.prototype._captureStackTrace; + var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace; + config.longStackTraces = true; + disableLongStackTraces = function() { + if (async.haveItemsQueued() && !config.longStackTraces) { + throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + Promise.prototype._captureStackTrace = Promise_captureStackTrace; + Promise.prototype._attachExtraTrace = Promise_attachExtraTrace; + Context.deactivateLongStackTraces(); + async.enableTrampoline(); + config.longStackTraces = false; + }; + Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace; + Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; + Context.activateLongStackTraces(); + async.disableTrampolineIfNecessary(); + } +}; + +Promise.hasLongStackTraces = function () { + return config.longStackTraces && longStackTracesIsSupported(); +}; + +var fireDomEvent = (function() { + try { + if (typeof CustomEvent === "function") { + var event = new CustomEvent("CustomEvent"); + util.global.dispatchEvent(event); + return function(name, event) { + var domEvent = new CustomEvent(name.toLowerCase(), { + detail: event, + cancelable: true + }); + return !util.global.dispatchEvent(domEvent); + }; + } else if (typeof Event === "function") { + var event = new Event("CustomEvent"); + util.global.dispatchEvent(event); + return function(name, event) { + var domEvent = new Event(name.toLowerCase(), { + cancelable: true + }); + domEvent.detail = event; + return !util.global.dispatchEvent(domEvent); + }; + } else { + var event = document.createEvent("CustomEvent"); + event.initCustomEvent("testingtheevent", false, true, {}); + util.global.dispatchEvent(event); + return function(name, event) { + var domEvent = document.createEvent("CustomEvent"); + domEvent.initCustomEvent(name.toLowerCase(), false, true, + event); + return !util.global.dispatchEvent(domEvent); + }; + } + } catch (e) {} + return function() { + return false; + }; +})(); + +var fireGlobalEvent = (function() { + if (util.isNode) { + return function() { + return process.emit.apply(process, arguments); + }; + } else { + if (!util.global) { + return function() { + return false; + }; + } + return function(name) { + var methodName = "on" + name.toLowerCase(); + var method = util.global[methodName]; + if (!method) return false; + method.apply(util.global, [].slice.call(arguments, 1)); + return true; + }; + } +})(); + +function generatePromiseLifecycleEventObject(name, promise) { + return {promise: promise}; +} + +var eventToObjectGenerator = { + promiseCreated: generatePromiseLifecycleEventObject, + promiseFulfilled: generatePromiseLifecycleEventObject, + promiseRejected: generatePromiseLifecycleEventObject, + promiseResolved: generatePromiseLifecycleEventObject, + promiseCancelled: generatePromiseLifecycleEventObject, + promiseChained: function(name, promise, child) { + return {promise: promise, child: child}; + }, + warning: function(name, warning) { + return {warning: warning}; + }, + unhandledRejection: function (name, reason, promise) { + return {reason: reason, promise: promise}; + }, + rejectionHandled: generatePromiseLifecycleEventObject +}; + +var activeFireEvent = function (name) { + var globalEventFired = false; + try { + globalEventFired = fireGlobalEvent.apply(null, arguments); + } catch (e) { + async.throwLater(e); + globalEventFired = true; + } + + var domEventFired = false; + try { + domEventFired = fireDomEvent(name, + eventToObjectGenerator[name].apply(null, arguments)); + } catch (e) { + async.throwLater(e); + domEventFired = true; + } + + return domEventFired || globalEventFired; +}; + +Promise.config = function(opts) { + opts = Object(opts); + if ("longStackTraces" in opts) { + if (opts.longStackTraces) { + Promise.longStackTraces(); + } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) { + disableLongStackTraces(); + } + } + if ("warnings" in opts) { + var warningsOption = opts.warnings; + config.warnings = !!warningsOption; + wForgottenReturn = config.warnings; + + if (util.isObject(warningsOption)) { + if ("wForgottenReturn" in warningsOption) { + wForgottenReturn = !!warningsOption.wForgottenReturn; + } + } + } + if ("cancellation" in opts && opts.cancellation && !config.cancellation) { + if (async.haveItemsQueued()) { + throw new Error( + "cannot enable cancellation after promises are in use"); + } + Promise.prototype._clearCancellationData = + cancellationClearCancellationData; + Promise.prototype._propagateFrom = cancellationPropagateFrom; + Promise.prototype._onCancel = cancellationOnCancel; + Promise.prototype._setOnCancel = cancellationSetOnCancel; + Promise.prototype._attachCancellationCallback = + cancellationAttachCancellationCallback; + Promise.prototype._execute = cancellationExecute; + propagateFromFunction = cancellationPropagateFrom; + config.cancellation = true; + } + if ("monitoring" in opts) { + if (opts.monitoring && !config.monitoring) { + config.monitoring = true; + Promise.prototype._fireEvent = activeFireEvent; + } else if (!opts.monitoring && config.monitoring) { + config.monitoring = false; + Promise.prototype._fireEvent = defaultFireEvent; + } + } + return Promise; +}; + +function defaultFireEvent() { return false; } + +Promise.prototype._fireEvent = defaultFireEvent; +Promise.prototype._execute = function(executor, resolve, reject) { + try { + executor(resolve, reject); + } catch (e) { + return e; + } +}; +Promise.prototype._onCancel = function () {}; +Promise.prototype._setOnCancel = function (handler) { ; }; +Promise.prototype._attachCancellationCallback = function(onCancel) { + ; +}; +Promise.prototype._captureStackTrace = function () {}; +Promise.prototype._attachExtraTrace = function () {}; +Promise.prototype._clearCancellationData = function() {}; +Promise.prototype._propagateFrom = function (parent, flags) { + ; + ; +}; + +function cancellationExecute(executor, resolve, reject) { + var promise = this; + try { + executor(resolve, reject, function(onCancel) { + if (typeof onCancel !== "function") { + throw new TypeError("onCancel must be a function, got: " + + util.toString(onCancel)); + } + promise._attachCancellationCallback(onCancel); + }); + } catch (e) { + return e; + } +} + +function cancellationAttachCancellationCallback(onCancel) { + if (!this._isCancellable()) return this; + + var previousOnCancel = this._onCancel(); + if (previousOnCancel !== undefined) { + if (util.isArray(previousOnCancel)) { + previousOnCancel.push(onCancel); + } else { + this._setOnCancel([previousOnCancel, onCancel]); + } + } else { + this._setOnCancel(onCancel); + } +} + +function cancellationOnCancel() { + return this._onCancelField; +} + +function cancellationSetOnCancel(onCancel) { + this._onCancelField = onCancel; +} + +function cancellationClearCancellationData() { + this._cancellationParent = undefined; + this._onCancelField = undefined; +} + +function cancellationPropagateFrom(parent, flags) { + if ((flags & 1) !== 0) { + this._cancellationParent = parent; + var branchesRemainingToCancel = parent._branchesRemainingToCancel; + if (branchesRemainingToCancel === undefined) { + branchesRemainingToCancel = 0; + } + parent._branchesRemainingToCancel = branchesRemainingToCancel + 1; + } + if ((flags & 2) !== 0 && parent._isBound()) { + this._setBoundTo(parent._boundTo); + } +} + +function bindingPropagateFrom(parent, flags) { + if ((flags & 2) !== 0 && parent._isBound()) { + this._setBoundTo(parent._boundTo); + } +} +var propagateFromFunction = bindingPropagateFrom; + +function boundValueFunction() { + var ret = this._boundTo; + if (ret !== undefined) { + if (ret instanceof Promise) { + if (ret.isFulfilled()) { + return ret.value(); + } else { + return undefined; + } + } + } + return ret; +} + +function longStackTracesCaptureStackTrace() { + this._trace = new CapturedTrace(this._peekContext()); +} + +function longStackTracesAttachExtraTrace(error, ignoreSelf) { + if (canAttachTrace(error)) { + var trace = this._trace; + if (trace !== undefined) { + if (ignoreSelf) trace = trace._parent; + } + if (trace !== undefined) { + trace.attachExtraTrace(error); + } else if (!error.__stackCleaned__) { + var parsed = parseStackAndMessage(error); + util.notEnumerableProp(error, "stack", + parsed.message + "\n" + parsed.stack.join("\n")); + util.notEnumerableProp(error, "__stackCleaned__", true); + } + } +} + +function checkForgottenReturns(returnValue, promiseCreated, name, promise, + parent) { + if (returnValue === undefined && promiseCreated !== null && + wForgottenReturn) { + if (parent !== undefined && parent._returnedNonUndefined()) return; + if ((promise._bitField & 65535) === 0) return; + + if (name) name = name + " "; + var handlerLine = ""; + var creatorLine = ""; + if (promiseCreated._trace) { + var traceLines = promiseCreated._trace.stack.split("\n"); + var stack = cleanStack(traceLines); + for (var i = stack.length - 1; i >= 0; --i) { + var line = stack[i]; + if (!nodeFramePattern.test(line)) { + var lineMatches = line.match(parseLinePattern); + if (lineMatches) { + handlerLine = "at " + lineMatches[1] + + ":" + lineMatches[2] + ":" + lineMatches[3] + " "; + } + break; + } + } + + if (stack.length > 0) { + var firstUserLine = stack[0]; + for (var i = 0; i < traceLines.length; ++i) { + + if (traceLines[i] === firstUserLine) { + if (i > 0) { + creatorLine = "\n" + traceLines[i - 1]; + } + break; + } + } + + } + } + var msg = "a promise was created in a " + name + + "handler " + handlerLine + "but was not returned from it, " + + "see http://goo.gl/rRqMUw" + + creatorLine; + promise._warn(msg, true, promiseCreated); + } +} + +function deprecated(name, replacement) { + var message = name + + " is deprecated and will be removed in a future version."; + if (replacement) message += " Use " + replacement + " instead."; + return warn(message); +} + +function warn(message, shouldUseOwnTrace, promise) { + if (!config.warnings) return; + var warning = new Warning(message); + var ctx; + if (shouldUseOwnTrace) { + promise._attachExtraTrace(warning); + } else if (config.longStackTraces && (ctx = Promise._peekContext())) { + ctx.attachExtraTrace(warning); + } else { + var parsed = parseStackAndMessage(warning); + warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); + } + + if (!activeFireEvent("warning", warning)) { + formatAndLogError(warning, "", true); + } +} + +function reconstructStack(message, stacks) { + for (var i = 0; i < stacks.length - 1; ++i) { + stacks[i].push("From previous event:"); + stacks[i] = stacks[i].join("\n"); + } + if (i < stacks.length) { + stacks[i] = stacks[i].join("\n"); + } + return message + "\n" + stacks.join("\n"); +} + +function removeDuplicateOrEmptyJumps(stacks) { + for (var i = 0; i < stacks.length; ++i) { + if (stacks[i].length === 0 || + ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) { + stacks.splice(i, 1); + i--; + } + } +} + +function removeCommonRoots(stacks) { + var current = stacks[0]; + for (var i = 1; i < stacks.length; ++i) { + var prev = stacks[i]; + var currentLastIndex = current.length - 1; + var currentLastLine = current[currentLastIndex]; + var commonRootMeetPoint = -1; + + for (var j = prev.length - 1; j >= 0; --j) { + if (prev[j] === currentLastLine) { + commonRootMeetPoint = j; + break; + } + } + + for (var j = commonRootMeetPoint; j >= 0; --j) { + var line = prev[j]; + if (current[currentLastIndex] === line) { + current.pop(); + currentLastIndex--; + } else { + break; + } + } + current = prev; + } +} + +function cleanStack(stack) { + var ret = []; + for (var i = 0; i < stack.length; ++i) { + var line = stack[i]; + var isTraceLine = " (No stack trace)" === line || + stackFramePattern.test(line); + var isInternalFrame = isTraceLine && shouldIgnore(line); + if (isTraceLine && !isInternalFrame) { + if (indentStackFrames && line.charAt(0) !== " ") { + line = " " + line; + } + ret.push(line); + } + } + return ret; +} + +function stackFramesAsArray(error) { + var stack = error.stack.replace(/\s+$/g, "").split("\n"); + for (var i = 0; i < stack.length; ++i) { + var line = stack[i]; + if (" (No stack trace)" === line || stackFramePattern.test(line)) { + break; + } + } + if (i > 0 && error.name != "SyntaxError") { + stack = stack.slice(i); + } + return stack; +} + +function parseStackAndMessage(error) { + var stack = error.stack; + var message = error.toString(); + stack = typeof stack === "string" && stack.length > 0 + ? stackFramesAsArray(error) : [" (No stack trace)"]; + return { + message: message, + stack: error.name == "SyntaxError" ? stack : cleanStack(stack) + }; +} + +function formatAndLogError(error, title, isSoft) { + if (typeof console !== "undefined") { + var message; + if (util.isObject(error)) { + var stack = error.stack; + message = title + formatStack(stack, error); + } else { + message = title + String(error); + } + if (typeof printWarning === "function") { + printWarning(message, isSoft); + } else if (typeof console.log === "function" || + typeof console.log === "object") { + console.log(message); + } + } +} + +function fireRejectionEvent(name, localHandler, reason, promise) { + var localEventFired = false; + try { + if (typeof localHandler === "function") { + localEventFired = true; + if (name === "rejectionHandled") { + localHandler(promise); + } else { + localHandler(reason, promise); + } + } + } catch (e) { + async.throwLater(e); + } + + if (name === "unhandledRejection") { + if (!activeFireEvent(name, reason, promise) && !localEventFired) { + formatAndLogError(reason, "Unhandled rejection "); + } + } else { + activeFireEvent(name, promise); + } +} + +function formatNonError(obj) { + var str; + if (typeof obj === "function") { + str = "[function " + + (obj.name || "anonymous") + + "]"; + } else { + str = obj && typeof obj.toString === "function" + ? obj.toString() : util.toString(obj); + var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; + if (ruselessToString.test(str)) { + try { + var newStr = JSON.stringify(obj); + str = newStr; + } + catch(e) { + + } + } + if (str.length === 0) { + str = "(empty array)"; + } + } + return ("(<" + snip(str) + ">, no stack trace)"); +} + +function snip(str) { + var maxChars = 41; + if (str.length < maxChars) { + return str; + } + return str.substr(0, maxChars - 3) + "..."; +} + +function longStackTracesIsSupported() { + return typeof captureStackTrace === "function"; +} + +var shouldIgnore = function() { return false; }; +var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; +function parseLineInfo(line) { + var matches = line.match(parseLineInfoRegex); + if (matches) { + return { + fileName: matches[1], + line: parseInt(matches[2], 10) + }; + } +} + +function setBounds(firstLineError, lastLineError) { + if (!longStackTracesIsSupported()) return; + var firstStackLines = firstLineError.stack.split("\n"); + var lastStackLines = lastLineError.stack.split("\n"); + var firstIndex = -1; + var lastIndex = -1; + var firstFileName; + var lastFileName; + for (var i = 0; i < firstStackLines.length; ++i) { + var result = parseLineInfo(firstStackLines[i]); + if (result) { + firstFileName = result.fileName; + firstIndex = result.line; + break; + } + } + for (var i = 0; i < lastStackLines.length; ++i) { + var result = parseLineInfo(lastStackLines[i]); + if (result) { + lastFileName = result.fileName; + lastIndex = result.line; + break; + } + } + if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || + firstFileName !== lastFileName || firstIndex >= lastIndex) { + return; + } + + shouldIgnore = function(line) { + if (bluebirdFramePattern.test(line)) return true; + var info = parseLineInfo(line); + if (info) { + if (info.fileName === firstFileName && + (firstIndex <= info.line && info.line <= lastIndex)) { + return true; + } + } + return false; + }; +} + +function CapturedTrace(parent) { + this._parent = parent; + this._promisesCreated = 0; + var length = this._length = 1 + (parent === undefined ? 0 : parent._length); + captureStackTrace(this, CapturedTrace); + if (length > 32) this.uncycle(); +} +util.inherits(CapturedTrace, Error); +Context.CapturedTrace = CapturedTrace; + +CapturedTrace.prototype.uncycle = function() { + var length = this._length; + if (length < 2) return; + var nodes = []; + var stackToIndex = {}; + + for (var i = 0, node = this; node !== undefined; ++i) { + nodes.push(node); + node = node._parent; + } + length = this._length = i; + for (var i = length - 1; i >= 0; --i) { + var stack = nodes[i].stack; + if (stackToIndex[stack] === undefined) { + stackToIndex[stack] = i; + } + } + for (var i = 0; i < length; ++i) { + var currentStack = nodes[i].stack; + var index = stackToIndex[currentStack]; + if (index !== undefined && index !== i) { + if (index > 0) { + nodes[index - 1]._parent = undefined; + nodes[index - 1]._length = 1; + } + nodes[i]._parent = undefined; + nodes[i]._length = 1; + var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; + + if (index < length - 1) { + cycleEdgeNode._parent = nodes[index + 1]; + cycleEdgeNode._parent.uncycle(); + cycleEdgeNode._length = + cycleEdgeNode._parent._length + 1; + } else { + cycleEdgeNode._parent = undefined; + cycleEdgeNode._length = 1; + } + var currentChildLength = cycleEdgeNode._length + 1; + for (var j = i - 2; j >= 0; --j) { + nodes[j]._length = currentChildLength; + currentChildLength++; + } + return; + } + } +}; + +CapturedTrace.prototype.attachExtraTrace = function(error) { + if (error.__stackCleaned__) return; + this.uncycle(); + var parsed = parseStackAndMessage(error); + var message = parsed.message; + var stacks = [parsed.stack]; + + var trace = this; + while (trace !== undefined) { + stacks.push(cleanStack(trace.stack.split("\n"))); + trace = trace._parent; + } + removeCommonRoots(stacks); + removeDuplicateOrEmptyJumps(stacks); + util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); + util.notEnumerableProp(error, "__stackCleaned__", true); +}; + +var captureStackTrace = (function stackDetection() { + var v8stackFramePattern = /^\s*at\s*/; + var v8stackFormatter = function(stack, error) { + if (typeof stack === "string") return stack; + + if (error.name !== undefined && + error.message !== undefined) { + return error.toString(); + } + return formatNonError(error); + }; + + if (typeof Error.stackTraceLimit === "number" && + typeof Error.captureStackTrace === "function") { + Error.stackTraceLimit += 6; + stackFramePattern = v8stackFramePattern; + formatStack = v8stackFormatter; + var captureStackTrace = Error.captureStackTrace; + + shouldIgnore = function(line) { + return bluebirdFramePattern.test(line); + }; + return function(receiver, ignoreUntil) { + Error.stackTraceLimit += 6; + captureStackTrace(receiver, ignoreUntil); + Error.stackTraceLimit -= 6; + }; + } + var err = new Error(); + + if (typeof err.stack === "string" && + err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { + stackFramePattern = /@/; + formatStack = v8stackFormatter; + indentStackFrames = true; + return function captureStackTrace(o) { + o.stack = new Error().stack; + }; + } + + var hasStackAfterThrow; + try { throw new Error(); } + catch(e) { + hasStackAfterThrow = ("stack" in e); + } + if (!("stack" in err) && hasStackAfterThrow && + typeof Error.stackTraceLimit === "number") { + stackFramePattern = v8stackFramePattern; + formatStack = v8stackFormatter; + return function captureStackTrace(o) { + Error.stackTraceLimit += 6; + try { throw new Error(); } + catch(e) { o.stack = e.stack; } + Error.stackTraceLimit -= 6; + }; + } + + formatStack = function(stack, error) { + if (typeof stack === "string") return stack; + + if ((typeof error === "object" || + typeof error === "function") && + error.name !== undefined && + error.message !== undefined) { + return error.toString(); + } + return formatNonError(error); + }; + + return null; + +})([]); + +if (typeof console !== "undefined" && typeof console.warn !== "undefined") { + printWarning = function (message) { + console.warn(message); + }; + if (util.isNode && process.stderr.isTTY) { + printWarning = function(message, isSoft) { + var color = isSoft ? "\u001b[33m" : "\u001b[31m"; + console.warn(color + message + "\u001b[0m\n"); + }; + } else if (!util.isNode && typeof (new Error().stack) === "string") { + printWarning = function(message, isSoft) { + console.warn("%c" + message, + isSoft ? "color: darkorange" : "color: red"); + }; + } +} + +var config = { + warnings: warnings, + longStackTraces: false, + cancellation: false, + monitoring: false +}; + +if (longStackTraces) Promise.longStackTraces(); + +return { + longStackTraces: function() { + return config.longStackTraces; + }, + warnings: function() { + return config.warnings; + }, + cancellation: function() { + return config.cancellation; + }, + monitoring: function() { + return config.monitoring; + }, + propagateFromFunction: function() { + return propagateFromFunction; + }, + boundValueFunction: function() { + return boundValueFunction; + }, + checkForgottenReturns: checkForgottenReturns, + setBounds: setBounds, + warn: warn, + deprecated: deprecated, + CapturedTrace: CapturedTrace, + fireDomEvent: fireDomEvent, + fireGlobalEvent: fireGlobalEvent +}; +}; + +},{"./errors":9,"./util":21}],8:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise) { +function returner() { + return this.value; +} +function thrower() { + throw this.reason; +} + +Promise.prototype["return"] = +Promise.prototype.thenReturn = function (value) { + if (value instanceof Promise) value.suppressUnhandledRejections(); + return this._then( + returner, undefined, undefined, {value: value}, undefined); +}; + +Promise.prototype["throw"] = +Promise.prototype.thenThrow = function (reason) { + return this._then( + thrower, undefined, undefined, {reason: reason}, undefined); +}; + +Promise.prototype.catchThrow = function (reason) { + if (arguments.length <= 1) { + return this._then( + undefined, thrower, undefined, {reason: reason}, undefined); + } else { + var _reason = arguments[1]; + var handler = function() {throw _reason;}; + return this.caught(reason, handler); + } +}; + +Promise.prototype.catchReturn = function (value) { + if (arguments.length <= 1) { + if (value instanceof Promise) value.suppressUnhandledRejections(); + return this._then( + undefined, returner, undefined, {value: value}, undefined); + } else { + var _value = arguments[1]; + if (_value instanceof Promise) _value.suppressUnhandledRejections(); + var handler = function() {return _value;}; + return this.caught(value, handler); + } +}; +}; + +},{}],9:[function(_dereq_,module,exports){ +"use strict"; +var es5 = _dereq_("./es5"); +var Objectfreeze = es5.freeze; +var util = _dereq_("./util"); +var inherits = util.inherits; +var notEnumerableProp = util.notEnumerableProp; + +function subError(nameProperty, defaultMessage) { + function SubError(message) { + if (!(this instanceof SubError)) return new SubError(message); + notEnumerableProp(this, "message", + typeof message === "string" ? message : defaultMessage); + notEnumerableProp(this, "name", nameProperty); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + Error.call(this); + } + } + inherits(SubError, Error); + return SubError; +} + +var _TypeError, _RangeError; +var Warning = subError("Warning", "warning"); +var CancellationError = subError("CancellationError", "cancellation error"); +var TimeoutError = subError("TimeoutError", "timeout error"); +var AggregateError = subError("AggregateError", "aggregate error"); +try { + _TypeError = TypeError; + _RangeError = RangeError; +} catch(e) { + _TypeError = subError("TypeError", "type error"); + _RangeError = subError("RangeError", "range error"); +} + +var methods = ("join pop push shift unshift slice filter forEach some " + + "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" "); + +for (var i = 0; i < methods.length; ++i) { + if (typeof Array.prototype[methods[i]] === "function") { + AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; + } +} + +es5.defineProperty(AggregateError.prototype, "length", { + value: 0, + configurable: false, + writable: true, + enumerable: true +}); +AggregateError.prototype["isOperational"] = true; +var level = 0; +AggregateError.prototype.toString = function() { + var indent = Array(level * 4 + 1).join(" "); + var ret = "\n" + indent + "AggregateError of:" + "\n"; + level++; + indent = Array(level * 4 + 1).join(" "); + for (var i = 0; i < this.length; ++i) { + var str = this[i] === this ? "[Circular AggregateError]" : this[i] + ""; + var lines = str.split("\n"); + for (var j = 0; j < lines.length; ++j) { + lines[j] = indent + lines[j]; + } + str = lines.join("\n"); + ret += str + "\n"; + } + level--; + return ret; +}; + +function OperationalError(message) { + if (!(this instanceof OperationalError)) + return new OperationalError(message); + notEnumerableProp(this, "name", "OperationalError"); + notEnumerableProp(this, "message", message); + this.cause = message; + this["isOperational"] = true; + + if (message instanceof Error) { + notEnumerableProp(this, "message", message.message); + notEnumerableProp(this, "stack", message.stack); + } else if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + +} +inherits(OperationalError, Error); + +var errorTypes = Error["__BluebirdErrorTypes__"]; +if (!errorTypes) { + errorTypes = Objectfreeze({ + CancellationError: CancellationError, + TimeoutError: TimeoutError, + OperationalError: OperationalError, + RejectionError: OperationalError, + AggregateError: AggregateError + }); + es5.defineProperty(Error, "__BluebirdErrorTypes__", { + value: errorTypes, + writable: false, + enumerable: false, + configurable: false + }); +} + +module.exports = { + Error: Error, + TypeError: _TypeError, + RangeError: _RangeError, + CancellationError: errorTypes.CancellationError, + OperationalError: errorTypes.OperationalError, + TimeoutError: errorTypes.TimeoutError, + AggregateError: errorTypes.AggregateError, + Warning: Warning +}; + +},{"./es5":10,"./util":21}],10:[function(_dereq_,module,exports){ +var isES5 = (function(){ + "use strict"; + return this === undefined; +})(); + +if (isES5) { + module.exports = { + freeze: Object.freeze, + defineProperty: Object.defineProperty, + getDescriptor: Object.getOwnPropertyDescriptor, + keys: Object.keys, + names: Object.getOwnPropertyNames, + getPrototypeOf: Object.getPrototypeOf, + isArray: Array.isArray, + isES5: isES5, + propertyIsWritable: function(obj, prop) { + var descriptor = Object.getOwnPropertyDescriptor(obj, prop); + return !!(!descriptor || descriptor.writable || descriptor.set); + } + }; +} else { + var has = {}.hasOwnProperty; + var str = {}.toString; + var proto = {}.constructor.prototype; + + var ObjectKeys = function (o) { + var ret = []; + for (var key in o) { + if (has.call(o, key)) { + ret.push(key); + } + } + return ret; + }; + + var ObjectGetDescriptor = function(o, key) { + return {value: o[key]}; + }; + + var ObjectDefineProperty = function (o, key, desc) { + o[key] = desc.value; + return o; + }; + + var ObjectFreeze = function (obj) { + return obj; + }; + + var ObjectGetPrototypeOf = function (obj) { + try { + return Object(obj).constructor.prototype; + } + catch (e) { + return proto; + } + }; + + var ArrayIsArray = function (obj) { + try { + return str.call(obj) === "[object Array]"; + } + catch(e) { + return false; + } + }; + + module.exports = { + isArray: ArrayIsArray, + keys: ObjectKeys, + names: ObjectKeys, + defineProperty: ObjectDefineProperty, + getDescriptor: ObjectGetDescriptor, + freeze: ObjectFreeze, + getPrototypeOf: ObjectGetPrototypeOf, + isES5: isES5, + propertyIsWritable: function() { + return true; + } + }; +} + +},{}],11:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) { +var util = _dereq_("./util"); +var CancellationError = Promise.CancellationError; +var errorObj = util.errorObj; +var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER); + +function PassThroughHandlerContext(promise, type, handler) { + this.promise = promise; + this.type = type; + this.handler = handler; + this.called = false; + this.cancelPromise = null; +} + +PassThroughHandlerContext.prototype.isFinallyHandler = function() { + return this.type === 0; +}; + +function FinallyHandlerCancelReaction(finallyHandler) { + this.finallyHandler = finallyHandler; +} + +FinallyHandlerCancelReaction.prototype._resultCancelled = function() { + checkCancel(this.finallyHandler); +}; + +function checkCancel(ctx, reason) { + if (ctx.cancelPromise != null) { + if (arguments.length > 1) { + ctx.cancelPromise._reject(reason); + } else { + ctx.cancelPromise._cancel(); + } + ctx.cancelPromise = null; + return true; + } + return false; +} + +function succeed() { + return finallyHandler.call(this, this.promise._target()._settledValue()); +} +function fail(reason) { + if (checkCancel(this, reason)) return; + errorObj.e = reason; + return errorObj; +} +function finallyHandler(reasonOrValue) { + var promise = this.promise; + var handler = this.handler; + + if (!this.called) { + this.called = true; + var ret = this.isFinallyHandler() + ? handler.call(promise._boundValue()) + : handler.call(promise._boundValue(), reasonOrValue); + if (ret === NEXT_FILTER) { + return ret; + } else if (ret !== undefined) { + promise._setReturnedNonUndefined(); + var maybePromise = tryConvertToPromise(ret, promise); + if (maybePromise instanceof Promise) { + if (this.cancelPromise != null) { + if (maybePromise._isCancelled()) { + var reason = + new CancellationError("late cancellation observer"); + promise._attachExtraTrace(reason); + errorObj.e = reason; + return errorObj; + } else if (maybePromise.isPending()) { + maybePromise._attachCancellationCallback( + new FinallyHandlerCancelReaction(this)); + } + } + return maybePromise._then( + succeed, fail, undefined, this, undefined); + } + } + } + + if (promise.isRejected()) { + checkCancel(this); + errorObj.e = reasonOrValue; + return errorObj; + } else { + checkCancel(this); + return reasonOrValue; + } +} + +Promise.prototype._passThrough = function(handler, type, success, fail) { + if (typeof handler !== "function") return this.then(); + return this._then(success, + fail, + undefined, + new PassThroughHandlerContext(this, type, handler), + undefined); +}; + +Promise.prototype.lastly = +Promise.prototype["finally"] = function (handler) { + return this._passThrough(handler, + 0, + finallyHandler, + finallyHandler); +}; + + +Promise.prototype.tap = function (handler) { + return this._passThrough(handler, 1, finallyHandler); +}; + +Promise.prototype.tapCatch = function (handlerOrPredicate) { + var len = arguments.length; + if(len === 1) { + return this._passThrough(handlerOrPredicate, + 1, + undefined, + finallyHandler); + } else { + var catchInstances = new Array(len - 1), + j = 0, i; + for (i = 0; i < len - 1; ++i) { + var item = arguments[i]; + if (util.isObject(item)) { + catchInstances[j++] = item; + } else { + return Promise.reject(new TypeError( + "tapCatch statement predicate: " + + "expecting an object but got " + util.classString(item) + )); + } + } + catchInstances.length = j; + var handler = arguments[i]; + return this._passThrough(catchFilter(catchInstances, handler, this), + 1, + undefined, + finallyHandler); + } + +}; + +return PassThroughHandlerContext; +}; + +},{"./catch_filter":5,"./util":21}],12:[function(_dereq_,module,exports){ +"use strict"; +module.exports = +function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, + getDomain) { +var util = _dereq_("./util"); +var canEvaluate = util.canEvaluate; +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var reject; + +if (!true) { +if (canEvaluate) { + var thenCallback = function(i) { + return new Function("value", "holder", " \n\ + 'use strict'; \n\ + holder.pIndex = value; \n\ + holder.checkFulfillment(this); \n\ + ".replace(/Index/g, i)); + }; + + var promiseSetter = function(i) { + return new Function("promise", "holder", " \n\ + 'use strict'; \n\ + holder.pIndex = promise; \n\ + ".replace(/Index/g, i)); + }; + + var generateHolderClass = function(total) { + var props = new Array(total); + for (var i = 0; i < props.length; ++i) { + props[i] = "this.p" + (i+1); + } + var assignment = props.join(" = ") + " = null;"; + var cancellationCode= "var promise;\n" + props.map(function(prop) { + return " \n\ + promise = " + prop + "; \n\ + if (promise instanceof Promise) { \n\ + promise.cancel(); \n\ + } \n\ + "; + }).join("\n"); + var passedArguments = props.join(", "); + var name = "Holder$" + total; + + + var code = "return function(tryCatch, errorObj, Promise, async) { \n\ + 'use strict'; \n\ + function [TheName](fn) { \n\ + [TheProperties] \n\ + this.fn = fn; \n\ + this.asyncNeeded = true; \n\ + this.now = 0; \n\ + } \n\ + \n\ + [TheName].prototype._callFunction = function(promise) { \n\ + promise._pushContext(); \n\ + var ret = tryCatch(this.fn)([ThePassedArguments]); \n\ + promise._popContext(); \n\ + if (ret === errorObj) { \n\ + promise._rejectCallback(ret.e, false); \n\ + } else { \n\ + promise._resolveCallback(ret); \n\ + } \n\ + }; \n\ + \n\ + [TheName].prototype.checkFulfillment = function(promise) { \n\ + var now = ++this.now; \n\ + if (now === [TheTotal]) { \n\ + if (this.asyncNeeded) { \n\ + async.invoke(this._callFunction, this, promise); \n\ + } else { \n\ + this._callFunction(promise); \n\ + } \n\ + \n\ + } \n\ + }; \n\ + \n\ + [TheName].prototype._resultCancelled = function() { \n\ + [CancellationCode] \n\ + }; \n\ + \n\ + return [TheName]; \n\ + }(tryCatch, errorObj, Promise, async); \n\ + "; + + code = code.replace(/\[TheName\]/g, name) + .replace(/\[TheTotal\]/g, total) + .replace(/\[ThePassedArguments\]/g, passedArguments) + .replace(/\[TheProperties\]/g, assignment) + .replace(/\[CancellationCode\]/g, cancellationCode); + + return new Function("tryCatch", "errorObj", "Promise", "async", code) + (tryCatch, errorObj, Promise, async); + }; + + var holderClasses = []; + var thenCallbacks = []; + var promiseSetters = []; + + for (var i = 0; i < 8; ++i) { + holderClasses.push(generateHolderClass(i + 1)); + thenCallbacks.push(thenCallback(i + 1)); + promiseSetters.push(promiseSetter(i + 1)); + } + + reject = function (reason) { + this._reject(reason); + }; +}} + +Promise.join = function () { + var last = arguments.length - 1; + var fn; + if (last > 0 && typeof arguments[last] === "function") { + fn = arguments[last]; + if (!true) { + if (last <= 8 && canEvaluate) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + var HolderClass = holderClasses[last - 1]; + var holder = new HolderClass(fn); + var callbacks = thenCallbacks; + + for (var i = 0; i < last; ++i) { + var maybePromise = tryConvertToPromise(arguments[i], ret); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + var bitField = maybePromise._bitField; + ; + if (((bitField & 50397184) === 0)) { + maybePromise._then(callbacks[i], reject, + undefined, ret, holder); + promiseSetters[i](maybePromise, holder); + holder.asyncNeeded = false; + } else if (((bitField & 33554432) !== 0)) { + callbacks[i].call(ret, + maybePromise._value(), holder); + } else if (((bitField & 16777216) !== 0)) { + ret._reject(maybePromise._reason()); + } else { + ret._cancel(); + } + } else { + callbacks[i].call(ret, maybePromise, holder); + } + } + + if (!ret._isFateSealed()) { + if (holder.asyncNeeded) { + var domain = getDomain(); + if (domain !== null) { + holder.fn = util.domainBind(domain, holder.fn); + } + } + ret._setAsyncGuaranteed(); + ret._setOnCancel(holder); + } + return ret; + } + } + } + var args = [].slice.call(arguments);; + if (fn) args.pop(); + var ret = new PromiseArray(args).promise(); + return fn !== undefined ? ret.spread(fn) : ret; +}; + +}; + +},{"./util":21}],13:[function(_dereq_,module,exports){ +"use strict"; +module.exports = +function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) { +var util = _dereq_("./util"); +var tryCatch = util.tryCatch; + +Promise.method = function (fn) { + if (typeof fn !== "function") { + throw new Promise.TypeError("expecting a function but got " + util.classString(fn)); + } + return function () { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._pushContext(); + var value = tryCatch(fn).apply(this, arguments); + var promiseCreated = ret._popContext(); + debug.checkForgottenReturns( + value, promiseCreated, "Promise.method", ret); + ret._resolveFromSyncValue(value); + return ret; + }; +}; + +Promise.attempt = Promise["try"] = function (fn) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._pushContext(); + var value; + if (arguments.length > 1) { + debug.deprecated("calling Promise.try with more than 1 argument"); + var arg = arguments[1]; + var ctx = arguments[2]; + value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg) + : tryCatch(fn).call(ctx, arg); + } else { + value = tryCatch(fn)(); + } + var promiseCreated = ret._popContext(); + debug.checkForgottenReturns( + value, promiseCreated, "Promise.try", ret); + ret._resolveFromSyncValue(value); + return ret; +}; + +Promise.prototype._resolveFromSyncValue = function (value) { + if (value === util.errorObj) { + this._rejectCallback(value.e, false); + } else { + this._resolveCallback(value, true); + } +}; +}; + +},{"./util":21}],14:[function(_dereq_,module,exports){ +"use strict"; +var util = _dereq_("./util"); +var maybeWrapAsError = util.maybeWrapAsError; +var errors = _dereq_("./errors"); +var OperationalError = errors.OperationalError; +var es5 = _dereq_("./es5"); + +function isUntypedError(obj) { + return obj instanceof Error && + es5.getPrototypeOf(obj) === Error.prototype; +} + +var rErrorKey = /^(?:name|message|stack|cause)$/; +function wrapAsOperationalError(obj) { + var ret; + if (isUntypedError(obj)) { + ret = new OperationalError(obj); + ret.name = obj.name; + ret.message = obj.message; + ret.stack = obj.stack; + var keys = es5.keys(obj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (!rErrorKey.test(key)) { + ret[key] = obj[key]; + } + } + return ret; + } + util.markAsOriginatingFromRejection(obj); + return obj; +} + +function nodebackForPromise(promise, multiArgs) { + return function(err, value) { + if (promise === null) return; + if (err) { + var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); + promise._attachExtraTrace(wrapped); + promise._reject(wrapped); + } else if (!multiArgs) { + promise._fulfill(value); + } else { + var args = [].slice.call(arguments, 1);; + promise._fulfill(args); + } + promise = null; + }; +} + +module.exports = nodebackForPromise; + +},{"./errors":9,"./es5":10,"./util":21}],15:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function() { +var makeSelfResolutionError = function () { + return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a"); +}; +var reflectHandler = function() { + return new Promise.PromiseInspection(this._target()); +}; +var apiRejection = function(msg) { + return Promise.reject(new TypeError(msg)); +}; +function Proxyable() {} +var UNDEFINED_BINDING = {}; +var util = _dereq_("./util"); + +var getDomain; +if (util.isNode) { + getDomain = function() { + var ret = process.domain; + if (ret === undefined) ret = null; + return ret; + }; +} else { + getDomain = function() { + return null; + }; +} +util.notEnumerableProp(Promise, "_getDomain", getDomain); + +var es5 = _dereq_("./es5"); +var Async = _dereq_("./async"); +var async = new Async(); +es5.defineProperty(Promise, "_async", {value: async}); +var errors = _dereq_("./errors"); +var TypeError = Promise.TypeError = errors.TypeError; +Promise.RangeError = errors.RangeError; +var CancellationError = Promise.CancellationError = errors.CancellationError; +Promise.TimeoutError = errors.TimeoutError; +Promise.OperationalError = errors.OperationalError; +Promise.RejectionError = errors.OperationalError; +Promise.AggregateError = errors.AggregateError; +var INTERNAL = function(){}; +var APPLY = {}; +var NEXT_FILTER = {}; +var tryConvertToPromise = _dereq_("./thenables")(Promise, INTERNAL); +var PromiseArray = + _dereq_("./promise_array")(Promise, INTERNAL, + tryConvertToPromise, apiRejection, Proxyable); +var Context = _dereq_("./context")(Promise); + /*jshint unused:false*/ +var createContext = Context.create; +var debug = _dereq_("./debuggability")(Promise, Context); +var CapturedTrace = debug.CapturedTrace; +var PassThroughHandlerContext = + _dereq_("./finally")(Promise, tryConvertToPromise, NEXT_FILTER); +var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER); +var nodebackForPromise = _dereq_("./nodeback"); +var errorObj = util.errorObj; +var tryCatch = util.tryCatch; +function check(self, executor) { + if (self == null || self.constructor !== Promise) { + throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + if (typeof executor !== "function") { + throw new TypeError("expecting a function but got " + util.classString(executor)); + } + +} + +function Promise(executor) { + if (executor !== INTERNAL) { + check(this, executor); + } + this._bitField = 0; + this._fulfillmentHandler0 = undefined; + this._rejectionHandler0 = undefined; + this._promise0 = undefined; + this._receiver0 = undefined; + this._resolveFromExecutor(executor); + this._promiseCreated(); + this._fireEvent("promiseCreated", this); +} + +Promise.prototype.toString = function () { + return "[object Promise]"; +}; + +Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { + var len = arguments.length; + if (len > 1) { + var catchInstances = new Array(len - 1), + j = 0, i; + for (i = 0; i < len - 1; ++i) { + var item = arguments[i]; + if (util.isObject(item)) { + catchInstances[j++] = item; + } else { + return apiRejection("Catch statement predicate: " + + "expecting an object but got " + util.classString(item)); + } + } + catchInstances.length = j; + fn = arguments[i]; + return this.then(undefined, catchFilter(catchInstances, fn, this)); + } + return this.then(undefined, fn); +}; + +Promise.prototype.reflect = function () { + return this._then(reflectHandler, + reflectHandler, undefined, this, undefined); +}; + +Promise.prototype.then = function (didFulfill, didReject) { + if (debug.warnings() && arguments.length > 0 && + typeof didFulfill !== "function" && + typeof didReject !== "function") { + var msg = ".then() only accepts functions but was passed: " + + util.classString(didFulfill); + if (arguments.length > 1) { + msg += ", " + util.classString(didReject); + } + this._warn(msg); + } + return this._then(didFulfill, didReject, undefined, undefined, undefined); +}; + +Promise.prototype.done = function (didFulfill, didReject) { + var promise = + this._then(didFulfill, didReject, undefined, undefined, undefined); + promise._setIsFinal(); +}; + +Promise.prototype.spread = function (fn) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + return this.all()._then(fn, undefined, undefined, APPLY, undefined); +}; + +Promise.prototype.toJSON = function () { + var ret = { + isFulfilled: false, + isRejected: false, + fulfillmentValue: undefined, + rejectionReason: undefined + }; + if (this.isFulfilled()) { + ret.fulfillmentValue = this.value(); + ret.isFulfilled = true; + } else if (this.isRejected()) { + ret.rejectionReason = this.reason(); + ret.isRejected = true; + } + return ret; +}; + +Promise.prototype.all = function () { + if (arguments.length > 0) { + this._warn(".all() was passed arguments but it does not take any"); + } + return new PromiseArray(this).promise(); +}; + +Promise.prototype.error = function (fn) { + return this.caught(util.originatesFromRejection, fn); +}; + +Promise.getNewLibraryCopy = module.exports; + +Promise.is = function (val) { + return val instanceof Promise; +}; + +Promise.fromNode = Promise.fromCallback = function(fn) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs + : false; + var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs)); + if (result === errorObj) { + ret._rejectCallback(result.e, true); + } + if (!ret._isFateSealed()) ret._setAsyncGuaranteed(); + return ret; +}; + +Promise.all = function (promises) { + return new PromiseArray(promises).promise(); +}; + +Promise.cast = function (obj) { + var ret = tryConvertToPromise(obj); + if (!(ret instanceof Promise)) { + ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._setFulfilled(); + ret._rejectionHandler0 = obj; + } + return ret; +}; + +Promise.resolve = Promise.fulfilled = Promise.cast; + +Promise.reject = Promise.rejected = function (reason) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._rejectCallback(reason, true); + return ret; +}; + +Promise.setScheduler = function(fn) { + if (typeof fn !== "function") { + throw new TypeError("expecting a function but got " + util.classString(fn)); + } + return async.setScheduler(fn); +}; + +Promise.prototype._then = function ( + didFulfill, + didReject, + _, receiver, + internalData +) { + var haveInternalData = internalData !== undefined; + var promise = haveInternalData ? internalData : new Promise(INTERNAL); + var target = this._target(); + var bitField = target._bitField; + + if (!haveInternalData) { + promise._propagateFrom(this, 3); + promise._captureStackTrace(); + if (receiver === undefined && + ((this._bitField & 2097152) !== 0)) { + if (!((bitField & 50397184) === 0)) { + receiver = this._boundValue(); + } else { + receiver = target === this ? undefined : this._boundTo; + } + } + this._fireEvent("promiseChained", this, promise); + } + + var domain = getDomain(); + if (!((bitField & 50397184) === 0)) { + var handler, value, settler = target._settlePromiseCtx; + if (((bitField & 33554432) !== 0)) { + value = target._rejectionHandler0; + handler = didFulfill; + } else if (((bitField & 16777216) !== 0)) { + value = target._fulfillmentHandler0; + handler = didReject; + target._unsetRejectionIsUnhandled(); + } else { + settler = target._settlePromiseLateCancellationObserver; + value = new CancellationError("late cancellation observer"); + target._attachExtraTrace(value); + handler = didReject; + } + + async.invoke(settler, target, { + handler: domain === null ? handler + : (typeof handler === "function" && + util.domainBind(domain, handler)), + promise: promise, + receiver: receiver, + value: value + }); + } else { + target._addCallbacks(didFulfill, didReject, promise, receiver, domain); + } + + return promise; +}; + +Promise.prototype._length = function () { + return this._bitField & 65535; +}; + +Promise.prototype._isFateSealed = function () { + return (this._bitField & 117506048) !== 0; +}; + +Promise.prototype._isFollowing = function () { + return (this._bitField & 67108864) === 67108864; +}; + +Promise.prototype._setLength = function (len) { + this._bitField = (this._bitField & -65536) | + (len & 65535); +}; + +Promise.prototype._setFulfilled = function () { + this._bitField = this._bitField | 33554432; + this._fireEvent("promiseFulfilled", this); +}; + +Promise.prototype._setRejected = function () { + this._bitField = this._bitField | 16777216; + this._fireEvent("promiseRejected", this); +}; + +Promise.prototype._setFollowing = function () { + this._bitField = this._bitField | 67108864; + this._fireEvent("promiseResolved", this); +}; + +Promise.prototype._setIsFinal = function () { + this._bitField = this._bitField | 4194304; +}; + +Promise.prototype._isFinal = function () { + return (this._bitField & 4194304) > 0; +}; + +Promise.prototype._unsetCancelled = function() { + this._bitField = this._bitField & (~65536); +}; + +Promise.prototype._setCancelled = function() { + this._bitField = this._bitField | 65536; + this._fireEvent("promiseCancelled", this); +}; + +Promise.prototype._setWillBeCancelled = function() { + this._bitField = this._bitField | 8388608; +}; + +Promise.prototype._setAsyncGuaranteed = function() { + if (async.hasCustomScheduler()) return; + this._bitField = this._bitField | 134217728; +}; + +Promise.prototype._receiverAt = function (index) { + var ret = index === 0 ? this._receiver0 : this[ + index * 4 - 4 + 3]; + if (ret === UNDEFINED_BINDING) { + return undefined; + } else if (ret === undefined && this._isBound()) { + return this._boundValue(); + } + return ret; +}; + +Promise.prototype._promiseAt = function (index) { + return this[ + index * 4 - 4 + 2]; +}; + +Promise.prototype._fulfillmentHandlerAt = function (index) { + return this[ + index * 4 - 4 + 0]; +}; + +Promise.prototype._rejectionHandlerAt = function (index) { + return this[ + index * 4 - 4 + 1]; +}; + +Promise.prototype._boundValue = function() {}; + +Promise.prototype._migrateCallback0 = function (follower) { + var bitField = follower._bitField; + var fulfill = follower._fulfillmentHandler0; + var reject = follower._rejectionHandler0; + var promise = follower._promise0; + var receiver = follower._receiverAt(0); + if (receiver === undefined) receiver = UNDEFINED_BINDING; + this._addCallbacks(fulfill, reject, promise, receiver, null); +}; + +Promise.prototype._migrateCallbackAt = function (follower, index) { + var fulfill = follower._fulfillmentHandlerAt(index); + var reject = follower._rejectionHandlerAt(index); + var promise = follower._promiseAt(index); + var receiver = follower._receiverAt(index); + if (receiver === undefined) receiver = UNDEFINED_BINDING; + this._addCallbacks(fulfill, reject, promise, receiver, null); +}; + +Promise.prototype._addCallbacks = function ( + fulfill, + reject, + promise, + receiver, + domain +) { + var index = this._length(); + + if (index >= 65535 - 4) { + index = 0; + this._setLength(0); + } + + if (index === 0) { + this._promise0 = promise; + this._receiver0 = receiver; + if (typeof fulfill === "function") { + this._fulfillmentHandler0 = + domain === null ? fulfill : util.domainBind(domain, fulfill); + } + if (typeof reject === "function") { + this._rejectionHandler0 = + domain === null ? reject : util.domainBind(domain, reject); + } + } else { + var base = index * 4 - 4; + this[base + 2] = promise; + this[base + 3] = receiver; + if (typeof fulfill === "function") { + this[base + 0] = + domain === null ? fulfill : util.domainBind(domain, fulfill); + } + if (typeof reject === "function") { + this[base + 1] = + domain === null ? reject : util.domainBind(domain, reject); + } + } + this._setLength(index + 1); + return index; +}; + +Promise.prototype._proxy = function (proxyable, arg) { + this._addCallbacks(undefined, undefined, arg, proxyable, null); +}; + +Promise.prototype._resolveCallback = function(value, shouldBind) { + if (((this._bitField & 117506048) !== 0)) return; + if (value === this) + return this._rejectCallback(makeSelfResolutionError(), false); + var maybePromise = tryConvertToPromise(value, this); + if (!(maybePromise instanceof Promise)) return this._fulfill(value); + + if (shouldBind) this._propagateFrom(maybePromise, 2); + + var promise = maybePromise._target(); + + if (promise === this) { + this._reject(makeSelfResolutionError()); + return; + } + + var bitField = promise._bitField; + if (((bitField & 50397184) === 0)) { + var len = this._length(); + if (len > 0) promise._migrateCallback0(this); + for (var i = 1; i < len; ++i) { + promise._migrateCallbackAt(this, i); + } + this._setFollowing(); + this._setLength(0); + this._setFollowee(promise); + } else if (((bitField & 33554432) !== 0)) { + this._fulfill(promise._value()); + } else if (((bitField & 16777216) !== 0)) { + this._reject(promise._reason()); + } else { + var reason = new CancellationError("late cancellation observer"); + promise._attachExtraTrace(reason); + this._reject(reason); + } +}; + +Promise.prototype._rejectCallback = +function(reason, synchronous, ignoreNonErrorWarnings) { + var trace = util.ensureErrorObject(reason); + var hasStack = trace === reason; + if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) { + var message = "a promise was rejected with a non-error: " + + util.classString(reason); + this._warn(message, true); + } + this._attachExtraTrace(trace, synchronous ? hasStack : false); + this._reject(reason); +}; + +Promise.prototype._resolveFromExecutor = function (executor) { + if (executor === INTERNAL) return; + var promise = this; + this._captureStackTrace(); + this._pushContext(); + var synchronous = true; + var r = this._execute(executor, function(value) { + promise._resolveCallback(value); + }, function (reason) { + promise._rejectCallback(reason, synchronous); + }); + synchronous = false; + this._popContext(); + + if (r !== undefined) { + promise._rejectCallback(r, true); + } +}; + +Promise.prototype._settlePromiseFromHandler = function ( + handler, receiver, value, promise +) { + var bitField = promise._bitField; + if (((bitField & 65536) !== 0)) return; + promise._pushContext(); + var x; + if (receiver === APPLY) { + if (!value || typeof value.length !== "number") { + x = errorObj; + x.e = new TypeError("cannot .spread() a non-array: " + + util.classString(value)); + } else { + x = tryCatch(handler).apply(this._boundValue(), value); + } + } else { + x = tryCatch(handler).call(receiver, value); + } + var promiseCreated = promise._popContext(); + bitField = promise._bitField; + if (((bitField & 65536) !== 0)) return; + + if (x === NEXT_FILTER) { + promise._reject(value); + } else if (x === errorObj) { + promise._rejectCallback(x.e, false); + } else { + debug.checkForgottenReturns(x, promiseCreated, "", promise, this); + promise._resolveCallback(x); + } +}; + +Promise.prototype._target = function() { + var ret = this; + while (ret._isFollowing()) ret = ret._followee(); + return ret; +}; + +Promise.prototype._followee = function() { + return this._rejectionHandler0; +}; + +Promise.prototype._setFollowee = function(promise) { + this._rejectionHandler0 = promise; +}; + +Promise.prototype._settlePromise = function(promise, handler, receiver, value) { + var isPromise = promise instanceof Promise; + var bitField = this._bitField; + var asyncGuaranteed = ((bitField & 134217728) !== 0); + if (((bitField & 65536) !== 0)) { + if (isPromise) promise._invokeInternalOnCancel(); + + if (receiver instanceof PassThroughHandlerContext && + receiver.isFinallyHandler()) { + receiver.cancelPromise = promise; + if (tryCatch(handler).call(receiver, value) === errorObj) { + promise._reject(errorObj.e); + } + } else if (handler === reflectHandler) { + promise._fulfill(reflectHandler.call(receiver)); + } else if (receiver instanceof Proxyable) { + receiver._promiseCancelled(promise); + } else if (isPromise || promise instanceof PromiseArray) { + promise._cancel(); + } else { + receiver.cancel(); + } + } else if (typeof handler === "function") { + if (!isPromise) { + handler.call(receiver, value, promise); + } else { + if (asyncGuaranteed) promise._setAsyncGuaranteed(); + this._settlePromiseFromHandler(handler, receiver, value, promise); + } + } else if (receiver instanceof Proxyable) { + if (!receiver._isResolved()) { + if (((bitField & 33554432) !== 0)) { + receiver._promiseFulfilled(value, promise); + } else { + receiver._promiseRejected(value, promise); + } + } + } else if (isPromise) { + if (asyncGuaranteed) promise._setAsyncGuaranteed(); + if (((bitField & 33554432) !== 0)) { + promise._fulfill(value); + } else { + promise._reject(value); + } + } +}; + +Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) { + var handler = ctx.handler; + var promise = ctx.promise; + var receiver = ctx.receiver; + var value = ctx.value; + if (typeof handler === "function") { + if (!(promise instanceof Promise)) { + handler.call(receiver, value, promise); + } else { + this._settlePromiseFromHandler(handler, receiver, value, promise); + } + } else if (promise instanceof Promise) { + promise._reject(value); + } +}; + +Promise.prototype._settlePromiseCtx = function(ctx) { + this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value); +}; + +Promise.prototype._settlePromise0 = function(handler, value, bitField) { + var promise = this._promise0; + var receiver = this._receiverAt(0); + this._promise0 = undefined; + this._receiver0 = undefined; + this._settlePromise(promise, handler, receiver, value); +}; + +Promise.prototype._clearCallbackDataAtIndex = function(index) { + var base = index * 4 - 4; + this[base + 2] = + this[base + 3] = + this[base + 0] = + this[base + 1] = undefined; +}; + +Promise.prototype._fulfill = function (value) { + var bitField = this._bitField; + if (((bitField & 117506048) >>> 16)) return; + if (value === this) { + var err = makeSelfResolutionError(); + this._attachExtraTrace(err); + return this._reject(err); + } + this._setFulfilled(); + this._rejectionHandler0 = value; + + if ((bitField & 65535) > 0) { + if (((bitField & 134217728) !== 0)) { + this._settlePromises(); + } else { + async.settlePromises(this); + } + } +}; + +Promise.prototype._reject = function (reason) { + var bitField = this._bitField; + if (((bitField & 117506048) >>> 16)) return; + this._setRejected(); + this._fulfillmentHandler0 = reason; + + if (this._isFinal()) { + return async.fatalError(reason, util.isNode); + } + + if ((bitField & 65535) > 0) { + async.settlePromises(this); + } else { + this._ensurePossibleRejectionHandled(); + } +}; + +Promise.prototype._fulfillPromises = function (len, value) { + for (var i = 1; i < len; i++) { + var handler = this._fulfillmentHandlerAt(i); + var promise = this._promiseAt(i); + var receiver = this._receiverAt(i); + this._clearCallbackDataAtIndex(i); + this._settlePromise(promise, handler, receiver, value); + } +}; + +Promise.prototype._rejectPromises = function (len, reason) { + for (var i = 1; i < len; i++) { + var handler = this._rejectionHandlerAt(i); + var promise = this._promiseAt(i); + var receiver = this._receiverAt(i); + this._clearCallbackDataAtIndex(i); + this._settlePromise(promise, handler, receiver, reason); + } +}; + +Promise.prototype._settlePromises = function () { + var bitField = this._bitField; + var len = (bitField & 65535); + + if (len > 0) { + if (((bitField & 16842752) !== 0)) { + var reason = this._fulfillmentHandler0; + this._settlePromise0(this._rejectionHandler0, reason, bitField); + this._rejectPromises(len, reason); + } else { + var value = this._rejectionHandler0; + this._settlePromise0(this._fulfillmentHandler0, value, bitField); + this._fulfillPromises(len, value); + } + this._setLength(0); + } + this._clearCancellationData(); +}; + +Promise.prototype._settledValue = function() { + var bitField = this._bitField; + if (((bitField & 33554432) !== 0)) { + return this._rejectionHandler0; + } else if (((bitField & 16777216) !== 0)) { + return this._fulfillmentHandler0; + } +}; + +function deferResolve(v) {this.promise._resolveCallback(v);} +function deferReject(v) {this.promise._rejectCallback(v, false);} + +Promise.defer = Promise.pending = function() { + debug.deprecated("Promise.defer", "new Promise"); + var promise = new Promise(INTERNAL); + return { + promise: promise, + resolve: deferResolve, + reject: deferReject + }; +}; + +util.notEnumerableProp(Promise, + "_makeSelfResolutionError", + makeSelfResolutionError); + +_dereq_("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection, + debug); +_dereq_("./bind")(Promise, INTERNAL, tryConvertToPromise, debug); +_dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug); +_dereq_("./direct_resolve")(Promise); +_dereq_("./synchronous_inspection")(Promise); +_dereq_("./join")( + Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain); +Promise.Promise = Promise; +Promise.version = "3.5.0"; + + util.toFastProperties(Promise); + util.toFastProperties(Promise.prototype); + function fillTypes(value) { + var p = new Promise(INTERNAL); + p._fulfillmentHandler0 = value; + p._rejectionHandler0 = value; + p._promise0 = value; + p._receiver0 = value; + } + // Complete slack tracking, opt out of field-type tracking and + // stabilize map + fillTypes({a: 1}); + fillTypes({b: 2}); + fillTypes({c: 3}); + fillTypes(1); + fillTypes(function(){}); + fillTypes(undefined); + fillTypes(false); + fillTypes(new Promise(INTERNAL)); + debug.setBounds(Async.firstLineError, util.lastLineError); + return Promise; + +}; + +},{"./async":1,"./bind":2,"./cancel":4,"./catch_filter":5,"./context":6,"./debuggability":7,"./direct_resolve":8,"./errors":9,"./es5":10,"./finally":11,"./join":12,"./method":13,"./nodeback":14,"./promise_array":16,"./synchronous_inspection":19,"./thenables":20,"./util":21}],16:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL, tryConvertToPromise, + apiRejection, Proxyable) { +var util = _dereq_("./util"); +var isArray = util.isArray; + +function toResolutionValue(val) { + switch(val) { + case -2: return []; + case -3: return {}; + case -6: return new Map(); + } +} + +function PromiseArray(values) { + var promise = this._promise = new Promise(INTERNAL); + if (values instanceof Promise) { + promise._propagateFrom(values, 3); + } + promise._setOnCancel(this); + this._values = values; + this._length = 0; + this._totalResolved = 0; + this._init(undefined, -2); +} +util.inherits(PromiseArray, Proxyable); + +PromiseArray.prototype.length = function () { + return this._length; +}; + +PromiseArray.prototype.promise = function () { + return this._promise; +}; + +PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { + var values = tryConvertToPromise(this._values, this._promise); + if (values instanceof Promise) { + values = values._target(); + var bitField = values._bitField; + ; + this._values = values; + + if (((bitField & 50397184) === 0)) { + this._promise._setAsyncGuaranteed(); + return values._then( + init, + this._reject, + undefined, + this, + resolveValueIfEmpty + ); + } else if (((bitField & 33554432) !== 0)) { + values = values._value(); + } else if (((bitField & 16777216) !== 0)) { + return this._reject(values._reason()); + } else { + return this._cancel(); + } + } + values = util.asArray(values); + if (values === null) { + var err = apiRejection( + "expecting an array or an iterable object but got " + util.classString(values)).reason(); + this._promise._rejectCallback(err, false); + return; + } + + if (values.length === 0) { + if (resolveValueIfEmpty === -5) { + this._resolveEmptyArray(); + } + else { + this._resolve(toResolutionValue(resolveValueIfEmpty)); + } + return; + } + this._iterate(values); +}; + +PromiseArray.prototype._iterate = function(values) { + var len = this.getActualLength(values.length); + this._length = len; + this._values = this.shouldCopyValues() ? new Array(len) : this._values; + var result = this._promise; + var isResolved = false; + var bitField = null; + for (var i = 0; i < len; ++i) { + var maybePromise = tryConvertToPromise(values[i], result); + + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + bitField = maybePromise._bitField; + } else { + bitField = null; + } + + if (isResolved) { + if (bitField !== null) { + maybePromise.suppressUnhandledRejections(); + } + } else if (bitField !== null) { + if (((bitField & 50397184) === 0)) { + maybePromise._proxy(this, i); + this._values[i] = maybePromise; + } else if (((bitField & 33554432) !== 0)) { + isResolved = this._promiseFulfilled(maybePromise._value(), i); + } else if (((bitField & 16777216) !== 0)) { + isResolved = this._promiseRejected(maybePromise._reason(), i); + } else { + isResolved = this._promiseCancelled(i); + } + } else { + isResolved = this._promiseFulfilled(maybePromise, i); + } + } + if (!isResolved) result._setAsyncGuaranteed(); +}; + +PromiseArray.prototype._isResolved = function () { + return this._values === null; +}; + +PromiseArray.prototype._resolve = function (value) { + this._values = null; + this._promise._fulfill(value); +}; + +PromiseArray.prototype._cancel = function() { + if (this._isResolved() || !this._promise._isCancellable()) return; + this._values = null; + this._promise._cancel(); +}; + +PromiseArray.prototype._reject = function (reason) { + this._values = null; + this._promise._rejectCallback(reason, false); +}; + +PromiseArray.prototype._promiseFulfilled = function (value, index) { + this._values[index] = value; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + this._resolve(this._values); + return true; + } + return false; +}; + +PromiseArray.prototype._promiseCancelled = function() { + this._cancel(); + return true; +}; + +PromiseArray.prototype._promiseRejected = function (reason) { + this._totalResolved++; + this._reject(reason); + return true; +}; + +PromiseArray.prototype._resultCancelled = function() { + if (this._isResolved()) return; + var values = this._values; + this._cancel(); + if (values instanceof Promise) { + values.cancel(); + } else { + for (var i = 0; i < values.length; ++i) { + if (values[i] instanceof Promise) { + values[i].cancel(); + } + } + } +}; + +PromiseArray.prototype.shouldCopyValues = function () { + return true; +}; + +PromiseArray.prototype.getActualLength = function (len) { + return len; +}; + +return PromiseArray; +}; + +},{"./util":21}],17:[function(_dereq_,module,exports){ +"use strict"; +function arrayMove(src, srcIndex, dst, dstIndex, len) { + for (var j = 0; j < len; ++j) { + dst[j + dstIndex] = src[j + srcIndex]; + src[j + srcIndex] = void 0; + } +} + +function Queue(capacity) { + this._capacity = capacity; + this._length = 0; + this._front = 0; +} + +Queue.prototype._willBeOverCapacity = function (size) { + return this._capacity < size; +}; + +Queue.prototype._pushOne = function (arg) { + var length = this.length(); + this._checkCapacity(length + 1); + var i = (this._front + length) & (this._capacity - 1); + this[i] = arg; + this._length = length + 1; +}; + +Queue.prototype.push = function (fn, receiver, arg) { + var length = this.length() + 3; + if (this._willBeOverCapacity(length)) { + this._pushOne(fn); + this._pushOne(receiver); + this._pushOne(arg); + return; + } + var j = this._front + length - 3; + this._checkCapacity(length); + var wrapMask = this._capacity - 1; + this[(j + 0) & wrapMask] = fn; + this[(j + 1) & wrapMask] = receiver; + this[(j + 2) & wrapMask] = arg; + this._length = length; +}; + +Queue.prototype.shift = function () { + var front = this._front, + ret = this[front]; + + this[front] = undefined; + this._front = (front + 1) & (this._capacity - 1); + this._length--; + return ret; +}; + +Queue.prototype.length = function () { + return this._length; +}; + +Queue.prototype._checkCapacity = function (size) { + if (this._capacity < size) { + this._resizeTo(this._capacity << 1); + } +}; + +Queue.prototype._resizeTo = function (capacity) { + var oldCapacity = this._capacity; + this._capacity = capacity; + var front = this._front; + var length = this._length; + var moveItemsCount = (front + length) & (oldCapacity - 1); + arrayMove(this, 0, this, oldCapacity, moveItemsCount); +}; + +module.exports = Queue; + +},{}],18:[function(_dereq_,module,exports){ +"use strict"; +var util = _dereq_("./util"); +var schedule; +var noAsyncScheduler = function() { + throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a"); +}; +var NativePromise = util.getNativePromise(); +if (util.isNode && typeof MutationObserver === "undefined") { + var GlobalSetImmediate = global.setImmediate; + var ProcessNextTick = process.nextTick; + schedule = util.isRecentNode + ? function(fn) { GlobalSetImmediate.call(global, fn); } + : function(fn) { ProcessNextTick.call(process, fn); }; +} else if (typeof NativePromise === "function" && + typeof NativePromise.resolve === "function") { + var nativePromise = NativePromise.resolve(); + schedule = function(fn) { + nativePromise.then(fn); + }; +} else if ((typeof MutationObserver !== "undefined") && + !(typeof window !== "undefined" && + window.navigator && + (window.navigator.standalone || window.cordova))) { + schedule = (function() { + var div = document.createElement("div"); + var opts = {attributes: true}; + var toggleScheduled = false; + var div2 = document.createElement("div"); + var o2 = new MutationObserver(function() { + div.classList.toggle("foo"); + toggleScheduled = false; + }); + o2.observe(div2, opts); + + var scheduleToggle = function() { + if (toggleScheduled) return; + toggleScheduled = true; + div2.classList.toggle("foo"); + }; + + return function schedule(fn) { + var o = new MutationObserver(function() { + o.disconnect(); + fn(); + }); + o.observe(div, opts); + scheduleToggle(); + }; + })(); +} else if (typeof setImmediate !== "undefined") { + schedule = function (fn) { + setImmediate(fn); + }; +} else if (typeof setTimeout !== "undefined") { + schedule = function (fn) { + setTimeout(fn, 0); + }; +} else { + schedule = noAsyncScheduler; +} +module.exports = schedule; + +},{"./util":21}],19:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise) { +function PromiseInspection(promise) { + if (promise !== undefined) { + promise = promise._target(); + this._bitField = promise._bitField; + this._settledValueField = promise._isFateSealed() + ? promise._settledValue() : undefined; + } + else { + this._bitField = 0; + this._settledValueField = undefined; + } +} + +PromiseInspection.prototype._settledValue = function() { + return this._settledValueField; +}; + +var value = PromiseInspection.prototype.value = function () { + if (!this.isFulfilled()) { + throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + return this._settledValue(); +}; + +var reason = PromiseInspection.prototype.error = +PromiseInspection.prototype.reason = function () { + if (!this.isRejected()) { + throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + return this._settledValue(); +}; + +var isFulfilled = PromiseInspection.prototype.isFulfilled = function() { + return (this._bitField & 33554432) !== 0; +}; + +var isRejected = PromiseInspection.prototype.isRejected = function () { + return (this._bitField & 16777216) !== 0; +}; + +var isPending = PromiseInspection.prototype.isPending = function () { + return (this._bitField & 50397184) === 0; +}; + +var isResolved = PromiseInspection.prototype.isResolved = function () { + return (this._bitField & 50331648) !== 0; +}; + +PromiseInspection.prototype.isCancelled = function() { + return (this._bitField & 8454144) !== 0; +}; + +Promise.prototype.__isCancelled = function() { + return (this._bitField & 65536) === 65536; +}; + +Promise.prototype._isCancelled = function() { + return this._target().__isCancelled(); +}; + +Promise.prototype.isCancelled = function() { + return (this._target()._bitField & 8454144) !== 0; +}; + +Promise.prototype.isPending = function() { + return isPending.call(this._target()); +}; + +Promise.prototype.isRejected = function() { + return isRejected.call(this._target()); +}; + +Promise.prototype.isFulfilled = function() { + return isFulfilled.call(this._target()); +}; + +Promise.prototype.isResolved = function() { + return isResolved.call(this._target()); +}; + +Promise.prototype.value = function() { + return value.call(this._target()); +}; + +Promise.prototype.reason = function() { + var target = this._target(); + target._unsetRejectionIsUnhandled(); + return reason.call(target); +}; + +Promise.prototype._value = function() { + return this._settledValue(); +}; + +Promise.prototype._reason = function() { + this._unsetRejectionIsUnhandled(); + return this._settledValue(); +}; + +Promise.PromiseInspection = PromiseInspection; +}; + +},{}],20:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var util = _dereq_("./util"); +var errorObj = util.errorObj; +var isObject = util.isObject; + +function tryConvertToPromise(obj, context) { + if (isObject(obj)) { + if (obj instanceof Promise) return obj; + var then = getThen(obj); + if (then === errorObj) { + if (context) context._pushContext(); + var ret = Promise.reject(then.e); + if (context) context._popContext(); + return ret; + } else if (typeof then === "function") { + if (isAnyBluebirdPromise(obj)) { + var ret = new Promise(INTERNAL); + obj._then( + ret._fulfill, + ret._reject, + undefined, + ret, + null + ); + return ret; + } + return doThenable(obj, then, context); + } + } + return obj; +} + +function doGetThen(obj) { + return obj.then; +} + +function getThen(obj) { + try { + return doGetThen(obj); + } catch (e) { + errorObj.e = e; + return errorObj; + } +} + +var hasProp = {}.hasOwnProperty; +function isAnyBluebirdPromise(obj) { + try { + return hasProp.call(obj, "_promise0"); + } catch (e) { + return false; + } +} + +function doThenable(x, then, context) { + var promise = new Promise(INTERNAL); + var ret = promise; + if (context) context._pushContext(); + promise._captureStackTrace(); + if (context) context._popContext(); + var synchronous = true; + var result = util.tryCatch(then).call(x, resolve, reject); + synchronous = false; + + if (promise && result === errorObj) { + promise._rejectCallback(result.e, true, true); + promise = null; + } + + function resolve(value) { + if (!promise) return; + promise._resolveCallback(value); + promise = null; + } + + function reject(reason) { + if (!promise) return; + promise._rejectCallback(reason, synchronous, true); + promise = null; + } + return ret; +} + +return tryConvertToPromise; +}; + +},{"./util":21}],21:[function(_dereq_,module,exports){ +"use strict"; +var es5 = _dereq_("./es5"); +var canEvaluate = typeof navigator == "undefined"; + +var errorObj = {e: {}}; +var tryCatchTarget; +var globalObject = typeof self !== "undefined" ? self : + typeof window !== "undefined" ? window : + typeof global !== "undefined" ? global : + this !== undefined ? this : null; + +function tryCatcher() { + try { + var target = tryCatchTarget; + tryCatchTarget = null; + return target.apply(this, arguments); + } catch (e) { + errorObj.e = e; + return errorObj; + } +} +function tryCatch(fn) { + tryCatchTarget = fn; + return tryCatcher; +} + +var inherits = function(Child, Parent) { + var hasProp = {}.hasOwnProperty; + + function T() { + this.constructor = Child; + this.constructor$ = Parent; + for (var propertyName in Parent.prototype) { + if (hasProp.call(Parent.prototype, propertyName) && + propertyName.charAt(propertyName.length-1) !== "$" + ) { + this[propertyName + "$"] = Parent.prototype[propertyName]; + } + } + } + T.prototype = Parent.prototype; + Child.prototype = new T(); + return Child.prototype; +}; + + +function isPrimitive(val) { + return val == null || val === true || val === false || + typeof val === "string" || typeof val === "number"; + +} + +function isObject(value) { + return typeof value === "function" || + typeof value === "object" && value !== null; +} + +function maybeWrapAsError(maybeError) { + if (!isPrimitive(maybeError)) return maybeError; + + return new Error(safeToString(maybeError)); +} + +function withAppended(target, appendee) { + var len = target.length; + var ret = new Array(len + 1); + var i; + for (i = 0; i < len; ++i) { + ret[i] = target[i]; + } + ret[i] = appendee; + return ret; +} + +function getDataPropertyOrDefault(obj, key, defaultValue) { + if (es5.isES5) { + var desc = Object.getOwnPropertyDescriptor(obj, key); + + if (desc != null) { + return desc.get == null && desc.set == null + ? desc.value + : defaultValue; + } + } else { + return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined; + } +} + +function notEnumerableProp(obj, name, value) { + if (isPrimitive(obj)) return obj; + var descriptor = { + value: value, + configurable: true, + enumerable: false, + writable: true + }; + es5.defineProperty(obj, name, descriptor); + return obj; +} + +function thrower(r) { + throw r; +} + +var inheritedDataKeys = (function() { + var excludedPrototypes = [ + Array.prototype, + Object.prototype, + Function.prototype + ]; + + var isExcludedProto = function(val) { + for (var i = 0; i < excludedPrototypes.length; ++i) { + if (excludedPrototypes[i] === val) { + return true; + } + } + return false; + }; + + if (es5.isES5) { + var getKeys = Object.getOwnPropertyNames; + return function(obj) { + var ret = []; + var visitedKeys = Object.create(null); + while (obj != null && !isExcludedProto(obj)) { + var keys; + try { + keys = getKeys(obj); + } catch (e) { + return ret; + } + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (visitedKeys[key]) continue; + visitedKeys[key] = true; + var desc = Object.getOwnPropertyDescriptor(obj, key); + if (desc != null && desc.get == null && desc.set == null) { + ret.push(key); + } + } + obj = es5.getPrototypeOf(obj); + } + return ret; + }; + } else { + var hasProp = {}.hasOwnProperty; + return function(obj) { + if (isExcludedProto(obj)) return []; + var ret = []; + + /*jshint forin:false */ + enumeration: for (var key in obj) { + if (hasProp.call(obj, key)) { + ret.push(key); + } else { + for (var i = 0; i < excludedPrototypes.length; ++i) { + if (hasProp.call(excludedPrototypes[i], key)) { + continue enumeration; + } + } + ret.push(key); + } + } + return ret; + }; + } + +})(); + +var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/; +function isClass(fn) { + try { + if (typeof fn === "function") { + var keys = es5.names(fn.prototype); + + var hasMethods = es5.isES5 && keys.length > 1; + var hasMethodsOtherThanConstructor = keys.length > 0 && + !(keys.length === 1 && keys[0] === "constructor"); + var hasThisAssignmentAndStaticMethods = + thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0; + + if (hasMethods || hasMethodsOtherThanConstructor || + hasThisAssignmentAndStaticMethods) { + return true; + } + } + return false; + } catch (e) { + return false; + } +} + +function toFastProperties(obj) { + /*jshint -W027,-W055,-W031*/ + function FakeConstructor() {} + FakeConstructor.prototype = obj; + var l = 8; + while (l--) new FakeConstructor(); + return obj; + eval(obj); +} + +var rident = /^[a-z$_][a-z$_0-9]*$/i; +function isIdentifier(str) { + return rident.test(str); +} + +function filledRange(count, prefix, suffix) { + var ret = new Array(count); + for(var i = 0; i < count; ++i) { + ret[i] = prefix + i + suffix; + } + return ret; +} + +function safeToString(obj) { + try { + return obj + ""; + } catch (e) { + return "[no string representation]"; + } +} + +function isError(obj) { + return obj !== null && + typeof obj === "object" && + typeof obj.message === "string" && + typeof obj.name === "string"; +} + +function markAsOriginatingFromRejection(e) { + try { + notEnumerableProp(e, "isOperational", true); + } + catch(ignore) {} +} + +function originatesFromRejection(e) { + if (e == null) return false; + return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) || + e["isOperational"] === true); +} + +function canAttachTrace(obj) { + return isError(obj) && es5.propertyIsWritable(obj, "stack"); +} + +var ensureErrorObject = (function() { + if (!("stack" in new Error())) { + return function(value) { + if (canAttachTrace(value)) return value; + try {throw new Error(safeToString(value));} + catch(err) {return err;} + }; + } else { + return function(value) { + if (canAttachTrace(value)) return value; + return new Error(safeToString(value)); + }; + } +})(); + +function classString(obj) { + return {}.toString.call(obj); +} + +function copyDescriptors(from, to, filter) { + var keys = es5.names(from); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (filter(key)) { + try { + es5.defineProperty(to, key, es5.getDescriptor(from, key)); + } catch (ignore) {} + } + } +} + +var asArray = function(v) { + if (es5.isArray(v)) { + return v; + } + return null; +}; + +if (typeof Symbol !== "undefined" && Symbol.iterator) { + var ArrayFrom = typeof Array.from === "function" ? function(v) { + return Array.from(v); + } : function(v) { + var ret = []; + var it = v[Symbol.iterator](); + var itResult; + while (!((itResult = it.next()).done)) { + ret.push(itResult.value); + } + return ret; + }; + + asArray = function(v) { + if (es5.isArray(v)) { + return v; + } else if (v != null && typeof v[Symbol.iterator] === "function") { + return ArrayFrom(v); + } + return null; + }; +} + +var isNode = typeof process !== "undefined" && + classString(process).toLowerCase() === "[object process]"; + +var hasEnvVariables = typeof process !== "undefined" && + typeof process.env !== "undefined"; + +function env(key) { + return hasEnvVariables ? process.env[key] : undefined; +} + +function getNativePromise() { + if (typeof Promise === "function") { + try { + var promise = new Promise(function(){}); + if ({}.toString.call(promise) === "[object Promise]") { + return Promise; + } + } catch (e) {} + } +} + +function domainBind(self, cb) { + return self.bind(cb); +} + +var ret = { + isClass: isClass, + isIdentifier: isIdentifier, + inheritedDataKeys: inheritedDataKeys, + getDataPropertyOrDefault: getDataPropertyOrDefault, + thrower: thrower, + isArray: es5.isArray, + asArray: asArray, + notEnumerableProp: notEnumerableProp, + isPrimitive: isPrimitive, + isObject: isObject, + isError: isError, + canEvaluate: canEvaluate, + errorObj: errorObj, + tryCatch: tryCatch, + inherits: inherits, + withAppended: withAppended, + maybeWrapAsError: maybeWrapAsError, + toFastProperties: toFastProperties, + filledRange: filledRange, + toString: safeToString, + canAttachTrace: canAttachTrace, + ensureErrorObject: ensureErrorObject, + originatesFromRejection: originatesFromRejection, + markAsOriginatingFromRejection: markAsOriginatingFromRejection, + classString: classString, + copyDescriptors: copyDescriptors, + hasDevTools: typeof chrome !== "undefined" && chrome && + typeof chrome.loadTimes === "function", + isNode: isNode, + hasEnvVariables: hasEnvVariables, + env: env, + global: globalObject, + getNativePromise: getNativePromise, + domainBind: domainBind +}; +ret.isRecentNode = ret.isNode && (function() { + var version = process.versions.node.split(".").map(Number); + return (version[0] === 0 && version[1] > 10) || (version[0] > 0); +})(); + +if (ret.isNode) ret.toFastProperties(process); + +try {throw new Error(); } catch (e) {ret.lastLineError = e;} +module.exports = ret; + +},{"./es5":10}]},{},[3])(3) +}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; } \ No newline at end of file diff --git a/node_modules/bluebird/js/browser/bluebird.core.min.js b/node_modules/bluebird/js/browser/bluebird.core.min.js new file mode 100644 index 0000000..cdfb7da --- /dev/null +++ b/node_modules/bluebird/js/browser/bluebird.core.min.js @@ -0,0 +1,31 @@ +/* @preserve + * The MIT License (MIT) + * + * Copyright (c) 2013-2017 Petka Antonov + * + * 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. + * + */ +/** + * bluebird build version 3.5.0 + * Features enabled: core + * Features disabled: race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each +*/ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t()}}(function(){var t,e,n;return function r(t,e,n){function i(a,s){if(!e[a]){if(!t[a]){var c="function"==typeof _dereq_&&_dereq_;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=e[a]={exports:{}};t[a][0].call(u.exports,function(e){var n=t[a][1][e];return i(n?n:e)},u,u.exports,r,t,e,n)}return e[a].exports}for(var o="function"==typeof _dereq_&&_dereq_,a=0;a0;){var e=t.shift();if("function"==typeof e){var n=t.shift(),r=t.shift();e.call(n,r)}else e._settlePromises()}},r.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},e.exports=r,e.exports.firstLineError=s},{"./queue":17,"./schedule":18,"./util":21}],2:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){var i=!1,o=function(t,e){this._reject(e)},a=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},s=function(t,e){0===(50397184&this._bitField)&&this._resolveCallback(e.target)},c=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=r.propagateFromFunction(),t.prototype._boundValue=r.boundValueFunction());var l=n(o),u=new t(e);u._propagateFrom(this,1);var p=this._target();if(u._setBoundTo(l),l instanceof t){var f={promiseRejectionQueued:!1,promise:u,target:p,bindingPromise:l};p._then(e,a,void 0,u,f),l._then(s,c,void 0,u,f),u._setOnCancel(l)}else u._resolveCallback(p);return u},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],3:[function(t,e,n){"use strict";function r(){try{Promise===o&&(Promise=i)}catch(t){}return o}var i;"undefined"!=typeof Promise&&(i=Promise);var o=t("./promise")();o.noConflict=r,e.exports=o},{"./promise":15}],4:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){var o=t("./util"),a=o.tryCatch,s=o.errorObj,c=e._async;e.prototype["break"]=e.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),this._enoughBranchesHaveCancelled()?(this._invokeOnCancel(),!0):!1)},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),c.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var n=0;n=0?o[t]:void 0}var i=!1,o=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,o.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=o.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},e.CapturedTrace=null,e.create=n,e.deactivateLongStackTraces=function(){},e.activateLongStackTraces=function(){var n=t.prototype._pushContext,o=t.prototype._popContext,a=t._peekContext,s=t.prototype._peekContext,c=t.prototype._promiseCreated;e.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=o,t._peekContext=a,t.prototype._peekContext=s,t.prototype._promiseCreated=c,i=!1},i=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},e}},{}],7:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,e){return{promise:e}}function i(){return!1}function o(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+I.toString(t));r._attachCancellationCallback(t)})}catch(i){return i}}function a(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?I.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function s(){return this._onCancelField}function c(t){this._onCancelField=t}function l(){this._cancellationParent=void 0,this._onCancelField=void 0}function u(t,e){if(0!==(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function p(t,e){0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function f(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function h(){this._trace=new x(this._peekContext())}function _(t,e){if(H(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var r=E(t);I.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),I.notEnumerableProp(t,"__stackCleaned__",!0)}}}function d(t,e,n,r,i){if(void 0===t&&null!==e&&X){if(void 0!==i&&i._returnedNonUndefined())return;if(0===(65535&r._bitField))return;n&&(n+=" ");var o="",a="";if(e._trace){for(var s=e._trace.stack.split("\n"),c=C(s),l=c.length-1;l>=0;--l){var u=c[l];if(!V.test(u)){var p=u.match(Q);p&&(o="at "+p[1]+":"+p[2]+":"+p[3]+" ");break}}if(c.length>0)for(var f=c[0],l=0;l0&&(a="\n"+s[l-1]);break}}var h="a promise was created in a "+n+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+a;r._warn(h,!0,e)}}function v(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),y(n)}function y(t,n,r){if(ot.warnings){var i,o=new U(t);if(n)r._attachExtraTrace(o);else if(ot.longStackTraces&&(i=e._peekContext()))i.attachExtraTrace(o);else{var a=E(o);o.stack=a.message+"\n"+a.stack.join("\n")}tt("warning",o)||k(o,"",!0)}}function g(t,e){for(var n=0;n=0;--s)if(r[s]===o){a=s;break}for(var s=a;s>=0;--s){var c=r[s];if(e[i]!==c)break;e.pop(),i--}e=r}}function C(t){for(var e=[],n=0;n0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}function E(t){var e=t.stack,n=t.toString();return e="string"==typeof e&&e.length>0?w(t):[" (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:C(e)}}function k(t,e,n){if("undefined"!=typeof console){var r;if(I.isObject(t)){var i=t.stack;r=e+G(i,t)}else r=e+String(t);"function"==typeof L?L(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function j(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(o){B.throwLater(o)}"unhandledRejection"===t?tt(t,n,r)||i||k(n,"Unhandled rejection "):tt(t,r)}function F(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():I.toString(t);var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(e))try{var r=JSON.stringify(t);e=r}catch(i){}0===e.length&&(e="(empty array)")}return"(<"+T(e)+">, no stack trace)"}function T(t){var e=41;return t.lengtha||0>s||!n||!r||n!==r||a>=s||(nt=function(t){if(D.test(t))return!0;var e=R(t);return e&&e.fileName===n&&a<=e.line&&e.line<=s?!0:!1})}}function x(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);it(this,x),e>32&&this.uncycle()}var O,A,L,N=e._getDomain,B=e._async,U=t("./errors").Warning,I=t("./util"),H=I.canAttachTrace,D=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,V=/\((?:timers\.js):\d+:\d+\)/,Q=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,q=null,G=null,M=!1,W=!(0==I.env("BLUEBIRD_DEBUG")||!I.env("BLUEBIRD_DEBUG")&&"development"!==I.env("NODE_ENV")),$=!(0==I.env("BLUEBIRD_WARNINGS")||!W&&!I.env("BLUEBIRD_WARNINGS")),z=!(0==I.env("BLUEBIRD_LONG_STACK_TRACES")||!W&&!I.env("BLUEBIRD_LONG_STACK_TRACES")),X=0!=I.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&($||!!I.env("BLUEBIRD_W_FORGOTTEN_RETURN"));e.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},e.prototype._ensurePossibleRejectionHandled=function(){0===(524288&this._bitField)&&(this._setRejectionIsUnhandled(),B.invokeLater(this._notifyUnhandledRejection,this,void 0))},e.prototype._notifyUnhandledRejectionIsHandled=function(){j("rejectionHandled",O,void 0,this)},e.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},e.prototype._returnedNonUndefined=function(){return 0!==(268435456&this._bitField)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),j("unhandledRejection",A,t,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},e.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},e.prototype._warn=function(t,e,n){return y(t,e,n||this)},e.onPossiblyUnhandledRejection=function(t){var e=N();A="function"==typeof t?null===e?t:I.domainBind(e,t):void 0},e.onUnhandledRejectionHandled=function(t){var e=N();O="function"==typeof t?null===e?t:I.domainBind(e,t):void 0};var K=function(){};e.longStackTraces=function(){if(B.haveItemsQueued()&&!ot.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!ot.longStackTraces&&P()){var t=e.prototype._captureStackTrace,r=e.prototype._attachExtraTrace;ot.longStackTraces=!0,K=function(){if(B.haveItemsQueued()&&!ot.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");e.prototype._captureStackTrace=t,e.prototype._attachExtraTrace=r,n.deactivateLongStackTraces(),B.enableTrampoline(),ot.longStackTraces=!1},e.prototype._captureStackTrace=h,e.prototype._attachExtraTrace=_,n.activateLongStackTraces(),B.disableTrampolineIfNecessary()}},e.hasLongStackTraces=function(){return ot.longStackTraces&&P()};var J=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return I.global.dispatchEvent(t),function(t,e){var n=new CustomEvent(t.toLowerCase(),{detail:e,cancelable:!0});return!I.global.dispatchEvent(n)}}if("function"==typeof Event){var t=new Event("CustomEvent");return I.global.dispatchEvent(t),function(t,e){var n=new Event(t.toLowerCase(),{cancelable:!0});return n.detail=e,!I.global.dispatchEvent(n)}}var t=document.createEvent("CustomEvent");return t.initCustomEvent("testingtheevent",!1,!0,{}),I.global.dispatchEvent(t),function(t,e){var n=document.createEvent("CustomEvent");return n.initCustomEvent(t.toLowerCase(),!1,!0,e),!I.global.dispatchEvent(n)}}catch(e){}return function(){return!1}}(),Y=function(){return I.isNode?function(){return process.emit.apply(process,arguments)}:I.global?function(t){var e="on"+t.toLowerCase(),n=I.global[e];return n?(n.apply(I.global,[].slice.call(arguments,1)),!0):!1}:function(){return!1}}(),Z={promiseCreated:r,promiseFulfilled:r,promiseRejected:r,promiseResolved:r,promiseCancelled:r,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:r},tt=function(t){var e=!1;try{e=Y.apply(null,arguments)}catch(n){B.throwLater(n),e=!0}var r=!1;try{r=J(t,Z[t].apply(null,arguments))}catch(n){B.throwLater(n),r=!0}return r||e};e.config=function(t){if(t=Object(t),"longStackTraces"in t&&(t.longStackTraces?e.longStackTraces():!t.longStackTraces&&e.hasLongStackTraces()&&K()),"warnings"in t){var n=t.warnings;ot.warnings=!!n,X=ot.warnings,I.isObject(n)&&"wForgottenReturn"in n&&(X=!!n.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!ot.cancellation){if(B.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=l,e.prototype._propagateFrom=u,e.prototype._onCancel=s,e.prototype._setOnCancel=c,e.prototype._attachCancellationCallback=a,e.prototype._execute=o,et=u,ot.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!ot.monitoring?(ot.monitoring=!0,e.prototype._fireEvent=tt):!t.monitoring&&ot.monitoring&&(ot.monitoring=!1,e.prototype._fireEvent=i)),e},e.prototype._fireEvent=i,e.prototype._execute=function(t,e,n){try{t(e,n)}catch(r){return r}},e.prototype._onCancel=function(){},e.prototype._setOnCancel=function(t){},e.prototype._attachCancellationCallback=function(t){},e.prototype._captureStackTrace=function(){},e.prototype._attachExtraTrace=function(){},e.prototype._clearCancellationData=function(){},e.prototype._propagateFrom=function(t,e){};var et=p,nt=function(){return!1},rt=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;I.inherits(x,Error),n.CapturedTrace=x,x.prototype.uncycle=function(){var t=this._length;if(!(2>t)){for(var e=[],n={},r=0,i=this;void 0!==i;++r)e.push(i),i=i._parent;t=this._length=r;for(var r=t-1;r>=0;--r){var o=e[r].stack;void 0===n[o]&&(n[o]=r)}for(var r=0;t>r;++r){var a=e[r].stack,s=n[a];if(void 0!==s&&s!==r){s>0&&(e[s-1]._parent=void 0,e[s-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var c=r>0?e[r-1]:this;t-1>s?(c._parent=e[s+1],c._parent.uncycle(),c._length=c._parent._length+1):(c._parent=void 0,c._length=1);for(var l=c._length+1,u=r-2;u>=0;--u)e[u]._length=l,l++;return}}}},x.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=E(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(C(i.stack.split("\n"))),i=i._parent;b(r),m(r),I.notEnumerableProp(t,"stack",g(n,r)),I.notEnumerableProp(t,"__stackCleaned__",!0)}};var it=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():F(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,q=t,G=e;var n=Error.captureStackTrace;return nt=function(t){return D.test(t)},function(t,e){Error.stackTraceLimit+=6,n(t,e),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return q=/@/,G=e,M=!0,function(t){t.stack=(new Error).stack};var i;try{throw new Error}catch(o){i="stack"in o}return"stack"in r||!i||"number"!=typeof Error.stackTraceLimit?(G=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?F(e):e.toString()},null):(q=t,G=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(L=function(t){console.warn(t)},I.isNode&&process.stderr.isTTY?L=function(t,e){var n=e?"":"";console.warn(n+t+"\n")}:I.isNode||"string"!=typeof(new Error).stack||(L=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var ot={warnings:$,longStackTraces:!1,cancellation:!1,monitoring:!1};return z&&e.longStackTraces(),{longStackTraces:function(){return ot.longStackTraces},warnings:function(){return ot.warnings},cancellation:function(){return ot.cancellation},monitoring:function(){return ot.monitoring},propagateFromFunction:function(){return et},boundValueFunction:function(){return f},checkForgottenReturns:d,setBounds:S,warn:y,deprecated:v,CapturedTrace:x,fireDomEvent:J,fireGlobalEvent:Y}}},{"./errors":9,"./util":21}],8:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype["return"]=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype["throw"]=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1],r=function(){throw e};return this.caught(t,r)},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var r=arguments[1];r instanceof t&&r.suppressUnhandledRejections();var i=function(){return r};return this.caught(n,i)}}},{}],9:[function(t,e,n){"use strict";function r(t,e){function n(r){return this instanceof n?(p(this,"message","string"==typeof r?r:e),p(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new n(r)}return u(n,Error),n}function i(t){return this instanceof i?(p(this,"name","OperationalError"),p(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(p(this,"message",t.message),p(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new i(t)}var o,a,s=t("./es5"),c=s.freeze,l=t("./util"),u=l.inherits,p=l.notEnumerableProp,f=r("Warning","warning"),h=r("CancellationError","cancellation error"),_=r("TimeoutError","timeout error"),d=r("AggregateError","aggregate error");try{o=TypeError,a=RangeError}catch(v){o=r("TypeError","type error"),a=r("RangeError","range error")}for(var y="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),g=0;g1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0):!1}function s(){return l.call(this,this.promise._target()._settledValue())}function c(t){return a(this,t)?void 0:(f.e=t,f)}function l(t){var i=this.promise,l=this.handler;if(!this.called){this.called=!0;var u=this.isFinallyHandler()?l.call(i._boundValue()):l.call(i._boundValue(),t);if(u===r)return u;if(void 0!==u){i._setReturnedNonUndefined();var h=n(u,i);if(h instanceof e){if(null!=this.cancelPromise){if(h._isCancelled()){var _=new p("late cancellation observer");return i._attachExtraTrace(_),f.e=_,f}h.isPending()&&h._attachCancellationCallback(new o(this))}return h._then(s,c,void 0,this,void 0)}}}return i.isRejected()?(a(this),f.e=t,f):(a(this),t)}var u=t("./util"),p=e.CancellationError,f=u.errorObj,h=t("./catch_filter")(r);return i.prototype.isFinallyHandler=function(){return 0===this.type},o.prototype._resultCancelled=function(){a(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,new i(this,e,t),void 0)},e.prototype.lastly=e.prototype["finally"]=function(t){return this._passThrough(t,0,l,l)},e.prototype.tap=function(t){return this._passThrough(t,1,l)},e.prototype.tapCatch=function(t){var n=arguments.length;if(1===n)return this._passThrough(t,1,void 0,l);var r,i=new Array(n-1),o=0;for(r=0;n-1>r;++r){var a=arguments[r];if(!u.isObject(a))return e.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+u.classString(a)));i[o++]=a}i.length=o;var s=arguments[r];return this._passThrough(h(i,s,this),1,void 0,l)},i}},{"./catch_filter":5,"./util":21}],12:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,a){var s=t("./util");s.canEvaluate,s.tryCatch,s.errorObj;e.join=function(){var t,e=arguments.length-1;if(e>0&&"function"==typeof arguments[e]){t=arguments[e];var r}var i=[].slice.call(arguments);t&&i.pop();var r=new n(i).promise();return void 0!==t?r.spread(t):r}}},{"./util":21}],13:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){var a=t("./util"),s=a.tryCatch;e.method=function(t){if("function"!=typeof t)throw new e.TypeError("expecting a function but got "+a.classString(t));return function(){var r=new e(n);r._captureStackTrace(),r._pushContext();var i=s(t).apply(this,arguments),a=r._popContext();return o.checkForgottenReturns(i,a,"Promise.method",r),r._resolveFromSyncValue(i),r}},e.attempt=e["try"]=function(t){if("function"!=typeof t)return i("expecting a function but got "+a.classString(t));var r=new e(n);r._captureStackTrace(),r._pushContext();var c;if(arguments.length>1){o.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],u=arguments[2];c=a.isArray(l)?s(t).apply(u,l):s(t).call(u,l)}else c=s(t)();var p=r._popContext();return o.checkForgottenReturns(c,p,"Promise.try",r),r._resolveFromSyncValue(c),r},e.prototype._resolveFromSyncValue=function(t){t===a.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":21}],14:[function(t,e,n){"use strict";function r(t){return t instanceof Error&&u.getPrototypeOf(t)===Error.prototype}function i(t){var e;if(r(t)){e=new l(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=u.keys(t),i=0;i1){var n,r=new Array(e-1),i=0;for(n=0;e-1>n;++n){var o=arguments[n];if(!h.isObject(o))return p("Catch statement predicate: expecting an object but got "+h.classString(o));r[i++]=o}return r.length=i,t=arguments[n],this.then(void 0,P(r,t,this))}return this.then(void 0,t)},i.prototype.reflect=function(){return this._then(u,u,void 0,this,void 0)},i.prototype.then=function(t,e){if(F.warnings()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+h.classString(t);arguments.length>1&&(n+=", "+h.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},i.prototype.done=function(t,e){var n=this._then(t,e,void 0,void 0,void 0);n._setIsFinal()},i.prototype.spread=function(t){return"function"!=typeof t?p("expecting a function but got "+h.classString(t)):this.all()._then(t,void 0,void 0,C,void 0); +},i.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new k(this).promise()},i.prototype.error=function(t){return this.caught(h.originatesFromRejection,t)},i.getNewLibraryCopy=e.exports,i.is=function(t){return t instanceof i},i.fromNode=i.fromCallback=function(t){var e=new i(b);e._captureStackTrace();var n=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=x(t)(R(e,n));return r===S&&e._rejectCallback(r.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},i.all=function(t){return new k(t).promise()},i.cast=function(t){var e=E(t);return e instanceof i||(e=new i(b),e._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(t){var e=new i(b);return e._captureStackTrace(),e._rejectCallback(t,!0),e},i.setScheduler=function(t){if("function"!=typeof t)throw new g("expecting a function but got "+h.classString(t));return v.setScheduler(t)},i.prototype._then=function(t,e,n,r,o){var a=void 0!==o,s=a?o:new i(b),l=this._target(),u=l._bitField;a||(s._propagateFrom(this,3),s._captureStackTrace(),void 0===r&&0!==(2097152&this._bitField)&&(r=0!==(50397184&u)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,s));var p=c();if(0!==(50397184&u)){var f,_,d=l._settlePromiseCtx;0!==(33554432&u)?(_=l._rejectionHandler0,f=t):0!==(16777216&u)?(_=l._fulfillmentHandler0,f=e,l._unsetRejectionIsUnhandled()):(d=l._settlePromiseLateCancellationObserver,_=new m("late cancellation observer"),l._attachExtraTrace(_),f=e),v.invoke(d,l,{handler:null===p?f:"function"==typeof f&&h.domainBind(p,f),promise:s,receiver:r,value:_})}else l._addCallbacks(t,e,s,r,p);return s},i.prototype._length=function(){return 65535&this._bitField},i.prototype._isFateSealed=function(){return 0!==(117506048&this._bitField)},i.prototype._isFollowing=function(){return 67108864===(67108864&this._bitField)},i.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},i.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},i.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},i.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},i.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},i.prototype._isFinal=function(){return(4194304&this._bitField)>0},i.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},i.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},i.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},i.prototype._setAsyncGuaranteed=function(){v.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},i.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];return e===f?void 0:void 0===e&&this._isBound()?this._boundValue():e},i.prototype._promiseAt=function(t){return this[4*t-4+2]},i.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},i.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},i.prototype._boundValue=function(){},i.prototype._migrateCallback0=function(t){var e=(t._bitField,t._fulfillmentHandler0),n=t._rejectionHandler0,r=t._promise0,i=t._receiverAt(0);void 0===i&&(i=f),this._addCallbacks(e,n,r,i,null)},i.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),r=t._rejectionHandlerAt(e),i=t._promiseAt(e),o=t._receiverAt(e);void 0===o&&(o=f),this._addCallbacks(n,r,i,o,null)},i.prototype._addCallbacks=function(t,e,n,r,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=n,this._receiver0=r,"function"==typeof t&&(this._fulfillmentHandler0=null===i?t:h.domainBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:h.domainBind(i,e));else{var a=4*o-4;this[a+2]=n,this[a+3]=r,"function"==typeof t&&(this[a+0]=null===i?t:h.domainBind(i,t)),"function"==typeof e&&(this[a+1]=null===i?e:h.domainBind(i,e))}return this._setLength(o+1),o},i.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},i.prototype._resolveCallback=function(t,e){if(0===(117506048&this._bitField)){if(t===this)return this._rejectCallback(l(),!1);var n=E(t,this);if(!(n instanceof i))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r===this)return void this._reject(l());var o=r._bitField;if(0===(50397184&o)){var a=this._length();a>0&&r._migrateCallback0(this);for(var s=1;a>s;++s)r._migrateCallbackAt(this,s);this._setFollowing(),this._setLength(0),this._setFollowee(r)}else if(0!==(33554432&o))this._fulfill(r._value());else if(0!==(16777216&o))this._reject(r._reason());else{var c=new m("late cancellation observer");r._attachExtraTrace(c),this._reject(c)}}},i.prototype._rejectCallback=function(t,e,n){var r=h.ensureErrorObject(t),i=r===t;if(!i&&!n&&F.warnings()){var o="a promise was rejected with a non-error: "+h.classString(t);this._warn(o,!0)}this._attachExtraTrace(r,e?i:!1),this._reject(t)},i.prototype._resolveFromExecutor=function(t){if(t!==b){var e=this;this._captureStackTrace(),this._pushContext();var n=!0,r=this._execute(t,function(t){e._resolveCallback(t)},function(t){e._rejectCallback(t,n)});n=!1,this._popContext(),void 0!==r&&e._rejectCallback(r,!0)}},i.prototype._settlePromiseFromHandler=function(t,e,n,r){var i=r._bitField;if(0===(65536&i)){r._pushContext();var o;e===C?n&&"number"==typeof n.length?o=x(t).apply(this._boundValue(),n):(o=S,o.e=new g("cannot .spread() a non-array: "+h.classString(n))):o=x(t).call(e,n);var a=r._popContext();i=r._bitField,0===(65536&i)&&(o===w?r._reject(n):o===S?r._rejectCallback(o.e,!1):(F.checkForgottenReturns(o,a,"",r,this),r._resolveCallback(o)))}},i.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},i.prototype._followee=function(){return this._rejectionHandler0},i.prototype._setFollowee=function(t){this._rejectionHandler0=t},i.prototype._settlePromise=function(t,e,r,o){var a=t instanceof i,s=this._bitField,c=0!==(134217728&s);0!==(65536&s)?(a&&t._invokeInternalOnCancel(),r instanceof T&&r.isFinallyHandler()?(r.cancelPromise=t,x(e).call(r,o)===S&&t._reject(S.e)):e===u?t._fulfill(u.call(r)):r instanceof n?r._promiseCancelled(t):a||t instanceof k?t._cancel():r.cancel()):"function"==typeof e?a?(c&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(e,r,o,t)):e.call(r,o,t):r instanceof n?r._isResolved()||(0!==(33554432&s)?r._promiseFulfilled(o,t):r._promiseRejected(o,t)):a&&(c&&t._setAsyncGuaranteed(),0!==(33554432&s)?t._fulfill(o):t._reject(o))},i.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,r=t.receiver,o=t.value;"function"==typeof e?n instanceof i?this._settlePromiseFromHandler(e,r,o,n):e.call(r,o,n):n instanceof i&&n._reject(o)},i.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},i.prototype._settlePromise0=function(t,e,n){var r=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(r,t,i,e)},i.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},i.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=l();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!==(134217728&e)?this._settlePromises():v.settlePromises(this))}},i.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?v.fatalError(t,h.isNode):void((65535&e)>0?v.settlePromises(this):this._ensurePossibleRejectionHandled())},i.prototype._fulfillPromises=function(t,e){for(var n=1;t>n;n++){var r=this._fulfillmentHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._rejectPromises=function(t,e){for(var n=1;t>n;n++){var r=this._rejectionHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._settlePromises=function(){var t=this._bitField,e=65535&t;if(e>0){if(0!==(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,t),this._fulfillPromises(e,r)}this._setLength(0)}this._clearCancellationData()},i.prototype._settledValue=function(){var t=this._bitField;return 0!==(33554432&t)?this._rejectionHandler0:0!==(16777216&t)?this._fulfillmentHandler0:void 0},i.defer=i.pending=function(){F.deprecated("Promise.defer","new Promise");var t=new i(b);return{promise:t,resolve:o,reject:a}},h.notEnumerableProp(i,"_makeSelfResolutionError",l),t("./method")(i,b,E,p,F),t("./bind")(i,b,E,F),t("./cancel")(i,k,p,F),t("./direct_resolve")(i),t("./synchronous_inspection")(i),t("./join")(i,k,E,b,v,c),i.Promise=i,i.version="3.5.0",h.toFastProperties(i),h.toFastProperties(i.prototype),s({a:1}),s({b:2}),s({c:3}),s(1),s(function(){}),s(void 0),s(!1),s(new i(b)),F.setBounds(d.firstLineError,h.lastLineError),i}},{"./async":1,"./bind":2,"./cancel":4,"./catch_filter":5,"./context":6,"./debuggability":7,"./direct_resolve":8,"./errors":9,"./es5":10,"./finally":11,"./join":12,"./method":13,"./nodeback":14,"./promise_array":16,"./synchronous_inspection":19,"./thenables":20,"./util":21}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){function a(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}function s(t){var r=this._promise=new e(n);t instanceof e&&r._propagateFrom(t,3),r._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var c=t("./util");c.isArray;return c.inherits(s,o),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function l(t,n){var o=r(this._values,this._promise);if(o instanceof e){o=o._target();var s=o._bitField;if(this._values=o,0===(50397184&s))return this._promise._setAsyncGuaranteed(),o._then(l,this._reject,void 0,this,n);if(0===(33554432&s))return 0!==(16777216&s)?this._reject(o._reason()):this._cancel();o=o._value()}if(o=c.asArray(o),null===o){var u=i("expecting an array or an iterable object but got "+c.classString(o)).reason();return void this._promise._rejectCallback(u,!1)}return 0===o.length?void(-5===n?this._resolveEmptyArray():this._resolve(a(n))):void this._iterate(o)},s.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var i=this._promise,o=!1,a=null,s=0;n>s;++s){var c=r(t[s],i);c instanceof e?(c=c._target(),a=c._bitField):a=null,o?null!==a&&c.suppressUnhandledRejections():null!==a?0===(50397184&a)?(c._proxy(this,s),this._values[s]=c):o=0!==(33554432&a)?this._promiseFulfilled(c._value(),s):0!==(16777216&a)?this._promiseRejected(c._reason(),s):this._promiseCancelled(s):o=this._promiseFulfilled(c,s)}o||i._setAsyncGuaranteed()},s.prototype._isResolved=function(){return null===this._values},s.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},s.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},s.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},s.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;no;++o)n[o+r]=t[o+e],t[o+e]=void 0}function i(t){this._capacity=t,this._length=0,this._front=0}i.prototype._willBeOverCapacity=function(t){return this._capacityn;++n)i[n]=t[n];return i[n]=e,i}function l(t,e,n){if(!F.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var r=Object.getOwnPropertyDescriptor(t,e);return null!=r?null==r.get&&null==r.set?r.value:n:void 0}function u(t,e,n){if(o(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return F.defineProperty(t,e,r),t}function p(t){throw t}function f(t){try{if("function"==typeof t){var e=F.names(t.prototype),n=F.isES5&&e.length>1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=A.test(t+"")&&F.names(t).length>0;if(n||r||i)return!0}return!1}catch(o){return!1}}function h(t){function e(){}e.prototype=t;for(var n=8;n--;)new e;return t}function _(t){return L.test(t)}function d(t,e,n){for(var r=new Array(t),i=0;t>i;++i)r[i]=e+i+n;return r}function v(t){try{return t+""}catch(e){return"[no string representation]"}}function y(t){return null!==t&&"object"==typeof t&&"string"==typeof t.message&&"string"==typeof t.name}function g(t){try{u(t,"isOperational",!0)}catch(e){}}function m(t){return null==t?!1:t instanceof Error.__BluebirdErrorTypes__.OperationalError||t.isOperational===!0}function b(t){return y(t)&&F.propertyIsWritable(t,"stack")}function C(t){return{}.toString.call(t)}function w(t,e,n){for(var r=F.names(t),i=0;i10||t[0]>0}(),D.isNode&&D.toFastProperties(process);try{throw new Error}catch(V){D.lastLineError=V}e.exports=D},{"./es5":10}]},{},[3])(3)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise); \ No newline at end of file diff --git a/node_modules/bluebird/js/browser/bluebird.js b/node_modules/bluebird/js/browser/bluebird.js new file mode 100644 index 0000000..0b823f7 --- /dev/null +++ b/node_modules/bluebird/js/browser/bluebird.js @@ -0,0 +1,5619 @@ +/* @preserve + * The MIT License (MIT) + * + * Copyright (c) 2013-2017 Petka Antonov + * + * 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. + * + */ +/** + * bluebird build version 3.5.0 + * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each +*/ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o 0) { + var fn = queue.shift(); + if (typeof fn !== "function") { + fn._settlePromises(); + continue; + } + var receiver = queue.shift(); + var arg = queue.shift(); + fn.call(receiver, arg); + } +}; + +Async.prototype._drainQueues = function () { + this._drainQueue(this._normalQueue); + this._reset(); + this._haveDrainedQueues = true; + this._drainQueue(this._lateQueue); +}; + +Async.prototype._queueTick = function () { + if (!this._isTickUsed) { + this._isTickUsed = true; + this._schedule(this.drainQueues); + } +}; + +Async.prototype._reset = function () { + this._isTickUsed = false; +}; + +module.exports = Async; +module.exports.firstLineError = firstLineError; + +},{"./queue":26,"./schedule":29,"./util":36}],3:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) { +var calledBind = false; +var rejectThis = function(_, e) { + this._reject(e); +}; + +var targetRejected = function(e, context) { + context.promiseRejectionQueued = true; + context.bindingPromise._then(rejectThis, rejectThis, null, this, e); +}; + +var bindingResolved = function(thisArg, context) { + if (((this._bitField & 50397184) === 0)) { + this._resolveCallback(context.target); + } +}; + +var bindingRejected = function(e, context) { + if (!context.promiseRejectionQueued) this._reject(e); +}; + +Promise.prototype.bind = function (thisArg) { + if (!calledBind) { + calledBind = true; + Promise.prototype._propagateFrom = debug.propagateFromFunction(); + Promise.prototype._boundValue = debug.boundValueFunction(); + } + var maybePromise = tryConvertToPromise(thisArg); + var ret = new Promise(INTERNAL); + ret._propagateFrom(this, 1); + var target = this._target(); + ret._setBoundTo(maybePromise); + if (maybePromise instanceof Promise) { + var context = { + promiseRejectionQueued: false, + promise: ret, + target: target, + bindingPromise: maybePromise + }; + target._then(INTERNAL, targetRejected, undefined, ret, context); + maybePromise._then( + bindingResolved, bindingRejected, undefined, ret, context); + ret._setOnCancel(maybePromise); + } else { + ret._resolveCallback(target); + } + return ret; +}; + +Promise.prototype._setBoundTo = function (obj) { + if (obj !== undefined) { + this._bitField = this._bitField | 2097152; + this._boundTo = obj; + } else { + this._bitField = this._bitField & (~2097152); + } +}; + +Promise.prototype._isBound = function () { + return (this._bitField & 2097152) === 2097152; +}; + +Promise.bind = function (thisArg, value) { + return Promise.resolve(value).bind(thisArg); +}; +}; + +},{}],4:[function(_dereq_,module,exports){ +"use strict"; +var old; +if (typeof Promise !== "undefined") old = Promise; +function noConflict() { + try { if (Promise === bluebird) Promise = old; } + catch (e) {} + return bluebird; +} +var bluebird = _dereq_("./promise")(); +bluebird.noConflict = noConflict; +module.exports = bluebird; + +},{"./promise":22}],5:[function(_dereq_,module,exports){ +"use strict"; +var cr = Object.create; +if (cr) { + var callerCache = cr(null); + var getterCache = cr(null); + callerCache[" size"] = getterCache[" size"] = 0; +} + +module.exports = function(Promise) { +var util = _dereq_("./util"); +var canEvaluate = util.canEvaluate; +var isIdentifier = util.isIdentifier; + +var getMethodCaller; +var getGetter; +if (!true) { +var makeMethodCaller = function (methodName) { + return new Function("ensureMethod", " \n\ + return function(obj) { \n\ + 'use strict' \n\ + var len = this.length; \n\ + ensureMethod(obj, 'methodName'); \n\ + switch(len) { \n\ + case 1: return obj.methodName(this[0]); \n\ + case 2: return obj.methodName(this[0], this[1]); \n\ + case 3: return obj.methodName(this[0], this[1], this[2]); \n\ + case 0: return obj.methodName(); \n\ + default: \n\ + return obj.methodName.apply(obj, this); \n\ + } \n\ + }; \n\ + ".replace(/methodName/g, methodName))(ensureMethod); +}; + +var makeGetter = function (propertyName) { + return new Function("obj", " \n\ + 'use strict'; \n\ + return obj.propertyName; \n\ + ".replace("propertyName", propertyName)); +}; + +var getCompiled = function(name, compiler, cache) { + var ret = cache[name]; + if (typeof ret !== "function") { + if (!isIdentifier(name)) { + return null; + } + ret = compiler(name); + cache[name] = ret; + cache[" size"]++; + if (cache[" size"] > 512) { + var keys = Object.keys(cache); + for (var i = 0; i < 256; ++i) delete cache[keys[i]]; + cache[" size"] = keys.length - 256; + } + } + return ret; +}; + +getMethodCaller = function(name) { + return getCompiled(name, makeMethodCaller, callerCache); +}; + +getGetter = function(name) { + return getCompiled(name, makeGetter, getterCache); +}; +} + +function ensureMethod(obj, methodName) { + var fn; + if (obj != null) fn = obj[methodName]; + if (typeof fn !== "function") { + var message = "Object " + util.classString(obj) + " has no method '" + + util.toString(methodName) + "'"; + throw new Promise.TypeError(message); + } + return fn; +} + +function caller(obj) { + var methodName = this.pop(); + var fn = ensureMethod(obj, methodName); + return fn.apply(obj, this); +} +Promise.prototype.call = function (methodName) { + var args = [].slice.call(arguments, 1);; + if (!true) { + if (canEvaluate) { + var maybeCaller = getMethodCaller(methodName); + if (maybeCaller !== null) { + return this._then( + maybeCaller, undefined, undefined, args, undefined); + } + } + } + args.push(methodName); + return this._then(caller, undefined, undefined, args, undefined); +}; + +function namedGetter(obj) { + return obj[this]; +} +function indexedGetter(obj) { + var index = +this; + if (index < 0) index = Math.max(0, index + obj.length); + return obj[index]; +} +Promise.prototype.get = function (propertyName) { + var isIndex = (typeof propertyName === "number"); + var getter; + if (!isIndex) { + if (canEvaluate) { + var maybeGetter = getGetter(propertyName); + getter = maybeGetter !== null ? maybeGetter : namedGetter; + } else { + getter = namedGetter; + } + } else { + getter = indexedGetter; + } + return this._then(getter, undefined, undefined, propertyName, undefined); +}; +}; + +},{"./util":36}],6:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, PromiseArray, apiRejection, debug) { +var util = _dereq_("./util"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var async = Promise._async; + +Promise.prototype["break"] = Promise.prototype.cancel = function() { + if (!debug.cancellation()) return this._warn("cancellation is disabled"); + + var promise = this; + var child = promise; + while (promise._isCancellable()) { + if (!promise._cancelBy(child)) { + if (child._isFollowing()) { + child._followee().cancel(); + } else { + child._cancelBranched(); + } + break; + } + + var parent = promise._cancellationParent; + if (parent == null || !parent._isCancellable()) { + if (promise._isFollowing()) { + promise._followee().cancel(); + } else { + promise._cancelBranched(); + } + break; + } else { + if (promise._isFollowing()) promise._followee().cancel(); + promise._setWillBeCancelled(); + child = promise; + promise = parent; + } + } +}; + +Promise.prototype._branchHasCancelled = function() { + this._branchesRemainingToCancel--; +}; + +Promise.prototype._enoughBranchesHaveCancelled = function() { + return this._branchesRemainingToCancel === undefined || + this._branchesRemainingToCancel <= 0; +}; + +Promise.prototype._cancelBy = function(canceller) { + if (canceller === this) { + this._branchesRemainingToCancel = 0; + this._invokeOnCancel(); + return true; + } else { + this._branchHasCancelled(); + if (this._enoughBranchesHaveCancelled()) { + this._invokeOnCancel(); + return true; + } + } + return false; +}; + +Promise.prototype._cancelBranched = function() { + if (this._enoughBranchesHaveCancelled()) { + this._cancel(); + } +}; + +Promise.prototype._cancel = function() { + if (!this._isCancellable()) return; + this._setCancelled(); + async.invoke(this._cancelPromises, this, undefined); +}; + +Promise.prototype._cancelPromises = function() { + if (this._length() > 0) this._settlePromises(); +}; + +Promise.prototype._unsetOnCancel = function() { + this._onCancelField = undefined; +}; + +Promise.prototype._isCancellable = function() { + return this.isPending() && !this._isCancelled(); +}; + +Promise.prototype.isCancellable = function() { + return this.isPending() && !this.isCancelled(); +}; + +Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) { + if (util.isArray(onCancelCallback)) { + for (var i = 0; i < onCancelCallback.length; ++i) { + this._doInvokeOnCancel(onCancelCallback[i], internalOnly); + } + } else if (onCancelCallback !== undefined) { + if (typeof onCancelCallback === "function") { + if (!internalOnly) { + var e = tryCatch(onCancelCallback).call(this._boundValue()); + if (e === errorObj) { + this._attachExtraTrace(e.e); + async.throwLater(e.e); + } + } + } else { + onCancelCallback._resultCancelled(this); + } + } +}; + +Promise.prototype._invokeOnCancel = function() { + var onCancelCallback = this._onCancel(); + this._unsetOnCancel(); + async.invoke(this._doInvokeOnCancel, this, onCancelCallback); +}; + +Promise.prototype._invokeInternalOnCancel = function() { + if (this._isCancellable()) { + this._doInvokeOnCancel(this._onCancel(), true); + this._unsetOnCancel(); + } +}; + +Promise.prototype._resultCancelled = function() { + this.cancel(); +}; + +}; + +},{"./util":36}],7:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(NEXT_FILTER) { +var util = _dereq_("./util"); +var getKeys = _dereq_("./es5").keys; +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; + +function catchFilter(instances, cb, promise) { + return function(e) { + var boundTo = promise._boundValue(); + predicateLoop: for (var i = 0; i < instances.length; ++i) { + var item = instances[i]; + + if (item === Error || + (item != null && item.prototype instanceof Error)) { + if (e instanceof item) { + return tryCatch(cb).call(boundTo, e); + } + } else if (typeof item === "function") { + var matchesPredicate = tryCatch(item).call(boundTo, e); + if (matchesPredicate === errorObj) { + return matchesPredicate; + } else if (matchesPredicate) { + return tryCatch(cb).call(boundTo, e); + } + } else if (util.isObject(e)) { + var keys = getKeys(item); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + if (item[key] != e[key]) { + continue predicateLoop; + } + } + return tryCatch(cb).call(boundTo, e); + } + } + return NEXT_FILTER; + }; +} + +return catchFilter; +}; + +},{"./es5":13,"./util":36}],8:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise) { +var longStackTraces = false; +var contextStack = []; + +Promise.prototype._promiseCreated = function() {}; +Promise.prototype._pushContext = function() {}; +Promise.prototype._popContext = function() {return null;}; +Promise._peekContext = Promise.prototype._peekContext = function() {}; + +function Context() { + this._trace = new Context.CapturedTrace(peekContext()); +} +Context.prototype._pushContext = function () { + if (this._trace !== undefined) { + this._trace._promiseCreated = null; + contextStack.push(this._trace); + } +}; + +Context.prototype._popContext = function () { + if (this._trace !== undefined) { + var trace = contextStack.pop(); + var ret = trace._promiseCreated; + trace._promiseCreated = null; + return ret; + } + return null; +}; + +function createContext() { + if (longStackTraces) return new Context(); +} + +function peekContext() { + var lastIndex = contextStack.length - 1; + if (lastIndex >= 0) { + return contextStack[lastIndex]; + } + return undefined; +} +Context.CapturedTrace = null; +Context.create = createContext; +Context.deactivateLongStackTraces = function() {}; +Context.activateLongStackTraces = function() { + var Promise_pushContext = Promise.prototype._pushContext; + var Promise_popContext = Promise.prototype._popContext; + var Promise_PeekContext = Promise._peekContext; + var Promise_peekContext = Promise.prototype._peekContext; + var Promise_promiseCreated = Promise.prototype._promiseCreated; + Context.deactivateLongStackTraces = function() { + Promise.prototype._pushContext = Promise_pushContext; + Promise.prototype._popContext = Promise_popContext; + Promise._peekContext = Promise_PeekContext; + Promise.prototype._peekContext = Promise_peekContext; + Promise.prototype._promiseCreated = Promise_promiseCreated; + longStackTraces = false; + }; + longStackTraces = true; + Promise.prototype._pushContext = Context.prototype._pushContext; + Promise.prototype._popContext = Context.prototype._popContext; + Promise._peekContext = Promise.prototype._peekContext = peekContext; + Promise.prototype._promiseCreated = function() { + var ctx = this._peekContext(); + if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this; + }; +}; +return Context; +}; + +},{}],9:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, Context) { +var getDomain = Promise._getDomain; +var async = Promise._async; +var Warning = _dereq_("./errors").Warning; +var util = _dereq_("./util"); +var canAttachTrace = util.canAttachTrace; +var unhandledRejectionHandled; +var possiblyUnhandledRejection; +var bluebirdFramePattern = + /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/; +var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/; +var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/; +var stackFramePattern = null; +var formatStack = null; +var indentStackFrames = false; +var printWarning; +var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 && + (true || + util.env("BLUEBIRD_DEBUG") || + util.env("NODE_ENV") === "development")); + +var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 && + (debugging || util.env("BLUEBIRD_WARNINGS"))); + +var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && + (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES"))); + +var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && + (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN")); + +Promise.prototype.suppressUnhandledRejections = function() { + var target = this._target(); + target._bitField = ((target._bitField & (~1048576)) | + 524288); +}; + +Promise.prototype._ensurePossibleRejectionHandled = function () { + if ((this._bitField & 524288) !== 0) return; + this._setRejectionIsUnhandled(); + async.invokeLater(this._notifyUnhandledRejection, this, undefined); +}; + +Promise.prototype._notifyUnhandledRejectionIsHandled = function () { + fireRejectionEvent("rejectionHandled", + unhandledRejectionHandled, undefined, this); +}; + +Promise.prototype._setReturnedNonUndefined = function() { + this._bitField = this._bitField | 268435456; +}; + +Promise.prototype._returnedNonUndefined = function() { + return (this._bitField & 268435456) !== 0; +}; + +Promise.prototype._notifyUnhandledRejection = function () { + if (this._isRejectionUnhandled()) { + var reason = this._settledValue(); + this._setUnhandledRejectionIsNotified(); + fireRejectionEvent("unhandledRejection", + possiblyUnhandledRejection, reason, this); + } +}; + +Promise.prototype._setUnhandledRejectionIsNotified = function () { + this._bitField = this._bitField | 262144; +}; + +Promise.prototype._unsetUnhandledRejectionIsNotified = function () { + this._bitField = this._bitField & (~262144); +}; + +Promise.prototype._isUnhandledRejectionNotified = function () { + return (this._bitField & 262144) > 0; +}; + +Promise.prototype._setRejectionIsUnhandled = function () { + this._bitField = this._bitField | 1048576; +}; + +Promise.prototype._unsetRejectionIsUnhandled = function () { + this._bitField = this._bitField & (~1048576); + if (this._isUnhandledRejectionNotified()) { + this._unsetUnhandledRejectionIsNotified(); + this._notifyUnhandledRejectionIsHandled(); + } +}; + +Promise.prototype._isRejectionUnhandled = function () { + return (this._bitField & 1048576) > 0; +}; + +Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) { + return warn(message, shouldUseOwnTrace, promise || this); +}; + +Promise.onPossiblyUnhandledRejection = function (fn) { + var domain = getDomain(); + possiblyUnhandledRejection = + typeof fn === "function" ? (domain === null ? + fn : util.domainBind(domain, fn)) + : undefined; +}; + +Promise.onUnhandledRejectionHandled = function (fn) { + var domain = getDomain(); + unhandledRejectionHandled = + typeof fn === "function" ? (domain === null ? + fn : util.domainBind(domain, fn)) + : undefined; +}; + +var disableLongStackTraces = function() {}; +Promise.longStackTraces = function () { + if (async.haveItemsQueued() && !config.longStackTraces) { + throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + if (!config.longStackTraces && longStackTracesIsSupported()) { + var Promise_captureStackTrace = Promise.prototype._captureStackTrace; + var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace; + config.longStackTraces = true; + disableLongStackTraces = function() { + if (async.haveItemsQueued() && !config.longStackTraces) { + throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + Promise.prototype._captureStackTrace = Promise_captureStackTrace; + Promise.prototype._attachExtraTrace = Promise_attachExtraTrace; + Context.deactivateLongStackTraces(); + async.enableTrampoline(); + config.longStackTraces = false; + }; + Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace; + Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; + Context.activateLongStackTraces(); + async.disableTrampolineIfNecessary(); + } +}; + +Promise.hasLongStackTraces = function () { + return config.longStackTraces && longStackTracesIsSupported(); +}; + +var fireDomEvent = (function() { + try { + if (typeof CustomEvent === "function") { + var event = new CustomEvent("CustomEvent"); + util.global.dispatchEvent(event); + return function(name, event) { + var domEvent = new CustomEvent(name.toLowerCase(), { + detail: event, + cancelable: true + }); + return !util.global.dispatchEvent(domEvent); + }; + } else if (typeof Event === "function") { + var event = new Event("CustomEvent"); + util.global.dispatchEvent(event); + return function(name, event) { + var domEvent = new Event(name.toLowerCase(), { + cancelable: true + }); + domEvent.detail = event; + return !util.global.dispatchEvent(domEvent); + }; + } else { + var event = document.createEvent("CustomEvent"); + event.initCustomEvent("testingtheevent", false, true, {}); + util.global.dispatchEvent(event); + return function(name, event) { + var domEvent = document.createEvent("CustomEvent"); + domEvent.initCustomEvent(name.toLowerCase(), false, true, + event); + return !util.global.dispatchEvent(domEvent); + }; + } + } catch (e) {} + return function() { + return false; + }; +})(); + +var fireGlobalEvent = (function() { + if (util.isNode) { + return function() { + return process.emit.apply(process, arguments); + }; + } else { + if (!util.global) { + return function() { + return false; + }; + } + return function(name) { + var methodName = "on" + name.toLowerCase(); + var method = util.global[methodName]; + if (!method) return false; + method.apply(util.global, [].slice.call(arguments, 1)); + return true; + }; + } +})(); + +function generatePromiseLifecycleEventObject(name, promise) { + return {promise: promise}; +} + +var eventToObjectGenerator = { + promiseCreated: generatePromiseLifecycleEventObject, + promiseFulfilled: generatePromiseLifecycleEventObject, + promiseRejected: generatePromiseLifecycleEventObject, + promiseResolved: generatePromiseLifecycleEventObject, + promiseCancelled: generatePromiseLifecycleEventObject, + promiseChained: function(name, promise, child) { + return {promise: promise, child: child}; + }, + warning: function(name, warning) { + return {warning: warning}; + }, + unhandledRejection: function (name, reason, promise) { + return {reason: reason, promise: promise}; + }, + rejectionHandled: generatePromiseLifecycleEventObject +}; + +var activeFireEvent = function (name) { + var globalEventFired = false; + try { + globalEventFired = fireGlobalEvent.apply(null, arguments); + } catch (e) { + async.throwLater(e); + globalEventFired = true; + } + + var domEventFired = false; + try { + domEventFired = fireDomEvent(name, + eventToObjectGenerator[name].apply(null, arguments)); + } catch (e) { + async.throwLater(e); + domEventFired = true; + } + + return domEventFired || globalEventFired; +}; + +Promise.config = function(opts) { + opts = Object(opts); + if ("longStackTraces" in opts) { + if (opts.longStackTraces) { + Promise.longStackTraces(); + } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) { + disableLongStackTraces(); + } + } + if ("warnings" in opts) { + var warningsOption = opts.warnings; + config.warnings = !!warningsOption; + wForgottenReturn = config.warnings; + + if (util.isObject(warningsOption)) { + if ("wForgottenReturn" in warningsOption) { + wForgottenReturn = !!warningsOption.wForgottenReturn; + } + } + } + if ("cancellation" in opts && opts.cancellation && !config.cancellation) { + if (async.haveItemsQueued()) { + throw new Error( + "cannot enable cancellation after promises are in use"); + } + Promise.prototype._clearCancellationData = + cancellationClearCancellationData; + Promise.prototype._propagateFrom = cancellationPropagateFrom; + Promise.prototype._onCancel = cancellationOnCancel; + Promise.prototype._setOnCancel = cancellationSetOnCancel; + Promise.prototype._attachCancellationCallback = + cancellationAttachCancellationCallback; + Promise.prototype._execute = cancellationExecute; + propagateFromFunction = cancellationPropagateFrom; + config.cancellation = true; + } + if ("monitoring" in opts) { + if (opts.monitoring && !config.monitoring) { + config.monitoring = true; + Promise.prototype._fireEvent = activeFireEvent; + } else if (!opts.monitoring && config.monitoring) { + config.monitoring = false; + Promise.prototype._fireEvent = defaultFireEvent; + } + } + return Promise; +}; + +function defaultFireEvent() { return false; } + +Promise.prototype._fireEvent = defaultFireEvent; +Promise.prototype._execute = function(executor, resolve, reject) { + try { + executor(resolve, reject); + } catch (e) { + return e; + } +}; +Promise.prototype._onCancel = function () {}; +Promise.prototype._setOnCancel = function (handler) { ; }; +Promise.prototype._attachCancellationCallback = function(onCancel) { + ; +}; +Promise.prototype._captureStackTrace = function () {}; +Promise.prototype._attachExtraTrace = function () {}; +Promise.prototype._clearCancellationData = function() {}; +Promise.prototype._propagateFrom = function (parent, flags) { + ; + ; +}; + +function cancellationExecute(executor, resolve, reject) { + var promise = this; + try { + executor(resolve, reject, function(onCancel) { + if (typeof onCancel !== "function") { + throw new TypeError("onCancel must be a function, got: " + + util.toString(onCancel)); + } + promise._attachCancellationCallback(onCancel); + }); + } catch (e) { + return e; + } +} + +function cancellationAttachCancellationCallback(onCancel) { + if (!this._isCancellable()) return this; + + var previousOnCancel = this._onCancel(); + if (previousOnCancel !== undefined) { + if (util.isArray(previousOnCancel)) { + previousOnCancel.push(onCancel); + } else { + this._setOnCancel([previousOnCancel, onCancel]); + } + } else { + this._setOnCancel(onCancel); + } +} + +function cancellationOnCancel() { + return this._onCancelField; +} + +function cancellationSetOnCancel(onCancel) { + this._onCancelField = onCancel; +} + +function cancellationClearCancellationData() { + this._cancellationParent = undefined; + this._onCancelField = undefined; +} + +function cancellationPropagateFrom(parent, flags) { + if ((flags & 1) !== 0) { + this._cancellationParent = parent; + var branchesRemainingToCancel = parent._branchesRemainingToCancel; + if (branchesRemainingToCancel === undefined) { + branchesRemainingToCancel = 0; + } + parent._branchesRemainingToCancel = branchesRemainingToCancel + 1; + } + if ((flags & 2) !== 0 && parent._isBound()) { + this._setBoundTo(parent._boundTo); + } +} + +function bindingPropagateFrom(parent, flags) { + if ((flags & 2) !== 0 && parent._isBound()) { + this._setBoundTo(parent._boundTo); + } +} +var propagateFromFunction = bindingPropagateFrom; + +function boundValueFunction() { + var ret = this._boundTo; + if (ret !== undefined) { + if (ret instanceof Promise) { + if (ret.isFulfilled()) { + return ret.value(); + } else { + return undefined; + } + } + } + return ret; +} + +function longStackTracesCaptureStackTrace() { + this._trace = new CapturedTrace(this._peekContext()); +} + +function longStackTracesAttachExtraTrace(error, ignoreSelf) { + if (canAttachTrace(error)) { + var trace = this._trace; + if (trace !== undefined) { + if (ignoreSelf) trace = trace._parent; + } + if (trace !== undefined) { + trace.attachExtraTrace(error); + } else if (!error.__stackCleaned__) { + var parsed = parseStackAndMessage(error); + util.notEnumerableProp(error, "stack", + parsed.message + "\n" + parsed.stack.join("\n")); + util.notEnumerableProp(error, "__stackCleaned__", true); + } + } +} + +function checkForgottenReturns(returnValue, promiseCreated, name, promise, + parent) { + if (returnValue === undefined && promiseCreated !== null && + wForgottenReturn) { + if (parent !== undefined && parent._returnedNonUndefined()) return; + if ((promise._bitField & 65535) === 0) return; + + if (name) name = name + " "; + var handlerLine = ""; + var creatorLine = ""; + if (promiseCreated._trace) { + var traceLines = promiseCreated._trace.stack.split("\n"); + var stack = cleanStack(traceLines); + for (var i = stack.length - 1; i >= 0; --i) { + var line = stack[i]; + if (!nodeFramePattern.test(line)) { + var lineMatches = line.match(parseLinePattern); + if (lineMatches) { + handlerLine = "at " + lineMatches[1] + + ":" + lineMatches[2] + ":" + lineMatches[3] + " "; + } + break; + } + } + + if (stack.length > 0) { + var firstUserLine = stack[0]; + for (var i = 0; i < traceLines.length; ++i) { + + if (traceLines[i] === firstUserLine) { + if (i > 0) { + creatorLine = "\n" + traceLines[i - 1]; + } + break; + } + } + + } + } + var msg = "a promise was created in a " + name + + "handler " + handlerLine + "but was not returned from it, " + + "see http://goo.gl/rRqMUw" + + creatorLine; + promise._warn(msg, true, promiseCreated); + } +} + +function deprecated(name, replacement) { + var message = name + + " is deprecated and will be removed in a future version."; + if (replacement) message += " Use " + replacement + " instead."; + return warn(message); +} + +function warn(message, shouldUseOwnTrace, promise) { + if (!config.warnings) return; + var warning = new Warning(message); + var ctx; + if (shouldUseOwnTrace) { + promise._attachExtraTrace(warning); + } else if (config.longStackTraces && (ctx = Promise._peekContext())) { + ctx.attachExtraTrace(warning); + } else { + var parsed = parseStackAndMessage(warning); + warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); + } + + if (!activeFireEvent("warning", warning)) { + formatAndLogError(warning, "", true); + } +} + +function reconstructStack(message, stacks) { + for (var i = 0; i < stacks.length - 1; ++i) { + stacks[i].push("From previous event:"); + stacks[i] = stacks[i].join("\n"); + } + if (i < stacks.length) { + stacks[i] = stacks[i].join("\n"); + } + return message + "\n" + stacks.join("\n"); +} + +function removeDuplicateOrEmptyJumps(stacks) { + for (var i = 0; i < stacks.length; ++i) { + if (stacks[i].length === 0 || + ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) { + stacks.splice(i, 1); + i--; + } + } +} + +function removeCommonRoots(stacks) { + var current = stacks[0]; + for (var i = 1; i < stacks.length; ++i) { + var prev = stacks[i]; + var currentLastIndex = current.length - 1; + var currentLastLine = current[currentLastIndex]; + var commonRootMeetPoint = -1; + + for (var j = prev.length - 1; j >= 0; --j) { + if (prev[j] === currentLastLine) { + commonRootMeetPoint = j; + break; + } + } + + for (var j = commonRootMeetPoint; j >= 0; --j) { + var line = prev[j]; + if (current[currentLastIndex] === line) { + current.pop(); + currentLastIndex--; + } else { + break; + } + } + current = prev; + } +} + +function cleanStack(stack) { + var ret = []; + for (var i = 0; i < stack.length; ++i) { + var line = stack[i]; + var isTraceLine = " (No stack trace)" === line || + stackFramePattern.test(line); + var isInternalFrame = isTraceLine && shouldIgnore(line); + if (isTraceLine && !isInternalFrame) { + if (indentStackFrames && line.charAt(0) !== " ") { + line = " " + line; + } + ret.push(line); + } + } + return ret; +} + +function stackFramesAsArray(error) { + var stack = error.stack.replace(/\s+$/g, "").split("\n"); + for (var i = 0; i < stack.length; ++i) { + var line = stack[i]; + if (" (No stack trace)" === line || stackFramePattern.test(line)) { + break; + } + } + if (i > 0 && error.name != "SyntaxError") { + stack = stack.slice(i); + } + return stack; +} + +function parseStackAndMessage(error) { + var stack = error.stack; + var message = error.toString(); + stack = typeof stack === "string" && stack.length > 0 + ? stackFramesAsArray(error) : [" (No stack trace)"]; + return { + message: message, + stack: error.name == "SyntaxError" ? stack : cleanStack(stack) + }; +} + +function formatAndLogError(error, title, isSoft) { + if (typeof console !== "undefined") { + var message; + if (util.isObject(error)) { + var stack = error.stack; + message = title + formatStack(stack, error); + } else { + message = title + String(error); + } + if (typeof printWarning === "function") { + printWarning(message, isSoft); + } else if (typeof console.log === "function" || + typeof console.log === "object") { + console.log(message); + } + } +} + +function fireRejectionEvent(name, localHandler, reason, promise) { + var localEventFired = false; + try { + if (typeof localHandler === "function") { + localEventFired = true; + if (name === "rejectionHandled") { + localHandler(promise); + } else { + localHandler(reason, promise); + } + } + } catch (e) { + async.throwLater(e); + } + + if (name === "unhandledRejection") { + if (!activeFireEvent(name, reason, promise) && !localEventFired) { + formatAndLogError(reason, "Unhandled rejection "); + } + } else { + activeFireEvent(name, promise); + } +} + +function formatNonError(obj) { + var str; + if (typeof obj === "function") { + str = "[function " + + (obj.name || "anonymous") + + "]"; + } else { + str = obj && typeof obj.toString === "function" + ? obj.toString() : util.toString(obj); + var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; + if (ruselessToString.test(str)) { + try { + var newStr = JSON.stringify(obj); + str = newStr; + } + catch(e) { + + } + } + if (str.length === 0) { + str = "(empty array)"; + } + } + return ("(<" + snip(str) + ">, no stack trace)"); +} + +function snip(str) { + var maxChars = 41; + if (str.length < maxChars) { + return str; + } + return str.substr(0, maxChars - 3) + "..."; +} + +function longStackTracesIsSupported() { + return typeof captureStackTrace === "function"; +} + +var shouldIgnore = function() { return false; }; +var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; +function parseLineInfo(line) { + var matches = line.match(parseLineInfoRegex); + if (matches) { + return { + fileName: matches[1], + line: parseInt(matches[2], 10) + }; + } +} + +function setBounds(firstLineError, lastLineError) { + if (!longStackTracesIsSupported()) return; + var firstStackLines = firstLineError.stack.split("\n"); + var lastStackLines = lastLineError.stack.split("\n"); + var firstIndex = -1; + var lastIndex = -1; + var firstFileName; + var lastFileName; + for (var i = 0; i < firstStackLines.length; ++i) { + var result = parseLineInfo(firstStackLines[i]); + if (result) { + firstFileName = result.fileName; + firstIndex = result.line; + break; + } + } + for (var i = 0; i < lastStackLines.length; ++i) { + var result = parseLineInfo(lastStackLines[i]); + if (result) { + lastFileName = result.fileName; + lastIndex = result.line; + break; + } + } + if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || + firstFileName !== lastFileName || firstIndex >= lastIndex) { + return; + } + + shouldIgnore = function(line) { + if (bluebirdFramePattern.test(line)) return true; + var info = parseLineInfo(line); + if (info) { + if (info.fileName === firstFileName && + (firstIndex <= info.line && info.line <= lastIndex)) { + return true; + } + } + return false; + }; +} + +function CapturedTrace(parent) { + this._parent = parent; + this._promisesCreated = 0; + var length = this._length = 1 + (parent === undefined ? 0 : parent._length); + captureStackTrace(this, CapturedTrace); + if (length > 32) this.uncycle(); +} +util.inherits(CapturedTrace, Error); +Context.CapturedTrace = CapturedTrace; + +CapturedTrace.prototype.uncycle = function() { + var length = this._length; + if (length < 2) return; + var nodes = []; + var stackToIndex = {}; + + for (var i = 0, node = this; node !== undefined; ++i) { + nodes.push(node); + node = node._parent; + } + length = this._length = i; + for (var i = length - 1; i >= 0; --i) { + var stack = nodes[i].stack; + if (stackToIndex[stack] === undefined) { + stackToIndex[stack] = i; + } + } + for (var i = 0; i < length; ++i) { + var currentStack = nodes[i].stack; + var index = stackToIndex[currentStack]; + if (index !== undefined && index !== i) { + if (index > 0) { + nodes[index - 1]._parent = undefined; + nodes[index - 1]._length = 1; + } + nodes[i]._parent = undefined; + nodes[i]._length = 1; + var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; + + if (index < length - 1) { + cycleEdgeNode._parent = nodes[index + 1]; + cycleEdgeNode._parent.uncycle(); + cycleEdgeNode._length = + cycleEdgeNode._parent._length + 1; + } else { + cycleEdgeNode._parent = undefined; + cycleEdgeNode._length = 1; + } + var currentChildLength = cycleEdgeNode._length + 1; + for (var j = i - 2; j >= 0; --j) { + nodes[j]._length = currentChildLength; + currentChildLength++; + } + return; + } + } +}; + +CapturedTrace.prototype.attachExtraTrace = function(error) { + if (error.__stackCleaned__) return; + this.uncycle(); + var parsed = parseStackAndMessage(error); + var message = parsed.message; + var stacks = [parsed.stack]; + + var trace = this; + while (trace !== undefined) { + stacks.push(cleanStack(trace.stack.split("\n"))); + trace = trace._parent; + } + removeCommonRoots(stacks); + removeDuplicateOrEmptyJumps(stacks); + util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); + util.notEnumerableProp(error, "__stackCleaned__", true); +}; + +var captureStackTrace = (function stackDetection() { + var v8stackFramePattern = /^\s*at\s*/; + var v8stackFormatter = function(stack, error) { + if (typeof stack === "string") return stack; + + if (error.name !== undefined && + error.message !== undefined) { + return error.toString(); + } + return formatNonError(error); + }; + + if (typeof Error.stackTraceLimit === "number" && + typeof Error.captureStackTrace === "function") { + Error.stackTraceLimit += 6; + stackFramePattern = v8stackFramePattern; + formatStack = v8stackFormatter; + var captureStackTrace = Error.captureStackTrace; + + shouldIgnore = function(line) { + return bluebirdFramePattern.test(line); + }; + return function(receiver, ignoreUntil) { + Error.stackTraceLimit += 6; + captureStackTrace(receiver, ignoreUntil); + Error.stackTraceLimit -= 6; + }; + } + var err = new Error(); + + if (typeof err.stack === "string" && + err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { + stackFramePattern = /@/; + formatStack = v8stackFormatter; + indentStackFrames = true; + return function captureStackTrace(o) { + o.stack = new Error().stack; + }; + } + + var hasStackAfterThrow; + try { throw new Error(); } + catch(e) { + hasStackAfterThrow = ("stack" in e); + } + if (!("stack" in err) && hasStackAfterThrow && + typeof Error.stackTraceLimit === "number") { + stackFramePattern = v8stackFramePattern; + formatStack = v8stackFormatter; + return function captureStackTrace(o) { + Error.stackTraceLimit += 6; + try { throw new Error(); } + catch(e) { o.stack = e.stack; } + Error.stackTraceLimit -= 6; + }; + } + + formatStack = function(stack, error) { + if (typeof stack === "string") return stack; + + if ((typeof error === "object" || + typeof error === "function") && + error.name !== undefined && + error.message !== undefined) { + return error.toString(); + } + return formatNonError(error); + }; + + return null; + +})([]); + +if (typeof console !== "undefined" && typeof console.warn !== "undefined") { + printWarning = function (message) { + console.warn(message); + }; + if (util.isNode && process.stderr.isTTY) { + printWarning = function(message, isSoft) { + var color = isSoft ? "\u001b[33m" : "\u001b[31m"; + console.warn(color + message + "\u001b[0m\n"); + }; + } else if (!util.isNode && typeof (new Error().stack) === "string") { + printWarning = function(message, isSoft) { + console.warn("%c" + message, + isSoft ? "color: darkorange" : "color: red"); + }; + } +} + +var config = { + warnings: warnings, + longStackTraces: false, + cancellation: false, + monitoring: false +}; + +if (longStackTraces) Promise.longStackTraces(); + +return { + longStackTraces: function() { + return config.longStackTraces; + }, + warnings: function() { + return config.warnings; + }, + cancellation: function() { + return config.cancellation; + }, + monitoring: function() { + return config.monitoring; + }, + propagateFromFunction: function() { + return propagateFromFunction; + }, + boundValueFunction: function() { + return boundValueFunction; + }, + checkForgottenReturns: checkForgottenReturns, + setBounds: setBounds, + warn: warn, + deprecated: deprecated, + CapturedTrace: CapturedTrace, + fireDomEvent: fireDomEvent, + fireGlobalEvent: fireGlobalEvent +}; +}; + +},{"./errors":12,"./util":36}],10:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise) { +function returner() { + return this.value; +} +function thrower() { + throw this.reason; +} + +Promise.prototype["return"] = +Promise.prototype.thenReturn = function (value) { + if (value instanceof Promise) value.suppressUnhandledRejections(); + return this._then( + returner, undefined, undefined, {value: value}, undefined); +}; + +Promise.prototype["throw"] = +Promise.prototype.thenThrow = function (reason) { + return this._then( + thrower, undefined, undefined, {reason: reason}, undefined); +}; + +Promise.prototype.catchThrow = function (reason) { + if (arguments.length <= 1) { + return this._then( + undefined, thrower, undefined, {reason: reason}, undefined); + } else { + var _reason = arguments[1]; + var handler = function() {throw _reason;}; + return this.caught(reason, handler); + } +}; + +Promise.prototype.catchReturn = function (value) { + if (arguments.length <= 1) { + if (value instanceof Promise) value.suppressUnhandledRejections(); + return this._then( + undefined, returner, undefined, {value: value}, undefined); + } else { + var _value = arguments[1]; + if (_value instanceof Promise) _value.suppressUnhandledRejections(); + var handler = function() {return _value;}; + return this.caught(value, handler); + } +}; +}; + +},{}],11:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var PromiseReduce = Promise.reduce; +var PromiseAll = Promise.all; + +function promiseAllThis() { + return PromiseAll(this); +} + +function PromiseMapSeries(promises, fn) { + return PromiseReduce(promises, fn, INTERNAL, INTERNAL); +} + +Promise.prototype.each = function (fn) { + return PromiseReduce(this, fn, INTERNAL, 0) + ._then(promiseAllThis, undefined, undefined, this, undefined); +}; + +Promise.prototype.mapSeries = function (fn) { + return PromiseReduce(this, fn, INTERNAL, INTERNAL); +}; + +Promise.each = function (promises, fn) { + return PromiseReduce(promises, fn, INTERNAL, 0) + ._then(promiseAllThis, undefined, undefined, promises, undefined); +}; + +Promise.mapSeries = PromiseMapSeries; +}; + + +},{}],12:[function(_dereq_,module,exports){ +"use strict"; +var es5 = _dereq_("./es5"); +var Objectfreeze = es5.freeze; +var util = _dereq_("./util"); +var inherits = util.inherits; +var notEnumerableProp = util.notEnumerableProp; + +function subError(nameProperty, defaultMessage) { + function SubError(message) { + if (!(this instanceof SubError)) return new SubError(message); + notEnumerableProp(this, "message", + typeof message === "string" ? message : defaultMessage); + notEnumerableProp(this, "name", nameProperty); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + Error.call(this); + } + } + inherits(SubError, Error); + return SubError; +} + +var _TypeError, _RangeError; +var Warning = subError("Warning", "warning"); +var CancellationError = subError("CancellationError", "cancellation error"); +var TimeoutError = subError("TimeoutError", "timeout error"); +var AggregateError = subError("AggregateError", "aggregate error"); +try { + _TypeError = TypeError; + _RangeError = RangeError; +} catch(e) { + _TypeError = subError("TypeError", "type error"); + _RangeError = subError("RangeError", "range error"); +} + +var methods = ("join pop push shift unshift slice filter forEach some " + + "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" "); + +for (var i = 0; i < methods.length; ++i) { + if (typeof Array.prototype[methods[i]] === "function") { + AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; + } +} + +es5.defineProperty(AggregateError.prototype, "length", { + value: 0, + configurable: false, + writable: true, + enumerable: true +}); +AggregateError.prototype["isOperational"] = true; +var level = 0; +AggregateError.prototype.toString = function() { + var indent = Array(level * 4 + 1).join(" "); + var ret = "\n" + indent + "AggregateError of:" + "\n"; + level++; + indent = Array(level * 4 + 1).join(" "); + for (var i = 0; i < this.length; ++i) { + var str = this[i] === this ? "[Circular AggregateError]" : this[i] + ""; + var lines = str.split("\n"); + for (var j = 0; j < lines.length; ++j) { + lines[j] = indent + lines[j]; + } + str = lines.join("\n"); + ret += str + "\n"; + } + level--; + return ret; +}; + +function OperationalError(message) { + if (!(this instanceof OperationalError)) + return new OperationalError(message); + notEnumerableProp(this, "name", "OperationalError"); + notEnumerableProp(this, "message", message); + this.cause = message; + this["isOperational"] = true; + + if (message instanceof Error) { + notEnumerableProp(this, "message", message.message); + notEnumerableProp(this, "stack", message.stack); + } else if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + +} +inherits(OperationalError, Error); + +var errorTypes = Error["__BluebirdErrorTypes__"]; +if (!errorTypes) { + errorTypes = Objectfreeze({ + CancellationError: CancellationError, + TimeoutError: TimeoutError, + OperationalError: OperationalError, + RejectionError: OperationalError, + AggregateError: AggregateError + }); + es5.defineProperty(Error, "__BluebirdErrorTypes__", { + value: errorTypes, + writable: false, + enumerable: false, + configurable: false + }); +} + +module.exports = { + Error: Error, + TypeError: _TypeError, + RangeError: _RangeError, + CancellationError: errorTypes.CancellationError, + OperationalError: errorTypes.OperationalError, + TimeoutError: errorTypes.TimeoutError, + AggregateError: errorTypes.AggregateError, + Warning: Warning +}; + +},{"./es5":13,"./util":36}],13:[function(_dereq_,module,exports){ +var isES5 = (function(){ + "use strict"; + return this === undefined; +})(); + +if (isES5) { + module.exports = { + freeze: Object.freeze, + defineProperty: Object.defineProperty, + getDescriptor: Object.getOwnPropertyDescriptor, + keys: Object.keys, + names: Object.getOwnPropertyNames, + getPrototypeOf: Object.getPrototypeOf, + isArray: Array.isArray, + isES5: isES5, + propertyIsWritable: function(obj, prop) { + var descriptor = Object.getOwnPropertyDescriptor(obj, prop); + return !!(!descriptor || descriptor.writable || descriptor.set); + } + }; +} else { + var has = {}.hasOwnProperty; + var str = {}.toString; + var proto = {}.constructor.prototype; + + var ObjectKeys = function (o) { + var ret = []; + for (var key in o) { + if (has.call(o, key)) { + ret.push(key); + } + } + return ret; + }; + + var ObjectGetDescriptor = function(o, key) { + return {value: o[key]}; + }; + + var ObjectDefineProperty = function (o, key, desc) { + o[key] = desc.value; + return o; + }; + + var ObjectFreeze = function (obj) { + return obj; + }; + + var ObjectGetPrototypeOf = function (obj) { + try { + return Object(obj).constructor.prototype; + } + catch (e) { + return proto; + } + }; + + var ArrayIsArray = function (obj) { + try { + return str.call(obj) === "[object Array]"; + } + catch(e) { + return false; + } + }; + + module.exports = { + isArray: ArrayIsArray, + keys: ObjectKeys, + names: ObjectKeys, + defineProperty: ObjectDefineProperty, + getDescriptor: ObjectGetDescriptor, + freeze: ObjectFreeze, + getPrototypeOf: ObjectGetPrototypeOf, + isES5: isES5, + propertyIsWritable: function() { + return true; + } + }; +} + +},{}],14:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var PromiseMap = Promise.map; + +Promise.prototype.filter = function (fn, options) { + return PromiseMap(this, fn, options, INTERNAL); +}; + +Promise.filter = function (promises, fn, options) { + return PromiseMap(promises, fn, options, INTERNAL); +}; +}; + +},{}],15:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) { +var util = _dereq_("./util"); +var CancellationError = Promise.CancellationError; +var errorObj = util.errorObj; +var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER); + +function PassThroughHandlerContext(promise, type, handler) { + this.promise = promise; + this.type = type; + this.handler = handler; + this.called = false; + this.cancelPromise = null; +} + +PassThroughHandlerContext.prototype.isFinallyHandler = function() { + return this.type === 0; +}; + +function FinallyHandlerCancelReaction(finallyHandler) { + this.finallyHandler = finallyHandler; +} + +FinallyHandlerCancelReaction.prototype._resultCancelled = function() { + checkCancel(this.finallyHandler); +}; + +function checkCancel(ctx, reason) { + if (ctx.cancelPromise != null) { + if (arguments.length > 1) { + ctx.cancelPromise._reject(reason); + } else { + ctx.cancelPromise._cancel(); + } + ctx.cancelPromise = null; + return true; + } + return false; +} + +function succeed() { + return finallyHandler.call(this, this.promise._target()._settledValue()); +} +function fail(reason) { + if (checkCancel(this, reason)) return; + errorObj.e = reason; + return errorObj; +} +function finallyHandler(reasonOrValue) { + var promise = this.promise; + var handler = this.handler; + + if (!this.called) { + this.called = true; + var ret = this.isFinallyHandler() + ? handler.call(promise._boundValue()) + : handler.call(promise._boundValue(), reasonOrValue); + if (ret === NEXT_FILTER) { + return ret; + } else if (ret !== undefined) { + promise._setReturnedNonUndefined(); + var maybePromise = tryConvertToPromise(ret, promise); + if (maybePromise instanceof Promise) { + if (this.cancelPromise != null) { + if (maybePromise._isCancelled()) { + var reason = + new CancellationError("late cancellation observer"); + promise._attachExtraTrace(reason); + errorObj.e = reason; + return errorObj; + } else if (maybePromise.isPending()) { + maybePromise._attachCancellationCallback( + new FinallyHandlerCancelReaction(this)); + } + } + return maybePromise._then( + succeed, fail, undefined, this, undefined); + } + } + } + + if (promise.isRejected()) { + checkCancel(this); + errorObj.e = reasonOrValue; + return errorObj; + } else { + checkCancel(this); + return reasonOrValue; + } +} + +Promise.prototype._passThrough = function(handler, type, success, fail) { + if (typeof handler !== "function") return this.then(); + return this._then(success, + fail, + undefined, + new PassThroughHandlerContext(this, type, handler), + undefined); +}; + +Promise.prototype.lastly = +Promise.prototype["finally"] = function (handler) { + return this._passThrough(handler, + 0, + finallyHandler, + finallyHandler); +}; + + +Promise.prototype.tap = function (handler) { + return this._passThrough(handler, 1, finallyHandler); +}; + +Promise.prototype.tapCatch = function (handlerOrPredicate) { + var len = arguments.length; + if(len === 1) { + return this._passThrough(handlerOrPredicate, + 1, + undefined, + finallyHandler); + } else { + var catchInstances = new Array(len - 1), + j = 0, i; + for (i = 0; i < len - 1; ++i) { + var item = arguments[i]; + if (util.isObject(item)) { + catchInstances[j++] = item; + } else { + return Promise.reject(new TypeError( + "tapCatch statement predicate: " + + "expecting an object but got " + util.classString(item) + )); + } + } + catchInstances.length = j; + var handler = arguments[i]; + return this._passThrough(catchFilter(catchInstances, handler, this), + 1, + undefined, + finallyHandler); + } + +}; + +return PassThroughHandlerContext; +}; + +},{"./catch_filter":7,"./util":36}],16:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, + apiRejection, + INTERNAL, + tryConvertToPromise, + Proxyable, + debug) { +var errors = _dereq_("./errors"); +var TypeError = errors.TypeError; +var util = _dereq_("./util"); +var errorObj = util.errorObj; +var tryCatch = util.tryCatch; +var yieldHandlers = []; + +function promiseFromYieldHandler(value, yieldHandlers, traceParent) { + for (var i = 0; i < yieldHandlers.length; ++i) { + traceParent._pushContext(); + var result = tryCatch(yieldHandlers[i])(value); + traceParent._popContext(); + if (result === errorObj) { + traceParent._pushContext(); + var ret = Promise.reject(errorObj.e); + traceParent._popContext(); + return ret; + } + var maybePromise = tryConvertToPromise(result, traceParent); + if (maybePromise instanceof Promise) return maybePromise; + } + return null; +} + +function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { + if (debug.cancellation()) { + var internal = new Promise(INTERNAL); + var _finallyPromise = this._finallyPromise = new Promise(INTERNAL); + this._promise = internal.lastly(function() { + return _finallyPromise; + }); + internal._captureStackTrace(); + internal._setOnCancel(this); + } else { + var promise = this._promise = new Promise(INTERNAL); + promise._captureStackTrace(); + } + this._stack = stack; + this._generatorFunction = generatorFunction; + this._receiver = receiver; + this._generator = undefined; + this._yieldHandlers = typeof yieldHandler === "function" + ? [yieldHandler].concat(yieldHandlers) + : yieldHandlers; + this._yieldedPromise = null; + this._cancellationPhase = false; +} +util.inherits(PromiseSpawn, Proxyable); + +PromiseSpawn.prototype._isResolved = function() { + return this._promise === null; +}; + +PromiseSpawn.prototype._cleanup = function() { + this._promise = this._generator = null; + if (debug.cancellation() && this._finallyPromise !== null) { + this._finallyPromise._fulfill(); + this._finallyPromise = null; + } +}; + +PromiseSpawn.prototype._promiseCancelled = function() { + if (this._isResolved()) return; + var implementsReturn = typeof this._generator["return"] !== "undefined"; + + var result; + if (!implementsReturn) { + var reason = new Promise.CancellationError( + "generator .return() sentinel"); + Promise.coroutine.returnSentinel = reason; + this._promise._attachExtraTrace(reason); + this._promise._pushContext(); + result = tryCatch(this._generator["throw"]).call(this._generator, + reason); + this._promise._popContext(); + } else { + this._promise._pushContext(); + result = tryCatch(this._generator["return"]).call(this._generator, + undefined); + this._promise._popContext(); + } + this._cancellationPhase = true; + this._yieldedPromise = null; + this._continue(result); +}; + +PromiseSpawn.prototype._promiseFulfilled = function(value) { + this._yieldedPromise = null; + this._promise._pushContext(); + var result = tryCatch(this._generator.next).call(this._generator, value); + this._promise._popContext(); + this._continue(result); +}; + +PromiseSpawn.prototype._promiseRejected = function(reason) { + this._yieldedPromise = null; + this._promise._attachExtraTrace(reason); + this._promise._pushContext(); + var result = tryCatch(this._generator["throw"]) + .call(this._generator, reason); + this._promise._popContext(); + this._continue(result); +}; + +PromiseSpawn.prototype._resultCancelled = function() { + if (this._yieldedPromise instanceof Promise) { + var promise = this._yieldedPromise; + this._yieldedPromise = null; + promise.cancel(); + } +}; + +PromiseSpawn.prototype.promise = function () { + return this._promise; +}; + +PromiseSpawn.prototype._run = function () { + this._generator = this._generatorFunction.call(this._receiver); + this._receiver = + this._generatorFunction = undefined; + this._promiseFulfilled(undefined); +}; + +PromiseSpawn.prototype._continue = function (result) { + var promise = this._promise; + if (result === errorObj) { + this._cleanup(); + if (this._cancellationPhase) { + return promise.cancel(); + } else { + return promise._rejectCallback(result.e, false); + } + } + + var value = result.value; + if (result.done === true) { + this._cleanup(); + if (this._cancellationPhase) { + return promise.cancel(); + } else { + return promise._resolveCallback(value); + } + } else { + var maybePromise = tryConvertToPromise(value, this._promise); + if (!(maybePromise instanceof Promise)) { + maybePromise = + promiseFromYieldHandler(maybePromise, + this._yieldHandlers, + this._promise); + if (maybePromise === null) { + this._promiseRejected( + new TypeError( + "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", String(value)) + + "From coroutine:\u000a" + + this._stack.split("\n").slice(1, -7).join("\n") + ) + ); + return; + } + } + maybePromise = maybePromise._target(); + var bitField = maybePromise._bitField; + ; + if (((bitField & 50397184) === 0)) { + this._yieldedPromise = maybePromise; + maybePromise._proxy(this, null); + } else if (((bitField & 33554432) !== 0)) { + Promise._async.invoke( + this._promiseFulfilled, this, maybePromise._value() + ); + } else if (((bitField & 16777216) !== 0)) { + Promise._async.invoke( + this._promiseRejected, this, maybePromise._reason() + ); + } else { + this._promiseCancelled(); + } + } +}; + +Promise.coroutine = function (generatorFunction, options) { + if (typeof generatorFunction !== "function") { + throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + var yieldHandler = Object(options).yieldHandler; + var PromiseSpawn$ = PromiseSpawn; + var stack = new Error().stack; + return function () { + var generator = generatorFunction.apply(this, arguments); + var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler, + stack); + var ret = spawn.promise(); + spawn._generator = generator; + spawn._promiseFulfilled(undefined); + return ret; + }; +}; + +Promise.coroutine.addYieldHandler = function(fn) { + if (typeof fn !== "function") { + throw new TypeError("expecting a function but got " + util.classString(fn)); + } + yieldHandlers.push(fn); +}; + +Promise.spawn = function (generatorFunction) { + debug.deprecated("Promise.spawn()", "Promise.coroutine()"); + if (typeof generatorFunction !== "function") { + return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + var spawn = new PromiseSpawn(generatorFunction, this); + var ret = spawn.promise(); + spawn._run(Promise.spawn); + return ret; +}; +}; + +},{"./errors":12,"./util":36}],17:[function(_dereq_,module,exports){ +"use strict"; +module.exports = +function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, + getDomain) { +var util = _dereq_("./util"); +var canEvaluate = util.canEvaluate; +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var reject; + +if (!true) { +if (canEvaluate) { + var thenCallback = function(i) { + return new Function("value", "holder", " \n\ + 'use strict'; \n\ + holder.pIndex = value; \n\ + holder.checkFulfillment(this); \n\ + ".replace(/Index/g, i)); + }; + + var promiseSetter = function(i) { + return new Function("promise", "holder", " \n\ + 'use strict'; \n\ + holder.pIndex = promise; \n\ + ".replace(/Index/g, i)); + }; + + var generateHolderClass = function(total) { + var props = new Array(total); + for (var i = 0; i < props.length; ++i) { + props[i] = "this.p" + (i+1); + } + var assignment = props.join(" = ") + " = null;"; + var cancellationCode= "var promise;\n" + props.map(function(prop) { + return " \n\ + promise = " + prop + "; \n\ + if (promise instanceof Promise) { \n\ + promise.cancel(); \n\ + } \n\ + "; + }).join("\n"); + var passedArguments = props.join(", "); + var name = "Holder$" + total; + + + var code = "return function(tryCatch, errorObj, Promise, async) { \n\ + 'use strict'; \n\ + function [TheName](fn) { \n\ + [TheProperties] \n\ + this.fn = fn; \n\ + this.asyncNeeded = true; \n\ + this.now = 0; \n\ + } \n\ + \n\ + [TheName].prototype._callFunction = function(promise) { \n\ + promise._pushContext(); \n\ + var ret = tryCatch(this.fn)([ThePassedArguments]); \n\ + promise._popContext(); \n\ + if (ret === errorObj) { \n\ + promise._rejectCallback(ret.e, false); \n\ + } else { \n\ + promise._resolveCallback(ret); \n\ + } \n\ + }; \n\ + \n\ + [TheName].prototype.checkFulfillment = function(promise) { \n\ + var now = ++this.now; \n\ + if (now === [TheTotal]) { \n\ + if (this.asyncNeeded) { \n\ + async.invoke(this._callFunction, this, promise); \n\ + } else { \n\ + this._callFunction(promise); \n\ + } \n\ + \n\ + } \n\ + }; \n\ + \n\ + [TheName].prototype._resultCancelled = function() { \n\ + [CancellationCode] \n\ + }; \n\ + \n\ + return [TheName]; \n\ + }(tryCatch, errorObj, Promise, async); \n\ + "; + + code = code.replace(/\[TheName\]/g, name) + .replace(/\[TheTotal\]/g, total) + .replace(/\[ThePassedArguments\]/g, passedArguments) + .replace(/\[TheProperties\]/g, assignment) + .replace(/\[CancellationCode\]/g, cancellationCode); + + return new Function("tryCatch", "errorObj", "Promise", "async", code) + (tryCatch, errorObj, Promise, async); + }; + + var holderClasses = []; + var thenCallbacks = []; + var promiseSetters = []; + + for (var i = 0; i < 8; ++i) { + holderClasses.push(generateHolderClass(i + 1)); + thenCallbacks.push(thenCallback(i + 1)); + promiseSetters.push(promiseSetter(i + 1)); + } + + reject = function (reason) { + this._reject(reason); + }; +}} + +Promise.join = function () { + var last = arguments.length - 1; + var fn; + if (last > 0 && typeof arguments[last] === "function") { + fn = arguments[last]; + if (!true) { + if (last <= 8 && canEvaluate) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + var HolderClass = holderClasses[last - 1]; + var holder = new HolderClass(fn); + var callbacks = thenCallbacks; + + for (var i = 0; i < last; ++i) { + var maybePromise = tryConvertToPromise(arguments[i], ret); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + var bitField = maybePromise._bitField; + ; + if (((bitField & 50397184) === 0)) { + maybePromise._then(callbacks[i], reject, + undefined, ret, holder); + promiseSetters[i](maybePromise, holder); + holder.asyncNeeded = false; + } else if (((bitField & 33554432) !== 0)) { + callbacks[i].call(ret, + maybePromise._value(), holder); + } else if (((bitField & 16777216) !== 0)) { + ret._reject(maybePromise._reason()); + } else { + ret._cancel(); + } + } else { + callbacks[i].call(ret, maybePromise, holder); + } + } + + if (!ret._isFateSealed()) { + if (holder.asyncNeeded) { + var domain = getDomain(); + if (domain !== null) { + holder.fn = util.domainBind(domain, holder.fn); + } + } + ret._setAsyncGuaranteed(); + ret._setOnCancel(holder); + } + return ret; + } + } + } + var args = [].slice.call(arguments);; + if (fn) args.pop(); + var ret = new PromiseArray(args).promise(); + return fn !== undefined ? ret.spread(fn) : ret; +}; + +}; + +},{"./util":36}],18:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, + PromiseArray, + apiRejection, + tryConvertToPromise, + INTERNAL, + debug) { +var getDomain = Promise._getDomain; +var util = _dereq_("./util"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var async = Promise._async; + +function MappingPromiseArray(promises, fn, limit, _filter) { + this.constructor$(promises); + this._promise._captureStackTrace(); + var domain = getDomain(); + this._callback = domain === null ? fn : util.domainBind(domain, fn); + this._preservedValues = _filter === INTERNAL + ? new Array(this.length()) + : null; + this._limit = limit; + this._inFlight = 0; + this._queue = []; + async.invoke(this._asyncInit, this, undefined); +} +util.inherits(MappingPromiseArray, PromiseArray); + +MappingPromiseArray.prototype._asyncInit = function() { + this._init$(undefined, -2); +}; + +MappingPromiseArray.prototype._init = function () {}; + +MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { + var values = this._values; + var length = this.length(); + var preservedValues = this._preservedValues; + var limit = this._limit; + + if (index < 0) { + index = (index * -1) - 1; + values[index] = value; + if (limit >= 1) { + this._inFlight--; + this._drainQueue(); + if (this._isResolved()) return true; + } + } else { + if (limit >= 1 && this._inFlight >= limit) { + values[index] = value; + this._queue.push(index); + return false; + } + if (preservedValues !== null) preservedValues[index] = value; + + var promise = this._promise; + var callback = this._callback; + var receiver = promise._boundValue(); + promise._pushContext(); + var ret = tryCatch(callback).call(receiver, value, index, length); + var promiseCreated = promise._popContext(); + debug.checkForgottenReturns( + ret, + promiseCreated, + preservedValues !== null ? "Promise.filter" : "Promise.map", + promise + ); + if (ret === errorObj) { + this._reject(ret.e); + return true; + } + + var maybePromise = tryConvertToPromise(ret, this._promise); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + var bitField = maybePromise._bitField; + ; + if (((bitField & 50397184) === 0)) { + if (limit >= 1) this._inFlight++; + values[index] = maybePromise; + maybePromise._proxy(this, (index + 1) * -1); + return false; + } else if (((bitField & 33554432) !== 0)) { + ret = maybePromise._value(); + } else if (((bitField & 16777216) !== 0)) { + this._reject(maybePromise._reason()); + return true; + } else { + this._cancel(); + return true; + } + } + values[index] = ret; + } + var totalResolved = ++this._totalResolved; + if (totalResolved >= length) { + if (preservedValues !== null) { + this._filter(values, preservedValues); + } else { + this._resolve(values); + } + return true; + } + return false; +}; + +MappingPromiseArray.prototype._drainQueue = function () { + var queue = this._queue; + var limit = this._limit; + var values = this._values; + while (queue.length > 0 && this._inFlight < limit) { + if (this._isResolved()) return; + var index = queue.pop(); + this._promiseFulfilled(values[index], index); + } +}; + +MappingPromiseArray.prototype._filter = function (booleans, values) { + var len = values.length; + var ret = new Array(len); + var j = 0; + for (var i = 0; i < len; ++i) { + if (booleans[i]) ret[j++] = values[i]; + } + ret.length = j; + this._resolve(ret); +}; + +MappingPromiseArray.prototype.preservedValues = function () { + return this._preservedValues; +}; + +function map(promises, fn, options, _filter) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + + var limit = 0; + if (options !== undefined) { + if (typeof options === "object" && options !== null) { + if (typeof options.concurrency !== "number") { + return Promise.reject( + new TypeError("'concurrency' must be a number but it is " + + util.classString(options.concurrency))); + } + limit = options.concurrency; + } else { + return Promise.reject(new TypeError( + "options argument must be an object but it is " + + util.classString(options))); + } + } + limit = typeof limit === "number" && + isFinite(limit) && limit >= 1 ? limit : 0; + return new MappingPromiseArray(promises, fn, limit, _filter).promise(); +} + +Promise.prototype.map = function (fn, options) { + return map(this, fn, options, null); +}; + +Promise.map = function (promises, fn, options, _filter) { + return map(promises, fn, options, _filter); +}; + + +}; + +},{"./util":36}],19:[function(_dereq_,module,exports){ +"use strict"; +module.exports = +function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) { +var util = _dereq_("./util"); +var tryCatch = util.tryCatch; + +Promise.method = function (fn) { + if (typeof fn !== "function") { + throw new Promise.TypeError("expecting a function but got " + util.classString(fn)); + } + return function () { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._pushContext(); + var value = tryCatch(fn).apply(this, arguments); + var promiseCreated = ret._popContext(); + debug.checkForgottenReturns( + value, promiseCreated, "Promise.method", ret); + ret._resolveFromSyncValue(value); + return ret; + }; +}; + +Promise.attempt = Promise["try"] = function (fn) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._pushContext(); + var value; + if (arguments.length > 1) { + debug.deprecated("calling Promise.try with more than 1 argument"); + var arg = arguments[1]; + var ctx = arguments[2]; + value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg) + : tryCatch(fn).call(ctx, arg); + } else { + value = tryCatch(fn)(); + } + var promiseCreated = ret._popContext(); + debug.checkForgottenReturns( + value, promiseCreated, "Promise.try", ret); + ret._resolveFromSyncValue(value); + return ret; +}; + +Promise.prototype._resolveFromSyncValue = function (value) { + if (value === util.errorObj) { + this._rejectCallback(value.e, false); + } else { + this._resolveCallback(value, true); + } +}; +}; + +},{"./util":36}],20:[function(_dereq_,module,exports){ +"use strict"; +var util = _dereq_("./util"); +var maybeWrapAsError = util.maybeWrapAsError; +var errors = _dereq_("./errors"); +var OperationalError = errors.OperationalError; +var es5 = _dereq_("./es5"); + +function isUntypedError(obj) { + return obj instanceof Error && + es5.getPrototypeOf(obj) === Error.prototype; +} + +var rErrorKey = /^(?:name|message|stack|cause)$/; +function wrapAsOperationalError(obj) { + var ret; + if (isUntypedError(obj)) { + ret = new OperationalError(obj); + ret.name = obj.name; + ret.message = obj.message; + ret.stack = obj.stack; + var keys = es5.keys(obj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (!rErrorKey.test(key)) { + ret[key] = obj[key]; + } + } + return ret; + } + util.markAsOriginatingFromRejection(obj); + return obj; +} + +function nodebackForPromise(promise, multiArgs) { + return function(err, value) { + if (promise === null) return; + if (err) { + var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); + promise._attachExtraTrace(wrapped); + promise._reject(wrapped); + } else if (!multiArgs) { + promise._fulfill(value); + } else { + var args = [].slice.call(arguments, 1);; + promise._fulfill(args); + } + promise = null; + }; +} + +module.exports = nodebackForPromise; + +},{"./errors":12,"./es5":13,"./util":36}],21:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise) { +var util = _dereq_("./util"); +var async = Promise._async; +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; + +function spreadAdapter(val, nodeback) { + var promise = this; + if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); + var ret = + tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val)); + if (ret === errorObj) { + async.throwLater(ret.e); + } +} + +function successAdapter(val, nodeback) { + var promise = this; + var receiver = promise._boundValue(); + var ret = val === undefined + ? tryCatch(nodeback).call(receiver, null) + : tryCatch(nodeback).call(receiver, null, val); + if (ret === errorObj) { + async.throwLater(ret.e); + } +} +function errorAdapter(reason, nodeback) { + var promise = this; + if (!reason) { + var newReason = new Error(reason + ""); + newReason.cause = reason; + reason = newReason; + } + var ret = tryCatch(nodeback).call(promise._boundValue(), reason); + if (ret === errorObj) { + async.throwLater(ret.e); + } +} + +Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback, + options) { + if (typeof nodeback == "function") { + var adapter = successAdapter; + if (options !== undefined && Object(options).spread) { + adapter = spreadAdapter; + } + this._then( + adapter, + errorAdapter, + undefined, + this, + nodeback + ); + } + return this; +}; +}; + +},{"./util":36}],22:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function() { +var makeSelfResolutionError = function () { + return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a"); +}; +var reflectHandler = function() { + return new Promise.PromiseInspection(this._target()); +}; +var apiRejection = function(msg) { + return Promise.reject(new TypeError(msg)); +}; +function Proxyable() {} +var UNDEFINED_BINDING = {}; +var util = _dereq_("./util"); + +var getDomain; +if (util.isNode) { + getDomain = function() { + var ret = process.domain; + if (ret === undefined) ret = null; + return ret; + }; +} else { + getDomain = function() { + return null; + }; +} +util.notEnumerableProp(Promise, "_getDomain", getDomain); + +var es5 = _dereq_("./es5"); +var Async = _dereq_("./async"); +var async = new Async(); +es5.defineProperty(Promise, "_async", {value: async}); +var errors = _dereq_("./errors"); +var TypeError = Promise.TypeError = errors.TypeError; +Promise.RangeError = errors.RangeError; +var CancellationError = Promise.CancellationError = errors.CancellationError; +Promise.TimeoutError = errors.TimeoutError; +Promise.OperationalError = errors.OperationalError; +Promise.RejectionError = errors.OperationalError; +Promise.AggregateError = errors.AggregateError; +var INTERNAL = function(){}; +var APPLY = {}; +var NEXT_FILTER = {}; +var tryConvertToPromise = _dereq_("./thenables")(Promise, INTERNAL); +var PromiseArray = + _dereq_("./promise_array")(Promise, INTERNAL, + tryConvertToPromise, apiRejection, Proxyable); +var Context = _dereq_("./context")(Promise); + /*jshint unused:false*/ +var createContext = Context.create; +var debug = _dereq_("./debuggability")(Promise, Context); +var CapturedTrace = debug.CapturedTrace; +var PassThroughHandlerContext = + _dereq_("./finally")(Promise, tryConvertToPromise, NEXT_FILTER); +var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER); +var nodebackForPromise = _dereq_("./nodeback"); +var errorObj = util.errorObj; +var tryCatch = util.tryCatch; +function check(self, executor) { + if (self == null || self.constructor !== Promise) { + throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + if (typeof executor !== "function") { + throw new TypeError("expecting a function but got " + util.classString(executor)); + } + +} + +function Promise(executor) { + if (executor !== INTERNAL) { + check(this, executor); + } + this._bitField = 0; + this._fulfillmentHandler0 = undefined; + this._rejectionHandler0 = undefined; + this._promise0 = undefined; + this._receiver0 = undefined; + this._resolveFromExecutor(executor); + this._promiseCreated(); + this._fireEvent("promiseCreated", this); +} + +Promise.prototype.toString = function () { + return "[object Promise]"; +}; + +Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { + var len = arguments.length; + if (len > 1) { + var catchInstances = new Array(len - 1), + j = 0, i; + for (i = 0; i < len - 1; ++i) { + var item = arguments[i]; + if (util.isObject(item)) { + catchInstances[j++] = item; + } else { + return apiRejection("Catch statement predicate: " + + "expecting an object but got " + util.classString(item)); + } + } + catchInstances.length = j; + fn = arguments[i]; + return this.then(undefined, catchFilter(catchInstances, fn, this)); + } + return this.then(undefined, fn); +}; + +Promise.prototype.reflect = function () { + return this._then(reflectHandler, + reflectHandler, undefined, this, undefined); +}; + +Promise.prototype.then = function (didFulfill, didReject) { + if (debug.warnings() && arguments.length > 0 && + typeof didFulfill !== "function" && + typeof didReject !== "function") { + var msg = ".then() only accepts functions but was passed: " + + util.classString(didFulfill); + if (arguments.length > 1) { + msg += ", " + util.classString(didReject); + } + this._warn(msg); + } + return this._then(didFulfill, didReject, undefined, undefined, undefined); +}; + +Promise.prototype.done = function (didFulfill, didReject) { + var promise = + this._then(didFulfill, didReject, undefined, undefined, undefined); + promise._setIsFinal(); +}; + +Promise.prototype.spread = function (fn) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + return this.all()._then(fn, undefined, undefined, APPLY, undefined); +}; + +Promise.prototype.toJSON = function () { + var ret = { + isFulfilled: false, + isRejected: false, + fulfillmentValue: undefined, + rejectionReason: undefined + }; + if (this.isFulfilled()) { + ret.fulfillmentValue = this.value(); + ret.isFulfilled = true; + } else if (this.isRejected()) { + ret.rejectionReason = this.reason(); + ret.isRejected = true; + } + return ret; +}; + +Promise.prototype.all = function () { + if (arguments.length > 0) { + this._warn(".all() was passed arguments but it does not take any"); + } + return new PromiseArray(this).promise(); +}; + +Promise.prototype.error = function (fn) { + return this.caught(util.originatesFromRejection, fn); +}; + +Promise.getNewLibraryCopy = module.exports; + +Promise.is = function (val) { + return val instanceof Promise; +}; + +Promise.fromNode = Promise.fromCallback = function(fn) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs + : false; + var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs)); + if (result === errorObj) { + ret._rejectCallback(result.e, true); + } + if (!ret._isFateSealed()) ret._setAsyncGuaranteed(); + return ret; +}; + +Promise.all = function (promises) { + return new PromiseArray(promises).promise(); +}; + +Promise.cast = function (obj) { + var ret = tryConvertToPromise(obj); + if (!(ret instanceof Promise)) { + ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._setFulfilled(); + ret._rejectionHandler0 = obj; + } + return ret; +}; + +Promise.resolve = Promise.fulfilled = Promise.cast; + +Promise.reject = Promise.rejected = function (reason) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._rejectCallback(reason, true); + return ret; +}; + +Promise.setScheduler = function(fn) { + if (typeof fn !== "function") { + throw new TypeError("expecting a function but got " + util.classString(fn)); + } + return async.setScheduler(fn); +}; + +Promise.prototype._then = function ( + didFulfill, + didReject, + _, receiver, + internalData +) { + var haveInternalData = internalData !== undefined; + var promise = haveInternalData ? internalData : new Promise(INTERNAL); + var target = this._target(); + var bitField = target._bitField; + + if (!haveInternalData) { + promise._propagateFrom(this, 3); + promise._captureStackTrace(); + if (receiver === undefined && + ((this._bitField & 2097152) !== 0)) { + if (!((bitField & 50397184) === 0)) { + receiver = this._boundValue(); + } else { + receiver = target === this ? undefined : this._boundTo; + } + } + this._fireEvent("promiseChained", this, promise); + } + + var domain = getDomain(); + if (!((bitField & 50397184) === 0)) { + var handler, value, settler = target._settlePromiseCtx; + if (((bitField & 33554432) !== 0)) { + value = target._rejectionHandler0; + handler = didFulfill; + } else if (((bitField & 16777216) !== 0)) { + value = target._fulfillmentHandler0; + handler = didReject; + target._unsetRejectionIsUnhandled(); + } else { + settler = target._settlePromiseLateCancellationObserver; + value = new CancellationError("late cancellation observer"); + target._attachExtraTrace(value); + handler = didReject; + } + + async.invoke(settler, target, { + handler: domain === null ? handler + : (typeof handler === "function" && + util.domainBind(domain, handler)), + promise: promise, + receiver: receiver, + value: value + }); + } else { + target._addCallbacks(didFulfill, didReject, promise, receiver, domain); + } + + return promise; +}; + +Promise.prototype._length = function () { + return this._bitField & 65535; +}; + +Promise.prototype._isFateSealed = function () { + return (this._bitField & 117506048) !== 0; +}; + +Promise.prototype._isFollowing = function () { + return (this._bitField & 67108864) === 67108864; +}; + +Promise.prototype._setLength = function (len) { + this._bitField = (this._bitField & -65536) | + (len & 65535); +}; + +Promise.prototype._setFulfilled = function () { + this._bitField = this._bitField | 33554432; + this._fireEvent("promiseFulfilled", this); +}; + +Promise.prototype._setRejected = function () { + this._bitField = this._bitField | 16777216; + this._fireEvent("promiseRejected", this); +}; + +Promise.prototype._setFollowing = function () { + this._bitField = this._bitField | 67108864; + this._fireEvent("promiseResolved", this); +}; + +Promise.prototype._setIsFinal = function () { + this._bitField = this._bitField | 4194304; +}; + +Promise.prototype._isFinal = function () { + return (this._bitField & 4194304) > 0; +}; + +Promise.prototype._unsetCancelled = function() { + this._bitField = this._bitField & (~65536); +}; + +Promise.prototype._setCancelled = function() { + this._bitField = this._bitField | 65536; + this._fireEvent("promiseCancelled", this); +}; + +Promise.prototype._setWillBeCancelled = function() { + this._bitField = this._bitField | 8388608; +}; + +Promise.prototype._setAsyncGuaranteed = function() { + if (async.hasCustomScheduler()) return; + this._bitField = this._bitField | 134217728; +}; + +Promise.prototype._receiverAt = function (index) { + var ret = index === 0 ? this._receiver0 : this[ + index * 4 - 4 + 3]; + if (ret === UNDEFINED_BINDING) { + return undefined; + } else if (ret === undefined && this._isBound()) { + return this._boundValue(); + } + return ret; +}; + +Promise.prototype._promiseAt = function (index) { + return this[ + index * 4 - 4 + 2]; +}; + +Promise.prototype._fulfillmentHandlerAt = function (index) { + return this[ + index * 4 - 4 + 0]; +}; + +Promise.prototype._rejectionHandlerAt = function (index) { + return this[ + index * 4 - 4 + 1]; +}; + +Promise.prototype._boundValue = function() {}; + +Promise.prototype._migrateCallback0 = function (follower) { + var bitField = follower._bitField; + var fulfill = follower._fulfillmentHandler0; + var reject = follower._rejectionHandler0; + var promise = follower._promise0; + var receiver = follower._receiverAt(0); + if (receiver === undefined) receiver = UNDEFINED_BINDING; + this._addCallbacks(fulfill, reject, promise, receiver, null); +}; + +Promise.prototype._migrateCallbackAt = function (follower, index) { + var fulfill = follower._fulfillmentHandlerAt(index); + var reject = follower._rejectionHandlerAt(index); + var promise = follower._promiseAt(index); + var receiver = follower._receiverAt(index); + if (receiver === undefined) receiver = UNDEFINED_BINDING; + this._addCallbacks(fulfill, reject, promise, receiver, null); +}; + +Promise.prototype._addCallbacks = function ( + fulfill, + reject, + promise, + receiver, + domain +) { + var index = this._length(); + + if (index >= 65535 - 4) { + index = 0; + this._setLength(0); + } + + if (index === 0) { + this._promise0 = promise; + this._receiver0 = receiver; + if (typeof fulfill === "function") { + this._fulfillmentHandler0 = + domain === null ? fulfill : util.domainBind(domain, fulfill); + } + if (typeof reject === "function") { + this._rejectionHandler0 = + domain === null ? reject : util.domainBind(domain, reject); + } + } else { + var base = index * 4 - 4; + this[base + 2] = promise; + this[base + 3] = receiver; + if (typeof fulfill === "function") { + this[base + 0] = + domain === null ? fulfill : util.domainBind(domain, fulfill); + } + if (typeof reject === "function") { + this[base + 1] = + domain === null ? reject : util.domainBind(domain, reject); + } + } + this._setLength(index + 1); + return index; +}; + +Promise.prototype._proxy = function (proxyable, arg) { + this._addCallbacks(undefined, undefined, arg, proxyable, null); +}; + +Promise.prototype._resolveCallback = function(value, shouldBind) { + if (((this._bitField & 117506048) !== 0)) return; + if (value === this) + return this._rejectCallback(makeSelfResolutionError(), false); + var maybePromise = tryConvertToPromise(value, this); + if (!(maybePromise instanceof Promise)) return this._fulfill(value); + + if (shouldBind) this._propagateFrom(maybePromise, 2); + + var promise = maybePromise._target(); + + if (promise === this) { + this._reject(makeSelfResolutionError()); + return; + } + + var bitField = promise._bitField; + if (((bitField & 50397184) === 0)) { + var len = this._length(); + if (len > 0) promise._migrateCallback0(this); + for (var i = 1; i < len; ++i) { + promise._migrateCallbackAt(this, i); + } + this._setFollowing(); + this._setLength(0); + this._setFollowee(promise); + } else if (((bitField & 33554432) !== 0)) { + this._fulfill(promise._value()); + } else if (((bitField & 16777216) !== 0)) { + this._reject(promise._reason()); + } else { + var reason = new CancellationError("late cancellation observer"); + promise._attachExtraTrace(reason); + this._reject(reason); + } +}; + +Promise.prototype._rejectCallback = +function(reason, synchronous, ignoreNonErrorWarnings) { + var trace = util.ensureErrorObject(reason); + var hasStack = trace === reason; + if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) { + var message = "a promise was rejected with a non-error: " + + util.classString(reason); + this._warn(message, true); + } + this._attachExtraTrace(trace, synchronous ? hasStack : false); + this._reject(reason); +}; + +Promise.prototype._resolveFromExecutor = function (executor) { + if (executor === INTERNAL) return; + var promise = this; + this._captureStackTrace(); + this._pushContext(); + var synchronous = true; + var r = this._execute(executor, function(value) { + promise._resolveCallback(value); + }, function (reason) { + promise._rejectCallback(reason, synchronous); + }); + synchronous = false; + this._popContext(); + + if (r !== undefined) { + promise._rejectCallback(r, true); + } +}; + +Promise.prototype._settlePromiseFromHandler = function ( + handler, receiver, value, promise +) { + var bitField = promise._bitField; + if (((bitField & 65536) !== 0)) return; + promise._pushContext(); + var x; + if (receiver === APPLY) { + if (!value || typeof value.length !== "number") { + x = errorObj; + x.e = new TypeError("cannot .spread() a non-array: " + + util.classString(value)); + } else { + x = tryCatch(handler).apply(this._boundValue(), value); + } + } else { + x = tryCatch(handler).call(receiver, value); + } + var promiseCreated = promise._popContext(); + bitField = promise._bitField; + if (((bitField & 65536) !== 0)) return; + + if (x === NEXT_FILTER) { + promise._reject(value); + } else if (x === errorObj) { + promise._rejectCallback(x.e, false); + } else { + debug.checkForgottenReturns(x, promiseCreated, "", promise, this); + promise._resolveCallback(x); + } +}; + +Promise.prototype._target = function() { + var ret = this; + while (ret._isFollowing()) ret = ret._followee(); + return ret; +}; + +Promise.prototype._followee = function() { + return this._rejectionHandler0; +}; + +Promise.prototype._setFollowee = function(promise) { + this._rejectionHandler0 = promise; +}; + +Promise.prototype._settlePromise = function(promise, handler, receiver, value) { + var isPromise = promise instanceof Promise; + var bitField = this._bitField; + var asyncGuaranteed = ((bitField & 134217728) !== 0); + if (((bitField & 65536) !== 0)) { + if (isPromise) promise._invokeInternalOnCancel(); + + if (receiver instanceof PassThroughHandlerContext && + receiver.isFinallyHandler()) { + receiver.cancelPromise = promise; + if (tryCatch(handler).call(receiver, value) === errorObj) { + promise._reject(errorObj.e); + } + } else if (handler === reflectHandler) { + promise._fulfill(reflectHandler.call(receiver)); + } else if (receiver instanceof Proxyable) { + receiver._promiseCancelled(promise); + } else if (isPromise || promise instanceof PromiseArray) { + promise._cancel(); + } else { + receiver.cancel(); + } + } else if (typeof handler === "function") { + if (!isPromise) { + handler.call(receiver, value, promise); + } else { + if (asyncGuaranteed) promise._setAsyncGuaranteed(); + this._settlePromiseFromHandler(handler, receiver, value, promise); + } + } else if (receiver instanceof Proxyable) { + if (!receiver._isResolved()) { + if (((bitField & 33554432) !== 0)) { + receiver._promiseFulfilled(value, promise); + } else { + receiver._promiseRejected(value, promise); + } + } + } else if (isPromise) { + if (asyncGuaranteed) promise._setAsyncGuaranteed(); + if (((bitField & 33554432) !== 0)) { + promise._fulfill(value); + } else { + promise._reject(value); + } + } +}; + +Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) { + var handler = ctx.handler; + var promise = ctx.promise; + var receiver = ctx.receiver; + var value = ctx.value; + if (typeof handler === "function") { + if (!(promise instanceof Promise)) { + handler.call(receiver, value, promise); + } else { + this._settlePromiseFromHandler(handler, receiver, value, promise); + } + } else if (promise instanceof Promise) { + promise._reject(value); + } +}; + +Promise.prototype._settlePromiseCtx = function(ctx) { + this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value); +}; + +Promise.prototype._settlePromise0 = function(handler, value, bitField) { + var promise = this._promise0; + var receiver = this._receiverAt(0); + this._promise0 = undefined; + this._receiver0 = undefined; + this._settlePromise(promise, handler, receiver, value); +}; + +Promise.prototype._clearCallbackDataAtIndex = function(index) { + var base = index * 4 - 4; + this[base + 2] = + this[base + 3] = + this[base + 0] = + this[base + 1] = undefined; +}; + +Promise.prototype._fulfill = function (value) { + var bitField = this._bitField; + if (((bitField & 117506048) >>> 16)) return; + if (value === this) { + var err = makeSelfResolutionError(); + this._attachExtraTrace(err); + return this._reject(err); + } + this._setFulfilled(); + this._rejectionHandler0 = value; + + if ((bitField & 65535) > 0) { + if (((bitField & 134217728) !== 0)) { + this._settlePromises(); + } else { + async.settlePromises(this); + } + } +}; + +Promise.prototype._reject = function (reason) { + var bitField = this._bitField; + if (((bitField & 117506048) >>> 16)) return; + this._setRejected(); + this._fulfillmentHandler0 = reason; + + if (this._isFinal()) { + return async.fatalError(reason, util.isNode); + } + + if ((bitField & 65535) > 0) { + async.settlePromises(this); + } else { + this._ensurePossibleRejectionHandled(); + } +}; + +Promise.prototype._fulfillPromises = function (len, value) { + for (var i = 1; i < len; i++) { + var handler = this._fulfillmentHandlerAt(i); + var promise = this._promiseAt(i); + var receiver = this._receiverAt(i); + this._clearCallbackDataAtIndex(i); + this._settlePromise(promise, handler, receiver, value); + } +}; + +Promise.prototype._rejectPromises = function (len, reason) { + for (var i = 1; i < len; i++) { + var handler = this._rejectionHandlerAt(i); + var promise = this._promiseAt(i); + var receiver = this._receiverAt(i); + this._clearCallbackDataAtIndex(i); + this._settlePromise(promise, handler, receiver, reason); + } +}; + +Promise.prototype._settlePromises = function () { + var bitField = this._bitField; + var len = (bitField & 65535); + + if (len > 0) { + if (((bitField & 16842752) !== 0)) { + var reason = this._fulfillmentHandler0; + this._settlePromise0(this._rejectionHandler0, reason, bitField); + this._rejectPromises(len, reason); + } else { + var value = this._rejectionHandler0; + this._settlePromise0(this._fulfillmentHandler0, value, bitField); + this._fulfillPromises(len, value); + } + this._setLength(0); + } + this._clearCancellationData(); +}; + +Promise.prototype._settledValue = function() { + var bitField = this._bitField; + if (((bitField & 33554432) !== 0)) { + return this._rejectionHandler0; + } else if (((bitField & 16777216) !== 0)) { + return this._fulfillmentHandler0; + } +}; + +function deferResolve(v) {this.promise._resolveCallback(v);} +function deferReject(v) {this.promise._rejectCallback(v, false);} + +Promise.defer = Promise.pending = function() { + debug.deprecated("Promise.defer", "new Promise"); + var promise = new Promise(INTERNAL); + return { + promise: promise, + resolve: deferResolve, + reject: deferReject + }; +}; + +util.notEnumerableProp(Promise, + "_makeSelfResolutionError", + makeSelfResolutionError); + +_dereq_("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection, + debug); +_dereq_("./bind")(Promise, INTERNAL, tryConvertToPromise, debug); +_dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug); +_dereq_("./direct_resolve")(Promise); +_dereq_("./synchronous_inspection")(Promise); +_dereq_("./join")( + Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain); +Promise.Promise = Promise; +Promise.version = "3.5.0"; +_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); +_dereq_('./call_get.js')(Promise); +_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug); +_dereq_('./timers.js')(Promise, INTERNAL, debug); +_dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug); +_dereq_('./nodeify.js')(Promise); +_dereq_('./promisify.js')(Promise, INTERNAL); +_dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection); +_dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection); +_dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); +_dereq_('./settle.js')(Promise, PromiseArray, debug); +_dereq_('./some.js')(Promise, PromiseArray, apiRejection); +_dereq_('./filter.js')(Promise, INTERNAL); +_dereq_('./each.js')(Promise, INTERNAL); +_dereq_('./any.js')(Promise); + + util.toFastProperties(Promise); + util.toFastProperties(Promise.prototype); + function fillTypes(value) { + var p = new Promise(INTERNAL); + p._fulfillmentHandler0 = value; + p._rejectionHandler0 = value; + p._promise0 = value; + p._receiver0 = value; + } + // Complete slack tracking, opt out of field-type tracking and + // stabilize map + fillTypes({a: 1}); + fillTypes({b: 2}); + fillTypes({c: 3}); + fillTypes(1); + fillTypes(function(){}); + fillTypes(undefined); + fillTypes(false); + fillTypes(new Promise(INTERNAL)); + debug.setBounds(Async.firstLineError, util.lastLineError); + return Promise; + +}; + +},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL, tryConvertToPromise, + apiRejection, Proxyable) { +var util = _dereq_("./util"); +var isArray = util.isArray; + +function toResolutionValue(val) { + switch(val) { + case -2: return []; + case -3: return {}; + case -6: return new Map(); + } +} + +function PromiseArray(values) { + var promise = this._promise = new Promise(INTERNAL); + if (values instanceof Promise) { + promise._propagateFrom(values, 3); + } + promise._setOnCancel(this); + this._values = values; + this._length = 0; + this._totalResolved = 0; + this._init(undefined, -2); +} +util.inherits(PromiseArray, Proxyable); + +PromiseArray.prototype.length = function () { + return this._length; +}; + +PromiseArray.prototype.promise = function () { + return this._promise; +}; + +PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { + var values = tryConvertToPromise(this._values, this._promise); + if (values instanceof Promise) { + values = values._target(); + var bitField = values._bitField; + ; + this._values = values; + + if (((bitField & 50397184) === 0)) { + this._promise._setAsyncGuaranteed(); + return values._then( + init, + this._reject, + undefined, + this, + resolveValueIfEmpty + ); + } else if (((bitField & 33554432) !== 0)) { + values = values._value(); + } else if (((bitField & 16777216) !== 0)) { + return this._reject(values._reason()); + } else { + return this._cancel(); + } + } + values = util.asArray(values); + if (values === null) { + var err = apiRejection( + "expecting an array or an iterable object but got " + util.classString(values)).reason(); + this._promise._rejectCallback(err, false); + return; + } + + if (values.length === 0) { + if (resolveValueIfEmpty === -5) { + this._resolveEmptyArray(); + } + else { + this._resolve(toResolutionValue(resolveValueIfEmpty)); + } + return; + } + this._iterate(values); +}; + +PromiseArray.prototype._iterate = function(values) { + var len = this.getActualLength(values.length); + this._length = len; + this._values = this.shouldCopyValues() ? new Array(len) : this._values; + var result = this._promise; + var isResolved = false; + var bitField = null; + for (var i = 0; i < len; ++i) { + var maybePromise = tryConvertToPromise(values[i], result); + + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + bitField = maybePromise._bitField; + } else { + bitField = null; + } + + if (isResolved) { + if (bitField !== null) { + maybePromise.suppressUnhandledRejections(); + } + } else if (bitField !== null) { + if (((bitField & 50397184) === 0)) { + maybePromise._proxy(this, i); + this._values[i] = maybePromise; + } else if (((bitField & 33554432) !== 0)) { + isResolved = this._promiseFulfilled(maybePromise._value(), i); + } else if (((bitField & 16777216) !== 0)) { + isResolved = this._promiseRejected(maybePromise._reason(), i); + } else { + isResolved = this._promiseCancelled(i); + } + } else { + isResolved = this._promiseFulfilled(maybePromise, i); + } + } + if (!isResolved) result._setAsyncGuaranteed(); +}; + +PromiseArray.prototype._isResolved = function () { + return this._values === null; +}; + +PromiseArray.prototype._resolve = function (value) { + this._values = null; + this._promise._fulfill(value); +}; + +PromiseArray.prototype._cancel = function() { + if (this._isResolved() || !this._promise._isCancellable()) return; + this._values = null; + this._promise._cancel(); +}; + +PromiseArray.prototype._reject = function (reason) { + this._values = null; + this._promise._rejectCallback(reason, false); +}; + +PromiseArray.prototype._promiseFulfilled = function (value, index) { + this._values[index] = value; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + this._resolve(this._values); + return true; + } + return false; +}; + +PromiseArray.prototype._promiseCancelled = function() { + this._cancel(); + return true; +}; + +PromiseArray.prototype._promiseRejected = function (reason) { + this._totalResolved++; + this._reject(reason); + return true; +}; + +PromiseArray.prototype._resultCancelled = function() { + if (this._isResolved()) return; + var values = this._values; + this._cancel(); + if (values instanceof Promise) { + values.cancel(); + } else { + for (var i = 0; i < values.length; ++i) { + if (values[i] instanceof Promise) { + values[i].cancel(); + } + } + } +}; + +PromiseArray.prototype.shouldCopyValues = function () { + return true; +}; + +PromiseArray.prototype.getActualLength = function (len) { + return len; +}; + +return PromiseArray; +}; + +},{"./util":36}],24:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var THIS = {}; +var util = _dereq_("./util"); +var nodebackForPromise = _dereq_("./nodeback"); +var withAppended = util.withAppended; +var maybeWrapAsError = util.maybeWrapAsError; +var canEvaluate = util.canEvaluate; +var TypeError = _dereq_("./errors").TypeError; +var defaultSuffix = "Async"; +var defaultPromisified = {__isPromisified__: true}; +var noCopyProps = [ + "arity", "length", + "name", + "arguments", + "caller", + "callee", + "prototype", + "__isPromisified__" +]; +var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$"); + +var defaultFilter = function(name) { + return util.isIdentifier(name) && + name.charAt(0) !== "_" && + name !== "constructor"; +}; + +function propsFilter(key) { + return !noCopyPropsPattern.test(key); +} + +function isPromisified(fn) { + try { + return fn.__isPromisified__ === true; + } + catch (e) { + return false; + } +} + +function hasPromisified(obj, key, suffix) { + var val = util.getDataPropertyOrDefault(obj, key + suffix, + defaultPromisified); + return val ? isPromisified(val) : false; +} +function checkValid(ret, suffix, suffixRegexp) { + for (var i = 0; i < ret.length; i += 2) { + var key = ret[i]; + if (suffixRegexp.test(key)) { + var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""); + for (var j = 0; j < ret.length; j += 2) { + if (ret[j] === keyWithoutAsyncSuffix) { + throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/MqrFmX\u000a" + .replace("%s", suffix)); + } + } + } + } +} + +function promisifiableMethods(obj, suffix, suffixRegexp, filter) { + var keys = util.inheritedDataKeys(obj); + var ret = []; + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var value = obj[key]; + var passesDefaultFilter = filter === defaultFilter + ? true : defaultFilter(key, value, obj); + if (typeof value === "function" && + !isPromisified(value) && + !hasPromisified(obj, key, suffix) && + filter(key, value, obj, passesDefaultFilter)) { + ret.push(key, value); + } + } + checkValid(ret, suffix, suffixRegexp); + return ret; +} + +var escapeIdentRegex = function(str) { + return str.replace(/([$])/, "\\$"); +}; + +var makeNodePromisifiedEval; +if (!true) { +var switchCaseArgumentOrder = function(likelyArgumentCount) { + var ret = [likelyArgumentCount]; + var min = Math.max(0, likelyArgumentCount - 1 - 3); + for(var i = likelyArgumentCount - 1; i >= min; --i) { + ret.push(i); + } + for(var i = likelyArgumentCount + 1; i <= 3; ++i) { + ret.push(i); + } + return ret; +}; + +var argumentSequence = function(argumentCount) { + return util.filledRange(argumentCount, "_arg", ""); +}; + +var parameterDeclaration = function(parameterCount) { + return util.filledRange( + Math.max(parameterCount, 3), "_arg", ""); +}; + +var parameterCount = function(fn) { + if (typeof fn.length === "number") { + return Math.max(Math.min(fn.length, 1023 + 1), 0); + } + return 0; +}; + +makeNodePromisifiedEval = +function(callback, receiver, originalName, fn, _, multiArgs) { + var newParameterCount = Math.max(0, parameterCount(fn) - 1); + var argumentOrder = switchCaseArgumentOrder(newParameterCount); + var shouldProxyThis = typeof callback === "string" || receiver === THIS; + + function generateCallForArgumentCount(count) { + var args = argumentSequence(count).join(", "); + var comma = count > 0 ? ", " : ""; + var ret; + if (shouldProxyThis) { + ret = "ret = callback.call(this, {{args}}, nodeback); break;\n"; + } else { + ret = receiver === undefined + ? "ret = callback({{args}}, nodeback); break;\n" + : "ret = callback.call(receiver, {{args}}, nodeback); break;\n"; + } + return ret.replace("{{args}}", args).replace(", ", comma); + } + + function generateArgumentSwitchCase() { + var ret = ""; + for (var i = 0; i < argumentOrder.length; ++i) { + ret += "case " + argumentOrder[i] +":" + + generateCallForArgumentCount(argumentOrder[i]); + } + + ret += " \n\ + default: \n\ + var args = new Array(len + 1); \n\ + var i = 0; \n\ + for (var i = 0; i < len; ++i) { \n\ + args[i] = arguments[i]; \n\ + } \n\ + args[i] = nodeback; \n\ + [CodeForCall] \n\ + break; \n\ + ".replace("[CodeForCall]", (shouldProxyThis + ? "ret = callback.apply(this, args);\n" + : "ret = callback.apply(receiver, args);\n")); + return ret; + } + + var getFunctionCode = typeof callback === "string" + ? ("this != null ? this['"+callback+"'] : fn") + : "fn"; + var body = "'use strict'; \n\ + var ret = function (Parameters) { \n\ + 'use strict'; \n\ + var len = arguments.length; \n\ + var promise = new Promise(INTERNAL); \n\ + promise._captureStackTrace(); \n\ + var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n\ + var ret; \n\ + var callback = tryCatch([GetFunctionCode]); \n\ + switch(len) { \n\ + [CodeForSwitchCase] \n\ + } \n\ + if (ret === errorObj) { \n\ + promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\ + } \n\ + if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n\ + return promise; \n\ + }; \n\ + notEnumerableProp(ret, '__isPromisified__', true); \n\ + return ret; \n\ + ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase()) + .replace("[GetFunctionCode]", getFunctionCode); + body = body.replace("Parameters", parameterDeclaration(newParameterCount)); + return new Function("Promise", + "fn", + "receiver", + "withAppended", + "maybeWrapAsError", + "nodebackForPromise", + "tryCatch", + "errorObj", + "notEnumerableProp", + "INTERNAL", + body)( + Promise, + fn, + receiver, + withAppended, + maybeWrapAsError, + nodebackForPromise, + util.tryCatch, + util.errorObj, + util.notEnumerableProp, + INTERNAL); +}; +} + +function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) { + var defaultThis = (function() {return this;})(); + var method = callback; + if (typeof method === "string") { + callback = fn; + } + function promisified() { + var _receiver = receiver; + if (receiver === THIS) _receiver = this; + var promise = new Promise(INTERNAL); + promise._captureStackTrace(); + var cb = typeof method === "string" && this !== defaultThis + ? this[method] : callback; + var fn = nodebackForPromise(promise, multiArgs); + try { + cb.apply(_receiver, withAppended(arguments, fn)); + } catch(e) { + promise._rejectCallback(maybeWrapAsError(e), true, true); + } + if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); + return promise; + } + util.notEnumerableProp(promisified, "__isPromisified__", true); + return promisified; +} + +var makeNodePromisified = canEvaluate + ? makeNodePromisifiedEval + : makeNodePromisifiedClosure; + +function promisifyAll(obj, suffix, filter, promisifier, multiArgs) { + var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"); + var methods = + promisifiableMethods(obj, suffix, suffixRegexp, filter); + + for (var i = 0, len = methods.length; i < len; i+= 2) { + var key = methods[i]; + var fn = methods[i+1]; + var promisifiedKey = key + suffix; + if (promisifier === makeNodePromisified) { + obj[promisifiedKey] = + makeNodePromisified(key, THIS, key, fn, suffix, multiArgs); + } else { + var promisified = promisifier(fn, function() { + return makeNodePromisified(key, THIS, key, + fn, suffix, multiArgs); + }); + util.notEnumerableProp(promisified, "__isPromisified__", true); + obj[promisifiedKey] = promisified; + } + } + util.toFastProperties(obj); + return obj; +} + +function promisify(callback, receiver, multiArgs) { + return makeNodePromisified(callback, receiver, undefined, + callback, null, multiArgs); +} + +Promise.promisify = function (fn, options) { + if (typeof fn !== "function") { + throw new TypeError("expecting a function but got " + util.classString(fn)); + } + if (isPromisified(fn)) { + return fn; + } + options = Object(options); + var receiver = options.context === undefined ? THIS : options.context; + var multiArgs = !!options.multiArgs; + var ret = promisify(fn, receiver, multiArgs); + util.copyDescriptors(fn, ret, propsFilter); + return ret; +}; + +Promise.promisifyAll = function (target, options) { + if (typeof target !== "function" && typeof target !== "object") { + throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + options = Object(options); + var multiArgs = !!options.multiArgs; + var suffix = options.suffix; + if (typeof suffix !== "string") suffix = defaultSuffix; + var filter = options.filter; + if (typeof filter !== "function") filter = defaultFilter; + var promisifier = options.promisifier; + if (typeof promisifier !== "function") promisifier = makeNodePromisified; + + if (!util.isIdentifier(suffix)) { + throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + + var keys = util.inheritedDataKeys(target); + for (var i = 0; i < keys.length; ++i) { + var value = target[keys[i]]; + if (keys[i] !== "constructor" && + util.isClass(value)) { + promisifyAll(value.prototype, suffix, filter, promisifier, + multiArgs); + promisifyAll(value, suffix, filter, promisifier, multiArgs); + } + } + + return promisifyAll(target, suffix, filter, promisifier, multiArgs); +}; +}; + + +},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function( + Promise, PromiseArray, tryConvertToPromise, apiRejection) { +var util = _dereq_("./util"); +var isObject = util.isObject; +var es5 = _dereq_("./es5"); +var Es6Map; +if (typeof Map === "function") Es6Map = Map; + +var mapToEntries = (function() { + var index = 0; + var size = 0; + + function extractEntry(value, key) { + this[index] = value; + this[index + size] = key; + index++; + } + + return function mapToEntries(map) { + size = map.size; + index = 0; + var ret = new Array(map.size * 2); + map.forEach(extractEntry, ret); + return ret; + }; +})(); + +var entriesToMap = function(entries) { + var ret = new Es6Map(); + var length = entries.length / 2 | 0; + for (var i = 0; i < length; ++i) { + var key = entries[length + i]; + var value = entries[i]; + ret.set(key, value); + } + return ret; +}; + +function PropertiesPromiseArray(obj) { + var isMap = false; + var entries; + if (Es6Map !== undefined && obj instanceof Es6Map) { + entries = mapToEntries(obj); + isMap = true; + } else { + var keys = es5.keys(obj); + var len = keys.length; + entries = new Array(len * 2); + for (var i = 0; i < len; ++i) { + var key = keys[i]; + entries[i] = obj[key]; + entries[i + len] = key; + } + } + this.constructor$(entries); + this._isMap = isMap; + this._init$(undefined, isMap ? -6 : -3); +} +util.inherits(PropertiesPromiseArray, PromiseArray); + +PropertiesPromiseArray.prototype._init = function () {}; + +PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { + this._values[index] = value; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + var val; + if (this._isMap) { + val = entriesToMap(this._values); + } else { + val = {}; + var keyOffset = this.length(); + for (var i = 0, len = this.length(); i < len; ++i) { + val[this._values[i + keyOffset]] = this._values[i]; + } + } + this._resolve(val); + return true; + } + return false; +}; + +PropertiesPromiseArray.prototype.shouldCopyValues = function () { + return false; +}; + +PropertiesPromiseArray.prototype.getActualLength = function (len) { + return len >> 1; +}; + +function props(promises) { + var ret; + var castValue = tryConvertToPromise(promises); + + if (!isObject(castValue)) { + return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } else if (castValue instanceof Promise) { + ret = castValue._then( + Promise.props, undefined, undefined, undefined, undefined); + } else { + ret = new PropertiesPromiseArray(castValue).promise(); + } + + if (castValue instanceof Promise) { + ret._propagateFrom(castValue, 2); + } + return ret; +} + +Promise.prototype.props = function () { + return props(this); +}; + +Promise.props = function (promises) { + return props(promises); +}; +}; + +},{"./es5":13,"./util":36}],26:[function(_dereq_,module,exports){ +"use strict"; +function arrayMove(src, srcIndex, dst, dstIndex, len) { + for (var j = 0; j < len; ++j) { + dst[j + dstIndex] = src[j + srcIndex]; + src[j + srcIndex] = void 0; + } +} + +function Queue(capacity) { + this._capacity = capacity; + this._length = 0; + this._front = 0; +} + +Queue.prototype._willBeOverCapacity = function (size) { + return this._capacity < size; +}; + +Queue.prototype._pushOne = function (arg) { + var length = this.length(); + this._checkCapacity(length + 1); + var i = (this._front + length) & (this._capacity - 1); + this[i] = arg; + this._length = length + 1; +}; + +Queue.prototype.push = function (fn, receiver, arg) { + var length = this.length() + 3; + if (this._willBeOverCapacity(length)) { + this._pushOne(fn); + this._pushOne(receiver); + this._pushOne(arg); + return; + } + var j = this._front + length - 3; + this._checkCapacity(length); + var wrapMask = this._capacity - 1; + this[(j + 0) & wrapMask] = fn; + this[(j + 1) & wrapMask] = receiver; + this[(j + 2) & wrapMask] = arg; + this._length = length; +}; + +Queue.prototype.shift = function () { + var front = this._front, + ret = this[front]; + + this[front] = undefined; + this._front = (front + 1) & (this._capacity - 1); + this._length--; + return ret; +}; + +Queue.prototype.length = function () { + return this._length; +}; + +Queue.prototype._checkCapacity = function (size) { + if (this._capacity < size) { + this._resizeTo(this._capacity << 1); + } +}; + +Queue.prototype._resizeTo = function (capacity) { + var oldCapacity = this._capacity; + this._capacity = capacity; + var front = this._front; + var length = this._length; + var moveItemsCount = (front + length) & (oldCapacity - 1); + arrayMove(this, 0, this, oldCapacity, moveItemsCount); +}; + +module.exports = Queue; + +},{}],27:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function( + Promise, INTERNAL, tryConvertToPromise, apiRejection) { +var util = _dereq_("./util"); + +var raceLater = function (promise) { + return promise.then(function(array) { + return race(array, promise); + }); +}; + +function race(promises, parent) { + var maybePromise = tryConvertToPromise(promises); + + if (maybePromise instanceof Promise) { + return raceLater(maybePromise); + } else { + promises = util.asArray(promises); + if (promises === null) + return apiRejection("expecting an array or an iterable object but got " + util.classString(promises)); + } + + var ret = new Promise(INTERNAL); + if (parent !== undefined) { + ret._propagateFrom(parent, 3); + } + var fulfill = ret._fulfill; + var reject = ret._reject; + for (var i = 0, len = promises.length; i < len; ++i) { + var val = promises[i]; + + if (val === undefined && !(i in promises)) { + continue; + } + + Promise.cast(val)._then(fulfill, reject, undefined, ret, null); + } + return ret; +} + +Promise.race = function (promises) { + return race(promises, undefined); +}; + +Promise.prototype.race = function () { + return race(this, undefined); +}; + +}; + +},{"./util":36}],28:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, + PromiseArray, + apiRejection, + tryConvertToPromise, + INTERNAL, + debug) { +var getDomain = Promise._getDomain; +var util = _dereq_("./util"); +var tryCatch = util.tryCatch; + +function ReductionPromiseArray(promises, fn, initialValue, _each) { + this.constructor$(promises); + var domain = getDomain(); + this._fn = domain === null ? fn : util.domainBind(domain, fn); + if (initialValue !== undefined) { + initialValue = Promise.resolve(initialValue); + initialValue._attachCancellationCallback(this); + } + this._initialValue = initialValue; + this._currentCancellable = null; + if(_each === INTERNAL) { + this._eachValues = Array(this._length); + } else if (_each === 0) { + this._eachValues = null; + } else { + this._eachValues = undefined; + } + this._promise._captureStackTrace(); + this._init$(undefined, -5); +} +util.inherits(ReductionPromiseArray, PromiseArray); + +ReductionPromiseArray.prototype._gotAccum = function(accum) { + if (this._eachValues !== undefined && + this._eachValues !== null && + accum !== INTERNAL) { + this._eachValues.push(accum); + } +}; + +ReductionPromiseArray.prototype._eachComplete = function(value) { + if (this._eachValues !== null) { + this._eachValues.push(value); + } + return this._eachValues; +}; + +ReductionPromiseArray.prototype._init = function() {}; + +ReductionPromiseArray.prototype._resolveEmptyArray = function() { + this._resolve(this._eachValues !== undefined ? this._eachValues + : this._initialValue); +}; + +ReductionPromiseArray.prototype.shouldCopyValues = function () { + return false; +}; + +ReductionPromiseArray.prototype._resolve = function(value) { + this._promise._resolveCallback(value); + this._values = null; +}; + +ReductionPromiseArray.prototype._resultCancelled = function(sender) { + if (sender === this._initialValue) return this._cancel(); + if (this._isResolved()) return; + this._resultCancelled$(); + if (this._currentCancellable instanceof Promise) { + this._currentCancellable.cancel(); + } + if (this._initialValue instanceof Promise) { + this._initialValue.cancel(); + } +}; + +ReductionPromiseArray.prototype._iterate = function (values) { + this._values = values; + var value; + var i; + var length = values.length; + if (this._initialValue !== undefined) { + value = this._initialValue; + i = 0; + } else { + value = Promise.resolve(values[0]); + i = 1; + } + + this._currentCancellable = value; + + if (!value.isRejected()) { + for (; i < length; ++i) { + var ctx = { + accum: null, + value: values[i], + index: i, + length: length, + array: this + }; + value = value._then(gotAccum, undefined, undefined, ctx, undefined); + } + } + + if (this._eachValues !== undefined) { + value = value + ._then(this._eachComplete, undefined, undefined, this, undefined); + } + value._then(completed, completed, undefined, value, this); +}; + +Promise.prototype.reduce = function (fn, initialValue) { + return reduce(this, fn, initialValue, null); +}; + +Promise.reduce = function (promises, fn, initialValue, _each) { + return reduce(promises, fn, initialValue, _each); +}; + +function completed(valueOrReason, array) { + if (this.isFulfilled()) { + array._resolve(valueOrReason); + } else { + array._reject(valueOrReason); + } +} + +function reduce(promises, fn, initialValue, _each) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + var array = new ReductionPromiseArray(promises, fn, initialValue, _each); + return array.promise(); +} + +function gotAccum(accum) { + this.accum = accum; + this.array._gotAccum(accum); + var value = tryConvertToPromise(this.value, this.array._promise); + if (value instanceof Promise) { + this.array._currentCancellable = value; + return value._then(gotValue, undefined, undefined, this, undefined); + } else { + return gotValue.call(this, value); + } +} + +function gotValue(value) { + var array = this.array; + var promise = array._promise; + var fn = tryCatch(array._fn); + promise._pushContext(); + var ret; + if (array._eachValues !== undefined) { + ret = fn.call(promise._boundValue(), value, this.index, this.length); + } else { + ret = fn.call(promise._boundValue(), + this.accum, value, this.index, this.length); + } + if (ret instanceof Promise) { + array._currentCancellable = ret; + } + var promiseCreated = promise._popContext(); + debug.checkForgottenReturns( + ret, + promiseCreated, + array._eachValues !== undefined ? "Promise.each" : "Promise.reduce", + promise + ); + return ret; +} +}; + +},{"./util":36}],29:[function(_dereq_,module,exports){ +"use strict"; +var util = _dereq_("./util"); +var schedule; +var noAsyncScheduler = function() { + throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a"); +}; +var NativePromise = util.getNativePromise(); +if (util.isNode && typeof MutationObserver === "undefined") { + var GlobalSetImmediate = global.setImmediate; + var ProcessNextTick = process.nextTick; + schedule = util.isRecentNode + ? function(fn) { GlobalSetImmediate.call(global, fn); } + : function(fn) { ProcessNextTick.call(process, fn); }; +} else if (typeof NativePromise === "function" && + typeof NativePromise.resolve === "function") { + var nativePromise = NativePromise.resolve(); + schedule = function(fn) { + nativePromise.then(fn); + }; +} else if ((typeof MutationObserver !== "undefined") && + !(typeof window !== "undefined" && + window.navigator && + (window.navigator.standalone || window.cordova))) { + schedule = (function() { + var div = document.createElement("div"); + var opts = {attributes: true}; + var toggleScheduled = false; + var div2 = document.createElement("div"); + var o2 = new MutationObserver(function() { + div.classList.toggle("foo"); + toggleScheduled = false; + }); + o2.observe(div2, opts); + + var scheduleToggle = function() { + if (toggleScheduled) return; + toggleScheduled = true; + div2.classList.toggle("foo"); + }; + + return function schedule(fn) { + var o = new MutationObserver(function() { + o.disconnect(); + fn(); + }); + o.observe(div, opts); + scheduleToggle(); + }; + })(); +} else if (typeof setImmediate !== "undefined") { + schedule = function (fn) { + setImmediate(fn); + }; +} else if (typeof setTimeout !== "undefined") { + schedule = function (fn) { + setTimeout(fn, 0); + }; +} else { + schedule = noAsyncScheduler; +} +module.exports = schedule; + +},{"./util":36}],30:[function(_dereq_,module,exports){ +"use strict"; +module.exports = + function(Promise, PromiseArray, debug) { +var PromiseInspection = Promise.PromiseInspection; +var util = _dereq_("./util"); + +function SettledPromiseArray(values) { + this.constructor$(values); +} +util.inherits(SettledPromiseArray, PromiseArray); + +SettledPromiseArray.prototype._promiseResolved = function (index, inspection) { + this._values[index] = inspection; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + this._resolve(this._values); + return true; + } + return false; +}; + +SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { + var ret = new PromiseInspection(); + ret._bitField = 33554432; + ret._settledValueField = value; + return this._promiseResolved(index, ret); +}; +SettledPromiseArray.prototype._promiseRejected = function (reason, index) { + var ret = new PromiseInspection(); + ret._bitField = 16777216; + ret._settledValueField = reason; + return this._promiseResolved(index, ret); +}; + +Promise.settle = function (promises) { + debug.deprecated(".settle()", ".reflect()"); + return new SettledPromiseArray(promises).promise(); +}; + +Promise.prototype.settle = function () { + return Promise.settle(this); +}; +}; + +},{"./util":36}],31:[function(_dereq_,module,exports){ +"use strict"; +module.exports = +function(Promise, PromiseArray, apiRejection) { +var util = _dereq_("./util"); +var RangeError = _dereq_("./errors").RangeError; +var AggregateError = _dereq_("./errors").AggregateError; +var isArray = util.isArray; +var CANCELLATION = {}; + + +function SomePromiseArray(values) { + this.constructor$(values); + this._howMany = 0; + this._unwrap = false; + this._initialized = false; +} +util.inherits(SomePromiseArray, PromiseArray); + +SomePromiseArray.prototype._init = function () { + if (!this._initialized) { + return; + } + if (this._howMany === 0) { + this._resolve([]); + return; + } + this._init$(undefined, -5); + var isArrayResolved = isArray(this._values); + if (!this._isResolved() && + isArrayResolved && + this._howMany > this._canPossiblyFulfill()) { + this._reject(this._getRangeError(this.length())); + } +}; + +SomePromiseArray.prototype.init = function () { + this._initialized = true; + this._init(); +}; + +SomePromiseArray.prototype.setUnwrap = function () { + this._unwrap = true; +}; + +SomePromiseArray.prototype.howMany = function () { + return this._howMany; +}; + +SomePromiseArray.prototype.setHowMany = function (count) { + this._howMany = count; +}; + +SomePromiseArray.prototype._promiseFulfilled = function (value) { + this._addFulfilled(value); + if (this._fulfilled() === this.howMany()) { + this._values.length = this.howMany(); + if (this.howMany() === 1 && this._unwrap) { + this._resolve(this._values[0]); + } else { + this._resolve(this._values); + } + return true; + } + return false; + +}; +SomePromiseArray.prototype._promiseRejected = function (reason) { + this._addRejected(reason); + return this._checkOutcome(); +}; + +SomePromiseArray.prototype._promiseCancelled = function () { + if (this._values instanceof Promise || this._values == null) { + return this._cancel(); + } + this._addRejected(CANCELLATION); + return this._checkOutcome(); +}; + +SomePromiseArray.prototype._checkOutcome = function() { + if (this.howMany() > this._canPossiblyFulfill()) { + var e = new AggregateError(); + for (var i = this.length(); i < this._values.length; ++i) { + if (this._values[i] !== CANCELLATION) { + e.push(this._values[i]); + } + } + if (e.length > 0) { + this._reject(e); + } else { + this._cancel(); + } + return true; + } + return false; +}; + +SomePromiseArray.prototype._fulfilled = function () { + return this._totalResolved; +}; + +SomePromiseArray.prototype._rejected = function () { + return this._values.length - this.length(); +}; + +SomePromiseArray.prototype._addRejected = function (reason) { + this._values.push(reason); +}; + +SomePromiseArray.prototype._addFulfilled = function (value) { + this._values[this._totalResolved++] = value; +}; + +SomePromiseArray.prototype._canPossiblyFulfill = function () { + return this.length() - this._rejected(); +}; + +SomePromiseArray.prototype._getRangeError = function (count) { + var message = "Input array must contain at least " + + this._howMany + " items but contains only " + count + " items"; + return new RangeError(message); +}; + +SomePromiseArray.prototype._resolveEmptyArray = function () { + this._reject(this._getRangeError(0)); +}; + +function some(promises, howMany) { + if ((howMany | 0) !== howMany || howMany < 0) { + return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + var ret = new SomePromiseArray(promises); + var promise = ret.promise(); + ret.setHowMany(howMany); + ret.init(); + return promise; +} + +Promise.some = function (promises, howMany) { + return some(promises, howMany); +}; + +Promise.prototype.some = function (howMany) { + return some(this, howMany); +}; + +Promise._SomePromiseArray = SomePromiseArray; +}; + +},{"./errors":12,"./util":36}],32:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise) { +function PromiseInspection(promise) { + if (promise !== undefined) { + promise = promise._target(); + this._bitField = promise._bitField; + this._settledValueField = promise._isFateSealed() + ? promise._settledValue() : undefined; + } + else { + this._bitField = 0; + this._settledValueField = undefined; + } +} + +PromiseInspection.prototype._settledValue = function() { + return this._settledValueField; +}; + +var value = PromiseInspection.prototype.value = function () { + if (!this.isFulfilled()) { + throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + return this._settledValue(); +}; + +var reason = PromiseInspection.prototype.error = +PromiseInspection.prototype.reason = function () { + if (!this.isRejected()) { + throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + return this._settledValue(); +}; + +var isFulfilled = PromiseInspection.prototype.isFulfilled = function() { + return (this._bitField & 33554432) !== 0; +}; + +var isRejected = PromiseInspection.prototype.isRejected = function () { + return (this._bitField & 16777216) !== 0; +}; + +var isPending = PromiseInspection.prototype.isPending = function () { + return (this._bitField & 50397184) === 0; +}; + +var isResolved = PromiseInspection.prototype.isResolved = function () { + return (this._bitField & 50331648) !== 0; +}; + +PromiseInspection.prototype.isCancelled = function() { + return (this._bitField & 8454144) !== 0; +}; + +Promise.prototype.__isCancelled = function() { + return (this._bitField & 65536) === 65536; +}; + +Promise.prototype._isCancelled = function() { + return this._target().__isCancelled(); +}; + +Promise.prototype.isCancelled = function() { + return (this._target()._bitField & 8454144) !== 0; +}; + +Promise.prototype.isPending = function() { + return isPending.call(this._target()); +}; + +Promise.prototype.isRejected = function() { + return isRejected.call(this._target()); +}; + +Promise.prototype.isFulfilled = function() { + return isFulfilled.call(this._target()); +}; + +Promise.prototype.isResolved = function() { + return isResolved.call(this._target()); +}; + +Promise.prototype.value = function() { + return value.call(this._target()); +}; + +Promise.prototype.reason = function() { + var target = this._target(); + target._unsetRejectionIsUnhandled(); + return reason.call(target); +}; + +Promise.prototype._value = function() { + return this._settledValue(); +}; + +Promise.prototype._reason = function() { + this._unsetRejectionIsUnhandled(); + return this._settledValue(); +}; + +Promise.PromiseInspection = PromiseInspection; +}; + +},{}],33:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var util = _dereq_("./util"); +var errorObj = util.errorObj; +var isObject = util.isObject; + +function tryConvertToPromise(obj, context) { + if (isObject(obj)) { + if (obj instanceof Promise) return obj; + var then = getThen(obj); + if (then === errorObj) { + if (context) context._pushContext(); + var ret = Promise.reject(then.e); + if (context) context._popContext(); + return ret; + } else if (typeof then === "function") { + if (isAnyBluebirdPromise(obj)) { + var ret = new Promise(INTERNAL); + obj._then( + ret._fulfill, + ret._reject, + undefined, + ret, + null + ); + return ret; + } + return doThenable(obj, then, context); + } + } + return obj; +} + +function doGetThen(obj) { + return obj.then; +} + +function getThen(obj) { + try { + return doGetThen(obj); + } catch (e) { + errorObj.e = e; + return errorObj; + } +} + +var hasProp = {}.hasOwnProperty; +function isAnyBluebirdPromise(obj) { + try { + return hasProp.call(obj, "_promise0"); + } catch (e) { + return false; + } +} + +function doThenable(x, then, context) { + var promise = new Promise(INTERNAL); + var ret = promise; + if (context) context._pushContext(); + promise._captureStackTrace(); + if (context) context._popContext(); + var synchronous = true; + var result = util.tryCatch(then).call(x, resolve, reject); + synchronous = false; + + if (promise && result === errorObj) { + promise._rejectCallback(result.e, true, true); + promise = null; + } + + function resolve(value) { + if (!promise) return; + promise._resolveCallback(value); + promise = null; + } + + function reject(reason) { + if (!promise) return; + promise._rejectCallback(reason, synchronous, true); + promise = null; + } + return ret; +} + +return tryConvertToPromise; +}; + +},{"./util":36}],34:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL, debug) { +var util = _dereq_("./util"); +var TimeoutError = Promise.TimeoutError; + +function HandleWrapper(handle) { + this.handle = handle; +} + +HandleWrapper.prototype._resultCancelled = function() { + clearTimeout(this.handle); +}; + +var afterValue = function(value) { return delay(+this).thenReturn(value); }; +var delay = Promise.delay = function (ms, value) { + var ret; + var handle; + if (value !== undefined) { + ret = Promise.resolve(value) + ._then(afterValue, null, null, ms, undefined); + if (debug.cancellation() && value instanceof Promise) { + ret._setOnCancel(value); + } + } else { + ret = new Promise(INTERNAL); + handle = setTimeout(function() { ret._fulfill(); }, +ms); + if (debug.cancellation()) { + ret._setOnCancel(new HandleWrapper(handle)); + } + ret._captureStackTrace(); + } + ret._setAsyncGuaranteed(); + return ret; +}; + +Promise.prototype.delay = function (ms) { + return delay(ms, this); +}; + +var afterTimeout = function (promise, message, parent) { + var err; + if (typeof message !== "string") { + if (message instanceof Error) { + err = message; + } else { + err = new TimeoutError("operation timed out"); + } + } else { + err = new TimeoutError(message); + } + util.markAsOriginatingFromRejection(err); + promise._attachExtraTrace(err); + promise._reject(err); + + if (parent != null) { + parent.cancel(); + } +}; + +function successClear(value) { + clearTimeout(this.handle); + return value; +} + +function failureClear(reason) { + clearTimeout(this.handle); + throw reason; +} + +Promise.prototype.timeout = function (ms, message) { + ms = +ms; + var ret, parent; + + var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() { + if (ret.isPending()) { + afterTimeout(ret, message, parent); + } + }, ms)); + + if (debug.cancellation()) { + parent = this.then(); + ret = parent._then(successClear, failureClear, + undefined, handleWrapper, undefined); + ret._setOnCancel(handleWrapper); + } else { + ret = this._then(successClear, failureClear, + undefined, handleWrapper, undefined); + } + + return ret; +}; + +}; + +},{"./util":36}],35:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function (Promise, apiRejection, tryConvertToPromise, + createContext, INTERNAL, debug) { + var util = _dereq_("./util"); + var TypeError = _dereq_("./errors").TypeError; + var inherits = _dereq_("./util").inherits; + var errorObj = util.errorObj; + var tryCatch = util.tryCatch; + var NULL = {}; + + function thrower(e) { + setTimeout(function(){throw e;}, 0); + } + + function castPreservingDisposable(thenable) { + var maybePromise = tryConvertToPromise(thenable); + if (maybePromise !== thenable && + typeof thenable._isDisposable === "function" && + typeof thenable._getDisposer === "function" && + thenable._isDisposable()) { + maybePromise._setDisposable(thenable._getDisposer()); + } + return maybePromise; + } + function dispose(resources, inspection) { + var i = 0; + var len = resources.length; + var ret = new Promise(INTERNAL); + function iterator() { + if (i >= len) return ret._fulfill(); + var maybePromise = castPreservingDisposable(resources[i++]); + if (maybePromise instanceof Promise && + maybePromise._isDisposable()) { + try { + maybePromise = tryConvertToPromise( + maybePromise._getDisposer().tryDispose(inspection), + resources.promise); + } catch (e) { + return thrower(e); + } + if (maybePromise instanceof Promise) { + return maybePromise._then(iterator, thrower, + null, null, null); + } + } + iterator(); + } + iterator(); + return ret; + } + + function Disposer(data, promise, context) { + this._data = data; + this._promise = promise; + this._context = context; + } + + Disposer.prototype.data = function () { + return this._data; + }; + + Disposer.prototype.promise = function () { + return this._promise; + }; + + Disposer.prototype.resource = function () { + if (this.promise().isFulfilled()) { + return this.promise().value(); + } + return NULL; + }; + + Disposer.prototype.tryDispose = function(inspection) { + var resource = this.resource(); + var context = this._context; + if (context !== undefined) context._pushContext(); + var ret = resource !== NULL + ? this.doDispose(resource, inspection) : null; + if (context !== undefined) context._popContext(); + this._promise._unsetDisposable(); + this._data = null; + return ret; + }; + + Disposer.isDisposer = function (d) { + return (d != null && + typeof d.resource === "function" && + typeof d.tryDispose === "function"); + }; + + function FunctionDisposer(fn, promise, context) { + this.constructor$(fn, promise, context); + } + inherits(FunctionDisposer, Disposer); + + FunctionDisposer.prototype.doDispose = function (resource, inspection) { + var fn = this.data(); + return fn.call(resource, resource, inspection); + }; + + function maybeUnwrapDisposer(value) { + if (Disposer.isDisposer(value)) { + this.resources[this.index]._setDisposable(value); + return value.promise(); + } + return value; + } + + function ResourceList(length) { + this.length = length; + this.promise = null; + this[length-1] = null; + } + + ResourceList.prototype._resultCancelled = function() { + var len = this.length; + for (var i = 0; i < len; ++i) { + var item = this[i]; + if (item instanceof Promise) { + item.cancel(); + } + } + }; + + Promise.using = function () { + var len = arguments.length; + if (len < 2) return apiRejection( + "you must pass at least 2 arguments to Promise.using"); + var fn = arguments[len - 1]; + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + var input; + var spreadArgs = true; + if (len === 2 && Array.isArray(arguments[0])) { + input = arguments[0]; + len = input.length; + spreadArgs = false; + } else { + input = arguments; + len--; + } + var resources = new ResourceList(len); + for (var i = 0; i < len; ++i) { + var resource = input[i]; + if (Disposer.isDisposer(resource)) { + var disposer = resource; + resource = resource.promise(); + resource._setDisposable(disposer); + } else { + var maybePromise = tryConvertToPromise(resource); + if (maybePromise instanceof Promise) { + resource = + maybePromise._then(maybeUnwrapDisposer, null, null, { + resources: resources, + index: i + }, undefined); + } + } + resources[i] = resource; + } + + var reflectedResources = new Array(resources.length); + for (var i = 0; i < reflectedResources.length; ++i) { + reflectedResources[i] = Promise.resolve(resources[i]).reflect(); + } + + var resultPromise = Promise.all(reflectedResources) + .then(function(inspections) { + for (var i = 0; i < inspections.length; ++i) { + var inspection = inspections[i]; + if (inspection.isRejected()) { + errorObj.e = inspection.error(); + return errorObj; + } else if (!inspection.isFulfilled()) { + resultPromise.cancel(); + return; + } + inspections[i] = inspection.value(); + } + promise._pushContext(); + + fn = tryCatch(fn); + var ret = spreadArgs + ? fn.apply(undefined, inspections) : fn(inspections); + var promiseCreated = promise._popContext(); + debug.checkForgottenReturns( + ret, promiseCreated, "Promise.using", promise); + return ret; + }); + + var promise = resultPromise.lastly(function() { + var inspection = new Promise.PromiseInspection(resultPromise); + return dispose(resources, inspection); + }); + resources.promise = promise; + promise._setOnCancel(resources); + return promise; + }; + + Promise.prototype._setDisposable = function (disposer) { + this._bitField = this._bitField | 131072; + this._disposer = disposer; + }; + + Promise.prototype._isDisposable = function () { + return (this._bitField & 131072) > 0; + }; + + Promise.prototype._getDisposer = function () { + return this._disposer; + }; + + Promise.prototype._unsetDisposable = function () { + this._bitField = this._bitField & (~131072); + this._disposer = undefined; + }; + + Promise.prototype.disposer = function (fn) { + if (typeof fn === "function") { + return new FunctionDisposer(fn, this, createContext()); + } + throw new TypeError(); + }; + +}; + +},{"./errors":12,"./util":36}],36:[function(_dereq_,module,exports){ +"use strict"; +var es5 = _dereq_("./es5"); +var canEvaluate = typeof navigator == "undefined"; + +var errorObj = {e: {}}; +var tryCatchTarget; +var globalObject = typeof self !== "undefined" ? self : + typeof window !== "undefined" ? window : + typeof global !== "undefined" ? global : + this !== undefined ? this : null; + +function tryCatcher() { + try { + var target = tryCatchTarget; + tryCatchTarget = null; + return target.apply(this, arguments); + } catch (e) { + errorObj.e = e; + return errorObj; + } +} +function tryCatch(fn) { + tryCatchTarget = fn; + return tryCatcher; +} + +var inherits = function(Child, Parent) { + var hasProp = {}.hasOwnProperty; + + function T() { + this.constructor = Child; + this.constructor$ = Parent; + for (var propertyName in Parent.prototype) { + if (hasProp.call(Parent.prototype, propertyName) && + propertyName.charAt(propertyName.length-1) !== "$" + ) { + this[propertyName + "$"] = Parent.prototype[propertyName]; + } + } + } + T.prototype = Parent.prototype; + Child.prototype = new T(); + return Child.prototype; +}; + + +function isPrimitive(val) { + return val == null || val === true || val === false || + typeof val === "string" || typeof val === "number"; + +} + +function isObject(value) { + return typeof value === "function" || + typeof value === "object" && value !== null; +} + +function maybeWrapAsError(maybeError) { + if (!isPrimitive(maybeError)) return maybeError; + + return new Error(safeToString(maybeError)); +} + +function withAppended(target, appendee) { + var len = target.length; + var ret = new Array(len + 1); + var i; + for (i = 0; i < len; ++i) { + ret[i] = target[i]; + } + ret[i] = appendee; + return ret; +} + +function getDataPropertyOrDefault(obj, key, defaultValue) { + if (es5.isES5) { + var desc = Object.getOwnPropertyDescriptor(obj, key); + + if (desc != null) { + return desc.get == null && desc.set == null + ? desc.value + : defaultValue; + } + } else { + return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined; + } +} + +function notEnumerableProp(obj, name, value) { + if (isPrimitive(obj)) return obj; + var descriptor = { + value: value, + configurable: true, + enumerable: false, + writable: true + }; + es5.defineProperty(obj, name, descriptor); + return obj; +} + +function thrower(r) { + throw r; +} + +var inheritedDataKeys = (function() { + var excludedPrototypes = [ + Array.prototype, + Object.prototype, + Function.prototype + ]; + + var isExcludedProto = function(val) { + for (var i = 0; i < excludedPrototypes.length; ++i) { + if (excludedPrototypes[i] === val) { + return true; + } + } + return false; + }; + + if (es5.isES5) { + var getKeys = Object.getOwnPropertyNames; + return function(obj) { + var ret = []; + var visitedKeys = Object.create(null); + while (obj != null && !isExcludedProto(obj)) { + var keys; + try { + keys = getKeys(obj); + } catch (e) { + return ret; + } + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (visitedKeys[key]) continue; + visitedKeys[key] = true; + var desc = Object.getOwnPropertyDescriptor(obj, key); + if (desc != null && desc.get == null && desc.set == null) { + ret.push(key); + } + } + obj = es5.getPrototypeOf(obj); + } + return ret; + }; + } else { + var hasProp = {}.hasOwnProperty; + return function(obj) { + if (isExcludedProto(obj)) return []; + var ret = []; + + /*jshint forin:false */ + enumeration: for (var key in obj) { + if (hasProp.call(obj, key)) { + ret.push(key); + } else { + for (var i = 0; i < excludedPrototypes.length; ++i) { + if (hasProp.call(excludedPrototypes[i], key)) { + continue enumeration; + } + } + ret.push(key); + } + } + return ret; + }; + } + +})(); + +var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/; +function isClass(fn) { + try { + if (typeof fn === "function") { + var keys = es5.names(fn.prototype); + + var hasMethods = es5.isES5 && keys.length > 1; + var hasMethodsOtherThanConstructor = keys.length > 0 && + !(keys.length === 1 && keys[0] === "constructor"); + var hasThisAssignmentAndStaticMethods = + thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0; + + if (hasMethods || hasMethodsOtherThanConstructor || + hasThisAssignmentAndStaticMethods) { + return true; + } + } + return false; + } catch (e) { + return false; + } +} + +function toFastProperties(obj) { + /*jshint -W027,-W055,-W031*/ + function FakeConstructor() {} + FakeConstructor.prototype = obj; + var l = 8; + while (l--) new FakeConstructor(); + return obj; + eval(obj); +} + +var rident = /^[a-z$_][a-z$_0-9]*$/i; +function isIdentifier(str) { + return rident.test(str); +} + +function filledRange(count, prefix, suffix) { + var ret = new Array(count); + for(var i = 0; i < count; ++i) { + ret[i] = prefix + i + suffix; + } + return ret; +} + +function safeToString(obj) { + try { + return obj + ""; + } catch (e) { + return "[no string representation]"; + } +} + +function isError(obj) { + return obj !== null && + typeof obj === "object" && + typeof obj.message === "string" && + typeof obj.name === "string"; +} + +function markAsOriginatingFromRejection(e) { + try { + notEnumerableProp(e, "isOperational", true); + } + catch(ignore) {} +} + +function originatesFromRejection(e) { + if (e == null) return false; + return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) || + e["isOperational"] === true); +} + +function canAttachTrace(obj) { + return isError(obj) && es5.propertyIsWritable(obj, "stack"); +} + +var ensureErrorObject = (function() { + if (!("stack" in new Error())) { + return function(value) { + if (canAttachTrace(value)) return value; + try {throw new Error(safeToString(value));} + catch(err) {return err;} + }; + } else { + return function(value) { + if (canAttachTrace(value)) return value; + return new Error(safeToString(value)); + }; + } +})(); + +function classString(obj) { + return {}.toString.call(obj); +} + +function copyDescriptors(from, to, filter) { + var keys = es5.names(from); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (filter(key)) { + try { + es5.defineProperty(to, key, es5.getDescriptor(from, key)); + } catch (ignore) {} + } + } +} + +var asArray = function(v) { + if (es5.isArray(v)) { + return v; + } + return null; +}; + +if (typeof Symbol !== "undefined" && Symbol.iterator) { + var ArrayFrom = typeof Array.from === "function" ? function(v) { + return Array.from(v); + } : function(v) { + var ret = []; + var it = v[Symbol.iterator](); + var itResult; + while (!((itResult = it.next()).done)) { + ret.push(itResult.value); + } + return ret; + }; + + asArray = function(v) { + if (es5.isArray(v)) { + return v; + } else if (v != null && typeof v[Symbol.iterator] === "function") { + return ArrayFrom(v); + } + return null; + }; +} + +var isNode = typeof process !== "undefined" && + classString(process).toLowerCase() === "[object process]"; + +var hasEnvVariables = typeof process !== "undefined" && + typeof process.env !== "undefined"; + +function env(key) { + return hasEnvVariables ? process.env[key] : undefined; +} + +function getNativePromise() { + if (typeof Promise === "function") { + try { + var promise = new Promise(function(){}); + if ({}.toString.call(promise) === "[object Promise]") { + return Promise; + } + } catch (e) {} + } +} + +function domainBind(self, cb) { + return self.bind(cb); +} + +var ret = { + isClass: isClass, + isIdentifier: isIdentifier, + inheritedDataKeys: inheritedDataKeys, + getDataPropertyOrDefault: getDataPropertyOrDefault, + thrower: thrower, + isArray: es5.isArray, + asArray: asArray, + notEnumerableProp: notEnumerableProp, + isPrimitive: isPrimitive, + isObject: isObject, + isError: isError, + canEvaluate: canEvaluate, + errorObj: errorObj, + tryCatch: tryCatch, + inherits: inherits, + withAppended: withAppended, + maybeWrapAsError: maybeWrapAsError, + toFastProperties: toFastProperties, + filledRange: filledRange, + toString: safeToString, + canAttachTrace: canAttachTrace, + ensureErrorObject: ensureErrorObject, + originatesFromRejection: originatesFromRejection, + markAsOriginatingFromRejection: markAsOriginatingFromRejection, + classString: classString, + copyDescriptors: copyDescriptors, + hasDevTools: typeof chrome !== "undefined" && chrome && + typeof chrome.loadTimes === "function", + isNode: isNode, + hasEnvVariables: hasEnvVariables, + env: env, + global: globalObject, + getNativePromise: getNativePromise, + domainBind: domainBind +}; +ret.isRecentNode = ret.isNode && (function() { + var version = process.versions.node.split(".").map(Number); + return (version[0] === 0 && version[1] > 10) || (version[0] > 0); +})(); + +if (ret.isNode) ret.toFastProperties(process); + +try {throw new Error(); } catch (e) {ret.lastLineError = e;} +module.exports = ret; + +},{"./es5":13}]},{},[4])(4) +}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; } \ No newline at end of file diff --git a/node_modules/bluebird/js/browser/bluebird.min.js b/node_modules/bluebird/js/browser/bluebird.min.js new file mode 100644 index 0000000..59afc96 --- /dev/null +++ b/node_modules/bluebird/js/browser/bluebird.min.js @@ -0,0 +1,31 @@ +/* @preserve + * The MIT License (MIT) + * + * Copyright (c) 2013-2017 Petka Antonov + * + * 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. + * + */ +/** + * bluebird build version 3.5.0 + * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each +*/ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t()}}(function(){var t,e,n;return function r(t,e,n){function i(s,a){if(!e[s]){if(!t[s]){var c="function"==typeof _dereq_&&_dereq_;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=e[s]={exports:{}};t[s][0].call(u.exports,function(e){var n=t[s][1][e];return i(n?n:e)},u,u.exports,r,t,e,n)}return e[s].exports}for(var o="function"==typeof _dereq_&&_dereq_,s=0;s0;){var e=t.shift();if("function"==typeof e){var n=t.shift(),r=t.shift();e.call(n,r)}else e._settlePromises()}},r.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},e.exports=r,e.exports.firstLineError=a},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){var i=!1,o=function(t,e){this._reject(e)},s=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},a=function(t,e){0===(50397184&this._bitField)&&this._resolveCallback(e.target)},c=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=r.propagateFromFunction(),t.prototype._boundValue=r.boundValueFunction());var l=n(o),u=new t(e);u._propagateFrom(this,1);var p=this._target();if(u._setBoundTo(l),l instanceof t){var h={promiseRejectionQueued:!1,promise:u,target:p,bindingPromise:l};p._then(e,s,void 0,u,h),l._then(a,c,void 0,u,h),u._setOnCancel(l)}else u._resolveCallback(p);return u},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],4:[function(t,e,n){"use strict";function r(){try{Promise===o&&(Promise=i)}catch(t){}return o}var i;"undefined"!=typeof Promise&&(i=Promise);var o=t("./promise")();o.noConflict=r,e.exports=o},{"./promise":22}],5:[function(t,e,n){"use strict";var r=Object.create;if(r){var i=r(null),o=r(null);i[" size"]=o[" size"]=0}e.exports=function(e){function n(t,n){var r;if(null!=t&&(r=t[n]),"function"!=typeof r){var i="Object "+a.classString(t)+" has no method '"+a.toString(n)+"'";throw new e.TypeError(i)}return r}function r(t){var e=this.pop(),r=n(t,e);return r.apply(t,this)}function i(t){return t[this]}function o(t){var e=+this;return 0>e&&(e=Math.max(0,e+t.length)),t[e]}var s,a=t("./util"),c=a.canEvaluate;a.isIdentifier;e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(r,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e,n="number"==typeof t;if(n)e=o;else if(c){var r=s(t);e=null!==r?r:i}else e=i;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){var o=t("./util"),s=o.tryCatch,a=o.errorObj,c=e._async;e.prototype["break"]=e.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),this._enoughBranchesHaveCancelled()?(this._invokeOnCancel(),!0):!1)},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),c.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var n=0;n=0?o[t]:void 0}var i=!1,o=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,o.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=o.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},e.CapturedTrace=null,e.create=n,e.deactivateLongStackTraces=function(){},e.activateLongStackTraces=function(){var n=t.prototype._pushContext,o=t.prototype._popContext,s=t._peekContext,a=t.prototype._peekContext,c=t.prototype._promiseCreated;e.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=o,t._peekContext=s,t.prototype._peekContext=a,t.prototype._promiseCreated=c,i=!1},i=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},e}},{}],9:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,e){return{promise:e}}function i(){return!1}function o(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+H.toString(t));r._attachCancellationCallback(t)})}catch(i){return i}}function s(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?H.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function a(){return this._onCancelField}function c(t){this._onCancelField=t}function l(){this._cancellationParent=void 0,this._onCancelField=void 0}function u(t,e){if(0!==(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function p(t,e){0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function h(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function f(){this._trace=new S(this._peekContext())}function _(t,e){if(N(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var r=j(t);H.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),H.notEnumerableProp(t,"__stackCleaned__",!0)}}}function d(t,e,n,r,i){if(void 0===t&&null!==e&&W){if(void 0!==i&&i._returnedNonUndefined())return;if(0===(65535&r._bitField))return;n&&(n+=" ");var o="",s="";if(e._trace){for(var a=e._trace.stack.split("\n"),c=w(a),l=c.length-1;l>=0;--l){var u=c[l];if(!U.test(u)){var p=u.match(M);p&&(o="at "+p[1]+":"+p[2]+":"+p[3]+" ");break}}if(c.length>0)for(var h=c[0],l=0;l0&&(s="\n"+a[l-1]);break}}var f="a promise was created in a "+n+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+s;r._warn(f,!0,e)}}function v(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),y(n)}function y(t,n,r){if(ot.warnings){var i,o=new L(t);if(n)r._attachExtraTrace(o);else if(ot.longStackTraces&&(i=e._peekContext()))i.attachExtraTrace(o);else{var s=j(o);o.stack=s.message+"\n"+s.stack.join("\n")}tt("warning",o)||E(o,"",!0)}}function m(t,e){for(var n=0;n=0;--a)if(r[a]===o){s=a;break}for(var a=s;a>=0;--a){var c=r[a];if(e[i]!==c)break;e.pop(),i--}e=r}}function w(t){for(var e=[],n=0;n0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}function j(t){var e=t.stack,n=t.toString();return e="string"==typeof e&&e.length>0?C(t):[" (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:w(e)}}function E(t,e,n){if("undefined"!=typeof console){var r;if(H.isObject(t)){var i=t.stack;r=e+Q(i,t)}else r=e+String(t);"function"==typeof D?D(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function k(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(o){I.throwLater(o)}"unhandledRejection"===t?tt(t,n,r)||i||E(n,"Unhandled rejection "):tt(t,r)}function F(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():H.toString(t);var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(e))try{var r=JSON.stringify(t);e=r}catch(i){}0===e.length&&(e="(empty array)")}return"(<"+x(e)+">, no stack trace)"}function x(t){var e=41;return t.lengths||0>a||!n||!r||n!==r||s>=a||(nt=function(t){if(B.test(t))return!0;var e=P(t);return e&&e.fileName===n&&s<=e.line&&e.line<=a?!0:!1})}}function S(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);it(this,S),e>32&&this.uncycle()}var O,A,D,V=e._getDomain,I=e._async,L=t("./errors").Warning,H=t("./util"),N=H.canAttachTrace,B=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,U=/\((?:timers\.js):\d+:\d+\)/,M=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,q=null,Q=null,$=!1,G=!(0==H.env("BLUEBIRD_DEBUG")||!H.env("BLUEBIRD_DEBUG")&&"development"!==H.env("NODE_ENV")),z=!(0==H.env("BLUEBIRD_WARNINGS")||!G&&!H.env("BLUEBIRD_WARNINGS")),X=!(0==H.env("BLUEBIRD_LONG_STACK_TRACES")||!G&&!H.env("BLUEBIRD_LONG_STACK_TRACES")),W=0!=H.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(z||!!H.env("BLUEBIRD_W_FORGOTTEN_RETURN"));e.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},e.prototype._ensurePossibleRejectionHandled=function(){0===(524288&this._bitField)&&(this._setRejectionIsUnhandled(),I.invokeLater(this._notifyUnhandledRejection,this,void 0))},e.prototype._notifyUnhandledRejectionIsHandled=function(){k("rejectionHandled",O,void 0,this)},e.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},e.prototype._returnedNonUndefined=function(){return 0!==(268435456&this._bitField)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),k("unhandledRejection",A,t,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},e.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},e.prototype._warn=function(t,e,n){return y(t,e,n||this)},e.onPossiblyUnhandledRejection=function(t){var e=V();A="function"==typeof t?null===e?t:H.domainBind(e,t):void 0},e.onUnhandledRejectionHandled=function(t){var e=V();O="function"==typeof t?null===e?t:H.domainBind(e,t):void 0};var K=function(){};e.longStackTraces=function(){if(I.haveItemsQueued()&&!ot.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!ot.longStackTraces&&T()){var t=e.prototype._captureStackTrace,r=e.prototype._attachExtraTrace;ot.longStackTraces=!0,K=function(){if(I.haveItemsQueued()&&!ot.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");e.prototype._captureStackTrace=t,e.prototype._attachExtraTrace=r,n.deactivateLongStackTraces(),I.enableTrampoline(),ot.longStackTraces=!1},e.prototype._captureStackTrace=f,e.prototype._attachExtraTrace=_,n.activateLongStackTraces(),I.disableTrampolineIfNecessary()}},e.hasLongStackTraces=function(){return ot.longStackTraces&&T()};var J=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return H.global.dispatchEvent(t),function(t,e){var n=new CustomEvent(t.toLowerCase(),{detail:e,cancelable:!0});return!H.global.dispatchEvent(n)}}if("function"==typeof Event){var t=new Event("CustomEvent");return H.global.dispatchEvent(t),function(t,e){var n=new Event(t.toLowerCase(),{cancelable:!0});return n.detail=e,!H.global.dispatchEvent(n)}}var t=document.createEvent("CustomEvent");return t.initCustomEvent("testingtheevent",!1,!0,{}),H.global.dispatchEvent(t),function(t,e){var n=document.createEvent("CustomEvent");return n.initCustomEvent(t.toLowerCase(),!1,!0,e),!H.global.dispatchEvent(n)}}catch(e){}return function(){return!1}}(),Y=function(){return H.isNode?function(){return process.emit.apply(process,arguments)}:H.global?function(t){var e="on"+t.toLowerCase(),n=H.global[e];return n?(n.apply(H.global,[].slice.call(arguments,1)),!0):!1}:function(){return!1}}(),Z={promiseCreated:r,promiseFulfilled:r,promiseRejected:r,promiseResolved:r,promiseCancelled:r,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:r},tt=function(t){var e=!1;try{e=Y.apply(null,arguments)}catch(n){I.throwLater(n),e=!0}var r=!1;try{r=J(t,Z[t].apply(null,arguments))}catch(n){I.throwLater(n),r=!0}return r||e};e.config=function(t){if(t=Object(t),"longStackTraces"in t&&(t.longStackTraces?e.longStackTraces():!t.longStackTraces&&e.hasLongStackTraces()&&K()),"warnings"in t){var n=t.warnings;ot.warnings=!!n,W=ot.warnings,H.isObject(n)&&"wForgottenReturn"in n&&(W=!!n.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!ot.cancellation){if(I.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=l,e.prototype._propagateFrom=u,e.prototype._onCancel=a,e.prototype._setOnCancel=c,e.prototype._attachCancellationCallback=s,e.prototype._execute=o,et=u,ot.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!ot.monitoring?(ot.monitoring=!0,e.prototype._fireEvent=tt):!t.monitoring&&ot.monitoring&&(ot.monitoring=!1,e.prototype._fireEvent=i)),e},e.prototype._fireEvent=i,e.prototype._execute=function(t,e,n){try{t(e,n)}catch(r){return r}},e.prototype._onCancel=function(){},e.prototype._setOnCancel=function(t){},e.prototype._attachCancellationCallback=function(t){},e.prototype._captureStackTrace=function(){},e.prototype._attachExtraTrace=function(){},e.prototype._clearCancellationData=function(){},e.prototype._propagateFrom=function(t,e){};var et=p,nt=function(){return!1},rt=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;H.inherits(S,Error),n.CapturedTrace=S,S.prototype.uncycle=function(){var t=this._length;if(!(2>t)){for(var e=[],n={},r=0,i=this;void 0!==i;++r)e.push(i),i=i._parent;t=this._length=r;for(var r=t-1;r>=0;--r){var o=e[r].stack;void 0===n[o]&&(n[o]=r)}for(var r=0;t>r;++r){var s=e[r].stack,a=n[s];if(void 0!==a&&a!==r){a>0&&(e[a-1]._parent=void 0,e[a-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var c=r>0?e[r-1]:this;t-1>a?(c._parent=e[a+1],c._parent.uncycle(),c._length=c._parent._length+1):(c._parent=void 0,c._length=1);for(var l=c._length+1,u=r-2;u>=0;--u)e[u]._length=l,l++;return}}}},S.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=j(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(w(i.stack.split("\n"))),i=i._parent;b(r),g(r),H.notEnumerableProp(t,"stack",m(n,r)),H.notEnumerableProp(t,"__stackCleaned__",!0)}};var it=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():F(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,q=t,Q=e;var n=Error.captureStackTrace;return nt=function(t){return B.test(t)},function(t,e){Error.stackTraceLimit+=6,n(t,e),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return q=/@/,Q=e,$=!0,function(t){t.stack=(new Error).stack};var i;try{throw new Error}catch(o){i="stack"in o}return"stack"in r||!i||"number"!=typeof Error.stackTraceLimit?(Q=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?F(e):e.toString()},null):(q=t,Q=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(D=function(t){console.warn(t)},H.isNode&&process.stderr.isTTY?D=function(t,e){var n=e?"":"";console.warn(n+t+"\n")}:H.isNode||"string"!=typeof(new Error).stack||(D=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var ot={warnings:z,longStackTraces:!1,cancellation:!1,monitoring:!1};return X&&e.longStackTraces(),{longStackTraces:function(){return ot.longStackTraces},warnings:function(){return ot.warnings},cancellation:function(){return ot.cancellation},monitoring:function(){return ot.monitoring},propagateFromFunction:function(){return et},boundValueFunction:function(){return h},checkForgottenReturns:d,setBounds:R,warn:y,deprecated:v,CapturedTrace:S,fireDomEvent:J,fireGlobalEvent:Y}}},{"./errors":12,"./util":36}],10:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype["return"]=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype["throw"]=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1],r=function(){throw e};return this.caught(t,r)},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var r=arguments[1];r instanceof t&&r.suppressUnhandledRejections();var i=function(){return r};return this.caught(n,i)}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t,e){function n(){return o(this)}function r(t,n){return i(t,n,e,e)}var i=t.reduce,o=t.all;t.prototype.each=function(t){return i(this,t,e,0)._then(n,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return i(this,t,e,e)},t.each=function(t,r){return i(t,r,e,0)._then(n,void 0,void 0,t,void 0)},t.mapSeries=r}},{}],12:[function(t,e,n){"use strict";function r(t,e){function n(r){return this instanceof n?(p(this,"message","string"==typeof r?r:e),p(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new n(r)}return u(n,Error),n}function i(t){return this instanceof i?(p(this,"name","OperationalError"),p(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(p(this,"message",t.message),p(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new i(t)}var o,s,a=t("./es5"),c=a.freeze,l=t("./util"),u=l.inherits,p=l.notEnumerableProp,h=r("Warning","warning"),f=r("CancellationError","cancellation error"),_=r("TimeoutError","timeout error"),d=r("AggregateError","aggregate error");try{o=TypeError,s=RangeError}catch(v){o=r("TypeError","type error"),s=r("RangeError","range error")}for(var y="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),m=0;m1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0):!1}function a(){return l.call(this,this.promise._target()._settledValue())}function c(t){return s(this,t)?void 0:(h.e=t,h)}function l(t){var i=this.promise,l=this.handler;if(!this.called){this.called=!0;var u=this.isFinallyHandler()?l.call(i._boundValue()):l.call(i._boundValue(),t);if(u===r)return u;if(void 0!==u){i._setReturnedNonUndefined();var f=n(u,i);if(f instanceof e){if(null!=this.cancelPromise){if(f._isCancelled()){var _=new p("late cancellation observer");return i._attachExtraTrace(_),h.e=_,h}f.isPending()&&f._attachCancellationCallback(new o(this))}return f._then(a,c,void 0,this,void 0)}}}return i.isRejected()?(s(this),h.e=t,h):(s(this),t)}var u=t("./util"),p=e.CancellationError,h=u.errorObj,f=t("./catch_filter")(r);return i.prototype.isFinallyHandler=function(){return 0===this.type},o.prototype._resultCancelled=function(){s(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,new i(this,e,t),void 0)},e.prototype.lastly=e.prototype["finally"]=function(t){return this._passThrough(t,0,l,l)},e.prototype.tap=function(t){return this._passThrough(t,1,l)},e.prototype.tapCatch=function(t){var n=arguments.length;if(1===n)return this._passThrough(t,1,void 0,l);var r,i=new Array(n-1),o=0;for(r=0;n-1>r;++r){var s=arguments[r];if(!u.isObject(s))return e.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+u.classString(s)));i[o++]=s}i.length=o;var a=arguments[r];return this._passThrough(f(i,a,this),1,void 0,l)},i}},{"./catch_filter":7,"./util":36}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r){for(var o=0;o0&&"function"==typeof arguments[e]){t=arguments[e];var r}var i=[].slice.call(arguments);t&&i.pop();var r=new n(i).promise();return void 0!==t?r.spread(t):r}}},{"./util":36}],18:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,e,n,r){this.constructor$(t),this._promise._captureStackTrace();var i=l();this._callback=null===i?e:u.domainBind(i,e),this._preservedValues=r===o?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],f.invoke(this._asyncInit,this,void 0)}function c(t,n,i,o){if("function"!=typeof n)return r("expecting a function but got "+u.classString(n));var s=0;if(void 0!==i){if("object"!=typeof i||null===i)return e.reject(new TypeError("options argument must be an object but it is "+u.classString(i)));if("number"!=typeof i.concurrency)return e.reject(new TypeError("'concurrency' must be a number but it is "+u.classString(i.concurrency)));s=i.concurrency}return s="number"==typeof s&&isFinite(s)&&s>=1?s:0,new a(t,n,s,o).promise()}var l=e._getDomain,u=t("./util"),p=u.tryCatch,h=u.errorObj,f=e._async;u.inherits(a,n),a.prototype._asyncInit=function(){this._init$(void 0,-2)},a.prototype._init=function(){},a.prototype._promiseFulfilled=function(t,n){var r=this._values,o=this.length(),a=this._preservedValues,c=this._limit;if(0>n){if(n=-1*n-1,r[n]=t,c>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(c>=1&&this._inFlight>=c)return r[n]=t,this._queue.push(n),!1;null!==a&&(a[n]=t);var l=this._promise,u=this._callback,f=l._boundValue();l._pushContext();var _=p(u).call(f,t,n,o),d=l._popContext();if(s.checkForgottenReturns(_,d,null!==a?"Promise.filter":"Promise.map",l),_===h)return this._reject(_.e),!0;var v=i(_,this._promise);if(v instanceof e){v=v._target();var y=v._bitField;if(0===(50397184&y))return c>=1&&this._inFlight++,r[n]=v,v._proxy(this,-1*(n+1)),!1;if(0===(33554432&y))return 0!==(16777216&y)?(this._reject(v._reason()),!0):(this._cancel(),!0);_=v._value()}r[n]=_}var m=++this._totalResolved;return m>=o?(null!==a?this._filter(r,a):this._resolve(r),!0):!1},a.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,n=this._values;t.length>0&&this._inFlighto;++o)t[o]&&(r[i++]=e[o]);r.length=i,this._resolve(r)},a.prototype.preservedValues=function(){return this._preservedValues},e.prototype.map=function(t,e){return c(this,t,e,null)},e.map=function(t,e,n,r){return c(t,e,n,r)}}},{"./util":36}],19:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){var s=t("./util"),a=s.tryCatch;e.method=function(t){if("function"!=typeof t)throw new e.TypeError("expecting a function but got "+s.classString(t));return function(){var r=new e(n);r._captureStackTrace(),r._pushContext();var i=a(t).apply(this,arguments),s=r._popContext();return o.checkForgottenReturns(i,s,"Promise.method",r),r._resolveFromSyncValue(i),r}},e.attempt=e["try"]=function(t){if("function"!=typeof t)return i("expecting a function but got "+s.classString(t));var r=new e(n);r._captureStackTrace(),r._pushContext();var c;if(arguments.length>1){o.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],u=arguments[2];c=s.isArray(l)?a(t).apply(u,l):a(t).call(u,l)}else c=a(t)();var p=r._popContext();return o.checkForgottenReturns(c,p,"Promise.try",r),r._resolveFromSyncValue(c),r},e.prototype._resolveFromSyncValue=function(t){t===s.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,n){"use strict";function r(t){return t instanceof Error&&u.getPrototypeOf(t)===Error.prototype}function i(t){var e;if(r(t)){e=new l(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=u.keys(t),i=0;i1){var n,r=new Array(e-1),i=0;for(n=0;e-1>n;++n){var o=arguments[n];if(!f.isObject(o))return p("Catch statement predicate: expecting an object but got "+f.classString(o));r[i++]=o}return r.length=i,t=arguments[n],this.then(void 0,P(r,t,this))}return this.then(void 0,t)},i.prototype.reflect=function(){return this._then(u,u,void 0,this,void 0)},i.prototype.then=function(t,e){if(x.warnings()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+f.classString(t);arguments.length>1&&(n+=", "+f.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},i.prototype.done=function(t,e){var n=this._then(t,e,void 0,void 0,void 0);n._setIsFinal()},i.prototype.spread=function(t){return"function"!=typeof t?p("expecting a function but got "+f.classString(t)):this.all()._then(t,void 0,void 0,w,void 0)},i.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new E(this).promise()},i.prototype.error=function(t){return this.caught(f.originatesFromRejection,t)},i.getNewLibraryCopy=e.exports,i.is=function(t){return t instanceof i},i.fromNode=i.fromCallback=function(t){var e=new i(b);e._captureStackTrace();var n=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=O(t)(R(e,n));return r===S&&e._rejectCallback(r.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},i.all=function(t){return new E(t).promise()},i.cast=function(t){var e=j(t);return e instanceof i||(e=new i(b),e._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(t){var e=new i(b);return e._captureStackTrace(),e._rejectCallback(t,!0),e},i.setScheduler=function(t){if("function"!=typeof t)throw new m("expecting a function but got "+f.classString(t));return v.setScheduler(t)},i.prototype._then=function(t,e,n,r,o){var s=void 0!==o,a=s?o:new i(b),l=this._target(),u=l._bitField;s||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===r&&0!==(2097152&this._bitField)&&(r=0!==(50397184&u)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var p=c();if(0!==(50397184&u)){var h,_,d=l._settlePromiseCtx;0!==(33554432&u)?(_=l._rejectionHandler0,h=t):0!==(16777216&u)?(_=l._fulfillmentHandler0,h=e,l._unsetRejectionIsUnhandled()):(d=l._settlePromiseLateCancellationObserver,_=new g("late cancellation observer"),l._attachExtraTrace(_),h=e),v.invoke(d,l,{handler:null===p?h:"function"==typeof h&&f.domainBind(p,h),promise:a,receiver:r,value:_})}else l._addCallbacks(t,e,a,r,p);return a},i.prototype._length=function(){return 65535&this._bitField},i.prototype._isFateSealed=function(){return 0!==(117506048&this._bitField)},i.prototype._isFollowing=function(){return 67108864===(67108864&this._bitField)},i.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},i.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},i.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},i.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},i.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},i.prototype._isFinal=function(){return(4194304&this._bitField)>0},i.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},i.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},i.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},i.prototype._setAsyncGuaranteed=function(){v.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},i.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];return e===h?void 0:void 0===e&&this._isBound()?this._boundValue():e},i.prototype._promiseAt=function(t){return this[4*t-4+2]},i.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},i.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},i.prototype._boundValue=function(){},i.prototype._migrateCallback0=function(t){var e=(t._bitField,t._fulfillmentHandler0),n=t._rejectionHandler0,r=t._promise0,i=t._receiverAt(0);void 0===i&&(i=h),this._addCallbacks(e,n,r,i,null)},i.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),r=t._rejectionHandlerAt(e),i=t._promiseAt(e),o=t._receiverAt(e);void 0===o&&(o=h),this._addCallbacks(n,r,i,o,null)},i.prototype._addCallbacks=function(t,e,n,r,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=n,this._receiver0=r,"function"==typeof t&&(this._fulfillmentHandler0=null===i?t:f.domainBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:f.domainBind(i,e));else{var s=4*o-4;this[s+2]=n,this[s+3]=r,"function"==typeof t&&(this[s+0]=null===i?t:f.domainBind(i,t)),"function"==typeof e&&(this[s+1]=null===i?e:f.domainBind(i,e))}return this._setLength(o+1),o},i.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},i.prototype._resolveCallback=function(t,e){if(0===(117506048&this._bitField)){if(t===this)return this._rejectCallback(l(),!1);var n=j(t,this);if(!(n instanceof i))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r===this)return void this._reject(l());var o=r._bitField;if(0===(50397184&o)){var s=this._length();s>0&&r._migrateCallback0(this);for(var a=1;s>a;++a)r._migrateCallbackAt(this,a);this._setFollowing(),this._setLength(0),this._setFollowee(r)}else if(0!==(33554432&o))this._fulfill(r._value());else if(0!==(16777216&o))this._reject(r._reason());else{var c=new g("late cancellation observer");r._attachExtraTrace(c),this._reject(c)}}},i.prototype._rejectCallback=function(t,e,n){var r=f.ensureErrorObject(t),i=r===t;if(!i&&!n&&x.warnings()){var o="a promise was rejected with a non-error: "+f.classString(t);this._warn(o,!0)}this._attachExtraTrace(r,e?i:!1),this._reject(t)},i.prototype._resolveFromExecutor=function(t){if(t!==b){var e=this;this._captureStackTrace(),this._pushContext();var n=!0,r=this._execute(t,function(t){e._resolveCallback(t)},function(t){e._rejectCallback(t,n)});n=!1,this._popContext(),void 0!==r&&e._rejectCallback(r,!0)}},i.prototype._settlePromiseFromHandler=function(t,e,n,r){var i=r._bitField;if(0===(65536&i)){r._pushContext();var o;e===w?n&&"number"==typeof n.length?o=O(t).apply(this._boundValue(),n):(o=S,o.e=new m("cannot .spread() a non-array: "+f.classString(n))):o=O(t).call(e,n);var s=r._popContext();i=r._bitField,0===(65536&i)&&(o===C?r._reject(n):o===S?r._rejectCallback(o.e,!1):(x.checkForgottenReturns(o,s,"",r,this),r._resolveCallback(o)))}},i.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},i.prototype._followee=function(){return this._rejectionHandler0},i.prototype._setFollowee=function(t){this._rejectionHandler0=t},i.prototype._settlePromise=function(t,e,r,o){var s=t instanceof i,a=this._bitField,c=0!==(134217728&a);0!==(65536&a)?(s&&t._invokeInternalOnCancel(),r instanceof T&&r.isFinallyHandler()?(r.cancelPromise=t,O(e).call(r,o)===S&&t._reject(S.e)):e===u?t._fulfill(u.call(r)):r instanceof n?r._promiseCancelled(t):s||t instanceof E?t._cancel():r.cancel()):"function"==typeof e?s?(c&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(e,r,o,t)):e.call(r,o,t):r instanceof n?r._isResolved()||(0!==(33554432&a)?r._promiseFulfilled(o,t):r._promiseRejected(o,t)):s&&(c&&t._setAsyncGuaranteed(),0!==(33554432&a)?t._fulfill(o):t._reject(o))},i.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,r=t.receiver,o=t.value;"function"==typeof e?n instanceof i?this._settlePromiseFromHandler(e,r,o,n):e.call(r,o,n):n instanceof i&&n._reject(o)},i.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},i.prototype._settlePromise0=function(t,e,n){var r=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(r,t,i,e)},i.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},i.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=l();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!==(134217728&e)?this._settlePromises():v.settlePromises(this))}},i.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?v.fatalError(t,f.isNode):void((65535&e)>0?v.settlePromises(this):this._ensurePossibleRejectionHandled())},i.prototype._fulfillPromises=function(t,e){for(var n=1;t>n;n++){var r=this._fulfillmentHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._rejectPromises=function(t,e){for(var n=1;t>n;n++){var r=this._rejectionHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._settlePromises=function(){var t=this._bitField,e=65535&t;if(e>0){if(0!==(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,t),this._fulfillPromises(e,r)}this._setLength(0)}this._clearCancellationData()},i.prototype._settledValue=function(){var t=this._bitField;return 0!==(33554432&t)?this._rejectionHandler0:0!==(16777216&t)?this._fulfillmentHandler0:void 0},i.defer=i.pending=function(){x.deprecated("Promise.defer","new Promise");var t=new i(b);return{promise:t,resolve:o,reject:s}},f.notEnumerableProp(i,"_makeSelfResolutionError",l),t("./method")(i,b,j,p,x),t("./bind")(i,b,j,x),t("./cancel")(i,E,p,x),t("./direct_resolve")(i),t("./synchronous_inspection")(i),t("./join")(i,E,j,b,v,c),i.Promise=i,i.version="3.5.0",t("./map.js")(i,E,p,j,b,x),t("./call_get.js")(i),t("./using.js")(i,p,j,F,b,x),t("./timers.js")(i,b,x),t("./generators.js")(i,p,b,j,n,x),t("./nodeify.js")(i),t("./promisify.js")(i,b),t("./props.js")(i,E,j,p),t("./race.js")(i,b,j,p),t("./reduce.js")(i,E,p,j,b,x),t("./settle.js")(i,E,x),t("./some.js")(i,E,p),t("./filter.js")(i,b),t("./each.js")(i,b),t("./any.js")(i),f.toFastProperties(i),f.toFastProperties(i.prototype),a({a:1}),a({b:2}),a({c:3}),a(1),a(function(){}),a(void 0),a(!1),a(new i(b)),x.setBounds(d.firstLineError,f.lastLineError),i}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){function s(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}function a(t){var r=this._promise=new e(n);t instanceof e&&r._propagateFrom(t,3),r._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var c=t("./util");c.isArray;return c.inherits(a,o),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function l(t,n){var o=r(this._values,this._promise);if(o instanceof e){o=o._target();var a=o._bitField;if(this._values=o,0===(50397184&a))return this._promise._setAsyncGuaranteed(),o._then(l,this._reject,void 0,this,n);if(0===(33554432&a))return 0!==(16777216&a)?this._reject(o._reason()):this._cancel();o=o._value()}if(o=c.asArray(o),null===o){var u=i("expecting an array or an iterable object but got "+c.classString(o)).reason();return void this._promise._rejectCallback(u,!1)}return 0===o.length?void(-5===n?this._resolveEmptyArray():this._resolve(s(n))):void this._iterate(o)},a.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var i=this._promise,o=!1,s=null,a=0;n>a;++a){var c=r(t[a],i);c instanceof e?(c=c._target(),s=c._bitField):s=null,o?null!==s&&c.suppressUnhandledRejections():null!==s?0===(50397184&s)?(c._proxy(this,a),this._values[a]=c):o=0!==(33554432&s)?this._promiseFulfilled(c._value(),a):0!==(16777216&s)?this._promiseRejected(c._reason(),a):this._promiseCancelled(a):o=this._promiseFulfilled(c,a)}o||i._setAsyncGuaranteed()},a.prototype._isResolved=function(){return null===this._values},a.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},a.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},a.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},a.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},a.prototype._promiseCancelled=function(){return this._cancel(),!0},a.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},a.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;nc;c+=2){var u=s[c],p=s[c+1],_=u+e;if(r===k)t[_]=k(u,h,u,p,e,i);else{var d=r(p,function(){return k(u,h,u,p,e,i)});f.notEnumerableProp(d,"__isPromisified__",!0),t[_]=d}}return f.toFastProperties(t),t}function u(t,e,n){return k(t,e,void 0,t,null,n)}var p,h={},f=t("./util"),_=t("./nodeback"),d=f.withAppended,v=f.maybeWrapAsError,y=f.canEvaluate,m=t("./errors").TypeError,g="Async",b={__isPromisified__:!0},w=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],C=new RegExp("^(?:"+w.join("|")+")$"),j=function(t){return f.isIdentifier(t)&&"_"!==t.charAt(0)&&"constructor"!==t},E=function(t){return t.replace(/([$])/,"\\$")},k=y?p:c;e.promisify=function(t,e){if("function"!=typeof t)throw new m("expecting a function but got "+f.classString(t));if(i(t))return t;e=Object(e);var n=void 0===e.context?h:e.context,o=!!e.multiArgs,s=u(t,n,o);return f.copyDescriptors(t,s,r),s},e.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new m("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");e=Object(e);var n=!!e.multiArgs,r=e.suffix;"string"!=typeof r&&(r=g);var i=e.filter;"function"!=typeof i&&(i=j);var o=e.promisifier;if("function"!=typeof o&&(o=k),!f.isIdentifier(r))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var s=f.inheritedDataKeys(t),a=0;ao;++o){var s=r[o];e[o]=t[s],e[o+i]=s}}this.constructor$(e),this._isMap=n,this._init$(void 0,n?-6:-3)}function s(t){var n,s=r(t);return l(s)?(n=s instanceof e?s._then(e.props,void 0,void 0,void 0,void 0):new o(s).promise(),s instanceof e&&n._propagateFrom(s,2),n):i("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n")}var a,c=t("./util"),l=c.isObject,u=t("./es5");"function"==typeof Map&&(a=Map);var p=function(){function t(t,r){this[e]=t,this[e+n]=r,e++}var e=0,n=0;return function(r){n=r.size,e=0;var i=new Array(2*r.size);return r.forEach(t,i),i}}(),h=function(t){for(var e=new a,n=t.length/2|0,r=0;n>r;++r){var i=t[n+r],o=t[r];e.set(i,o)}return e};c.inherits(o,n),o.prototype._init=function(){},o.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;if(n>=this._length){var r;if(this._isMap)r=h(this._values);else{r={};for(var i=this.length(),o=0,s=this.length();s>o;++o)r[this._values[o+i]]=this._values[o]}return this._resolve(r),!0}return!1},o.prototype.shouldCopyValues=function(){return!1},o.prototype.getActualLength=function(t){return t>>1},e.prototype.props=function(){return s(this)},e.props=function(t){return s(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,n){"use strict";function r(t,e,n,r,i){for(var o=0;i>o;++o)n[o+r]=t[o+e],t[o+e]=void 0}function i(t){this._capacity=t,this._length=0,this._front=0}i.prototype._willBeOverCapacity=function(t){return this._capacityh;++h){var _=t[h];(void 0!==_||h in t)&&e.cast(_)._then(u,p,void 0,l,null)}return l}var s=t("./util"),a=function(t){return t.then(function(e){return o(e,t)})};e.race=function(t){return o(t,void 0)},e.prototype.race=function(){return o(this,void 0)}}},{"./util":36}],28:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r,i){this.constructor$(t);var s=h();this._fn=null===s?n:f.domainBind(s,n),void 0!==r&&(r=e.resolve(r),r._attachCancellationCallback(this)),this._initialValue=r,this._currentCancellable=null,i===o?this._eachValues=Array(this._length):0===i?this._eachValues=null:this._eachValues=void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}function c(t,e){this.isFulfilled()?e._resolve(t):e._reject(t)}function l(t,e,n,i){if("function"!=typeof e)return r("expecting a function but got "+f.classString(e));var o=new a(t,e,n,i);return o.promise()}function u(t){this.accum=t,this.array._gotAccum(t);var n=i(this.value,this.array._promise);return n instanceof e?(this.array._currentCancellable=n,n._then(p,void 0,void 0,this,void 0)):p.call(this,n)}function p(t){var n=this.array,r=n._promise,i=_(n._fn);r._pushContext();var o;o=void 0!==n._eachValues?i.call(r._boundValue(),t,this.index,this.length):i.call(r._boundValue(),this.accum,t,this.index,this.length),o instanceof e&&(n._currentCancellable=o);var a=r._popContext();return s.checkForgottenReturns(o,a,void 0!==n._eachValues?"Promise.each":"Promise.reduce",r),o}var h=e._getDomain,f=t("./util"),_=f.tryCatch;f.inherits(a,n),a.prototype._gotAccum=function(t){void 0!==this._eachValues&&null!==this._eachValues&&t!==o&&this._eachValues.push(t)},a.prototype._eachComplete=function(t){return null!==this._eachValues&&this._eachValues.push(t),this._eachValues},a.prototype._init=function(){},a.prototype._resolveEmptyArray=function(){this._resolve(void 0!==this._eachValues?this._eachValues:this._initialValue)},a.prototype.shouldCopyValues=function(){return!1},a.prototype._resolve=function(t){this._promise._resolveCallback(t),this._values=null},a.prototype._resultCancelled=function(t){return t===this._initialValue?this._cancel():void(this._isResolved()||(this._resultCancelled$(),this._currentCancellable instanceof e&&this._currentCancellable.cancel(),this._initialValue instanceof e&&this._initialValue.cancel()))},a.prototype._iterate=function(t){this._values=t;var n,r,i=t.length;if(void 0!==this._initialValue?(n=this._initialValue,r=0):(n=e.resolve(t[0]),r=1),this._currentCancellable=n,!n.isRejected())for(;i>r;++r){var o={accum:null,value:t[r],index:r,length:i,array:this};n=n._then(u,void 0,void 0,o,void 0)}void 0!==this._eachValues&&(n=n._then(this._eachComplete,void 0,void 0,this,void 0)),n._then(c,c,void 0,n,this)},e.prototype.reduce=function(t,e){return l(this,t,e,null)},e.reduce=function(t,e,n,r){return l(t,e,n,r)}}},{"./util":36}],29:[function(t,e,n){"use strict";var r,i=t("./util"),o=function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")},s=i.getNativePromise();if(i.isNode&&"undefined"==typeof MutationObserver){var a=global.setImmediate,c=process.nextTick;r=i.isRecentNode?function(t){a.call(global,t)}:function(t){c.call(process,t)}}else if("function"==typeof s&&"function"==typeof s.resolve){var l=s.resolve();r=function(t){l.then(t)}}else r="undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&(window.navigator.standalone||window.cordova)?"undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:o:function(){var t=document.createElement("div"),e={attributes:!0},n=!1,r=document.createElement("div"),i=new MutationObserver(function(){t.classList.toggle("foo"),n=!1});i.observe(r,e);var o=function(){n||(n=!0,r.classList.toggle("foo"))};return function(n){var r=new MutationObserver(function(){r.disconnect(),n()});r.observe(t,e),o()}}();e.exports=r},{"./util":36}],30:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t)}var o=e.PromiseInspection,s=t("./util");s.inherits(i,n),i.prototype._promiseResolved=function(t,e){this._values[t]=e;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},i.prototype._promiseFulfilled=function(t,e){var n=new o;return n._bitField=33554432,n._settledValueField=t,this._promiseResolved(e,n)},i.prototype._promiseRejected=function(t,e){var n=new o;return n._bitField=16777216,n._settledValueField=t,this._promiseResolved(e,n)},e.settle=function(t){return r.deprecated(".settle()",".reflect()"),new i(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t), +this._howMany=0,this._unwrap=!1,this._initialized=!1}function o(t,e){if((0|e)!==e||0>e)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new i(t),o=n.promise();return n.setHowMany(e),n.init(),o}var s=t("./util"),a=t("./errors").RangeError,c=t("./errors").AggregateError,l=s.isArray,u={};s.inherits(i,n),i.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var t=l(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},i.prototype.init=function(){this._initialized=!0,this._init()},i.prototype.setUnwrap=function(){this._unwrap=!0},i.prototype.howMany=function(){return this._howMany},i.prototype.setHowMany=function(t){this._howMany=t},i.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()?(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0):!1},i.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},i.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(u),this._checkOutcome())},i.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new c,e=this.length();e0?this._reject(t):this._cancel(),!0}return!1},i.prototype._fulfilled=function(){return this._totalResolved},i.prototype._rejected=function(){return this._values.length-this.length()},i.prototype._addRejected=function(t){this._values.push(t)},i.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},i.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},i.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new a(e)},i.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return o(t,e)},e.prototype.some=function(t){return o(this,t)},e._SomePromiseArray=i}},{"./errors":12,"./util":36}],32:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var n=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.isFulfilled=function(){return 0!==(33554432&this._bitField)},o=e.prototype.isRejected=function(){return 0!==(16777216&this._bitField)},s=e.prototype.isPending=function(){return 0===(50397184&this._bitField)},a=e.prototype.isResolved=function(){return 0!==(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!==(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536===(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!==(8454144&this._target()._bitField)},t.prototype.isPending=function(){return s.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return a.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),r.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,r){if(u(t)){if(t instanceof e)return t;var i=o(t);if(i===l){r&&r._pushContext();var c=e.reject(i.e);return r&&r._popContext(),c}if("function"==typeof i){if(s(t)){var c=new e(n);return t._then(c._fulfill,c._reject,void 0,c,null),c}return a(t,i,r)}}return t}function i(t){return t.then}function o(t){try{return i(t)}catch(e){return l.e=e,l}}function s(t){try{return p.call(t,"_promise0")}catch(e){return!1}}function a(t,r,i){function o(t){a&&(a._resolveCallback(t),a=null)}function s(t){a&&(a._rejectCallback(t,p,!0),a=null)}var a=new e(n),u=a;i&&i._pushContext(),a._captureStackTrace(),i&&i._popContext();var p=!0,h=c.tryCatch(r).call(t,o,s);return p=!1,a&&h===l&&(a._rejectCallback(h.e,!0,!0),a=null),u}var c=t("./util"),l=c.errorObj,u=c.isObject,p={}.hasOwnProperty;return r}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.handle=t}function o(t){return clearTimeout(this.handle),t}function s(t){throw clearTimeout(this.handle),t}var a=t("./util"),c=e.TimeoutError;i.prototype._resultCancelled=function(){clearTimeout(this.handle)};var l=function(t){return u(+this).thenReturn(t)},u=e.delay=function(t,o){var s,a;return void 0!==o?(s=e.resolve(o)._then(l,null,null,t,void 0),r.cancellation()&&o instanceof e&&s._setOnCancel(o)):(s=new e(n),a=setTimeout(function(){s._fulfill()},+t),r.cancellation()&&s._setOnCancel(new i(a)),s._captureStackTrace()),s._setAsyncGuaranteed(),s};e.prototype.delay=function(t){return u(t,this)};var p=function(t,e,n){var r;r="string"!=typeof e?e instanceof Error?e:new c("operation timed out"):new c(e),a.markAsOriginatingFromRejection(r),t._attachExtraTrace(r),t._reject(r),null!=n&&n.cancel()};e.prototype.timeout=function(t,e){t=+t;var n,a,c=new i(setTimeout(function(){n.isPending()&&p(n,e,a)},t));return r.cancellation()?(a=this.then(),n=a._then(o,s,void 0,c,void 0),n._setOnCancel(c)):n=this._then(o,s,void 0,c,void 0),n}}},{"./util":36}],35:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t){setTimeout(function(){throw t},0)}function c(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}function l(t,n){function i(){if(s>=l)return u._fulfill();var o=c(t[s++]);if(o instanceof e&&o._isDisposable()){try{o=r(o._getDisposer().tryDispose(n),t.promise)}catch(p){return a(p)}if(o instanceof e)return o._then(i,a,null,null,null)}i()}var s=0,l=t.length,u=new e(o);return i(),u}function u(t,e,n){this._data=t,this._promise=e,this._context=n}function p(t,e,n){this.constructor$(t,e,n)}function h(t){return u.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function f(t){this.length=t,this.promise=null,this[t-1]=null}var _=t("./util"),d=t("./errors").TypeError,v=t("./util").inherits,y=_.errorObj,m=_.tryCatch,g={};u.prototype.data=function(){return this._data},u.prototype.promise=function(){return this._promise},u.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():g},u.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=e!==g?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},u.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},v(p,u),p.prototype.doDispose=function(t,e){var n=this.data();return n.call(t,t,e)},f.prototype._resultCancelled=function(){for(var t=this.length,n=0;t>n;++n){var r=this[n];r instanceof e&&r.cancel()}},e.using=function(){var t=arguments.length;if(2>t)return n("you must pass at least 2 arguments to Promise.using");var i=arguments[t-1];if("function"!=typeof i)return n("expecting a function but got "+_.classString(i));var o,a=!0;2===t&&Array.isArray(arguments[0])?(o=arguments[0],t=o.length,a=!1):(o=arguments,t--);for(var c=new f(t),p=0;t>p;++p){var d=o[p];if(u.isDisposer(d)){var v=d;d=d.promise(),d._setDisposable(v)}else{var g=r(d);g instanceof e&&(d=g._then(h,null,null,{resources:c,index:p},void 0))}c[p]=d}for(var b=new Array(c.length),p=0;p0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new p(t,this,i());throw new d}}},{"./errors":12,"./util":36}],36:[function(t,e,n){"use strict";function r(){try{var t=P;return P=null,t.apply(this,arguments)}catch(e){return T.e=e,T}}function i(t){return P=t,r}function o(t){return null==t||t===!0||t===!1||"string"==typeof t||"number"==typeof t}function s(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return o(t)?new Error(v(t)):t}function c(t,e){var n,r=t.length,i=new Array(r+1);for(n=0;r>n;++n)i[n]=t[n];return i[n]=e,i}function l(t,e,n){if(!F.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var r=Object.getOwnPropertyDescriptor(t,e);return null!=r?null==r.get&&null==r.set?r.value:n:void 0}function u(t,e,n){if(o(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return F.defineProperty(t,e,r),t}function p(t){throw t}function h(t){try{if("function"==typeof t){var e=F.names(t.prototype),n=F.isES5&&e.length>1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=A.test(t+"")&&F.names(t).length>0;if(n||r||i)return!0}return!1}catch(o){return!1}}function f(t){function e(){}e.prototype=t;for(var n=8;n--;)new e;return t}function _(t){return D.test(t)}function d(t,e,n){for(var r=new Array(t),i=0;t>i;++i)r[i]=e+i+n;return r}function v(t){try{return t+""}catch(e){return"[no string representation]"}}function y(t){return null!==t&&"object"==typeof t&&"string"==typeof t.message&&"string"==typeof t.name}function m(t){try{u(t,"isOperational",!0)}catch(e){}}function g(t){return null==t?!1:t instanceof Error.__BluebirdErrorTypes__.OperationalError||t.isOperational===!0}function b(t){return y(t)&&F.propertyIsWritable(t,"stack")}function w(t){return{}.toString.call(t)}function C(t,e,n){for(var r=F.names(t),i=0;i10||t[0]>0}(),B.isNode&&B.toFastProperties(process);try{throw new Error}catch(U){B.lastLineError=U}e.exports=B},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise); \ No newline at end of file diff --git a/node_modules/bluebird/js/release/any.js b/node_modules/bluebird/js/release/any.js new file mode 100644 index 0000000..05a6228 --- /dev/null +++ b/node_modules/bluebird/js/release/any.js @@ -0,0 +1,21 @@ +"use strict"; +module.exports = function(Promise) { +var SomePromiseArray = Promise._SomePromiseArray; +function any(promises) { + var ret = new SomePromiseArray(promises); + var promise = ret.promise(); + ret.setHowMany(1); + ret.setUnwrap(); + ret.init(); + return promise; +} + +Promise.any = function (promises) { + return any(promises); +}; + +Promise.prototype.any = function () { + return any(this); +}; + +}; diff --git a/node_modules/bluebird/js/release/assert.js b/node_modules/bluebird/js/release/assert.js new file mode 100644 index 0000000..4518231 --- /dev/null +++ b/node_modules/bluebird/js/release/assert.js @@ -0,0 +1,55 @@ +"use strict"; +module.exports = (function(){ +var AssertionError = (function() { + function AssertionError(a) { + this.constructor$(a); + this.message = a; + this.name = "AssertionError"; + } + AssertionError.prototype = new Error(); + AssertionError.prototype.constructor = AssertionError; + AssertionError.prototype.constructor$ = Error; + return AssertionError; +})(); + +function getParams(args) { + var params = []; + for (var i = 0; i < args.length; ++i) params.push("arg" + i); + return params; +} + +function nativeAssert(callName, args, expect) { + try { + var params = getParams(args); + var constructorArgs = params; + constructorArgs.push("return " + + callName + "("+ params.join(",") + ");"); + var fn = Function.apply(null, constructorArgs); + return fn.apply(null, args); + } catch (e) { + if (!(e instanceof SyntaxError)) { + throw e; + } else { + return expect; + } + } +} + +return function assert(boolExpr, message) { + if (boolExpr === true) return; + + if (typeof boolExpr === "string" && + boolExpr.charAt(0) === "%") { + var nativeCallName = boolExpr; + var $_len = arguments.length;var args = new Array(Math.max($_len - 2, 0)); for(var $_i = 2; $_i < $_len; ++$_i) {args[$_i - 2] = arguments[$_i];}; + if (nativeAssert(nativeCallName, args, message) === message) return; + message = (nativeCallName + " !== " + message); + } + + var ret = new AssertionError(message); + if (Error.captureStackTrace) { + Error.captureStackTrace(ret, assert); + } + throw ret; +}; +})(); diff --git a/node_modules/bluebird/js/release/async.js b/node_modules/bluebird/js/release/async.js new file mode 100644 index 0000000..41f6655 --- /dev/null +++ b/node_modules/bluebird/js/release/async.js @@ -0,0 +1,161 @@ +"use strict"; +var firstLineError; +try {throw new Error(); } catch (e) {firstLineError = e;} +var schedule = require("./schedule"); +var Queue = require("./queue"); +var util = require("./util"); + +function Async() { + this._customScheduler = false; + this._isTickUsed = false; + this._lateQueue = new Queue(16); + this._normalQueue = new Queue(16); + this._haveDrainedQueues = false; + this._trampolineEnabled = true; + var self = this; + this.drainQueues = function () { + self._drainQueues(); + }; + this._schedule = schedule; +} + +Async.prototype.setScheduler = function(fn) { + var prev = this._schedule; + this._schedule = fn; + this._customScheduler = true; + return prev; +}; + +Async.prototype.hasCustomScheduler = function() { + return this._customScheduler; +}; + +Async.prototype.enableTrampoline = function() { + this._trampolineEnabled = true; +}; + +Async.prototype.disableTrampolineIfNecessary = function() { + if (util.hasDevTools) { + this._trampolineEnabled = false; + } +}; + +Async.prototype.haveItemsQueued = function () { + return this._isTickUsed || this._haveDrainedQueues; +}; + + +Async.prototype.fatalError = function(e, isNode) { + if (isNode) { + process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) + + "\n"); + process.exit(2); + } else { + this.throwLater(e); + } +}; + +Async.prototype.throwLater = function(fn, arg) { + if (arguments.length === 1) { + arg = fn; + fn = function () { throw arg; }; + } + if (typeof setTimeout !== "undefined") { + setTimeout(function() { + fn(arg); + }, 0); + } else try { + this._schedule(function() { + fn(arg); + }); + } catch (e) { + throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } +}; + +function AsyncInvokeLater(fn, receiver, arg) { + this._lateQueue.push(fn, receiver, arg); + this._queueTick(); +} + +function AsyncInvoke(fn, receiver, arg) { + this._normalQueue.push(fn, receiver, arg); + this._queueTick(); +} + +function AsyncSettlePromises(promise) { + this._normalQueue._pushOne(promise); + this._queueTick(); +} + +if (!util.hasDevTools) { + Async.prototype.invokeLater = AsyncInvokeLater; + Async.prototype.invoke = AsyncInvoke; + Async.prototype.settlePromises = AsyncSettlePromises; +} else { + Async.prototype.invokeLater = function (fn, receiver, arg) { + if (this._trampolineEnabled) { + AsyncInvokeLater.call(this, fn, receiver, arg); + } else { + this._schedule(function() { + setTimeout(function() { + fn.call(receiver, arg); + }, 100); + }); + } + }; + + Async.prototype.invoke = function (fn, receiver, arg) { + if (this._trampolineEnabled) { + AsyncInvoke.call(this, fn, receiver, arg); + } else { + this._schedule(function() { + fn.call(receiver, arg); + }); + } + }; + + Async.prototype.settlePromises = function(promise) { + if (this._trampolineEnabled) { + AsyncSettlePromises.call(this, promise); + } else { + this._schedule(function() { + promise._settlePromises(); + }); + } + }; +} + +Async.prototype._drainQueue = function(queue) { + while (queue.length() > 0) { + var fn = queue.shift(); + if (typeof fn !== "function") { + fn._settlePromises(); + continue; + } + var receiver = queue.shift(); + var arg = queue.shift(); + fn.call(receiver, arg); + } +}; + +Async.prototype._drainQueues = function () { + this._drainQueue(this._normalQueue); + this._reset(); + this._haveDrainedQueues = true; + this._drainQueue(this._lateQueue); +}; + +Async.prototype._queueTick = function () { + if (!this._isTickUsed) { + this._isTickUsed = true; + this._schedule(this.drainQueues); + } +}; + +Async.prototype._reset = function () { + this._isTickUsed = false; +}; + +module.exports = Async; +module.exports.firstLineError = firstLineError; diff --git a/node_modules/bluebird/js/release/bind.js b/node_modules/bluebird/js/release/bind.js new file mode 100644 index 0000000..fc3379d --- /dev/null +++ b/node_modules/bluebird/js/release/bind.js @@ -0,0 +1,67 @@ +"use strict"; +module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) { +var calledBind = false; +var rejectThis = function(_, e) { + this._reject(e); +}; + +var targetRejected = function(e, context) { + context.promiseRejectionQueued = true; + context.bindingPromise._then(rejectThis, rejectThis, null, this, e); +}; + +var bindingResolved = function(thisArg, context) { + if (((this._bitField & 50397184) === 0)) { + this._resolveCallback(context.target); + } +}; + +var bindingRejected = function(e, context) { + if (!context.promiseRejectionQueued) this._reject(e); +}; + +Promise.prototype.bind = function (thisArg) { + if (!calledBind) { + calledBind = true; + Promise.prototype._propagateFrom = debug.propagateFromFunction(); + Promise.prototype._boundValue = debug.boundValueFunction(); + } + var maybePromise = tryConvertToPromise(thisArg); + var ret = new Promise(INTERNAL); + ret._propagateFrom(this, 1); + var target = this._target(); + ret._setBoundTo(maybePromise); + if (maybePromise instanceof Promise) { + var context = { + promiseRejectionQueued: false, + promise: ret, + target: target, + bindingPromise: maybePromise + }; + target._then(INTERNAL, targetRejected, undefined, ret, context); + maybePromise._then( + bindingResolved, bindingRejected, undefined, ret, context); + ret._setOnCancel(maybePromise); + } else { + ret._resolveCallback(target); + } + return ret; +}; + +Promise.prototype._setBoundTo = function (obj) { + if (obj !== undefined) { + this._bitField = this._bitField | 2097152; + this._boundTo = obj; + } else { + this._bitField = this._bitField & (~2097152); + } +}; + +Promise.prototype._isBound = function () { + return (this._bitField & 2097152) === 2097152; +}; + +Promise.bind = function (thisArg, value) { + return Promise.resolve(value).bind(thisArg); +}; +}; diff --git a/node_modules/bluebird/js/release/bluebird.js b/node_modules/bluebird/js/release/bluebird.js new file mode 100644 index 0000000..1c36cf3 --- /dev/null +++ b/node_modules/bluebird/js/release/bluebird.js @@ -0,0 +1,11 @@ +"use strict"; +var old; +if (typeof Promise !== "undefined") old = Promise; +function noConflict() { + try { if (Promise === bluebird) Promise = old; } + catch (e) {} + return bluebird; +} +var bluebird = require("./promise")(); +bluebird.noConflict = noConflict; +module.exports = bluebird; diff --git a/node_modules/bluebird/js/release/call_get.js b/node_modules/bluebird/js/release/call_get.js new file mode 100644 index 0000000..0ed7714 --- /dev/null +++ b/node_modules/bluebird/js/release/call_get.js @@ -0,0 +1,123 @@ +"use strict"; +var cr = Object.create; +if (cr) { + var callerCache = cr(null); + var getterCache = cr(null); + callerCache[" size"] = getterCache[" size"] = 0; +} + +module.exports = function(Promise) { +var util = require("./util"); +var canEvaluate = util.canEvaluate; +var isIdentifier = util.isIdentifier; + +var getMethodCaller; +var getGetter; +if (!false) { +var makeMethodCaller = function (methodName) { + return new Function("ensureMethod", " \n\ + return function(obj) { \n\ + 'use strict' \n\ + var len = this.length; \n\ + ensureMethod(obj, 'methodName'); \n\ + switch(len) { \n\ + case 1: return obj.methodName(this[0]); \n\ + case 2: return obj.methodName(this[0], this[1]); \n\ + case 3: return obj.methodName(this[0], this[1], this[2]); \n\ + case 0: return obj.methodName(); \n\ + default: \n\ + return obj.methodName.apply(obj, this); \n\ + } \n\ + }; \n\ + ".replace(/methodName/g, methodName))(ensureMethod); +}; + +var makeGetter = function (propertyName) { + return new Function("obj", " \n\ + 'use strict'; \n\ + return obj.propertyName; \n\ + ".replace("propertyName", propertyName)); +}; + +var getCompiled = function(name, compiler, cache) { + var ret = cache[name]; + if (typeof ret !== "function") { + if (!isIdentifier(name)) { + return null; + } + ret = compiler(name); + cache[name] = ret; + cache[" size"]++; + if (cache[" size"] > 512) { + var keys = Object.keys(cache); + for (var i = 0; i < 256; ++i) delete cache[keys[i]]; + cache[" size"] = keys.length - 256; + } + } + return ret; +}; + +getMethodCaller = function(name) { + return getCompiled(name, makeMethodCaller, callerCache); +}; + +getGetter = function(name) { + return getCompiled(name, makeGetter, getterCache); +}; +} + +function ensureMethod(obj, methodName) { + var fn; + if (obj != null) fn = obj[methodName]; + if (typeof fn !== "function") { + var message = "Object " + util.classString(obj) + " has no method '" + + util.toString(methodName) + "'"; + throw new Promise.TypeError(message); + } + return fn; +} + +function caller(obj) { + var methodName = this.pop(); + var fn = ensureMethod(obj, methodName); + return fn.apply(obj, this); +} +Promise.prototype.call = function (methodName) { + var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];}; + if (!false) { + if (canEvaluate) { + var maybeCaller = getMethodCaller(methodName); + if (maybeCaller !== null) { + return this._then( + maybeCaller, undefined, undefined, args, undefined); + } + } + } + args.push(methodName); + return this._then(caller, undefined, undefined, args, undefined); +}; + +function namedGetter(obj) { + return obj[this]; +} +function indexedGetter(obj) { + var index = +this; + if (index < 0) index = Math.max(0, index + obj.length); + return obj[index]; +} +Promise.prototype.get = function (propertyName) { + var isIndex = (typeof propertyName === "number"); + var getter; + if (!isIndex) { + if (canEvaluate) { + var maybeGetter = getGetter(propertyName); + getter = maybeGetter !== null ? maybeGetter : namedGetter; + } else { + getter = namedGetter; + } + } else { + getter = indexedGetter; + } + return this._then(getter, undefined, undefined, propertyName, undefined); +}; +}; diff --git a/node_modules/bluebird/js/release/cancel.js b/node_modules/bluebird/js/release/cancel.js new file mode 100644 index 0000000..7a12415 --- /dev/null +++ b/node_modules/bluebird/js/release/cancel.js @@ -0,0 +1,129 @@ +"use strict"; +module.exports = function(Promise, PromiseArray, apiRejection, debug) { +var util = require("./util"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var async = Promise._async; + +Promise.prototype["break"] = Promise.prototype.cancel = function() { + if (!debug.cancellation()) return this._warn("cancellation is disabled"); + + var promise = this; + var child = promise; + while (promise._isCancellable()) { + if (!promise._cancelBy(child)) { + if (child._isFollowing()) { + child._followee().cancel(); + } else { + child._cancelBranched(); + } + break; + } + + var parent = promise._cancellationParent; + if (parent == null || !parent._isCancellable()) { + if (promise._isFollowing()) { + promise._followee().cancel(); + } else { + promise._cancelBranched(); + } + break; + } else { + if (promise._isFollowing()) promise._followee().cancel(); + promise._setWillBeCancelled(); + child = promise; + promise = parent; + } + } +}; + +Promise.prototype._branchHasCancelled = function() { + this._branchesRemainingToCancel--; +}; + +Promise.prototype._enoughBranchesHaveCancelled = function() { + return this._branchesRemainingToCancel === undefined || + this._branchesRemainingToCancel <= 0; +}; + +Promise.prototype._cancelBy = function(canceller) { + if (canceller === this) { + this._branchesRemainingToCancel = 0; + this._invokeOnCancel(); + return true; + } else { + this._branchHasCancelled(); + if (this._enoughBranchesHaveCancelled()) { + this._invokeOnCancel(); + return true; + } + } + return false; +}; + +Promise.prototype._cancelBranched = function() { + if (this._enoughBranchesHaveCancelled()) { + this._cancel(); + } +}; + +Promise.prototype._cancel = function() { + if (!this._isCancellable()) return; + this._setCancelled(); + async.invoke(this._cancelPromises, this, undefined); +}; + +Promise.prototype._cancelPromises = function() { + if (this._length() > 0) this._settlePromises(); +}; + +Promise.prototype._unsetOnCancel = function() { + this._onCancelField = undefined; +}; + +Promise.prototype._isCancellable = function() { + return this.isPending() && !this._isCancelled(); +}; + +Promise.prototype.isCancellable = function() { + return this.isPending() && !this.isCancelled(); +}; + +Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) { + if (util.isArray(onCancelCallback)) { + for (var i = 0; i < onCancelCallback.length; ++i) { + this._doInvokeOnCancel(onCancelCallback[i], internalOnly); + } + } else if (onCancelCallback !== undefined) { + if (typeof onCancelCallback === "function") { + if (!internalOnly) { + var e = tryCatch(onCancelCallback).call(this._boundValue()); + if (e === errorObj) { + this._attachExtraTrace(e.e); + async.throwLater(e.e); + } + } + } else { + onCancelCallback._resultCancelled(this); + } + } +}; + +Promise.prototype._invokeOnCancel = function() { + var onCancelCallback = this._onCancel(); + this._unsetOnCancel(); + async.invoke(this._doInvokeOnCancel, this, onCancelCallback); +}; + +Promise.prototype._invokeInternalOnCancel = function() { + if (this._isCancellable()) { + this._doInvokeOnCancel(this._onCancel(), true); + this._unsetOnCancel(); + } +}; + +Promise.prototype._resultCancelled = function() { + this.cancel(); +}; + +}; diff --git a/node_modules/bluebird/js/release/catch_filter.js b/node_modules/bluebird/js/release/catch_filter.js new file mode 100644 index 0000000..0f24ce2 --- /dev/null +++ b/node_modules/bluebird/js/release/catch_filter.js @@ -0,0 +1,42 @@ +"use strict"; +module.exports = function(NEXT_FILTER) { +var util = require("./util"); +var getKeys = require("./es5").keys; +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; + +function catchFilter(instances, cb, promise) { + return function(e) { + var boundTo = promise._boundValue(); + predicateLoop: for (var i = 0; i < instances.length; ++i) { + var item = instances[i]; + + if (item === Error || + (item != null && item.prototype instanceof Error)) { + if (e instanceof item) { + return tryCatch(cb).call(boundTo, e); + } + } else if (typeof item === "function") { + var matchesPredicate = tryCatch(item).call(boundTo, e); + if (matchesPredicate === errorObj) { + return matchesPredicate; + } else if (matchesPredicate) { + return tryCatch(cb).call(boundTo, e); + } + } else if (util.isObject(e)) { + var keys = getKeys(item); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + if (item[key] != e[key]) { + continue predicateLoop; + } + } + return tryCatch(cb).call(boundTo, e); + } + } + return NEXT_FILTER; + }; +} + +return catchFilter; +}; diff --git a/node_modules/bluebird/js/release/context.js b/node_modules/bluebird/js/release/context.js new file mode 100644 index 0000000..c307414 --- /dev/null +++ b/node_modules/bluebird/js/release/context.js @@ -0,0 +1,69 @@ +"use strict"; +module.exports = function(Promise) { +var longStackTraces = false; +var contextStack = []; + +Promise.prototype._promiseCreated = function() {}; +Promise.prototype._pushContext = function() {}; +Promise.prototype._popContext = function() {return null;}; +Promise._peekContext = Promise.prototype._peekContext = function() {}; + +function Context() { + this._trace = new Context.CapturedTrace(peekContext()); +} +Context.prototype._pushContext = function () { + if (this._trace !== undefined) { + this._trace._promiseCreated = null; + contextStack.push(this._trace); + } +}; + +Context.prototype._popContext = function () { + if (this._trace !== undefined) { + var trace = contextStack.pop(); + var ret = trace._promiseCreated; + trace._promiseCreated = null; + return ret; + } + return null; +}; + +function createContext() { + if (longStackTraces) return new Context(); +} + +function peekContext() { + var lastIndex = contextStack.length - 1; + if (lastIndex >= 0) { + return contextStack[lastIndex]; + } + return undefined; +} +Context.CapturedTrace = null; +Context.create = createContext; +Context.deactivateLongStackTraces = function() {}; +Context.activateLongStackTraces = function() { + var Promise_pushContext = Promise.prototype._pushContext; + var Promise_popContext = Promise.prototype._popContext; + var Promise_PeekContext = Promise._peekContext; + var Promise_peekContext = Promise.prototype._peekContext; + var Promise_promiseCreated = Promise.prototype._promiseCreated; + Context.deactivateLongStackTraces = function() { + Promise.prototype._pushContext = Promise_pushContext; + Promise.prototype._popContext = Promise_popContext; + Promise._peekContext = Promise_PeekContext; + Promise.prototype._peekContext = Promise_peekContext; + Promise.prototype._promiseCreated = Promise_promiseCreated; + longStackTraces = false; + }; + longStackTraces = true; + Promise.prototype._pushContext = Context.prototype._pushContext; + Promise.prototype._popContext = Context.prototype._popContext; + Promise._peekContext = Promise.prototype._peekContext = peekContext; + Promise.prototype._promiseCreated = function() { + var ctx = this._peekContext(); + if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this; + }; +}; +return Context; +}; diff --git a/node_modules/bluebird/js/release/debuggability.js b/node_modules/bluebird/js/release/debuggability.js new file mode 100644 index 0000000..bf0587c --- /dev/null +++ b/node_modules/bluebird/js/release/debuggability.js @@ -0,0 +1,916 @@ +"use strict"; +module.exports = function(Promise, Context) { +var getDomain = Promise._getDomain; +var async = Promise._async; +var Warning = require("./errors").Warning; +var util = require("./util"); +var canAttachTrace = util.canAttachTrace; +var unhandledRejectionHandled; +var possiblyUnhandledRejection; +var bluebirdFramePattern = + /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/; +var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/; +var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/; +var stackFramePattern = null; +var formatStack = null; +var indentStackFrames = false; +var printWarning; +var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 && + (false || + util.env("BLUEBIRD_DEBUG") || + util.env("NODE_ENV") === "development")); + +var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 && + (debugging || util.env("BLUEBIRD_WARNINGS"))); + +var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && + (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES"))); + +var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && + (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN")); + +Promise.prototype.suppressUnhandledRejections = function() { + var target = this._target(); + target._bitField = ((target._bitField & (~1048576)) | + 524288); +}; + +Promise.prototype._ensurePossibleRejectionHandled = function () { + if ((this._bitField & 524288) !== 0) return; + this._setRejectionIsUnhandled(); + async.invokeLater(this._notifyUnhandledRejection, this, undefined); +}; + +Promise.prototype._notifyUnhandledRejectionIsHandled = function () { + fireRejectionEvent("rejectionHandled", + unhandledRejectionHandled, undefined, this); +}; + +Promise.prototype._setReturnedNonUndefined = function() { + this._bitField = this._bitField | 268435456; +}; + +Promise.prototype._returnedNonUndefined = function() { + return (this._bitField & 268435456) !== 0; +}; + +Promise.prototype._notifyUnhandledRejection = function () { + if (this._isRejectionUnhandled()) { + var reason = this._settledValue(); + this._setUnhandledRejectionIsNotified(); + fireRejectionEvent("unhandledRejection", + possiblyUnhandledRejection, reason, this); + } +}; + +Promise.prototype._setUnhandledRejectionIsNotified = function () { + this._bitField = this._bitField | 262144; +}; + +Promise.prototype._unsetUnhandledRejectionIsNotified = function () { + this._bitField = this._bitField & (~262144); +}; + +Promise.prototype._isUnhandledRejectionNotified = function () { + return (this._bitField & 262144) > 0; +}; + +Promise.prototype._setRejectionIsUnhandled = function () { + this._bitField = this._bitField | 1048576; +}; + +Promise.prototype._unsetRejectionIsUnhandled = function () { + this._bitField = this._bitField & (~1048576); + if (this._isUnhandledRejectionNotified()) { + this._unsetUnhandledRejectionIsNotified(); + this._notifyUnhandledRejectionIsHandled(); + } +}; + +Promise.prototype._isRejectionUnhandled = function () { + return (this._bitField & 1048576) > 0; +}; + +Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) { + return warn(message, shouldUseOwnTrace, promise || this); +}; + +Promise.onPossiblyUnhandledRejection = function (fn) { + var domain = getDomain(); + possiblyUnhandledRejection = + typeof fn === "function" ? (domain === null ? + fn : util.domainBind(domain, fn)) + : undefined; +}; + +Promise.onUnhandledRejectionHandled = function (fn) { + var domain = getDomain(); + unhandledRejectionHandled = + typeof fn === "function" ? (domain === null ? + fn : util.domainBind(domain, fn)) + : undefined; +}; + +var disableLongStackTraces = function() {}; +Promise.longStackTraces = function () { + if (async.haveItemsQueued() && !config.longStackTraces) { + throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + if (!config.longStackTraces && longStackTracesIsSupported()) { + var Promise_captureStackTrace = Promise.prototype._captureStackTrace; + var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace; + config.longStackTraces = true; + disableLongStackTraces = function() { + if (async.haveItemsQueued() && !config.longStackTraces) { + throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + Promise.prototype._captureStackTrace = Promise_captureStackTrace; + Promise.prototype._attachExtraTrace = Promise_attachExtraTrace; + Context.deactivateLongStackTraces(); + async.enableTrampoline(); + config.longStackTraces = false; + }; + Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace; + Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; + Context.activateLongStackTraces(); + async.disableTrampolineIfNecessary(); + } +}; + +Promise.hasLongStackTraces = function () { + return config.longStackTraces && longStackTracesIsSupported(); +}; + +var fireDomEvent = (function() { + try { + if (typeof CustomEvent === "function") { + var event = new CustomEvent("CustomEvent"); + util.global.dispatchEvent(event); + return function(name, event) { + var domEvent = new CustomEvent(name.toLowerCase(), { + detail: event, + cancelable: true + }); + return !util.global.dispatchEvent(domEvent); + }; + } else if (typeof Event === "function") { + var event = new Event("CustomEvent"); + util.global.dispatchEvent(event); + return function(name, event) { + var domEvent = new Event(name.toLowerCase(), { + cancelable: true + }); + domEvent.detail = event; + return !util.global.dispatchEvent(domEvent); + }; + } else { + var event = document.createEvent("CustomEvent"); + event.initCustomEvent("testingtheevent", false, true, {}); + util.global.dispatchEvent(event); + return function(name, event) { + var domEvent = document.createEvent("CustomEvent"); + domEvent.initCustomEvent(name.toLowerCase(), false, true, + event); + return !util.global.dispatchEvent(domEvent); + }; + } + } catch (e) {} + return function() { + return false; + }; +})(); + +var fireGlobalEvent = (function() { + if (util.isNode) { + return function() { + return process.emit.apply(process, arguments); + }; + } else { + if (!util.global) { + return function() { + return false; + }; + } + return function(name) { + var methodName = "on" + name.toLowerCase(); + var method = util.global[methodName]; + if (!method) return false; + method.apply(util.global, [].slice.call(arguments, 1)); + return true; + }; + } +})(); + +function generatePromiseLifecycleEventObject(name, promise) { + return {promise: promise}; +} + +var eventToObjectGenerator = { + promiseCreated: generatePromiseLifecycleEventObject, + promiseFulfilled: generatePromiseLifecycleEventObject, + promiseRejected: generatePromiseLifecycleEventObject, + promiseResolved: generatePromiseLifecycleEventObject, + promiseCancelled: generatePromiseLifecycleEventObject, + promiseChained: function(name, promise, child) { + return {promise: promise, child: child}; + }, + warning: function(name, warning) { + return {warning: warning}; + }, + unhandledRejection: function (name, reason, promise) { + return {reason: reason, promise: promise}; + }, + rejectionHandled: generatePromiseLifecycleEventObject +}; + +var activeFireEvent = function (name) { + var globalEventFired = false; + try { + globalEventFired = fireGlobalEvent.apply(null, arguments); + } catch (e) { + async.throwLater(e); + globalEventFired = true; + } + + var domEventFired = false; + try { + domEventFired = fireDomEvent(name, + eventToObjectGenerator[name].apply(null, arguments)); + } catch (e) { + async.throwLater(e); + domEventFired = true; + } + + return domEventFired || globalEventFired; +}; + +Promise.config = function(opts) { + opts = Object(opts); + if ("longStackTraces" in opts) { + if (opts.longStackTraces) { + Promise.longStackTraces(); + } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) { + disableLongStackTraces(); + } + } + if ("warnings" in opts) { + var warningsOption = opts.warnings; + config.warnings = !!warningsOption; + wForgottenReturn = config.warnings; + + if (util.isObject(warningsOption)) { + if ("wForgottenReturn" in warningsOption) { + wForgottenReturn = !!warningsOption.wForgottenReturn; + } + } + } + if ("cancellation" in opts && opts.cancellation && !config.cancellation) { + if (async.haveItemsQueued()) { + throw new Error( + "cannot enable cancellation after promises are in use"); + } + Promise.prototype._clearCancellationData = + cancellationClearCancellationData; + Promise.prototype._propagateFrom = cancellationPropagateFrom; + Promise.prototype._onCancel = cancellationOnCancel; + Promise.prototype._setOnCancel = cancellationSetOnCancel; + Promise.prototype._attachCancellationCallback = + cancellationAttachCancellationCallback; + Promise.prototype._execute = cancellationExecute; + propagateFromFunction = cancellationPropagateFrom; + config.cancellation = true; + } + if ("monitoring" in opts) { + if (opts.monitoring && !config.monitoring) { + config.monitoring = true; + Promise.prototype._fireEvent = activeFireEvent; + } else if (!opts.monitoring && config.monitoring) { + config.monitoring = false; + Promise.prototype._fireEvent = defaultFireEvent; + } + } + return Promise; +}; + +function defaultFireEvent() { return false; } + +Promise.prototype._fireEvent = defaultFireEvent; +Promise.prototype._execute = function(executor, resolve, reject) { + try { + executor(resolve, reject); + } catch (e) { + return e; + } +}; +Promise.prototype._onCancel = function () {}; +Promise.prototype._setOnCancel = function (handler) { ; }; +Promise.prototype._attachCancellationCallback = function(onCancel) { + ; +}; +Promise.prototype._captureStackTrace = function () {}; +Promise.prototype._attachExtraTrace = function () {}; +Promise.prototype._clearCancellationData = function() {}; +Promise.prototype._propagateFrom = function (parent, flags) { + ; + ; +}; + +function cancellationExecute(executor, resolve, reject) { + var promise = this; + try { + executor(resolve, reject, function(onCancel) { + if (typeof onCancel !== "function") { + throw new TypeError("onCancel must be a function, got: " + + util.toString(onCancel)); + } + promise._attachCancellationCallback(onCancel); + }); + } catch (e) { + return e; + } +} + +function cancellationAttachCancellationCallback(onCancel) { + if (!this._isCancellable()) return this; + + var previousOnCancel = this._onCancel(); + if (previousOnCancel !== undefined) { + if (util.isArray(previousOnCancel)) { + previousOnCancel.push(onCancel); + } else { + this._setOnCancel([previousOnCancel, onCancel]); + } + } else { + this._setOnCancel(onCancel); + } +} + +function cancellationOnCancel() { + return this._onCancelField; +} + +function cancellationSetOnCancel(onCancel) { + this._onCancelField = onCancel; +} + +function cancellationClearCancellationData() { + this._cancellationParent = undefined; + this._onCancelField = undefined; +} + +function cancellationPropagateFrom(parent, flags) { + if ((flags & 1) !== 0) { + this._cancellationParent = parent; + var branchesRemainingToCancel = parent._branchesRemainingToCancel; + if (branchesRemainingToCancel === undefined) { + branchesRemainingToCancel = 0; + } + parent._branchesRemainingToCancel = branchesRemainingToCancel + 1; + } + if ((flags & 2) !== 0 && parent._isBound()) { + this._setBoundTo(parent._boundTo); + } +} + +function bindingPropagateFrom(parent, flags) { + if ((flags & 2) !== 0 && parent._isBound()) { + this._setBoundTo(parent._boundTo); + } +} +var propagateFromFunction = bindingPropagateFrom; + +function boundValueFunction() { + var ret = this._boundTo; + if (ret !== undefined) { + if (ret instanceof Promise) { + if (ret.isFulfilled()) { + return ret.value(); + } else { + return undefined; + } + } + } + return ret; +} + +function longStackTracesCaptureStackTrace() { + this._trace = new CapturedTrace(this._peekContext()); +} + +function longStackTracesAttachExtraTrace(error, ignoreSelf) { + if (canAttachTrace(error)) { + var trace = this._trace; + if (trace !== undefined) { + if (ignoreSelf) trace = trace._parent; + } + if (trace !== undefined) { + trace.attachExtraTrace(error); + } else if (!error.__stackCleaned__) { + var parsed = parseStackAndMessage(error); + util.notEnumerableProp(error, "stack", + parsed.message + "\n" + parsed.stack.join("\n")); + util.notEnumerableProp(error, "__stackCleaned__", true); + } + } +} + +function checkForgottenReturns(returnValue, promiseCreated, name, promise, + parent) { + if (returnValue === undefined && promiseCreated !== null && + wForgottenReturn) { + if (parent !== undefined && parent._returnedNonUndefined()) return; + if ((promise._bitField & 65535) === 0) return; + + if (name) name = name + " "; + var handlerLine = ""; + var creatorLine = ""; + if (promiseCreated._trace) { + var traceLines = promiseCreated._trace.stack.split("\n"); + var stack = cleanStack(traceLines); + for (var i = stack.length - 1; i >= 0; --i) { + var line = stack[i]; + if (!nodeFramePattern.test(line)) { + var lineMatches = line.match(parseLinePattern); + if (lineMatches) { + handlerLine = "at " + lineMatches[1] + + ":" + lineMatches[2] + ":" + lineMatches[3] + " "; + } + break; + } + } + + if (stack.length > 0) { + var firstUserLine = stack[0]; + for (var i = 0; i < traceLines.length; ++i) { + + if (traceLines[i] === firstUserLine) { + if (i > 0) { + creatorLine = "\n" + traceLines[i - 1]; + } + break; + } + } + + } + } + var msg = "a promise was created in a " + name + + "handler " + handlerLine + "but was not returned from it, " + + "see http://goo.gl/rRqMUw" + + creatorLine; + promise._warn(msg, true, promiseCreated); + } +} + +function deprecated(name, replacement) { + var message = name + + " is deprecated and will be removed in a future version."; + if (replacement) message += " Use " + replacement + " instead."; + return warn(message); +} + +function warn(message, shouldUseOwnTrace, promise) { + if (!config.warnings) return; + var warning = new Warning(message); + var ctx; + if (shouldUseOwnTrace) { + promise._attachExtraTrace(warning); + } else if (config.longStackTraces && (ctx = Promise._peekContext())) { + ctx.attachExtraTrace(warning); + } else { + var parsed = parseStackAndMessage(warning); + warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); + } + + if (!activeFireEvent("warning", warning)) { + formatAndLogError(warning, "", true); + } +} + +function reconstructStack(message, stacks) { + for (var i = 0; i < stacks.length - 1; ++i) { + stacks[i].push("From previous event:"); + stacks[i] = stacks[i].join("\n"); + } + if (i < stacks.length) { + stacks[i] = stacks[i].join("\n"); + } + return message + "\n" + stacks.join("\n"); +} + +function removeDuplicateOrEmptyJumps(stacks) { + for (var i = 0; i < stacks.length; ++i) { + if (stacks[i].length === 0 || + ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) { + stacks.splice(i, 1); + i--; + } + } +} + +function removeCommonRoots(stacks) { + var current = stacks[0]; + for (var i = 1; i < stacks.length; ++i) { + var prev = stacks[i]; + var currentLastIndex = current.length - 1; + var currentLastLine = current[currentLastIndex]; + var commonRootMeetPoint = -1; + + for (var j = prev.length - 1; j >= 0; --j) { + if (prev[j] === currentLastLine) { + commonRootMeetPoint = j; + break; + } + } + + for (var j = commonRootMeetPoint; j >= 0; --j) { + var line = prev[j]; + if (current[currentLastIndex] === line) { + current.pop(); + currentLastIndex--; + } else { + break; + } + } + current = prev; + } +} + +function cleanStack(stack) { + var ret = []; + for (var i = 0; i < stack.length; ++i) { + var line = stack[i]; + var isTraceLine = " (No stack trace)" === line || + stackFramePattern.test(line); + var isInternalFrame = isTraceLine && shouldIgnore(line); + if (isTraceLine && !isInternalFrame) { + if (indentStackFrames && line.charAt(0) !== " ") { + line = " " + line; + } + ret.push(line); + } + } + return ret; +} + +function stackFramesAsArray(error) { + var stack = error.stack.replace(/\s+$/g, "").split("\n"); + for (var i = 0; i < stack.length; ++i) { + var line = stack[i]; + if (" (No stack trace)" === line || stackFramePattern.test(line)) { + break; + } + } + if (i > 0 && error.name != "SyntaxError") { + stack = stack.slice(i); + } + return stack; +} + +function parseStackAndMessage(error) { + var stack = error.stack; + var message = error.toString(); + stack = typeof stack === "string" && stack.length > 0 + ? stackFramesAsArray(error) : [" (No stack trace)"]; + return { + message: message, + stack: error.name == "SyntaxError" ? stack : cleanStack(stack) + }; +} + +function formatAndLogError(error, title, isSoft) { + if (typeof console !== "undefined") { + var message; + if (util.isObject(error)) { + var stack = error.stack; + message = title + formatStack(stack, error); + } else { + message = title + String(error); + } + if (typeof printWarning === "function") { + printWarning(message, isSoft); + } else if (typeof console.log === "function" || + typeof console.log === "object") { + console.log(message); + } + } +} + +function fireRejectionEvent(name, localHandler, reason, promise) { + var localEventFired = false; + try { + if (typeof localHandler === "function") { + localEventFired = true; + if (name === "rejectionHandled") { + localHandler(promise); + } else { + localHandler(reason, promise); + } + } + } catch (e) { + async.throwLater(e); + } + + if (name === "unhandledRejection") { + if (!activeFireEvent(name, reason, promise) && !localEventFired) { + formatAndLogError(reason, "Unhandled rejection "); + } + } else { + activeFireEvent(name, promise); + } +} + +function formatNonError(obj) { + var str; + if (typeof obj === "function") { + str = "[function " + + (obj.name || "anonymous") + + "]"; + } else { + str = obj && typeof obj.toString === "function" + ? obj.toString() : util.toString(obj); + var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; + if (ruselessToString.test(str)) { + try { + var newStr = JSON.stringify(obj); + str = newStr; + } + catch(e) { + + } + } + if (str.length === 0) { + str = "(empty array)"; + } + } + return ("(<" + snip(str) + ">, no stack trace)"); +} + +function snip(str) { + var maxChars = 41; + if (str.length < maxChars) { + return str; + } + return str.substr(0, maxChars - 3) + "..."; +} + +function longStackTracesIsSupported() { + return typeof captureStackTrace === "function"; +} + +var shouldIgnore = function() { return false; }; +var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; +function parseLineInfo(line) { + var matches = line.match(parseLineInfoRegex); + if (matches) { + return { + fileName: matches[1], + line: parseInt(matches[2], 10) + }; + } +} + +function setBounds(firstLineError, lastLineError) { + if (!longStackTracesIsSupported()) return; + var firstStackLines = firstLineError.stack.split("\n"); + var lastStackLines = lastLineError.stack.split("\n"); + var firstIndex = -1; + var lastIndex = -1; + var firstFileName; + var lastFileName; + for (var i = 0; i < firstStackLines.length; ++i) { + var result = parseLineInfo(firstStackLines[i]); + if (result) { + firstFileName = result.fileName; + firstIndex = result.line; + break; + } + } + for (var i = 0; i < lastStackLines.length; ++i) { + var result = parseLineInfo(lastStackLines[i]); + if (result) { + lastFileName = result.fileName; + lastIndex = result.line; + break; + } + } + if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || + firstFileName !== lastFileName || firstIndex >= lastIndex) { + return; + } + + shouldIgnore = function(line) { + if (bluebirdFramePattern.test(line)) return true; + var info = parseLineInfo(line); + if (info) { + if (info.fileName === firstFileName && + (firstIndex <= info.line && info.line <= lastIndex)) { + return true; + } + } + return false; + }; +} + +function CapturedTrace(parent) { + this._parent = parent; + this._promisesCreated = 0; + var length = this._length = 1 + (parent === undefined ? 0 : parent._length); + captureStackTrace(this, CapturedTrace); + if (length > 32) this.uncycle(); +} +util.inherits(CapturedTrace, Error); +Context.CapturedTrace = CapturedTrace; + +CapturedTrace.prototype.uncycle = function() { + var length = this._length; + if (length < 2) return; + var nodes = []; + var stackToIndex = {}; + + for (var i = 0, node = this; node !== undefined; ++i) { + nodes.push(node); + node = node._parent; + } + length = this._length = i; + for (var i = length - 1; i >= 0; --i) { + var stack = nodes[i].stack; + if (stackToIndex[stack] === undefined) { + stackToIndex[stack] = i; + } + } + for (var i = 0; i < length; ++i) { + var currentStack = nodes[i].stack; + var index = stackToIndex[currentStack]; + if (index !== undefined && index !== i) { + if (index > 0) { + nodes[index - 1]._parent = undefined; + nodes[index - 1]._length = 1; + } + nodes[i]._parent = undefined; + nodes[i]._length = 1; + var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; + + if (index < length - 1) { + cycleEdgeNode._parent = nodes[index + 1]; + cycleEdgeNode._parent.uncycle(); + cycleEdgeNode._length = + cycleEdgeNode._parent._length + 1; + } else { + cycleEdgeNode._parent = undefined; + cycleEdgeNode._length = 1; + } + var currentChildLength = cycleEdgeNode._length + 1; + for (var j = i - 2; j >= 0; --j) { + nodes[j]._length = currentChildLength; + currentChildLength++; + } + return; + } + } +}; + +CapturedTrace.prototype.attachExtraTrace = function(error) { + if (error.__stackCleaned__) return; + this.uncycle(); + var parsed = parseStackAndMessage(error); + var message = parsed.message; + var stacks = [parsed.stack]; + + var trace = this; + while (trace !== undefined) { + stacks.push(cleanStack(trace.stack.split("\n"))); + trace = trace._parent; + } + removeCommonRoots(stacks); + removeDuplicateOrEmptyJumps(stacks); + util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); + util.notEnumerableProp(error, "__stackCleaned__", true); +}; + +var captureStackTrace = (function stackDetection() { + var v8stackFramePattern = /^\s*at\s*/; + var v8stackFormatter = function(stack, error) { + if (typeof stack === "string") return stack; + + if (error.name !== undefined && + error.message !== undefined) { + return error.toString(); + } + return formatNonError(error); + }; + + if (typeof Error.stackTraceLimit === "number" && + typeof Error.captureStackTrace === "function") { + Error.stackTraceLimit += 6; + stackFramePattern = v8stackFramePattern; + formatStack = v8stackFormatter; + var captureStackTrace = Error.captureStackTrace; + + shouldIgnore = function(line) { + return bluebirdFramePattern.test(line); + }; + return function(receiver, ignoreUntil) { + Error.stackTraceLimit += 6; + captureStackTrace(receiver, ignoreUntil); + Error.stackTraceLimit -= 6; + }; + } + var err = new Error(); + + if (typeof err.stack === "string" && + err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { + stackFramePattern = /@/; + formatStack = v8stackFormatter; + indentStackFrames = true; + return function captureStackTrace(o) { + o.stack = new Error().stack; + }; + } + + var hasStackAfterThrow; + try { throw new Error(); } + catch(e) { + hasStackAfterThrow = ("stack" in e); + } + if (!("stack" in err) && hasStackAfterThrow && + typeof Error.stackTraceLimit === "number") { + stackFramePattern = v8stackFramePattern; + formatStack = v8stackFormatter; + return function captureStackTrace(o) { + Error.stackTraceLimit += 6; + try { throw new Error(); } + catch(e) { o.stack = e.stack; } + Error.stackTraceLimit -= 6; + }; + } + + formatStack = function(stack, error) { + if (typeof stack === "string") return stack; + + if ((typeof error === "object" || + typeof error === "function") && + error.name !== undefined && + error.message !== undefined) { + return error.toString(); + } + return formatNonError(error); + }; + + return null; + +})([]); + +if (typeof console !== "undefined" && typeof console.warn !== "undefined") { + printWarning = function (message) { + console.warn(message); + }; + if (util.isNode && process.stderr.isTTY) { + printWarning = function(message, isSoft) { + var color = isSoft ? "\u001b[33m" : "\u001b[31m"; + console.warn(color + message + "\u001b[0m\n"); + }; + } else if (!util.isNode && typeof (new Error().stack) === "string") { + printWarning = function(message, isSoft) { + console.warn("%c" + message, + isSoft ? "color: darkorange" : "color: red"); + }; + } +} + +var config = { + warnings: warnings, + longStackTraces: false, + cancellation: false, + monitoring: false +}; + +if (longStackTraces) Promise.longStackTraces(); + +return { + longStackTraces: function() { + return config.longStackTraces; + }, + warnings: function() { + return config.warnings; + }, + cancellation: function() { + return config.cancellation; + }, + monitoring: function() { + return config.monitoring; + }, + propagateFromFunction: function() { + return propagateFromFunction; + }, + boundValueFunction: function() { + return boundValueFunction; + }, + checkForgottenReturns: checkForgottenReturns, + setBounds: setBounds, + warn: warn, + deprecated: deprecated, + CapturedTrace: CapturedTrace, + fireDomEvent: fireDomEvent, + fireGlobalEvent: fireGlobalEvent +}; +}; diff --git a/node_modules/bluebird/js/release/direct_resolve.js b/node_modules/bluebird/js/release/direct_resolve.js new file mode 100644 index 0000000..a890298 --- /dev/null +++ b/node_modules/bluebird/js/release/direct_resolve.js @@ -0,0 +1,46 @@ +"use strict"; +module.exports = function(Promise) { +function returner() { + return this.value; +} +function thrower() { + throw this.reason; +} + +Promise.prototype["return"] = +Promise.prototype.thenReturn = function (value) { + if (value instanceof Promise) value.suppressUnhandledRejections(); + return this._then( + returner, undefined, undefined, {value: value}, undefined); +}; + +Promise.prototype["throw"] = +Promise.prototype.thenThrow = function (reason) { + return this._then( + thrower, undefined, undefined, {reason: reason}, undefined); +}; + +Promise.prototype.catchThrow = function (reason) { + if (arguments.length <= 1) { + return this._then( + undefined, thrower, undefined, {reason: reason}, undefined); + } else { + var _reason = arguments[1]; + var handler = function() {throw _reason;}; + return this.caught(reason, handler); + } +}; + +Promise.prototype.catchReturn = function (value) { + if (arguments.length <= 1) { + if (value instanceof Promise) value.suppressUnhandledRejections(); + return this._then( + undefined, returner, undefined, {value: value}, undefined); + } else { + var _value = arguments[1]; + if (_value instanceof Promise) _value.suppressUnhandledRejections(); + var handler = function() {return _value;}; + return this.caught(value, handler); + } +}; +}; diff --git a/node_modules/bluebird/js/release/each.js b/node_modules/bluebird/js/release/each.js new file mode 100644 index 0000000..e4f3d05 --- /dev/null +++ b/node_modules/bluebird/js/release/each.js @@ -0,0 +1,30 @@ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var PromiseReduce = Promise.reduce; +var PromiseAll = Promise.all; + +function promiseAllThis() { + return PromiseAll(this); +} + +function PromiseMapSeries(promises, fn) { + return PromiseReduce(promises, fn, INTERNAL, INTERNAL); +} + +Promise.prototype.each = function (fn) { + return PromiseReduce(this, fn, INTERNAL, 0) + ._then(promiseAllThis, undefined, undefined, this, undefined); +}; + +Promise.prototype.mapSeries = function (fn) { + return PromiseReduce(this, fn, INTERNAL, INTERNAL); +}; + +Promise.each = function (promises, fn) { + return PromiseReduce(promises, fn, INTERNAL, 0) + ._then(promiseAllThis, undefined, undefined, promises, undefined); +}; + +Promise.mapSeries = PromiseMapSeries; +}; + diff --git a/node_modules/bluebird/js/release/errors.js b/node_modules/bluebird/js/release/errors.js new file mode 100644 index 0000000..f62f323 --- /dev/null +++ b/node_modules/bluebird/js/release/errors.js @@ -0,0 +1,116 @@ +"use strict"; +var es5 = require("./es5"); +var Objectfreeze = es5.freeze; +var util = require("./util"); +var inherits = util.inherits; +var notEnumerableProp = util.notEnumerableProp; + +function subError(nameProperty, defaultMessage) { + function SubError(message) { + if (!(this instanceof SubError)) return new SubError(message); + notEnumerableProp(this, "message", + typeof message === "string" ? message : defaultMessage); + notEnumerableProp(this, "name", nameProperty); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + Error.call(this); + } + } + inherits(SubError, Error); + return SubError; +} + +var _TypeError, _RangeError; +var Warning = subError("Warning", "warning"); +var CancellationError = subError("CancellationError", "cancellation error"); +var TimeoutError = subError("TimeoutError", "timeout error"); +var AggregateError = subError("AggregateError", "aggregate error"); +try { + _TypeError = TypeError; + _RangeError = RangeError; +} catch(e) { + _TypeError = subError("TypeError", "type error"); + _RangeError = subError("RangeError", "range error"); +} + +var methods = ("join pop push shift unshift slice filter forEach some " + + "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" "); + +for (var i = 0; i < methods.length; ++i) { + if (typeof Array.prototype[methods[i]] === "function") { + AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; + } +} + +es5.defineProperty(AggregateError.prototype, "length", { + value: 0, + configurable: false, + writable: true, + enumerable: true +}); +AggregateError.prototype["isOperational"] = true; +var level = 0; +AggregateError.prototype.toString = function() { + var indent = Array(level * 4 + 1).join(" "); + var ret = "\n" + indent + "AggregateError of:" + "\n"; + level++; + indent = Array(level * 4 + 1).join(" "); + for (var i = 0; i < this.length; ++i) { + var str = this[i] === this ? "[Circular AggregateError]" : this[i] + ""; + var lines = str.split("\n"); + for (var j = 0; j < lines.length; ++j) { + lines[j] = indent + lines[j]; + } + str = lines.join("\n"); + ret += str + "\n"; + } + level--; + return ret; +}; + +function OperationalError(message) { + if (!(this instanceof OperationalError)) + return new OperationalError(message); + notEnumerableProp(this, "name", "OperationalError"); + notEnumerableProp(this, "message", message); + this.cause = message; + this["isOperational"] = true; + + if (message instanceof Error) { + notEnumerableProp(this, "message", message.message); + notEnumerableProp(this, "stack", message.stack); + } else if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + +} +inherits(OperationalError, Error); + +var errorTypes = Error["__BluebirdErrorTypes__"]; +if (!errorTypes) { + errorTypes = Objectfreeze({ + CancellationError: CancellationError, + TimeoutError: TimeoutError, + OperationalError: OperationalError, + RejectionError: OperationalError, + AggregateError: AggregateError + }); + es5.defineProperty(Error, "__BluebirdErrorTypes__", { + value: errorTypes, + writable: false, + enumerable: false, + configurable: false + }); +} + +module.exports = { + Error: Error, + TypeError: _TypeError, + RangeError: _RangeError, + CancellationError: errorTypes.CancellationError, + OperationalError: errorTypes.OperationalError, + TimeoutError: errorTypes.TimeoutError, + AggregateError: errorTypes.AggregateError, + Warning: Warning +}; diff --git a/node_modules/bluebird/js/release/es5.js b/node_modules/bluebird/js/release/es5.js new file mode 100644 index 0000000..ea41d5a --- /dev/null +++ b/node_modules/bluebird/js/release/es5.js @@ -0,0 +1,80 @@ +var isES5 = (function(){ + "use strict"; + return this === undefined; +})(); + +if (isES5) { + module.exports = { + freeze: Object.freeze, + defineProperty: Object.defineProperty, + getDescriptor: Object.getOwnPropertyDescriptor, + keys: Object.keys, + names: Object.getOwnPropertyNames, + getPrototypeOf: Object.getPrototypeOf, + isArray: Array.isArray, + isES5: isES5, + propertyIsWritable: function(obj, prop) { + var descriptor = Object.getOwnPropertyDescriptor(obj, prop); + return !!(!descriptor || descriptor.writable || descriptor.set); + } + }; +} else { + var has = {}.hasOwnProperty; + var str = {}.toString; + var proto = {}.constructor.prototype; + + var ObjectKeys = function (o) { + var ret = []; + for (var key in o) { + if (has.call(o, key)) { + ret.push(key); + } + } + return ret; + }; + + var ObjectGetDescriptor = function(o, key) { + return {value: o[key]}; + }; + + var ObjectDefineProperty = function (o, key, desc) { + o[key] = desc.value; + return o; + }; + + var ObjectFreeze = function (obj) { + return obj; + }; + + var ObjectGetPrototypeOf = function (obj) { + try { + return Object(obj).constructor.prototype; + } + catch (e) { + return proto; + } + }; + + var ArrayIsArray = function (obj) { + try { + return str.call(obj) === "[object Array]"; + } + catch(e) { + return false; + } + }; + + module.exports = { + isArray: ArrayIsArray, + keys: ObjectKeys, + names: ObjectKeys, + defineProperty: ObjectDefineProperty, + getDescriptor: ObjectGetDescriptor, + freeze: ObjectFreeze, + getPrototypeOf: ObjectGetPrototypeOf, + isES5: isES5, + propertyIsWritable: function() { + return true; + } + }; +} diff --git a/node_modules/bluebird/js/release/filter.js b/node_modules/bluebird/js/release/filter.js new file mode 100644 index 0000000..ed57bf0 --- /dev/null +++ b/node_modules/bluebird/js/release/filter.js @@ -0,0 +1,12 @@ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var PromiseMap = Promise.map; + +Promise.prototype.filter = function (fn, options) { + return PromiseMap(this, fn, options, INTERNAL); +}; + +Promise.filter = function (promises, fn, options) { + return PromiseMap(promises, fn, options, INTERNAL); +}; +}; diff --git a/node_modules/bluebird/js/release/finally.js b/node_modules/bluebird/js/release/finally.js new file mode 100644 index 0000000..d57444b --- /dev/null +++ b/node_modules/bluebird/js/release/finally.js @@ -0,0 +1,146 @@ +"use strict"; +module.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) { +var util = require("./util"); +var CancellationError = Promise.CancellationError; +var errorObj = util.errorObj; +var catchFilter = require("./catch_filter")(NEXT_FILTER); + +function PassThroughHandlerContext(promise, type, handler) { + this.promise = promise; + this.type = type; + this.handler = handler; + this.called = false; + this.cancelPromise = null; +} + +PassThroughHandlerContext.prototype.isFinallyHandler = function() { + return this.type === 0; +}; + +function FinallyHandlerCancelReaction(finallyHandler) { + this.finallyHandler = finallyHandler; +} + +FinallyHandlerCancelReaction.prototype._resultCancelled = function() { + checkCancel(this.finallyHandler); +}; + +function checkCancel(ctx, reason) { + if (ctx.cancelPromise != null) { + if (arguments.length > 1) { + ctx.cancelPromise._reject(reason); + } else { + ctx.cancelPromise._cancel(); + } + ctx.cancelPromise = null; + return true; + } + return false; +} + +function succeed() { + return finallyHandler.call(this, this.promise._target()._settledValue()); +} +function fail(reason) { + if (checkCancel(this, reason)) return; + errorObj.e = reason; + return errorObj; +} +function finallyHandler(reasonOrValue) { + var promise = this.promise; + var handler = this.handler; + + if (!this.called) { + this.called = true; + var ret = this.isFinallyHandler() + ? handler.call(promise._boundValue()) + : handler.call(promise._boundValue(), reasonOrValue); + if (ret === NEXT_FILTER) { + return ret; + } else if (ret !== undefined) { + promise._setReturnedNonUndefined(); + var maybePromise = tryConvertToPromise(ret, promise); + if (maybePromise instanceof Promise) { + if (this.cancelPromise != null) { + if (maybePromise._isCancelled()) { + var reason = + new CancellationError("late cancellation observer"); + promise._attachExtraTrace(reason); + errorObj.e = reason; + return errorObj; + } else if (maybePromise.isPending()) { + maybePromise._attachCancellationCallback( + new FinallyHandlerCancelReaction(this)); + } + } + return maybePromise._then( + succeed, fail, undefined, this, undefined); + } + } + } + + if (promise.isRejected()) { + checkCancel(this); + errorObj.e = reasonOrValue; + return errorObj; + } else { + checkCancel(this); + return reasonOrValue; + } +} + +Promise.prototype._passThrough = function(handler, type, success, fail) { + if (typeof handler !== "function") return this.then(); + return this._then(success, + fail, + undefined, + new PassThroughHandlerContext(this, type, handler), + undefined); +}; + +Promise.prototype.lastly = +Promise.prototype["finally"] = function (handler) { + return this._passThrough(handler, + 0, + finallyHandler, + finallyHandler); +}; + + +Promise.prototype.tap = function (handler) { + return this._passThrough(handler, 1, finallyHandler); +}; + +Promise.prototype.tapCatch = function (handlerOrPredicate) { + var len = arguments.length; + if(len === 1) { + return this._passThrough(handlerOrPredicate, + 1, + undefined, + finallyHandler); + } else { + var catchInstances = new Array(len - 1), + j = 0, i; + for (i = 0; i < len - 1; ++i) { + var item = arguments[i]; + if (util.isObject(item)) { + catchInstances[j++] = item; + } else { + return Promise.reject(new TypeError( + "tapCatch statement predicate: " + + "expecting an object but got " + util.classString(item) + )); + } + } + catchInstances.length = j; + var handler = arguments[i]; + return this._passThrough(catchFilter(catchInstances, handler, this), + 1, + undefined, + finallyHandler); + } + +}; + +return PassThroughHandlerContext; +}; diff --git a/node_modules/bluebird/js/release/generators.js b/node_modules/bluebird/js/release/generators.js new file mode 100644 index 0000000..500c280 --- /dev/null +++ b/node_modules/bluebird/js/release/generators.js @@ -0,0 +1,223 @@ +"use strict"; +module.exports = function(Promise, + apiRejection, + INTERNAL, + tryConvertToPromise, + Proxyable, + debug) { +var errors = require("./errors"); +var TypeError = errors.TypeError; +var util = require("./util"); +var errorObj = util.errorObj; +var tryCatch = util.tryCatch; +var yieldHandlers = []; + +function promiseFromYieldHandler(value, yieldHandlers, traceParent) { + for (var i = 0; i < yieldHandlers.length; ++i) { + traceParent._pushContext(); + var result = tryCatch(yieldHandlers[i])(value); + traceParent._popContext(); + if (result === errorObj) { + traceParent._pushContext(); + var ret = Promise.reject(errorObj.e); + traceParent._popContext(); + return ret; + } + var maybePromise = tryConvertToPromise(result, traceParent); + if (maybePromise instanceof Promise) return maybePromise; + } + return null; +} + +function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { + if (debug.cancellation()) { + var internal = new Promise(INTERNAL); + var _finallyPromise = this._finallyPromise = new Promise(INTERNAL); + this._promise = internal.lastly(function() { + return _finallyPromise; + }); + internal._captureStackTrace(); + internal._setOnCancel(this); + } else { + var promise = this._promise = new Promise(INTERNAL); + promise._captureStackTrace(); + } + this._stack = stack; + this._generatorFunction = generatorFunction; + this._receiver = receiver; + this._generator = undefined; + this._yieldHandlers = typeof yieldHandler === "function" + ? [yieldHandler].concat(yieldHandlers) + : yieldHandlers; + this._yieldedPromise = null; + this._cancellationPhase = false; +} +util.inherits(PromiseSpawn, Proxyable); + +PromiseSpawn.prototype._isResolved = function() { + return this._promise === null; +}; + +PromiseSpawn.prototype._cleanup = function() { + this._promise = this._generator = null; + if (debug.cancellation() && this._finallyPromise !== null) { + this._finallyPromise._fulfill(); + this._finallyPromise = null; + } +}; + +PromiseSpawn.prototype._promiseCancelled = function() { + if (this._isResolved()) return; + var implementsReturn = typeof this._generator["return"] !== "undefined"; + + var result; + if (!implementsReturn) { + var reason = new Promise.CancellationError( + "generator .return() sentinel"); + Promise.coroutine.returnSentinel = reason; + this._promise._attachExtraTrace(reason); + this._promise._pushContext(); + result = tryCatch(this._generator["throw"]).call(this._generator, + reason); + this._promise._popContext(); + } else { + this._promise._pushContext(); + result = tryCatch(this._generator["return"]).call(this._generator, + undefined); + this._promise._popContext(); + } + this._cancellationPhase = true; + this._yieldedPromise = null; + this._continue(result); +}; + +PromiseSpawn.prototype._promiseFulfilled = function(value) { + this._yieldedPromise = null; + this._promise._pushContext(); + var result = tryCatch(this._generator.next).call(this._generator, value); + this._promise._popContext(); + this._continue(result); +}; + +PromiseSpawn.prototype._promiseRejected = function(reason) { + this._yieldedPromise = null; + this._promise._attachExtraTrace(reason); + this._promise._pushContext(); + var result = tryCatch(this._generator["throw"]) + .call(this._generator, reason); + this._promise._popContext(); + this._continue(result); +}; + +PromiseSpawn.prototype._resultCancelled = function() { + if (this._yieldedPromise instanceof Promise) { + var promise = this._yieldedPromise; + this._yieldedPromise = null; + promise.cancel(); + } +}; + +PromiseSpawn.prototype.promise = function () { + return this._promise; +}; + +PromiseSpawn.prototype._run = function () { + this._generator = this._generatorFunction.call(this._receiver); + this._receiver = + this._generatorFunction = undefined; + this._promiseFulfilled(undefined); +}; + +PromiseSpawn.prototype._continue = function (result) { + var promise = this._promise; + if (result === errorObj) { + this._cleanup(); + if (this._cancellationPhase) { + return promise.cancel(); + } else { + return promise._rejectCallback(result.e, false); + } + } + + var value = result.value; + if (result.done === true) { + this._cleanup(); + if (this._cancellationPhase) { + return promise.cancel(); + } else { + return promise._resolveCallback(value); + } + } else { + var maybePromise = tryConvertToPromise(value, this._promise); + if (!(maybePromise instanceof Promise)) { + maybePromise = + promiseFromYieldHandler(maybePromise, + this._yieldHandlers, + this._promise); + if (maybePromise === null) { + this._promiseRejected( + new TypeError( + "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", String(value)) + + "From coroutine:\u000a" + + this._stack.split("\n").slice(1, -7).join("\n") + ) + ); + return; + } + } + maybePromise = maybePromise._target(); + var bitField = maybePromise._bitField; + ; + if (((bitField & 50397184) === 0)) { + this._yieldedPromise = maybePromise; + maybePromise._proxy(this, null); + } else if (((bitField & 33554432) !== 0)) { + Promise._async.invoke( + this._promiseFulfilled, this, maybePromise._value() + ); + } else if (((bitField & 16777216) !== 0)) { + Promise._async.invoke( + this._promiseRejected, this, maybePromise._reason() + ); + } else { + this._promiseCancelled(); + } + } +}; + +Promise.coroutine = function (generatorFunction, options) { + if (typeof generatorFunction !== "function") { + throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + var yieldHandler = Object(options).yieldHandler; + var PromiseSpawn$ = PromiseSpawn; + var stack = new Error().stack; + return function () { + var generator = generatorFunction.apply(this, arguments); + var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler, + stack); + var ret = spawn.promise(); + spawn._generator = generator; + spawn._promiseFulfilled(undefined); + return ret; + }; +}; + +Promise.coroutine.addYieldHandler = function(fn) { + if (typeof fn !== "function") { + throw new TypeError("expecting a function but got " + util.classString(fn)); + } + yieldHandlers.push(fn); +}; + +Promise.spawn = function (generatorFunction) { + debug.deprecated("Promise.spawn()", "Promise.coroutine()"); + if (typeof generatorFunction !== "function") { + return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + var spawn = new PromiseSpawn(generatorFunction, this); + var ret = spawn.promise(); + spawn._run(Promise.spawn); + return ret; +}; +}; diff --git a/node_modules/bluebird/js/release/join.js b/node_modules/bluebird/js/release/join.js new file mode 100644 index 0000000..4945e3f --- /dev/null +++ b/node_modules/bluebird/js/release/join.js @@ -0,0 +1,168 @@ +"use strict"; +module.exports = +function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, + getDomain) { +var util = require("./util"); +var canEvaluate = util.canEvaluate; +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var reject; + +if (!false) { +if (canEvaluate) { + var thenCallback = function(i) { + return new Function("value", "holder", " \n\ + 'use strict'; \n\ + holder.pIndex = value; \n\ + holder.checkFulfillment(this); \n\ + ".replace(/Index/g, i)); + }; + + var promiseSetter = function(i) { + return new Function("promise", "holder", " \n\ + 'use strict'; \n\ + holder.pIndex = promise; \n\ + ".replace(/Index/g, i)); + }; + + var generateHolderClass = function(total) { + var props = new Array(total); + for (var i = 0; i < props.length; ++i) { + props[i] = "this.p" + (i+1); + } + var assignment = props.join(" = ") + " = null;"; + var cancellationCode= "var promise;\n" + props.map(function(prop) { + return " \n\ + promise = " + prop + "; \n\ + if (promise instanceof Promise) { \n\ + promise.cancel(); \n\ + } \n\ + "; + }).join("\n"); + var passedArguments = props.join(", "); + var name = "Holder$" + total; + + + var code = "return function(tryCatch, errorObj, Promise, async) { \n\ + 'use strict'; \n\ + function [TheName](fn) { \n\ + [TheProperties] \n\ + this.fn = fn; \n\ + this.asyncNeeded = true; \n\ + this.now = 0; \n\ + } \n\ + \n\ + [TheName].prototype._callFunction = function(promise) { \n\ + promise._pushContext(); \n\ + var ret = tryCatch(this.fn)([ThePassedArguments]); \n\ + promise._popContext(); \n\ + if (ret === errorObj) { \n\ + promise._rejectCallback(ret.e, false); \n\ + } else { \n\ + promise._resolveCallback(ret); \n\ + } \n\ + }; \n\ + \n\ + [TheName].prototype.checkFulfillment = function(promise) { \n\ + var now = ++this.now; \n\ + if (now === [TheTotal]) { \n\ + if (this.asyncNeeded) { \n\ + async.invoke(this._callFunction, this, promise); \n\ + } else { \n\ + this._callFunction(promise); \n\ + } \n\ + \n\ + } \n\ + }; \n\ + \n\ + [TheName].prototype._resultCancelled = function() { \n\ + [CancellationCode] \n\ + }; \n\ + \n\ + return [TheName]; \n\ + }(tryCatch, errorObj, Promise, async); \n\ + "; + + code = code.replace(/\[TheName\]/g, name) + .replace(/\[TheTotal\]/g, total) + .replace(/\[ThePassedArguments\]/g, passedArguments) + .replace(/\[TheProperties\]/g, assignment) + .replace(/\[CancellationCode\]/g, cancellationCode); + + return new Function("tryCatch", "errorObj", "Promise", "async", code) + (tryCatch, errorObj, Promise, async); + }; + + var holderClasses = []; + var thenCallbacks = []; + var promiseSetters = []; + + for (var i = 0; i < 8; ++i) { + holderClasses.push(generateHolderClass(i + 1)); + thenCallbacks.push(thenCallback(i + 1)); + promiseSetters.push(promiseSetter(i + 1)); + } + + reject = function (reason) { + this._reject(reason); + }; +}} + +Promise.join = function () { + var last = arguments.length - 1; + var fn; + if (last > 0 && typeof arguments[last] === "function") { + fn = arguments[last]; + if (!false) { + if (last <= 8 && canEvaluate) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + var HolderClass = holderClasses[last - 1]; + var holder = new HolderClass(fn); + var callbacks = thenCallbacks; + + for (var i = 0; i < last; ++i) { + var maybePromise = tryConvertToPromise(arguments[i], ret); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + var bitField = maybePromise._bitField; + ; + if (((bitField & 50397184) === 0)) { + maybePromise._then(callbacks[i], reject, + undefined, ret, holder); + promiseSetters[i](maybePromise, holder); + holder.asyncNeeded = false; + } else if (((bitField & 33554432) !== 0)) { + callbacks[i].call(ret, + maybePromise._value(), holder); + } else if (((bitField & 16777216) !== 0)) { + ret._reject(maybePromise._reason()); + } else { + ret._cancel(); + } + } else { + callbacks[i].call(ret, maybePromise, holder); + } + } + + if (!ret._isFateSealed()) { + if (holder.asyncNeeded) { + var domain = getDomain(); + if (domain !== null) { + holder.fn = util.domainBind(domain, holder.fn); + } + } + ret._setAsyncGuaranteed(); + ret._setOnCancel(holder); + } + return ret; + } + } + } + var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];}; + if (fn) args.pop(); + var ret = new PromiseArray(args).promise(); + return fn !== undefined ? ret.spread(fn) : ret; +}; + +}; diff --git a/node_modules/bluebird/js/release/map.js b/node_modules/bluebird/js/release/map.js new file mode 100644 index 0000000..976f15e --- /dev/null +++ b/node_modules/bluebird/js/release/map.js @@ -0,0 +1,168 @@ +"use strict"; +module.exports = function(Promise, + PromiseArray, + apiRejection, + tryConvertToPromise, + INTERNAL, + debug) { +var getDomain = Promise._getDomain; +var util = require("./util"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var async = Promise._async; + +function MappingPromiseArray(promises, fn, limit, _filter) { + this.constructor$(promises); + this._promise._captureStackTrace(); + var domain = getDomain(); + this._callback = domain === null ? fn : util.domainBind(domain, fn); + this._preservedValues = _filter === INTERNAL + ? new Array(this.length()) + : null; + this._limit = limit; + this._inFlight = 0; + this._queue = []; + async.invoke(this._asyncInit, this, undefined); +} +util.inherits(MappingPromiseArray, PromiseArray); + +MappingPromiseArray.prototype._asyncInit = function() { + this._init$(undefined, -2); +}; + +MappingPromiseArray.prototype._init = function () {}; + +MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { + var values = this._values; + var length = this.length(); + var preservedValues = this._preservedValues; + var limit = this._limit; + + if (index < 0) { + index = (index * -1) - 1; + values[index] = value; + if (limit >= 1) { + this._inFlight--; + this._drainQueue(); + if (this._isResolved()) return true; + } + } else { + if (limit >= 1 && this._inFlight >= limit) { + values[index] = value; + this._queue.push(index); + return false; + } + if (preservedValues !== null) preservedValues[index] = value; + + var promise = this._promise; + var callback = this._callback; + var receiver = promise._boundValue(); + promise._pushContext(); + var ret = tryCatch(callback).call(receiver, value, index, length); + var promiseCreated = promise._popContext(); + debug.checkForgottenReturns( + ret, + promiseCreated, + preservedValues !== null ? "Promise.filter" : "Promise.map", + promise + ); + if (ret === errorObj) { + this._reject(ret.e); + return true; + } + + var maybePromise = tryConvertToPromise(ret, this._promise); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + var bitField = maybePromise._bitField; + ; + if (((bitField & 50397184) === 0)) { + if (limit >= 1) this._inFlight++; + values[index] = maybePromise; + maybePromise._proxy(this, (index + 1) * -1); + return false; + } else if (((bitField & 33554432) !== 0)) { + ret = maybePromise._value(); + } else if (((bitField & 16777216) !== 0)) { + this._reject(maybePromise._reason()); + return true; + } else { + this._cancel(); + return true; + } + } + values[index] = ret; + } + var totalResolved = ++this._totalResolved; + if (totalResolved >= length) { + if (preservedValues !== null) { + this._filter(values, preservedValues); + } else { + this._resolve(values); + } + return true; + } + return false; +}; + +MappingPromiseArray.prototype._drainQueue = function () { + var queue = this._queue; + var limit = this._limit; + var values = this._values; + while (queue.length > 0 && this._inFlight < limit) { + if (this._isResolved()) return; + var index = queue.pop(); + this._promiseFulfilled(values[index], index); + } +}; + +MappingPromiseArray.prototype._filter = function (booleans, values) { + var len = values.length; + var ret = new Array(len); + var j = 0; + for (var i = 0; i < len; ++i) { + if (booleans[i]) ret[j++] = values[i]; + } + ret.length = j; + this._resolve(ret); +}; + +MappingPromiseArray.prototype.preservedValues = function () { + return this._preservedValues; +}; + +function map(promises, fn, options, _filter) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + + var limit = 0; + if (options !== undefined) { + if (typeof options === "object" && options !== null) { + if (typeof options.concurrency !== "number") { + return Promise.reject( + new TypeError("'concurrency' must be a number but it is " + + util.classString(options.concurrency))); + } + limit = options.concurrency; + } else { + return Promise.reject(new TypeError( + "options argument must be an object but it is " + + util.classString(options))); + } + } + limit = typeof limit === "number" && + isFinite(limit) && limit >= 1 ? limit : 0; + return new MappingPromiseArray(promises, fn, limit, _filter).promise(); +} + +Promise.prototype.map = function (fn, options) { + return map(this, fn, options, null); +}; + +Promise.map = function (promises, fn, options, _filter) { + return map(promises, fn, options, _filter); +}; + + +}; diff --git a/node_modules/bluebird/js/release/method.js b/node_modules/bluebird/js/release/method.js new file mode 100644 index 0000000..ce9e4db --- /dev/null +++ b/node_modules/bluebird/js/release/method.js @@ -0,0 +1,55 @@ +"use strict"; +module.exports = +function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) { +var util = require("./util"); +var tryCatch = util.tryCatch; + +Promise.method = function (fn) { + if (typeof fn !== "function") { + throw new Promise.TypeError("expecting a function but got " + util.classString(fn)); + } + return function () { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._pushContext(); + var value = tryCatch(fn).apply(this, arguments); + var promiseCreated = ret._popContext(); + debug.checkForgottenReturns( + value, promiseCreated, "Promise.method", ret); + ret._resolveFromSyncValue(value); + return ret; + }; +}; + +Promise.attempt = Promise["try"] = function (fn) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._pushContext(); + var value; + if (arguments.length > 1) { + debug.deprecated("calling Promise.try with more than 1 argument"); + var arg = arguments[1]; + var ctx = arguments[2]; + value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg) + : tryCatch(fn).call(ctx, arg); + } else { + value = tryCatch(fn)(); + } + var promiseCreated = ret._popContext(); + debug.checkForgottenReturns( + value, promiseCreated, "Promise.try", ret); + ret._resolveFromSyncValue(value); + return ret; +}; + +Promise.prototype._resolveFromSyncValue = function (value) { + if (value === util.errorObj) { + this._rejectCallback(value.e, false); + } else { + this._resolveCallback(value, true); + } +}; +}; diff --git a/node_modules/bluebird/js/release/nodeback.js b/node_modules/bluebird/js/release/nodeback.js new file mode 100644 index 0000000..71e69eb --- /dev/null +++ b/node_modules/bluebird/js/release/nodeback.js @@ -0,0 +1,51 @@ +"use strict"; +var util = require("./util"); +var maybeWrapAsError = util.maybeWrapAsError; +var errors = require("./errors"); +var OperationalError = errors.OperationalError; +var es5 = require("./es5"); + +function isUntypedError(obj) { + return obj instanceof Error && + es5.getPrototypeOf(obj) === Error.prototype; +} + +var rErrorKey = /^(?:name|message|stack|cause)$/; +function wrapAsOperationalError(obj) { + var ret; + if (isUntypedError(obj)) { + ret = new OperationalError(obj); + ret.name = obj.name; + ret.message = obj.message; + ret.stack = obj.stack; + var keys = es5.keys(obj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (!rErrorKey.test(key)) { + ret[key] = obj[key]; + } + } + return ret; + } + util.markAsOriginatingFromRejection(obj); + return obj; +} + +function nodebackForPromise(promise, multiArgs) { + return function(err, value) { + if (promise === null) return; + if (err) { + var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); + promise._attachExtraTrace(wrapped); + promise._reject(wrapped); + } else if (!multiArgs) { + promise._fulfill(value); + } else { + var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];}; + promise._fulfill(args); + } + promise = null; + }; +} + +module.exports = nodebackForPromise; diff --git a/node_modules/bluebird/js/release/nodeify.js b/node_modules/bluebird/js/release/nodeify.js new file mode 100644 index 0000000..ce2b190 --- /dev/null +++ b/node_modules/bluebird/js/release/nodeify.js @@ -0,0 +1,58 @@ +"use strict"; +module.exports = function(Promise) { +var util = require("./util"); +var async = Promise._async; +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; + +function spreadAdapter(val, nodeback) { + var promise = this; + if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); + var ret = + tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val)); + if (ret === errorObj) { + async.throwLater(ret.e); + } +} + +function successAdapter(val, nodeback) { + var promise = this; + var receiver = promise._boundValue(); + var ret = val === undefined + ? tryCatch(nodeback).call(receiver, null) + : tryCatch(nodeback).call(receiver, null, val); + if (ret === errorObj) { + async.throwLater(ret.e); + } +} +function errorAdapter(reason, nodeback) { + var promise = this; + if (!reason) { + var newReason = new Error(reason + ""); + newReason.cause = reason; + reason = newReason; + } + var ret = tryCatch(nodeback).call(promise._boundValue(), reason); + if (ret === errorObj) { + async.throwLater(ret.e); + } +} + +Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback, + options) { + if (typeof nodeback == "function") { + var adapter = successAdapter; + if (options !== undefined && Object(options).spread) { + adapter = spreadAdapter; + } + this._then( + adapter, + errorAdapter, + undefined, + this, + nodeback + ); + } + return this; +}; +}; diff --git a/node_modules/bluebird/js/release/promise.js b/node_modules/bluebird/js/release/promise.js new file mode 100644 index 0000000..99d20f9 --- /dev/null +++ b/node_modules/bluebird/js/release/promise.js @@ -0,0 +1,775 @@ +"use strict"; +module.exports = function() { +var makeSelfResolutionError = function () { + return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a"); +}; +var reflectHandler = function() { + return new Promise.PromiseInspection(this._target()); +}; +var apiRejection = function(msg) { + return Promise.reject(new TypeError(msg)); +}; +function Proxyable() {} +var UNDEFINED_BINDING = {}; +var util = require("./util"); + +var getDomain; +if (util.isNode) { + getDomain = function() { + var ret = process.domain; + if (ret === undefined) ret = null; + return ret; + }; +} else { + getDomain = function() { + return null; + }; +} +util.notEnumerableProp(Promise, "_getDomain", getDomain); + +var es5 = require("./es5"); +var Async = require("./async"); +var async = new Async(); +es5.defineProperty(Promise, "_async", {value: async}); +var errors = require("./errors"); +var TypeError = Promise.TypeError = errors.TypeError; +Promise.RangeError = errors.RangeError; +var CancellationError = Promise.CancellationError = errors.CancellationError; +Promise.TimeoutError = errors.TimeoutError; +Promise.OperationalError = errors.OperationalError; +Promise.RejectionError = errors.OperationalError; +Promise.AggregateError = errors.AggregateError; +var INTERNAL = function(){}; +var APPLY = {}; +var NEXT_FILTER = {}; +var tryConvertToPromise = require("./thenables")(Promise, INTERNAL); +var PromiseArray = + require("./promise_array")(Promise, INTERNAL, + tryConvertToPromise, apiRejection, Proxyable); +var Context = require("./context")(Promise); + /*jshint unused:false*/ +var createContext = Context.create; +var debug = require("./debuggability")(Promise, Context); +var CapturedTrace = debug.CapturedTrace; +var PassThroughHandlerContext = + require("./finally")(Promise, tryConvertToPromise, NEXT_FILTER); +var catchFilter = require("./catch_filter")(NEXT_FILTER); +var nodebackForPromise = require("./nodeback"); +var errorObj = util.errorObj; +var tryCatch = util.tryCatch; +function check(self, executor) { + if (self == null || self.constructor !== Promise) { + throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + if (typeof executor !== "function") { + throw new TypeError("expecting a function but got " + util.classString(executor)); + } + +} + +function Promise(executor) { + if (executor !== INTERNAL) { + check(this, executor); + } + this._bitField = 0; + this._fulfillmentHandler0 = undefined; + this._rejectionHandler0 = undefined; + this._promise0 = undefined; + this._receiver0 = undefined; + this._resolveFromExecutor(executor); + this._promiseCreated(); + this._fireEvent("promiseCreated", this); +} + +Promise.prototype.toString = function () { + return "[object Promise]"; +}; + +Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { + var len = arguments.length; + if (len > 1) { + var catchInstances = new Array(len - 1), + j = 0, i; + for (i = 0; i < len - 1; ++i) { + var item = arguments[i]; + if (util.isObject(item)) { + catchInstances[j++] = item; + } else { + return apiRejection("Catch statement predicate: " + + "expecting an object but got " + util.classString(item)); + } + } + catchInstances.length = j; + fn = arguments[i]; + return this.then(undefined, catchFilter(catchInstances, fn, this)); + } + return this.then(undefined, fn); +}; + +Promise.prototype.reflect = function () { + return this._then(reflectHandler, + reflectHandler, undefined, this, undefined); +}; + +Promise.prototype.then = function (didFulfill, didReject) { + if (debug.warnings() && arguments.length > 0 && + typeof didFulfill !== "function" && + typeof didReject !== "function") { + var msg = ".then() only accepts functions but was passed: " + + util.classString(didFulfill); + if (arguments.length > 1) { + msg += ", " + util.classString(didReject); + } + this._warn(msg); + } + return this._then(didFulfill, didReject, undefined, undefined, undefined); +}; + +Promise.prototype.done = function (didFulfill, didReject) { + var promise = + this._then(didFulfill, didReject, undefined, undefined, undefined); + promise._setIsFinal(); +}; + +Promise.prototype.spread = function (fn) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + return this.all()._then(fn, undefined, undefined, APPLY, undefined); +}; + +Promise.prototype.toJSON = function () { + var ret = { + isFulfilled: false, + isRejected: false, + fulfillmentValue: undefined, + rejectionReason: undefined + }; + if (this.isFulfilled()) { + ret.fulfillmentValue = this.value(); + ret.isFulfilled = true; + } else if (this.isRejected()) { + ret.rejectionReason = this.reason(); + ret.isRejected = true; + } + return ret; +}; + +Promise.prototype.all = function () { + if (arguments.length > 0) { + this._warn(".all() was passed arguments but it does not take any"); + } + return new PromiseArray(this).promise(); +}; + +Promise.prototype.error = function (fn) { + return this.caught(util.originatesFromRejection, fn); +}; + +Promise.getNewLibraryCopy = module.exports; + +Promise.is = function (val) { + return val instanceof Promise; +}; + +Promise.fromNode = Promise.fromCallback = function(fn) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs + : false; + var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs)); + if (result === errorObj) { + ret._rejectCallback(result.e, true); + } + if (!ret._isFateSealed()) ret._setAsyncGuaranteed(); + return ret; +}; + +Promise.all = function (promises) { + return new PromiseArray(promises).promise(); +}; + +Promise.cast = function (obj) { + var ret = tryConvertToPromise(obj); + if (!(ret instanceof Promise)) { + ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._setFulfilled(); + ret._rejectionHandler0 = obj; + } + return ret; +}; + +Promise.resolve = Promise.fulfilled = Promise.cast; + +Promise.reject = Promise.rejected = function (reason) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._rejectCallback(reason, true); + return ret; +}; + +Promise.setScheduler = function(fn) { + if (typeof fn !== "function") { + throw new TypeError("expecting a function but got " + util.classString(fn)); + } + return async.setScheduler(fn); +}; + +Promise.prototype._then = function ( + didFulfill, + didReject, + _, receiver, + internalData +) { + var haveInternalData = internalData !== undefined; + var promise = haveInternalData ? internalData : new Promise(INTERNAL); + var target = this._target(); + var bitField = target._bitField; + + if (!haveInternalData) { + promise._propagateFrom(this, 3); + promise._captureStackTrace(); + if (receiver === undefined && + ((this._bitField & 2097152) !== 0)) { + if (!((bitField & 50397184) === 0)) { + receiver = this._boundValue(); + } else { + receiver = target === this ? undefined : this._boundTo; + } + } + this._fireEvent("promiseChained", this, promise); + } + + var domain = getDomain(); + if (!((bitField & 50397184) === 0)) { + var handler, value, settler = target._settlePromiseCtx; + if (((bitField & 33554432) !== 0)) { + value = target._rejectionHandler0; + handler = didFulfill; + } else if (((bitField & 16777216) !== 0)) { + value = target._fulfillmentHandler0; + handler = didReject; + target._unsetRejectionIsUnhandled(); + } else { + settler = target._settlePromiseLateCancellationObserver; + value = new CancellationError("late cancellation observer"); + target._attachExtraTrace(value); + handler = didReject; + } + + async.invoke(settler, target, { + handler: domain === null ? handler + : (typeof handler === "function" && + util.domainBind(domain, handler)), + promise: promise, + receiver: receiver, + value: value + }); + } else { + target._addCallbacks(didFulfill, didReject, promise, receiver, domain); + } + + return promise; +}; + +Promise.prototype._length = function () { + return this._bitField & 65535; +}; + +Promise.prototype._isFateSealed = function () { + return (this._bitField & 117506048) !== 0; +}; + +Promise.prototype._isFollowing = function () { + return (this._bitField & 67108864) === 67108864; +}; + +Promise.prototype._setLength = function (len) { + this._bitField = (this._bitField & -65536) | + (len & 65535); +}; + +Promise.prototype._setFulfilled = function () { + this._bitField = this._bitField | 33554432; + this._fireEvent("promiseFulfilled", this); +}; + +Promise.prototype._setRejected = function () { + this._bitField = this._bitField | 16777216; + this._fireEvent("promiseRejected", this); +}; + +Promise.prototype._setFollowing = function () { + this._bitField = this._bitField | 67108864; + this._fireEvent("promiseResolved", this); +}; + +Promise.prototype._setIsFinal = function () { + this._bitField = this._bitField | 4194304; +}; + +Promise.prototype._isFinal = function () { + return (this._bitField & 4194304) > 0; +}; + +Promise.prototype._unsetCancelled = function() { + this._bitField = this._bitField & (~65536); +}; + +Promise.prototype._setCancelled = function() { + this._bitField = this._bitField | 65536; + this._fireEvent("promiseCancelled", this); +}; + +Promise.prototype._setWillBeCancelled = function() { + this._bitField = this._bitField | 8388608; +}; + +Promise.prototype._setAsyncGuaranteed = function() { + if (async.hasCustomScheduler()) return; + this._bitField = this._bitField | 134217728; +}; + +Promise.prototype._receiverAt = function (index) { + var ret = index === 0 ? this._receiver0 : this[ + index * 4 - 4 + 3]; + if (ret === UNDEFINED_BINDING) { + return undefined; + } else if (ret === undefined && this._isBound()) { + return this._boundValue(); + } + return ret; +}; + +Promise.prototype._promiseAt = function (index) { + return this[ + index * 4 - 4 + 2]; +}; + +Promise.prototype._fulfillmentHandlerAt = function (index) { + return this[ + index * 4 - 4 + 0]; +}; + +Promise.prototype._rejectionHandlerAt = function (index) { + return this[ + index * 4 - 4 + 1]; +}; + +Promise.prototype._boundValue = function() {}; + +Promise.prototype._migrateCallback0 = function (follower) { + var bitField = follower._bitField; + var fulfill = follower._fulfillmentHandler0; + var reject = follower._rejectionHandler0; + var promise = follower._promise0; + var receiver = follower._receiverAt(0); + if (receiver === undefined) receiver = UNDEFINED_BINDING; + this._addCallbacks(fulfill, reject, promise, receiver, null); +}; + +Promise.prototype._migrateCallbackAt = function (follower, index) { + var fulfill = follower._fulfillmentHandlerAt(index); + var reject = follower._rejectionHandlerAt(index); + var promise = follower._promiseAt(index); + var receiver = follower._receiverAt(index); + if (receiver === undefined) receiver = UNDEFINED_BINDING; + this._addCallbacks(fulfill, reject, promise, receiver, null); +}; + +Promise.prototype._addCallbacks = function ( + fulfill, + reject, + promise, + receiver, + domain +) { + var index = this._length(); + + if (index >= 65535 - 4) { + index = 0; + this._setLength(0); + } + + if (index === 0) { + this._promise0 = promise; + this._receiver0 = receiver; + if (typeof fulfill === "function") { + this._fulfillmentHandler0 = + domain === null ? fulfill : util.domainBind(domain, fulfill); + } + if (typeof reject === "function") { + this._rejectionHandler0 = + domain === null ? reject : util.domainBind(domain, reject); + } + } else { + var base = index * 4 - 4; + this[base + 2] = promise; + this[base + 3] = receiver; + if (typeof fulfill === "function") { + this[base + 0] = + domain === null ? fulfill : util.domainBind(domain, fulfill); + } + if (typeof reject === "function") { + this[base + 1] = + domain === null ? reject : util.domainBind(domain, reject); + } + } + this._setLength(index + 1); + return index; +}; + +Promise.prototype._proxy = function (proxyable, arg) { + this._addCallbacks(undefined, undefined, arg, proxyable, null); +}; + +Promise.prototype._resolveCallback = function(value, shouldBind) { + if (((this._bitField & 117506048) !== 0)) return; + if (value === this) + return this._rejectCallback(makeSelfResolutionError(), false); + var maybePromise = tryConvertToPromise(value, this); + if (!(maybePromise instanceof Promise)) return this._fulfill(value); + + if (shouldBind) this._propagateFrom(maybePromise, 2); + + var promise = maybePromise._target(); + + if (promise === this) { + this._reject(makeSelfResolutionError()); + return; + } + + var bitField = promise._bitField; + if (((bitField & 50397184) === 0)) { + var len = this._length(); + if (len > 0) promise._migrateCallback0(this); + for (var i = 1; i < len; ++i) { + promise._migrateCallbackAt(this, i); + } + this._setFollowing(); + this._setLength(0); + this._setFollowee(promise); + } else if (((bitField & 33554432) !== 0)) { + this._fulfill(promise._value()); + } else if (((bitField & 16777216) !== 0)) { + this._reject(promise._reason()); + } else { + var reason = new CancellationError("late cancellation observer"); + promise._attachExtraTrace(reason); + this._reject(reason); + } +}; + +Promise.prototype._rejectCallback = +function(reason, synchronous, ignoreNonErrorWarnings) { + var trace = util.ensureErrorObject(reason); + var hasStack = trace === reason; + if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) { + var message = "a promise was rejected with a non-error: " + + util.classString(reason); + this._warn(message, true); + } + this._attachExtraTrace(trace, synchronous ? hasStack : false); + this._reject(reason); +}; + +Promise.prototype._resolveFromExecutor = function (executor) { + if (executor === INTERNAL) return; + var promise = this; + this._captureStackTrace(); + this._pushContext(); + var synchronous = true; + var r = this._execute(executor, function(value) { + promise._resolveCallback(value); + }, function (reason) { + promise._rejectCallback(reason, synchronous); + }); + synchronous = false; + this._popContext(); + + if (r !== undefined) { + promise._rejectCallback(r, true); + } +}; + +Promise.prototype._settlePromiseFromHandler = function ( + handler, receiver, value, promise +) { + var bitField = promise._bitField; + if (((bitField & 65536) !== 0)) return; + promise._pushContext(); + var x; + if (receiver === APPLY) { + if (!value || typeof value.length !== "number") { + x = errorObj; + x.e = new TypeError("cannot .spread() a non-array: " + + util.classString(value)); + } else { + x = tryCatch(handler).apply(this._boundValue(), value); + } + } else { + x = tryCatch(handler).call(receiver, value); + } + var promiseCreated = promise._popContext(); + bitField = promise._bitField; + if (((bitField & 65536) !== 0)) return; + + if (x === NEXT_FILTER) { + promise._reject(value); + } else if (x === errorObj) { + promise._rejectCallback(x.e, false); + } else { + debug.checkForgottenReturns(x, promiseCreated, "", promise, this); + promise._resolveCallback(x); + } +}; + +Promise.prototype._target = function() { + var ret = this; + while (ret._isFollowing()) ret = ret._followee(); + return ret; +}; + +Promise.prototype._followee = function() { + return this._rejectionHandler0; +}; + +Promise.prototype._setFollowee = function(promise) { + this._rejectionHandler0 = promise; +}; + +Promise.prototype._settlePromise = function(promise, handler, receiver, value) { + var isPromise = promise instanceof Promise; + var bitField = this._bitField; + var asyncGuaranteed = ((bitField & 134217728) !== 0); + if (((bitField & 65536) !== 0)) { + if (isPromise) promise._invokeInternalOnCancel(); + + if (receiver instanceof PassThroughHandlerContext && + receiver.isFinallyHandler()) { + receiver.cancelPromise = promise; + if (tryCatch(handler).call(receiver, value) === errorObj) { + promise._reject(errorObj.e); + } + } else if (handler === reflectHandler) { + promise._fulfill(reflectHandler.call(receiver)); + } else if (receiver instanceof Proxyable) { + receiver._promiseCancelled(promise); + } else if (isPromise || promise instanceof PromiseArray) { + promise._cancel(); + } else { + receiver.cancel(); + } + } else if (typeof handler === "function") { + if (!isPromise) { + handler.call(receiver, value, promise); + } else { + if (asyncGuaranteed) promise._setAsyncGuaranteed(); + this._settlePromiseFromHandler(handler, receiver, value, promise); + } + } else if (receiver instanceof Proxyable) { + if (!receiver._isResolved()) { + if (((bitField & 33554432) !== 0)) { + receiver._promiseFulfilled(value, promise); + } else { + receiver._promiseRejected(value, promise); + } + } + } else if (isPromise) { + if (asyncGuaranteed) promise._setAsyncGuaranteed(); + if (((bitField & 33554432) !== 0)) { + promise._fulfill(value); + } else { + promise._reject(value); + } + } +}; + +Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) { + var handler = ctx.handler; + var promise = ctx.promise; + var receiver = ctx.receiver; + var value = ctx.value; + if (typeof handler === "function") { + if (!(promise instanceof Promise)) { + handler.call(receiver, value, promise); + } else { + this._settlePromiseFromHandler(handler, receiver, value, promise); + } + } else if (promise instanceof Promise) { + promise._reject(value); + } +}; + +Promise.prototype._settlePromiseCtx = function(ctx) { + this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value); +}; + +Promise.prototype._settlePromise0 = function(handler, value, bitField) { + var promise = this._promise0; + var receiver = this._receiverAt(0); + this._promise0 = undefined; + this._receiver0 = undefined; + this._settlePromise(promise, handler, receiver, value); +}; + +Promise.prototype._clearCallbackDataAtIndex = function(index) { + var base = index * 4 - 4; + this[base + 2] = + this[base + 3] = + this[base + 0] = + this[base + 1] = undefined; +}; + +Promise.prototype._fulfill = function (value) { + var bitField = this._bitField; + if (((bitField & 117506048) >>> 16)) return; + if (value === this) { + var err = makeSelfResolutionError(); + this._attachExtraTrace(err); + return this._reject(err); + } + this._setFulfilled(); + this._rejectionHandler0 = value; + + if ((bitField & 65535) > 0) { + if (((bitField & 134217728) !== 0)) { + this._settlePromises(); + } else { + async.settlePromises(this); + } + } +}; + +Promise.prototype._reject = function (reason) { + var bitField = this._bitField; + if (((bitField & 117506048) >>> 16)) return; + this._setRejected(); + this._fulfillmentHandler0 = reason; + + if (this._isFinal()) { + return async.fatalError(reason, util.isNode); + } + + if ((bitField & 65535) > 0) { + async.settlePromises(this); + } else { + this._ensurePossibleRejectionHandled(); + } +}; + +Promise.prototype._fulfillPromises = function (len, value) { + for (var i = 1; i < len; i++) { + var handler = this._fulfillmentHandlerAt(i); + var promise = this._promiseAt(i); + var receiver = this._receiverAt(i); + this._clearCallbackDataAtIndex(i); + this._settlePromise(promise, handler, receiver, value); + } +}; + +Promise.prototype._rejectPromises = function (len, reason) { + for (var i = 1; i < len; i++) { + var handler = this._rejectionHandlerAt(i); + var promise = this._promiseAt(i); + var receiver = this._receiverAt(i); + this._clearCallbackDataAtIndex(i); + this._settlePromise(promise, handler, receiver, reason); + } +}; + +Promise.prototype._settlePromises = function () { + var bitField = this._bitField; + var len = (bitField & 65535); + + if (len > 0) { + if (((bitField & 16842752) !== 0)) { + var reason = this._fulfillmentHandler0; + this._settlePromise0(this._rejectionHandler0, reason, bitField); + this._rejectPromises(len, reason); + } else { + var value = this._rejectionHandler0; + this._settlePromise0(this._fulfillmentHandler0, value, bitField); + this._fulfillPromises(len, value); + } + this._setLength(0); + } + this._clearCancellationData(); +}; + +Promise.prototype._settledValue = function() { + var bitField = this._bitField; + if (((bitField & 33554432) !== 0)) { + return this._rejectionHandler0; + } else if (((bitField & 16777216) !== 0)) { + return this._fulfillmentHandler0; + } +}; + +function deferResolve(v) {this.promise._resolveCallback(v);} +function deferReject(v) {this.promise._rejectCallback(v, false);} + +Promise.defer = Promise.pending = function() { + debug.deprecated("Promise.defer", "new Promise"); + var promise = new Promise(INTERNAL); + return { + promise: promise, + resolve: deferResolve, + reject: deferReject + }; +}; + +util.notEnumerableProp(Promise, + "_makeSelfResolutionError", + makeSelfResolutionError); + +require("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection, + debug); +require("./bind")(Promise, INTERNAL, tryConvertToPromise, debug); +require("./cancel")(Promise, PromiseArray, apiRejection, debug); +require("./direct_resolve")(Promise); +require("./synchronous_inspection")(Promise); +require("./join")( + Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain); +Promise.Promise = Promise; +Promise.version = "3.5.0"; +require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); +require('./call_get.js')(Promise); +require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug); +require('./timers.js')(Promise, INTERNAL, debug); +require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug); +require('./nodeify.js')(Promise); +require('./promisify.js')(Promise, INTERNAL); +require('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection); +require('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection); +require('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); +require('./settle.js')(Promise, PromiseArray, debug); +require('./some.js')(Promise, PromiseArray, apiRejection); +require('./filter.js')(Promise, INTERNAL); +require('./each.js')(Promise, INTERNAL); +require('./any.js')(Promise); + + util.toFastProperties(Promise); + util.toFastProperties(Promise.prototype); + function fillTypes(value) { + var p = new Promise(INTERNAL); + p._fulfillmentHandler0 = value; + p._rejectionHandler0 = value; + p._promise0 = value; + p._receiver0 = value; + } + // Complete slack tracking, opt out of field-type tracking and + // stabilize map + fillTypes({a: 1}); + fillTypes({b: 2}); + fillTypes({c: 3}); + fillTypes(1); + fillTypes(function(){}); + fillTypes(undefined); + fillTypes(false); + fillTypes(new Promise(INTERNAL)); + debug.setBounds(Async.firstLineError, util.lastLineError); + return Promise; + +}; diff --git a/node_modules/bluebird/js/release/promise_array.js b/node_modules/bluebird/js/release/promise_array.js new file mode 100644 index 0000000..0fb303e --- /dev/null +++ b/node_modules/bluebird/js/release/promise_array.js @@ -0,0 +1,185 @@ +"use strict"; +module.exports = function(Promise, INTERNAL, tryConvertToPromise, + apiRejection, Proxyable) { +var util = require("./util"); +var isArray = util.isArray; + +function toResolutionValue(val) { + switch(val) { + case -2: return []; + case -3: return {}; + case -6: return new Map(); + } +} + +function PromiseArray(values) { + var promise = this._promise = new Promise(INTERNAL); + if (values instanceof Promise) { + promise._propagateFrom(values, 3); + } + promise._setOnCancel(this); + this._values = values; + this._length = 0; + this._totalResolved = 0; + this._init(undefined, -2); +} +util.inherits(PromiseArray, Proxyable); + +PromiseArray.prototype.length = function () { + return this._length; +}; + +PromiseArray.prototype.promise = function () { + return this._promise; +}; + +PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { + var values = tryConvertToPromise(this._values, this._promise); + if (values instanceof Promise) { + values = values._target(); + var bitField = values._bitField; + ; + this._values = values; + + if (((bitField & 50397184) === 0)) { + this._promise._setAsyncGuaranteed(); + return values._then( + init, + this._reject, + undefined, + this, + resolveValueIfEmpty + ); + } else if (((bitField & 33554432) !== 0)) { + values = values._value(); + } else if (((bitField & 16777216) !== 0)) { + return this._reject(values._reason()); + } else { + return this._cancel(); + } + } + values = util.asArray(values); + if (values === null) { + var err = apiRejection( + "expecting an array or an iterable object but got " + util.classString(values)).reason(); + this._promise._rejectCallback(err, false); + return; + } + + if (values.length === 0) { + if (resolveValueIfEmpty === -5) { + this._resolveEmptyArray(); + } + else { + this._resolve(toResolutionValue(resolveValueIfEmpty)); + } + return; + } + this._iterate(values); +}; + +PromiseArray.prototype._iterate = function(values) { + var len = this.getActualLength(values.length); + this._length = len; + this._values = this.shouldCopyValues() ? new Array(len) : this._values; + var result = this._promise; + var isResolved = false; + var bitField = null; + for (var i = 0; i < len; ++i) { + var maybePromise = tryConvertToPromise(values[i], result); + + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + bitField = maybePromise._bitField; + } else { + bitField = null; + } + + if (isResolved) { + if (bitField !== null) { + maybePromise.suppressUnhandledRejections(); + } + } else if (bitField !== null) { + if (((bitField & 50397184) === 0)) { + maybePromise._proxy(this, i); + this._values[i] = maybePromise; + } else if (((bitField & 33554432) !== 0)) { + isResolved = this._promiseFulfilled(maybePromise._value(), i); + } else if (((bitField & 16777216) !== 0)) { + isResolved = this._promiseRejected(maybePromise._reason(), i); + } else { + isResolved = this._promiseCancelled(i); + } + } else { + isResolved = this._promiseFulfilled(maybePromise, i); + } + } + if (!isResolved) result._setAsyncGuaranteed(); +}; + +PromiseArray.prototype._isResolved = function () { + return this._values === null; +}; + +PromiseArray.prototype._resolve = function (value) { + this._values = null; + this._promise._fulfill(value); +}; + +PromiseArray.prototype._cancel = function() { + if (this._isResolved() || !this._promise._isCancellable()) return; + this._values = null; + this._promise._cancel(); +}; + +PromiseArray.prototype._reject = function (reason) { + this._values = null; + this._promise._rejectCallback(reason, false); +}; + +PromiseArray.prototype._promiseFulfilled = function (value, index) { + this._values[index] = value; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + this._resolve(this._values); + return true; + } + return false; +}; + +PromiseArray.prototype._promiseCancelled = function() { + this._cancel(); + return true; +}; + +PromiseArray.prototype._promiseRejected = function (reason) { + this._totalResolved++; + this._reject(reason); + return true; +}; + +PromiseArray.prototype._resultCancelled = function() { + if (this._isResolved()) return; + var values = this._values; + this._cancel(); + if (values instanceof Promise) { + values.cancel(); + } else { + for (var i = 0; i < values.length; ++i) { + if (values[i] instanceof Promise) { + values[i].cancel(); + } + } + } +}; + +PromiseArray.prototype.shouldCopyValues = function () { + return true; +}; + +PromiseArray.prototype.getActualLength = function (len) { + return len; +}; + +return PromiseArray; +}; diff --git a/node_modules/bluebird/js/release/promisify.js b/node_modules/bluebird/js/release/promisify.js new file mode 100644 index 0000000..aa98e5b --- /dev/null +++ b/node_modules/bluebird/js/release/promisify.js @@ -0,0 +1,314 @@ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var THIS = {}; +var util = require("./util"); +var nodebackForPromise = require("./nodeback"); +var withAppended = util.withAppended; +var maybeWrapAsError = util.maybeWrapAsError; +var canEvaluate = util.canEvaluate; +var TypeError = require("./errors").TypeError; +var defaultSuffix = "Async"; +var defaultPromisified = {__isPromisified__: true}; +var noCopyProps = [ + "arity", "length", + "name", + "arguments", + "caller", + "callee", + "prototype", + "__isPromisified__" +]; +var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$"); + +var defaultFilter = function(name) { + return util.isIdentifier(name) && + name.charAt(0) !== "_" && + name !== "constructor"; +}; + +function propsFilter(key) { + return !noCopyPropsPattern.test(key); +} + +function isPromisified(fn) { + try { + return fn.__isPromisified__ === true; + } + catch (e) { + return false; + } +} + +function hasPromisified(obj, key, suffix) { + var val = util.getDataPropertyOrDefault(obj, key + suffix, + defaultPromisified); + return val ? isPromisified(val) : false; +} +function checkValid(ret, suffix, suffixRegexp) { + for (var i = 0; i < ret.length; i += 2) { + var key = ret[i]; + if (suffixRegexp.test(key)) { + var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""); + for (var j = 0; j < ret.length; j += 2) { + if (ret[j] === keyWithoutAsyncSuffix) { + throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/MqrFmX\u000a" + .replace("%s", suffix)); + } + } + } + } +} + +function promisifiableMethods(obj, suffix, suffixRegexp, filter) { + var keys = util.inheritedDataKeys(obj); + var ret = []; + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var value = obj[key]; + var passesDefaultFilter = filter === defaultFilter + ? true : defaultFilter(key, value, obj); + if (typeof value === "function" && + !isPromisified(value) && + !hasPromisified(obj, key, suffix) && + filter(key, value, obj, passesDefaultFilter)) { + ret.push(key, value); + } + } + checkValid(ret, suffix, suffixRegexp); + return ret; +} + +var escapeIdentRegex = function(str) { + return str.replace(/([$])/, "\\$"); +}; + +var makeNodePromisifiedEval; +if (!false) { +var switchCaseArgumentOrder = function(likelyArgumentCount) { + var ret = [likelyArgumentCount]; + var min = Math.max(0, likelyArgumentCount - 1 - 3); + for(var i = likelyArgumentCount - 1; i >= min; --i) { + ret.push(i); + } + for(var i = likelyArgumentCount + 1; i <= 3; ++i) { + ret.push(i); + } + return ret; +}; + +var argumentSequence = function(argumentCount) { + return util.filledRange(argumentCount, "_arg", ""); +}; + +var parameterDeclaration = function(parameterCount) { + return util.filledRange( + Math.max(parameterCount, 3), "_arg", ""); +}; + +var parameterCount = function(fn) { + if (typeof fn.length === "number") { + return Math.max(Math.min(fn.length, 1023 + 1), 0); + } + return 0; +}; + +makeNodePromisifiedEval = +function(callback, receiver, originalName, fn, _, multiArgs) { + var newParameterCount = Math.max(0, parameterCount(fn) - 1); + var argumentOrder = switchCaseArgumentOrder(newParameterCount); + var shouldProxyThis = typeof callback === "string" || receiver === THIS; + + function generateCallForArgumentCount(count) { + var args = argumentSequence(count).join(", "); + var comma = count > 0 ? ", " : ""; + var ret; + if (shouldProxyThis) { + ret = "ret = callback.call(this, {{args}}, nodeback); break;\n"; + } else { + ret = receiver === undefined + ? "ret = callback({{args}}, nodeback); break;\n" + : "ret = callback.call(receiver, {{args}}, nodeback); break;\n"; + } + return ret.replace("{{args}}", args).replace(", ", comma); + } + + function generateArgumentSwitchCase() { + var ret = ""; + for (var i = 0; i < argumentOrder.length; ++i) { + ret += "case " + argumentOrder[i] +":" + + generateCallForArgumentCount(argumentOrder[i]); + } + + ret += " \n\ + default: \n\ + var args = new Array(len + 1); \n\ + var i = 0; \n\ + for (var i = 0; i < len; ++i) { \n\ + args[i] = arguments[i]; \n\ + } \n\ + args[i] = nodeback; \n\ + [CodeForCall] \n\ + break; \n\ + ".replace("[CodeForCall]", (shouldProxyThis + ? "ret = callback.apply(this, args);\n" + : "ret = callback.apply(receiver, args);\n")); + return ret; + } + + var getFunctionCode = typeof callback === "string" + ? ("this != null ? this['"+callback+"'] : fn") + : "fn"; + var body = "'use strict'; \n\ + var ret = function (Parameters) { \n\ + 'use strict'; \n\ + var len = arguments.length; \n\ + var promise = new Promise(INTERNAL); \n\ + promise._captureStackTrace(); \n\ + var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n\ + var ret; \n\ + var callback = tryCatch([GetFunctionCode]); \n\ + switch(len) { \n\ + [CodeForSwitchCase] \n\ + } \n\ + if (ret === errorObj) { \n\ + promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\ + } \n\ + if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n\ + return promise; \n\ + }; \n\ + notEnumerableProp(ret, '__isPromisified__', true); \n\ + return ret; \n\ + ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase()) + .replace("[GetFunctionCode]", getFunctionCode); + body = body.replace("Parameters", parameterDeclaration(newParameterCount)); + return new Function("Promise", + "fn", + "receiver", + "withAppended", + "maybeWrapAsError", + "nodebackForPromise", + "tryCatch", + "errorObj", + "notEnumerableProp", + "INTERNAL", + body)( + Promise, + fn, + receiver, + withAppended, + maybeWrapAsError, + nodebackForPromise, + util.tryCatch, + util.errorObj, + util.notEnumerableProp, + INTERNAL); +}; +} + +function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) { + var defaultThis = (function() {return this;})(); + var method = callback; + if (typeof method === "string") { + callback = fn; + } + function promisified() { + var _receiver = receiver; + if (receiver === THIS) _receiver = this; + var promise = new Promise(INTERNAL); + promise._captureStackTrace(); + var cb = typeof method === "string" && this !== defaultThis + ? this[method] : callback; + var fn = nodebackForPromise(promise, multiArgs); + try { + cb.apply(_receiver, withAppended(arguments, fn)); + } catch(e) { + promise._rejectCallback(maybeWrapAsError(e), true, true); + } + if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); + return promise; + } + util.notEnumerableProp(promisified, "__isPromisified__", true); + return promisified; +} + +var makeNodePromisified = canEvaluate + ? makeNodePromisifiedEval + : makeNodePromisifiedClosure; + +function promisifyAll(obj, suffix, filter, promisifier, multiArgs) { + var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"); + var methods = + promisifiableMethods(obj, suffix, suffixRegexp, filter); + + for (var i = 0, len = methods.length; i < len; i+= 2) { + var key = methods[i]; + var fn = methods[i+1]; + var promisifiedKey = key + suffix; + if (promisifier === makeNodePromisified) { + obj[promisifiedKey] = + makeNodePromisified(key, THIS, key, fn, suffix, multiArgs); + } else { + var promisified = promisifier(fn, function() { + return makeNodePromisified(key, THIS, key, + fn, suffix, multiArgs); + }); + util.notEnumerableProp(promisified, "__isPromisified__", true); + obj[promisifiedKey] = promisified; + } + } + util.toFastProperties(obj); + return obj; +} + +function promisify(callback, receiver, multiArgs) { + return makeNodePromisified(callback, receiver, undefined, + callback, null, multiArgs); +} + +Promise.promisify = function (fn, options) { + if (typeof fn !== "function") { + throw new TypeError("expecting a function but got " + util.classString(fn)); + } + if (isPromisified(fn)) { + return fn; + } + options = Object(options); + var receiver = options.context === undefined ? THIS : options.context; + var multiArgs = !!options.multiArgs; + var ret = promisify(fn, receiver, multiArgs); + util.copyDescriptors(fn, ret, propsFilter); + return ret; +}; + +Promise.promisifyAll = function (target, options) { + if (typeof target !== "function" && typeof target !== "object") { + throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + options = Object(options); + var multiArgs = !!options.multiArgs; + var suffix = options.suffix; + if (typeof suffix !== "string") suffix = defaultSuffix; + var filter = options.filter; + if (typeof filter !== "function") filter = defaultFilter; + var promisifier = options.promisifier; + if (typeof promisifier !== "function") promisifier = makeNodePromisified; + + if (!util.isIdentifier(suffix)) { + throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + + var keys = util.inheritedDataKeys(target); + for (var i = 0; i < keys.length; ++i) { + var value = target[keys[i]]; + if (keys[i] !== "constructor" && + util.isClass(value)) { + promisifyAll(value.prototype, suffix, filter, promisifier, + multiArgs); + promisifyAll(value, suffix, filter, promisifier, multiArgs); + } + } + + return promisifyAll(target, suffix, filter, promisifier, multiArgs); +}; +}; + diff --git a/node_modules/bluebird/js/release/props.js b/node_modules/bluebird/js/release/props.js new file mode 100644 index 0000000..6a34aaf --- /dev/null +++ b/node_modules/bluebird/js/release/props.js @@ -0,0 +1,118 @@ +"use strict"; +module.exports = function( + Promise, PromiseArray, tryConvertToPromise, apiRejection) { +var util = require("./util"); +var isObject = util.isObject; +var es5 = require("./es5"); +var Es6Map; +if (typeof Map === "function") Es6Map = Map; + +var mapToEntries = (function() { + var index = 0; + var size = 0; + + function extractEntry(value, key) { + this[index] = value; + this[index + size] = key; + index++; + } + + return function mapToEntries(map) { + size = map.size; + index = 0; + var ret = new Array(map.size * 2); + map.forEach(extractEntry, ret); + return ret; + }; +})(); + +var entriesToMap = function(entries) { + var ret = new Es6Map(); + var length = entries.length / 2 | 0; + for (var i = 0; i < length; ++i) { + var key = entries[length + i]; + var value = entries[i]; + ret.set(key, value); + } + return ret; +}; + +function PropertiesPromiseArray(obj) { + var isMap = false; + var entries; + if (Es6Map !== undefined && obj instanceof Es6Map) { + entries = mapToEntries(obj); + isMap = true; + } else { + var keys = es5.keys(obj); + var len = keys.length; + entries = new Array(len * 2); + for (var i = 0; i < len; ++i) { + var key = keys[i]; + entries[i] = obj[key]; + entries[i + len] = key; + } + } + this.constructor$(entries); + this._isMap = isMap; + this._init$(undefined, isMap ? -6 : -3); +} +util.inherits(PropertiesPromiseArray, PromiseArray); + +PropertiesPromiseArray.prototype._init = function () {}; + +PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { + this._values[index] = value; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + var val; + if (this._isMap) { + val = entriesToMap(this._values); + } else { + val = {}; + var keyOffset = this.length(); + for (var i = 0, len = this.length(); i < len; ++i) { + val[this._values[i + keyOffset]] = this._values[i]; + } + } + this._resolve(val); + return true; + } + return false; +}; + +PropertiesPromiseArray.prototype.shouldCopyValues = function () { + return false; +}; + +PropertiesPromiseArray.prototype.getActualLength = function (len) { + return len >> 1; +}; + +function props(promises) { + var ret; + var castValue = tryConvertToPromise(promises); + + if (!isObject(castValue)) { + return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } else if (castValue instanceof Promise) { + ret = castValue._then( + Promise.props, undefined, undefined, undefined, undefined); + } else { + ret = new PropertiesPromiseArray(castValue).promise(); + } + + if (castValue instanceof Promise) { + ret._propagateFrom(castValue, 2); + } + return ret; +} + +Promise.prototype.props = function () { + return props(this); +}; + +Promise.props = function (promises) { + return props(promises); +}; +}; diff --git a/node_modules/bluebird/js/release/queue.js b/node_modules/bluebird/js/release/queue.js new file mode 100644 index 0000000..ffd36fd --- /dev/null +++ b/node_modules/bluebird/js/release/queue.js @@ -0,0 +1,73 @@ +"use strict"; +function arrayMove(src, srcIndex, dst, dstIndex, len) { + for (var j = 0; j < len; ++j) { + dst[j + dstIndex] = src[j + srcIndex]; + src[j + srcIndex] = void 0; + } +} + +function Queue(capacity) { + this._capacity = capacity; + this._length = 0; + this._front = 0; +} + +Queue.prototype._willBeOverCapacity = function (size) { + return this._capacity < size; +}; + +Queue.prototype._pushOne = function (arg) { + var length = this.length(); + this._checkCapacity(length + 1); + var i = (this._front + length) & (this._capacity - 1); + this[i] = arg; + this._length = length + 1; +}; + +Queue.prototype.push = function (fn, receiver, arg) { + var length = this.length() + 3; + if (this._willBeOverCapacity(length)) { + this._pushOne(fn); + this._pushOne(receiver); + this._pushOne(arg); + return; + } + var j = this._front + length - 3; + this._checkCapacity(length); + var wrapMask = this._capacity - 1; + this[(j + 0) & wrapMask] = fn; + this[(j + 1) & wrapMask] = receiver; + this[(j + 2) & wrapMask] = arg; + this._length = length; +}; + +Queue.prototype.shift = function () { + var front = this._front, + ret = this[front]; + + this[front] = undefined; + this._front = (front + 1) & (this._capacity - 1); + this._length--; + return ret; +}; + +Queue.prototype.length = function () { + return this._length; +}; + +Queue.prototype._checkCapacity = function (size) { + if (this._capacity < size) { + this._resizeTo(this._capacity << 1); + } +}; + +Queue.prototype._resizeTo = function (capacity) { + var oldCapacity = this._capacity; + this._capacity = capacity; + var front = this._front; + var length = this._length; + var moveItemsCount = (front + length) & (oldCapacity - 1); + arrayMove(this, 0, this, oldCapacity, moveItemsCount); +}; + +module.exports = Queue; diff --git a/node_modules/bluebird/js/release/race.js b/node_modules/bluebird/js/release/race.js new file mode 100644 index 0000000..b862f46 --- /dev/null +++ b/node_modules/bluebird/js/release/race.js @@ -0,0 +1,49 @@ +"use strict"; +module.exports = function( + Promise, INTERNAL, tryConvertToPromise, apiRejection) { +var util = require("./util"); + +var raceLater = function (promise) { + return promise.then(function(array) { + return race(array, promise); + }); +}; + +function race(promises, parent) { + var maybePromise = tryConvertToPromise(promises); + + if (maybePromise instanceof Promise) { + return raceLater(maybePromise); + } else { + promises = util.asArray(promises); + if (promises === null) + return apiRejection("expecting an array or an iterable object but got " + util.classString(promises)); + } + + var ret = new Promise(INTERNAL); + if (parent !== undefined) { + ret._propagateFrom(parent, 3); + } + var fulfill = ret._fulfill; + var reject = ret._reject; + for (var i = 0, len = promises.length; i < len; ++i) { + var val = promises[i]; + + if (val === undefined && !(i in promises)) { + continue; + } + + Promise.cast(val)._then(fulfill, reject, undefined, ret, null); + } + return ret; +} + +Promise.race = function (promises) { + return race(promises, undefined); +}; + +Promise.prototype.race = function () { + return race(this, undefined); +}; + +}; diff --git a/node_modules/bluebird/js/release/reduce.js b/node_modules/bluebird/js/release/reduce.js new file mode 100644 index 0000000..26e2b1a --- /dev/null +++ b/node_modules/bluebird/js/release/reduce.js @@ -0,0 +1,172 @@ +"use strict"; +module.exports = function(Promise, + PromiseArray, + apiRejection, + tryConvertToPromise, + INTERNAL, + debug) { +var getDomain = Promise._getDomain; +var util = require("./util"); +var tryCatch = util.tryCatch; + +function ReductionPromiseArray(promises, fn, initialValue, _each) { + this.constructor$(promises); + var domain = getDomain(); + this._fn = domain === null ? fn : util.domainBind(domain, fn); + if (initialValue !== undefined) { + initialValue = Promise.resolve(initialValue); + initialValue._attachCancellationCallback(this); + } + this._initialValue = initialValue; + this._currentCancellable = null; + if(_each === INTERNAL) { + this._eachValues = Array(this._length); + } else if (_each === 0) { + this._eachValues = null; + } else { + this._eachValues = undefined; + } + this._promise._captureStackTrace(); + this._init$(undefined, -5); +} +util.inherits(ReductionPromiseArray, PromiseArray); + +ReductionPromiseArray.prototype._gotAccum = function(accum) { + if (this._eachValues !== undefined && + this._eachValues !== null && + accum !== INTERNAL) { + this._eachValues.push(accum); + } +}; + +ReductionPromiseArray.prototype._eachComplete = function(value) { + if (this._eachValues !== null) { + this._eachValues.push(value); + } + return this._eachValues; +}; + +ReductionPromiseArray.prototype._init = function() {}; + +ReductionPromiseArray.prototype._resolveEmptyArray = function() { + this._resolve(this._eachValues !== undefined ? this._eachValues + : this._initialValue); +}; + +ReductionPromiseArray.prototype.shouldCopyValues = function () { + return false; +}; + +ReductionPromiseArray.prototype._resolve = function(value) { + this._promise._resolveCallback(value); + this._values = null; +}; + +ReductionPromiseArray.prototype._resultCancelled = function(sender) { + if (sender === this._initialValue) return this._cancel(); + if (this._isResolved()) return; + this._resultCancelled$(); + if (this._currentCancellable instanceof Promise) { + this._currentCancellable.cancel(); + } + if (this._initialValue instanceof Promise) { + this._initialValue.cancel(); + } +}; + +ReductionPromiseArray.prototype._iterate = function (values) { + this._values = values; + var value; + var i; + var length = values.length; + if (this._initialValue !== undefined) { + value = this._initialValue; + i = 0; + } else { + value = Promise.resolve(values[0]); + i = 1; + } + + this._currentCancellable = value; + + if (!value.isRejected()) { + for (; i < length; ++i) { + var ctx = { + accum: null, + value: values[i], + index: i, + length: length, + array: this + }; + value = value._then(gotAccum, undefined, undefined, ctx, undefined); + } + } + + if (this._eachValues !== undefined) { + value = value + ._then(this._eachComplete, undefined, undefined, this, undefined); + } + value._then(completed, completed, undefined, value, this); +}; + +Promise.prototype.reduce = function (fn, initialValue) { + return reduce(this, fn, initialValue, null); +}; + +Promise.reduce = function (promises, fn, initialValue, _each) { + return reduce(promises, fn, initialValue, _each); +}; + +function completed(valueOrReason, array) { + if (this.isFulfilled()) { + array._resolve(valueOrReason); + } else { + array._reject(valueOrReason); + } +} + +function reduce(promises, fn, initialValue, _each) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + var array = new ReductionPromiseArray(promises, fn, initialValue, _each); + return array.promise(); +} + +function gotAccum(accum) { + this.accum = accum; + this.array._gotAccum(accum); + var value = tryConvertToPromise(this.value, this.array._promise); + if (value instanceof Promise) { + this.array._currentCancellable = value; + return value._then(gotValue, undefined, undefined, this, undefined); + } else { + return gotValue.call(this, value); + } +} + +function gotValue(value) { + var array = this.array; + var promise = array._promise; + var fn = tryCatch(array._fn); + promise._pushContext(); + var ret; + if (array._eachValues !== undefined) { + ret = fn.call(promise._boundValue(), value, this.index, this.length); + } else { + ret = fn.call(promise._boundValue(), + this.accum, value, this.index, this.length); + } + if (ret instanceof Promise) { + array._currentCancellable = ret; + } + var promiseCreated = promise._popContext(); + debug.checkForgottenReturns( + ret, + promiseCreated, + array._eachValues !== undefined ? "Promise.each" : "Promise.reduce", + promise + ); + return ret; +} +}; diff --git a/node_modules/bluebird/js/release/schedule.js b/node_modules/bluebird/js/release/schedule.js new file mode 100644 index 0000000..f70df9f --- /dev/null +++ b/node_modules/bluebird/js/release/schedule.js @@ -0,0 +1,61 @@ +"use strict"; +var util = require("./util"); +var schedule; +var noAsyncScheduler = function() { + throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a"); +}; +var NativePromise = util.getNativePromise(); +if (util.isNode && typeof MutationObserver === "undefined") { + var GlobalSetImmediate = global.setImmediate; + var ProcessNextTick = process.nextTick; + schedule = util.isRecentNode + ? function(fn) { GlobalSetImmediate.call(global, fn); } + : function(fn) { ProcessNextTick.call(process, fn); }; +} else if (typeof NativePromise === "function" && + typeof NativePromise.resolve === "function") { + var nativePromise = NativePromise.resolve(); + schedule = function(fn) { + nativePromise.then(fn); + }; +} else if ((typeof MutationObserver !== "undefined") && + !(typeof window !== "undefined" && + window.navigator && + (window.navigator.standalone || window.cordova))) { + schedule = (function() { + var div = document.createElement("div"); + var opts = {attributes: true}; + var toggleScheduled = false; + var div2 = document.createElement("div"); + var o2 = new MutationObserver(function() { + div.classList.toggle("foo"); + toggleScheduled = false; + }); + o2.observe(div2, opts); + + var scheduleToggle = function() { + if (toggleScheduled) return; + toggleScheduled = true; + div2.classList.toggle("foo"); + }; + + return function schedule(fn) { + var o = new MutationObserver(function() { + o.disconnect(); + fn(); + }); + o.observe(div, opts); + scheduleToggle(); + }; + })(); +} else if (typeof setImmediate !== "undefined") { + schedule = function (fn) { + setImmediate(fn); + }; +} else if (typeof setTimeout !== "undefined") { + schedule = function (fn) { + setTimeout(fn, 0); + }; +} else { + schedule = noAsyncScheduler; +} +module.exports = schedule; diff --git a/node_modules/bluebird/js/release/settle.js b/node_modules/bluebird/js/release/settle.js new file mode 100644 index 0000000..fade3a1 --- /dev/null +++ b/node_modules/bluebird/js/release/settle.js @@ -0,0 +1,43 @@ +"use strict"; +module.exports = + function(Promise, PromiseArray, debug) { +var PromiseInspection = Promise.PromiseInspection; +var util = require("./util"); + +function SettledPromiseArray(values) { + this.constructor$(values); +} +util.inherits(SettledPromiseArray, PromiseArray); + +SettledPromiseArray.prototype._promiseResolved = function (index, inspection) { + this._values[index] = inspection; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + this._resolve(this._values); + return true; + } + return false; +}; + +SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { + var ret = new PromiseInspection(); + ret._bitField = 33554432; + ret._settledValueField = value; + return this._promiseResolved(index, ret); +}; +SettledPromiseArray.prototype._promiseRejected = function (reason, index) { + var ret = new PromiseInspection(); + ret._bitField = 16777216; + ret._settledValueField = reason; + return this._promiseResolved(index, ret); +}; + +Promise.settle = function (promises) { + debug.deprecated(".settle()", ".reflect()"); + return new SettledPromiseArray(promises).promise(); +}; + +Promise.prototype.settle = function () { + return Promise.settle(this); +}; +}; diff --git a/node_modules/bluebird/js/release/some.js b/node_modules/bluebird/js/release/some.js new file mode 100644 index 0000000..400d852 --- /dev/null +++ b/node_modules/bluebird/js/release/some.js @@ -0,0 +1,148 @@ +"use strict"; +module.exports = +function(Promise, PromiseArray, apiRejection) { +var util = require("./util"); +var RangeError = require("./errors").RangeError; +var AggregateError = require("./errors").AggregateError; +var isArray = util.isArray; +var CANCELLATION = {}; + + +function SomePromiseArray(values) { + this.constructor$(values); + this._howMany = 0; + this._unwrap = false; + this._initialized = false; +} +util.inherits(SomePromiseArray, PromiseArray); + +SomePromiseArray.prototype._init = function () { + if (!this._initialized) { + return; + } + if (this._howMany === 0) { + this._resolve([]); + return; + } + this._init$(undefined, -5); + var isArrayResolved = isArray(this._values); + if (!this._isResolved() && + isArrayResolved && + this._howMany > this._canPossiblyFulfill()) { + this._reject(this._getRangeError(this.length())); + } +}; + +SomePromiseArray.prototype.init = function () { + this._initialized = true; + this._init(); +}; + +SomePromiseArray.prototype.setUnwrap = function () { + this._unwrap = true; +}; + +SomePromiseArray.prototype.howMany = function () { + return this._howMany; +}; + +SomePromiseArray.prototype.setHowMany = function (count) { + this._howMany = count; +}; + +SomePromiseArray.prototype._promiseFulfilled = function (value) { + this._addFulfilled(value); + if (this._fulfilled() === this.howMany()) { + this._values.length = this.howMany(); + if (this.howMany() === 1 && this._unwrap) { + this._resolve(this._values[0]); + } else { + this._resolve(this._values); + } + return true; + } + return false; + +}; +SomePromiseArray.prototype._promiseRejected = function (reason) { + this._addRejected(reason); + return this._checkOutcome(); +}; + +SomePromiseArray.prototype._promiseCancelled = function () { + if (this._values instanceof Promise || this._values == null) { + return this._cancel(); + } + this._addRejected(CANCELLATION); + return this._checkOutcome(); +}; + +SomePromiseArray.prototype._checkOutcome = function() { + if (this.howMany() > this._canPossiblyFulfill()) { + var e = new AggregateError(); + for (var i = this.length(); i < this._values.length; ++i) { + if (this._values[i] !== CANCELLATION) { + e.push(this._values[i]); + } + } + if (e.length > 0) { + this._reject(e); + } else { + this._cancel(); + } + return true; + } + return false; +}; + +SomePromiseArray.prototype._fulfilled = function () { + return this._totalResolved; +}; + +SomePromiseArray.prototype._rejected = function () { + return this._values.length - this.length(); +}; + +SomePromiseArray.prototype._addRejected = function (reason) { + this._values.push(reason); +}; + +SomePromiseArray.prototype._addFulfilled = function (value) { + this._values[this._totalResolved++] = value; +}; + +SomePromiseArray.prototype._canPossiblyFulfill = function () { + return this.length() - this._rejected(); +}; + +SomePromiseArray.prototype._getRangeError = function (count) { + var message = "Input array must contain at least " + + this._howMany + " items but contains only " + count + " items"; + return new RangeError(message); +}; + +SomePromiseArray.prototype._resolveEmptyArray = function () { + this._reject(this._getRangeError(0)); +}; + +function some(promises, howMany) { + if ((howMany | 0) !== howMany || howMany < 0) { + return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + var ret = new SomePromiseArray(promises); + var promise = ret.promise(); + ret.setHowMany(howMany); + ret.init(); + return promise; +} + +Promise.some = function (promises, howMany) { + return some(promises, howMany); +}; + +Promise.prototype.some = function (howMany) { + return some(this, howMany); +}; + +Promise._SomePromiseArray = SomePromiseArray; +}; diff --git a/node_modules/bluebird/js/release/synchronous_inspection.js b/node_modules/bluebird/js/release/synchronous_inspection.js new file mode 100644 index 0000000..9c49d2e --- /dev/null +++ b/node_modules/bluebird/js/release/synchronous_inspection.js @@ -0,0 +1,103 @@ +"use strict"; +module.exports = function(Promise) { +function PromiseInspection(promise) { + if (promise !== undefined) { + promise = promise._target(); + this._bitField = promise._bitField; + this._settledValueField = promise._isFateSealed() + ? promise._settledValue() : undefined; + } + else { + this._bitField = 0; + this._settledValueField = undefined; + } +} + +PromiseInspection.prototype._settledValue = function() { + return this._settledValueField; +}; + +var value = PromiseInspection.prototype.value = function () { + if (!this.isFulfilled()) { + throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + return this._settledValue(); +}; + +var reason = PromiseInspection.prototype.error = +PromiseInspection.prototype.reason = function () { + if (!this.isRejected()) { + throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + return this._settledValue(); +}; + +var isFulfilled = PromiseInspection.prototype.isFulfilled = function() { + return (this._bitField & 33554432) !== 0; +}; + +var isRejected = PromiseInspection.prototype.isRejected = function () { + return (this._bitField & 16777216) !== 0; +}; + +var isPending = PromiseInspection.prototype.isPending = function () { + return (this._bitField & 50397184) === 0; +}; + +var isResolved = PromiseInspection.prototype.isResolved = function () { + return (this._bitField & 50331648) !== 0; +}; + +PromiseInspection.prototype.isCancelled = function() { + return (this._bitField & 8454144) !== 0; +}; + +Promise.prototype.__isCancelled = function() { + return (this._bitField & 65536) === 65536; +}; + +Promise.prototype._isCancelled = function() { + return this._target().__isCancelled(); +}; + +Promise.prototype.isCancelled = function() { + return (this._target()._bitField & 8454144) !== 0; +}; + +Promise.prototype.isPending = function() { + return isPending.call(this._target()); +}; + +Promise.prototype.isRejected = function() { + return isRejected.call(this._target()); +}; + +Promise.prototype.isFulfilled = function() { + return isFulfilled.call(this._target()); +}; + +Promise.prototype.isResolved = function() { + return isResolved.call(this._target()); +}; + +Promise.prototype.value = function() { + return value.call(this._target()); +}; + +Promise.prototype.reason = function() { + var target = this._target(); + target._unsetRejectionIsUnhandled(); + return reason.call(target); +}; + +Promise.prototype._value = function() { + return this._settledValue(); +}; + +Promise.prototype._reason = function() { + this._unsetRejectionIsUnhandled(); + return this._settledValue(); +}; + +Promise.PromiseInspection = PromiseInspection; +}; diff --git a/node_modules/bluebird/js/release/thenables.js b/node_modules/bluebird/js/release/thenables.js new file mode 100644 index 0000000..d6ab9aa --- /dev/null +++ b/node_modules/bluebird/js/release/thenables.js @@ -0,0 +1,86 @@ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var util = require("./util"); +var errorObj = util.errorObj; +var isObject = util.isObject; + +function tryConvertToPromise(obj, context) { + if (isObject(obj)) { + if (obj instanceof Promise) return obj; + var then = getThen(obj); + if (then === errorObj) { + if (context) context._pushContext(); + var ret = Promise.reject(then.e); + if (context) context._popContext(); + return ret; + } else if (typeof then === "function") { + if (isAnyBluebirdPromise(obj)) { + var ret = new Promise(INTERNAL); + obj._then( + ret._fulfill, + ret._reject, + undefined, + ret, + null + ); + return ret; + } + return doThenable(obj, then, context); + } + } + return obj; +} + +function doGetThen(obj) { + return obj.then; +} + +function getThen(obj) { + try { + return doGetThen(obj); + } catch (e) { + errorObj.e = e; + return errorObj; + } +} + +var hasProp = {}.hasOwnProperty; +function isAnyBluebirdPromise(obj) { + try { + return hasProp.call(obj, "_promise0"); + } catch (e) { + return false; + } +} + +function doThenable(x, then, context) { + var promise = new Promise(INTERNAL); + var ret = promise; + if (context) context._pushContext(); + promise._captureStackTrace(); + if (context) context._popContext(); + var synchronous = true; + var result = util.tryCatch(then).call(x, resolve, reject); + synchronous = false; + + if (promise && result === errorObj) { + promise._rejectCallback(result.e, true, true); + promise = null; + } + + function resolve(value) { + if (!promise) return; + promise._resolveCallback(value); + promise = null; + } + + function reject(reason) { + if (!promise) return; + promise._rejectCallback(reason, synchronous, true); + promise = null; + } + return ret; +} + +return tryConvertToPromise; +}; diff --git a/node_modules/bluebird/js/release/timers.js b/node_modules/bluebird/js/release/timers.js new file mode 100644 index 0000000..cb8f1f4 --- /dev/null +++ b/node_modules/bluebird/js/release/timers.js @@ -0,0 +1,93 @@ +"use strict"; +module.exports = function(Promise, INTERNAL, debug) { +var util = require("./util"); +var TimeoutError = Promise.TimeoutError; + +function HandleWrapper(handle) { + this.handle = handle; +} + +HandleWrapper.prototype._resultCancelled = function() { + clearTimeout(this.handle); +}; + +var afterValue = function(value) { return delay(+this).thenReturn(value); }; +var delay = Promise.delay = function (ms, value) { + var ret; + var handle; + if (value !== undefined) { + ret = Promise.resolve(value) + ._then(afterValue, null, null, ms, undefined); + if (debug.cancellation() && value instanceof Promise) { + ret._setOnCancel(value); + } + } else { + ret = new Promise(INTERNAL); + handle = setTimeout(function() { ret._fulfill(); }, +ms); + if (debug.cancellation()) { + ret._setOnCancel(new HandleWrapper(handle)); + } + ret._captureStackTrace(); + } + ret._setAsyncGuaranteed(); + return ret; +}; + +Promise.prototype.delay = function (ms) { + return delay(ms, this); +}; + +var afterTimeout = function (promise, message, parent) { + var err; + if (typeof message !== "string") { + if (message instanceof Error) { + err = message; + } else { + err = new TimeoutError("operation timed out"); + } + } else { + err = new TimeoutError(message); + } + util.markAsOriginatingFromRejection(err); + promise._attachExtraTrace(err); + promise._reject(err); + + if (parent != null) { + parent.cancel(); + } +}; + +function successClear(value) { + clearTimeout(this.handle); + return value; +} + +function failureClear(reason) { + clearTimeout(this.handle); + throw reason; +} + +Promise.prototype.timeout = function (ms, message) { + ms = +ms; + var ret, parent; + + var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() { + if (ret.isPending()) { + afterTimeout(ret, message, parent); + } + }, ms)); + + if (debug.cancellation()) { + parent = this.then(); + ret = parent._then(successClear, failureClear, + undefined, handleWrapper, undefined); + ret._setOnCancel(handleWrapper); + } else { + ret = this._then(successClear, failureClear, + undefined, handleWrapper, undefined); + } + + return ret; +}; + +}; diff --git a/node_modules/bluebird/js/release/using.js b/node_modules/bluebird/js/release/using.js new file mode 100644 index 0000000..65de531 --- /dev/null +++ b/node_modules/bluebird/js/release/using.js @@ -0,0 +1,226 @@ +"use strict"; +module.exports = function (Promise, apiRejection, tryConvertToPromise, + createContext, INTERNAL, debug) { + var util = require("./util"); + var TypeError = require("./errors").TypeError; + var inherits = require("./util").inherits; + var errorObj = util.errorObj; + var tryCatch = util.tryCatch; + var NULL = {}; + + function thrower(e) { + setTimeout(function(){throw e;}, 0); + } + + function castPreservingDisposable(thenable) { + var maybePromise = tryConvertToPromise(thenable); + if (maybePromise !== thenable && + typeof thenable._isDisposable === "function" && + typeof thenable._getDisposer === "function" && + thenable._isDisposable()) { + maybePromise._setDisposable(thenable._getDisposer()); + } + return maybePromise; + } + function dispose(resources, inspection) { + var i = 0; + var len = resources.length; + var ret = new Promise(INTERNAL); + function iterator() { + if (i >= len) return ret._fulfill(); + var maybePromise = castPreservingDisposable(resources[i++]); + if (maybePromise instanceof Promise && + maybePromise._isDisposable()) { + try { + maybePromise = tryConvertToPromise( + maybePromise._getDisposer().tryDispose(inspection), + resources.promise); + } catch (e) { + return thrower(e); + } + if (maybePromise instanceof Promise) { + return maybePromise._then(iterator, thrower, + null, null, null); + } + } + iterator(); + } + iterator(); + return ret; + } + + function Disposer(data, promise, context) { + this._data = data; + this._promise = promise; + this._context = context; + } + + Disposer.prototype.data = function () { + return this._data; + }; + + Disposer.prototype.promise = function () { + return this._promise; + }; + + Disposer.prototype.resource = function () { + if (this.promise().isFulfilled()) { + return this.promise().value(); + } + return NULL; + }; + + Disposer.prototype.tryDispose = function(inspection) { + var resource = this.resource(); + var context = this._context; + if (context !== undefined) context._pushContext(); + var ret = resource !== NULL + ? this.doDispose(resource, inspection) : null; + if (context !== undefined) context._popContext(); + this._promise._unsetDisposable(); + this._data = null; + return ret; + }; + + Disposer.isDisposer = function (d) { + return (d != null && + typeof d.resource === "function" && + typeof d.tryDispose === "function"); + }; + + function FunctionDisposer(fn, promise, context) { + this.constructor$(fn, promise, context); + } + inherits(FunctionDisposer, Disposer); + + FunctionDisposer.prototype.doDispose = function (resource, inspection) { + var fn = this.data(); + return fn.call(resource, resource, inspection); + }; + + function maybeUnwrapDisposer(value) { + if (Disposer.isDisposer(value)) { + this.resources[this.index]._setDisposable(value); + return value.promise(); + } + return value; + } + + function ResourceList(length) { + this.length = length; + this.promise = null; + this[length-1] = null; + } + + ResourceList.prototype._resultCancelled = function() { + var len = this.length; + for (var i = 0; i < len; ++i) { + var item = this[i]; + if (item instanceof Promise) { + item.cancel(); + } + } + }; + + Promise.using = function () { + var len = arguments.length; + if (len < 2) return apiRejection( + "you must pass at least 2 arguments to Promise.using"); + var fn = arguments[len - 1]; + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + var input; + var spreadArgs = true; + if (len === 2 && Array.isArray(arguments[0])) { + input = arguments[0]; + len = input.length; + spreadArgs = false; + } else { + input = arguments; + len--; + } + var resources = new ResourceList(len); + for (var i = 0; i < len; ++i) { + var resource = input[i]; + if (Disposer.isDisposer(resource)) { + var disposer = resource; + resource = resource.promise(); + resource._setDisposable(disposer); + } else { + var maybePromise = tryConvertToPromise(resource); + if (maybePromise instanceof Promise) { + resource = + maybePromise._then(maybeUnwrapDisposer, null, null, { + resources: resources, + index: i + }, undefined); + } + } + resources[i] = resource; + } + + var reflectedResources = new Array(resources.length); + for (var i = 0; i < reflectedResources.length; ++i) { + reflectedResources[i] = Promise.resolve(resources[i]).reflect(); + } + + var resultPromise = Promise.all(reflectedResources) + .then(function(inspections) { + for (var i = 0; i < inspections.length; ++i) { + var inspection = inspections[i]; + if (inspection.isRejected()) { + errorObj.e = inspection.error(); + return errorObj; + } else if (!inspection.isFulfilled()) { + resultPromise.cancel(); + return; + } + inspections[i] = inspection.value(); + } + promise._pushContext(); + + fn = tryCatch(fn); + var ret = spreadArgs + ? fn.apply(undefined, inspections) : fn(inspections); + var promiseCreated = promise._popContext(); + debug.checkForgottenReturns( + ret, promiseCreated, "Promise.using", promise); + return ret; + }); + + var promise = resultPromise.lastly(function() { + var inspection = new Promise.PromiseInspection(resultPromise); + return dispose(resources, inspection); + }); + resources.promise = promise; + promise._setOnCancel(resources); + return promise; + }; + + Promise.prototype._setDisposable = function (disposer) { + this._bitField = this._bitField | 131072; + this._disposer = disposer; + }; + + Promise.prototype._isDisposable = function () { + return (this._bitField & 131072) > 0; + }; + + Promise.prototype._getDisposer = function () { + return this._disposer; + }; + + Promise.prototype._unsetDisposable = function () { + this._bitField = this._bitField & (~131072); + this._disposer = undefined; + }; + + Promise.prototype.disposer = function (fn) { + if (typeof fn === "function") { + return new FunctionDisposer(fn, this, createContext()); + } + throw new TypeError(); + }; + +}; diff --git a/node_modules/bluebird/js/release/util.js b/node_modules/bluebird/js/release/util.js new file mode 100644 index 0000000..84c28ec --- /dev/null +++ b/node_modules/bluebird/js/release/util.js @@ -0,0 +1,379 @@ +"use strict"; +var es5 = require("./es5"); +var canEvaluate = typeof navigator == "undefined"; + +var errorObj = {e: {}}; +var tryCatchTarget; +var globalObject = typeof self !== "undefined" ? self : + typeof window !== "undefined" ? window : + typeof global !== "undefined" ? global : + this !== undefined ? this : null; + +function tryCatcher() { + try { + var target = tryCatchTarget; + tryCatchTarget = null; + return target.apply(this, arguments); + } catch (e) { + errorObj.e = e; + return errorObj; + } +} +function tryCatch(fn) { + tryCatchTarget = fn; + return tryCatcher; +} + +var inherits = function(Child, Parent) { + var hasProp = {}.hasOwnProperty; + + function T() { + this.constructor = Child; + this.constructor$ = Parent; + for (var propertyName in Parent.prototype) { + if (hasProp.call(Parent.prototype, propertyName) && + propertyName.charAt(propertyName.length-1) !== "$" + ) { + this[propertyName + "$"] = Parent.prototype[propertyName]; + } + } + } + T.prototype = Parent.prototype; + Child.prototype = new T(); + return Child.prototype; +}; + + +function isPrimitive(val) { + return val == null || val === true || val === false || + typeof val === "string" || typeof val === "number"; + +} + +function isObject(value) { + return typeof value === "function" || + typeof value === "object" && value !== null; +} + +function maybeWrapAsError(maybeError) { + if (!isPrimitive(maybeError)) return maybeError; + + return new Error(safeToString(maybeError)); +} + +function withAppended(target, appendee) { + var len = target.length; + var ret = new Array(len + 1); + var i; + for (i = 0; i < len; ++i) { + ret[i] = target[i]; + } + ret[i] = appendee; + return ret; +} + +function getDataPropertyOrDefault(obj, key, defaultValue) { + if (es5.isES5) { + var desc = Object.getOwnPropertyDescriptor(obj, key); + + if (desc != null) { + return desc.get == null && desc.set == null + ? desc.value + : defaultValue; + } + } else { + return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined; + } +} + +function notEnumerableProp(obj, name, value) { + if (isPrimitive(obj)) return obj; + var descriptor = { + value: value, + configurable: true, + enumerable: false, + writable: true + }; + es5.defineProperty(obj, name, descriptor); + return obj; +} + +function thrower(r) { + throw r; +} + +var inheritedDataKeys = (function() { + var excludedPrototypes = [ + Array.prototype, + Object.prototype, + Function.prototype + ]; + + var isExcludedProto = function(val) { + for (var i = 0; i < excludedPrototypes.length; ++i) { + if (excludedPrototypes[i] === val) { + return true; + } + } + return false; + }; + + if (es5.isES5) { + var getKeys = Object.getOwnPropertyNames; + return function(obj) { + var ret = []; + var visitedKeys = Object.create(null); + while (obj != null && !isExcludedProto(obj)) { + var keys; + try { + keys = getKeys(obj); + } catch (e) { + return ret; + } + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (visitedKeys[key]) continue; + visitedKeys[key] = true; + var desc = Object.getOwnPropertyDescriptor(obj, key); + if (desc != null && desc.get == null && desc.set == null) { + ret.push(key); + } + } + obj = es5.getPrototypeOf(obj); + } + return ret; + }; + } else { + var hasProp = {}.hasOwnProperty; + return function(obj) { + if (isExcludedProto(obj)) return []; + var ret = []; + + /*jshint forin:false */ + enumeration: for (var key in obj) { + if (hasProp.call(obj, key)) { + ret.push(key); + } else { + for (var i = 0; i < excludedPrototypes.length; ++i) { + if (hasProp.call(excludedPrototypes[i], key)) { + continue enumeration; + } + } + ret.push(key); + } + } + return ret; + }; + } + +})(); + +var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/; +function isClass(fn) { + try { + if (typeof fn === "function") { + var keys = es5.names(fn.prototype); + + var hasMethods = es5.isES5 && keys.length > 1; + var hasMethodsOtherThanConstructor = keys.length > 0 && + !(keys.length === 1 && keys[0] === "constructor"); + var hasThisAssignmentAndStaticMethods = + thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0; + + if (hasMethods || hasMethodsOtherThanConstructor || + hasThisAssignmentAndStaticMethods) { + return true; + } + } + return false; + } catch (e) { + return false; + } +} + +function toFastProperties(obj) { + /*jshint -W027,-W055,-W031*/ + function FakeConstructor() {} + FakeConstructor.prototype = obj; + var l = 8; + while (l--) new FakeConstructor(); + return obj; + eval(obj); +} + +var rident = /^[a-z$_][a-z$_0-9]*$/i; +function isIdentifier(str) { + return rident.test(str); +} + +function filledRange(count, prefix, suffix) { + var ret = new Array(count); + for(var i = 0; i < count; ++i) { + ret[i] = prefix + i + suffix; + } + return ret; +} + +function safeToString(obj) { + try { + return obj + ""; + } catch (e) { + return "[no string representation]"; + } +} + +function isError(obj) { + return obj !== null && + typeof obj === "object" && + typeof obj.message === "string" && + typeof obj.name === "string"; +} + +function markAsOriginatingFromRejection(e) { + try { + notEnumerableProp(e, "isOperational", true); + } + catch(ignore) {} +} + +function originatesFromRejection(e) { + if (e == null) return false; + return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) || + e["isOperational"] === true); +} + +function canAttachTrace(obj) { + return isError(obj) && es5.propertyIsWritable(obj, "stack"); +} + +var ensureErrorObject = (function() { + if (!("stack" in new Error())) { + return function(value) { + if (canAttachTrace(value)) return value; + try {throw new Error(safeToString(value));} + catch(err) {return err;} + }; + } else { + return function(value) { + if (canAttachTrace(value)) return value; + return new Error(safeToString(value)); + }; + } +})(); + +function classString(obj) { + return {}.toString.call(obj); +} + +function copyDescriptors(from, to, filter) { + var keys = es5.names(from); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (filter(key)) { + try { + es5.defineProperty(to, key, es5.getDescriptor(from, key)); + } catch (ignore) {} + } + } +} + +var asArray = function(v) { + if (es5.isArray(v)) { + return v; + } + return null; +}; + +if (typeof Symbol !== "undefined" && Symbol.iterator) { + var ArrayFrom = typeof Array.from === "function" ? function(v) { + return Array.from(v); + } : function(v) { + var ret = []; + var it = v[Symbol.iterator](); + var itResult; + while (!((itResult = it.next()).done)) { + ret.push(itResult.value); + } + return ret; + }; + + asArray = function(v) { + if (es5.isArray(v)) { + return v; + } else if (v != null && typeof v[Symbol.iterator] === "function") { + return ArrayFrom(v); + } + return null; + }; +} + +var isNode = typeof process !== "undefined" && + classString(process).toLowerCase() === "[object process]"; + +var hasEnvVariables = typeof process !== "undefined" && + typeof process.env !== "undefined"; + +function env(key) { + return hasEnvVariables ? process.env[key] : undefined; +} + +function getNativePromise() { + if (typeof Promise === "function") { + try { + var promise = new Promise(function(){}); + if ({}.toString.call(promise) === "[object Promise]") { + return Promise; + } + } catch (e) {} + } +} + +function domainBind(self, cb) { + return self.bind(cb); +} + +var ret = { + isClass: isClass, + isIdentifier: isIdentifier, + inheritedDataKeys: inheritedDataKeys, + getDataPropertyOrDefault: getDataPropertyOrDefault, + thrower: thrower, + isArray: es5.isArray, + asArray: asArray, + notEnumerableProp: notEnumerableProp, + isPrimitive: isPrimitive, + isObject: isObject, + isError: isError, + canEvaluate: canEvaluate, + errorObj: errorObj, + tryCatch: tryCatch, + inherits: inherits, + withAppended: withAppended, + maybeWrapAsError: maybeWrapAsError, + toFastProperties: toFastProperties, + filledRange: filledRange, + toString: safeToString, + canAttachTrace: canAttachTrace, + ensureErrorObject: ensureErrorObject, + originatesFromRejection: originatesFromRejection, + markAsOriginatingFromRejection: markAsOriginatingFromRejection, + classString: classString, + copyDescriptors: copyDescriptors, + hasDevTools: typeof chrome !== "undefined" && chrome && + typeof chrome.loadTimes === "function", + isNode: isNode, + hasEnvVariables: hasEnvVariables, + env: env, + global: globalObject, + getNativePromise: getNativePromise, + domainBind: domainBind +}; +ret.isRecentNode = ret.isNode && (function() { + var version = process.versions.node.split(".").map(Number); + return (version[0] === 0 && version[1] > 10) || (version[0] > 0); +})(); + +if (ret.isNode) ret.toFastProperties(process); + +try {throw new Error(); } catch (e) {ret.lastLineError = e;} +module.exports = ret; diff --git a/node_modules/bluebird/package.json b/node_modules/bluebird/package.json new file mode 100644 index 0000000..37837a8 --- /dev/null +++ b/node_modules/bluebird/package.json @@ -0,0 +1,101 @@ +{ + "_from": "bluebird@3.5.0", + "_id": "bluebird@3.5.0", + "_inBundle": false, + "_integrity": "sha1-eRQg1/VR7qKJdFOop3ZT+WYG1nw=", + "_location": "/bluebird", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "bluebird@3.5.0", + "name": "bluebird", + "escapedName": "bluebird", + "rawSpec": "3.5.0", + "saveSpec": null, + "fetchSpec": "3.5.0" + }, + "_requiredBy": [ + "/mquery" + ], + "_resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.0.tgz", + "_shasum": "791420d7f551eea2897453a8a77653f96606d67c", + "_spec": "bluebird@3.5.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/mquery", + "author": { + "name": "Petka Antonov", + "email": "petka_antonov@hotmail.com", + "url": "http://github.com/petkaantonov/" + }, + "browser": "./js/browser/bluebird.js", + "bugs": { + "url": "http://github.com/petkaantonov/bluebird/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Full featured Promises/A+ implementation with exceptionally good performance", + "devDependencies": { + "acorn": "~0.6.0", + "baconjs": "^0.7.43", + "bluebird": "^2.9.2", + "body-parser": "^1.10.2", + "browserify": "^8.1.1", + "cli-table": "~0.3.1", + "co": "^4.2.0", + "cross-spawn": "^0.2.3", + "glob": "^4.3.2", + "grunt-saucelabs": "~8.4.1", + "highland": "^2.3.0", + "istanbul": "^0.3.5", + "jshint": "^2.6.0", + "jshint-stylish": "~0.2.0", + "kefir": "^2.4.1", + "mkdirp": "~0.5.0", + "mocha": "~2.1", + "open": "~0.0.5", + "optimist": "~0.6.1", + "rimraf": "~2.2.6", + "rx": "^2.3.25", + "serve-static": "^1.7.1", + "sinon": "~1.7.3", + "uglify-js": "~2.4.16" + }, + "files": [ + "js/browser", + "js/release", + "LICENSE" + ], + "homepage": "https://github.com/petkaantonov/bluebird", + "keywords": [ + "promise", + "performance", + "promises", + "promises-a", + "promises-aplus", + "async", + "await", + "deferred", + "deferreds", + "future", + "flow control", + "dsl", + "fluent interface" + ], + "license": "MIT", + "main": "./js/release/bluebird.js", + "name": "bluebird", + "repository": { + "type": "git", + "url": "git://github.com/petkaantonov/bluebird.git" + }, + "scripts": { + "generate-browser-core": "node tools/build.js --features=core --no-debug --release --zalgo --browser --minify && mv js/browser/bluebird.js js/browser/bluebird.core.js && mv js/browser/bluebird.min.js js/browser/bluebird.core.min.js", + "generate-browser-full": "node tools/build.js --no-clean --no-debug --release --browser --minify", + "istanbul": "istanbul", + "lint": "node scripts/jshint.js", + "prepublish": "npm run generate-browser-core && npm run generate-browser-full", + "test": "node tools/test.js" + }, + "version": "3.5.0", + "webpack": "./js/release/bluebird.js" +} diff --git a/node_modules/body-parser/HISTORY.md b/node_modules/body-parser/HISTORY.md new file mode 100644 index 0000000..6ab747b --- /dev/null +++ b/node_modules/body-parser/HISTORY.md @@ -0,0 +1,568 @@ +1.18.2 / 2017-09-22 +=================== + + * deps: debug@2.6.9 + * perf: remove argument reassignment + +1.18.1 / 2017-09-12 +=================== + + * deps: content-type@~1.0.4 + - perf: remove argument reassignment + - perf: skip parameter parsing when no parameters + * deps: iconv-lite@0.4.19 + - Fix ISO-8859-1 regression + - Update Windows-1255 + * deps: qs@6.5.1 + - Fix parsing & compacting very deep objects + * deps: raw-body@2.3.2 + - deps: iconv-lite@0.4.19 + +1.18.0 / 2017-09-08 +=================== + + * Fix JSON strict violation error to match native parse error + * Include the `body` property on verify errors + * Include the `type` property on all generated errors + * Use `http-errors` to set status code on errors + * deps: bytes@3.0.0 + * deps: debug@2.6.8 + * deps: depd@~1.1.1 + - Remove unnecessary `Buffer` loading + * deps: http-errors@~1.6.2 + - deps: depd@1.1.1 + * deps: iconv-lite@0.4.18 + - Add support for React Native + - Add a warning if not loaded as utf-8 + - Fix CESU-8 decoding in Node.js 8 + - Improve speed of ISO-8859-1 encoding + * deps: qs@6.5.0 + * deps: raw-body@2.3.1 + - Use `http-errors` for standard emitted errors + - deps: bytes@3.0.0 + - deps: iconv-lite@0.4.18 + - perf: skip buffer decoding on overage chunk + * perf: prevent internal `throw` when missing charset + +1.17.2 / 2017-05-17 +=================== + + * deps: debug@2.6.7 + - Fix `DEBUG_MAX_ARRAY_LENGTH` + - deps: ms@2.0.0 + * deps: type-is@~1.6.15 + - deps: mime-types@~2.1.15 + +1.17.1 / 2017-03-06 +=================== + + * deps: qs@6.4.0 + - Fix regression parsing keys starting with `[` + +1.17.0 / 2017-03-01 +=================== + + * deps: http-errors@~1.6.1 + - Make `message` property enumerable for `HttpError`s + - deps: setprototypeof@1.0.3 + * deps: qs@6.3.1 + - Fix compacting nested arrays + +1.16.1 / 2017-02-10 +=================== + + * deps: debug@2.6.1 + - Fix deprecation messages in WebStorm and other editors + - Undeprecate `DEBUG_FD` set to `1` or `2` + +1.16.0 / 2017-01-17 +=================== + + * deps: debug@2.6.0 + - Allow colors in workers + - Deprecated `DEBUG_FD` environment variable + - Fix error when running under React Native + - Use same color for same namespace + - deps: ms@0.7.2 + * deps: http-errors@~1.5.1 + - deps: inherits@2.0.3 + - deps: setprototypeof@1.0.2 + - deps: statuses@'>= 1.3.1 < 2' + * deps: iconv-lite@0.4.15 + - Added encoding MS-31J + - Added encoding MS-932 + - Added encoding MS-936 + - Added encoding MS-949 + - Added encoding MS-950 + - Fix GBK/GB18030 handling of Euro character + * deps: qs@6.2.1 + - Fix array parsing from skipping empty values + * deps: raw-body@~2.2.0 + - deps: iconv-lite@0.4.15 + * deps: type-is@~1.6.14 + - deps: mime-types@~2.1.13 + +1.15.2 / 2016-06-19 +=================== + + * deps: bytes@2.4.0 + * deps: content-type@~1.0.2 + - perf: enable strict mode + * deps: http-errors@~1.5.0 + - Use `setprototypeof` module to replace `__proto__` setting + - deps: statuses@'>= 1.3.0 < 2' + - perf: enable strict mode + * deps: qs@6.2.0 + * deps: raw-body@~2.1.7 + - deps: bytes@2.4.0 + - perf: remove double-cleanup on happy path + * deps: type-is@~1.6.13 + - deps: mime-types@~2.1.11 + +1.15.1 / 2016-05-05 +=================== + + * deps: bytes@2.3.0 + - Drop partial bytes on all parsed units + - Fix parsing byte string that looks like hex + * deps: raw-body@~2.1.6 + - deps: bytes@2.3.0 + * deps: type-is@~1.6.12 + - deps: mime-types@~2.1.10 + +1.15.0 / 2016-02-10 +=================== + + * deps: http-errors@~1.4.0 + - Add `HttpError` export, for `err instanceof createError.HttpError` + - deps: inherits@2.0.1 + - deps: statuses@'>= 1.2.1 < 2' + * deps: qs@6.1.0 + * deps: type-is@~1.6.11 + - deps: mime-types@~2.1.9 + +1.14.2 / 2015-12-16 +=================== + + * deps: bytes@2.2.0 + * deps: iconv-lite@0.4.13 + * deps: qs@5.2.0 + * deps: raw-body@~2.1.5 + - deps: bytes@2.2.0 + - deps: iconv-lite@0.4.13 + * deps: type-is@~1.6.10 + - deps: mime-types@~2.1.8 + +1.14.1 / 2015-09-27 +=================== + + * Fix issue where invalid charset results in 400 when `verify` used + * deps: iconv-lite@0.4.12 + - Fix CESU-8 decoding in Node.js 4.x + * deps: raw-body@~2.1.4 + - Fix masking critical errors from `iconv-lite` + - deps: iconv-lite@0.4.12 + * deps: type-is@~1.6.9 + - deps: mime-types@~2.1.7 + +1.14.0 / 2015-09-16 +=================== + + * Fix JSON strict parse error to match syntax errors + * Provide static `require` analysis in `urlencoded` parser + * deps: depd@~1.1.0 + - Support web browser loading + * deps: qs@5.1.0 + * deps: raw-body@~2.1.3 + - Fix sync callback when attaching data listener causes sync read + * deps: type-is@~1.6.8 + - Fix type error when given invalid type to match against + - deps: mime-types@~2.1.6 + +1.13.3 / 2015-07-31 +=================== + + * deps: type-is@~1.6.6 + - deps: mime-types@~2.1.4 + +1.13.2 / 2015-07-05 +=================== + + * deps: iconv-lite@0.4.11 + * deps: qs@4.0.0 + - Fix dropping parameters like `hasOwnProperty` + - Fix user-visible incompatibilities from 3.1.0 + - Fix various parsing edge cases + * deps: raw-body@~2.1.2 + - Fix error stack traces to skip `makeError` + - deps: iconv-lite@0.4.11 + * deps: type-is@~1.6.4 + - deps: mime-types@~2.1.2 + - perf: enable strict mode + - perf: remove argument reassignment + +1.13.1 / 2015-06-16 +=================== + + * deps: qs@2.4.2 + - Downgraded from 3.1.0 because of user-visible incompatibilities + +1.13.0 / 2015-06-14 +=================== + + * Add `statusCode` property on `Error`s, in addition to `status` + * Change `type` default to `application/json` for JSON parser + * Change `type` default to `application/x-www-form-urlencoded` for urlencoded parser + * Provide static `require` analysis + * Use the `http-errors` module to generate errors + * deps: bytes@2.1.0 + - Slight optimizations + * deps: iconv-lite@0.4.10 + - The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails + - Leading BOM is now removed when decoding + * deps: on-finished@~2.3.0 + - Add defined behavior for HTTP `CONNECT` requests + - Add defined behavior for HTTP `Upgrade` requests + - deps: ee-first@1.1.1 + * deps: qs@3.1.0 + - Fix dropping parameters like `hasOwnProperty` + - Fix various parsing edge cases + - Parsed object now has `null` prototype + * deps: raw-body@~2.1.1 + - Use `unpipe` module for unpiping requests + - deps: iconv-lite@0.4.10 + * deps: type-is@~1.6.3 + - deps: mime-types@~2.1.1 + - perf: reduce try block size + - perf: remove bitwise operations + * perf: enable strict mode + * perf: remove argument reassignment + * perf: remove delete call + +1.12.4 / 2015-05-10 +=================== + + * deps: debug@~2.2.0 + * deps: qs@2.4.2 + - Fix allowing parameters like `constructor` + * deps: on-finished@~2.2.1 + * deps: raw-body@~2.0.1 + - Fix a false-positive when unpiping in Node.js 0.8 + - deps: bytes@2.0.1 + * deps: type-is@~1.6.2 + - deps: mime-types@~2.0.11 + +1.12.3 / 2015-04-15 +=================== + + * Slight efficiency improvement when not debugging + * deps: depd@~1.0.1 + * deps: iconv-lite@0.4.8 + - Add encoding alias UNICODE-1-1-UTF-7 + * deps: raw-body@1.3.4 + - Fix hanging callback if request aborts during read + - deps: iconv-lite@0.4.8 + +1.12.2 / 2015-03-16 +=================== + + * deps: qs@2.4.1 + - Fix error when parameter `hasOwnProperty` is present + +1.12.1 / 2015-03-15 +=================== + + * deps: debug@~2.1.3 + - Fix high intensity foreground color for bold + - deps: ms@0.7.0 + * deps: type-is@~1.6.1 + - deps: mime-types@~2.0.10 + +1.12.0 / 2015-02-13 +=================== + + * add `debug` messages + * accept a function for the `type` option + * use `content-type` to parse `Content-Type` headers + * deps: iconv-lite@0.4.7 + - Gracefully support enumerables on `Object.prototype` + * deps: raw-body@1.3.3 + - deps: iconv-lite@0.4.7 + * deps: type-is@~1.6.0 + - fix argument reassignment + - fix false-positives in `hasBody` `Transfer-Encoding` check + - support wildcard for both type and subtype (`*/*`) + - deps: mime-types@~2.0.9 + +1.11.0 / 2015-01-30 +=================== + + * make internal `extended: true` depth limit infinity + * deps: type-is@~1.5.6 + - deps: mime-types@~2.0.8 + +1.10.2 / 2015-01-20 +=================== + + * deps: iconv-lite@0.4.6 + - Fix rare aliases of single-byte encodings + * deps: raw-body@1.3.2 + - deps: iconv-lite@0.4.6 + +1.10.1 / 2015-01-01 +=================== + + * deps: on-finished@~2.2.0 + * deps: type-is@~1.5.5 + - deps: mime-types@~2.0.7 + +1.10.0 / 2014-12-02 +=================== + + * make internal `extended: true` array limit dynamic + +1.9.3 / 2014-11-21 +================== + + * deps: iconv-lite@0.4.5 + - Fix Windows-31J and X-SJIS encoding support + * deps: qs@2.3.3 + - Fix `arrayLimit` behavior + * deps: raw-body@1.3.1 + - deps: iconv-lite@0.4.5 + * deps: type-is@~1.5.3 + - deps: mime-types@~2.0.3 + +1.9.2 / 2014-10-27 +================== + + * deps: qs@2.3.2 + - Fix parsing of mixed objects and values + +1.9.1 / 2014-10-22 +================== + + * deps: on-finished@~2.1.1 + - Fix handling of pipelined requests + * deps: qs@2.3.0 + - Fix parsing of mixed implicit and explicit arrays + * deps: type-is@~1.5.2 + - deps: mime-types@~2.0.2 + +1.9.0 / 2014-09-24 +================== + + * include the charset in "unsupported charset" error message + * include the encoding in "unsupported content encoding" error message + * deps: depd@~1.0.0 + +1.8.4 / 2014-09-23 +================== + + * fix content encoding to be case-insensitive + +1.8.3 / 2014-09-19 +================== + + * deps: qs@2.2.4 + - Fix issue with object keys starting with numbers truncated + +1.8.2 / 2014-09-15 +================== + + * deps: depd@0.4.5 + +1.8.1 / 2014-09-07 +================== + + * deps: media-typer@0.3.0 + * deps: type-is@~1.5.1 + +1.8.0 / 2014-09-05 +================== + + * make empty-body-handling consistent between chunked requests + - empty `json` produces `{}` + - empty `raw` produces `new Buffer(0)` + - empty `text` produces `''` + - empty `urlencoded` produces `{}` + * deps: qs@2.2.3 + - Fix issue where first empty value in array is discarded + * deps: type-is@~1.5.0 + - fix `hasbody` to be true for `content-length: 0` + +1.7.0 / 2014-09-01 +================== + + * add `parameterLimit` option to `urlencoded` parser + * change `urlencoded` extended array limit to 100 + * respond with 413 when over `parameterLimit` in `urlencoded` + +1.6.7 / 2014-08-29 +================== + + * deps: qs@2.2.2 + - Remove unnecessary cloning + +1.6.6 / 2014-08-27 +================== + + * deps: qs@2.2.0 + - Array parsing fix + - Performance improvements + +1.6.5 / 2014-08-16 +================== + + * deps: on-finished@2.1.0 + +1.6.4 / 2014-08-14 +================== + + * deps: qs@1.2.2 + +1.6.3 / 2014-08-10 +================== + + * deps: qs@1.2.1 + +1.6.2 / 2014-08-07 +================== + + * deps: qs@1.2.0 + - Fix parsing array of objects + +1.6.1 / 2014-08-06 +================== + + * deps: qs@1.1.0 + - Accept urlencoded square brackets + - Accept empty values in implicit array notation + +1.6.0 / 2014-08-05 +================== + + * deps: qs@1.0.2 + - Complete rewrite + - Limits array length to 20 + - Limits object depth to 5 + - Limits parameters to 1,000 + +1.5.2 / 2014-07-27 +================== + + * deps: depd@0.4.4 + - Work-around v8 generating empty stack traces + +1.5.1 / 2014-07-26 +================== + + * deps: depd@0.4.3 + - Fix exception when global `Error.stackTraceLimit` is too low + +1.5.0 / 2014-07-20 +================== + + * deps: depd@0.4.2 + - Add `TRACE_DEPRECATION` environment variable + - Remove non-standard grey color from color output + - Support `--no-deprecation` argument + - Support `--trace-deprecation` argument + * deps: iconv-lite@0.4.4 + - Added encoding UTF-7 + * deps: raw-body@1.3.0 + - deps: iconv-lite@0.4.4 + - Added encoding UTF-7 + - Fix `Cannot switch to old mode now` error on Node.js 0.10+ + * deps: type-is@~1.3.2 + +1.4.3 / 2014-06-19 +================== + + * deps: type-is@1.3.1 + - fix global variable leak + +1.4.2 / 2014-06-19 +================== + + * deps: type-is@1.3.0 + - improve type parsing + +1.4.1 / 2014-06-19 +================== + + * fix urlencoded extended deprecation message + +1.4.0 / 2014-06-19 +================== + + * add `text` parser + * add `raw` parser + * check accepted charset in content-type (accepts utf-8) + * check accepted encoding in content-encoding (accepts identity) + * deprecate `bodyParser()` middleware; use `.json()` and `.urlencoded()` as needed + * deprecate `urlencoded()` without provided `extended` option + * lazy-load urlencoded parsers + * parsers split into files for reduced mem usage + * support gzip and deflate bodies + - set `inflate: false` to turn off + * deps: raw-body@1.2.2 + - Support all encodings from `iconv-lite` + +1.3.1 / 2014-06-11 +================== + + * deps: type-is@1.2.1 + - Switch dependency from mime to mime-types@1.0.0 + +1.3.0 / 2014-05-31 +================== + + * add `extended` option to urlencoded parser + +1.2.2 / 2014-05-27 +================== + + * deps: raw-body@1.1.6 + - assert stream encoding on node.js 0.8 + - assert stream encoding on node.js < 0.10.6 + - deps: bytes@1 + +1.2.1 / 2014-05-26 +================== + + * invoke `next(err)` after request fully read + - prevents hung responses and socket hang ups + +1.2.0 / 2014-05-11 +================== + + * add `verify` option + * deps: type-is@1.2.0 + - support suffix matching + +1.1.2 / 2014-05-11 +================== + + * improve json parser speed + +1.1.1 / 2014-05-11 +================== + + * fix repeated limit parsing with every request + +1.1.0 / 2014-05-10 +================== + + * add `type` option + * deps: pin for safety and consistency + +1.0.2 / 2014-04-14 +================== + + * use `type-is` module + +1.0.1 / 2014-03-20 +================== + + * lower default limits to 100kb diff --git a/node_modules/body-parser/LICENSE b/node_modules/body-parser/LICENSE new file mode 100644 index 0000000..386b7b6 --- /dev/null +++ b/node_modules/body-parser/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2014-2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/body-parser/README.md b/node_modules/body-parser/README.md new file mode 100644 index 0000000..62221e4 --- /dev/null +++ b/node_modules/body-parser/README.md @@ -0,0 +1,438 @@ +# body-parser + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] +[![Gratipay][gratipay-image]][gratipay-url] + +Node.js body parsing middleware. + +Parse incoming request bodies in a middleware before your handlers, available +under the `req.body` property. + +[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/). + +_This does not handle multipart bodies_, due to their complex and typically +large nature. For multipart bodies, you may be interested in the following +modules: + + * [busboy](https://www.npmjs.org/package/busboy#readme) and + [connect-busboy](https://www.npmjs.org/package/connect-busboy#readme) + * [multiparty](https://www.npmjs.org/package/multiparty#readme) and + [connect-multiparty](https://www.npmjs.org/package/connect-multiparty#readme) + * [formidable](https://www.npmjs.org/package/formidable#readme) + * [multer](https://www.npmjs.org/package/multer#readme) + +This module provides the following parsers: + + * [JSON body parser](#bodyparserjsonoptions) + * [Raw body parser](#bodyparserrawoptions) + * [Text body parser](#bodyparsertextoptions) + * [URL-encoded form body parser](#bodyparserurlencodedoptions) + +Other body parsers you might be interested in: + +- [body](https://www.npmjs.org/package/body#readme) +- [co-body](https://www.npmjs.org/package/co-body#readme) + +## Installation + +```sh +$ npm install body-parser +``` + +## API + + + +```js +var bodyParser = require('body-parser') +``` + +The `bodyParser` object exposes various factories to create middlewares. All +middlewares will populate the `req.body` property with the parsed body when +the `Content-Type` request header matches the `type` option, or an empty +object (`{}`) if there was no body to parse, the `Content-Type` was not matched, +or an error occurred. + +The various errors returned by this module are described in the +[errors section](#errors). + +### bodyParser.json([options]) + +Returns middleware that only parses `json` and only looks at requests where +the `Content-Type` header matches the `type` option. This parser accepts any +Unicode encoding of the body and supports automatic inflation of `gzip` and +`deflate` encodings. + +A new `body` object containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). + +#### Options + +The `json` function takes an optional `options` object that may contain any of +the following keys: + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### reviver + +The `reviver` option is passed directly to `JSON.parse` as the second +argument. You can find more information on this argument +[in the MDN documentation about JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter). + +##### strict + +When set to `true`, will only accept arrays and objects; when `false` will +accept anything `JSON.parse` accepts. Defaults to `true`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a function or a string. If a string, `type` option +is passed directly to the [type-is](https://www.npmjs.org/package/type-is#readme) +library and this can be an extension name (like `json`), a mime type (like +`application/json`), or a mime type with a wildcard (like `*/*` or `*/json`). +If a function, the `type` option is called as `fn(req)` and the request is +parsed if it returns a truthy value. Defaults to `application/json`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +### bodyParser.raw([options]) + +Returns middleware that parses all bodies as a `Buffer` and only looks at +requests where the `Content-Type` header matches the `type` option. This +parser supports automatic inflation of `gzip` and `deflate` encodings. + +A new `body` object containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). This will be a `Buffer` object +of the body. + +#### Options + +The `raw` function takes an optional `options` object that may contain any of +the following keys: + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a function or a string. If a string, `type` option +is passed directly to the [type-is](https://www.npmjs.org/package/type-is#readme) +library and this can be an extension name (like `bin`), a mime type (like +`application/octet-stream`), or a mime type with a wildcard (like `*/*` or +`application/*`). If a function, the `type` option is called as `fn(req)` +and the request is parsed if it returns a truthy value. Defaults to +`application/octet-stream`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +### bodyParser.text([options]) + +Returns middleware that parses all bodies as a string and only looks at +requests where the `Content-Type` header matches the `type` option. This +parser supports automatic inflation of `gzip` and `deflate` encodings. + +A new `body` string containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). This will be a string of the +body. + +#### Options + +The `text` function takes an optional `options` object that may contain any of +the following keys: + +##### defaultCharset + +Specify the default character set for the text content if the charset is not +specified in the `Content-Type` header of the request. Defaults to `utf-8`. + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a function or a string. If a string, `type` option +is passed directly to the [type-is](https://www.npmjs.org/package/type-is#readme) +library and this can be an extension name (like `txt`), a mime type (like +`text/plain`), or a mime type with a wildcard (like `*/*` or `text/*`). +If a function, the `type` option is called as `fn(req)` and the request is +parsed if it returns a truthy value. Defaults to `text/plain`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +### bodyParser.urlencoded([options]) + +Returns middleware that only parses `urlencoded` bodies and only looks at +requests where the `Content-Type` header matches the `type` option. This +parser accepts only UTF-8 encoding of the body and supports automatic +inflation of `gzip` and `deflate` encodings. + +A new `body` object containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). This object will contain +key-value pairs, where the value can be a string or array (when `extended` is +`false`), or any type (when `extended` is `true`). + +#### Options + +The `urlencoded` function takes an optional `options` object that may contain +any of the following keys: + +##### extended + +The `extended` option allows to choose between parsing the URL-encoded data +with the `querystring` library (when `false`) or the `qs` library (when +`true`). The "extended" syntax allows for rich objects and arrays to be +encoded into the URL-encoded format, allowing for a JSON-like experience +with URL-encoded. For more information, please +[see the qs library](https://www.npmjs.org/package/qs#readme). + +Defaults to `true`, but using the default has been deprecated. Please +research into the difference between `qs` and `querystring` and choose the +appropriate setting. + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### parameterLimit + +The `parameterLimit` option controls the maximum number of parameters that +are allowed in the URL-encoded data. If a request contains more parameters +than this value, a 413 will be returned to the client. Defaults to `1000`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a function or a string. If a string, `type` option +is passed directly to the [type-is](https://www.npmjs.org/package/type-is#readme) +library and this can be an extension name (like `urlencoded`), a mime type (like +`application/x-www-form-urlencoded`), or a mime type with a wildcard (like +`*/x-www-form-urlencoded`). If a function, the `type` option is called as +`fn(req)` and the request is parsed if it returns a truthy value. Defaults +to `application/x-www-form-urlencoded`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +## Errors + +The middlewares provided by this module create errors depending on the error +condition during parsing. The errors will typically have a `status`/`statusCode` +property that contains the suggested HTTP response code, an `expose` property +to determine if the `message` property should be displayed to the client, a +`type` property to determine the type of error without matching against the +`message`, and a `body` property containing the read body, if available. + +The following are the common errors emitted, though any error can come through +for various reasons. + +### content encoding unsupported + +This error will occur when the request had a `Content-Encoding` header that +contained an encoding but the "inflation" option was set to `false`. The +`status` property is set to `415`, the `type` property is set to +`'encoding.unsupported'`, and the `charset` property will be set to the +encoding that is unsupported. + +### request aborted + +This error will occur when the request is aborted by the client before reading +the body has finished. The `received` property will be set to the number of +bytes received before the request was aborted and the `expected` property is +set to the number of expected bytes. The `status` property is set to `400` +and `type` property is set to `'request.aborted'`. + +### request entity too large + +This error will occur when the request body's size is larger than the "limit" +option. The `limit` property will be set to the byte limit and the `length` +property will be set to the request body's length. The `status` property is +set to `413` and the `type` property is set to `'entity.too.large'`. + +### request size did not match content length + +This error will occur when the request's length did not match the length from +the `Content-Length` header. This typically occurs when the request is malformed, +typically when the `Content-Length` header was calculated based on characters +instead of bytes. The `status` property is set to `400` and the `type` property +is set to `'request.size.invalid'`. + +### stream encoding should not be set + +This error will occur when something called the `req.setEncoding` method prior +to this middleware. This module operates directly on bytes only and you cannot +call `req.setEncoding` when using this module. The `status` property is set to +`500` and the `type` property is set to `'stream.encoding.set'`. + +### too many parameters + +This error will occur when the content of the request exceeds the configured +`parameterLimit` for the `urlencoded` parser. The `status` property is set to +`413` and the `type` property is set to `'parameters.too.many'`. + +### unsupported charset "BOGUS" + +This error will occur when the request had a charset parameter in the +`Content-Type` header, but the `iconv-lite` module does not support it OR the +parser does not support it. The charset is contained in the message as well +as in the `charset` property. The `status` property is set to `415`, the +`type` property is set to `'charset.unsupported'`, and the `charset` property +is set to the charset that is unsupported. + +### unsupported content encoding "bogus" + +This error will occur when the request had a `Content-Encoding` header that +contained an unsupported encoding. The encoding is contained in the message +as well as in the `encoding` property. The `status` property is set to `415`, +the `type` property is set to `'encoding.unsupported'`, and the `encoding` +property is set to the encoding that is unsupported. + +## Examples + +### Express/Connect top-level generic + +This example demonstrates adding a generic JSON and URL-encoded parser as a +top-level middleware, which will parse the bodies of all incoming requests. +This is the simplest setup. + +```js +var express = require('express') +var bodyParser = require('body-parser') + +var app = express() + +// parse application/x-www-form-urlencoded +app.use(bodyParser.urlencoded({ extended: false })) + +// parse application/json +app.use(bodyParser.json()) + +app.use(function (req, res) { + res.setHeader('Content-Type', 'text/plain') + res.write('you posted:\n') + res.end(JSON.stringify(req.body, null, 2)) +}) +``` + +### Express route-specific + +This example demonstrates adding body parsers specifically to the routes that +need them. In general, this is the most recommended way to use body-parser with +Express. + +```js +var express = require('express') +var bodyParser = require('body-parser') + +var app = express() + +// create application/json parser +var jsonParser = bodyParser.json() + +// create application/x-www-form-urlencoded parser +var urlencodedParser = bodyParser.urlencoded({ extended: false }) + +// POST /login gets urlencoded bodies +app.post('/login', urlencodedParser, function (req, res) { + if (!req.body) return res.sendStatus(400) + res.send('welcome, ' + req.body.username) +}) + +// POST /api/users gets JSON bodies +app.post('/api/users', jsonParser, function (req, res) { + if (!req.body) return res.sendStatus(400) + // create user in req.body +}) +``` + +### Change accepted type for parsers + +All the parsers accept a `type` option which allows you to change the +`Content-Type` that the middleware will parse. + +```js +var express = require('express') +var bodyParser = require('body-parser') + +var app = express() + +// parse various different custom JSON types as JSON +app.use(bodyParser.json({ type: 'application/*+json' })) + +// parse some custom thing into a Buffer +app.use(bodyParser.raw({ type: 'application/vnd.custom-type' })) + +// parse an HTML body into a string +app.use(bodyParser.text({ type: 'text/html' })) +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/body-parser.svg +[npm-url]: https://npmjs.org/package/body-parser +[travis-image]: https://img.shields.io/travis/expressjs/body-parser/master.svg +[travis-url]: https://travis-ci.org/expressjs/body-parser +[coveralls-image]: https://img.shields.io/coveralls/expressjs/body-parser/master.svg +[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master +[downloads-image]: https://img.shields.io/npm/dm/body-parser.svg +[downloads-url]: https://npmjs.org/package/body-parser +[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg +[gratipay-url]: https://www.gratipay.com/dougwilson/ diff --git a/node_modules/body-parser/index.js b/node_modules/body-parser/index.js new file mode 100644 index 0000000..93c3a1f --- /dev/null +++ b/node_modules/body-parser/index.js @@ -0,0 +1,157 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var deprecate = require('depd')('body-parser') + +/** + * Cache of loaded parsers. + * @private + */ + +var parsers = Object.create(null) + +/** + * @typedef Parsers + * @type {function} + * @property {function} json + * @property {function} raw + * @property {function} text + * @property {function} urlencoded + */ + +/** + * Module exports. + * @type {Parsers} + */ + +exports = module.exports = deprecate.function(bodyParser, + 'bodyParser: use individual json/urlencoded middlewares') + +/** + * JSON parser. + * @public + */ + +Object.defineProperty(exports, 'json', { + configurable: true, + enumerable: true, + get: createParserGetter('json') +}) + +/** + * Raw parser. + * @public + */ + +Object.defineProperty(exports, 'raw', { + configurable: true, + enumerable: true, + get: createParserGetter('raw') +}) + +/** + * Text parser. + * @public + */ + +Object.defineProperty(exports, 'text', { + configurable: true, + enumerable: true, + get: createParserGetter('text') +}) + +/** + * URL-encoded parser. + * @public + */ + +Object.defineProperty(exports, 'urlencoded', { + configurable: true, + enumerable: true, + get: createParserGetter('urlencoded') +}) + +/** + * Create a middleware to parse json and urlencoded bodies. + * + * @param {object} [options] + * @return {function} + * @deprecated + * @public + */ + +function bodyParser (options) { + var opts = {} + + // exclude type option + if (options) { + for (var prop in options) { + if (prop !== 'type') { + opts[prop] = options[prop] + } + } + } + + var _urlencoded = exports.urlencoded(opts) + var _json = exports.json(opts) + + return function bodyParser (req, res, next) { + _json(req, res, function (err) { + if (err) return next(err) + _urlencoded(req, res, next) + }) + } +} + +/** + * Create a getter for loading a parser. + * @private + */ + +function createParserGetter (name) { + return function get () { + return loadParser(name) + } +} + +/** + * Load a parser module. + * @private + */ + +function loadParser (parserName) { + var parser = parsers[parserName] + + if (parser !== undefined) { + return parser + } + + // this uses a switch for static require analysis + switch (parserName) { + case 'json': + parser = require('./lib/types/json') + break + case 'raw': + parser = require('./lib/types/raw') + break + case 'text': + parser = require('./lib/types/text') + break + case 'urlencoded': + parser = require('./lib/types/urlencoded') + break + } + + // store to prevent invoking require() + return (parsers[parserName] = parser) +} diff --git a/node_modules/body-parser/lib/read.js b/node_modules/body-parser/lib/read.js new file mode 100644 index 0000000..c102609 --- /dev/null +++ b/node_modules/body-parser/lib/read.js @@ -0,0 +1,181 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var createError = require('http-errors') +var getBody = require('raw-body') +var iconv = require('iconv-lite') +var onFinished = require('on-finished') +var zlib = require('zlib') + +/** + * Module exports. + */ + +module.exports = read + +/** + * Read a request into a buffer and parse. + * + * @param {object} req + * @param {object} res + * @param {function} next + * @param {function} parse + * @param {function} debug + * @param {object} options + * @private + */ + +function read (req, res, next, parse, debug, options) { + var length + var opts = options + var stream + + // flag as parsed + req._body = true + + // read options + var encoding = opts.encoding !== null + ? opts.encoding + : null + var verify = opts.verify + + try { + // get the content stream + stream = contentstream(req, debug, opts.inflate) + length = stream.length + stream.length = undefined + } catch (err) { + return next(err) + } + + // set raw-body options + opts.length = length + opts.encoding = verify + ? null + : encoding + + // assert charset is supported + if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) { + return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', { + charset: encoding.toLowerCase(), + type: 'charset.unsupported' + })) + } + + // read body + debug('read body') + getBody(stream, opts, function (error, body) { + if (error) { + var _error + + if (error.type === 'encoding.unsupported') { + // echo back charset + _error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', { + charset: encoding.toLowerCase(), + type: 'charset.unsupported' + }) + } else { + // set status code on error + _error = createError(400, error) + } + + // read off entire request + stream.resume() + onFinished(req, function onfinished () { + next(createError(400, _error)) + }) + return + } + + // verify + if (verify) { + try { + debug('verify body') + verify(req, res, body, encoding) + } catch (err) { + next(createError(403, err, { + body: body, + type: err.type || 'entity.verify.failed' + })) + return + } + } + + // parse + var str = body + try { + debug('parse body') + str = typeof body !== 'string' && encoding !== null + ? iconv.decode(body, encoding) + : body + req.body = parse(str) + } catch (err) { + next(createError(400, err, { + body: str, + type: err.type || 'entity.parse.failed' + })) + return + } + + next() + }) +} + +/** + * Get the content stream of the request. + * + * @param {object} req + * @param {function} debug + * @param {boolean} [inflate=true] + * @return {object} + * @api private + */ + +function contentstream (req, debug, inflate) { + var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase() + var length = req.headers['content-length'] + var stream + + debug('content-encoding "%s"', encoding) + + if (inflate === false && encoding !== 'identity') { + throw createError(415, 'content encoding unsupported', { + encoding: encoding, + type: 'encoding.unsupported' + }) + } + + switch (encoding) { + case 'deflate': + stream = zlib.createInflate() + debug('inflate body') + req.pipe(stream) + break + case 'gzip': + stream = zlib.createGunzip() + debug('gunzip body') + req.pipe(stream) + break + case 'identity': + stream = req + stream.length = length + break + default: + throw createError(415, 'unsupported content encoding "' + encoding + '"', { + encoding: encoding, + type: 'encoding.unsupported' + }) + } + + return stream +} diff --git a/node_modules/body-parser/lib/types/json.js b/node_modules/body-parser/lib/types/json.js new file mode 100644 index 0000000..a7bc838 --- /dev/null +++ b/node_modules/body-parser/lib/types/json.js @@ -0,0 +1,232 @@ +/*! + * body-parser + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var bytes = require('bytes') +var contentType = require('content-type') +var createError = require('http-errors') +var debug = require('debug')('body-parser:json') +var read = require('../read') +var typeis = require('type-is') + +/** + * Module exports. + */ + +module.exports = json + +/** + * RegExp to match the first non-space in a string. + * + * Allowed whitespace is defined in RFC 7159: + * + * ws = *( + * %x20 / ; Space + * %x09 / ; Horizontal tab + * %x0A / ; Line feed or New line + * %x0D ) ; Carriage return + */ + +var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*(.)/ // eslint-disable-line no-control-regex + +/** + * Create a middleware to parse JSON bodies. + * + * @param {object} [options] + * @return {function} + * @public + */ + +function json (options) { + var opts = options || {} + + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var inflate = opts.inflate !== false + var reviver = opts.reviver + var strict = opts.strict !== false + var type = opts.type || 'application/json' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type + + function parse (body) { + if (body.length === 0) { + // special-case empty json body, as it's a common client-side mistake + // TODO: maybe make this configurable or part of "strict" option + return {} + } + + if (strict) { + var first = firstchar(body) + + if (first !== '{' && first !== '[') { + debug('strict violation') + throw createStrictSyntaxError(body, first) + } + } + + try { + debug('parse json') + return JSON.parse(body, reviver) + } catch (e) { + throw normalizeJsonSyntaxError(e, { + stack: e.stack + }) + } + } + + return function jsonParser (req, res, next) { + if (req._body) { + debug('body already parsed') + next() + return + } + + req.body = req.body || {} + + // skip requests without bodies + if (!typeis.hasBody(req)) { + debug('skip empty body') + next() + return + } + + debug('content-type %j', req.headers['content-type']) + + // determine if request should be parsed + if (!shouldParse(req)) { + debug('skip parsing') + next() + return + } + + // assert charset per RFC 7159 sec 8.1 + var charset = getCharset(req) || 'utf-8' + if (charset.substr(0, 4) !== 'utf-') { + debug('invalid charset') + next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', { + charset: charset, + type: 'charset.unsupported' + })) + return + } + + // read + read(req, res, next, parse, debug, { + encoding: charset, + inflate: inflate, + limit: limit, + verify: verify + }) + } +} + +/** + * Create strict violation syntax error matching native error. + * + * @param {string} str + * @param {string} char + * @return {Error} + * @private + */ + +function createStrictSyntaxError (str, char) { + var index = str.indexOf(char) + var partial = str.substring(0, index) + '#' + + try { + JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation') + } catch (e) { + return normalizeJsonSyntaxError(e, { + message: e.message.replace('#', char), + stack: e.stack + }) + } +} + +/** + * Get the first non-whitespace character in a string. + * + * @param {string} str + * @return {function} + * @private + */ + +function firstchar (str) { + return FIRST_CHAR_REGEXP.exec(str)[1] +} + +/** + * Get the charset of a request. + * + * @param {object} req + * @api private + */ + +function getCharset (req) { + try { + return (contentType.parse(req).parameters.charset || '').toLowerCase() + } catch (e) { + return undefined + } +} + +/** + * Normalize a SyntaxError for JSON.parse. + * + * @param {SyntaxError} error + * @param {object} obj + * @return {SyntaxError} + */ + +function normalizeJsonSyntaxError (error, obj) { + var keys = Object.getOwnPropertyNames(error) + + for (var i = 0; i < keys.length; i++) { + var key = keys[i] + if (key !== 'stack' && key !== 'message') { + delete error[key] + } + } + + var props = Object.keys(obj) + + for (var j = 0; j < props.length; j++) { + var prop = props[j] + error[prop] = obj[prop] + } + + return error +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/node_modules/body-parser/lib/types/raw.js b/node_modules/body-parser/lib/types/raw.js new file mode 100644 index 0000000..f5d1b67 --- /dev/null +++ b/node_modules/body-parser/lib/types/raw.js @@ -0,0 +1,101 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + */ + +var bytes = require('bytes') +var debug = require('debug')('body-parser:raw') +var read = require('../read') +var typeis = require('type-is') + +/** + * Module exports. + */ + +module.exports = raw + +/** + * Create a middleware to parse raw bodies. + * + * @param {object} [options] + * @return {function} + * @api public + */ + +function raw (options) { + var opts = options || {} + + var inflate = opts.inflate !== false + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var type = opts.type || 'application/octet-stream' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type + + function parse (buf) { + return buf + } + + return function rawParser (req, res, next) { + if (req._body) { + debug('body already parsed') + next() + return + } + + req.body = req.body || {} + + // skip requests without bodies + if (!typeis.hasBody(req)) { + debug('skip empty body') + next() + return + } + + debug('content-type %j', req.headers['content-type']) + + // determine if request should be parsed + if (!shouldParse(req)) { + debug('skip parsing') + next() + return + } + + // read + read(req, res, next, parse, debug, { + encoding: null, + inflate: inflate, + limit: limit, + verify: verify + }) + } +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/node_modules/body-parser/lib/types/text.js b/node_modules/body-parser/lib/types/text.js new file mode 100644 index 0000000..083a009 --- /dev/null +++ b/node_modules/body-parser/lib/types/text.js @@ -0,0 +1,121 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + */ + +var bytes = require('bytes') +var contentType = require('content-type') +var debug = require('debug')('body-parser:text') +var read = require('../read') +var typeis = require('type-is') + +/** + * Module exports. + */ + +module.exports = text + +/** + * Create a middleware to parse text bodies. + * + * @param {object} [options] + * @return {function} + * @api public + */ + +function text (options) { + var opts = options || {} + + var defaultCharset = opts.defaultCharset || 'utf-8' + var inflate = opts.inflate !== false + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var type = opts.type || 'text/plain' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type + + function parse (buf) { + return buf + } + + return function textParser (req, res, next) { + if (req._body) { + debug('body already parsed') + next() + return + } + + req.body = req.body || {} + + // skip requests without bodies + if (!typeis.hasBody(req)) { + debug('skip empty body') + next() + return + } + + debug('content-type %j', req.headers['content-type']) + + // determine if request should be parsed + if (!shouldParse(req)) { + debug('skip parsing') + next() + return + } + + // get charset + var charset = getCharset(req) || defaultCharset + + // read + read(req, res, next, parse, debug, { + encoding: charset, + inflate: inflate, + limit: limit, + verify: verify + }) + } +} + +/** + * Get the charset of a request. + * + * @param {object} req + * @api private + */ + +function getCharset (req) { + try { + return (contentType.parse(req).parameters.charset || '').toLowerCase() + } catch (e) { + return undefined + } +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/node_modules/body-parser/lib/types/urlencoded.js b/node_modules/body-parser/lib/types/urlencoded.js new file mode 100644 index 0000000..5ccda21 --- /dev/null +++ b/node_modules/body-parser/lib/types/urlencoded.js @@ -0,0 +1,284 @@ +/*! + * body-parser + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var bytes = require('bytes') +var contentType = require('content-type') +var createError = require('http-errors') +var debug = require('debug')('body-parser:urlencoded') +var deprecate = require('depd')('body-parser') +var read = require('../read') +var typeis = require('type-is') + +/** + * Module exports. + */ + +module.exports = urlencoded + +/** + * Cache of parser modules. + */ + +var parsers = Object.create(null) + +/** + * Create a middleware to parse urlencoded bodies. + * + * @param {object} [options] + * @return {function} + * @public + */ + +function urlencoded (options) { + var opts = options || {} + + // notice because option default will flip in next major + if (opts.extended === undefined) { + deprecate('undefined extended: provide extended option') + } + + var extended = opts.extended !== false + var inflate = opts.inflate !== false + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var type = opts.type || 'application/x-www-form-urlencoded' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate query parser + var queryparse = extended + ? extendedparser(opts) + : simpleparser(opts) + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type + + function parse (body) { + return body.length + ? queryparse(body) + : {} + } + + return function urlencodedParser (req, res, next) { + if (req._body) { + debug('body already parsed') + next() + return + } + + req.body = req.body || {} + + // skip requests without bodies + if (!typeis.hasBody(req)) { + debug('skip empty body') + next() + return + } + + debug('content-type %j', req.headers['content-type']) + + // determine if request should be parsed + if (!shouldParse(req)) { + debug('skip parsing') + next() + return + } + + // assert charset + var charset = getCharset(req) || 'utf-8' + if (charset !== 'utf-8') { + debug('invalid charset') + next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', { + charset: charset, + type: 'charset.unsupported' + })) + return + } + + // read + read(req, res, next, parse, debug, { + debug: debug, + encoding: charset, + inflate: inflate, + limit: limit, + verify: verify + }) + } +} + +/** + * Get the extended query parser. + * + * @param {object} options + */ + +function extendedparser (options) { + var parameterLimit = options.parameterLimit !== undefined + ? options.parameterLimit + : 1000 + var parse = parser('qs') + + if (isNaN(parameterLimit) || parameterLimit < 1) { + throw new TypeError('option parameterLimit must be a positive number') + } + + if (isFinite(parameterLimit)) { + parameterLimit = parameterLimit | 0 + } + + return function queryparse (body) { + var paramCount = parameterCount(body, parameterLimit) + + if (paramCount === undefined) { + debug('too many parameters') + throw createError(413, 'too many parameters', { + type: 'parameters.too.many' + }) + } + + var arrayLimit = Math.max(100, paramCount) + + debug('parse extended urlencoding') + return parse(body, { + allowPrototypes: true, + arrayLimit: arrayLimit, + depth: Infinity, + parameterLimit: parameterLimit + }) + } +} + +/** + * Get the charset of a request. + * + * @param {object} req + * @api private + */ + +function getCharset (req) { + try { + return (contentType.parse(req).parameters.charset || '').toLowerCase() + } catch (e) { + return undefined + } +} + +/** + * Count the number of parameters, stopping once limit reached + * + * @param {string} body + * @param {number} limit + * @api private + */ + +function parameterCount (body, limit) { + var count = 0 + var index = 0 + + while ((index = body.indexOf('&', index)) !== -1) { + count++ + index++ + + if (count === limit) { + return undefined + } + } + + return count +} + +/** + * Get parser for module name dynamically. + * + * @param {string} name + * @return {function} + * @api private + */ + +function parser (name) { + var mod = parsers[name] + + if (mod !== undefined) { + return mod.parse + } + + // this uses a switch for static require analysis + switch (name) { + case 'qs': + mod = require('qs') + break + case 'querystring': + mod = require('querystring') + break + } + + // store to prevent invoking require() + parsers[name] = mod + + return mod.parse +} + +/** + * Get the simple query parser. + * + * @param {object} options + */ + +function simpleparser (options) { + var parameterLimit = options.parameterLimit !== undefined + ? options.parameterLimit + : 1000 + var parse = parser('querystring') + + if (isNaN(parameterLimit) || parameterLimit < 1) { + throw new TypeError('option parameterLimit must be a positive number') + } + + if (isFinite(parameterLimit)) { + parameterLimit = parameterLimit | 0 + } + + return function queryparse (body) { + var paramCount = parameterCount(body, parameterLimit) + + if (paramCount === undefined) { + debug('too many parameters') + throw createError(413, 'too many parameters', { + type: 'parameters.too.many' + }) + } + + debug('parse urlencoding') + return parse(body, undefined, undefined, {maxKeys: parameterLimit}) + } +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/node_modules/body-parser/package.json b/node_modules/body-parser/package.json new file mode 100644 index 0000000..684726f --- /dev/null +++ b/node_modules/body-parser/package.json @@ -0,0 +1,91 @@ +{ + "_from": "body-parser@~1.18.2", + "_id": "body-parser@1.18.2", + "_inBundle": false, + "_integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", + "_location": "/body-parser", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "body-parser@~1.18.2", + "name": "body-parser", + "escapedName": "body-parser", + "rawSpec": "~1.18.2", + "saveSpec": null, + "fetchSpec": "~1.18.2" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", + "_shasum": "87678a19d84b47d859b83199bd59bce222b10454", + "_spec": "body-parser@~1.18.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB", + "bugs": { + "url": "https://github.com/expressjs/body-parser/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com" + } + ], + "dependencies": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.1", + "http-errors": "~1.6.2", + "iconv-lite": "0.4.19", + "on-finished": "~2.3.0", + "qs": "6.5.1", + "raw-body": "2.3.2", + "type-is": "~1.6.15" + }, + "deprecated": false, + "description": "Node.js body parsing middleware", + "devDependencies": { + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.7.0", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-node": "5.1.1", + "eslint-plugin-promise": "3.5.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "methods": "1.1.2", + "mocha": "2.5.3", + "safe-buffer": "5.1.1", + "supertest": "1.1.0" + }, + "engines": { + "node": ">= 0.8" + }, + "files": [ + "lib/", + "LICENSE", + "HISTORY.md", + "index.js" + ], + "homepage": "https://github.com/expressjs/body-parser#readme", + "license": "MIT", + "name": "body-parser", + "repository": { + "type": "git", + "url": "git+https://github.com/expressjs/body-parser.git" + }, + "scripts": { + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --require test/support/env --reporter spec --check-leaks --bail test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks test/" + }, + "version": "1.18.2" +} diff --git a/node_modules/boxen/index.js b/node_modules/boxen/index.js new file mode 100644 index 0000000..b54b92d --- /dev/null +++ b/node_modules/boxen/index.js @@ -0,0 +1,138 @@ +'use strict'; +const stringWidth = require('string-width'); +const chalk = require('chalk'); +const widestLine = require('widest-line'); +const cliBoxes = require('cli-boxes'); +const camelCase = require('camelcase'); +const ansiAlign = require('ansi-align'); +const termSize = require('term-size'); + +const getObject = detail => { + let obj; + + if (typeof detail === 'number') { + obj = { + top: detail, + right: detail * 3, + bottom: detail, + left: detail * 3 + }; + } else { + obj = Object.assign({ + top: 0, + right: 0, + bottom: 0, + left: 0 + }, detail); + } + + return obj; +}; + +const getBorderChars = borderStyle => { + const sides = [ + 'topLeft', + 'topRight', + 'bottomRight', + 'bottomLeft', + 'vertical', + 'horizontal' + ]; + + let chars; + + if (typeof borderStyle === 'string') { + chars = cliBoxes[borderStyle]; + + if (!chars) { + throw new TypeError(`Invalid border style: ${borderStyle}`); + } + } else { + sides.forEach(key => { + if (!borderStyle[key] || typeof borderStyle[key] !== 'string') { + throw new TypeError(`Invalid border style: ${key}`); + } + }); + + chars = borderStyle; + } + + return chars; +}; + +const getBackgroundColorName = x => camelCase('bg', x); + +module.exports = (text, opts) => { + opts = Object.assign({ + padding: 0, + borderStyle: 'single', + dimBorder: false, + align: 'left', + float: 'left' + }, opts); + + if (opts.backgroundColor) { + opts.backgroundColor = getBackgroundColorName(opts.backgroundColor); + } + + if (opts.borderColor && !chalk[opts.borderColor]) { + throw new Error(`${opts.borderColor} is not a valid borderColor`); + } + + if (opts.backgroundColor && !chalk[opts.backgroundColor]) { + throw new Error(`${opts.backgroundColor} is not a valid backgroundColor`); + } + + const chars = getBorderChars(opts.borderStyle); + const padding = getObject(opts.padding); + const margin = getObject(opts.margin); + + const colorizeBorder = x => { + const ret = opts.borderColor ? chalk[opts.borderColor](x) : x; + return opts.dimBorder ? chalk.dim(ret) : ret; + }; + + const colorizeContent = x => opts.backgroundColor ? chalk[opts.backgroundColor](x) : x; + + text = ansiAlign(text, {align: opts.align}); + + const NL = '\n'; + const PAD = ' '; + + let lines = text.split(NL); + + if (padding.top > 0) { + lines = Array(padding.top).fill('').concat(lines); + } + + if (padding.bottom > 0) { + lines = lines.concat(Array(padding.bottom).fill('')); + } + + const contentWidth = widestLine(text) + padding.left + padding.right; + const paddingLeft = PAD.repeat(padding.left); + const columns = termSize().columns; + let marginLeft = PAD.repeat(margin.left); + + if (opts.float === 'center') { + const padWidth = Math.max((columns - contentWidth) / 2, 0); + marginLeft = PAD.repeat(padWidth); + } else if (opts.float === 'right') { + const padWidth = Math.max(columns - contentWidth - margin.right - 2, 0); + marginLeft = PAD.repeat(padWidth); + } + + const horizontal = chars.horizontal.repeat(contentWidth); + const top = colorizeBorder(NL.repeat(margin.top) + marginLeft + chars.topLeft + horizontal + chars.topRight); + const bottom = colorizeBorder(marginLeft + chars.bottomLeft + horizontal + chars.bottomRight + NL.repeat(margin.bottom)); + const side = colorizeBorder(chars.vertical); + + const middle = lines.map(line => { + const paddingRight = PAD.repeat(contentWidth - stringWidth(line) - padding.left); + return marginLeft + side + colorizeContent(paddingLeft + line + paddingRight) + side; + }).join(NL); + + return top + NL + middle + NL + bottom; +}; + +module.exports._borderStyles = cliBoxes; diff --git a/node_modules/boxen/license b/node_modules/boxen/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/boxen/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/boxen/node_modules/camelcase/index.js b/node_modules/boxen/node_modules/camelcase/index.js new file mode 100644 index 0000000..c8492a2 --- /dev/null +++ b/node_modules/boxen/node_modules/camelcase/index.js @@ -0,0 +1,64 @@ +'use strict'; + +function preserveCamelCase(str) { + let isLastCharLower = false; + let isLastCharUpper = false; + let isLastLastCharUpper = false; + + for (let i = 0; i < str.length; i++) { + const c = str[i]; + + if (isLastCharLower && /[a-zA-Z]/.test(c) && c.toUpperCase() === c) { + str = str.substr(0, i) + '-' + str.substr(i); + isLastCharLower = false; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = true; + i++; + } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(c) && c.toLowerCase() === c) { + str = str.substr(0, i - 1) + '-' + str.substr(i - 1); + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = false; + isLastCharLower = true; + } else { + isLastCharLower = c.toLowerCase() === c; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = c.toUpperCase() === c; + } + } + + return str; +} + +module.exports = function (str) { + if (arguments.length > 1) { + str = Array.from(arguments) + .map(x => x.trim()) + .filter(x => x.length) + .join('-'); + } else { + str = str.trim(); + } + + if (str.length === 0) { + return ''; + } + + if (str.length === 1) { + return str.toLowerCase(); + } + + if (/^[a-z0-9]+$/.test(str)) { + return str; + } + + const hasUpperCase = str !== str.toLowerCase(); + + if (hasUpperCase) { + str = preserveCamelCase(str); + } + + return str + .replace(/^[_.\- ]+/, '') + .toLowerCase() + .replace(/[_.\- ]+(\w|$)/g, (m, p1) => p1.toUpperCase()); +}; diff --git a/node_modules/boxen/node_modules/camelcase/license b/node_modules/boxen/node_modules/camelcase/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/boxen/node_modules/camelcase/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/boxen/node_modules/camelcase/package.json b/node_modules/boxen/node_modules/camelcase/package.json new file mode 100644 index 0000000..c673aa1 --- /dev/null +++ b/node_modules/boxen/node_modules/camelcase/package.json @@ -0,0 +1,74 @@ +{ + "_from": "camelcase@^4.0.0", + "_id": "camelcase@4.1.0", + "_inBundle": false, + "_integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "_location": "/boxen/camelcase", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "camelcase@^4.0.0", + "name": "camelcase", + "escapedName": "camelcase", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/boxen" + ], + "_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "_shasum": "d545635be1e33c542649c69173e5de6acfae34dd", + "_spec": "camelcase@^4.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/boxen", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/camelcase/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/camelcase#readme", + "keywords": [ + "camelcase", + "camel-case", + "camel", + "case", + "dash", + "hyphen", + "dot", + "underscore", + "separator", + "string", + "text", + "convert" + ], + "license": "MIT", + "name": "camelcase", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/camelcase.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "4.1.0", + "xo": { + "esnext": true + } +} diff --git a/node_modules/boxen/node_modules/camelcase/readme.md b/node_modules/boxen/node_modules/camelcase/readme.md new file mode 100644 index 0000000..0610dc6 --- /dev/null +++ b/node_modules/boxen/node_modules/camelcase/readme.md @@ -0,0 +1,57 @@ +# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase) + +> Convert a dash/dot/underscore/space separated string to camelCase: `foo-bar` → `fooBar` + + +## Install + +``` +$ npm install --save camelcase +``` + + +## Usage + +```js +const camelCase = require('camelcase'); + +camelCase('foo-bar'); +//=> 'fooBar' + +camelCase('foo_bar'); +//=> 'fooBar' + +camelCase('Foo-Bar'); +//=> 'fooBar' + +camelCase('--foo.bar'); +//=> 'fooBar' + +camelCase('__foo__bar__'); +//=> 'fooBar' + +camelCase('foo bar'); +//=> 'fooBar' + +console.log(process.argv[3]); +//=> '--foo-bar' +camelCase(process.argv[3]); +//=> 'fooBar' + +camelCase('foo', 'bar'); +//=> 'fooBar' + +camelCase('__foo__', '--bar'); +//=> 'fooBar' +``` + + +## Related + +- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module +- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/boxen/package.json b/node_modules/boxen/package.json new file mode 100644 index 0000000..af14dec --- /dev/null +++ b/node_modules/boxen/package.json @@ -0,0 +1,79 @@ +{ + "_from": "boxen@^1.2.1", + "_id": "boxen@1.3.0", + "_inBundle": false, + "_integrity": "sha512-TNPjfTr432qx7yOjQyaXm3dSR0MH9vXp7eT1BFSl/C51g+EFnOR9hTg1IreahGBmDNCehscshe45f+C1TBZbLw==", + "_location": "/boxen", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "boxen@^1.2.1", + "name": "boxen", + "escapedName": "boxen", + "rawSpec": "^1.2.1", + "saveSpec": null, + "fetchSpec": "^1.2.1" + }, + "_requiredBy": [ + "/update-notifier" + ], + "_resolved": "https://registry.npmjs.org/boxen/-/boxen-1.3.0.tgz", + "_shasum": "55c6c39a8ba58d9c61ad22cd877532deb665a20b", + "_spec": "boxen@^1.2.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/update-notifier", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/boxen/issues" + }, + "bundleDependencies": false, + "dependencies": { + "ansi-align": "^2.0.0", + "camelcase": "^4.0.0", + "chalk": "^2.0.1", + "cli-boxes": "^1.0.0", + "string-width": "^2.0.0", + "term-size": "^1.2.0", + "widest-line": "^2.0.0" + }, + "deprecated": false, + "description": "Create boxes in the terminal", + "devDependencies": { + "ava": "*", + "nyc": "^11.0.3", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/boxen#readme", + "keywords": [ + "cli", + "box", + "boxes", + "terminal", + "term", + "console", + "ascii", + "unicode", + "border", + "text" + ], + "license": "MIT", + "name": "boxen", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/boxen.git" + }, + "scripts": { + "test": "xo && nyc ava" + }, + "version": "1.3.0" +} diff --git a/node_modules/boxen/readme.md b/node_modules/boxen/readme.md new file mode 100644 index 0000000..d8db8e9 --- /dev/null +++ b/node_modules/boxen/readme.md @@ -0,0 +1,175 @@ +# boxen + +> Create boxes in the terminal + +[![Build Status](https://travis-ci.org/sindresorhus/boxen.svg?branch=master)](https://travis-ci.org/sindresorhus/boxen) + + +## Install + +``` +$ npm install boxen +``` + + +## Usage + +```js +const boxen = require('boxen'); + +console.log(boxen('unicorn', {padding: 1})); +/* +┌─────────────┐ +│ │ +│ unicorn │ +│ │ +└─────────────┘ +*/ + +console.log(boxen('unicorn', {padding: 1, margin: 1, borderStyle: 'double'})); +/* + + ╔═════════════╗ + ║ ║ + ║ unicorn ║ + ║ ║ + ╚═════════════╝ + +*/ +``` + + +## API + +### boxen(input, [options]) + +#### input + +Type: `string` + +Text inside the box. + +#### options + +##### borderColor + +Type: `string`
+Values: `black` `red` `green` `yellow` `blue` `magenta` `cyan` `white` `gray` + +Color of the box border. + +##### borderStyle + +Type: `string` `object`
+Default: `single`
+Values: +- `single` +``` +┌───┐ +│foo│ +└───┘ +``` +- `double` +``` +╔═══╗ +║foo║ +╚═══╝ +``` +- `round` (`single` sides with round corners) +``` +╭───╮ +│foo│ +╰───╯ +``` +- `single-double` (`single` on top and bottom, `double` on right and left) +``` +╓───╖ +║foo║ +╙───╜ +``` +- `double-single` (`double` on top and bottom, `single` on right and left) +``` +╒═══╕ +│foo│ +╘═══╛ +``` +- `classic` +``` ++---+ +|foo| ++---+ +``` + +Style of the box border. + +Can be any of the above predefined styles or an object with the following keys: + +```js +{ + topLeft: '+', + topRight: '+', + bottomLeft: '+', + bottomRight: '+', + horizontal: '-', + vertical: '|' +} +``` + +##### dimBorder + +Type: `boolean`
+Default: `false` + +Reduce opacity of the border. + +##### padding + +Type: `number` `Object`
+Default: `0` + +Space between the text and box border. + +Accepts a number or an object with any of the `top`, `right`, `bottom`, `left` properties. When a number is specified, the left/right padding is 3 times the top/bottom to make it look nice. + +##### margin + +Type: `number` `Object`
+Default: `0` + +Space around the box. + +Accepts a number or an object with any of the `top`, `right`, `bottom`, `left` properties. When a number is specified, the left/right margin is 3 times the top/bottom to make it look nice. + +##### float + +Type: `string`
+Values: `right` `center` `left`
+Default: `left` + +Float the box on the available terminal screen space. + +##### backgroundColor + +Type: `string`
+Values: `black` `red` `green` `yellow` `blue` `magenta` `cyan` `white` + +Color of the background. + +##### align + +Type: `string`
+Default: `left`
+Values: `left` `center` `right` + +Align the text in the box based on the widest line. + + +## Related + +- [boxen-cli](https://github.com/sindresorhus/boxen-cli) - CLI for this module +- [cli-boxes](https://github.com/sindresorhus/cli-boxes) - Boxes for use in the terminal + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/brace-expansion/LICENSE b/node_modules/brace-expansion/LICENSE new file mode 100644 index 0000000..de32266 --- /dev/null +++ b/node_modules/brace-expansion/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013 Julian Gruber + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/brace-expansion/README.md b/node_modules/brace-expansion/README.md new file mode 100644 index 0000000..6b4e0e1 --- /dev/null +++ b/node_modules/brace-expansion/README.md @@ -0,0 +1,129 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) +[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) +[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## Sponsors + +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! + +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/brace-expansion/index.js b/node_modules/brace-expansion/index.js new file mode 100644 index 0000000..0478be8 --- /dev/null +++ b/node_modules/brace-expansion/index.js @@ -0,0 +1,201 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} + diff --git a/node_modules/brace-expansion/package.json b/node_modules/brace-expansion/package.json new file mode 100644 index 0000000..c5b194e --- /dev/null +++ b/node_modules/brace-expansion/package.json @@ -0,0 +1,75 @@ +{ + "_from": "brace-expansion@^1.1.7", + "_id": "brace-expansion@1.1.11", + "_inBundle": false, + "_integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "_location": "/brace-expansion", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "brace-expansion@^1.1.7", + "name": "brace-expansion", + "escapedName": "brace-expansion", + "rawSpec": "^1.1.7", + "saveSpec": null, + "fetchSpec": "^1.1.7" + }, + "_requiredBy": [ + "/minimatch" + ], + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "_shasum": "3c7fcbf529d87226f3d2f52b966ff5271eb441dd", + "_spec": "brace-expansion@^1.1.7", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/minimatch", + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "bugs": { + "url": "https://github.com/juliangruber/brace-expansion/issues" + }, + "bundleDependencies": false, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "deprecated": false, + "description": "Brace expansion as known from sh/bash", + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "keywords": [], + "license": "MIT", + "main": "index.js", + "name": "brace-expansion", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "scripts": { + "bench": "matcha test/perf/bench.js", + "gentest": "bash test/generate.sh", + "test": "tape test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "version": "1.1.11" +} diff --git a/node_modules/braces/LICENSE b/node_modules/braces/LICENSE new file mode 100644 index 0000000..d32ab44 --- /dev/null +++ b/node_modules/braces/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2018, 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/node_modules/braces/README.md b/node_modules/braces/README.md new file mode 100644 index 0000000..f909bfb --- /dev/null +++ b/node_modules/braces/README.md @@ -0,0 +1,640 @@ +# braces [![NPM version](https://img.shields.io/npm/v/braces.svg?style=flat)](https://www.npmjs.com/package/braces) [![NPM monthly downloads](https://img.shields.io/npm/dm/braces.svg?style=flat)](https://npmjs.org/package/braces) [![NPM total downloads](https://img.shields.io/npm/dt/braces.svg?style=flat)](https://npmjs.org/package/braces) [![Linux Build Status](https://img.shields.io/travis/micromatch/braces.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/braces) [![Windows Build Status](https://img.shields.io/appveyor/ci/micromatch/braces.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/micromatch/braces) + +> Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save braces +``` + +## Why use braces? + +Brace patterns are great for matching ranges. Users (and implementors) shouldn't have to think about whether or not they will break their application (or yours) from accidentally defining an aggressive brace pattern. _Braces is the only library that offers a [solution to this problem](#performance)_. + +* **Safe(r)**: Braces isn't vulnerable to DoS attacks like [brace-expansion](https://github.com/juliangruber/brace-expansion), [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch) (a different bug than the [other regex DoS bug](https://medium.com/node-security/minimatch-redos-vulnerability-590da24e6d3c#.jew0b6mpc)). +* **Accurate**: complete support for the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/) specification (passes all of the Bash braces tests) +* **[fast and performant](#benchmarks)**: Starts fast, runs fast and [scales well](#performance) as patterns increase in complexity. +* **Organized code base**: with parser and compiler that are eas(y|ier) to maintain and update when edge cases crop up. +* **Well-tested**: thousands of test assertions. Passes 100% of the [minimatch](https://github.com/isaacs/minimatch) and [brace-expansion](https://github.com/juliangruber/brace-expansion) unit tests as well (as of the writing of this). + +## Usage + +The main export is a function that takes one or more brace `patterns` and `options`. + +```js +var braces = require('braces'); +braces(pattern[, options]); +``` + +By default, braces returns an optimized regex-source string. To get an array of brace patterns, use `brace.expand()`. + +The following section explains the difference in more detail. _(If you're curious about "why" braces does this by default, see [brace matching pitfalls](#brace-matching-pitfalls)_. + +### Optimized vs. expanded braces + +**Optimized** + +By default, patterns are optimized for regex and matching: + +```js +console.log(braces('a/{x,y,z}/b')); +//=> ['a/(x|y|z)/b'] +``` + +**Expanded** + +To expand patterns the same way as Bash or [minimatch](https://github.com/isaacs/minimatch), use the [.expand](#expand) method: + +```js +console.log(braces.expand('a/{x,y,z}/b')); +//=> ['a/x/b', 'a/y/b', 'a/z/b'] +``` + +Or use [options.expand](#optionsexpand): + +```js +console.log(braces('a/{x,y,z}/b', {expand: true})); +//=> ['a/x/b', 'a/y/b', 'a/z/b'] +``` + +## Features + +* [lists](#lists): Supports "lists": `a/{b,c}/d` => `['a/b/d', 'a/c/d']` +* [sequences](#sequences): Supports alphabetical or numerical "sequences" (ranges): `{1..3}` => `['1', '2', '3']` +* [steps](#steps): Supports "steps" or increments: `{2..10..2}` => `['2', '4', '6', '8', '10']` +* [escaping](#escaping) +* [options](#options) + +### Lists + +Uses [fill-range](https://github.com/jonschlinkert/fill-range) for expanding alphabetical or numeric lists: + +```js +console.log(braces('a/{foo,bar,baz}/*.js')); +//=> ['a/(foo|bar|baz)/*.js'] + +console.log(braces.expand('a/{foo,bar,baz}/*.js')); +//=> ['a/foo/*.js', 'a/bar/*.js', 'a/baz/*.js'] +``` + +### Sequences + +Uses [fill-range](https://github.com/jonschlinkert/fill-range) for expanding alphabetical or numeric ranges (bash "sequences"): + +```js +console.log(braces.expand('{1..3}')); // ['1', '2', '3'] +console.log(braces.expand('a{01..03}b')); // ['a01b', 'a02b', 'a03b'] +console.log(braces.expand('a{1..3}b')); // ['a1b', 'a2b', 'a3b'] +console.log(braces.expand('{a..c}')); // ['a', 'b', 'c'] +console.log(braces.expand('foo/{a..c}')); // ['foo/a', 'foo/b', 'foo/c'] + +// supports padded ranges +console.log(braces('a{01..03}b')); //=> [ 'a(0[1-3])b' ] +console.log(braces('a{001..300}b')); //=> [ 'a(0{2}[1-9]|0[1-9][0-9]|[12][0-9]{2}|300)b' ] +``` + +### Steps + +Steps, or increments, may be used with ranges: + +```js +console.log(braces.expand('{2..10..2}')); +//=> ['2', '4', '6', '8', '10'] + +console.log(braces('{2..10..2}')); +//=> ['(2|4|6|8|10)'] +``` + +When the [.optimize](#optimize) method is used, or [options.optimize](#optionsoptimize) is set to true, sequences are passed to [to-regex-range](https://github.com/jonschlinkert/to-regex-range) for expansion. + +### Nesting + +Brace patterns may be nested. The results of each expanded string are not sorted, and left to right order is preserved. + +**"Expanded" braces** + +```js +console.log(braces.expand('a{b,c,/{x,y}}/e')); +//=> ['ab/e', 'ac/e', 'a/x/e', 'a/y/e'] + +console.log(braces.expand('a/{x,{1..5},y}/c')); +//=> ['a/x/c', 'a/1/c', 'a/2/c', 'a/3/c', 'a/4/c', 'a/5/c', 'a/y/c'] +``` + +**"Optimized" braces** + +```js +console.log(braces('a{b,c,/{x,y}}/e')); +//=> ['a(b|c|/(x|y))/e'] + +console.log(braces('a/{x,{1..5},y}/c')); +//=> ['a/(x|([1-5])|y)/c'] +``` + +### Escaping + +**Escaping braces** + +A brace pattern will not be expanded or evaluted if _either the opening or closing brace is escaped_: + +```js +console.log(braces.expand('a\\{d,c,b}e')); +//=> ['a{d,c,b}e'] + +console.log(braces.expand('a{d,c,b\\}e')); +//=> ['a{d,c,b}e'] +``` + +**Escaping commas** + +Commas inside braces may also be escaped: + +```js +console.log(braces.expand('a{b\\,c}d')); +//=> ['a{b,c}d'] + +console.log(braces.expand('a{d\\,c,b}e')); +//=> ['ad,ce', 'abe'] +``` + +**Single items** + +Following bash conventions, a brace pattern is also not expanded when it contains a single character: + +```js +console.log(braces.expand('a{b}c')); +//=> ['a{b}c'] +``` + +## Options + +### options.maxLength + +**Type**: `Number` + +**Default**: `65,536` + +**Description**: Limit the length of the input string. Useful when the input string is generated or your application allows users to pass a string, et cetera. + +```js +console.log(braces('a/{b,c}/d', { maxLength: 3 })); //=> throws an error +``` + +### options.expand + +**Type**: `Boolean` + +**Default**: `undefined` + +**Description**: Generate an "expanded" brace pattern (this option is unncessary with the `.expand` method, which does the same thing). + +```js +console.log(braces('a/{b,c}/d', {expand: true})); +//=> [ 'a/b/d', 'a/c/d' ] +``` + +### options.optimize + +**Type**: `Boolean` + +**Default**: `true` + +**Description**: Enabled by default. + +```js +console.log(braces('a/{b,c}/d')); +//=> [ 'a/(b|c)/d' ] +``` + +### options.nodupes + +**Type**: `Boolean` + +**Default**: `true` + +**Description**: Duplicates are removed by default. To keep duplicates, pass `{nodupes: false}` on the options + +### options.rangeLimit + +**Type**: `Number` + +**Default**: `250` + +**Description**: When `braces.expand()` is used, or `options.expand` is true, brace patterns will automatically be [optimized](#optionsoptimize) when the difference between the range minimum and range maximum exceeds the `rangeLimit`. This is to prevent huge ranges from freezing your application. + +You can set this to any number, or change `options.rangeLimit` to `Inifinity` to disable this altogether. + +**Examples** + +```js +// pattern exceeds the "rangeLimit", so it's optimized automatically +console.log(braces.expand('{1..1000}')); +//=> ['([1-9]|[1-9][0-9]{1,2}|1000)'] + +// pattern does not exceed "rangeLimit", so it's NOT optimized +console.log(braces.expand('{1..100}')); +//=> ['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'] +``` + +### options.transform + +**Type**: `Function` + +**Default**: `undefined` + +**Description**: Customize range expansion. + +```js +var range = braces.expand('x{a..e}y', { + transform: function(str) { + return 'foo' + str; + } +}); + +console.log(range); +//=> [ 'xfooay', 'xfooby', 'xfoocy', 'xfoody', 'xfooey' ] +``` + +### options.quantifiers + +**Type**: `Boolean` + +**Default**: `undefined` + +**Description**: In regular expressions, quanitifiers can be used to specify how many times a token can be repeated. For example, `a{1,3}` will match the letter `a` one to three times. + +Unfortunately, regex quantifiers happen to share the same syntax as [Bash lists](#lists) + +The `quantifiers` option tells braces to detect when [regex quantifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#quantifiers) are defined in the given pattern, and not to try to expand them as lists. + +**Examples** + +```js +var braces = require('braces'); +console.log(braces('a/b{1,3}/{x,y,z}')); +//=> [ 'a/b(1|3)/(x|y|z)' ] +console.log(braces('a/b{1,3}/{x,y,z}', {quantifiers: true})); +//=> [ 'a/b{1,3}/(x|y|z)' ] +console.log(braces('a/b{1,3}/{x,y,z}', {quantifiers: true, expand: true})); +//=> [ 'a/b{1,3}/x', 'a/b{1,3}/y', 'a/b{1,3}/z' ] +``` + +### options.unescape + +**Type**: `Boolean` + +**Default**: `undefined` + +**Description**: Strip backslashes that were used for escaping from the result. + +## What is "brace expansion"? + +Brace expansion is a type of parameter expansion that was made popular by unix shells for generating lists of strings, as well as regex-like matching when used alongside wildcards (globs). + +In addition to "expansion", braces are also used for matching. In other words: + +* [brace expansion](#brace-expansion) is for generating new lists +* [brace matching](#brace-matching) is for filtering existing lists + +
+More about brace expansion (click to expand) + +There are two main types of brace expansion: + +1. **lists**: which are defined using comma-separated values inside curly braces: `{a,b,c}` +2. **sequences**: which are defined using a starting value and an ending value, separated by two dots: `a{1..3}b`. Optionally, a third argument may be passed to define a "step" or increment to use: `a{1..100..10}b`. These are also sometimes referred to as "ranges". + +Here are some example brace patterns to illustrate how they work: + +**Sets** + +``` +{a,b,c} => a b c +{a,b,c}{1,2} => a1 a2 b1 b2 c1 c2 +``` + +**Sequences** + +``` +{1..9} => 1 2 3 4 5 6 7 8 9 +{4..-4} => 4 3 2 1 0 -1 -2 -3 -4 +{1..20..3} => 1 4 7 10 13 16 19 +{a..j} => a b c d e f g h i j +{j..a} => j i h g f e d c b a +{a..z..3} => a d g j m p s v y +``` + +**Combination** + +Sets and sequences can be mixed together or used along with any other strings. + +``` +{a,b,c}{1..3} => a1 a2 a3 b1 b2 b3 c1 c2 c3 +foo/{a,b,c}/bar => foo/a/bar foo/b/bar foo/c/bar +``` + +The fact that braces can be "expanded" from relatively simple patterns makes them ideal for quickly generating test fixtures, file paths, and similar use cases. + +## Brace matching + +In addition to _expansion_, brace patterns are also useful for performing regular-expression-like matching. + +For example, the pattern `foo/{1..3}/bar` would match any of following strings: + +``` +foo/1/bar +foo/2/bar +foo/3/bar +``` + +But not: + +``` +baz/1/qux +baz/2/qux +baz/3/qux +``` + +Braces can also be combined with [glob patterns](https://github.com/jonschlinkert/micromatch) to perform more advanced wildcard matching. For example, the pattern `*/{1..3}/*` would match any of following strings: + +``` +foo/1/bar +foo/2/bar +foo/3/bar +baz/1/qux +baz/2/qux +baz/3/qux +``` + +## Brace matching pitfalls + +Although brace patterns offer a user-friendly way of matching ranges or sets of strings, there are also some major disadvantages and potential risks you should be aware of. + +### tldr + +**"brace bombs"** + +* brace expansion can eat up a huge amount of processing resources +* as brace patterns increase _linearly in size_, the system resources required to expand the pattern increase exponentially +* users can accidentally (or intentially) exhaust your system's resources resulting in the equivalent of a DoS attack (bonus: no programming knowledge is required!) + +For a more detailed explanation with examples, see the [geometric complexity](#geometric-complexity) section. + +### The solution + +Jump to the [performance section](#performance) to see how Braces solves this problem in comparison to other libraries. + +### Geometric complexity + +At minimum, brace patterns with sets limited to two elements have quadradic or `O(n^2)` complexity. But the complexity of the algorithm increases exponentially as the number of sets, _and elements per set_, increases, which is `O(n^c)`. + +For example, the following sets demonstrate quadratic (`O(n^2)`) complexity: + +``` +{1,2}{3,4} => (2X2) => 13 14 23 24 +{1,2}{3,4}{5,6} => (2X2X2) => 135 136 145 146 235 236 245 246 +``` + +But add an element to a set, and we get a n-fold Cartesian product with `O(n^c)` complexity: + +``` +{1,2,3}{4,5,6}{7,8,9} => (3X3X3) => 147 148 149 157 158 159 167 168 169 247 248 + 249 257 258 259 267 268 269 347 348 349 357 + 358 359 367 368 369 +``` + +Now, imagine how this complexity grows given that each element is a n-tuple: + +``` +{1..100}{1..100} => (100X100) => 10,000 elements (38.4 kB) +{1..100}{1..100}{1..100} => (100X100X100) => 1,000,000 elements (5.76 MB) +``` + +Although these examples are clearly contrived, they demonstrate how brace patterns can quickly grow out of control. + +**More information** + +Interested in learning more about brace expansion? + +* [linuxjournal/bash-brace-expansion](http://www.linuxjournal.com/content/bash-brace-expansion) +* [rosettacode/Brace_expansion](https://rosettacode.org/wiki/Brace_expansion) +* [cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) + +
+ +## Performance + +Braces is not only screaming fast, it's also more accurate the other brace expansion libraries. + +### Better algorithms + +Fortunately there is a solution to the ["brace bomb" problem](#brace-matching-pitfalls): _don't expand brace patterns into an array when they're used for matching_. + +Instead, convert the pattern into an optimized regular expression. This is easier said than done, and braces is the only library that does this currently. + +**The proof is in the numbers** + +Minimatch gets exponentially slower as patterns increase in complexity, braces does not. The following results were generated using `braces()` and `minimatch.braceExpand()`, respectively. + +| **Pattern** | **braces** | **[minimatch](https://github.com/isaacs/minimatch)** | +| --- | --- | --- | +| `{1..9007199254740991}`[1] | `298 B` (5ms 459μs) | N/A (freezes) | +| `{1..1000000000000000}` | `41 B` (1ms 15μs) | N/A (freezes) | +| `{1..100000000000000}` | `40 B` (890μs) | N/A (freezes) | +| `{1..10000000000000}` | `39 B` (2ms 49μs) | N/A (freezes) | +| `{1..1000000000000}` | `38 B` (608μs) | N/A (freezes) | +| `{1..100000000000}` | `37 B` (397μs) | N/A (freezes) | +| `{1..10000000000}` | `35 B` (983μs) | N/A (freezes) | +| `{1..1000000000}` | `34 B` (798μs) | N/A (freezes) | +| `{1..100000000}` | `33 B` (733μs) | N/A (freezes) | +| `{1..10000000}` | `32 B` (5ms 632μs) | `78.89 MB` (16s 388ms 569μs) | +| `{1..1000000}` | `31 B` (1ms 381μs) | `6.89 MB` (1s 496ms 887μs) | +| `{1..100000}` | `30 B` (950μs) | `588.89 kB` (146ms 921μs) | +| `{1..10000}` | `29 B` (1ms 114μs) | `48.89 kB` (14ms 187μs) | +| `{1..1000}` | `28 B` (760μs) | `3.89 kB` (1ms 453μs) | +| `{1..100}` | `22 B` (345μs) | `291 B` (196μs) | +| `{1..10}` | `10 B` (533μs) | `20 B` (37μs) | +| `{1..3}` | `7 B` (190μs) | `5 B` (27μs) | + +### Faster algorithms + +When you need expansion, braces is still much faster. + +_(the following results were generated using `braces.expand()` and `minimatch.braceExpand()`, respectively)_ + +| **Pattern** | **braces** | **[minimatch](https://github.com/isaacs/minimatch)** | +| --- | --- | --- | +| `{1..10000000}` | `78.89 MB` (2s 698ms 642μs) | `78.89 MB` (18s 601ms 974μs) | +| `{1..1000000}` | `6.89 MB` (458ms 576μs) | `6.89 MB` (1s 491ms 621μs) | +| `{1..100000}` | `588.89 kB` (20ms 728μs) | `588.89 kB` (156ms 919μs) | +| `{1..10000}` | `48.89 kB` (2ms 202μs) | `48.89 kB` (13ms 641μs) | +| `{1..1000}` | `3.89 kB` (1ms 796μs) | `3.89 kB` (1ms 958μs) | +| `{1..100}` | `291 B` (424μs) | `291 B` (211μs) | +| `{1..10}` | `20 B` (487μs) | `20 B` (72μs) | +| `{1..3}` | `5 B` (166μs) | `5 B` (27μs) | + +If you'd like to run these comparisons yourself, see [test/support/generate.js](test/support/generate.js). + +## Benchmarks + +### Running benchmarks + +Install dev dependencies: + +```bash +npm i -d && npm benchmark +``` + +### Latest results + +```bash +Benchmarking: (8 of 8) + · combination-nested + · combination + · escaped + · list-basic + · list-multiple + · no-braces + · sequence-basic + · sequence-multiple + +# benchmark/fixtures/combination-nested.js (52 bytes) + brace-expansion x 4,756 ops/sec ±1.09% (86 runs sampled) + braces x 11,202,303 ops/sec ±1.06% (88 runs sampled) + minimatch x 4,816 ops/sec ±0.99% (87 runs sampled) + + fastest is braces + +# benchmark/fixtures/combination.js (51 bytes) + brace-expansion x 625 ops/sec ±0.87% (87 runs sampled) + braces x 11,031,884 ops/sec ±0.72% (90 runs sampled) + minimatch x 637 ops/sec ±0.84% (88 runs sampled) + + fastest is braces + +# benchmark/fixtures/escaped.js (44 bytes) + brace-expansion x 163,325 ops/sec ±1.05% (87 runs sampled) + braces x 10,655,071 ops/sec ±1.22% (88 runs sampled) + minimatch x 147,495 ops/sec ±0.96% (88 runs sampled) + + fastest is braces + +# benchmark/fixtures/list-basic.js (40 bytes) + brace-expansion x 99,726 ops/sec ±1.07% (83 runs sampled) + braces x 10,596,584 ops/sec ±0.98% (88 runs sampled) + minimatch x 100,069 ops/sec ±1.17% (86 runs sampled) + + fastest is braces + +# benchmark/fixtures/list-multiple.js (52 bytes) + brace-expansion x 34,348 ops/sec ±1.08% (88 runs sampled) + braces x 9,264,131 ops/sec ±1.12% (88 runs sampled) + minimatch x 34,893 ops/sec ±0.87% (87 runs sampled) + + fastest is braces + +# benchmark/fixtures/no-braces.js (48 bytes) + brace-expansion x 275,368 ops/sec ±1.18% (89 runs sampled) + braces x 9,134,677 ops/sec ±0.95% (88 runs sampled) + minimatch x 3,755,954 ops/sec ±1.13% (89 runs sampled) + + fastest is braces + +# benchmark/fixtures/sequence-basic.js (41 bytes) + brace-expansion x 5,492 ops/sec ±1.35% (87 runs sampled) + braces x 8,485,034 ops/sec ±1.28% (89 runs sampled) + minimatch x 5,341 ops/sec ±1.17% (87 runs sampled) + + fastest is braces + +# benchmark/fixtures/sequence-multiple.js (51 bytes) + brace-expansion x 116 ops/sec ±0.77% (77 runs sampled) + braces x 9,445,118 ops/sec ±1.32% (84 runs sampled) + minimatch x 109 ops/sec ±1.16% (76 runs sampled) + + fastest is braces +``` + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Related projects + +You might also be interested in these projects: + +* [expand-brackets](https://www.npmjs.com/package/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns. | [homepage](https://github.com/jonschlinkert/expand-brackets "Expand POSIX bracket expressions (character classes) in glob patterns.") +* [extglob](https://www.npmjs.com/package/extglob): Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob… [more](https://github.com/micromatch/extglob) | [homepage](https://github.com/micromatch/extglob "Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns.") +* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or `step` to… [more](https://github.com/jonschlinkert/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`") +* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/micromatch/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") +* [nanomatch](https://www.npmjs.com/package/nanomatch): Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash… [more](https://github.com/micromatch/nanomatch) | [homepage](https://github.com/micromatch/nanomatch "Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash 4.3 wildcard support only (no support for exglobs, posix brackets or braces)") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 188 | [jonschlinkert](https://github.com/jonschlinkert) | +| 4 | [doowb](https://github.com/doowb) | +| 1 | [es128](https://github.com/es128) | +| 1 | [eush77](https://github.com/eush77) | +| 1 | [hemanth](https://github.com/hemanth) | + +### Author + +**Jon Schlinkert** + +* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert) +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on February 17, 2018._ + +
+
+
    +
  1. this is the largest safe integer allowed in JavaScript. + +
  2. +
+
\ No newline at end of file diff --git a/node_modules/braces/index.js b/node_modules/braces/index.js new file mode 100644 index 0000000..b3170ed --- /dev/null +++ b/node_modules/braces/index.js @@ -0,0 +1,315 @@ +'use strict'; + +/** + * Module dependencies + */ + +var toRegex = require('to-regex'); +var unique = require('array-unique'); +var extend = require('extend-shallow'); +var define = require('define-property'); + +/** + * Local dependencies + */ + +var compilers = require('./lib/compilers'); +var parsers = require('./lib/parsers'); +var Braces = require('./lib/braces'); +var utils = require('./lib/utils'); +var MAX_LENGTH = 1024 * 64; +var cache = {}; + +/** + * Convert the given `braces` pattern into a regex-compatible string. By default, only one string is generated for every input string. Set `options.expand` to true to return an array of patterns (similar to Bash or minimatch. Before using `options.expand`, it's recommended that you read the [performance notes](#performance)). + * + * ```js + * var braces = require('braces'); + * console.log(braces('{a,b,c}')); + * //=> ['(a|b|c)'] + * + * console.log(braces('{a,b,c}', {expand: true})); + * //=> ['a', 'b', 'c'] + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {String} + * @api public + */ + +function braces(pattern, options) { + var key = utils.createKey(String(pattern), options); + var arr = []; + + var disabled = options && options.cache === false; + if (!disabled && cache.hasOwnProperty(key)) { + return cache[key]; + } + + if (Array.isArray(pattern)) { + for (var i = 0; i < pattern.length; i++) { + arr.push.apply(arr, braces.create(pattern[i], options)); + } + } else { + arr = braces.create(pattern, options); + } + + if (options && options.nodupes === true) { + arr = unique(arr); + } + + if (!disabled) { + cache[key] = arr; + } + return arr; +} + +/** + * Expands a brace pattern into an array. This method is called by the main [braces](#braces) function when `options.expand` is true. Before using this method it's recommended that you read the [performance notes](#performance)) and advantages of using [.optimize](#optimize) instead. + * + * ```js + * var braces = require('braces'); + * console.log(braces.expand('a/{b,c}/d')); + * //=> ['a/b/d', 'a/c/d']; + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.expand = function(pattern, options) { + return braces.create(pattern, extend({}, options, {expand: true})); +}; + +/** + * Expands a brace pattern into a regex-compatible, optimized string. This method is called by the main [braces](#braces) function by default. + * + * ```js + * var braces = require('braces'); + * console.log(braces.expand('a/{b,c}/d')); + * //=> ['a/(b|c)/d'] + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.optimize = function(pattern, options) { + return braces.create(pattern, options); +}; + +/** + * Processes a brace pattern and returns either an expanded array (if `options.expand` is true), a highly optimized regex-compatible string. This method is called by the main [braces](#braces) function. + * + * ```js + * var braces = require('braces'); + * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}')) + * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)' + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.create = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + + var maxLength = (options && options.maxLength) || MAX_LENGTH; + if (pattern.length >= maxLength) { + throw new Error('expected pattern to be less than ' + maxLength + ' characters'); + } + + function create() { + if (pattern === '' || pattern.length < 3) { + return [pattern]; + } + + if (utils.isEmptySets(pattern)) { + return []; + } + + if (utils.isQuotedString(pattern)) { + return [pattern.slice(1, -1)]; + } + + var proto = new Braces(options); + var result = !options || options.expand !== true + ? proto.optimize(pattern, options) + : proto.expand(pattern, options); + + // get the generated pattern(s) + var arr = result.output; + + // filter out empty strings if specified + if (options && options.noempty === true) { + arr = arr.filter(Boolean); + } + + // filter out duplicates if specified + if (options && options.nodupes === true) { + arr = unique(arr); + } + + define(arr, 'result', result); + return arr; + } + + return memoize('create', pattern, options, create); +}; + +/** + * Create a regular expression from the given string `pattern`. + * + * ```js + * var braces = require('braces'); + * + * console.log(braces.makeRe('id-{200..300}')); + * //=> /^(?:id-(20[0-9]|2[1-9][0-9]|300))$/ + * ``` + * @param {String} `pattern` The pattern to convert to regex. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +braces.makeRe = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + + var maxLength = (options && options.maxLength) || MAX_LENGTH; + if (pattern.length >= maxLength) { + throw new Error('expected pattern to be less than ' + maxLength + ' characters'); + } + + function makeRe() { + var arr = braces(pattern, options); + var opts = extend({strictErrors: false}, options); + return toRegex(arr, opts); + } + + return memoize('makeRe', pattern, options, makeRe); +}; + +/** + * Parse the given `str` with the given `options`. + * + * ```js + * var braces = require('braces'); + * var ast = braces.parse('a/{b,c}/d'); + * console.log(ast); + * // { type: 'root', + * // errors: [], + * // input: 'a/{b,c}/d', + * // nodes: + * // [ { type: 'bos', val: '' }, + * // { type: 'text', val: 'a/' }, + * // { type: 'brace', + * // nodes: + * // [ { type: 'brace.open', val: '{' }, + * // { type: 'text', val: 'b,c' }, + * // { type: 'brace.close', val: '}' } ] }, + * // { type: 'text', val: '/d' }, + * // { type: 'eos', val: '' } ] } + * ``` + * @param {String} `pattern` Brace pattern to parse + * @param {Object} `options` + * @return {Object} Returns an AST + * @api public + */ + +braces.parse = function(pattern, options) { + var proto = new Braces(options); + return proto.parse(pattern, options); +}; + +/** + * Compile the given `ast` or string with the given `options`. + * + * ```js + * var braces = require('braces'); + * var ast = braces.parse('a/{b,c}/d'); + * console.log(braces.compile(ast)); + * // { options: { source: 'string' }, + * // state: {}, + * // compilers: + * // { eos: [Function], + * // noop: [Function], + * // bos: [Function], + * // brace: [Function], + * // 'brace.open': [Function], + * // text: [Function], + * // 'brace.close': [Function] }, + * // output: [ 'a/(b|c)/d' ], + * // ast: + * // { ... }, + * // parsingErrors: [] } + * ``` + * @param {Object|String} `ast` AST from [.parse](#parse). If a string is passed it will be parsed first. + * @param {Object} `options` + * @return {Object} Returns an object that has an `output` property with the compiled string. + * @api public + */ + +braces.compile = function(ast, options) { + var proto = new Braces(options); + return proto.compile(ast, options); +}; + +/** + * Clear the regex cache. + * + * ```js + * braces.clearCache(); + * ``` + * @api public + */ + +braces.clearCache = function() { + cache = braces.cache = {}; +}; + +/** + * Memoize a generated regex or function. A unique key is generated + * from the method name, pattern, and user-defined options. Set + * options.memoize to false to disable. + */ + +function memoize(type, pattern, options, fn) { + var key = utils.createKey(type + ':' + pattern, options); + var disabled = options && options.cache === false; + if (disabled) { + braces.clearCache(); + return fn(pattern, options); + } + + if (cache.hasOwnProperty(key)) { + return cache[key]; + } + + var res = fn(pattern, options); + cache[key] = res; + return res; +} + +/** + * Expose `Braces` constructor and methods + * @type {Function} + */ + +braces.Braces = Braces; +braces.compilers = compilers; +braces.parsers = parsers; +braces.cache = cache; + +/** + * Expose `braces` + * @type {Function} + */ + +module.exports = braces; diff --git a/node_modules/braces/lib/braces.js b/node_modules/braces/lib/braces.js new file mode 100644 index 0000000..7a68734 --- /dev/null +++ b/node_modules/braces/lib/braces.js @@ -0,0 +1,106 @@ +'use strict'; + +var typeOf = require('kind-of'); +var define = require('define-property'); +var extend = require('extend-shallow'); +var Snapdragon = require('snapdragon'); +var compilers = require('./compilers'); +var parsers = require('./parsers'); +var utils = require('./utils'); + +/** + * Customize Snapdragon parser and renderer + */ + +function Braces(options) { + this.options = extend({}, options); +} + +/** + * Initialize braces + */ + +Braces.prototype.init = function(options) { + if (this.isInitialized) return; + this.isInitialized = true; + var opts = utils.createOptions({}, this.options, options); + this.snapdragon = this.options.snapdragon || new Snapdragon(opts); + this.compiler = this.snapdragon.compiler; + this.parser = this.snapdragon.parser; + + compilers(this.snapdragon, opts); + parsers(this.snapdragon, opts); + + /** + * Call Snapdragon `.parse` method. When AST is returned, we check to + * see if any unclosed braces are left on the stack and, if so, we iterate + * over the stack and correct the AST so that compilers are called in the correct + * order and unbalance braces are properly escaped. + */ + + define(this.snapdragon, 'parse', function(pattern, options) { + var parsed = Snapdragon.prototype.parse.apply(this, arguments); + this.parser.ast.input = pattern; + + var stack = this.parser.stack; + while (stack.length) { + addParent({type: 'brace.close', val: ''}, stack.pop()); + } + + function addParent(node, parent) { + define(node, 'parent', parent); + parent.nodes.push(node); + } + + // add non-enumerable parser reference + define(parsed, 'parser', this.parser); + return parsed; + }); +}; + +/** + * Decorate `.parse` method + */ + +Braces.prototype.parse = function(ast, options) { + if (typeOf(ast) === 'object' && ast.nodes) return ast; + this.init(options); + return this.snapdragon.parse(ast, options); +}; + +/** + * Decorate `.compile` method + */ + +Braces.prototype.compile = function(ast, options) { + if (typeof ast === 'string') { + ast = this.parse(ast, options); + } else { + this.init(options); + } + return this.snapdragon.compile(ast, options); +}; + +/** + * Expand + */ + +Braces.prototype.expand = function(pattern) { + var ast = this.parse(pattern, {expand: true}); + return this.compile(ast, {expand: true}); +}; + +/** + * Optimize + */ + +Braces.prototype.optimize = function(pattern) { + var ast = this.parse(pattern, {optimize: true}); + return this.compile(ast, {optimize: true}); +}; + +/** + * Expose `Braces` + */ + +module.exports = Braces; diff --git a/node_modules/braces/lib/compilers.js b/node_modules/braces/lib/compilers.js new file mode 100644 index 0000000..a3b820e --- /dev/null +++ b/node_modules/braces/lib/compilers.js @@ -0,0 +1,282 @@ +'use strict'; + +var utils = require('./utils'); + +module.exports = function(braces, options) { + braces.compiler + + /** + * bos + */ + + .set('bos', function() { + if (this.output) return; + this.ast.queue = isEscaped(this.ast) ? [this.ast.val] : []; + this.ast.count = 1; + }) + + /** + * Square brackets + */ + + .set('bracket', function(node) { + var close = node.close; + var open = !node.escaped ? '[' : '\\['; + var negated = node.negated; + var inner = node.inner; + + inner = inner.replace(/\\(?=[\\\w]|$)/g, '\\\\'); + if (inner === ']-') { + inner = '\\]\\-'; + } + + if (negated && inner.indexOf('.') === -1) { + inner += '.'; + } + if (negated && inner.indexOf('/') === -1) { + inner += '/'; + } + + var val = open + negated + inner + close; + var queue = node.parent.queue; + var last = utils.arrayify(queue.pop()); + + queue.push(utils.join(last, val)); + queue.push.apply(queue, []); + }) + + /** + * Brace + */ + + .set('brace', function(node) { + node.queue = isEscaped(node) ? [node.val] : []; + node.count = 1; + return this.mapVisit(node.nodes); + }) + + /** + * Open + */ + + .set('brace.open', function(node) { + node.parent.open = node.val; + }) + + /** + * Inner + */ + + .set('text', function(node) { + var queue = node.parent.queue; + var escaped = node.escaped; + var segs = [node.val]; + + if (node.optimize === false) { + options = utils.extend({}, options, {optimize: false}); + } + + if (node.multiplier > 1) { + node.parent.count *= node.multiplier; + } + + if (options.quantifiers === true && utils.isQuantifier(node.val)) { + escaped = true; + + } else if (node.val.length > 1) { + if (isType(node.parent, 'brace') && !isEscaped(node)) { + var expanded = utils.expand(node.val, options); + segs = expanded.segs; + + if (expanded.isOptimized) { + node.parent.isOptimized = true; + } + + // if nothing was expanded, we probably have a literal brace + if (!segs.length) { + var val = (expanded.val || node.val); + if (options.unescape !== false) { + // unescape unexpanded brace sequence/set separators + val = val.replace(/\\([,.])/g, '$1'); + // strip quotes + val = val.replace(/["'`]/g, ''); + } + + segs = [val]; + escaped = true; + } + } + + } else if (node.val === ',') { + if (options.expand) { + node.parent.queue.push(['']); + segs = ['']; + } else { + segs = ['|']; + } + } else { + escaped = true; + } + + if (escaped && isType(node.parent, 'brace')) { + if (node.parent.nodes.length <= 4 && node.parent.count === 1) { + node.parent.escaped = true; + } else if (node.parent.length <= 3) { + node.parent.escaped = true; + } + } + + if (!hasQueue(node.parent)) { + node.parent.queue = segs; + return; + } + + var last = utils.arrayify(queue.pop()); + if (node.parent.count > 1 && options.expand) { + last = multiply(last, node.parent.count); + node.parent.count = 1; + } + + queue.push(utils.join(utils.flatten(last), segs.shift())); + queue.push.apply(queue, segs); + }) + + /** + * Close + */ + + .set('brace.close', function(node) { + var queue = node.parent.queue; + var prev = node.parent.parent; + var last = prev.queue.pop(); + var open = node.parent.open; + var close = node.val; + + if (open && close && isOptimized(node, options)) { + open = '('; + close = ')'; + } + + // if a close brace exists, and the previous segment is one character + // don't wrap the result in braces or parens + var ele = utils.last(queue); + if (node.parent.count > 1 && options.expand) { + ele = multiply(queue.pop(), node.parent.count); + node.parent.count = 1; + queue.push(ele); + } + + if (close && typeof ele === 'string' && ele.length === 1) { + open = ''; + close = ''; + } + + if ((isLiteralBrace(node, options) || noInner(node)) && !node.parent.hasEmpty) { + queue.push(utils.join(open, queue.pop() || '')); + queue = utils.flatten(utils.join(queue, close)); + } + + if (typeof last === 'undefined') { + prev.queue = [queue]; + } else { + prev.queue.push(utils.flatten(utils.join(last, queue))); + } + }) + + /** + * eos + */ + + .set('eos', function(node) { + if (this.input) return; + + if (options.optimize !== false) { + this.output = utils.last(utils.flatten(this.ast.queue)); + } else if (Array.isArray(utils.last(this.ast.queue))) { + this.output = utils.flatten(this.ast.queue.pop()); + } else { + this.output = utils.flatten(this.ast.queue); + } + + if (node.parent.count > 1 && options.expand) { + this.output = multiply(this.output, node.parent.count); + } + + this.output = utils.arrayify(this.output); + this.ast.queue = []; + }); + +}; + +/** + * Multiply the segments in the current brace level + */ + +function multiply(queue, n, options) { + return utils.flatten(utils.repeat(utils.arrayify(queue), n)); +} + +/** + * Return true if `node` is escaped + */ + +function isEscaped(node) { + return node.escaped === true; +} + +/** + * Returns true if regex parens should be used for sets. If the parent `type` + * is not `brace`, then we're on a root node, which means we should never + * expand segments and open/close braces should be `{}` (since this indicates + * a brace is missing from the set) + */ + +function isOptimized(node, options) { + if (node.parent.isOptimized) return true; + return isType(node.parent, 'brace') + && !isEscaped(node.parent) + && options.expand !== true; +} + +/** + * Returns true if the value in `node` should be wrapped in a literal brace. + * @return {Boolean} + */ + +function isLiteralBrace(node, options) { + return isEscaped(node.parent) || options.optimize !== false; +} + +/** + * Returns true if the given `node` does not have an inner value. + * @return {Boolean} + */ + +function noInner(node, type) { + if (node.parent.queue.length === 1) { + return true; + } + var nodes = node.parent.nodes; + return nodes.length === 3 + && isType(nodes[0], 'brace.open') + && !isType(nodes[1], 'text') + && isType(nodes[2], 'brace.close'); +} + +/** + * Returns true if the given `node` is the given `type` + * @return {Boolean} + */ + +function isType(node, type) { + return typeof node !== 'undefined' && node.type === type; +} + +/** + * Returns true if the given `node` has a non-empty queue. + * @return {Boolean} + */ + +function hasQueue(node) { + return Array.isArray(node.queue) && node.queue.length; +} diff --git a/node_modules/braces/lib/parsers-new.js b/node_modules/braces/lib/parsers-new.js new file mode 100644 index 0000000..53b5eca --- /dev/null +++ b/node_modules/braces/lib/parsers-new.js @@ -0,0 +1,439 @@ +'use strict'; + +var Node = require('snapdragon-node'); +var utils = require('./utils'); + +/** + * Braces parsers + */ + +module.exports = function(braces, options) { + function update(parent, val) { + if (parent && parent.type === 'brace') { + parent.text = parent.text || ''; + parent.text += val; + } + } + + braces.parser + .set('bos', function() { + if (!this.parsed) { + this.ast = this.nodes[0] = new Node(this.ast); + } + }) + + /** + * Character parsers + */ + + .set('escape', function() { + var pos = this.position(); + var m = this.match(/^(?:\\(.)|\$\{)/); + if (!m) return; + + var prev = this.prev(); + var last = utils.last(prev.nodes); + update(prev, m[0]); + + var node = pos(new Node({ + type: 'text', + multiplier: 1, + val: m[0] + })); + + if (node.val === '\\\\') { + return node; + } + + if (node.val === '${') { + var str = this.input; + var idx = -1; + var ch; + + while ((ch = str[++idx])) { + this.consume(1); + node.val += ch; + if (ch === '\\') { + node.val += str[++idx]; + continue; + } + if (ch === '}') { + break; + } + } + } + + if (last.val === '"' && this.input.charAt(0) === '"') { + last.val = node.val; + this.consume(1); + return; + } + + return concatNodes.call(this, pos, node, prev, options); + }) + + /** + * Brackets: "[...]" (basic, this is overridden by + * other parsers in more advanced implementations) + */ + + .set('bracket', function() { + var pos = this.position(); + var m = this.match(/^(?!\\)(?:\[([!^]?)([^\]]{2,}|\]\-)(\]|[^*+?]+)|\[)/); + if (!m) return; + + var prev = this.prev(); + var val = m[0]; + var negated = m[1] ? '^' : ''; + var inner = m[2] || ''; + var close = m[3] || ''; + + update(prev, m[0]); + + if (this.input[0] === ']') { + this.consume(1); + inner = '\\]'; + val = '\\['; + } + + if (this.input.slice(0, 2) === '\\]') { + this.consume(2); + inner = '\\]'; + val = '\\['; + } + + var node = pos(new Node({ + type: 'bracket', + val: val, + escaped: close !== ']', + negated: negated, + inner: inner, + close: close + })); + + return node; + }) + + /** + * Empty braces (we capture these early to + * speed up processing in the compiler) + */ + + .set('multiplier', function() { + var pos = this.position(); + var m = this.match(/^\{(,+(?:(\{,+\})*),*|,*(?:(\{,+\})*),+)\}/); + if (!m) return; + + this.multiplier = true; + var prev = this.prev(); + var val = m[0]; + var node = pos(new Node({ + type: 'text', + multiplier: 1, + match: m, + val: val + })); + + update(prev, m[0]); + return concatNodes.call(this, pos, node, prev, options); + }) + + /** + * Paren open: "(" + */ + + .set('paren.open', function() { + var pos = this.position(); + var m = this.match(/^\(/); + if (!m) return; + + var prev = this.prev(); + update(prev, m[0]); + + var node = pos(new Node({ + type: 'paren', + nodes: [] + })); + + var open = pos(new Node({ + type: 'paren.open', + val: m[0] + })); + + node.push(open); + prev.push(node); + this.push('paren', node); + }) + + /** + * Paren close: ")" + */ + + .set('paren.close', function() { + var pos = this.position(); + var m = this.match(/^\)/); + if (!m) return; + + var paren = this.pop('paren'); + var node = pos(new Node({ + type: 'paren.close', + val: m[0] + })); + + if (!this.isType(paren, 'paren')) { + if (this.options.strict) { + throw new Error('missing opening "("'); + } + node.type = 'text'; + node.escaped = true; + return node; + } + + update(this.prev(), m[0]); + paren.push(node); + + paren.type = 'text'; + paren.val = ''; + + // visit(paren, function(n) { + // if (n.type === 'bracket') { + // paren.val += n.val; + // if (n.inner === '\\]') { + // paren.val += n.inner; + // } + // paren.val += n.close; + // } else if (n.type === 'paren.open' || n.type === 'paren.close') { + // paren.val += n.val; + // paren.unescape = false; + // } else if (n.val) { + // paren.val += n.val; + // } + // }); + + delete paren.nodes; + }) + + /** + * Brace open: "{" + */ + + .set('brace.open', function() { + var pos = this.position(); + var m = this.match(/^\{(?!(?:[^\\}]?|,+)\})/); + if (!m) return; + + var prev = this.prev(); + var last = utils.last(prev.nodes); + var open = pos(new Node({ + type: 'brace.open', + val: m[0] + })); + + update(prev, m[0]); + + var node = pos(new Node({ + type: 'brace', + nodes: [] + })); + + var lastChar = (last && last.val) ? last.val.slice(-1) : ''; + node.isExtglob = utils.isExtglobChar(lastChar); + + // if the last parsed character was an extglob character + // we need to _not optimize_ the brace pattern because + // it might be mistaken for an extglob by a downstream parser + if (lastChar && node.isExtglob && !this.options.toExtglob) { + last.optimize = false; + } + + if (this.options.toExtglob) { + node.lastChar = node.isExtglob ? lastChar : ''; + node.toExtglob = true; + } + + node.push(open); + prev.push(node); + this.push('brace', node); + }) + + /** + * Brace close: "}" + */ + + .set('brace.close', function() { + var pos = this.position(); + var m = this.match(/^\}/); + if (!m || !m[0]) return; + + var brace = this.pop('brace'); + var node = pos(new Node({ + type: 'brace.close', + val: m[0] + })); + + if (!this.isType(brace, 'brace')) { + if (this.options.strict) { + throw new Error('missing opening "{"'); + } + node.type = 'text'; + node.multiplier = 0; + node.escaped = true; + return node; + } + + var prev = this.prev(); + update(prev, node.val); + + var last = utils.last(prev.nodes); + if (last.type === 'brace') { + var lastNode = utils.last(last.nodes); + var lastVal = lastNode.val ? lastNode.val[0] : null; + if (lastVal === ')') { + if (/[!@*?+]\(/.test(last.text)) { + var open = last.nodes[0]; + var text = last.nodes[1]; + if (open.type === 'brace.open' && text && text.type === 'text') { + text.optimize = false; + } + } + } + } + + if (brace.nodes.length > 2) { + var first = brace.nodes[1]; + if (first.type === 'text' && first.val === ',') { + brace.nodes.splice(1, 1); + brace.nodes.push(first); + } + } + + brace.push(node); + }) + + /** + * Capture boundary characters + */ + + .set('boundary', function() { + var pos = this.position(); + var m = this.match(/^[$^](?!\{)/); + if (!m) return; + + update(this.prev(), m[0]); + return pos(new Node({ + type: 'text', + val: m[0] + })); + }) + + /** + * One or zero, non-comma characters wrapped in braces + */ + + .set('nobrace', function() { + var pos = this.position(); + var m = this.match(/^\{[^,]?\}/); + if (!m) return; + + var prev = this.prev(); + var val = m[0]; + + update(prev, val); + return pos(new Node({ + type: 'text', + multiplier: 0, + val: val + })); + }) + + /** + * Text + */ + + .set('text', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^((?!\\)[^${}()\[\]])+/); + if (!m) return; + + var prev = this.prev(); + var val = m[0]; + + if (utils.isExtglobChar(m[1]) && this.input[0] === '{') { + val = val.slice(0, val.length - 1) + '\\' + val.slice(-1); + } + + var node = pos(new Node({ + type: 'text', + multiplier: 1, + val: val + })); + + update(prev, val); + return concatNodes.call(this, pos, node, prev, options); + }); +}; + +/** + * Combine text nodes, and calculate empty sets (`{,,}`) + * @param {Function} `pos` Function to calculate node position + * @param {Object} `node` AST node + * @return {Object} + */ + +function concatNodes(pos, node, parent, options) { + node.orig = node.val; + var prev = this.prev(); + var last = utils.last(prev.nodes); + var isEscaped = false; + + if (node.val.length > 1) { + var a = node.val.charAt(0); + var b = node.val.slice(-1); + + isEscaped = (a === '"' && b === '"') + || (a === "'" && b === "'") + || (a === '`' && b === '`'); + } + + if (isEscaped && options.unescape !== false) { + node.val = node.val.slice(1, node.val.length - 1); + node.escaped = true; + } + + if (node.match) { + var match = node.match[1]; + if (!match || match.indexOf('}') === -1) { + match = node.match[0]; + } + + // replace each set with a single "," + var val = match.replace(/\{/g, ',').replace(/\}/g, ''); + node.multiplier *= val.length; + node.val = ''; + } + + var simpleText = last.type === 'text' + && last.multiplier === 1 + && node.multiplier === 1 + && node.val; + + if (simpleText) { + last.val += node.val; + return; + } + + prev.push(node); +} + +function visit(node, fn) { + fn(node); + return node.nodes ? mapVisit(node, fn) : node; +} + +function mapVisit(node, fn) { + for (let i = 0; i < node.nodes.length; i++) { + visit(node.nodes[i], fn); + } + return node; +} diff --git a/node_modules/braces/lib/parsers-orig.js b/node_modules/braces/lib/parsers-orig.js new file mode 100644 index 0000000..42730fe --- /dev/null +++ b/node_modules/braces/lib/parsers-orig.js @@ -0,0 +1,360 @@ +'use strict'; + +var Node = require('snapdragon-node'); +var utils = require('./utils'); + +/** + * Braces parsers + */ + +module.exports = function(braces, options) { + braces.parser + .set('bos', function() { + if (!this.parsed) { + this.ast = this.nodes[0] = new Node(this.ast); + } + }) + + /** + * Character parsers + */ + + .set('escape', function() { + var pos = this.position(); + var m = this.match(/^(?:\\(.)|\$\{)/); + if (!m) return; + + var prev = this.prev(); + var last = utils.last(prev.nodes); + + var node = pos(new Node({ + type: 'text', + multiplier: 1, + val: m[0] + })); + + if (node.val === '\\\\') { + return node; + } + + if (node.val === '${') { + var str = this.input; + var idx = -1; + var ch; + + while ((ch = str[++idx])) { + this.consume(1); + node.val += ch; + if (ch === '\\') { + node.val += str[++idx]; + continue; + } + if (ch === '}') { + break; + } + } + } + + if (this.options.unescape !== false) { + node.val = node.val.replace(/\\([{}])/g, '$1'); + } + + if (last.val === '"' && this.input.charAt(0) === '"') { + last.val = node.val; + this.consume(1); + return; + } + + return concatNodes.call(this, pos, node, prev, options); + }) + + /** + * Brackets: "[...]" (basic, this is overridden by + * other parsers in more advanced implementations) + */ + + .set('bracket', function() { + var isInside = this.isInside('brace'); + var pos = this.position(); + var m = this.match(/^(?:\[([!^]?)([^\]]{2,}|\]\-)(\]|[^*+?]+)|\[)/); + if (!m) return; + + var prev = this.prev(); + var val = m[0]; + var negated = m[1] ? '^' : ''; + var inner = m[2] || ''; + var close = m[3] || ''; + + if (isInside && prev.type === 'brace') { + prev.text = prev.text || ''; + prev.text += val; + } + + var esc = this.input.slice(0, 2); + if (inner === '' && esc === '\\]') { + inner += esc; + this.consume(2); + + var str = this.input; + var idx = -1; + var ch; + + while ((ch = str[++idx])) { + this.consume(1); + if (ch === ']') { + close = ch; + break; + } + inner += ch; + } + } + + return pos(new Node({ + type: 'bracket', + val: val, + escaped: close !== ']', + negated: negated, + inner: inner, + close: close + })); + }) + + /** + * Empty braces (we capture these early to + * speed up processing in the compiler) + */ + + .set('multiplier', function() { + var isInside = this.isInside('brace'); + var pos = this.position(); + var m = this.match(/^\{(,+(?:(\{,+\})*),*|,*(?:(\{,+\})*),+)\}/); + if (!m) return; + + this.multiplier = true; + var prev = this.prev(); + var val = m[0]; + + if (isInside && prev.type === 'brace') { + prev.text = prev.text || ''; + prev.text += val; + } + + var node = pos(new Node({ + type: 'text', + multiplier: 1, + match: m, + val: val + })); + + return concatNodes.call(this, pos, node, prev, options); + }) + + /** + * Open + */ + + .set('brace.open', function() { + var pos = this.position(); + var m = this.match(/^\{(?!(?:[^\\}]?|,+)\})/); + if (!m) return; + + var prev = this.prev(); + var last = utils.last(prev.nodes); + + // if the last parsed character was an extglob character + // we need to _not optimize_ the brace pattern because + // it might be mistaken for an extglob by a downstream parser + if (last && last.val && isExtglobChar(last.val.slice(-1))) { + last.optimize = false; + } + + var open = pos(new Node({ + type: 'brace.open', + val: m[0] + })); + + var node = pos(new Node({ + type: 'brace', + nodes: [] + })); + + node.push(open); + prev.push(node); + this.push('brace', node); + }) + + /** + * Close + */ + + .set('brace.close', function() { + var pos = this.position(); + var m = this.match(/^\}/); + if (!m || !m[0]) return; + + var brace = this.pop('brace'); + var node = pos(new Node({ + type: 'brace.close', + val: m[0] + })); + + if (!this.isType(brace, 'brace')) { + if (this.options.strict) { + throw new Error('missing opening "{"'); + } + node.type = 'text'; + node.multiplier = 0; + node.escaped = true; + return node; + } + + var prev = this.prev(); + var last = utils.last(prev.nodes); + if (last.text) { + var lastNode = utils.last(last.nodes); + if (lastNode.val === ')' && /[!@*?+]\(/.test(last.text)) { + var open = last.nodes[0]; + var text = last.nodes[1]; + if (open.type === 'brace.open' && text && text.type === 'text') { + text.optimize = false; + } + } + } + + if (brace.nodes.length > 2) { + var first = brace.nodes[1]; + if (first.type === 'text' && first.val === ',') { + brace.nodes.splice(1, 1); + brace.nodes.push(first); + } + } + + brace.push(node); + }) + + /** + * Capture boundary characters + */ + + .set('boundary', function() { + var pos = this.position(); + var m = this.match(/^[$^](?!\{)/); + if (!m) return; + return pos(new Node({ + type: 'text', + val: m[0] + })); + }) + + /** + * One or zero, non-comma characters wrapped in braces + */ + + .set('nobrace', function() { + var isInside = this.isInside('brace'); + var pos = this.position(); + var m = this.match(/^\{[^,]?\}/); + if (!m) return; + + var prev = this.prev(); + var val = m[0]; + + if (isInside && prev.type === 'brace') { + prev.text = prev.text || ''; + prev.text += val; + } + + return pos(new Node({ + type: 'text', + multiplier: 0, + val: val + })); + }) + + /** + * Text + */ + + .set('text', function() { + var isInside = this.isInside('brace'); + var pos = this.position(); + var m = this.match(/^((?!\\)[^${}\[\]])+/); + if (!m) return; + + var prev = this.prev(); + var val = m[0]; + + if (isInside && prev.type === 'brace') { + prev.text = prev.text || ''; + prev.text += val; + } + + var node = pos(new Node({ + type: 'text', + multiplier: 1, + val: val + })); + + return concatNodes.call(this, pos, node, prev, options); + }); +}; + +/** + * Returns true if the character is an extglob character. + */ + +function isExtglobChar(ch) { + return ch === '!' || ch === '@' || ch === '*' || ch === '?' || ch === '+'; +} + +/** + * Combine text nodes, and calculate empty sets (`{,,}`) + * @param {Function} `pos` Function to calculate node position + * @param {Object} `node` AST node + * @return {Object} + */ + +function concatNodes(pos, node, parent, options) { + node.orig = node.val; + var prev = this.prev(); + var last = utils.last(prev.nodes); + var isEscaped = false; + + if (node.val.length > 1) { + var a = node.val.charAt(0); + var b = node.val.slice(-1); + + isEscaped = (a === '"' && b === '"') + || (a === "'" && b === "'") + || (a === '`' && b === '`'); + } + + if (isEscaped && options.unescape !== false) { + node.val = node.val.slice(1, node.val.length - 1); + node.escaped = true; + } + + if (node.match) { + var match = node.match[1]; + if (!match || match.indexOf('}') === -1) { + match = node.match[0]; + } + + // replace each set with a single "," + var val = match.replace(/\{/g, ',').replace(/\}/g, ''); + node.multiplier *= val.length; + node.val = ''; + } + + var simpleText = last.type === 'text' + && last.multiplier === 1 + && node.multiplier === 1 + && node.val; + + if (simpleText) { + last.val += node.val; + return; + } + + prev.push(node); +} diff --git a/node_modules/braces/lib/parsers-parens.js b/node_modules/braces/lib/parsers-parens.js new file mode 100644 index 0000000..25b48b5 --- /dev/null +++ b/node_modules/braces/lib/parsers-parens.js @@ -0,0 +1,493 @@ +'use strict'; + +var Node = require('snapdragon-node'); +var utils = require('./utils'); + +/** + * Braces parsers + */ + +module.exports = function(braces, options) { + function update(parent, val) { + if (parent && parent.type === 'brace') { + parent.text = parent.text || ''; + parent.text += val; + } + } + + braces.parser + .set('bos', function() { + if (!this.parsed) { + this.ast = this.nodes[0] = new Node(this.ast); + } + }) + + /** + * Character parsers + */ + + .set('escape', function() { + var pos = this.position(); + var m = this.match(/^(?:\\(.)|\$\{)/); + if (!m) return; + + var prev = this.prev(); + var last = utils.last(prev.nodes); + + var node = pos(new Node({ + type: 'text', + multiplier: 1, + val: m[0] + })); + + if (node.val === '\\\\') { + return node; + } + + if (node.val === '${') { + var str = this.input; + var idx = -1; + var ch; + + while ((ch = str[++idx])) { + this.consume(1); + node.val += ch; + if (ch === '\\') { + node.val += str[++idx]; + continue; + } + if (ch === '}') { + break; + } + } + } + + if (this.options.unescape !== false) { + node.val = node.val.replace(/\\([{}])/g, '$1'); + } + + if (last.val === '"' && this.input.charAt(0) === '"') { + last.val = node.val; + this.consume(1); + return; + } + + return concatNodes.call(this, pos, node, prev, options); + }) + + /** + * Brackets: "[...]" (basic, this is overridden by + * other parsers in more advanced implementations) + */ + + .set('bracket', function() { + var pos = this.position(); + var m = this.match(/^(?:\[([!^]?)([^\]]{2,}|\]\-)(\]|[^*+?]+)|\[)/); + if (!m) return; + + var prev = this.prev(); + var val = m[0]; + var negated = m[1] ? '^' : ''; + var inner = m[2] || ''; + var close = m[3] || ''; + + var esc = this.input.slice(0, 2); + if (inner === '' && esc === '\\]') { + inner += esc; + this.consume(2); + + var str = this.input; + var idx = -1; + var ch; + + while ((ch = str[++idx])) { + this.consume(1); + if (ch === ']') { + close = ch; + break; + } + inner += ch; + } + } + + var node = pos(new Node({ + type: 'bracket', + val: val, + escaped: close !== ']', + negated: negated, + inner: inner, + close: close + })); + + update(prev, m[0]); + return node; + }) + + /** + * Empty braces (we capture these early to + * speed up processing in the compiler) + */ + + .set('multiplier', function() { + var pos = this.position(); + var m = this.match(/^\{(,+(?:(\{,+\})*),*|,*(?:(\{,+\})*),+)\}/); + if (!m) return; + + this.multiplier = true; + var prev = this.prev(); + var val = m[0]; + + update(prev, val); + + var node = pos(new Node({ + type: 'text', + multiplier: 1, + match: m, + val: val + })); + + return concatNodes.call(this, pos, node, prev, options); + }) + + /** + * Paren open: "(" + */ + + .set('paren.open', function() { + var pos = this.position(); + var m = this.match(/^\(/); + if (!m) return; + + var prev = this.prev(); + var node = pos(new Node({ + type: 'paren', + nodes: [] + })); + + var open = pos(new Node({ + type: 'paren.open', + val: m[0] + })); + + node.push(open); + prev.push(node); + this.push('paren', node); + }) + + /** + * Paren close: ")" + */ + + .set('paren.close', function() { + var pos = this.position(); + var m = this.match(/^\)/); + if (!m) return; + + var paren = this.pop('paren'); + var node = pos(new Node({ + type: 'paren.close', + val: m[0] + })); + + if (!this.isType(paren, 'paren')) { + if (this.options.strict) { + throw new Error('missing opening "("'); + } + node.type = 'text'; + node.escaped = true; + return node; + } + + var prev = this.prev(); + paren.push(node); + + // paren.type = 'text'; + // paren.val = ''; + + function addNode(node) { + // node.type = 'text'; + // var last = prev.nodes[prev.nodes.length - 1]; + // if (last && last.type === 'text') { + // last.val += node.val; + // } else { + // prev.nodes.push(node); + // } + prev.nodes.push(node); + } + + visit(paren, function(n) { + // if (n.type === 'paren.open' || n.type === 'paren.close') { + // n.type = 'text'; + // } + if (n.val && prev.type === 'brace') { + prev.text += n.val; + } + // if (n.val) { + // addNode(n); + // } + // if (n.type === 'bracket') { + // paren.val += n.val; + // if (n.inner === '\\]') { + // paren.val += n.inner; + // } + // paren.val += n.close; + // } else if (n.type === 'paren.open' || n.type === 'paren.close') { + // paren.val += n.val; + // paren.unescape = false; + // } else if (n.val) { + // paren.val += n.val; + // } + }); + + var arr = prev.nodes.slice(); + var close = arr[arr.length - 1]; + var nodes = [arr[0]]; + + delete paren.nodes; + var split = require('split-string'); + var segs = split(prev.text, {separator: ','}); + for (var i = 0; i < segs.length; i++) { + var seg = segs[i]; + if (i !== segs.length && i !== segs.length - 1) seg += ','; + var n = new Node({type: 'text', val: seg}); + n.optimize = false; + n.parent = prev; + nodes.push(n); + } + + prev.nodes = nodes; + }) + + /** + * Brace open: "{" + */ + + .set('brace.open', function() { + var pos = this.position(); + var m = this.match(/^\{(?!(?:[^\\}]?|,+)\})/); + if (!m) return; + + var prev = this.prev(); + var last = utils.last(prev.nodes); + + var open = pos(new Node({ + type: 'brace.open', + val: m[0] + })); + + var brace = pos(new Node({ + type: 'brace', + nodes: [] + })); + + // if the last parsed character was an extglob character + // we need to _not optimize or escape_ the brace pattern because + // it might be mistaken for an extglob by a downstream parser + if (last && last.val && isExtglobChar(last.val.slice(-1))) { + last.val = last.val.replace(/([@!*+?])/, '\\$1'); + brace.hasExtglob = true; + // last.optimize = false; + } + + brace.push(open); + prev.push(brace); + this.push('brace', brace); + }) + + /** + * Brace close: "}" + */ + + .set('brace.close', function() { + var pos = this.position(); + var m = this.match(/^\}/); + if (!m || !m[0]) return; + + var brace = this.pop('brace'); + update(his.prev(), m[0]); + + var node = pos(new Node({ + type: 'brace.close', + val: m[0] + })); + + if (!this.isType(brace, 'brace')) { + if (this.options.strict) { + throw new Error('missing opening "{"'); + } + node.type = 'text'; + node.multiplier = 0; + node.escaped = true; + return node; + } + + // var last = utils.last(prev.nodes); + // if (last.text) { + // var lastNode = utils.last(last.nodes); + // if (lastNode.val === ')' && /[!@*?+]\(/.test(last.text)) { + // var open = last.nodes[0]; + // var text = last.nodes[1]; + // if (open.type === 'brace.open' && text && text.type === 'text') { + // text.optimize = false; + // } + // } + // } + + // if (brace.nodes.length > 2) { + // var first = brace.nodes[1]; + // if (first.type === 'text' && first.val === ',') { + // brace.nodes.splice(1, 1); + // brace.nodes.push(first); + // } + // } + + brace.push(node); + + if (utils.hasExtglob(brace.text)) { + brace.optimize = false; + prev.optimize = false; + // brace.nodes.forEach(function(node) { + // node.optimize = false; + // }); + visit(prev, function(node) { + node.optimize = false; + return node; + }); + } + delete brace.text; + console.log(brace) + }) + + /** + * Capture boundary characters + */ + + .set('boundary', function() { + var pos = this.position(); + var m = this.match(/^[$^](?!\{)/); + if (!m) return; + + update(this.prev(), m[0]); + + return pos(new Node({ + type: 'text', + val: m[0] + })); + }) + + /** + * One or zero, non-comma characters wrapped in braces + */ + + .set('nobrace', function() { + var pos = this.position(); + var m = this.match(/^\{[^,]?\}/); + if (!m) return; + + var prev = this.prev(); + var val = m[0]; + + update(prev, val); + + return pos(new Node({ + type: 'text', + multiplier: 0, + val: val + })); + }) + + /** + * Text + */ + + .set('text', function() { + var pos = this.position(); + var m = this.match(/^((?!\\)[^${}()\[\]])+/); + if (!m) return; + + var prev = this.prev(); + var val = m[0]; + + update(prev, val); + + var node = pos(new Node({ + type: 'text', + multiplier: 1, + val: val + })); + + concatNodes.call(this, pos, node, prev, options); + }); +}; + +/** + * Returns true if the character is an extglob character. + */ + +function isExtglobChar(ch) { + return ch === '!' || ch === '@' || ch === '*' || ch === '?' || ch === '+'; +} + +/** + * Combine text nodes, and calculate empty sets (`{,,}`) + * @param {Function} `pos` Function to calculate node position + * @param {Object} `node` AST node + * @return {Object} + */ + +function concatNodes(pos, node, parent, options) { + node.orig = node.val; + var prev = this.prev(); + var last = utils.last(prev.nodes); + var isEscaped = false; + + if (node.val.length > 1) { + var a = node.val.charAt(0); + var b = node.val.slice(-1); + + isEscaped = (a === '"' && b === '"') + || (a === "'" && b === "'") + || (a === '`' && b === '`'); + } + + if (isEscaped && options.unescape !== false) { + node.val = node.val.slice(1, node.val.length - 1); + node.escaped = true; + } + + if (node.match) { + var match = node.match[1]; + if (!match || match.indexOf('}') === -1) { + match = node.match[0]; + } + + // replace each set with a single "," + var val = match.replace(/\{/g, ',').replace(/\}/g, ''); + node.multiplier *= val.length; + node.val = ''; + } + + var simpleText = last.type === 'text' + && last.multiplier === 1 + && node.multiplier === 1 + && node.val; + + if (simpleText) { + last.val += node.val; + return; + } + + prev.push(node); +} + +function visit(node, fn) { + fn(node); + return node.nodes ? mapVisit(node, fn) : node; +} + +function mapVisit(node, fn) { + for (let i = 0; i < node.nodes.length; i++) { + visit(node.nodes[i], fn); + } + return node; +} diff --git a/node_modules/braces/lib/parsers.js b/node_modules/braces/lib/parsers.js new file mode 100644 index 0000000..b14bc83 --- /dev/null +++ b/node_modules/braces/lib/parsers.js @@ -0,0 +1,360 @@ +'use strict'; + +var Node = require('snapdragon-node'); +var utils = require('./utils'); + +/** + * Braces parsers + */ + +module.exports = function(braces, options) { + braces.parser + .set('bos', function() { + if (!this.parsed) { + this.ast = this.nodes[0] = new Node(this.ast); + } + }) + + /** + * Character parsers + */ + + .set('escape', function() { + var pos = this.position(); + var m = this.match(/^(?:\\(.)|\$\{)/); + if (!m) return; + + var prev = this.prev(); + var last = utils.last(prev.nodes); + + var node = pos(new Node({ + type: 'text', + multiplier: 1, + val: m[0] + })); + + if (node.val === '\\\\') { + return node; + } + + if (node.val === '${') { + var str = this.input; + var idx = -1; + var ch; + + while ((ch = str[++idx])) { + this.consume(1); + node.val += ch; + if (ch === '\\') { + node.val += str[++idx]; + continue; + } + if (ch === '}') { + break; + } + } + } + + if (this.options.unescape !== false) { + node.val = node.val.replace(/\\([{}])/g, '$1'); + } + + if (last.val === '"' && this.input.charAt(0) === '"') { + last.val = node.val; + this.consume(1); + return; + } + + return concatNodes.call(this, pos, node, prev, options); + }) + + /** + * Brackets: "[...]" (basic, this is overridden by + * other parsers in more advanced implementations) + */ + + .set('bracket', function() { + var isInside = this.isInside('brace'); + var pos = this.position(); + var m = this.match(/^(?:\[([!^]?)([^\]]{2,}|\]\-)(\]|[^*+?]+)|\[)/); + if (!m) return; + + var prev = this.prev(); + var val = m[0]; + var negated = m[1] ? '^' : ''; + var inner = m[2] || ''; + var close = m[3] || ''; + + if (isInside && prev.type === 'brace') { + prev.text = prev.text || ''; + prev.text += val; + } + + var esc = this.input.slice(0, 2); + if (inner === '' && esc === '\\]') { + inner += esc; + this.consume(2); + + var str = this.input; + var idx = -1; + var ch; + + while ((ch = str[++idx])) { + this.consume(1); + if (ch === ']') { + close = ch; + break; + } + inner += ch; + } + } + + return pos(new Node({ + type: 'bracket', + val: val, + escaped: close !== ']', + negated: negated, + inner: inner, + close: close + })); + }) + + /** + * Empty braces (we capture these early to + * speed up processing in the compiler) + */ + + .set('multiplier', function() { + var isInside = this.isInside('brace'); + var pos = this.position(); + var m = this.match(/^\{((?:,|\{,+\})+)\}/); + if (!m) return; + + this.multiplier = true; + var prev = this.prev(); + var val = m[0]; + + if (isInside && prev.type === 'brace') { + prev.text = prev.text || ''; + prev.text += val; + } + + var node = pos(new Node({ + type: 'text', + multiplier: 1, + match: m, + val: val + })); + + return concatNodes.call(this, pos, node, prev, options); + }) + + /** + * Open + */ + + .set('brace.open', function() { + var pos = this.position(); + var m = this.match(/^\{(?!(?:[^\\}]?|,+)\})/); + if (!m) return; + + var prev = this.prev(); + var last = utils.last(prev.nodes); + + // if the last parsed character was an extglob character + // we need to _not optimize_ the brace pattern because + // it might be mistaken for an extglob by a downstream parser + if (last && last.val && isExtglobChar(last.val.slice(-1))) { + last.optimize = false; + } + + var open = pos(new Node({ + type: 'brace.open', + val: m[0] + })); + + var node = pos(new Node({ + type: 'brace', + nodes: [] + })); + + node.push(open); + prev.push(node); + this.push('brace', node); + }) + + /** + * Close + */ + + .set('brace.close', function() { + var pos = this.position(); + var m = this.match(/^\}/); + if (!m || !m[0]) return; + + var brace = this.pop('brace'); + var node = pos(new Node({ + type: 'brace.close', + val: m[0] + })); + + if (!this.isType(brace, 'brace')) { + if (this.options.strict) { + throw new Error('missing opening "{"'); + } + node.type = 'text'; + node.multiplier = 0; + node.escaped = true; + return node; + } + + var prev = this.prev(); + var last = utils.last(prev.nodes); + if (last.text) { + var lastNode = utils.last(last.nodes); + if (lastNode.val === ')' && /[!@*?+]\(/.test(last.text)) { + var open = last.nodes[0]; + var text = last.nodes[1]; + if (open.type === 'brace.open' && text && text.type === 'text') { + text.optimize = false; + } + } + } + + if (brace.nodes.length > 2) { + var first = brace.nodes[1]; + if (first.type === 'text' && first.val === ',') { + brace.nodes.splice(1, 1); + brace.nodes.push(first); + } + } + + brace.push(node); + }) + + /** + * Capture boundary characters + */ + + .set('boundary', function() { + var pos = this.position(); + var m = this.match(/^[$^](?!\{)/); + if (!m) return; + return pos(new Node({ + type: 'text', + val: m[0] + })); + }) + + /** + * One or zero, non-comma characters wrapped in braces + */ + + .set('nobrace', function() { + var isInside = this.isInside('brace'); + var pos = this.position(); + var m = this.match(/^\{[^,]?\}/); + if (!m) return; + + var prev = this.prev(); + var val = m[0]; + + if (isInside && prev.type === 'brace') { + prev.text = prev.text || ''; + prev.text += val; + } + + return pos(new Node({ + type: 'text', + multiplier: 0, + val: val + })); + }) + + /** + * Text + */ + + .set('text', function() { + var isInside = this.isInside('brace'); + var pos = this.position(); + var m = this.match(/^((?!\\)[^${}\[\]])+/); + if (!m) return; + + var prev = this.prev(); + var val = m[0]; + + if (isInside && prev.type === 'brace') { + prev.text = prev.text || ''; + prev.text += val; + } + + var node = pos(new Node({ + type: 'text', + multiplier: 1, + val: val + })); + + return concatNodes.call(this, pos, node, prev, options); + }); +}; + +/** + * Returns true if the character is an extglob character. + */ + +function isExtglobChar(ch) { + return ch === '!' || ch === '@' || ch === '*' || ch === '?' || ch === '+'; +} + +/** + * Combine text nodes, and calculate empty sets (`{,,}`) + * @param {Function} `pos` Function to calculate node position + * @param {Object} `node` AST node + * @return {Object} + */ + +function concatNodes(pos, node, parent, options) { + node.orig = node.val; + var prev = this.prev(); + var last = utils.last(prev.nodes); + var isEscaped = false; + + if (node.val.length > 1) { + var a = node.val.charAt(0); + var b = node.val.slice(-1); + + isEscaped = (a === '"' && b === '"') + || (a === "'" && b === "'") + || (a === '`' && b === '`'); + } + + if (isEscaped && options.unescape !== false) { + node.val = node.val.slice(1, node.val.length - 1); + node.escaped = true; + } + + if (node.match) { + var match = node.match[1]; + if (!match || match.indexOf('}') === -1) { + match = node.match[0]; + } + + // replace each set with a single "," + var val = match.replace(/\{/g, ',').replace(/\}/g, ''); + node.multiplier *= val.length; + node.val = ''; + } + + var simpleText = last.type === 'text' + && last.multiplier === 1 + && node.multiplier === 1 + && node.val; + + if (simpleText) { + last.val += node.val; + return; + } + + prev.push(node); +} diff --git a/node_modules/braces/lib/utils.js b/node_modules/braces/lib/utils.js new file mode 100644 index 0000000..4d2131a --- /dev/null +++ b/node_modules/braces/lib/utils.js @@ -0,0 +1,335 @@ +'use strict'; + +var splitString = require('split-string'); +var utils = module.exports; + +/** + * Module dependencies + */ + +utils.define = require('define-property'); +utils.extend = require('extend-shallow'); +utils.flatten = require('arr-flatten'); +utils.isObject = require('isobject'); +utils.fillRange = require('fill-range'); +utils.repeat = require('repeat-element'); +utils.unique = require('array-unique'); + +/** + * Returns true if the given string contains only empty brace sets. + */ + +utils.isEmptySets = function(str) { + return /^(?:\{,\})+$/.test(str); +}; + +/** + * Returns true if the given string contains only empty brace sets. + */ + +utils.isQuotedString = function(str) { + var open = str.charAt(0); + if (open === '\'' || open === '"' || open === '`') { + return str.slice(-1) === open; + } + return false; +}; + +/** + * Create the key to use for memoization. The unique key is generated + * by iterating over the options and concatenating key-value pairs + * to the pattern string. + */ + +utils.createKey = function(pattern, options) { + var id = pattern; + if (typeof options === 'undefined') { + return id; + } + var keys = Object.keys(options); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + id += ';' + key + '=' + String(options[key]); + } + return id; +}; + +/** + * Normalize options + */ + +utils.createOptions = function(options) { + var opts = utils.extend.apply(null, arguments); + if (typeof opts.expand === 'boolean') { + opts.optimize = !opts.expand; + } + if (typeof opts.optimize === 'boolean') { + opts.expand = !opts.optimize; + } + if (opts.optimize === true) { + opts.makeRe = true; + } + return opts; +}; + +/** + * Join patterns in `a` to patterns in `b` + */ + +utils.join = function(a, b, options) { + options = options || {}; + a = utils.arrayify(a); + b = utils.arrayify(b); + + if (!a.length) return b; + if (!b.length) return a; + + var len = a.length; + var idx = -1; + var arr = []; + + while (++idx < len) { + var val = a[idx]; + if (Array.isArray(val)) { + for (var i = 0; i < val.length; i++) { + val[i] = utils.join(val[i], b, options); + } + arr.push(val); + continue; + } + + for (var j = 0; j < b.length; j++) { + var bval = b[j]; + + if (Array.isArray(bval)) { + arr.push(utils.join(val, bval, options)); + } else { + arr.push(val + bval); + } + } + } + return arr; +}; + +/** + * Split the given string on `,` if not escaped. + */ + +utils.split = function(str, options) { + var opts = utils.extend({sep: ','}, options); + if (typeof opts.keepQuotes !== 'boolean') { + opts.keepQuotes = true; + } + if (opts.unescape === false) { + opts.keepEscaping = true; + } + return splitString(str, opts, utils.escapeBrackets(opts)); +}; + +/** + * Expand ranges or sets in the given `pattern`. + * + * @param {String} `str` + * @param {Object} `options` + * @return {Object} + */ + +utils.expand = function(str, options) { + var opts = utils.extend({rangeLimit: 10000}, options); + var segs = utils.split(str, opts); + var tok = { segs: segs }; + + if (utils.isQuotedString(str)) { + return tok; + } + + if (opts.rangeLimit === true) { + opts.rangeLimit = 10000; + } + + if (segs.length > 1) { + if (opts.optimize === false) { + tok.val = segs[0]; + return tok; + } + + tok.segs = utils.stringifyArray(tok.segs); + } else if (segs.length === 1) { + var arr = str.split('..'); + + if (arr.length === 1) { + tok.val = tok.segs[tok.segs.length - 1] || tok.val || str; + tok.segs = []; + return tok; + } + + if (arr.length === 2 && arr[0] === arr[1]) { + tok.escaped = true; + tok.val = arr[0]; + tok.segs = []; + return tok; + } + + if (arr.length > 1) { + if (opts.optimize !== false) { + opts.optimize = true; + delete opts.expand; + } + + if (opts.optimize !== true) { + var min = Math.min(arr[0], arr[1]); + var max = Math.max(arr[0], arr[1]); + var step = arr[2] || 1; + + if (opts.rangeLimit !== false && ((max - min) / step >= opts.rangeLimit)) { + throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); + } + } + + arr.push(opts); + tok.segs = utils.fillRange.apply(null, arr); + + if (!tok.segs.length) { + tok.escaped = true; + tok.val = str; + return tok; + } + + if (opts.optimize === true) { + tok.segs = utils.stringifyArray(tok.segs); + } + + if (tok.segs === '') { + tok.val = str; + } else { + tok.val = tok.segs[0]; + } + return tok; + } + } else { + tok.val = str; + } + return tok; +}; + +/** + * Ensure commas inside brackets and parens are not split. + * @param {Object} `tok` Token from the `split-string` module + * @return {undefined} + */ + +utils.escapeBrackets = function(options) { + return function(tok) { + if (tok.escaped && tok.val === 'b') { + tok.val = '\\b'; + return; + } + + if (tok.val !== '(' && tok.val !== '[') return; + var opts = utils.extend({}, options); + var brackets = []; + var parens = []; + var stack = []; + var val = tok.val; + var str = tok.str; + var i = tok.idx - 1; + + while (++i < str.length) { + var ch = str[i]; + + if (ch === '\\') { + val += (opts.keepEscaping === false ? '' : ch) + str[++i]; + continue; + } + + if (ch === '(') { + parens.push(ch); + stack.push(ch); + } + + if (ch === '[') { + brackets.push(ch); + stack.push(ch); + } + + if (ch === ')') { + parens.pop(); + stack.pop(); + if (!stack.length) { + val += ch; + break; + } + } + + if (ch === ']') { + brackets.pop(); + stack.pop(); + if (!stack.length) { + val += ch; + break; + } + } + val += ch; + } + + tok.split = false; + tok.val = val.slice(1); + tok.idx = i; + }; +}; + +/** + * Returns true if the given string looks like a regex quantifier + * @return {Boolean} + */ + +utils.isQuantifier = function(str) { + return /^(?:[0-9]?,[0-9]|[0-9],)$/.test(str); +}; + +/** + * Cast `val` to an array. + * @param {*} `val` + */ + +utils.stringifyArray = function(arr) { + return [utils.arrayify(arr).join('|')]; +}; + +/** + * Cast `val` to an array. + * @param {*} `val` + */ + +utils.arrayify = function(arr) { + if (typeof arr === 'undefined') { + return []; + } + if (typeof arr === 'string') { + return [arr]; + } + return arr; +}; + +/** + * Returns true if the given `str` is a non-empty string + * @return {Boolean} + */ + +utils.isString = function(str) { + return str != null && typeof str === 'string'; +}; + +/** + * Get the last element from `array` + * @param {Array} `array` + * @return {*} + */ + +utils.last = function(arr, n) { + return arr[arr.length - (n || 1)]; +}; + +utils.escapeRegex = function(str) { + return str.replace(/\\?([!^*?()\[\]{}+?/])/g, '\\$1'); +}; diff --git a/node_modules/braces/node_modules/define-property/LICENSE b/node_modules/braces/node_modules/define-property/LICENSE new file mode 100644 index 0000000..ec85897 --- /dev/null +++ b/node_modules/braces/node_modules/define-property/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 2017, 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/node_modules/braces/node_modules/define-property/README.md b/node_modules/braces/node_modules/define-property/README.md new file mode 100644 index 0000000..2f1af05 --- /dev/null +++ b/node_modules/braces/node_modules/define-property/README.md @@ -0,0 +1,95 @@ +# define-property [![NPM version](https://img.shields.io/npm/v/define-property.svg?style=flat)](https://www.npmjs.com/package/define-property) [![NPM monthly downloads](https://img.shields.io/npm/dm/define-property.svg?style=flat)](https://npmjs.org/package/define-property) [![NPM total downloads](https://img.shields.io/npm/dt/define-property.svg?style=flat)](https://npmjs.org/package/define-property) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/define-property.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/define-property) + +> Define a non-enumerable property on an object. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save define-property +``` + +Install with [yarn](https://yarnpkg.com): + +```sh +$ yarn add define-property +``` + +## Usage + +**Params** + +* `obj`: The object on which to define the property. +* `prop`: The name of the property to be defined or modified. +* `descriptor`: The descriptor for the property being defined or modified. + +```js +var define = require('define-property'); +var obj = {}; +define(obj, 'foo', function(val) { + return val.toUpperCase(); +}); + +console.log(obj); +//=> {} + +console.log(obj.foo('bar')); +//=> 'BAR' +``` + +**get/set** + +```js +define(obj, 'foo', { + get: function() {}, + set: function() {} +}); +``` + +## About + +### Related projects + +* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target… [more](https://github.com/jonschlinkert/assign-deep) | [homepage](https://github.com/jonschlinkert/assign-deep "Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target (first) object.") +* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.") +* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep "Recursively merge values in a javascript object.") +* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 20, 2017._ \ No newline at end of file diff --git a/node_modules/braces/node_modules/define-property/index.js b/node_modules/braces/node_modules/define-property/index.js new file mode 100644 index 0000000..27c19eb --- /dev/null +++ b/node_modules/braces/node_modules/define-property/index.js @@ -0,0 +1,31 @@ +/*! + * define-property + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var isDescriptor = require('is-descriptor'); + +module.exports = function defineProperty(obj, prop, val) { + if (typeof obj !== 'object' && typeof obj !== 'function') { + throw new TypeError('expected an object or function.'); + } + + if (typeof prop !== 'string') { + throw new TypeError('expected `prop` to be a string.'); + } + + if (isDescriptor(val) && ('set' in val || 'get' in val)) { + return Object.defineProperty(obj, prop, val); + } + + return Object.defineProperty(obj, prop, { + configurable: true, + enumerable: false, + writable: true, + value: val + }); +}; diff --git a/node_modules/braces/node_modules/define-property/package.json b/node_modules/braces/node_modules/define-property/package.json new file mode 100644 index 0000000..e79585d --- /dev/null +++ b/node_modules/braces/node_modules/define-property/package.json @@ -0,0 +1,93 @@ +{ + "_from": "define-property@^1.0.0", + "_id": "define-property@1.0.0", + "_inBundle": false, + "_integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "_location": "/braces/define-property", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "define-property@^1.0.0", + "name": "define-property", + "escapedName": "define-property", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/braces" + ], + "_resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "_shasum": "769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6", + "_spec": "define-property@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/braces", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/define-property/issues" + }, + "bundleDependencies": false, + "dependencies": { + "is-descriptor": "^1.0.0" + }, + "deprecated": false, + "description": "Define a non-enumerable property on an object.", + "devDependencies": { + "gulp-format-md": "^0.1.12", + "mocha": "^3.2.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/define-property", + "keywords": [ + "define", + "define-property", + "enumerable", + "key", + "non", + "non-enumerable", + "object", + "prop", + "property", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "define-property", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/define-property.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "extend-shallow", + "merge-deep", + "assign-deep", + "mixin-deep" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + }, + "version": "1.0.0" +} diff --git a/node_modules/braces/node_modules/extend-shallow/LICENSE b/node_modules/braces/node_modules/extend-shallow/LICENSE new file mode 100644 index 0000000..fa30c4c --- /dev/null +++ b/node_modules/braces/node_modules/extend-shallow/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2015, 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/node_modules/braces/node_modules/extend-shallow/README.md b/node_modules/braces/node_modules/extend-shallow/README.md new file mode 100644 index 0000000..cdc45d4 --- /dev/null +++ b/node_modules/braces/node_modules/extend-shallow/README.md @@ -0,0 +1,61 @@ +# extend-shallow [![NPM version](https://badge.fury.io/js/extend-shallow.svg)](http://badge.fury.io/js/extend-shallow) [![Build Status](https://travis-ci.org/jonschlinkert/extend-shallow.svg)](https://travis-ci.org/jonschlinkert/extend-shallow) + +> Extend an object with the properties of additional objects. node.js/javascript util. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i extend-shallow --save +``` + +## Usage + +```js +var extend = require('extend-shallow'); + +extend({a: 'b'}, {c: 'd'}) +//=> {a: 'b', c: 'd'} +``` + +Pass an empty object to shallow clone: + +```js +var obj = {}; +extend(obj, {a: 'b'}, {c: 'd'}) +//=> {a: 'b', c: 'd'} +``` + +## Related + +* [extend-shallow](https://github.com/jonschlinkert/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. +* [for-own](https://github.com/jonschlinkert/for-own): Iterate over the own enumerable properties of an object, and return an object with properties… [more](https://github.com/jonschlinkert/for-own) +* [for-in](https://github.com/jonschlinkert/for-in): Iterate over the own and inherited enumerable properties of an objecte, and return an object… [more](https://github.com/jonschlinkert/for-in) +* [is-plain-object](https://github.com/jonschlinkert/is-plain-object): Returns true if an object was created by the `Object` constructor. +* [isobject](https://github.com/jonschlinkert/isobject): Returns true if the value is an object and not an array or null. +* [kind-of](https://github.com/jonschlinkert/kind-of): Get the native type of a value. + +## Running tests + +Install dev dependencies: + +```sh +$ npm i -d && npm test +``` + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 Jon Schlinkert +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 29, 2015._ \ No newline at end of file diff --git a/node_modules/braces/node_modules/extend-shallow/index.js b/node_modules/braces/node_modules/extend-shallow/index.js new file mode 100644 index 0000000..92a067f --- /dev/null +++ b/node_modules/braces/node_modules/extend-shallow/index.js @@ -0,0 +1,33 @@ +'use strict'; + +var isObject = require('is-extendable'); + +module.exports = function extend(o/*, objects*/) { + if (!isObject(o)) { o = {}; } + + var len = arguments.length; + for (var i = 1; i < len; i++) { + var obj = arguments[i]; + + if (isObject(obj)) { + assign(o, obj); + } + } + return o; +}; + +function assign(a, b) { + for (var key in b) { + if (hasOwn(b, key)) { + a[key] = b[key]; + } + } +} + +/** + * Returns true if the given `key` is an own property of `obj`. + */ + +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} diff --git a/node_modules/braces/node_modules/extend-shallow/package.json b/node_modules/braces/node_modules/extend-shallow/package.json new file mode 100644 index 0000000..635a9cb --- /dev/null +++ b/node_modules/braces/node_modules/extend-shallow/package.json @@ -0,0 +1,87 @@ +{ + "_from": "extend-shallow@^2.0.1", + "_id": "extend-shallow@2.0.1", + "_inBundle": false, + "_integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "_location": "/braces/extend-shallow", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "extend-shallow@^2.0.1", + "name": "extend-shallow", + "escapedName": "extend-shallow", + "rawSpec": "^2.0.1", + "saveSpec": null, + "fetchSpec": "^2.0.1" + }, + "_requiredBy": [ + "/braces" + ], + "_resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "_shasum": "51af7d614ad9a9f610ea1bafbb989d6b1c56890f", + "_spec": "extend-shallow@^2.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/braces", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/extend-shallow/issues" + }, + "bundleDependencies": false, + "dependencies": { + "is-extendable": "^0.1.0" + }, + "deprecated": false, + "description": "Extend an object with the properties of additional objects. node.js/javascript util.", + "devDependencies": { + "array-slice": "^0.2.3", + "benchmarked": "^0.1.4", + "chalk": "^1.0.0", + "for-own": "^0.1.3", + "glob": "^5.0.12", + "is-plain-object": "^2.0.1", + "kind-of": "^2.0.0", + "minimist": "^1.1.1", + "mocha": "^2.2.5", + "should": "^7.0.1" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/extend-shallow", + "keywords": [ + "assign", + "extend", + "javascript", + "js", + "keys", + "merge", + "obj", + "object", + "prop", + "properties", + "property", + "props", + "shallow", + "util", + "utility", + "utils", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "extend-shallow", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/extend-shallow.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "2.0.1" +} diff --git a/node_modules/braces/node_modules/kind-of/CHANGELOG.md b/node_modules/braces/node_modules/kind-of/CHANGELOG.md new file mode 100644 index 0000000..fb30b06 --- /dev/null +++ b/node_modules/braces/node_modules/kind-of/CHANGELOG.md @@ -0,0 +1,157 @@ +# Release history + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +
+ Guiding Principles + +- Changelogs are for humans, not machines. +- There should be an entry for every single version. +- The same types of changes should be grouped. +- Versions and sections should be linkable. +- The latest version comes first. +- The release date of each versions is displayed. +- Mention whether you follow Semantic Versioning. + +
+ +
+ Types of changes + +Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_): + +- `Added` for new features. +- `Changed` for changes in existing functionality. +- `Deprecated` for soon-to-be removed features. +- `Removed` for now removed features. +- `Fixed` for any bug fixes. +- `Security` in case of vulnerabilities. + +
+ +## [6.0.0] - 2017-10-13 + +- refactor code to be more performant +- refactor benchmarks + +## [5.1.0] - 2017-10-13 + +**Added** + +- Merge pull request #15 from aretecode/patch-1 +- adds support and tests for string & array iterators + +**Changed** + +- updates benchmarks + +## [5.0.2] - 2017-08-02 + +- Merge pull request #14 from struct78/master +- Added `undefined` check + +## [5.0.0] - 2017-06-21 + +- Merge pull request #12 from aretecode/iterator +- Set Iterator + Map Iterator +- streamline `isbuffer`, minor edits + +## [4.0.0] - 2017-05-19 + +- Merge pull request #8 from tunnckoCore/master +- update deps + +## [3.2.2] - 2017-05-16 + +- fix version + +## [3.2.1] - 2017-05-16 + +- add browserify + +## [3.2.0] - 2017-04-25 + +- Merge pull request #10 from ksheedlo/unrequire-buffer +- add `promise` support and tests +- Remove unnecessary `Buffer` check + +## [3.1.0] - 2016-12-07 + +- Merge pull request #7 from laggingreflex/err +- add support for `error` and tests +- run update + +## [3.0.4] - 2016-07-29 + +- move tests +- run update + +## [3.0.3] - 2016-05-03 + +- fix prepublish script +- remove unused dep + +## [3.0.0] - 2015-11-17 + +- add typed array support +- Merge pull request #5 from miguelmota/typed-arrays +- adds new tests + +## [2.0.1] - 2015-08-21 + +- use `is-buffer` module + +## [2.0.0] - 2015-05-31 + +- Create fallback for `Array.isArray` if used as a browser package +- Merge pull request #2 from dtothefp/patch-1 +- Merge pull request #3 from pdehaan/patch-1 +- Merge branch 'master' of https://github.com/chorks/kind-of into chorks-master +- optimizations, mostly date and regex + +## [1.1.0] - 2015-02-09 + +- adds `buffer` support +- adds tests for `buffer` + +## [1.0.0] - 2015-01-19 + +- update benchmarks +- optimizations based on benchmarks + +## [0.1.2] - 2014-10-26 + +- return `typeof` value if it's not an object. very slight speed improvement +- use `.slice` +- adds benchmarks + +## [0.1.0] - 2014-9-26 + +- first commit + +[6.0.0]: https://github.com/jonschlinkert/kind-of/compare/5.1.0...6.0.0 +[5.1.0]: https://github.com/jonschlinkert/kind-of/compare/5.0.2...5.1.0 +[5.0.2]: https://github.com/jonschlinkert/kind-of/compare/5.0.1...5.0.2 +[5.0.1]: https://github.com/jonschlinkert/kind-of/compare/5.0.0...5.0.1 +[5.0.0]: https://github.com/jonschlinkert/kind-of/compare/4.0.0...5.0.0 +[4.0.0]: https://github.com/jonschlinkert/kind-of/compare/3.2.2...4.0.0 +[3.2.2]: https://github.com/jonschlinkert/kind-of/compare/3.2.1...3.2.2 +[3.2.1]: https://github.com/jonschlinkert/kind-of/compare/3.2.0...3.2.1 +[3.2.0]: https://github.com/jonschlinkert/kind-of/compare/3.1.0...3.2.0 +[3.1.0]: https://github.com/jonschlinkert/kind-of/compare/3.0.4...3.1.0 +[3.0.4]: https://github.com/jonschlinkert/kind-of/compare/3.0.3...3.0.4 +[3.0.3]: https://github.com/jonschlinkert/kind-of/compare/3.0.0...3.0.3 +[3.0.0]: https://github.com/jonschlinkert/kind-of/compare/2.0.1...3.0.0 +[2.0.1]: https://github.com/jonschlinkert/kind-of/compare/2.0.0...2.0.1 +[2.0.0]: https://github.com/jonschlinkert/kind-of/compare/1.1.0...2.0.0 +[1.1.0]: https://github.com/jonschlinkert/kind-of/compare/1.0.0...1.1.0 +[1.0.0]: https://github.com/jonschlinkert/kind-of/compare/0.1.2...1.0.0 +[0.1.2]: https://github.com/jonschlinkert/kind-of/compare/0.1.0...0.1.2 +[0.1.0]: https://github.com/jonschlinkert/kind-of/commit/2fae09b0b19b1aadb558e9be39f0c3ef6034eb87 + +[Unreleased]: https://github.com/jonschlinkert/kind-of/compare/0.1.2...HEAD +[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog + diff --git a/node_modules/braces/node_modules/kind-of/LICENSE b/node_modules/braces/node_modules/kind-of/LICENSE new file mode 100644 index 0000000..3f2eca1 --- /dev/null +++ b/node_modules/braces/node_modules/kind-of/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, 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/node_modules/braces/node_modules/kind-of/README.md b/node_modules/braces/node_modules/kind-of/README.md new file mode 100644 index 0000000..4b0d4a8 --- /dev/null +++ b/node_modules/braces/node_modules/kind-of/README.md @@ -0,0 +1,365 @@ +# kind-of [![NPM version](https://img.shields.io/npm/v/kind-of.svg?style=flat)](https://www.npmjs.com/package/kind-of) [![NPM monthly downloads](https://img.shields.io/npm/dm/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![NPM total downloads](https://img.shields.io/npm/dt/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/kind-of.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/kind-of) + +> Get the native type of a value. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save kind-of +``` + +Install with [bower](https://bower.io/) + +```sh +$ bower install kind-of --save +``` + +## Why use this? + +1. [it's fast](#benchmarks) | [optimizations](#optimizations) +2. [better type checking](#better-type-checking) + +## Usage + +> es5, es6, and browser ready + +```js +var kindOf = require('kind-of'); + +kindOf(undefined); +//=> 'undefined' + +kindOf(null); +//=> 'null' + +kindOf(true); +//=> 'boolean' + +kindOf(false); +//=> 'boolean' + +kindOf(new Buffer('')); +//=> 'buffer' + +kindOf(42); +//=> 'number' + +kindOf('str'); +//=> 'string' + +kindOf(arguments); +//=> 'arguments' + +kindOf({}); +//=> 'object' + +kindOf(Object.create(null)); +//=> 'object' + +kindOf(new Test()); +//=> 'object' + +kindOf(new Date()); +//=> 'date' + +kindOf([1, 2, 3]); +//=> 'array' + +kindOf(/foo/); +//=> 'regexp' + +kindOf(new RegExp('foo')); +//=> 'regexp' + +kindOf(new Error('error')); +//=> 'error' + +kindOf(function () {}); +//=> 'function' + +kindOf(function * () {}); +//=> 'generatorfunction' + +kindOf(Symbol('str')); +//=> 'symbol' + +kindOf(new Map()); +//=> 'map' + +kindOf(new WeakMap()); +//=> 'weakmap' + +kindOf(new Set()); +//=> 'set' + +kindOf(new WeakSet()); +//=> 'weakset' + +kindOf(new Int8Array()); +//=> 'int8array' + +kindOf(new Uint8Array()); +//=> 'uint8array' + +kindOf(new Uint8ClampedArray()); +//=> 'uint8clampedarray' + +kindOf(new Int16Array()); +//=> 'int16array' + +kindOf(new Uint16Array()); +//=> 'uint16array' + +kindOf(new Int32Array()); +//=> 'int32array' + +kindOf(new Uint32Array()); +//=> 'uint32array' + +kindOf(new Float32Array()); +//=> 'float32array' + +kindOf(new Float64Array()); +//=> 'float64array' +``` + +## Benchmarks + +Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of). + +```bash +# arguments (32 bytes) + kind-of x 17,024,098 ops/sec ±1.90% (86 runs sampled) + lib-type-of x 11,926,235 ops/sec ±1.34% (83 runs sampled) + lib-typeof x 9,245,257 ops/sec ±1.22% (87 runs sampled) + + fastest is kind-of (by 161% avg) + +# array (22 bytes) + kind-of x 17,196,492 ops/sec ±1.07% (88 runs sampled) + lib-type-of x 8,838,283 ops/sec ±1.02% (87 runs sampled) + lib-typeof x 8,677,848 ops/sec ±0.87% (87 runs sampled) + + fastest is kind-of (by 196% avg) + +# boolean (24 bytes) + kind-of x 16,841,600 ops/sec ±1.10% (86 runs sampled) + lib-type-of x 8,096,787 ops/sec ±0.95% (87 runs sampled) + lib-typeof x 8,423,345 ops/sec ±1.15% (86 runs sampled) + + fastest is kind-of (by 204% avg) + +# buffer (38 bytes) + kind-of x 14,848,060 ops/sec ±1.05% (86 runs sampled) + lib-type-of x 3,671,577 ops/sec ±1.49% (87 runs sampled) + lib-typeof x 8,360,236 ops/sec ±1.24% (86 runs sampled) + + fastest is kind-of (by 247% avg) + +# date (30 bytes) + kind-of x 16,067,761 ops/sec ±1.58% (86 runs sampled) + lib-type-of x 8,954,436 ops/sec ±1.40% (87 runs sampled) + lib-typeof x 8,488,307 ops/sec ±1.51% (84 runs sampled) + + fastest is kind-of (by 184% avg) + +# error (36 bytes) + kind-of x 9,634,090 ops/sec ±1.12% (89 runs sampled) + lib-type-of x 7,735,624 ops/sec ±1.32% (86 runs sampled) + lib-typeof x 7,442,160 ops/sec ±1.11% (90 runs sampled) + + fastest is kind-of (by 127% avg) + +# function (34 bytes) + kind-of x 10,031,494 ops/sec ±1.27% (86 runs sampled) + lib-type-of x 9,502,757 ops/sec ±1.17% (89 runs sampled) + lib-typeof x 8,278,985 ops/sec ±1.08% (88 runs sampled) + + fastest is kind-of (by 113% avg) + +# null (24 bytes) + kind-of x 18,159,808 ops/sec ±1.92% (86 runs sampled) + lib-type-of x 12,927,635 ops/sec ±1.01% (88 runs sampled) + lib-typeof x 7,958,234 ops/sec ±1.21% (89 runs sampled) + + fastest is kind-of (by 174% avg) + +# number (22 bytes) + kind-of x 17,846,779 ops/sec ±0.91% (85 runs sampled) + lib-type-of x 3,316,636 ops/sec ±1.19% (86 runs sampled) + lib-typeof x 2,329,477 ops/sec ±2.21% (85 runs sampled) + + fastest is kind-of (by 632% avg) + +# object-plain (47 bytes) + kind-of x 7,085,155 ops/sec ±1.05% (88 runs sampled) + lib-type-of x 8,870,930 ops/sec ±1.06% (83 runs sampled) + lib-typeof x 8,716,024 ops/sec ±1.05% (87 runs sampled) + + fastest is lib-type-of (by 112% avg) + +# regex (25 bytes) + kind-of x 14,196,052 ops/sec ±1.65% (84 runs sampled) + lib-type-of x 9,554,164 ops/sec ±1.25% (88 runs sampled) + lib-typeof x 8,359,691 ops/sec ±1.07% (87 runs sampled) + + fastest is kind-of (by 158% avg) + +# string (33 bytes) + kind-of x 16,131,428 ops/sec ±1.41% (85 runs sampled) + lib-type-of x 7,273,172 ops/sec ±1.05% (87 runs sampled) + lib-typeof x 7,382,635 ops/sec ±1.17% (85 runs sampled) + + fastest is kind-of (by 220% avg) + +# symbol (34 bytes) + kind-of x 17,011,537 ops/sec ±1.24% (86 runs sampled) + lib-type-of x 3,492,454 ops/sec ±1.23% (89 runs sampled) + lib-typeof x 7,471,235 ops/sec ±2.48% (87 runs sampled) + + fastest is kind-of (by 310% avg) + +# template-strings (36 bytes) + kind-of x 15,434,250 ops/sec ±1.46% (83 runs sampled) + lib-type-of x 7,157,907 ops/sec ±0.97% (87 runs sampled) + lib-typeof x 7,517,986 ops/sec ±0.92% (86 runs sampled) + + fastest is kind-of (by 210% avg) + +# undefined (29 bytes) + kind-of x 19,167,115 ops/sec ±1.71% (87 runs sampled) + lib-type-of x 15,477,740 ops/sec ±1.63% (85 runs sampled) + lib-typeof x 19,075,495 ops/sec ±1.17% (83 runs sampled) + + fastest is lib-typeof,kind-of + +``` + +## Optimizations + +In 7 out of 8 cases, this library is 2x-10x faster than other top libraries included in the benchmarks. There are a few things that lead to this performance advantage, none of them hard and fast rules, but all of them simple and repeatable in almost any code library: + +1. Optimize around the fastest and most common use cases first. Of course, this will change from project-to-project, but I took some time to understand how and why `typeof` checks were being used in my own libraries and other libraries I use a lot. +2. Optimize around bottlenecks - In other words, the order in which conditionals are implemented is significant, because each check is only as fast as the failing checks that came before it. Here, the biggest bottleneck by far is checking for plain objects (an object that was created by the `Object` constructor). I opted to make this check happen by process of elimination rather than brute force up front (e.g. by using something like `val.constructor.name`), so that every other type check would not be penalized it. +3. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'` +4. There is no reason to make the code in a microlib as terse as possible, just to win points for making it shorter. It's always better to favor performant code over terse code. You will always only be using a single `require()` statement to use the library anyway, regardless of how the code is written. + +## Better type checking + +kind-of seems to be more consistently "correct" than other type checking libs I've looked at. For example, here are some differing results from other popular libs: + +### [typeof](https://github.com/CodingFu/typeof) lib + +Incorrectly identifies instances of custom constructors (pretty common): + +```js +var typeOf = require('typeof'); +function Test() {} +console.log(typeOf(new Test())); +//=> 'test' +``` + +Returns `object` instead of `arguments`: + +```js +function foo() { + console.log(typeOf(arguments)) //=> 'object' +} +foo(); +``` + +### [type-of](https://github.com/ForbesLindesay/type-of) lib + +Incorrectly returns `object` for generator functions, buffers, `Map`, `Set`, `WeakMap` and `WeakSet`: + +```js +function * foo() {} +console.log(typeOf(foo)); +//=> 'object' +console.log(typeOf(new Buffer(''))); +//=> 'object' +console.log(typeOf(new Map())); +//=> 'object' +console.log(typeOf(new Set())); +//=> 'object' +console.log(typeOf(new WeakMap())); +//=> 'object' +console.log(typeOf(new WeakSet())); +//=> 'object' +``` + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Related projects + +You might also be interested in these projects: + +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number "Returns true if the value is a number. comprehensive tests.") +* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 98 | [jonschlinkert](https://github.com/jonschlinkert) | +| 3 | [aretecode](https://github.com/aretecode) | +| 2 | [miguelmota](https://github.com/miguelmota) | +| 1 | [dtothefp](https://github.com/dtothefp) | +| 1 | [ianstormtaylor](https://github.com/ianstormtaylor) | +| 1 | [ksheedlo](https://github.com/ksheedlo) | +| 1 | [pdehaan](https://github.com/pdehaan) | +| 1 | [laggingreflex](https://github.com/laggingreflex) | +| 1 | [charlike-old](https://github.com/charlike-old) | + +### Author + +**Jon Schlinkert** + +* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert) +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on December 01, 2017._ \ No newline at end of file diff --git a/node_modules/braces/node_modules/kind-of/index.js b/node_modules/braces/node_modules/kind-of/index.js new file mode 100644 index 0000000..aa2bb39 --- /dev/null +++ b/node_modules/braces/node_modules/kind-of/index.js @@ -0,0 +1,129 @@ +var toString = Object.prototype.toString; + +module.exports = function kindOf(val) { + if (val === void 0) return 'undefined'; + if (val === null) return 'null'; + + var type = typeof val; + if (type === 'boolean') return 'boolean'; + if (type === 'string') return 'string'; + if (type === 'number') return 'number'; + if (type === 'symbol') return 'symbol'; + if (type === 'function') { + return isGeneratorFn(val) ? 'generatorfunction' : 'function'; + } + + if (isArray(val)) return 'array'; + if (isBuffer(val)) return 'buffer'; + if (isArguments(val)) return 'arguments'; + if (isDate(val)) return 'date'; + if (isError(val)) return 'error'; + if (isRegexp(val)) return 'regexp'; + + switch (ctorName(val)) { + case 'Symbol': return 'symbol'; + case 'Promise': return 'promise'; + + // Set, Map, WeakSet, WeakMap + case 'WeakMap': return 'weakmap'; + case 'WeakSet': return 'weakset'; + case 'Map': return 'map'; + case 'Set': return 'set'; + + // 8-bit typed arrays + case 'Int8Array': return 'int8array'; + case 'Uint8Array': return 'uint8array'; + case 'Uint8ClampedArray': return 'uint8clampedarray'; + + // 16-bit typed arrays + case 'Int16Array': return 'int16array'; + case 'Uint16Array': return 'uint16array'; + + // 32-bit typed arrays + case 'Int32Array': return 'int32array'; + case 'Uint32Array': return 'uint32array'; + case 'Float32Array': return 'float32array'; + case 'Float64Array': return 'float64array'; + } + + if (isGeneratorObj(val)) { + return 'generator'; + } + + // Non-plain objects + type = toString.call(val); + switch (type) { + case '[object Object]': return 'object'; + // iterators + case '[object Map Iterator]': return 'mapiterator'; + case '[object Set Iterator]': return 'setiterator'; + case '[object String Iterator]': return 'stringiterator'; + case '[object Array Iterator]': return 'arrayiterator'; + } + + // other + return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); +}; + +function ctorName(val) { + return val.constructor ? val.constructor.name : null; +} + +function isArray(val) { + if (Array.isArray) return Array.isArray(val); + return val instanceof Array; +} + +function isError(val) { + return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'); +} + +function isDate(val) { + if (val instanceof Date) return true; + return typeof val.toDateString === 'function' + && typeof val.getDate === 'function' + && typeof val.setDate === 'function'; +} + +function isRegexp(val) { + if (val instanceof RegExp) return true; + return typeof val.flags === 'string' + && typeof val.ignoreCase === 'boolean' + && typeof val.multiline === 'boolean' + && typeof val.global === 'boolean'; +} + +function isGeneratorFn(name, val) { + return ctorName(name) === 'GeneratorFunction'; +} + +function isGeneratorObj(val) { + return typeof val.throw === 'function' + && typeof val.return === 'function' + && typeof val.next === 'function'; +} + +function isArguments(val) { + try { + if (typeof val.length === 'number' && typeof val.callee === 'function') { + return true; + } + } catch (err) { + if (err.message.indexOf('callee') !== -1) { + return true; + } + } + return false; +} + +/** + * If you need to support Safari 5-7 (8-10 yr-old browser), + * take a look at https://github.com/feross/is-buffer + */ + +function isBuffer(val) { + if (val.constructor && typeof val.constructor.isBuffer === 'function') { + return val.constructor.isBuffer(val); + } + return false; +} diff --git a/node_modules/braces/node_modules/kind-of/package.json b/node_modules/braces/node_modules/kind-of/package.json new file mode 100644 index 0000000..1de5f4c --- /dev/null +++ b/node_modules/braces/node_modules/kind-of/package.json @@ -0,0 +1,143 @@ +{ + "_from": "kind-of@^6.0.2", + "_id": "kind-of@6.0.2", + "_inBundle": false, + "_integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "_location": "/braces/kind-of", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "kind-of@^6.0.2", + "name": "kind-of", + "escapedName": "kind-of", + "rawSpec": "^6.0.2", + "saveSpec": null, + "fetchSpec": "^6.0.2" + }, + "_requiredBy": [ + "/braces" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "_shasum": "01146b36a6218e64e58f3a8d66de5d7fc6f6d051", + "_spec": "kind-of@^6.0.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/braces", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/kind-of/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "David Fox-Powell", + "url": "https://dtothefp.github.io/me" + }, + { + "name": "James", + "url": "https://twitter.com/aretecode" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Ken Sheedlo", + "url": "kensheedlo.com" + }, + { + "name": "laggingreflex", + "url": "https://github.com/laggingreflex" + }, + { + "name": "Miguel Mota", + "url": "https://miguelmota.com" + }, + { + "name": "Peter deHaan", + "url": "http://about.me/peterdehaan" + }, + { + "name": "tunnckoCore", + "url": "https://i.am.charlike.online" + } + ], + "deprecated": false, + "description": "Get the native type of a value.", + "devDependencies": { + "benchmarked": "^2.0.0", + "browserify": "^14.4.0", + "gulp-format-md": "^1.0.0", + "mocha": "^4.0.1", + "write": "^1.0.3" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/kind-of", + "keywords": [ + "arguments", + "array", + "boolean", + "check", + "date", + "function", + "is", + "is-type", + "is-type-of", + "kind", + "kind-of", + "number", + "object", + "of", + "regexp", + "string", + "test", + "type", + "type-of", + "typeof", + "types" + ], + "license": "MIT", + "main": "index.js", + "name": "kind-of", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/kind-of.git" + }, + "scripts": { + "prepublish": "browserify -o browser.js -e index.js -s index --bare", + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "related": { + "list": [ + "is-glob", + "is-number", + "is-primitive" + ] + }, + "reflinks": [ + "type-of", + "typeof", + "verb" + ] + }, + "version": "6.0.2" +} diff --git a/node_modules/braces/package.json b/node_modules/braces/package.json new file mode 100644 index 0000000..50d6fa8 --- /dev/null +++ b/node_modules/braces/package.json @@ -0,0 +1,160 @@ +{ + "_from": "braces@^2.3.0", + "_id": "braces@2.3.1", + "_inBundle": false, + "_integrity": "sha512-SO5lYHA3vO6gz66erVvedSCkp7AKWdv6VcQ2N4ysXfPxdAlxAMMAdwegGGcv1Bqwm7naF1hNdk5d6AAIEHV2nQ==", + "_location": "/braces", + "_phantomChildren": { + "is-descriptor": "1.0.2", + "is-extendable": "0.1.1" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "braces@^2.3.0", + "name": "braces", + "escapedName": "braces", + "rawSpec": "^2.3.0", + "saveSpec": null, + "fetchSpec": "^2.3.0" + }, + "_requiredBy": [ + "/chokidar", + "/micromatch" + ], + "_resolved": "https://registry.npmjs.org/braces/-/braces-2.3.1.tgz", + "_shasum": "7086c913b4e5a08dbe37ac0ee6a2500c4ba691bb", + "_spec": "braces@^2.3.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/chokidar", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/micromatch/braces/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Brian Woodward", + "url": "https://twitter.com/doowb" + }, + { + "name": "Elan Shanker", + "url": "https://github.com/es128" + }, + { + "name": "Eugene Sharygin", + "url": "https://github.com/eush77" + }, + { + "name": "hemanth.hm", + "url": "http://h3manth.com" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + } + ], + "dependencies": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "kind-of": "^6.0.2", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "deprecated": false, + "description": "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.", + "devDependencies": { + "ansi-cyan": "^0.1.1", + "benchmarked": "^2.0.0", + "brace-expansion": "^1.1.8", + "cross-spawn": "^5.1.0", + "gulp": "^3.9.1", + "gulp-eslint": "^4.0.0", + "gulp-format-md": "^1.0.0", + "gulp-istanbul": "^1.1.2", + "gulp-mocha": "^3.0.1", + "gulp-unused": "^0.2.1", + "is-windows": "^1.0.1", + "minimatch": "^3.0.4", + "mocha": "^3.2.0", + "noncharacters": "^1.1.0", + "text-table": "^0.2.0", + "time-diff": "^0.3.1", + "yargs-parser": "^8.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js", + "lib" + ], + "homepage": "https://github.com/micromatch/braces", + "keywords": [ + "alpha", + "alphabetical", + "bash", + "brace", + "braces", + "expand", + "expansion", + "filepath", + "fill", + "fs", + "glob", + "globbing", + "letter", + "match", + "matches", + "matching", + "number", + "numerical", + "path", + "range", + "ranges", + "sh" + ], + "license": "MIT", + "main": "index.js", + "name": "braces", + "repository": { + "type": "git", + "url": "git+https://github.com/micromatch/braces.git" + }, + "scripts": { + "benchmark": "node benchmark", + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "lint": { + "reflinks": true + }, + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "expand-brackets", + "extglob", + "fill-range", + "micromatch", + "nanomatch" + ] + } + }, + "version": "2.3.1" +} diff --git a/node_modules/bson/HISTORY.md b/node_modules/bson/HISTORY.md new file mode 100644 index 0000000..d4b47d1 --- /dev/null +++ b/node_modules/bson/HISTORY.md @@ -0,0 +1,210 @@ + +## 1.0.5 (2018-02-26) + + +### Bug Fixes + +* **decimal128:** add basic guard against REDOS attacks ([bd61c45](https://github.com/mongodb/js-bson/commit/bd61c45)) +* **objectid:** if pid is 1, use random value ([e188ae6](https://github.com/mongodb/js-bson/commit/e188ae6)) + + + +1.0.4 2016-01-11 +---------------- +- #204 remove Buffer.from as it's partially broken in early 4.x.x. series of node releases. + +1.0.3 2016-01-03 +---------------- +- Fixed toString for ObjectId so it will work with inspect. + +1.0.2 2016-01-02 +---------------- +- Minor optimizations for ObjectID to use Buffer.from where available. + +1.0.1 2016-12-06 +---------------- +- Reverse behavior for undefined to be serialized as NULL. MongoDB 3.4 does not allow for undefined comparisons. + +1.0.0 2016-12-06 +---------------- +- Introduced new BSON API and documentation. + +0.5.7 2016-11-18 +----------------- +- NODE-848 BSON Regex flags must be alphabetically ordered. + +0.5.6 2016-10-19 +----------------- +- NODE-833, Detects cyclic dependencies in documents and throws error if one is found. +- Fix(deserializer): corrected the check for (size + index) comparison… (Issue #195, https://github.com/JoelParke). + +0.5.5 2016-09-15 +----------------- +- Added DBPointer up conversion to DBRef + +0.5.4 2016-08-23 +----------------- +- Added promoteValues flag (default to true) allowing user to specify if deserialization should be into wrapper classes only. + +0.5.3 2016-07-11 +----------------- +- Throw error if ObjectId is not a string or a buffer. + +0.5.2 2016-07-11 +----------------- +- All values encoded big-endian style for ObjectId. + +0.5.1 2016-07-11 +----------------- +- Fixed encoding/decoding issue in ObjectId timestamp generation. +- Removed BinaryParser dependency from the serializer/deserializer. + +0.5.0 2016-07-05 +----------------- +- Added Decimal128 type and extended test suite to include entire bson corpus. + +0.4.23 2016-04-08 +----------------- +- Allow for proper detection of ObjectId or objects that look like ObjectId, improving compatibility across third party libraries. +- Remove one package from dependency due to having been pulled from NPM. + +0.4.22 2016-03-04 +----------------- +- Fix "TypeError: data.copy is not a function" in Electron (Issue #170, https://github.com/kangas). +- Fixed issue with undefined type on deserializing. + +0.4.21 2016-01-12 +----------------- +- Minor optimizations to avoid non needed object creation. + +0.4.20 2015-10-15 +----------------- +- Added bower file to repository. +- Fixed browser pid sometimes set greater than 0xFFFF on browsers (Issue #155, https://github.com/rahatarmanahmed) + +0.4.19 2015-10-15 +----------------- +- Remove all support for bson-ext. + +0.4.18 2015-10-15 +----------------- +- ObjectID equality check should return boolean instead of throwing exception for invalid oid string #139 +- add option for deserializing binary into Buffer object #116 + +0.4.17 2015-10-15 +----------------- +- Validate regexp string for null bytes and throw if there is one. + +0.4.16 2015-10-07 +----------------- +- Fixed issue with return statement in Map.js. + +0.4.15 2015-10-06 +----------------- +- Exposed Map correctly via index.js file. + +0.4.14 2015-10-06 +----------------- +- Exposed Map correctly via bson.js file. + +0.4.13 2015-10-06 +----------------- +- Added ES6 Map type serialization as well as a polyfill for ES5. + +0.4.12 2015-09-18 +----------------- +- Made ignore undefined an optional parameter. + +0.4.11 2015-08-06 +----------------- +- Minor fix for invalid key checking. + +0.4.10 2015-08-06 +----------------- +- NODE-38 Added new BSONRegExp type to allow direct serialization to MongoDB type. +- Some performance improvements by in lining code. + +0.4.9 2015-08-06 +---------------- +- Undefined fields are omitted from serialization in objects. + +0.4.8 2015-07-14 +---------------- +- Fixed size validation to ensure we can deserialize from dumped files. + +0.4.7 2015-06-26 +---------------- +- Added ability to instruct deserializer to return raw BSON buffers for named array fields. +- Minor deserialization optimization by moving inlined function out. + +0.4.6 2015-06-17 +---------------- +- Fixed serializeWithBufferAndIndex bug. + +0.4.5 2015-06-17 +---------------- +- Removed any references to the shared buffer to avoid non GC collectible bson instances. + +0.4.4 2015-06-17 +---------------- +- Fixed rethrowing of error when not RangeError. + +0.4.3 2015-06-17 +---------------- +- Start buffer at 64K and double as needed, meaning we keep a low memory profile until needed. + +0.4.2 2015-06-16 +---------------- +- More fixes for corrupt Bson + +0.4.1 2015-06-16 +---------------- +- More fixes for corrupt Bson + +0.4.0 2015-06-16 +---------------- +- New JS serializer serializing into a single buffer then copying out the new buffer. Performance is similar to current C++ parser. +- Removed bson-ext extension dependency for now. + +0.3.2 2015-03-27 +---------------- +- Removed node-gyp from install script in package.json. + +0.3.1 2015-03-27 +---------------- +- Return pure js version on native() call if failed to initialize. + +0.3.0 2015-03-26 +---------------- +- Pulled out all C++ code into bson-ext and made it an optional dependency. + +0.2.21 2015-03-21 +----------------- +- Updated Nan to 1.7.0 to support io.js and node 0.12.0 + +0.2.19 2015-02-16 +----------------- +- Updated Nan to 1.6.2 to support io.js and node 0.12.0 + +0.2.18 2015-01-20 +----------------- +- Updated Nan to 1.5.1 to support io.js + +0.2.16 2014-12-17 +----------------- +- Made pid cycle on 0xffff to avoid weird overflows on creation of ObjectID's + +0.2.12 2014-08-24 +----------------- +- Fixes for fortify review of c++ extension +- toBSON correctly allows returns of non objects + +0.2.3 2013-10-01 +---------------- +- Drying of ObjectId code for generation of id (Issue #54, https://github.com/moredip) +- Fixed issue where corrupt CString's could cause endless loop +- Support for Node 0.11.X > (Issue #49, https://github.com/kkoopa) + +0.1.4 2012-09-25 +---------------- +- Added precompiled c++ native extensions for win32 ia32 and x64 diff --git a/node_modules/bson/LICENSE.md b/node_modules/bson/LICENSE.md new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/node_modules/bson/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/bson/README.md b/node_modules/bson/README.md new file mode 100644 index 0000000..ec5fbcd --- /dev/null +++ b/node_modules/bson/README.md @@ -0,0 +1,150 @@ +# BSON parser + +BSON is short for Bin­ary JSON and is the bin­ary-en­coded seri­al­iz­a­tion of JSON-like doc­u­ments. You can learn more about it in [the specification](http://bsonspec.org). + +This browser version of the BSON parser is compiled using [webpack](https://webpack.js.org/) and the current version is pre-compiled in the `browser_build` directory. + +This is the default BSON parser, however, there is a C++ Node.js addon version as well that does not support the browser. It can be found at [mongod-js/bson-ext](https://github.com/mongodb-js/bson-ext). + +## Usage + +To build a new version perform the following operations: + +``` +npm install +npm run build +``` + +A simple example of how to use BSON in the browser: + +```html + + + +``` + +A simple example of how to use BSON in `Node.js`: + +```js +// Get BSON parser class +var BSON = require('bson') +// Get the Long type +var Long = BSON.Long; +// Create a bson parser instance +var bson = new BSON(); + +// Serialize document +var doc = { long: Long.fromNumber(100) } + +// Serialize a document +var data = bson.serialize(doc) +console.log('data:', data) + +// Deserialize the resulting Buffer +var doc_2 = bson.deserialize(data) +console.log('doc_2:', doc_2) +``` + +## Installation + +`npm install bson` + +## API + +### BSON types + +For all BSON types documentation, please refer to the documentation for the [MongoDB Node.js driver](https://github.com/mongodb/node-mongodb-native). + +### BSON serialization and deserialiation + +**`new BSON()`** - Creates a new BSON serializer/deserializer you can use to serialize and deserialize BSON. + +#### BSON.serialize + +The BSON `serialize` method takes a JavaScript object and an optional options object and returns a Node.js Buffer. + + * `BSON.serialize(object, options)` + * @param {Object} object the JavaScript object to serialize. + * @param {Boolean} [options.checkKeys=false] the serializer will check if keys are valid. + * @param {Boolean} [options.serializeFunctions=false] serialize the JavaScript functions. + * @param {Boolean} [options.ignoreUndefined=true] + * @return {Buffer} returns a Buffer instance. + +#### BSON.serializeWithBufferAndIndex + +The BSON `serializeWithBufferAndIndex` method takes an object, a target buffer instance and an optional options object and returns the end serialization index in the final buffer. + + * `BSON.serializeWithBufferAndIndex(object, buffer, options)` + * @param {Object} object the JavaScript object to serialize. + * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. + * @param {Boolean} [options.checkKeys=false] the serializer will check if keys are valid. + * @param {Boolean} [options.serializeFunctions=false] serialize the JavaScript functions. + * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields. + * @param {Number} [options.index=0] the index in the buffer where we wish to start serializing into. + * @return {Number} returns the index pointing to the last written byte in the buffer. + +#### BSON.calculateObjectSize + +The BSON `calculateObjectSize` method takes a JavaScript object and an optional options object and returns the size of the BSON object. + + * `BSON.calculateObjectSize(object, options)` + * @param {Object} object the JavaScript object to serialize. + * @param {Boolean} [options.serializeFunctions=false] serialize the JavaScript functions. + * @param {Boolean} [options.ignoreUndefined=true] + * @return {Buffer} returns a Buffer instance. + +#### BSON.deserialize + +The BSON `deserialize` method takes a Node.js Buffer and an optional options object and returns a deserialized JavaScript object. + + * `BSON.deserialize(buffer, options)` + * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized. + * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse. + * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function. + * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits + * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a Node.js Buffer instance. + * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types. + * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer. + * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances. + * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. + +#### BSON.deserializeStream + +The BSON `deserializeStream` method takes a Node.js Buffer, `startIndex` and allow more control over deserialization of a Buffer containing concatenated BSON documents. + + * `BSON.deserializeStream(buffer, startIndex, numberOfDocuments, documents, docStartIndex, options)` + * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. + * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. + * @param {Number} numberOfDocuments number of documents to deserialize. + * @param {Array} documents an array where to store the deserialized documents. + * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. + * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized. + * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse. + * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function. + * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits + * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a Node.js Buffer instance. + * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types. + * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer. + * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances. + * @return {Object} returns the deserialized JavaScript Object. + +## FAQ + +#### Why does `undefined` get converted to `null`? + +The `undefined` BSON type has been [deprecated for many years](http://bsonspec.org/spec.html), so this library has dropped support for it. Use the `ignoreUndefined` option (for example, from the [driver](http://mongodb.github.io/node-mongodb-native/2.2/api/MongoClient.html#connect) ) to instead remove `undefined` keys. diff --git a/node_modules/bson/bower.json b/node_modules/bson/bower.json new file mode 100644 index 0000000..b32140e --- /dev/null +++ b/node_modules/bson/bower.json @@ -0,0 +1,25 @@ +{ + "name": "bson", + "description": "A bson parser for node.js and the browser", + "keywords": [ + "mongodb", + "bson", + "parser" + ], + "author": "Christian Amor Kvalheim ", + "main": "./browser_build/bson.js", + "license": "Apache-2.0", + "moduleType": [ + "globals", + "node" + ], + "ignore": [ + "**/.*", + "alternate_parsers", + "benchmarks", + "bower_components", + "node_modules", + "test", + "tools" + ] +} diff --git a/node_modules/bson/browser_build/bson.js b/node_modules/bson/browser_build/bson.js new file mode 100644 index 0000000..bae3dfd --- /dev/null +++ b/node_modules/bson/browser_build/bson.js @@ -0,0 +1,19407 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if (typeof exports === 'object' && typeof module === 'object') module.exports = factory(); + else if (typeof define === 'function' && define.amd) define([], factory); + else { + var a = factory(); + for (var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; + } +})(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__) { + __webpack_require__(1); + module.exports = __webpack_require__(298); + + /***/ + }, + /* 1 */ + /***/ function(module, exports, __webpack_require__) { + /* WEBPACK VAR INJECTION */ (function(global) { + 'use strict'; + + __webpack_require__(2); + + __webpack_require__(293); + + __webpack_require__(295); + + if (global._babelPolyfill) { + throw new Error('only one instance of babel-polyfill is allowed'); + } + global._babelPolyfill = true; + + var DEFINE_PROPERTY = 'defineProperty'; + function define(O, key, value) { + O[key] || + Object[DEFINE_PROPERTY](O, key, { + writable: true, + configurable: true, + value: value + }); + } + + define(String.prototype, 'padLeft', ''.padStart); + define(String.prototype, 'padRight', ''.padEnd); + + 'pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill' + .split(',') + .forEach(function(key) { + [][key] && define(Array, key, Function.call.bind([][key])); + }); + /* WEBPACK VAR INJECTION */ + }.call( + exports, + (function() { + return this; + })() + )); + + /***/ + }, + /* 2 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(3); + __webpack_require__(52); + __webpack_require__(53); + __webpack_require__(54); + __webpack_require__(55); + __webpack_require__(57); + __webpack_require__(60); + __webpack_require__(61); + __webpack_require__(62); + __webpack_require__(63); + __webpack_require__(64); + __webpack_require__(65); + __webpack_require__(66); + __webpack_require__(67); + __webpack_require__(68); + __webpack_require__(70); + __webpack_require__(72); + __webpack_require__(74); + __webpack_require__(76); + __webpack_require__(79); + __webpack_require__(80); + __webpack_require__(81); + __webpack_require__(85); + __webpack_require__(87); + __webpack_require__(89); + __webpack_require__(92); + __webpack_require__(93); + __webpack_require__(94); + __webpack_require__(95); + __webpack_require__(97); + __webpack_require__(98); + __webpack_require__(99); + __webpack_require__(100); + __webpack_require__(101); + __webpack_require__(102); + __webpack_require__(103); + __webpack_require__(105); + __webpack_require__(106); + __webpack_require__(107); + __webpack_require__(109); + __webpack_require__(110); + __webpack_require__(111); + __webpack_require__(113); + __webpack_require__(114); + __webpack_require__(115); + __webpack_require__(116); + __webpack_require__(117); + __webpack_require__(118); + __webpack_require__(119); + __webpack_require__(120); + __webpack_require__(121); + __webpack_require__(122); + __webpack_require__(123); + __webpack_require__(124); + __webpack_require__(125); + __webpack_require__(126); + __webpack_require__(131); + __webpack_require__(132); + __webpack_require__(136); + __webpack_require__(137); + __webpack_require__(138); + __webpack_require__(139); + __webpack_require__(141); + __webpack_require__(142); + __webpack_require__(143); + __webpack_require__(144); + __webpack_require__(145); + __webpack_require__(146); + __webpack_require__(147); + __webpack_require__(148); + __webpack_require__(149); + __webpack_require__(150); + __webpack_require__(151); + __webpack_require__(152); + __webpack_require__(153); + __webpack_require__(154); + __webpack_require__(155); + __webpack_require__(156); + __webpack_require__(157); + __webpack_require__(159); + __webpack_require__(160); + __webpack_require__(166); + __webpack_require__(167); + __webpack_require__(169); + __webpack_require__(170); + __webpack_require__(171); + __webpack_require__(175); + __webpack_require__(176); + __webpack_require__(177); + __webpack_require__(178); + __webpack_require__(179); + __webpack_require__(181); + __webpack_require__(182); + __webpack_require__(183); + __webpack_require__(184); + __webpack_require__(187); + __webpack_require__(189); + __webpack_require__(190); + __webpack_require__(191); + __webpack_require__(193); + __webpack_require__(195); + __webpack_require__(197); + __webpack_require__(198); + __webpack_require__(199); + __webpack_require__(201); + __webpack_require__(202); + __webpack_require__(203); + __webpack_require__(204); + __webpack_require__(211); + __webpack_require__(214); + __webpack_require__(215); + __webpack_require__(217); + __webpack_require__(218); + __webpack_require__(221); + __webpack_require__(222); + __webpack_require__(224); + __webpack_require__(225); + __webpack_require__(226); + __webpack_require__(227); + __webpack_require__(228); + __webpack_require__(229); + __webpack_require__(230); + __webpack_require__(231); + __webpack_require__(232); + __webpack_require__(233); + __webpack_require__(234); + __webpack_require__(235); + __webpack_require__(236); + __webpack_require__(237); + __webpack_require__(238); + __webpack_require__(239); + __webpack_require__(240); + __webpack_require__(241); + __webpack_require__(242); + __webpack_require__(244); + __webpack_require__(245); + __webpack_require__(246); + __webpack_require__(247); + __webpack_require__(248); + __webpack_require__(249); + __webpack_require__(251); + __webpack_require__(252); + __webpack_require__(253); + __webpack_require__(254); + __webpack_require__(255); + __webpack_require__(256); + __webpack_require__(257); + __webpack_require__(258); + __webpack_require__(260); + __webpack_require__(261); + __webpack_require__(263); + __webpack_require__(264); + __webpack_require__(265); + __webpack_require__(266); + __webpack_require__(269); + __webpack_require__(270); + __webpack_require__(271); + __webpack_require__(272); + __webpack_require__(273); + __webpack_require__(274); + __webpack_require__(275); + __webpack_require__(276); + __webpack_require__(278); + __webpack_require__(279); + __webpack_require__(280); + __webpack_require__(281); + __webpack_require__(282); + __webpack_require__(283); + __webpack_require__(284); + __webpack_require__(285); + __webpack_require__(286); + __webpack_require__(287); + __webpack_require__(288); + __webpack_require__(291); + __webpack_require__(292); + module.exports = __webpack_require__(9); + + /***/ + }, + /* 3 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // ECMAScript 6 symbols shim + var global = __webpack_require__(4), + has = __webpack_require__(5), + DESCRIPTORS = __webpack_require__(6), + $export = __webpack_require__(8), + redefine = __webpack_require__(18), + META = __webpack_require__(22).KEY, + $fails = __webpack_require__(7), + shared = __webpack_require__(23), + setToStringTag = __webpack_require__(24), + uid = __webpack_require__(19), + wks = __webpack_require__(25), + wksExt = __webpack_require__(26), + wksDefine = __webpack_require__(27), + keyOf = __webpack_require__(29), + enumKeys = __webpack_require__(42), + isArray = __webpack_require__(45), + anObject = __webpack_require__(12), + toIObject = __webpack_require__(32), + toPrimitive = __webpack_require__(16), + createDesc = __webpack_require__(17), + _create = __webpack_require__(46), + gOPNExt = __webpack_require__(49), + $GOPD = __webpack_require__(51), + $DP = __webpack_require__(11), + $keys = __webpack_require__(30), + gOPD = $GOPD.f, + dP = $DP.f, + gOPN = gOPNExt.f, + $Symbol = global.Symbol, + $JSON = global.JSON, + _stringify = $JSON && $JSON.stringify, + PROTOTYPE = 'prototype', + HIDDEN = wks('_hidden'), + TO_PRIMITIVE = wks('toPrimitive'), + isEnum = {}.propertyIsEnumerable, + SymbolRegistry = shared('symbol-registry'), + AllSymbols = shared('symbols'), + OPSymbols = shared('op-symbols'), + ObjectProto = Object[PROTOTYPE], + USE_NATIVE = typeof $Symbol == 'function', + QObject = global.QObject; + // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 + var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; + + // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 + var setSymbolDesc = + DESCRIPTORS && + $fails(function() { + return ( + _create( + dP({}, 'a', { + get: function() { + return dP(this, 'a', { value: 7 }).a; + } + }) + ).a != 7 + ); + }) + ? function(it, key, D) { + var protoDesc = gOPD(ObjectProto, key); + if (protoDesc) delete ObjectProto[key]; + dP(it, key, D); + if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc); + } + : dP; + + var wrap = function(tag) { + var sym = (AllSymbols[tag] = _create($Symbol[PROTOTYPE])); + sym._k = tag; + return sym; + }; + + var isSymbol = + USE_NATIVE && typeof $Symbol.iterator == 'symbol' + ? function(it) { + return typeof it == 'symbol'; + } + : function(it) { + return it instanceof $Symbol; + }; + + var $defineProperty = function defineProperty(it, key, D) { + if (it === ObjectProto) $defineProperty(OPSymbols, key, D); + anObject(it); + key = toPrimitive(key, true); + anObject(D); + if (has(AllSymbols, key)) { + if (!D.enumerable) { + if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {})); + it[HIDDEN][key] = true; + } else { + if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; + D = _create(D, { enumerable: createDesc(0, false) }); + } + return setSymbolDesc(it, key, D); + } + return dP(it, key, D); + }; + var $defineProperties = function defineProperties(it, P) { + anObject(it); + var keys = enumKeys((P = toIObject(P))), + i = 0, + l = keys.length, + key; + while (l > i) $defineProperty(it, (key = keys[i++]), P[key]); + return it; + }; + var $create = function create(it, P) { + return P === undefined ? _create(it) : $defineProperties(_create(it), P); + }; + var $propertyIsEnumerable = function propertyIsEnumerable(key) { + var E = isEnum.call(this, (key = toPrimitive(key, true))); + if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) + return false; + return E || + !has(this, key) || + !has(AllSymbols, key) || + (has(this, HIDDEN) && this[HIDDEN][key]) + ? E + : true; + }; + var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { + it = toIObject(it); + key = toPrimitive(key, true); + if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return; + var D = gOPD(it, key); + if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) + D.enumerable = true; + return D; + }; + var $getOwnPropertyNames = function getOwnPropertyNames(it) { + var names = gOPN(toIObject(it)), + result = [], + i = 0, + key; + while (names.length > i) { + if (!has(AllSymbols, (key = names[i++])) && key != HIDDEN && key != META) + result.push(key); + } + return result; + }; + var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { + var IS_OP = it === ObjectProto, + names = gOPN(IS_OP ? OPSymbols : toIObject(it)), + result = [], + i = 0, + key; + while (names.length > i) { + if ( + has(AllSymbols, (key = names[i++])) && + (IS_OP ? has(ObjectProto, key) : true) + ) + result.push(AllSymbols[key]); + } + return result; + }; + + // 19.4.1.1 Symbol([description]) + if (!USE_NATIVE) { + $Symbol = function Symbol() { + if (this instanceof $Symbol) + throw TypeError('Symbol is not a constructor!'); + var tag = uid(arguments.length > 0 ? arguments[0] : undefined); + var $set = function(value) { + if (this === ObjectProto) $set.call(OPSymbols, value); + if (has(this, HIDDEN) && has(this[HIDDEN], tag)) + this[HIDDEN][tag] = false; + setSymbolDesc(this, tag, createDesc(1, value)); + }; + if (DESCRIPTORS && setter) + setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set }); + return wrap(tag); + }; + redefine($Symbol[PROTOTYPE], 'toString', function toString() { + return this._k; + }); + + $GOPD.f = $getOwnPropertyDescriptor; + $DP.f = $defineProperty; + __webpack_require__(50).f = gOPNExt.f = $getOwnPropertyNames; + __webpack_require__(44).f = $propertyIsEnumerable; + __webpack_require__(43).f = $getOwnPropertySymbols; + + if (DESCRIPTORS && !__webpack_require__(28)) { + redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); + } + + wksExt.f = function(name) { + return wrap(wks(name)); + }; + } + + $export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol }); + + for ( + var symbols = // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 + 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'.split( + ',' + ), + i = 0; + symbols.length > i; + + ) + wks(symbols[i++]); + + for (var symbols = $keys(wks.store), i = 0; symbols.length > i; ) + wksDefine(symbols[i++]); + + $export($export.S + $export.F * !USE_NATIVE, 'Symbol', { + // 19.4.2.1 Symbol.for(key) + for: function(key) { + return has(SymbolRegistry, (key += '')) + ? SymbolRegistry[key] + : (SymbolRegistry[key] = $Symbol(key)); + }, + // 19.4.2.5 Symbol.keyFor(sym) + keyFor: function keyFor(key) { + if (isSymbol(key)) return keyOf(SymbolRegistry, key); + throw TypeError(key + ' is not a symbol!'); + }, + useSetter: function() { + setter = true; + }, + useSimple: function() { + setter = false; + } + }); + + $export($export.S + $export.F * !USE_NATIVE, 'Object', { + // 19.1.2.2 Object.create(O [, Properties]) + create: $create, + // 19.1.2.4 Object.defineProperty(O, P, Attributes) + defineProperty: $defineProperty, + // 19.1.2.3 Object.defineProperties(O, Properties) + defineProperties: $defineProperties, + // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) + getOwnPropertyDescriptor: $getOwnPropertyDescriptor, + // 19.1.2.7 Object.getOwnPropertyNames(O) + getOwnPropertyNames: $getOwnPropertyNames, + // 19.1.2.8 Object.getOwnPropertySymbols(O) + getOwnPropertySymbols: $getOwnPropertySymbols + }); + + // 24.3.2 JSON.stringify(value [, replacer [, space]]) + $JSON && + $export( + $export.S + + $export.F * + (!USE_NATIVE || + $fails(function() { + var S = $Symbol(); + // MS Edge converts symbol values to JSON as {} + // WebKit converts symbol values to JSON as null + // V8 throws on boxed symbols + return ( + _stringify([S]) != '[null]' || + _stringify({ a: S }) != '{}' || + _stringify(Object(S)) != '{}' + ); + })), + 'JSON', + { + stringify: function stringify(it) { + if (it === undefined || isSymbol(it)) return; // IE8 returns string on undefined + var args = [it], + i = 1, + replacer, + $replacer; + while (arguments.length > i) args.push(arguments[i++]); + replacer = args[1]; + if (typeof replacer == 'function') $replacer = replacer; + if ($replacer || !isArray(replacer)) + replacer = function(key, value) { + if ($replacer) value = $replacer.call(this, key, value); + if (!isSymbol(value)) return value; + }; + args[1] = replacer; + return _stringify.apply($JSON, args); + } + } + ); + + // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) + $Symbol[PROTOTYPE][TO_PRIMITIVE] || + __webpack_require__(10)( + $Symbol[PROTOTYPE], + TO_PRIMITIVE, + $Symbol[PROTOTYPE].valueOf + ); + // 19.4.3.5 Symbol.prototype[@@toStringTag] + setToStringTag($Symbol, 'Symbol'); + // 20.2.1.9 Math[@@toStringTag] + setToStringTag(Math, 'Math', true); + // 24.3.3 JSON[@@toStringTag] + setToStringTag(global.JSON, 'JSON', true); + + /***/ + }, + /* 4 */ + /***/ function(module, exports) { + // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 + var global = (module.exports = + typeof window != 'undefined' && window.Math == Math + ? window + : typeof self != 'undefined' && self.Math == Math + ? self + : Function('return this')()); + if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef + + /***/ + }, + /* 5 */ + /***/ function(module, exports) { + var hasOwnProperty = {}.hasOwnProperty; + module.exports = function(it, key) { + return hasOwnProperty.call(it, key); + }; + + /***/ + }, + /* 6 */ + /***/ function(module, exports, __webpack_require__) { + // Thank's IE8 for his funny defineProperty + module.exports = !__webpack_require__(7)(function() { + return ( + Object.defineProperty({}, 'a', { + get: function() { + return 7; + } + }).a != 7 + ); + }); + + /***/ + }, + /* 7 */ + /***/ function(module, exports) { + module.exports = function(exec) { + try { + return !!exec(); + } catch (e) { + return true; + } + }; + + /***/ + }, + /* 8 */ + /***/ function(module, exports, __webpack_require__) { + var global = __webpack_require__(4), + core = __webpack_require__(9), + hide = __webpack_require__(10), + redefine = __webpack_require__(18), + ctx = __webpack_require__(20), + PROTOTYPE = 'prototype'; + + var $export = function(type, name, source) { + var IS_FORCED = type & $export.F, + IS_GLOBAL = type & $export.G, + IS_STATIC = type & $export.S, + IS_PROTO = type & $export.P, + IS_BIND = type & $export.B, + target = IS_GLOBAL + ? global + : IS_STATIC + ? global[name] || (global[name] = {}) + : (global[name] || {})[PROTOTYPE], + exports = IS_GLOBAL ? core : core[name] || (core[name] = {}), + expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}), + key, + own, + out, + exp; + if (IS_GLOBAL) source = name; + for (key in source) { + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + // export native or passed + out = (own ? target : source)[key]; + // bind timers to global for call from export context + exp = + IS_BIND && own + ? ctx(out, global) + : IS_PROTO && typeof out == 'function' + ? ctx(Function.call, out) + : out; + // extend global + if (target) redefine(target, key, out, type & $export.U); + // export + if (exports[key] != out) hide(exports, key, exp); + if (IS_PROTO && expProto[key] != out) expProto[key] = out; + } + }; + global.core = core; + // type bitmap + $export.F = 1; // forced + $export.G = 2; // global + $export.S = 4; // static + $export.P = 8; // proto + $export.B = 16; // bind + $export.W = 32; // wrap + $export.U = 64; // safe + $export.R = 128; // real proto method for `library` + module.exports = $export; + + /***/ + }, + /* 9 */ + /***/ function(module, exports) { + var core = (module.exports = { version: '2.4.0' }); + if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef + + /***/ + }, + /* 10 */ + /***/ function(module, exports, __webpack_require__) { + var dP = __webpack_require__(11), + createDesc = __webpack_require__(17); + module.exports = __webpack_require__(6) + ? function(object, key, value) { + return dP.f(object, key, createDesc(1, value)); + } + : function(object, key, value) { + object[key] = value; + return object; + }; + + /***/ + }, + /* 11 */ + /***/ function(module, exports, __webpack_require__) { + var anObject = __webpack_require__(12), + IE8_DOM_DEFINE = __webpack_require__(14), + toPrimitive = __webpack_require__(16), + dP = Object.defineProperty; + + exports.f = __webpack_require__(6) + ? Object.defineProperty + : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if (IE8_DOM_DEFINE) + try { + return dP(O, P, Attributes); + } catch (e) { + /* empty */ + } + if ('get' in Attributes || 'set' in Attributes) + throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; + }; + + /***/ + }, + /* 12 */ + /***/ function(module, exports, __webpack_require__) { + var isObject = __webpack_require__(13); + module.exports = function(it) { + if (!isObject(it)) throw TypeError(it + ' is not an object!'); + return it; + }; + + /***/ + }, + /* 13 */ + /***/ function(module, exports) { + module.exports = function(it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; + }; + + /***/ + }, + /* 14 */ + /***/ function(module, exports, __webpack_require__) { + module.exports = + !__webpack_require__(6) && + !__webpack_require__(7)(function() { + return ( + Object.defineProperty(__webpack_require__(15)('div'), 'a', { + get: function() { + return 7; + } + }).a != 7 + ); + }); + + /***/ + }, + /* 15 */ + /***/ function(module, exports, __webpack_require__) { + var isObject = __webpack_require__(13), + document = __webpack_require__(4).document, + // in old IE typeof document.createElement is 'object' + is = isObject(document) && isObject(document.createElement); + module.exports = function(it) { + return is ? document.createElement(it) : {}; + }; + + /***/ + }, + /* 16 */ + /***/ function(module, exports, __webpack_require__) { + // 7.1.1 ToPrimitive(input [, PreferredType]) + var isObject = __webpack_require__(13); + // instead of the ES6 spec version, we didn't implement @@toPrimitive case + // and the second argument - flag - preferred type is a string + module.exports = function(it, S) { + if (!isObject(it)) return it; + var fn, val; + if ( + S && + typeof (fn = it.toString) == 'function' && + !isObject((val = fn.call(it))) + ) + return val; + if (typeof (fn = it.valueOf) == 'function' && !isObject((val = fn.call(it)))) + return val; + if ( + !S && + typeof (fn = it.toString) == 'function' && + !isObject((val = fn.call(it))) + ) + return val; + throw TypeError("Can't convert object to primitive value"); + }; + + /***/ + }, + /* 17 */ + /***/ function(module, exports) { + module.exports = function(bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; + }; + + /***/ + }, + /* 18 */ + /***/ function(module, exports, __webpack_require__) { + var global = __webpack_require__(4), + hide = __webpack_require__(10), + has = __webpack_require__(5), + SRC = __webpack_require__(19)('src'), + TO_STRING = 'toString', + $toString = Function[TO_STRING], + TPL = ('' + $toString).split(TO_STRING); + + __webpack_require__(9).inspectSource = function(it) { + return $toString.call(it); + }; + + (module.exports = function(O, key, val, safe) { + var isFunction = typeof val == 'function'; + if (isFunction) has(val, 'name') || hide(val, 'name', key); + if (O[key] === val) return; + if (isFunction) + has(val, SRC) || + hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); + if (O === global) { + O[key] = val; + } else { + if (!safe) { + delete O[key]; + hide(O, key, val); + } else { + if (O[key]) O[key] = val; + else hide(O, key, val); + } + } + // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative + })(Function.prototype, TO_STRING, function toString() { + return (typeof this == 'function' && this[SRC]) || $toString.call(this); + }); + + /***/ + }, + /* 19 */ + /***/ function(module, exports) { + var id = 0, + px = Math.random(); + module.exports = function(key) { + return 'Symbol('.concat( + key === undefined ? '' : key, + ')_', + (++id + px).toString(36) + ); + }; + + /***/ + }, + /* 20 */ + /***/ function(module, exports, __webpack_require__) { + // optional / simple context binding + var aFunction = __webpack_require__(21); + module.exports = function(fn, that, length) { + aFunction(fn); + if (that === undefined) return fn; + switch (length) { + case 1: + return function(a) { + return fn.call(that, a); + }; + case 2: + return function(a, b) { + return fn.call(that, a, b); + }; + case 3: + return function(a, b, c) { + return fn.call(that, a, b, c); + }; + } + return function(/* ...args */) { + return fn.apply(that, arguments); + }; + }; + + /***/ + }, + /* 21 */ + /***/ function(module, exports) { + module.exports = function(it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); + return it; + }; + + /***/ + }, + /* 22 */ + /***/ function(module, exports, __webpack_require__) { + var META = __webpack_require__(19)('meta'), + isObject = __webpack_require__(13), + has = __webpack_require__(5), + setDesc = __webpack_require__(11).f, + id = 0; + var isExtensible = + Object.isExtensible || + function() { + return true; + }; + var FREEZE = !__webpack_require__(7)(function() { + return isExtensible(Object.preventExtensions({})); + }); + var setMeta = function(it) { + setDesc(it, META, { + value: { + i: 'O' + ++id, // object ID + w: {} // weak collections IDs + } + }); + }; + var fastKey = function(it, create) { + // return primitive with prefix + if (!isObject(it)) + return typeof it == 'symbol' + ? it + : (typeof it == 'string' ? 'S' : 'P') + it; + if (!has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return 'F'; + // not necessary to add metadata + if (!create) return 'E'; + // add missing metadata + setMeta(it); + // return object ID + } + return it[META].i; + }; + var getWeak = function(it, create) { + if (!has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return true; + // not necessary to add metadata + if (!create) return false; + // add missing metadata + setMeta(it); + // return hash weak collections IDs + } + return it[META].w; + }; + // add metadata on freeze-family methods calling + var onFreeze = function(it) { + if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); + return it; + }; + var meta = (module.exports = { + KEY: META, + NEED: false, + fastKey: fastKey, + getWeak: getWeak, + onFreeze: onFreeze + }); + + /***/ + }, + /* 23 */ + /***/ function(module, exports, __webpack_require__) { + var global = __webpack_require__(4), + SHARED = '__core-js_shared__', + store = global[SHARED] || (global[SHARED] = {}); + module.exports = function(key) { + return store[key] || (store[key] = {}); + }; + + /***/ + }, + /* 24 */ + /***/ function(module, exports, __webpack_require__) { + var def = __webpack_require__(11).f, + has = __webpack_require__(5), + TAG = __webpack_require__(25)('toStringTag'); + + module.exports = function(it, tag, stat) { + if (it && !has((it = stat ? it : it.prototype), TAG)) + def(it, TAG, { configurable: true, value: tag }); + }; + + /***/ + }, + /* 25 */ + /***/ function(module, exports, __webpack_require__) { + var store = __webpack_require__(23)('wks'), + uid = __webpack_require__(19), + Symbol = __webpack_require__(4).Symbol, + USE_SYMBOL = typeof Symbol == 'function'; + + var $exports = (module.exports = function(name) { + return ( + store[name] || + (store[name] = + (USE_SYMBOL && Symbol[name]) || + (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)) + ); + }); + + $exports.store = store; + + /***/ + }, + /* 26 */ + /***/ function(module, exports, __webpack_require__) { + exports.f = __webpack_require__(25); + + /***/ + }, + /* 27 */ + /***/ function(module, exports, __webpack_require__) { + var global = __webpack_require__(4), + core = __webpack_require__(9), + LIBRARY = __webpack_require__(28), + wksExt = __webpack_require__(26), + defineProperty = __webpack_require__(11).f; + module.exports = function(name) { + var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); + if (name.charAt(0) != '_' && !(name in $Symbol)) + defineProperty($Symbol, name, { value: wksExt.f(name) }); + }; + + /***/ + }, + /* 28 */ + /***/ function(module, exports) { + module.exports = false; + + /***/ + }, + /* 29 */ + /***/ function(module, exports, __webpack_require__) { + var getKeys = __webpack_require__(30), + toIObject = __webpack_require__(32); + module.exports = function(object, el) { + var O = toIObject(object), + keys = getKeys(O), + length = keys.length, + index = 0, + key; + while (length > index) if (O[(key = keys[index++])] === el) return key; + }; + + /***/ + }, + /* 30 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.2.14 / 15.2.3.14 Object.keys(O) + var $keys = __webpack_require__(31), + enumBugKeys = __webpack_require__(41); + + module.exports = + Object.keys || + function keys(O) { + return $keys(O, enumBugKeys); + }; + + /***/ + }, + /* 31 */ + /***/ function(module, exports, __webpack_require__) { + var has = __webpack_require__(5), + toIObject = __webpack_require__(32), + arrayIndexOf = __webpack_require__(36)(false), + IE_PROTO = __webpack_require__(40)('IE_PROTO'); + + module.exports = function(object, names) { + var O = toIObject(object), + i = 0, + result = [], + key; + for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); + // Don't enum bug & hidden keys + while (names.length > i) + if (has(O, (key = names[i++]))) { + ~arrayIndexOf(result, key) || result.push(key); + } + return result; + }; + + /***/ + }, + /* 32 */ + /***/ function(module, exports, __webpack_require__) { + // to indexed object, toObject with fallback for non-array-like ES3 strings + var IObject = __webpack_require__(33), + defined = __webpack_require__(35); + module.exports = function(it) { + return IObject(defined(it)); + }; + + /***/ + }, + /* 33 */ + /***/ function(module, exports, __webpack_require__) { + // fallback for non-array-like ES3 and non-enumerable old V8 strings + var cof = __webpack_require__(34); + module.exports = Object('z').propertyIsEnumerable(0) + ? Object + : function(it) { + return cof(it) == 'String' ? it.split('') : Object(it); + }; + + /***/ + }, + /* 34 */ + /***/ function(module, exports) { + var toString = {}.toString; + + module.exports = function(it) { + return toString.call(it).slice(8, -1); + }; + + /***/ + }, + /* 35 */ + /***/ function(module, exports) { + // 7.2.1 RequireObjectCoercible(argument) + module.exports = function(it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; + }; + + /***/ + }, + /* 36 */ + /***/ function(module, exports, __webpack_require__) { + // false -> Array#indexOf + // true -> Array#includes + var toIObject = __webpack_require__(32), + toLength = __webpack_require__(37), + toIndex = __webpack_require__(39); + module.exports = function(IS_INCLUDES) { + return function($this, el, fromIndex) { + var O = toIObject($this), + length = toLength(O.length), + index = toIndex(fromIndex, length), + value; + // Array#includes uses SameValueZero equality algorithm + if (IS_INCLUDES && el != el) + while (length > index) { + value = O[index++]; + if (value != value) return true; + // Array#toIndex ignores holes, Array#includes - not + } + else + for (; length > index; index++) + if (IS_INCLUDES || index in O) { + if (O[index] === el) return IS_INCLUDES || index || 0; + } + return !IS_INCLUDES && -1; + }; + }; + + /***/ + }, + /* 37 */ + /***/ function(module, exports, __webpack_require__) { + // 7.1.15 ToLength + var toInteger = __webpack_require__(38), + min = Math.min; + module.exports = function(it) { + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 + }; + + /***/ + }, + /* 38 */ + /***/ function(module, exports) { + // 7.1.4 ToInteger + var ceil = Math.ceil, + floor = Math.floor; + module.exports = function(it) { + return isNaN((it = +it)) ? 0 : (it > 0 ? floor : ceil)(it); + }; + + /***/ + }, + /* 39 */ + /***/ function(module, exports, __webpack_require__) { + var toInteger = __webpack_require__(38), + max = Math.max, + min = Math.min; + module.exports = function(index, length) { + index = toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); + }; + + /***/ + }, + /* 40 */ + /***/ function(module, exports, __webpack_require__) { + var shared = __webpack_require__(23)('keys'), + uid = __webpack_require__(19); + module.exports = function(key) { + return shared[key] || (shared[key] = uid(key)); + }; + + /***/ + }, + /* 41 */ + /***/ function(module, exports) { + // IE 8- don't enum bug keys + module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split( + ',' + ); + + /***/ + }, + /* 42 */ + /***/ function(module, exports, __webpack_require__) { + // all enumerable object keys, includes symbols + var getKeys = __webpack_require__(30), + gOPS = __webpack_require__(43), + pIE = __webpack_require__(44); + module.exports = function(it) { + var result = getKeys(it), + getSymbols = gOPS.f; + if (getSymbols) { + var symbols = getSymbols(it), + isEnum = pIE.f, + i = 0, + key; + while (symbols.length > i) + if (isEnum.call(it, (key = symbols[i++]))) result.push(key); + } + return result; + }; + + /***/ + }, + /* 43 */ + /***/ function(module, exports) { + exports.f = Object.getOwnPropertySymbols; + + /***/ + }, + /* 44 */ + /***/ function(module, exports) { + exports.f = {}.propertyIsEnumerable; + + /***/ + }, + /* 45 */ + /***/ function(module, exports, __webpack_require__) { + // 7.2.2 IsArray(argument) + var cof = __webpack_require__(34); + module.exports = + Array.isArray || + function isArray(arg) { + return cof(arg) == 'Array'; + }; + + /***/ + }, + /* 46 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) + var anObject = __webpack_require__(12), + dPs = __webpack_require__(47), + enumBugKeys = __webpack_require__(41), + IE_PROTO = __webpack_require__(40)('IE_PROTO'), + Empty = function() { + /* empty */ + }, + PROTOTYPE = 'prototype'; + + // Create object with fake `null` prototype: use iframe Object with cleared prototype + var createDict = function() { + // Thrash, waste and sodomy: IE GC bug + var iframe = __webpack_require__(15)('iframe'), + i = enumBugKeys.length, + lt = '<', + gt = '>', + iframeDocument; + iframe.style.display = 'none'; + __webpack_require__(48).appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write( + lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt + ); + iframeDocument.close(); + createDict = iframeDocument.F; + while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; + return createDict(); + }; + + module.exports = + Object.create || + function create(O, Properties) { + var result; + if (O !== null) { + Empty[PROTOTYPE] = anObject(O); + result = new Empty(); + Empty[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = createDict(); + return Properties === undefined ? result : dPs(result, Properties); + }; + + /***/ + }, + /* 47 */ + /***/ function(module, exports, __webpack_require__) { + var dP = __webpack_require__(11), + anObject = __webpack_require__(12), + getKeys = __webpack_require__(30); + + module.exports = __webpack_require__(6) + ? Object.defineProperties + : function defineProperties(O, Properties) { + anObject(O); + var keys = getKeys(Properties), + length = keys.length, + i = 0, + P; + while (length > i) dP.f(O, (P = keys[i++]), Properties[P]); + return O; + }; + + /***/ + }, + /* 48 */ + /***/ function(module, exports, __webpack_require__) { + module.exports = __webpack_require__(4).document && document.documentElement; + + /***/ + }, + /* 49 */ + /***/ function(module, exports, __webpack_require__) { + // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window + var toIObject = __webpack_require__(32), + gOPN = __webpack_require__(50).f, + toString = {}.toString; + + var windowNames = + typeof window == 'object' && window && Object.getOwnPropertyNames + ? Object.getOwnPropertyNames(window) + : []; + + var getWindowNames = function(it) { + try { + return gOPN(it); + } catch (e) { + return windowNames.slice(); + } + }; + + module.exports.f = function getOwnPropertyNames(it) { + return windowNames && toString.call(it) == '[object Window]' + ? getWindowNames(it) + : gOPN(toIObject(it)); + }; + + /***/ + }, + /* 50 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) + var $keys = __webpack_require__(31), + hiddenKeys = __webpack_require__(41).concat('length', 'prototype'); + + exports.f = + Object.getOwnPropertyNames || + function getOwnPropertyNames(O) { + return $keys(O, hiddenKeys); + }; + + /***/ + }, + /* 51 */ + /***/ function(module, exports, __webpack_require__) { + var pIE = __webpack_require__(44), + createDesc = __webpack_require__(17), + toIObject = __webpack_require__(32), + toPrimitive = __webpack_require__(16), + has = __webpack_require__(5), + IE8_DOM_DEFINE = __webpack_require__(14), + gOPD = Object.getOwnPropertyDescriptor; + + exports.f = __webpack_require__(6) + ? gOPD + : function getOwnPropertyDescriptor(O, P) { + O = toIObject(O); + P = toPrimitive(P, true); + if (IE8_DOM_DEFINE) + try { + return gOPD(O, P); + } catch (e) { + /* empty */ + } + if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); + }; + + /***/ + }, + /* 52 */ + /***/ function(module, exports, __webpack_require__) { + var $export = __webpack_require__(8); + // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) + $export($export.S, 'Object', { create: __webpack_require__(46) }); + + /***/ + }, + /* 53 */ + /***/ function(module, exports, __webpack_require__) { + var $export = __webpack_require__(8); + // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) + $export($export.S + $export.F * !__webpack_require__(6), 'Object', { + defineProperty: __webpack_require__(11).f + }); + + /***/ + }, + /* 54 */ + /***/ function(module, exports, __webpack_require__) { + var $export = __webpack_require__(8); + // 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) + $export($export.S + $export.F * !__webpack_require__(6), 'Object', { + defineProperties: __webpack_require__(47) + }); + + /***/ + }, + /* 55 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) + var toIObject = __webpack_require__(32), + $getOwnPropertyDescriptor = __webpack_require__(51).f; + + __webpack_require__(56)('getOwnPropertyDescriptor', function() { + return function getOwnPropertyDescriptor(it, key) { + return $getOwnPropertyDescriptor(toIObject(it), key); + }; + }); + + /***/ + }, + /* 56 */ + /***/ function(module, exports, __webpack_require__) { + // most Object methods by ES6 should accept primitives + var $export = __webpack_require__(8), + core = __webpack_require__(9), + fails = __webpack_require__(7); + module.exports = function(KEY, exec) { + var fn = (core.Object || {})[KEY] || Object[KEY], + exp = {}; + exp[KEY] = exec(fn); + $export( + $export.S + + $export.F * + fails(function() { + fn(1); + }), + 'Object', + exp + ); + }; + + /***/ + }, + /* 57 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.2.9 Object.getPrototypeOf(O) + var toObject = __webpack_require__(58), + $getPrototypeOf = __webpack_require__(59); + + __webpack_require__(56)('getPrototypeOf', function() { + return function getPrototypeOf(it) { + return $getPrototypeOf(toObject(it)); + }; + }); + + /***/ + }, + /* 58 */ + /***/ function(module, exports, __webpack_require__) { + // 7.1.13 ToObject(argument) + var defined = __webpack_require__(35); + module.exports = function(it) { + return Object(defined(it)); + }; + + /***/ + }, + /* 59 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) + var has = __webpack_require__(5), + toObject = __webpack_require__(58), + IE_PROTO = __webpack_require__(40)('IE_PROTO'), + ObjectProto = Object.prototype; + + module.exports = + Object.getPrototypeOf || + function(O) { + O = toObject(O); + if (has(O, IE_PROTO)) return O[IE_PROTO]; + if (typeof O.constructor == 'function' && O instanceof O.constructor) { + return O.constructor.prototype; + } + return O instanceof Object ? ObjectProto : null; + }; + + /***/ + }, + /* 60 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.2.14 Object.keys(O) + var toObject = __webpack_require__(58), + $keys = __webpack_require__(30); + + __webpack_require__(56)('keys', function() { + return function keys(it) { + return $keys(toObject(it)); + }; + }); + + /***/ + }, + /* 61 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.2.7 Object.getOwnPropertyNames(O) + __webpack_require__(56)('getOwnPropertyNames', function() { + return __webpack_require__(49).f; + }); + + /***/ + }, + /* 62 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.2.5 Object.freeze(O) + var isObject = __webpack_require__(13), + meta = __webpack_require__(22).onFreeze; + + __webpack_require__(56)('freeze', function($freeze) { + return function freeze(it) { + return $freeze && isObject(it) ? $freeze(meta(it)) : it; + }; + }); + + /***/ + }, + /* 63 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.2.17 Object.seal(O) + var isObject = __webpack_require__(13), + meta = __webpack_require__(22).onFreeze; + + __webpack_require__(56)('seal', function($seal) { + return function seal(it) { + return $seal && isObject(it) ? $seal(meta(it)) : it; + }; + }); + + /***/ + }, + /* 64 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.2.15 Object.preventExtensions(O) + var isObject = __webpack_require__(13), + meta = __webpack_require__(22).onFreeze; + + __webpack_require__(56)('preventExtensions', function($preventExtensions) { + return function preventExtensions(it) { + return $preventExtensions && isObject(it) + ? $preventExtensions(meta(it)) + : it; + }; + }); + + /***/ + }, + /* 65 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.2.12 Object.isFrozen(O) + var isObject = __webpack_require__(13); + + __webpack_require__(56)('isFrozen', function($isFrozen) { + return function isFrozen(it) { + return isObject(it) ? ($isFrozen ? $isFrozen(it) : false) : true; + }; + }); + + /***/ + }, + /* 66 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.2.13 Object.isSealed(O) + var isObject = __webpack_require__(13); + + __webpack_require__(56)('isSealed', function($isSealed) { + return function isSealed(it) { + return isObject(it) ? ($isSealed ? $isSealed(it) : false) : true; + }; + }); + + /***/ + }, + /* 67 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.2.11 Object.isExtensible(O) + var isObject = __webpack_require__(13); + + __webpack_require__(56)('isExtensible', function($isExtensible) { + return function isExtensible(it) { + return isObject(it) ? ($isExtensible ? $isExtensible(it) : true) : false; + }; + }); + + /***/ + }, + /* 68 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.3.1 Object.assign(target, source) + var $export = __webpack_require__(8); + + $export($export.S + $export.F, 'Object', { assign: __webpack_require__(69) }); + + /***/ + }, + /* 69 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // 19.1.2.1 Object.assign(target, source, ...) + var getKeys = __webpack_require__(30), + gOPS = __webpack_require__(43), + pIE = __webpack_require__(44), + toObject = __webpack_require__(58), + IObject = __webpack_require__(33), + $assign = Object.assign; + + // should work with symbols and should have deterministic property order (V8 bug) + module.exports = + !$assign || + __webpack_require__(7)(function() { + var A = {}, + B = {}, + S = Symbol(), + K = 'abcdefghijklmnopqrst'; + A[S] = 7; + K.split('').forEach(function(k) { + B[k] = k; + }); + return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; + }) + ? function assign(target, source) { + // eslint-disable-line no-unused-vars + var T = toObject(target), + aLen = arguments.length, + index = 1, + getSymbols = gOPS.f, + isEnum = pIE.f; + while (aLen > index) { + var S = IObject(arguments[index++]), + keys = getSymbols + ? getKeys(S).concat(getSymbols(S)) + : getKeys(S), + length = keys.length, + j = 0, + key; + while (length > j) + if (isEnum.call(S, (key = keys[j++]))) T[key] = S[key]; + } + return T; + } + : $assign; + + /***/ + }, + /* 70 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.3.10 Object.is(value1, value2) + var $export = __webpack_require__(8); + $export($export.S, 'Object', { is: __webpack_require__(71) }); + + /***/ + }, + /* 71 */ + /***/ function(module, exports) { + // 7.2.9 SameValue(x, y) + module.exports = + Object.is || + function is(x, y) { + return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; + }; + + /***/ + }, + /* 72 */ + /***/ function(module, exports, __webpack_require__) { + // 19.1.3.19 Object.setPrototypeOf(O, proto) + var $export = __webpack_require__(8); + $export($export.S, 'Object', { setPrototypeOf: __webpack_require__(73).set }); + + /***/ + }, + /* 73 */ + /***/ function(module, exports, __webpack_require__) { + // Works with __proto__ only. Old v8 can't work with null proto objects. + /* eslint-disable no-proto */ + var isObject = __webpack_require__(13), + anObject = __webpack_require__(12); + var check = function(O, proto) { + anObject(O); + if (!isObject(proto) && proto !== null) + throw TypeError(proto + ": can't set as prototype!"); + }; + module.exports = { + set: + Object.setPrototypeOf || + ('__proto__' in {} // eslint-disable-line + ? (function(test, buggy, set) { + try { + set = __webpack_require__(20)( + Function.call, + __webpack_require__(51).f(Object.prototype, '__proto__') + .set, + 2 + ); + set(test, []); + buggy = !(test instanceof Array); + } catch (e) { + buggy = true; + } + return function setPrototypeOf(O, proto) { + check(O, proto); + if (buggy) O.__proto__ = proto; + else set(O, proto); + return O; + }; + })({}, false) + : undefined), + check: check + }; + + /***/ + }, + /* 74 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // 19.1.3.6 Object.prototype.toString() + var classof = __webpack_require__(75), + test = {}; + test[__webpack_require__(25)('toStringTag')] = 'z'; + if (test + '' != '[object z]') { + __webpack_require__(18)( + Object.prototype, + 'toString', + function toString() { + return '[object ' + classof(this) + ']'; + }, + true + ); + } + + /***/ + }, + /* 75 */ + /***/ function(module, exports, __webpack_require__) { + // getting tag from 19.1.3.6 Object.prototype.toString() + var cof = __webpack_require__(34), + TAG = __webpack_require__(25)('toStringTag'), + // ES3 wrong here + ARG = + cof( + (function() { + return arguments; + })() + ) == 'Arguments'; + + // fallback for IE11 Script Access Denied error + var tryGet = function(it, key) { + try { + return it[key]; + } catch (e) { + /* empty */ + } + }; + + module.exports = function(it) { + var O, T, B; + return it === undefined + ? 'Undefined' + : it === null + ? 'Null' + : // @@toStringTag case + typeof (T = tryGet((O = Object(it)), TAG)) == 'string' + ? T + : // builtinTag case + ARG + ? cof(O) + : // ES3 arguments fallback + (B = cof(O)) == 'Object' && typeof O.callee == 'function' + ? 'Arguments' + : B; + }; + + /***/ + }, + /* 76 */ + /***/ function(module, exports, __webpack_require__) { + // 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...) + var $export = __webpack_require__(8); + + $export($export.P, 'Function', { bind: __webpack_require__(77) }); + + /***/ + }, + /* 77 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var aFunction = __webpack_require__(21), + isObject = __webpack_require__(13), + invoke = __webpack_require__(78), + arraySlice = [].slice, + factories = {}; + + var construct = function(F, len, args) { + if (!(len in factories)) { + for (var n = [], i = 0; i < len; i++) n[i] = 'a[' + i + ']'; + factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')'); + } + return factories[len](F, args); + }; + + module.exports = + Function.bind || + function bind(that /*, args... */) { + var fn = aFunction(this), + partArgs = arraySlice.call(arguments, 1); + var bound = function(/* args... */) { + var args = partArgs.concat(arraySlice.call(arguments)); + return this instanceof bound + ? construct(fn, args.length, args) + : invoke(fn, args, that); + }; + if (isObject(fn.prototype)) bound.prototype = fn.prototype; + return bound; + }; + + /***/ + }, + /* 78 */ + /***/ function(module, exports) { + // fast apply, http://jsperf.lnkit.com/fast-apply/5 + module.exports = function(fn, args, that) { + var un = that === undefined; + switch (args.length) { + case 0: + return un ? fn() : fn.call(that); + case 1: + return un ? fn(args[0]) : fn.call(that, args[0]); + case 2: + return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]); + case 3: + return un + ? fn(args[0], args[1], args[2]) + : fn.call(that, args[0], args[1], args[2]); + case 4: + return un + ? fn(args[0], args[1], args[2], args[3]) + : fn.call(that, args[0], args[1], args[2], args[3]); + } + return fn.apply(that, args); + }; + + /***/ + }, + /* 79 */ + /***/ function(module, exports, __webpack_require__) { + var dP = __webpack_require__(11).f, + createDesc = __webpack_require__(17), + has = __webpack_require__(5), + FProto = Function.prototype, + nameRE = /^\s*function ([^ (]*)/, + NAME = 'name'; + + var isExtensible = + Object.isExtensible || + function() { + return true; + }; + + // 19.2.4.2 name + NAME in FProto || + (__webpack_require__(6) && + dP(FProto, NAME, { + configurable: true, + get: function() { + try { + var that = this, + name = ('' + that).match(nameRE)[1]; + has(that, NAME) || + !isExtensible(that) || + dP(that, NAME, createDesc(5, name)); + return name; + } catch (e) { + return ''; + } + } + })); + + /***/ + }, + /* 80 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var isObject = __webpack_require__(13), + getPrototypeOf = __webpack_require__(59), + HAS_INSTANCE = __webpack_require__(25)('hasInstance'), + FunctionProto = Function.prototype; + // 19.2.3.6 Function.prototype[@@hasInstance](V) + if (!(HAS_INSTANCE in FunctionProto)) + __webpack_require__(11).f(FunctionProto, HAS_INSTANCE, { + value: function(O) { + if (typeof this != 'function' || !isObject(O)) return false; + if (!isObject(this.prototype)) return O instanceof this; + // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: + while ((O = getPrototypeOf(O))) if (this.prototype === O) return true; + return false; + } + }); + + /***/ + }, + /* 81 */ + /***/ function(module, exports, __webpack_require__) { + var $export = __webpack_require__(8), + $parseInt = __webpack_require__(82); + // 18.2.5 parseInt(string, radix) + $export($export.G + $export.F * (parseInt != $parseInt), { parseInt: $parseInt }); + + /***/ + }, + /* 82 */ + /***/ function(module, exports, __webpack_require__) { + var $parseInt = __webpack_require__(4).parseInt, + $trim = __webpack_require__(83).trim, + ws = __webpack_require__(84), + hex = /^[\-+]?0[xX]/; + + module.exports = + $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 + ? function parseInt(str, radix) { + var string = $trim(String(str), 3); + return $parseInt(string, radix >>> 0 || (hex.test(string) ? 16 : 10)); + } + : $parseInt; + + /***/ + }, + /* 83 */ + /***/ function(module, exports, __webpack_require__) { + var $export = __webpack_require__(8), + defined = __webpack_require__(35), + fails = __webpack_require__(7), + spaces = __webpack_require__(84), + space = '[' + spaces + ']', + non = '\u200b\u0085', + ltrim = RegExp('^' + space + space + '*'), + rtrim = RegExp(space + space + '*$'); + + var exporter = function(KEY, exec, ALIAS) { + var exp = {}; + var FORCE = fails(function() { + return !!spaces[KEY]() || non[KEY]() != non; + }); + var fn = (exp[KEY] = FORCE ? exec(trim) : spaces[KEY]); + if (ALIAS) exp[ALIAS] = fn; + $export($export.P + $export.F * FORCE, 'String', exp); + }; + + // 1 -> String#trimLeft + // 2 -> String#trimRight + // 3 -> String#trim + var trim = (exporter.trim = function(string, TYPE) { + string = String(defined(string)); + if (TYPE & 1) string = string.replace(ltrim, ''); + if (TYPE & 2) string = string.replace(rtrim, ''); + return string; + }); + + module.exports = exporter; + + /***/ + }, + /* 84 */ + /***/ function(module, exports) { + module.exports = + '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; + + /***/ + }, + /* 85 */ + /***/ function(module, exports, __webpack_require__) { + var $export = __webpack_require__(8), + $parseFloat = __webpack_require__(86); + // 18.2.4 parseFloat(string) + $export($export.G + $export.F * (parseFloat != $parseFloat), { + parseFloat: $parseFloat + }); + + /***/ + }, + /* 86 */ + /***/ function(module, exports, __webpack_require__) { + var $parseFloat = __webpack_require__(4).parseFloat, + $trim = __webpack_require__(83).trim; + + module.exports = + 1 / $parseFloat(__webpack_require__(84) + '-0') !== -Infinity + ? function parseFloat(str) { + var string = $trim(String(str), 3), + result = $parseFloat(string); + return result === 0 && string.charAt(0) == '-' ? -0 : result; + } + : $parseFloat; + + /***/ + }, + /* 87 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var global = __webpack_require__(4), + has = __webpack_require__(5), + cof = __webpack_require__(34), + inheritIfRequired = __webpack_require__(88), + toPrimitive = __webpack_require__(16), + fails = __webpack_require__(7), + gOPN = __webpack_require__(50).f, + gOPD = __webpack_require__(51).f, + dP = __webpack_require__(11).f, + $trim = __webpack_require__(83).trim, + NUMBER = 'Number', + $Number = global[NUMBER], + Base = $Number, + proto = $Number.prototype, + // Opera ~12 has broken Object#toString + BROKEN_COF = cof(__webpack_require__(46)(proto)) == NUMBER, + TRIM = 'trim' in String.prototype; + + // 7.1.3 ToNumber(argument) + var toNumber = function(argument) { + var it = toPrimitive(argument, false); + if (typeof it == 'string' && it.length > 2) { + it = TRIM ? it.trim() : $trim(it, 3); + var first = it.charCodeAt(0), + third, + radix, + maxCode; + if (first === 43 || first === 45) { + third = it.charCodeAt(2); + if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix + } else if (first === 48) { + switch (it.charCodeAt(1)) { + case 66: + case 98: + radix = 2; + maxCode = 49; + break; // fast equal /^0b[01]+$/i + case 79: + case 111: + radix = 8; + maxCode = 55; + break; // fast equal /^0o[0-7]+$/i + default: + return +it; + } + for ( + var digits = it.slice(2), i = 0, l = digits.length, code; + i < l; + i++ + ) { + code = digits.charCodeAt(i); + // parseInt parses a string to a first unavailable symbol + // but ToNumber should return NaN if a string contains unavailable symbols + if (code < 48 || code > maxCode) return NaN; + } + return parseInt(digits, radix); + } + } + return +it; + }; + + if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) { + $Number = function Number(value) { + var it = arguments.length < 1 ? 0 : value, + that = this; + return that instanceof $Number && + // check on 1..constructor(foo) case + (BROKEN_COF + ? fails(function() { + proto.valueOf.call(that); + }) + : cof(that) != NUMBER) + ? inheritIfRequired(new Base(toNumber(it)), that, $Number) + : toNumber(it); + }; + for ( + var keys = __webpack_require__(6) + ? gOPN(Base) + : // ES3: + ('MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + + // ES6 (in case, if modules with ES6 Number statics required before): + 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' + ).split(','), + j = 0, + key; + keys.length > j; + j++ + ) { + if (has(Base, (key = keys[j])) && !has($Number, key)) { + dP($Number, key, gOPD(Base, key)); + } + } + $Number.prototype = proto; + proto.constructor = $Number; + __webpack_require__(18)(global, NUMBER, $Number); + } + + /***/ + }, + /* 88 */ + /***/ function(module, exports, __webpack_require__) { + var isObject = __webpack_require__(13), + setPrototypeOf = __webpack_require__(73).set; + module.exports = function(that, target, C) { + var P, + S = target.constructor; + if ( + S !== C && + typeof S == 'function' && + (P = S.prototype) !== C.prototype && + isObject(P) && + setPrototypeOf + ) { + setPrototypeOf(that, P); + } + return that; + }; + + /***/ + }, + /* 89 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + toInteger = __webpack_require__(38), + aNumberValue = __webpack_require__(90), + repeat = __webpack_require__(91), + $toFixed = (1).toFixed, + floor = Math.floor, + data = [0, 0, 0, 0, 0, 0], + ERROR = 'Number.toFixed: incorrect invocation!', + ZERO = '0'; + + var multiply = function(n, c) { + var i = -1, + c2 = c; + while (++i < 6) { + c2 += n * data[i]; + data[i] = c2 % 1e7; + c2 = floor(c2 / 1e7); + } + }; + var divide = function(n) { + var i = 6, + c = 0; + while (--i >= 0) { + c += data[i]; + data[i] = floor(c / n); + c = (c % n) * 1e7; + } + }; + var numToString = function() { + var i = 6, + s = ''; + while (--i >= 0) { + if (s !== '' || i === 0 || data[i] !== 0) { + var t = String(data[i]); + s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t; + } + } + return s; + }; + var pow = function(x, n, acc) { + return n === 0 + ? acc + : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc); + }; + var log = function(x) { + var n = 0, + x2 = x; + while (x2 >= 4096) { + n += 12; + x2 /= 4096; + } + while (x2 >= 2) { + n += 1; + x2 /= 2; + } + return n; + }; + + $export( + $export.P + + $export.F * + ((!!$toFixed && + ((0.00008).toFixed(3) !== '0.000' || + (0.9).toFixed(0) !== '1' || + (1.255).toFixed(2) !== '1.25' || + (1000000000000000128).toFixed(0) !== '1000000000000000128')) || + !__webpack_require__(7)(function() { + // V8 ~ Android 4.3- + $toFixed.call({}); + })), + 'Number', + { + toFixed: function toFixed(fractionDigits) { + var x = aNumberValue(this, ERROR), + f = toInteger(fractionDigits), + s = '', + m = ZERO, + e, + z, + j, + k; + if (f < 0 || f > 20) throw RangeError(ERROR); + if (x != x) return 'NaN'; + if (x <= -1e21 || x >= 1e21) return String(x); + if (x < 0) { + s = '-'; + x = -x; + } + if (x > 1e-21) { + e = log(x * pow(2, 69, 1)) - 69; + z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1); + z *= 0x10000000000000; + e = 52 - e; + if (e > 0) { + multiply(0, z); + j = f; + while (j >= 7) { + multiply(1e7, 0); + j -= 7; + } + multiply(pow(10, j, 1), 0); + j = e - 1; + while (j >= 23) { + divide(1 << 23); + j -= 23; + } + divide(1 << j); + multiply(1, 1); + divide(2); + m = numToString(); + } else { + multiply(0, z); + multiply(1 << -e, 0); + m = numToString() + repeat.call(ZERO, f); + } + } + if (f > 0) { + k = m.length; + m = + s + + (k <= f + ? '0.' + repeat.call(ZERO, f - k) + m + : m.slice(0, k - f) + '.' + m.slice(k - f)); + } else { + m = s + m; + } + return m; + } + } + ); + + /***/ + }, + /* 90 */ + /***/ function(module, exports, __webpack_require__) { + var cof = __webpack_require__(34); + module.exports = function(it, msg) { + if (typeof it != 'number' && cof(it) != 'Number') throw TypeError(msg); + return +it; + }; + + /***/ + }, + /* 91 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var toInteger = __webpack_require__(38), + defined = __webpack_require__(35); + + module.exports = function repeat(count) { + var str = String(defined(this)), + res = '', + n = toInteger(count); + if (n < 0 || n == Infinity) throw RangeError("Count can't be negative"); + for (; n > 0; (n >>>= 1) && (str += str)) if (n & 1) res += str; + return res; + }; + + /***/ + }, + /* 92 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + $fails = __webpack_require__(7), + aNumberValue = __webpack_require__(90), + $toPrecision = (1).toPrecision; + + $export( + $export.P + + $export.F * + ($fails(function() { + // IE7- + return $toPrecision.call(1, undefined) !== '1'; + }) || + !$fails(function() { + // V8 ~ Android 4.3- + $toPrecision.call({}); + })), + 'Number', + { + toPrecision: function toPrecision(precision) { + var that = aNumberValue( + this, + 'Number#toPrecision: incorrect invocation!' + ); + return precision === undefined + ? $toPrecision.call(that) + : $toPrecision.call(that, precision); + } + } + ); + + /***/ + }, + /* 93 */ + /***/ function(module, exports, __webpack_require__) { + // 20.1.2.1 Number.EPSILON + var $export = __webpack_require__(8); + + $export($export.S, 'Number', { EPSILON: Math.pow(2, -52) }); + + /***/ + }, + /* 94 */ + /***/ function(module, exports, __webpack_require__) { + // 20.1.2.2 Number.isFinite(number) + var $export = __webpack_require__(8), + _isFinite = __webpack_require__(4).isFinite; + + $export($export.S, 'Number', { + isFinite: function isFinite(it) { + return typeof it == 'number' && _isFinite(it); + } + }); + + /***/ + }, + /* 95 */ + /***/ function(module, exports, __webpack_require__) { + // 20.1.2.3 Number.isInteger(number) + var $export = __webpack_require__(8); + + $export($export.S, 'Number', { isInteger: __webpack_require__(96) }); + + /***/ + }, + /* 96 */ + /***/ function(module, exports, __webpack_require__) { + // 20.1.2.3 Number.isInteger(number) + var isObject = __webpack_require__(13), + floor = Math.floor; + module.exports = function isInteger(it) { + return !isObject(it) && isFinite(it) && floor(it) === it; + }; + + /***/ + }, + /* 97 */ + /***/ function(module, exports, __webpack_require__) { + // 20.1.2.4 Number.isNaN(number) + var $export = __webpack_require__(8); + + $export($export.S, 'Number', { + isNaN: function isNaN(number) { + return number != number; + } + }); + + /***/ + }, + /* 98 */ + /***/ function(module, exports, __webpack_require__) { + // 20.1.2.5 Number.isSafeInteger(number) + var $export = __webpack_require__(8), + isInteger = __webpack_require__(96), + abs = Math.abs; + + $export($export.S, 'Number', { + isSafeInteger: function isSafeInteger(number) { + return isInteger(number) && abs(number) <= 0x1fffffffffffff; + } + }); + + /***/ + }, + /* 99 */ + /***/ function(module, exports, __webpack_require__) { + // 20.1.2.6 Number.MAX_SAFE_INTEGER + var $export = __webpack_require__(8); + + $export($export.S, 'Number', { MAX_SAFE_INTEGER: 0x1fffffffffffff }); + + /***/ + }, + /* 100 */ + /***/ function(module, exports, __webpack_require__) { + // 20.1.2.10 Number.MIN_SAFE_INTEGER + var $export = __webpack_require__(8); + + $export($export.S, 'Number', { MIN_SAFE_INTEGER: -0x1fffffffffffff }); + + /***/ + }, + /* 101 */ + /***/ function(module, exports, __webpack_require__) { + var $export = __webpack_require__(8), + $parseFloat = __webpack_require__(86); + // 20.1.2.12 Number.parseFloat(string) + $export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', { + parseFloat: $parseFloat + }); + + /***/ + }, + /* 102 */ + /***/ function(module, exports, __webpack_require__) { + var $export = __webpack_require__(8), + $parseInt = __webpack_require__(82); + // 20.1.2.13 Number.parseInt(string, radix) + $export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', { + parseInt: $parseInt + }); + + /***/ + }, + /* 103 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.3 Math.acosh(x) + var $export = __webpack_require__(8), + log1p = __webpack_require__(104), + sqrt = Math.sqrt, + $acosh = Math.acosh; + + $export( + $export.S + + $export.F * + !( + $acosh && + // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 + Math.floor($acosh(Number.MAX_VALUE)) == 710 && + // Tor Browser bug: Math.acosh(Infinity) -> NaN + $acosh(Infinity) == Infinity + ), + 'Math', + { + acosh: function acosh(x) { + return (x = +x) < 1 + ? NaN + : x > 94906265.62425156 + ? Math.log(x) + Math.LN2 + : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1)); + } + } + ); + + /***/ + }, + /* 104 */ + /***/ function(module, exports) { + // 20.2.2.20 Math.log1p(x) + module.exports = + Math.log1p || + function log1p(x) { + return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x); + }; + + /***/ + }, + /* 105 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.5 Math.asinh(x) + var $export = __webpack_require__(8), + $asinh = Math.asinh; + + function asinh(x) { + return !isFinite((x = +x)) || x == 0 + ? x + : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1)); + } + + // Tor Browser bug: Math.asinh(0) -> -0 + $export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', { + asinh: asinh + }); + + /***/ + }, + /* 106 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.7 Math.atanh(x) + var $export = __webpack_require__(8), + $atanh = Math.atanh; + + // Tor Browser bug: Math.atanh(-0) -> 0 + $export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', { + atanh: function atanh(x) { + return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2; + } + }); + + /***/ + }, + /* 107 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.9 Math.cbrt(x) + var $export = __webpack_require__(8), + sign = __webpack_require__(108); + + $export($export.S, 'Math', { + cbrt: function cbrt(x) { + return sign((x = +x)) * Math.pow(Math.abs(x), 1 / 3); + } + }); + + /***/ + }, + /* 108 */ + /***/ function(module, exports) { + // 20.2.2.28 Math.sign(x) + module.exports = + Math.sign || + function sign(x) { + return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; + }; + + /***/ + }, + /* 109 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.11 Math.clz32(x) + var $export = __webpack_require__(8); + + $export($export.S, 'Math', { + clz32: function clz32(x) { + return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32; + } + }); + + /***/ + }, + /* 110 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.12 Math.cosh(x) + var $export = __webpack_require__(8), + exp = Math.exp; + + $export($export.S, 'Math', { + cosh: function cosh(x) { + return (exp((x = +x)) + exp(-x)) / 2; + } + }); + + /***/ + }, + /* 111 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.14 Math.expm1(x) + var $export = __webpack_require__(8), + $expm1 = __webpack_require__(112); + + $export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', { expm1: $expm1 }); + + /***/ + }, + /* 112 */ + /***/ function(module, exports) { + // 20.2.2.14 Math.expm1(x) + var $expm1 = Math.expm1; + module.exports = + !$expm1 || + // Old FF bug + $expm1(10) > 22025.465794806719 || + $expm1(10) < 22025.4657948067165168 || + // Tor Browser bug + $expm1(-2e-17) != -2e-17 + ? function expm1(x) { + return (x = +x) == 0 + ? x + : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1; + } + : $expm1; + + /***/ + }, + /* 113 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.16 Math.fround(x) + var $export = __webpack_require__(8), + sign = __webpack_require__(108), + pow = Math.pow, + EPSILON = pow(2, -52), + EPSILON32 = pow(2, -23), + MAX32 = pow(2, 127) * (2 - EPSILON32), + MIN32 = pow(2, -126); + + var roundTiesToEven = function(n) { + return n + 1 / EPSILON - 1 / EPSILON; + }; + + $export($export.S, 'Math', { + fround: function fround(x) { + var $abs = Math.abs(x), + $sign = sign(x), + a, + result; + if ($abs < MIN32) + return ( + $sign * + roundTiesToEven($abs / MIN32 / EPSILON32) * + MIN32 * + EPSILON32 + ); + a = (1 + EPSILON32 / EPSILON) * $abs; + result = a - (a - $abs); + if (result > MAX32 || result != result) return $sign * Infinity; + return $sign * result; + } + }); + + /***/ + }, + /* 114 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.17 Math.hypot([value1[, value2[, … ]]]) + var $export = __webpack_require__(8), + abs = Math.abs; + + $export($export.S, 'Math', { + hypot: function hypot(value1, value2) { + // eslint-disable-line no-unused-vars + var sum = 0, + i = 0, + aLen = arguments.length, + larg = 0, + arg, + div; + while (i < aLen) { + arg = abs(arguments[i++]); + if (larg < arg) { + div = larg / arg; + sum = sum * div * div + 1; + larg = arg; + } else if (arg > 0) { + div = arg / larg; + sum += div * div; + } else sum += arg; + } + return larg === Infinity ? Infinity : larg * Math.sqrt(sum); + } + }); + + /***/ + }, + /* 115 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.18 Math.imul(x, y) + var $export = __webpack_require__(8), + $imul = Math.imul; + + // some WebKit versions fails with big numbers, some has wrong arity + $export( + $export.S + + $export.F * + __webpack_require__(7)(function() { + return $imul(0xffffffff, 5) != -5 || $imul.length != 2; + }), + 'Math', + { + imul: function imul(x, y) { + var UINT16 = 0xffff, + xn = +x, + yn = +y, + xl = UINT16 & xn, + yl = UINT16 & yn; + return ( + 0 | + (xl * yl + + ((((UINT16 & (xn >>> 16)) * yl + xl * (UINT16 & (yn >>> 16))) << + 16) >>> + 0)) + ); + } + } + ); + + /***/ + }, + /* 116 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.21 Math.log10(x) + var $export = __webpack_require__(8); + + $export($export.S, 'Math', { + log10: function log10(x) { + return Math.log(x) / Math.LN10; + } + }); + + /***/ + }, + /* 117 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.20 Math.log1p(x) + var $export = __webpack_require__(8); + + $export($export.S, 'Math', { log1p: __webpack_require__(104) }); + + /***/ + }, + /* 118 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.22 Math.log2(x) + var $export = __webpack_require__(8); + + $export($export.S, 'Math', { + log2: function log2(x) { + return Math.log(x) / Math.LN2; + } + }); + + /***/ + }, + /* 119 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.28 Math.sign(x) + var $export = __webpack_require__(8); + + $export($export.S, 'Math', { sign: __webpack_require__(108) }); + + /***/ + }, + /* 120 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.30 Math.sinh(x) + var $export = __webpack_require__(8), + expm1 = __webpack_require__(112), + exp = Math.exp; + + // V8 near Chromium 38 has a problem with very small numbers + $export( + $export.S + + $export.F * + __webpack_require__(7)(function() { + return !Math.sinh(-2e-17) != -2e-17; + }), + 'Math', + { + sinh: function sinh(x) { + return Math.abs((x = +x)) < 1 + ? (expm1(x) - expm1(-x)) / 2 + : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2); + } + } + ); + + /***/ + }, + /* 121 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.33 Math.tanh(x) + var $export = __webpack_require__(8), + expm1 = __webpack_require__(112), + exp = Math.exp; + + $export($export.S, 'Math', { + tanh: function tanh(x) { + var a = expm1((x = +x)), + b = expm1(-x); + return a == Infinity + ? 1 + : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); + } + }); + + /***/ + }, + /* 122 */ + /***/ function(module, exports, __webpack_require__) { + // 20.2.2.34 Math.trunc(x) + var $export = __webpack_require__(8); + + $export($export.S, 'Math', { + trunc: function trunc(it) { + return (it > 0 ? Math.floor : Math.ceil)(it); + } + }); + + /***/ + }, + /* 123 */ + /***/ function(module, exports, __webpack_require__) { + var $export = __webpack_require__(8), + toIndex = __webpack_require__(39), + fromCharCode = String.fromCharCode, + $fromCodePoint = String.fromCodePoint; + + // length should be 1, old FF problem + $export( + $export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), + 'String', + { + // 21.1.2.2 String.fromCodePoint(...codePoints) + fromCodePoint: function fromCodePoint(x) { + // eslint-disable-line no-unused-vars + var res = [], + aLen = arguments.length, + i = 0, + code; + while (aLen > i) { + code = +arguments[i++]; + if (toIndex(code, 0x10ffff) !== code) + throw RangeError(code + ' is not a valid code point'); + res.push( + code < 0x10000 + ? fromCharCode(code) + : fromCharCode( + ((code -= 0x10000) >> 10) + 0xd800, + code % 0x400 + 0xdc00 + ) + ); + } + return res.join(''); + } + } + ); + + /***/ + }, + /* 124 */ + /***/ function(module, exports, __webpack_require__) { + var $export = __webpack_require__(8), + toIObject = __webpack_require__(32), + toLength = __webpack_require__(37); + + $export($export.S, 'String', { + // 21.1.2.4 String.raw(callSite, ...substitutions) + raw: function raw(callSite) { + var tpl = toIObject(callSite.raw), + len = toLength(tpl.length), + aLen = arguments.length, + res = [], + i = 0; + while (len > i) { + res.push(String(tpl[i++])); + if (i < aLen) res.push(String(arguments[i])); + } + return res.join(''); + } + }); + + /***/ + }, + /* 125 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // 21.1.3.25 String.prototype.trim() + __webpack_require__(83)('trim', function($trim) { + return function trim() { + return $trim(this, 3); + }; + }); + + /***/ + }, + /* 126 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $at = __webpack_require__(127)(true); + + // 21.1.3.27 String.prototype[@@iterator]() + __webpack_require__(128)( + String, + 'String', + function(iterated) { + this._t = String(iterated); // target + this._i = 0; // next index + // 21.1.5.2.1 %StringIteratorPrototype%.next() + }, + function() { + var O = this._t, + index = this._i, + point; + if (index >= O.length) return { value: undefined, done: true }; + point = $at(O, index); + this._i += point.length; + return { value: point, done: false }; + } + ); + + /***/ + }, + /* 127 */ + /***/ function(module, exports, __webpack_require__) { + var toInteger = __webpack_require__(38), + defined = __webpack_require__(35); + // true -> String#at + // false -> String#codePointAt + module.exports = function(TO_STRING) { + return function(that, pos) { + var s = String(defined(that)), + i = toInteger(pos), + l = s.length, + a, + b; + if (i < 0 || i >= l) return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || + a > 0xdbff || + i + 1 === l || + (b = s.charCodeAt(i + 1)) < 0xdc00 || + b > 0xdfff + ? TO_STRING ? s.charAt(i) : a + : TO_STRING + ? s.slice(i, i + 2) + : ((a - 0xd800) << 10) + (b - 0xdc00) + 0x10000; + }; + }; + + /***/ + }, + /* 128 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var LIBRARY = __webpack_require__(28), + $export = __webpack_require__(8), + redefine = __webpack_require__(18), + hide = __webpack_require__(10), + has = __webpack_require__(5), + Iterators = __webpack_require__(129), + $iterCreate = __webpack_require__(130), + setToStringTag = __webpack_require__(24), + getPrototypeOf = __webpack_require__(59), + ITERATOR = __webpack_require__(25)('iterator'), + BUGGY = !([].keys && 'next' in [].keys()), // Safari has buggy iterators w/o `next` + FF_ITERATOR = '@@iterator', + KEYS = 'keys', + VALUES = 'values'; + + var returnThis = function() { + return this; + }; + + module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { + $iterCreate(Constructor, NAME, next); + var getMethod = function(kind) { + if (!BUGGY && kind in proto) return proto[kind]; + switch (kind) { + case KEYS: + return function keys() { + return new Constructor(this, kind); + }; + case VALUES: + return function values() { + return new Constructor(this, kind); + }; + } + return function entries() { + return new Constructor(this, kind); + }; + }; + var TAG = NAME + ' Iterator', + DEF_VALUES = DEFAULT == VALUES, + VALUES_BUG = false, + proto = Base.prototype, + $native = + proto[ITERATOR] || proto[FF_ITERATOR] || (DEFAULT && proto[DEFAULT]), + $default = $native || getMethod(DEFAULT), + $entries = DEFAULT + ? !DEF_VALUES ? $default : getMethod('entries') + : undefined, + $anyNative = NAME == 'Array' ? proto.entries || $native : $native, + methods, + key, + IteratorPrototype; + // Fix native + if ($anyNative) { + IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); + if (IteratorPrototype !== Object.prototype) { + // Set @@toStringTag to native iterators + setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) + hide(IteratorPrototype, ITERATOR, returnThis); + } + } + // fix Array#{values, @@iterator}.name in V8 / FF + if (DEF_VALUES && $native && $native.name !== VALUES) { + VALUES_BUG = true; + $default = function values() { + return $native.call(this); + }; + } + // Define iterator + if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { + hide(proto, ITERATOR, $default); + } + // Plug for library + Iterators[NAME] = $default; + Iterators[TAG] = returnThis; + if (DEFAULT) { + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if (FORCED) + for (key in methods) { + if (!(key in proto)) redefine(proto, key, methods[key]); + } + else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); + } + return methods; + }; + + /***/ + }, + /* 129 */ + /***/ function(module, exports) { + module.exports = {}; + + /***/ + }, + /* 130 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var create = __webpack_require__(46), + descriptor = __webpack_require__(17), + setToStringTag = __webpack_require__(24), + IteratorPrototype = {}; + + // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() + __webpack_require__(10)( + IteratorPrototype, + __webpack_require__(25)('iterator'), + function() { + return this; + } + ); + + module.exports = function(Constructor, NAME, next) { + Constructor.prototype = create(IteratorPrototype, { + next: descriptor(1, next) + }); + setToStringTag(Constructor, NAME + ' Iterator'); + }; + + /***/ + }, + /* 131 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + $at = __webpack_require__(127)(false); + $export($export.P, 'String', { + // 21.1.3.3 String.prototype.codePointAt(pos) + codePointAt: function codePointAt(pos) { + return $at(this, pos); + } + }); + + /***/ + }, + /* 132 */ + /***/ function(module, exports, __webpack_require__) { + // 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) + 'use strict'; + var $export = __webpack_require__(8), + toLength = __webpack_require__(37), + context = __webpack_require__(133), + ENDS_WITH = 'endsWith', + $endsWith = ''[ENDS_WITH]; + + $export($export.P + $export.F * __webpack_require__(135)(ENDS_WITH), 'String', { + endsWith: function endsWith(searchString /*, endPosition = @length */) { + var that = context(this, searchString, ENDS_WITH), + endPosition = arguments.length > 1 ? arguments[1] : undefined, + len = toLength(that.length), + end = + endPosition === undefined + ? len + : Math.min(toLength(endPosition), len), + search = String(searchString); + return $endsWith + ? $endsWith.call(that, search, end) + : that.slice(end - search.length, end) === search; + } + }); + + /***/ + }, + /* 133 */ + /***/ function(module, exports, __webpack_require__) { + // helper for String#{startsWith, endsWith, includes} + var isRegExp = __webpack_require__(134), + defined = __webpack_require__(35); + + module.exports = function(that, searchString, NAME) { + if (isRegExp(searchString)) + throw TypeError('String#' + NAME + " doesn't accept regex!"); + return String(defined(that)); + }; + + /***/ + }, + /* 134 */ + /***/ function(module, exports, __webpack_require__) { + // 7.2.8 IsRegExp(argument) + var isObject = __webpack_require__(13), + cof = __webpack_require__(34), + MATCH = __webpack_require__(25)('match'); + module.exports = function(it) { + var isRegExp; + return ( + isObject(it) && + ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp') + ); + }; + + /***/ + }, + /* 135 */ + /***/ function(module, exports, __webpack_require__) { + var MATCH = __webpack_require__(25)('match'); + module.exports = function(KEY) { + var re = /./; + try { + '/./'[KEY](re); + } catch (e) { + try { + re[MATCH] = false; + return !'/./'[KEY](re); + } catch (f) { + /* empty */ + } + } + return true; + }; + + /***/ + }, + /* 136 */ + /***/ function(module, exports, __webpack_require__) { + // 21.1.3.7 String.prototype.includes(searchString, position = 0) + 'use strict'; + var $export = __webpack_require__(8), + context = __webpack_require__(133), + INCLUDES = 'includes'; + + $export($export.P + $export.F * __webpack_require__(135)(INCLUDES), 'String', { + includes: function includes(searchString /*, position = 0 */) { + return !!~context(this, searchString, INCLUDES).indexOf( + searchString, + arguments.length > 1 ? arguments[1] : undefined + ); + } + }); + + /***/ + }, + /* 137 */ + /***/ function(module, exports, __webpack_require__) { + var $export = __webpack_require__(8); + + $export($export.P, 'String', { + // 21.1.3.13 String.prototype.repeat(count) + repeat: __webpack_require__(91) + }); + + /***/ + }, + /* 138 */ + /***/ function(module, exports, __webpack_require__) { + // 21.1.3.18 String.prototype.startsWith(searchString [, position ]) + 'use strict'; + var $export = __webpack_require__(8), + toLength = __webpack_require__(37), + context = __webpack_require__(133), + STARTS_WITH = 'startsWith', + $startsWith = ''[STARTS_WITH]; + + $export($export.P + $export.F * __webpack_require__(135)(STARTS_WITH), 'String', { + startsWith: function startsWith(searchString /*, position = 0 */) { + var that = context(this, searchString, STARTS_WITH), + index = toLength( + Math.min( + arguments.length > 1 ? arguments[1] : undefined, + that.length + ) + ), + search = String(searchString); + return $startsWith + ? $startsWith.call(that, search, index) + : that.slice(index, index + search.length) === search; + } + }); + + /***/ + }, + /* 139 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // B.2.3.2 String.prototype.anchor(name) + __webpack_require__(140)('anchor', function(createHTML) { + return function anchor(name) { + return createHTML(this, 'a', 'name', name); + }; + }); + + /***/ + }, + /* 140 */ + /***/ function(module, exports, __webpack_require__) { + var $export = __webpack_require__(8), + fails = __webpack_require__(7), + defined = __webpack_require__(35), + quot = /"/g; + // B.2.3.2.1 CreateHTML(string, tag, attribute, value) + var createHTML = function(string, tag, attribute, value) { + var S = String(defined(string)), + p1 = '<' + tag; + if (attribute !== '') + p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"'; + return p1 + '>' + S + ''; + }; + module.exports = function(NAME, exec) { + var O = {}; + O[NAME] = exec(createHTML); + $export( + $export.P + + $export.F * + fails(function() { + var test = ''[NAME]('"'); + return ( + test !== test.toLowerCase() || test.split('"').length > 3 + ); + }), + 'String', + O + ); + }; + + /***/ + }, + /* 141 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // B.2.3.3 String.prototype.big() + __webpack_require__(140)('big', function(createHTML) { + return function big() { + return createHTML(this, 'big', '', ''); + }; + }); + + /***/ + }, + /* 142 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // B.2.3.4 String.prototype.blink() + __webpack_require__(140)('blink', function(createHTML) { + return function blink() { + return createHTML(this, 'blink', '', ''); + }; + }); + + /***/ + }, + /* 143 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // B.2.3.5 String.prototype.bold() + __webpack_require__(140)('bold', function(createHTML) { + return function bold() { + return createHTML(this, 'b', '', ''); + }; + }); + + /***/ + }, + /* 144 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // B.2.3.6 String.prototype.fixed() + __webpack_require__(140)('fixed', function(createHTML) { + return function fixed() { + return createHTML(this, 'tt', '', ''); + }; + }); + + /***/ + }, + /* 145 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // B.2.3.7 String.prototype.fontcolor(color) + __webpack_require__(140)('fontcolor', function(createHTML) { + return function fontcolor(color) { + return createHTML(this, 'font', 'color', color); + }; + }); + + /***/ + }, + /* 146 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // B.2.3.8 String.prototype.fontsize(size) + __webpack_require__(140)('fontsize', function(createHTML) { + return function fontsize(size) { + return createHTML(this, 'font', 'size', size); + }; + }); + + /***/ + }, + /* 147 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // B.2.3.9 String.prototype.italics() + __webpack_require__(140)('italics', function(createHTML) { + return function italics() { + return createHTML(this, 'i', '', ''); + }; + }); + + /***/ + }, + /* 148 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // B.2.3.10 String.prototype.link(url) + __webpack_require__(140)('link', function(createHTML) { + return function link(url) { + return createHTML(this, 'a', 'href', url); + }; + }); + + /***/ + }, + /* 149 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // B.2.3.11 String.prototype.small() + __webpack_require__(140)('small', function(createHTML) { + return function small() { + return createHTML(this, 'small', '', ''); + }; + }); + + /***/ + }, + /* 150 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // B.2.3.12 String.prototype.strike() + __webpack_require__(140)('strike', function(createHTML) { + return function strike() { + return createHTML(this, 'strike', '', ''); + }; + }); + + /***/ + }, + /* 151 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // B.2.3.13 String.prototype.sub() + __webpack_require__(140)('sub', function(createHTML) { + return function sub() { + return createHTML(this, 'sub', '', ''); + }; + }); + + /***/ + }, + /* 152 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // B.2.3.14 String.prototype.sup() + __webpack_require__(140)('sup', function(createHTML) { + return function sup() { + return createHTML(this, 'sup', '', ''); + }; + }); + + /***/ + }, + /* 153 */ + /***/ function(module, exports, __webpack_require__) { + // 20.3.3.1 / 15.9.4.4 Date.now() + var $export = __webpack_require__(8); + + $export($export.S, 'Date', { + now: function() { + return new Date().getTime(); + } + }); + + /***/ + }, + /* 154 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + toObject = __webpack_require__(58), + toPrimitive = __webpack_require__(16); + + $export( + $export.P + + $export.F * + __webpack_require__(7)(function() { + return ( + new Date(NaN).toJSON() !== null || + Date.prototype.toJSON.call({ + toISOString: function() { + return 1; + } + }) !== 1 + ); + }), + 'Date', + { + toJSON: function toJSON(key) { + var O = toObject(this), + pv = toPrimitive(O); + return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString(); + } + } + ); + + /***/ + }, + /* 155 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() + var $export = __webpack_require__(8), + fails = __webpack_require__(7), + getTime = Date.prototype.getTime; + + var lz = function(num) { + return num > 9 ? num : '0' + num; + }; + + // PhantomJS / old WebKit has a broken implementations + $export( + $export.P + + $export.F * + (fails(function() { + return ( + new Date(-5e13 - 1).toISOString() != '0385-07-25T07:06:39.999Z' + ); + }) || + !fails(function() { + new Date(NaN).toISOString(); + })), + 'Date', + { + toISOString: function toISOString() { + if (!isFinite(getTime.call(this))) + throw RangeError('Invalid time value'); + var d = this, + y = d.getUTCFullYear(), + m = d.getUTCMilliseconds(), + s = y < 0 ? '-' : y > 9999 ? '+' : ''; + return ( + s + + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + + '-' + + lz(d.getUTCMonth() + 1) + + '-' + + lz(d.getUTCDate()) + + 'T' + + lz(d.getUTCHours()) + + ':' + + lz(d.getUTCMinutes()) + + ':' + + lz(d.getUTCSeconds()) + + '.' + + (m > 99 ? m : '0' + lz(m)) + + 'Z' + ); + } + } + ); + + /***/ + }, + /* 156 */ + /***/ function(module, exports, __webpack_require__) { + var DateProto = Date.prototype, + INVALID_DATE = 'Invalid Date', + TO_STRING = 'toString', + $toString = DateProto[TO_STRING], + getTime = DateProto.getTime; + if (new Date(NaN) + '' != INVALID_DATE) { + __webpack_require__(18)(DateProto, TO_STRING, function toString() { + var value = getTime.call(this); + return value === value ? $toString.call(this) : INVALID_DATE; + }); + } + + /***/ + }, + /* 157 */ + /***/ function(module, exports, __webpack_require__) { + var TO_PRIMITIVE = __webpack_require__(25)('toPrimitive'), + proto = Date.prototype; + + if (!(TO_PRIMITIVE in proto)) + __webpack_require__(10)(proto, TO_PRIMITIVE, __webpack_require__(158)); + + /***/ + }, + /* 158 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var anObject = __webpack_require__(12), + toPrimitive = __webpack_require__(16), + NUMBER = 'number'; + + module.exports = function(hint) { + if (hint !== 'string' && hint !== NUMBER && hint !== 'default') + throw TypeError('Incorrect hint'); + return toPrimitive(anObject(this), hint != NUMBER); + }; + + /***/ + }, + /* 159 */ + /***/ function(module, exports, __webpack_require__) { + // 22.1.2.2 / 15.4.3.2 Array.isArray(arg) + var $export = __webpack_require__(8); + + $export($export.S, 'Array', { isArray: __webpack_require__(45) }); + + /***/ + }, + /* 160 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var ctx = __webpack_require__(20), + $export = __webpack_require__(8), + toObject = __webpack_require__(58), + call = __webpack_require__(161), + isArrayIter = __webpack_require__(162), + toLength = __webpack_require__(37), + createProperty = __webpack_require__(163), + getIterFn = __webpack_require__(164); + + $export( + $export.S + + $export.F * + !__webpack_require__(165)(function(iter) { + Array.from(iter); + }), + 'Array', + { + // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) + from: function from( + arrayLike /*, mapfn = undefined, thisArg = undefined*/ + ) { + var O = toObject(arrayLike), + C = typeof this == 'function' ? this : Array, + aLen = arguments.length, + mapfn = aLen > 1 ? arguments[1] : undefined, + mapping = mapfn !== undefined, + index = 0, + iterFn = getIterFn(O), + length, + result, + step, + iterator; + if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); + // if object isn't iterable or it's array with default iterator - use simple case + if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) { + for ( + iterator = iterFn.call(O), result = new C(); + !(step = iterator.next()).done; + index++ + ) { + createProperty( + result, + index, + mapping + ? call(iterator, mapfn, [step.value, index], true) + : step.value + ); + } + } else { + length = toLength(O.length); + for (result = new C(length); length > index; index++) { + createProperty( + result, + index, + mapping ? mapfn(O[index], index) : O[index] + ); + } + } + result.length = index; + return result; + } + } + ); + + /***/ + }, + /* 161 */ + /***/ function(module, exports, __webpack_require__) { + // call something on iterator step with safe closing on error + var anObject = __webpack_require__(12); + module.exports = function(iterator, fn, value, entries) { + try { + return entries ? fn(anObject(value)[0], value[1]) : fn(value); + // 7.4.6 IteratorClose(iterator, completion) + } catch (e) { + var ret = iterator['return']; + if (ret !== undefined) anObject(ret.call(iterator)); + throw e; + } + }; + + /***/ + }, + /* 162 */ + /***/ function(module, exports, __webpack_require__) { + // check on default Array iterator + var Iterators = __webpack_require__(129), + ITERATOR = __webpack_require__(25)('iterator'), + ArrayProto = Array.prototype; + + module.exports = function(it) { + return ( + it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it) + ); + }; + + /***/ + }, + /* 163 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $defineProperty = __webpack_require__(11), + createDesc = __webpack_require__(17); + + module.exports = function(object, index, value) { + if (index in object) $defineProperty.f(object, index, createDesc(0, value)); + else object[index] = value; + }; + + /***/ + }, + /* 164 */ + /***/ function(module, exports, __webpack_require__) { + var classof = __webpack_require__(75), + ITERATOR = __webpack_require__(25)('iterator'), + Iterators = __webpack_require__(129); + module.exports = __webpack_require__(9).getIteratorMethod = function(it) { + if (it != undefined) + return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; + }; + + /***/ + }, + /* 165 */ + /***/ function(module, exports, __webpack_require__) { + var ITERATOR = __webpack_require__(25)('iterator'), + SAFE_CLOSING = false; + + try { + var riter = [7][ITERATOR](); + riter['return'] = function() { + SAFE_CLOSING = true; + }; + Array.from(riter, function() { + throw 2; + }); + } catch (e) { + /* empty */ + } + + module.exports = function(exec, skipClosing) { + if (!skipClosing && !SAFE_CLOSING) return false; + var safe = false; + try { + var arr = [7], + iter = arr[ITERATOR](); + iter.next = function() { + return { done: (safe = true) }; + }; + arr[ITERATOR] = function() { + return iter; + }; + exec(arr); + } catch (e) { + /* empty */ + } + return safe; + }; + + /***/ + }, + /* 166 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + createProperty = __webpack_require__(163); + + // WebKit Array.of isn't generic + $export( + $export.S + + $export.F * + __webpack_require__(7)(function() { + function F() {} + return !(Array.of.call(F) instanceof F); + }), + 'Array', + { + // 22.1.2.3 Array.of( ...items) + of: function of(/* ...args */) { + var index = 0, + aLen = arguments.length, + result = new (typeof this == 'function' ? this : Array)(aLen); + while (aLen > index) createProperty(result, index, arguments[index++]); + result.length = aLen; + return result; + } + } + ); + + /***/ + }, + /* 167 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // 22.1.3.13 Array.prototype.join(separator) + var $export = __webpack_require__(8), + toIObject = __webpack_require__(32), + arrayJoin = [].join; + + // fallback for not array-like strings + $export( + $export.P + + $export.F * + (__webpack_require__(33) != Object || + !__webpack_require__(168)(arrayJoin)), + 'Array', + { + join: function join(separator) { + return arrayJoin.call( + toIObject(this), + separator === undefined ? ',' : separator + ); + } + } + ); + + /***/ + }, + /* 168 */ + /***/ function(module, exports, __webpack_require__) { + var fails = __webpack_require__(7); + + module.exports = function(method, arg) { + return ( + !!method && + fails(function() { + arg ? method.call(null, function() {}, 1) : method.call(null); + }) + ); + }; + + /***/ + }, + /* 169 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + html = __webpack_require__(48), + cof = __webpack_require__(34), + toIndex = __webpack_require__(39), + toLength = __webpack_require__(37), + arraySlice = [].slice; + + // fallback for not array-like ES3 strings and DOM objects + $export( + $export.P + + $export.F * + __webpack_require__(7)(function() { + if (html) arraySlice.call(html); + }), + 'Array', + { + slice: function slice(begin, end) { + var len = toLength(this.length), + klass = cof(this); + end = end === undefined ? len : end; + if (klass == 'Array') return arraySlice.call(this, begin, end); + var start = toIndex(begin, len), + upTo = toIndex(end, len), + size = toLength(upTo - start), + cloned = Array(size), + i = 0; + for (; i < size; i++) + cloned[i] = + klass == 'String' ? this.charAt(start + i) : this[start + i]; + return cloned; + } + } + ); + + /***/ + }, + /* 170 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + aFunction = __webpack_require__(21), + toObject = __webpack_require__(58), + fails = __webpack_require__(7), + $sort = [].sort, + test = [1, 2, 3]; + + $export( + $export.P + + $export.F * + (fails(function() { + // IE8- + test.sort(undefined); + }) || + !fails(function() { + // V8 bug + test.sort(null); + // Old WebKit + }) || + !__webpack_require__(168)($sort)), + 'Array', + { + // 22.1.3.25 Array.prototype.sort(comparefn) + sort: function sort(comparefn) { + return comparefn === undefined + ? $sort.call(toObject(this)) + : $sort.call(toObject(this), aFunction(comparefn)); + } + } + ); + + /***/ + }, + /* 171 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + $forEach = __webpack_require__(172)(0), + STRICT = __webpack_require__(168)([].forEach, true); + + $export($export.P + $export.F * !STRICT, 'Array', { + // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) + forEach: function forEach(callbackfn /* , thisArg */) { + return $forEach(this, callbackfn, arguments[1]); + } + }); + + /***/ + }, + /* 172 */ + /***/ function(module, exports, __webpack_require__) { + // 0 -> Array#forEach + // 1 -> Array#map + // 2 -> Array#filter + // 3 -> Array#some + // 4 -> Array#every + // 5 -> Array#find + // 6 -> Array#findIndex + var ctx = __webpack_require__(20), + IObject = __webpack_require__(33), + toObject = __webpack_require__(58), + toLength = __webpack_require__(37), + asc = __webpack_require__(173); + module.exports = function(TYPE, $create) { + var IS_MAP = TYPE == 1, + IS_FILTER = TYPE == 2, + IS_SOME = TYPE == 3, + IS_EVERY = TYPE == 4, + IS_FIND_INDEX = TYPE == 6, + NO_HOLES = TYPE == 5 || IS_FIND_INDEX, + create = $create || asc; + return function($this, callbackfn, that) { + var O = toObject($this), + self = IObject(O), + f = ctx(callbackfn, that, 3), + length = toLength(self.length), + index = 0, + result = IS_MAP + ? create($this, length) + : IS_FILTER ? create($this, 0) : undefined, + val, + res; + for (; length > index; index++) + if (NO_HOLES || index in self) { + val = self[index]; + res = f(val, index, O); + if (TYPE) { + if (IS_MAP) result[index] = res; + else if (res) + // map + switch (TYPE) { + case 3: + return true; // some + case 5: + return val; // find + case 6: + return index; // findIndex + case 2: + result.push(val); // filter + } + else if (IS_EVERY) return false; // every + } + } + return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; + }; + }; + + /***/ + }, + /* 173 */ + /***/ function(module, exports, __webpack_require__) { + // 9.4.2.3 ArraySpeciesCreate(originalArray, length) + var speciesConstructor = __webpack_require__(174); + + module.exports = function(original, length) { + return new (speciesConstructor(original))(length); + }; + + /***/ + }, + /* 174 */ + /***/ function(module, exports, __webpack_require__) { + var isObject = __webpack_require__(13), + isArray = __webpack_require__(45), + SPECIES = __webpack_require__(25)('species'); + + module.exports = function(original) { + var C; + if (isArray(original)) { + C = original.constructor; + // cross-realm fallback + if (typeof C == 'function' && (C === Array || isArray(C.prototype))) + C = undefined; + if (isObject(C)) { + C = C[SPECIES]; + if (C === null) C = undefined; + } + } + return C === undefined ? Array : C; + }; + + /***/ + }, + /* 175 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + $map = __webpack_require__(172)(1); + + $export($export.P + $export.F * !__webpack_require__(168)([].map, true), 'Array', { + // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) + map: function map(callbackfn /* , thisArg */) { + return $map(this, callbackfn, arguments[1]); + } + }); + + /***/ + }, + /* 176 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + $filter = __webpack_require__(172)(2); + + $export( + $export.P + $export.F * !__webpack_require__(168)([].filter, true), + 'Array', + { + // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) + filter: function filter(callbackfn /* , thisArg */) { + return $filter(this, callbackfn, arguments[1]); + } + } + ); + + /***/ + }, + /* 177 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + $some = __webpack_require__(172)(3); + + $export($export.P + $export.F * !__webpack_require__(168)([].some, true), 'Array', { + // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg]) + some: function some(callbackfn /* , thisArg */) { + return $some(this, callbackfn, arguments[1]); + } + }); + + /***/ + }, + /* 178 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + $every = __webpack_require__(172)(4); + + $export( + $export.P + $export.F * !__webpack_require__(168)([].every, true), + 'Array', + { + // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg]) + every: function every(callbackfn /* , thisArg */) { + return $every(this, callbackfn, arguments[1]); + } + } + ); + + /***/ + }, + /* 179 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + $reduce = __webpack_require__(180); + + $export( + $export.P + $export.F * !__webpack_require__(168)([].reduce, true), + 'Array', + { + // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) + reduce: function reduce(callbackfn /* , initialValue */) { + return $reduce(this, callbackfn, arguments.length, arguments[1], false); + } + } + ); + + /***/ + }, + /* 180 */ + /***/ function(module, exports, __webpack_require__) { + var aFunction = __webpack_require__(21), + toObject = __webpack_require__(58), + IObject = __webpack_require__(33), + toLength = __webpack_require__(37); + + module.exports = function(that, callbackfn, aLen, memo, isRight) { + aFunction(callbackfn); + var O = toObject(that), + self = IObject(O), + length = toLength(O.length), + index = isRight ? length - 1 : 0, + i = isRight ? -1 : 1; + if (aLen < 2) + for (;;) { + if (index in self) { + memo = self[index]; + index += i; + break; + } + index += i; + if (isRight ? index < 0 : length <= index) { + throw TypeError('Reduce of empty array with no initial value'); + } + } + for (; isRight ? index >= 0 : length > index; index += i) + if (index in self) { + memo = callbackfn(memo, self[index], index, O); + } + return memo; + }; + + /***/ + }, + /* 181 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + $reduce = __webpack_require__(180); + + $export( + $export.P + $export.F * !__webpack_require__(168)([].reduceRight, true), + 'Array', + { + // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue]) + reduceRight: function reduceRight(callbackfn /* , initialValue */) { + return $reduce(this, callbackfn, arguments.length, arguments[1], true); + } + } + ); + + /***/ + }, + /* 182 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + $indexOf = __webpack_require__(36)(false), + $native = [].indexOf, + NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0; + + $export( + $export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(168)($native)), + 'Array', + { + // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) + indexOf: function indexOf(searchElement /*, fromIndex = 0 */) { + return NEGATIVE_ZERO + ? // convert -0 to +0 + $native.apply(this, arguments) || 0 + : $indexOf(this, searchElement, arguments[1]); + } + } + ); + + /***/ + }, + /* 183 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + toIObject = __webpack_require__(32), + toInteger = __webpack_require__(38), + toLength = __webpack_require__(37), + $native = [].lastIndexOf, + NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0; + + $export( + $export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(168)($native)), + 'Array', + { + // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) + lastIndexOf: function lastIndexOf(searchElement /*, fromIndex = @[*-1] */) { + // convert -0 to +0 + if (NEGATIVE_ZERO) return $native.apply(this, arguments) || 0; + var O = toIObject(this), + length = toLength(O.length), + index = length - 1; + if (arguments.length > 1) + index = Math.min(index, toInteger(arguments[1])); + if (index < 0) index = length + index; + for (; index >= 0; index--) + if (index in O) if (O[index] === searchElement) return index || 0; + return -1; + } + } + ); + + /***/ + }, + /* 184 */ + /***/ function(module, exports, __webpack_require__) { + // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) + var $export = __webpack_require__(8); + + $export($export.P, 'Array', { copyWithin: __webpack_require__(185) }); + + __webpack_require__(186)('copyWithin'); + + /***/ + }, + /* 185 */ + /***/ function(module, exports, __webpack_require__) { + // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) + 'use strict'; + var toObject = __webpack_require__(58), + toIndex = __webpack_require__(39), + toLength = __webpack_require__(37); + + module.exports = + [].copyWithin || + function copyWithin(target /*= 0*/, start /*= 0, end = @length*/) { + var O = toObject(this), + len = toLength(O.length), + to = toIndex(target, len), + from = toIndex(start, len), + end = arguments.length > 2 ? arguments[2] : undefined, + count = Math.min( + (end === undefined ? len : toIndex(end, len)) - from, + len - to + ), + inc = 1; + if (from < to && to < from + count) { + inc = -1; + from += count - 1; + to += count - 1; + } + while (count-- > 0) { + if (from in O) O[to] = O[from]; + else delete O[to]; + to += inc; + from += inc; + } + return O; + }; + + /***/ + }, + /* 186 */ + /***/ function(module, exports, __webpack_require__) { + // 22.1.3.31 Array.prototype[@@unscopables] + var UNSCOPABLES = __webpack_require__(25)('unscopables'), + ArrayProto = Array.prototype; + if (ArrayProto[UNSCOPABLES] == undefined) + __webpack_require__(10)(ArrayProto, UNSCOPABLES, {}); + module.exports = function(key) { + ArrayProto[UNSCOPABLES][key] = true; + }; + + /***/ + }, + /* 187 */ + /***/ function(module, exports, __webpack_require__) { + // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) + var $export = __webpack_require__(8); + + $export($export.P, 'Array', { fill: __webpack_require__(188) }); + + __webpack_require__(186)('fill'); + + /***/ + }, + /* 188 */ + /***/ function(module, exports, __webpack_require__) { + // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) + 'use strict'; + var toObject = __webpack_require__(58), + toIndex = __webpack_require__(39), + toLength = __webpack_require__(37); + module.exports = function fill(value /*, start = 0, end = @length */) { + var O = toObject(this), + length = toLength(O.length), + aLen = arguments.length, + index = toIndex(aLen > 1 ? arguments[1] : undefined, length), + end = aLen > 2 ? arguments[2] : undefined, + endPos = end === undefined ? length : toIndex(end, length); + while (endPos > index) O[index++] = value; + return O; + }; + + /***/ + }, + /* 189 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) + var $export = __webpack_require__(8), + $find = __webpack_require__(172)(5), + KEY = 'find', + forced = true; + // Shouldn't skip holes + if (KEY in []) + Array(1)[KEY](function() { + forced = false; + }); + $export($export.P + $export.F * forced, 'Array', { + find: function find(callbackfn /*, that = undefined */) { + return $find( + this, + callbackfn, + arguments.length > 1 ? arguments[1] : undefined + ); + } + }); + __webpack_require__(186)(KEY); + + /***/ + }, + /* 190 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) + var $export = __webpack_require__(8), + $find = __webpack_require__(172)(6), + KEY = 'findIndex', + forced = true; + // Shouldn't skip holes + if (KEY in []) + Array(1)[KEY](function() { + forced = false; + }); + $export($export.P + $export.F * forced, 'Array', { + findIndex: function findIndex(callbackfn /*, that = undefined */) { + return $find( + this, + callbackfn, + arguments.length > 1 ? arguments[1] : undefined + ); + } + }); + __webpack_require__(186)(KEY); + + /***/ + }, + /* 191 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(192)('Array'); + + /***/ + }, + /* 192 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var global = __webpack_require__(4), + dP = __webpack_require__(11), + DESCRIPTORS = __webpack_require__(6), + SPECIES = __webpack_require__(25)('species'); + + module.exports = function(KEY) { + var C = global[KEY]; + if (DESCRIPTORS && C && !C[SPECIES]) + dP.f(C, SPECIES, { + configurable: true, + get: function() { + return this; + } + }); + }; + + /***/ + }, + /* 193 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var addToUnscopables = __webpack_require__(186), + step = __webpack_require__(194), + Iterators = __webpack_require__(129), + toIObject = __webpack_require__(32); + + // 22.1.3.4 Array.prototype.entries() + // 22.1.3.13 Array.prototype.keys() + // 22.1.3.29 Array.prototype.values() + // 22.1.3.30 Array.prototype[@@iterator]() + module.exports = __webpack_require__(128)( + Array, + 'Array', + function(iterated, kind) { + this._t = toIObject(iterated); // target + this._i = 0; // next index + this._k = kind; // kind + // 22.1.5.2.1 %ArrayIteratorPrototype%.next() + }, + function() { + var O = this._t, + kind = this._k, + index = this._i++; + if (!O || index >= O.length) { + this._t = undefined; + return step(1); + } + if (kind == 'keys') return step(0, index); + if (kind == 'values') return step(0, O[index]); + return step(0, [index, O[index]]); + }, + 'values' + ); + + // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) + Iterators.Arguments = Iterators.Array; + + addToUnscopables('keys'); + addToUnscopables('values'); + addToUnscopables('entries'); + + /***/ + }, + /* 194 */ + /***/ function(module, exports) { + module.exports = function(done, value) { + return { value: value, done: !!done }; + }; + + /***/ + }, + /* 195 */ + /***/ function(module, exports, __webpack_require__) { + var global = __webpack_require__(4), + inheritIfRequired = __webpack_require__(88), + dP = __webpack_require__(11).f, + gOPN = __webpack_require__(50).f, + isRegExp = __webpack_require__(134), + $flags = __webpack_require__(196), + $RegExp = global.RegExp, + Base = $RegExp, + proto = $RegExp.prototype, + re1 = /a/g, + re2 = /a/g, + // "new" creates a new object, old webkit buggy here + CORRECT_NEW = new $RegExp(re1) !== re1; + + if ( + __webpack_require__(6) && + (!CORRECT_NEW || + __webpack_require__(7)(function() { + re2[__webpack_require__(25)('match')] = false; + // RegExp constructor can alter flags and IsRegExp works correct with @@match + return ( + $RegExp(re1) != re1 || + $RegExp(re2) == re2 || + $RegExp(re1, 'i') != '/a/i' + ); + })) + ) { + $RegExp = function RegExp(p, f) { + var tiRE = this instanceof $RegExp, + piRE = isRegExp(p), + fiU = f === undefined; + return !tiRE && piRE && p.constructor === $RegExp && fiU + ? p + : inheritIfRequired( + CORRECT_NEW + ? new Base(piRE && !fiU ? p.source : p, f) + : Base( + (piRE = p instanceof $RegExp) ? p.source : p, + piRE && fiU ? $flags.call(p) : f + ), + tiRE ? this : proto, + $RegExp + ); + }; + var proxy = function(key) { + key in $RegExp || + dP($RegExp, key, { + configurable: true, + get: function() { + return Base[key]; + }, + set: function(it) { + Base[key] = it; + } + }); + }; + for (var keys = gOPN(Base), i = 0; keys.length > i; ) proxy(keys[i++]); + proto.constructor = $RegExp; + $RegExp.prototype = proto; + __webpack_require__(18)(global, 'RegExp', $RegExp); + } + + __webpack_require__(192)('RegExp'); + + /***/ + }, + /* 196 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // 21.2.5.3 get RegExp.prototype.flags + var anObject = __webpack_require__(12); + module.exports = function() { + var that = anObject(this), + result = ''; + if (that.global) result += 'g'; + if (that.ignoreCase) result += 'i'; + if (that.multiline) result += 'm'; + if (that.unicode) result += 'u'; + if (that.sticky) result += 'y'; + return result; + }; + + /***/ + }, + /* 197 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + __webpack_require__(198); + var anObject = __webpack_require__(12), + $flags = __webpack_require__(196), + DESCRIPTORS = __webpack_require__(6), + TO_STRING = 'toString', + $toString = /./[TO_STRING]; + + var define = function(fn) { + __webpack_require__(18)(RegExp.prototype, TO_STRING, fn, true); + }; + + // 21.2.5.14 RegExp.prototype.toString() + if ( + __webpack_require__(7)(function() { + return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; + }) + ) { + define(function toString() { + var R = anObject(this); + return '/'.concat( + R.source, + '/', + 'flags' in R + ? R.flags + : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined + ); + }); + // FF44- RegExp#toString has a wrong name + } else if ($toString.name != TO_STRING) { + define(function toString() { + return $toString.call(this); + }); + } + + /***/ + }, + /* 198 */ + /***/ function(module, exports, __webpack_require__) { + // 21.2.5.3 get RegExp.prototype.flags() + if (__webpack_require__(6) && /./g.flags != 'g') + __webpack_require__(11).f(RegExp.prototype, 'flags', { + configurable: true, + get: __webpack_require__(196) + }); + + /***/ + }, + /* 199 */ + /***/ function(module, exports, __webpack_require__) { + // @@match logic + __webpack_require__(200)('match', 1, function(defined, MATCH, $match) { + // 21.1.3.11 String.prototype.match(regexp) + return [ + function match(regexp) { + 'use strict'; + var O = defined(this), + fn = regexp == undefined ? undefined : regexp[MATCH]; + return fn !== undefined + ? fn.call(regexp, O) + : new RegExp(regexp)[MATCH](String(O)); + }, + $match + ]; + }); + + /***/ + }, + /* 200 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var hide = __webpack_require__(10), + redefine = __webpack_require__(18), + fails = __webpack_require__(7), + defined = __webpack_require__(35), + wks = __webpack_require__(25); + + module.exports = function(KEY, length, exec) { + var SYMBOL = wks(KEY), + fns = exec(defined, SYMBOL, ''[KEY]), + strfn = fns[0], + rxfn = fns[1]; + if ( + fails(function() { + var O = {}; + O[SYMBOL] = function() { + return 7; + }; + return ''[KEY](O) != 7; + }) + ) { + redefine(String.prototype, KEY, strfn); + hide( + RegExp.prototype, + SYMBOL, + length == 2 + ? // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) + // 21.2.5.11 RegExp.prototype[@@split](string, limit) + function(string, arg) { + return rxfn.call(string, this, arg); + } + : // 21.2.5.6 RegExp.prototype[@@match](string) + // 21.2.5.9 RegExp.prototype[@@search](string) + function(string) { + return rxfn.call(string, this); + } + ); + } + }; + + /***/ + }, + /* 201 */ + /***/ function(module, exports, __webpack_require__) { + // @@replace logic + __webpack_require__(200)('replace', 2, function(defined, REPLACE, $replace) { + // 21.1.3.14 String.prototype.replace(searchValue, replaceValue) + return [ + function replace(searchValue, replaceValue) { + 'use strict'; + var O = defined(this), + fn = searchValue == undefined ? undefined : searchValue[REPLACE]; + return fn !== undefined + ? fn.call(searchValue, O, replaceValue) + : $replace.call(String(O), searchValue, replaceValue); + }, + $replace + ]; + }); + + /***/ + }, + /* 202 */ + /***/ function(module, exports, __webpack_require__) { + // @@search logic + __webpack_require__(200)('search', 1, function(defined, SEARCH, $search) { + // 21.1.3.15 String.prototype.search(regexp) + return [ + function search(regexp) { + 'use strict'; + var O = defined(this), + fn = regexp == undefined ? undefined : regexp[SEARCH]; + return fn !== undefined + ? fn.call(regexp, O) + : new RegExp(regexp)[SEARCH](String(O)); + }, + $search + ]; + }); + + /***/ + }, + /* 203 */ + /***/ function(module, exports, __webpack_require__) { + // @@split logic + __webpack_require__(200)('split', 2, function(defined, SPLIT, $split) { + 'use strict'; + var isRegExp = __webpack_require__(134), + _split = $split, + $push = [].push, + $SPLIT = 'split', + LENGTH = 'length', + LAST_INDEX = 'lastIndex'; + if ( + 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || + 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || + 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || + '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || + '.'[$SPLIT](/()()/)[LENGTH] > 1 || + ''[$SPLIT](/.?/)[LENGTH] + ) { + var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group + // based on es5-shim implementation, need to rework it + $split = function(separator, limit) { + var string = String(this); + if (separator === undefined && limit === 0) return []; + // If `separator` is not a regex, use native split + if (!isRegExp(separator)) return _split.call(string, separator, limit); + var output = []; + var flags = + (separator.ignoreCase ? 'i' : '') + + (separator.multiline ? 'm' : '') + + (separator.unicode ? 'u' : '') + + (separator.sticky ? 'y' : ''); + var lastLastIndex = 0; + var splitLimit = limit === undefined ? 4294967295 : limit >>> 0; + // Make `global` and avoid `lastIndex` issues by working with a copy + var separatorCopy = new RegExp(separator.source, flags + 'g'); + var separator2, match, lastIndex, lastLength, i; + // Doesn't need flags gy, but they don't hurt + if (!NPCG) + separator2 = new RegExp( + '^' + separatorCopy.source + '$(?!\\s)', + flags + ); + while ((match = separatorCopy.exec(string))) { + // `separatorCopy.lastIndex` is not reliable cross-browser + lastIndex = match.index + match[0][LENGTH]; + if (lastIndex > lastLastIndex) { + output.push(string.slice(lastLastIndex, match.index)); + // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG + if (!NPCG && match[LENGTH] > 1) + match[0].replace(separator2, function() { + for (i = 1; i < arguments[LENGTH] - 2; i++) + if (arguments[i] === undefined) + match[i] = undefined; + }); + if (match[LENGTH] > 1 && match.index < string[LENGTH]) + $push.apply(output, match.slice(1)); + lastLength = match[0][LENGTH]; + lastLastIndex = lastIndex; + if (output[LENGTH] >= splitLimit) break; + } + if (separatorCopy[LAST_INDEX] === match.index) + separatorCopy[LAST_INDEX]++; // Avoid an infinite loop + } + if (lastLastIndex === string[LENGTH]) { + if (lastLength || !separatorCopy.test('')) output.push(''); + } else output.push(string.slice(lastLastIndex)); + return output[LENGTH] > splitLimit + ? output.slice(0, splitLimit) + : output; + }; + // Chakra, V8 + } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) { + $split = function(separator, limit) { + return separator === undefined && limit === 0 + ? [] + : _split.call(this, separator, limit); + }; + } + // 21.1.3.17 String.prototype.split(separator, limit) + return [ + function split(separator, limit) { + var O = defined(this), + fn = separator == undefined ? undefined : separator[SPLIT]; + return fn !== undefined + ? fn.call(separator, O, limit) + : $split.call(String(O), separator, limit); + }, + $split + ]; + }); + + /***/ + }, + /* 204 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var LIBRARY = __webpack_require__(28), + global = __webpack_require__(4), + ctx = __webpack_require__(20), + classof = __webpack_require__(75), + $export = __webpack_require__(8), + isObject = __webpack_require__(13), + aFunction = __webpack_require__(21), + anInstance = __webpack_require__(205), + forOf = __webpack_require__(206), + speciesConstructor = __webpack_require__(207), + task = __webpack_require__(208).set, + microtask = __webpack_require__(209)(), + PROMISE = 'Promise', + TypeError = global.TypeError, + process = global.process, + $Promise = global[PROMISE], + process = global.process, + isNode = classof(process) == 'process', + empty = function() { + /* empty */ + }, + Internal, + GenericPromiseCapability, + Wrapper; + + var USE_NATIVE = !!(function() { + try { + // correct subclassing with @@species support + var promise = $Promise.resolve(1), + FakePromise = ((promise.constructor = {})[ + __webpack_require__(25)('species') + ] = function(exec) { + exec(empty, empty); + }); + // unhandled rejections tracking support, NodeJS Promise without it fails @@species test + return ( + (isNode || typeof PromiseRejectionEvent == 'function') && + promise.then(empty) instanceof FakePromise + ); + } catch (e) { + /* empty */ + } + })(); + + // helpers + var sameConstructor = function(a, b) { + // with library wrapper special case + return a === b || (a === $Promise && b === Wrapper); + }; + var isThenable = function(it) { + var then; + return isObject(it) && typeof (then = it.then) == 'function' ? then : false; + }; + var newPromiseCapability = function(C) { + return sameConstructor($Promise, C) + ? new PromiseCapability(C) + : new GenericPromiseCapability(C); + }; + var PromiseCapability = (GenericPromiseCapability = function(C) { + var resolve, reject; + this.promise = new C(function($$resolve, $$reject) { + if (resolve !== undefined || reject !== undefined) + throw TypeError('Bad Promise constructor'); + resolve = $$resolve; + reject = $$reject; + }); + this.resolve = aFunction(resolve); + this.reject = aFunction(reject); + }); + var perform = function(exec) { + try { + exec(); + } catch (e) { + return { error: e }; + } + }; + var notify = function(promise, isReject) { + if (promise._n) return; + promise._n = true; + var chain = promise._c; + microtask(function() { + var value = promise._v, + ok = promise._s == 1, + i = 0; + var run = function(reaction) { + var handler = ok ? reaction.ok : reaction.fail, + resolve = reaction.resolve, + reject = reaction.reject, + domain = reaction.domain, + result, + then; + try { + if (handler) { + if (!ok) { + if (promise._h == 2) onHandleUnhandled(promise); + promise._h = 1; + } + if (handler === true) result = value; + else { + if (domain) domain.enter(); + result = handler(value); + if (domain) domain.exit(); + } + if (result === reaction.promise) { + reject(TypeError('Promise-chain cycle')); + } else if ((then = isThenable(result))) { + then.call(result, resolve, reject); + } else resolve(result); + } else reject(value); + } catch (e) { + reject(e); + } + }; + while (chain.length > i) run(chain[i++]); // variable length - can't use forEach + promise._c = []; + promise._n = false; + if (isReject && !promise._h) onUnhandled(promise); + }); + }; + var onUnhandled = function(promise) { + task.call(global, function() { + var value = promise._v, + abrupt, + handler, + console; + if (isUnhandled(promise)) { + abrupt = perform(function() { + if (isNode) { + process.emit('unhandledRejection', value, promise); + } else if ((handler = global.onunhandledrejection)) { + handler({ promise: promise, reason: value }); + } else if ((console = global.console) && console.error) { + console.error('Unhandled promise rejection', value); + } + }); + // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should + promise._h = isNode || isUnhandled(promise) ? 2 : 1; + } + promise._a = undefined; + if (abrupt) throw abrupt.error; + }); + }; + var isUnhandled = function(promise) { + if (promise._h == 1) return false; + var chain = promise._a || promise._c, + i = 0, + reaction; + while (chain.length > i) { + reaction = chain[i++]; + if (reaction.fail || !isUnhandled(reaction.promise)) return false; + } + return true; + }; + var onHandleUnhandled = function(promise) { + task.call(global, function() { + var handler; + if (isNode) { + process.emit('rejectionHandled', promise); + } else if ((handler = global.onrejectionhandled)) { + handler({ promise: promise, reason: promise._v }); + } + }); + }; + var $reject = function(value) { + var promise = this; + if (promise._d) return; + promise._d = true; + promise = promise._w || promise; // unwrap + promise._v = value; + promise._s = 2; + if (!promise._a) promise._a = promise._c.slice(); + notify(promise, true); + }; + var $resolve = function(value) { + var promise = this, + then; + if (promise._d) return; + promise._d = true; + promise = promise._w || promise; // unwrap + try { + if (promise === value) throw TypeError("Promise can't be resolved itself"); + if ((then = isThenable(value))) { + microtask(function() { + var wrapper = { _w: promise, _d: false }; // wrap + try { + then.call( + value, + ctx($resolve, wrapper, 1), + ctx($reject, wrapper, 1) + ); + } catch (e) { + $reject.call(wrapper, e); + } + }); + } else { + promise._v = value; + promise._s = 1; + notify(promise, false); + } + } catch (e) { + $reject.call({ _w: promise, _d: false }, e); // wrap + } + }; + + // constructor polyfill + if (!USE_NATIVE) { + // 25.4.3.1 Promise(executor) + $Promise = function Promise(executor) { + anInstance(this, $Promise, PROMISE, '_h'); + aFunction(executor); + Internal.call(this); + try { + executor(ctx($resolve, this, 1), ctx($reject, this, 1)); + } catch (err) { + $reject.call(this, err); + } + }; + Internal = function Promise(executor) { + this._c = []; // <- awaiting reactions + this._a = undefined; // <- checked in isUnhandled reactions + this._s = 0; // <- state + this._d = false; // <- done + this._v = undefined; // <- value + this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled + this._n = false; // <- notify + }; + Internal.prototype = __webpack_require__(210)($Promise.prototype, { + // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) + then: function then(onFulfilled, onRejected) { + var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); + reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; + reaction.fail = typeof onRejected == 'function' && onRejected; + reaction.domain = isNode ? process.domain : undefined; + this._c.push(reaction); + if (this._a) this._a.push(reaction); + if (this._s) notify(this, false); + return reaction.promise; + }, + // 25.4.5.1 Promise.prototype.catch(onRejected) + catch: function(onRejected) { + return this.then(undefined, onRejected); + } + }); + PromiseCapability = function() { + var promise = new Internal(); + this.promise = promise; + this.resolve = ctx($resolve, promise, 1); + this.reject = ctx($reject, promise, 1); + }; + } + + $export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise }); + __webpack_require__(24)($Promise, PROMISE); + __webpack_require__(192)(PROMISE); + Wrapper = __webpack_require__(9)[PROMISE]; + + // statics + $export($export.S + $export.F * !USE_NATIVE, PROMISE, { + // 25.4.4.5 Promise.reject(r) + reject: function reject(r) { + var capability = newPromiseCapability(this), + $$reject = capability.reject; + $$reject(r); + return capability.promise; + } + }); + $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { + // 25.4.4.6 Promise.resolve(x) + resolve: function resolve(x) { + // instanceof instead of internal slot check because we should fix it without replacement native Promise core + if (x instanceof $Promise && sameConstructor(x.constructor, this)) return x; + var capability = newPromiseCapability(this), + $$resolve = capability.resolve; + $$resolve(x); + return capability.promise; + } + }); + $export( + $export.S + + $export.F * + !( + USE_NATIVE && + __webpack_require__(165)(function(iter) { + $Promise.all(iter)['catch'](empty); + }) + ), + PROMISE, + { + // 25.4.4.1 Promise.all(iterable) + all: function all(iterable) { + var C = this, + capability = newPromiseCapability(C), + resolve = capability.resolve, + reject = capability.reject; + var abrupt = perform(function() { + var values = [], + index = 0, + remaining = 1; + forOf(iterable, false, function(promise) { + var $index = index++, + alreadyCalled = false; + values.push(undefined); + remaining++; + C.resolve(promise).then(function(value) { + if (alreadyCalled) return; + alreadyCalled = true; + values[$index] = value; + --remaining || resolve(values); + }, reject); + }); + --remaining || resolve(values); + }); + if (abrupt) reject(abrupt.error); + return capability.promise; + }, + // 25.4.4.4 Promise.race(iterable) + race: function race(iterable) { + var C = this, + capability = newPromiseCapability(C), + reject = capability.reject; + var abrupt = perform(function() { + forOf(iterable, false, function(promise) { + C.resolve(promise).then(capability.resolve, reject); + }); + }); + if (abrupt) reject(abrupt.error); + return capability.promise; + } + } + ); + + /***/ + }, + /* 205 */ + /***/ function(module, exports) { + module.exports = function(it, Constructor, name, forbiddenField) { + if ( + !(it instanceof Constructor) || + (forbiddenField !== undefined && forbiddenField in it) + ) { + throw TypeError(name + ': incorrect invocation!'); + } + return it; + }; + + /***/ + }, + /* 206 */ + /***/ function(module, exports, __webpack_require__) { + var ctx = __webpack_require__(20), + call = __webpack_require__(161), + isArrayIter = __webpack_require__(162), + anObject = __webpack_require__(12), + toLength = __webpack_require__(37), + getIterFn = __webpack_require__(164), + BREAK = {}, + RETURN = {}; + var exports = (module.exports = function(iterable, entries, fn, that, ITERATOR) { + var iterFn = ITERATOR + ? function() { + return iterable; + } + : getIterFn(iterable), + f = ctx(fn, that, entries ? 2 : 1), + index = 0, + length, + step, + iterator, + result; + if (typeof iterFn != 'function') + throw TypeError(iterable + ' is not iterable!'); + // fast case for arrays with default iterator + if (isArrayIter(iterFn)) + for (length = toLength(iterable.length); length > index; index++) { + result = entries + ? f(anObject((step = iterable[index]))[0], step[1]) + : f(iterable[index]); + if (result === BREAK || result === RETURN) return result; + } + else + for (iterator = iterFn.call(iterable); !(step = iterator.next()).done; ) { + result = call(iterator, f, step.value, entries); + if (result === BREAK || result === RETURN) return result; + } + }); + exports.BREAK = BREAK; + exports.RETURN = RETURN; + + /***/ + }, + /* 207 */ + /***/ function(module, exports, __webpack_require__) { + // 7.3.20 SpeciesConstructor(O, defaultConstructor) + var anObject = __webpack_require__(12), + aFunction = __webpack_require__(21), + SPECIES = __webpack_require__(25)('species'); + module.exports = function(O, D) { + var C = anObject(O).constructor, + S; + return C === undefined || (S = anObject(C)[SPECIES]) == undefined + ? D + : aFunction(S); + }; + + /***/ + }, + /* 208 */ + /***/ function(module, exports, __webpack_require__) { + var ctx = __webpack_require__(20), + invoke = __webpack_require__(78), + html = __webpack_require__(48), + cel = __webpack_require__(15), + global = __webpack_require__(4), + process = global.process, + setTask = global.setImmediate, + clearTask = global.clearImmediate, + MessageChannel = global.MessageChannel, + counter = 0, + queue = {}, + ONREADYSTATECHANGE = 'onreadystatechange', + defer, + channel, + port; + var run = function() { + var id = +this; + if (queue.hasOwnProperty(id)) { + var fn = queue[id]; + delete queue[id]; + fn(); + } + }; + var listener = function(event) { + run.call(event.data); + }; + // Node.js 0.9+ & IE10+ has setImmediate, otherwise: + if (!setTask || !clearTask) { + setTask = function setImmediate(fn) { + var args = [], + i = 1; + while (arguments.length > i) args.push(arguments[i++]); + queue[++counter] = function() { + invoke(typeof fn == 'function' ? fn : Function(fn), args); + }; + defer(counter); + return counter; + }; + clearTask = function clearImmediate(id) { + delete queue[id]; + }; + // Node.js 0.8- + if (__webpack_require__(34)(process) == 'process') { + defer = function(id) { + process.nextTick(ctx(run, id, 1)); + }; + // Browsers with MessageChannel, includes WebWorkers + } else if (MessageChannel) { + channel = new MessageChannel(); + port = channel.port2; + channel.port1.onmessage = listener; + defer = ctx(port.postMessage, port, 1); + // Browsers with postMessage, skip WebWorkers + // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' + } else if ( + global.addEventListener && + typeof postMessage == 'function' && + !global.importScripts + ) { + defer = function(id) { + global.postMessage(id + '', '*'); + }; + global.addEventListener('message', listener, false); + // IE8- + } else if (ONREADYSTATECHANGE in cel('script')) { + defer = function(id) { + html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function() { + html.removeChild(this); + run.call(id); + }; + }; + // Rest old browsers + } else { + defer = function(id) { + setTimeout(ctx(run, id, 1), 0); + }; + } + } + module.exports = { + set: setTask, + clear: clearTask + }; + + /***/ + }, + /* 209 */ + /***/ function(module, exports, __webpack_require__) { + var global = __webpack_require__(4), + macrotask = __webpack_require__(208).set, + Observer = global.MutationObserver || global.WebKitMutationObserver, + process = global.process, + Promise = global.Promise, + isNode = __webpack_require__(34)(process) == 'process'; + + module.exports = function() { + var head, last, notify; + + var flush = function() { + var parent, fn; + if (isNode && (parent = process.domain)) parent.exit(); + while (head) { + fn = head.fn; + head = head.next; + try { + fn(); + } catch (e) { + if (head) notify(); + else last = undefined; + throw e; + } + } + last = undefined; + if (parent) parent.enter(); + }; + + // Node.js + if (isNode) { + notify = function() { + process.nextTick(flush); + }; + // browsers with MutationObserver + } else if (Observer) { + var toggle = true, + node = document.createTextNode(''); + new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new + notify = function() { + node.data = toggle = !toggle; + }; + // environments with maybe non-completely correct, but existent Promise + } else if (Promise && Promise.resolve) { + var promise = Promise.resolve(); + notify = function() { + promise.then(flush); + }; + // for other environments - macrotask based on: + // - setImmediate + // - MessageChannel + // - window.postMessag + // - onreadystatechange + // - setTimeout + } else { + notify = function() { + // strange IE + webpack dev server bug - use .call(global) + macrotask.call(global, flush); + }; + } + + return function(fn) { + var task = { fn: fn, next: undefined }; + if (last) last.next = task; + if (!head) { + head = task; + notify(); + } + last = task; + }; + }; + + /***/ + }, + /* 210 */ + /***/ function(module, exports, __webpack_require__) { + var redefine = __webpack_require__(18); + module.exports = function(target, src, safe) { + for (var key in src) redefine(target, key, src[key], safe); + return target; + }; + + /***/ + }, + /* 211 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var strong = __webpack_require__(212); + + // 23.1 Map Objects + module.exports = __webpack_require__(213)( + 'Map', + function(get) { + return function Map() { + return get(this, arguments.length > 0 ? arguments[0] : undefined); + }; + }, + { + // 23.1.3.6 Map.prototype.get(key) + get: function get(key) { + var entry = strong.getEntry(this, key); + return entry && entry.v; + }, + // 23.1.3.9 Map.prototype.set(key, value) + set: function set(key, value) { + return strong.def(this, key === 0 ? 0 : key, value); + } + }, + strong, + true + ); + + /***/ + }, + /* 212 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var dP = __webpack_require__(11).f, + create = __webpack_require__(46), + redefineAll = __webpack_require__(210), + ctx = __webpack_require__(20), + anInstance = __webpack_require__(205), + defined = __webpack_require__(35), + forOf = __webpack_require__(206), + $iterDefine = __webpack_require__(128), + step = __webpack_require__(194), + setSpecies = __webpack_require__(192), + DESCRIPTORS = __webpack_require__(6), + fastKey = __webpack_require__(22).fastKey, + SIZE = DESCRIPTORS ? '_s' : 'size'; + + var getEntry = function(that, key) { + // fast case + var index = fastKey(key), + entry; + if (index !== 'F') return that._i[index]; + // frozen object case + for (entry = that._f; entry; entry = entry.n) { + if (entry.k == key) return entry; + } + }; + + module.exports = { + getConstructor: function(wrapper, NAME, IS_MAP, ADDER) { + var C = wrapper(function(that, iterable) { + anInstance(that, C, NAME, '_i'); + that._i = create(null); // index + that._f = undefined; // first entry + that._l = undefined; // last entry + that[SIZE] = 0; // size + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + }); + redefineAll(C.prototype, { + // 23.1.3.1 Map.prototype.clear() + // 23.2.3.2 Set.prototype.clear() + clear: function clear() { + for ( + var that = this, data = that._i, entry = that._f; + entry; + entry = entry.n + ) { + entry.r = true; + if (entry.p) entry.p = entry.p.n = undefined; + delete data[entry.i]; + } + that._f = that._l = undefined; + that[SIZE] = 0; + }, + // 23.1.3.3 Map.prototype.delete(key) + // 23.2.3.4 Set.prototype.delete(value) + delete: function(key) { + var that = this, + entry = getEntry(that, key); + if (entry) { + var next = entry.n, + prev = entry.p; + delete that._i[entry.i]; + entry.r = true; + if (prev) prev.n = next; + if (next) next.p = prev; + if (that._f == entry) that._f = next; + if (that._l == entry) that._l = prev; + that[SIZE]--; + } + return !!entry; + }, + // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) + // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) + forEach: function forEach(callbackfn /*, that = undefined */) { + anInstance(this, C, 'forEach'); + var f = ctx( + callbackfn, + arguments.length > 1 ? arguments[1] : undefined, + 3 + ), + entry; + while ((entry = entry ? entry.n : this._f)) { + f(entry.v, entry.k, this); + // revert to the last existing entry + while (entry && entry.r) entry = entry.p; + } + }, + // 23.1.3.7 Map.prototype.has(key) + // 23.2.3.7 Set.prototype.has(value) + has: function has(key) { + return !!getEntry(this, key); + } + }); + if (DESCRIPTORS) + dP(C.prototype, 'size', { + get: function() { + return defined(this[SIZE]); + } + }); + return C; + }, + def: function(that, key, value) { + var entry = getEntry(that, key), + prev, + index; + // change existing entry + if (entry) { + entry.v = value; + // create new entry + } else { + that._l = entry = { + i: (index = fastKey(key, true)), // <- index + k: key, // <- key + v: value, // <- value + p: (prev = that._l), // <- previous entry + n: undefined, // <- next entry + r: false // <- removed + }; + if (!that._f) that._f = entry; + if (prev) prev.n = entry; + that[SIZE]++; + // add to index + if (index !== 'F') that._i[index] = entry; + } + return that; + }, + getEntry: getEntry, + setStrong: function(C, NAME, IS_MAP) { + // add .keys, .values, .entries, [@@iterator] + // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 + $iterDefine( + C, + NAME, + function(iterated, kind) { + this._t = iterated; // target + this._k = kind; // kind + this._l = undefined; // previous + }, + function() { + var that = this, + kind = that._k, + entry = that._l; + // revert to the last existing entry + while (entry && entry.r) entry = entry.p; + // get next entry + if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) { + // or finish the iteration + that._t = undefined; + return step(1); + } + // return step by kind + if (kind == 'keys') return step(0, entry.k); + if (kind == 'values') return step(0, entry.v); + return step(0, [entry.k, entry.v]); + }, + IS_MAP ? 'entries' : 'values', + !IS_MAP, + true + ); + + // add [@@species], 23.1.2.2, 23.2.2.2 + setSpecies(NAME); + } + }; + + /***/ + }, + /* 213 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var global = __webpack_require__(4), + $export = __webpack_require__(8), + redefine = __webpack_require__(18), + redefineAll = __webpack_require__(210), + meta = __webpack_require__(22), + forOf = __webpack_require__(206), + anInstance = __webpack_require__(205), + isObject = __webpack_require__(13), + fails = __webpack_require__(7), + $iterDetect = __webpack_require__(165), + setToStringTag = __webpack_require__(24), + inheritIfRequired = __webpack_require__(88); + + module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { + var Base = global[NAME], + C = Base, + ADDER = IS_MAP ? 'set' : 'add', + proto = C && C.prototype, + O = {}; + var fixMethod = function(KEY) { + var fn = proto[KEY]; + redefine( + proto, + KEY, + KEY == 'delete' + ? function(a) { + return IS_WEAK && !isObject(a) + ? false + : fn.call(this, a === 0 ? 0 : a); + } + : KEY == 'has' + ? function has(a) { + return IS_WEAK && !isObject(a) + ? false + : fn.call(this, a === 0 ? 0 : a); + } + : KEY == 'get' + ? function get(a) { + return IS_WEAK && !isObject(a) + ? undefined + : fn.call(this, a === 0 ? 0 : a); + } + : KEY == 'add' + ? function add(a) { + fn.call(this, a === 0 ? 0 : a); + return this; + } + : function set(a, b) { + fn.call(this, a === 0 ? 0 : a, b); + return this; + } + ); + }; + if ( + typeof C != 'function' || + !( + IS_WEAK || + (proto.forEach && + !fails(function() { + new C().entries().next(); + })) + ) + ) { + // create collection constructor + C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); + redefineAll(C.prototype, methods); + meta.NEED = true; + } else { + var instance = new C(), + // early implementations not supports chaining + HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance, + // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false + THROWS_ON_PRIMITIVES = fails(function() { + instance.has(1); + }), + // most early implementations doesn't supports iterables, most modern - not close it correctly + ACCEPT_ITERABLES = $iterDetect(function(iter) { + new C(iter); + }), // eslint-disable-line no-new + // for early implementations -0 and +0 not the same + BUGGY_ZERO = + !IS_WEAK && + fails(function() { + // V8 ~ Chromium 42- fails only with 5+ elements + var $instance = new C(), + index = 5; + while (index--) $instance[ADDER](index, index); + return !$instance.has(-0); + }); + if (!ACCEPT_ITERABLES) { + C = wrapper(function(target, iterable) { + anInstance(target, C, NAME); + var that = inheritIfRequired(new Base(), target, C); + if (iterable != undefined) + forOf(iterable, IS_MAP, that[ADDER], that); + return that; + }); + C.prototype = proto; + proto.constructor = C; + } + if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { + fixMethod('delete'); + fixMethod('has'); + IS_MAP && fixMethod('get'); + } + if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); + // weak collections should not contains .clear method + if (IS_WEAK && proto.clear) delete proto.clear; + } + + setToStringTag(C, NAME); + + O[NAME] = C; + $export($export.G + $export.W + $export.F * (C != Base), O); + + if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP); + + return C; + }; + + /***/ + }, + /* 214 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var strong = __webpack_require__(212); + + // 23.2 Set Objects + module.exports = __webpack_require__(213)( + 'Set', + function(get) { + return function Set() { + return get(this, arguments.length > 0 ? arguments[0] : undefined); + }; + }, + { + // 23.2.3.1 Set.prototype.add(value) + add: function add(value) { + return strong.def(this, (value = value === 0 ? 0 : value), value); + } + }, + strong + ); + + /***/ + }, + /* 215 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var each = __webpack_require__(172)(0), + redefine = __webpack_require__(18), + meta = __webpack_require__(22), + assign = __webpack_require__(69), + weak = __webpack_require__(216), + isObject = __webpack_require__(13), + getWeak = meta.getWeak, + isExtensible = Object.isExtensible, + uncaughtFrozenStore = weak.ufstore, + tmp = {}, + InternalMap; + + var wrapper = function(get) { + return function WeakMap() { + return get(this, arguments.length > 0 ? arguments[0] : undefined); + }; + }; + + var methods = { + // 23.3.3.3 WeakMap.prototype.get(key) + get: function get(key) { + if (isObject(key)) { + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(this).get(key); + return data ? data[this._i] : undefined; + } + }, + // 23.3.3.5 WeakMap.prototype.set(key, value) + set: function set(key, value) { + return weak.def(this, key, value); + } + }; + + // 23.3 WeakMap Objects + var $WeakMap = (module.exports = __webpack_require__(213)( + 'WeakMap', + wrapper, + methods, + weak, + true, + true + )); + + // IE11 WeakMap frozen keys fix + if (new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7) { + InternalMap = weak.getConstructor(wrapper); + assign(InternalMap.prototype, methods); + meta.NEED = true; + each(['delete', 'has', 'get', 'set'], function(key) { + var proto = $WeakMap.prototype, + method = proto[key]; + redefine(proto, key, function(a, b) { + // store frozen objects on internal weakmap shim + if (isObject(a) && !isExtensible(a)) { + if (!this._f) this._f = new InternalMap(); + var result = this._f[key](a, b); + return key == 'set' ? this : result; + // store all the rest on native weakmap + } + return method.call(this, a, b); + }); + }); + } + + /***/ + }, + /* 216 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var redefineAll = __webpack_require__(210), + getWeak = __webpack_require__(22).getWeak, + anObject = __webpack_require__(12), + isObject = __webpack_require__(13), + anInstance = __webpack_require__(205), + forOf = __webpack_require__(206), + createArrayMethod = __webpack_require__(172), + $has = __webpack_require__(5), + arrayFind = createArrayMethod(5), + arrayFindIndex = createArrayMethod(6), + id = 0; + + // fallback for uncaught frozen keys + var uncaughtFrozenStore = function(that) { + return that._l || (that._l = new UncaughtFrozenStore()); + }; + var UncaughtFrozenStore = function() { + this.a = []; + }; + var findUncaughtFrozen = function(store, key) { + return arrayFind(store.a, function(it) { + return it[0] === key; + }); + }; + UncaughtFrozenStore.prototype = { + get: function(key) { + var entry = findUncaughtFrozen(this, key); + if (entry) return entry[1]; + }, + has: function(key) { + return !!findUncaughtFrozen(this, key); + }, + set: function(key, value) { + var entry = findUncaughtFrozen(this, key); + if (entry) entry[1] = value; + else this.a.push([key, value]); + }, + delete: function(key) { + var index = arrayFindIndex(this.a, function(it) { + return it[0] === key; + }); + if (~index) this.a.splice(index, 1); + return !!~index; + } + }; + + module.exports = { + getConstructor: function(wrapper, NAME, IS_MAP, ADDER) { + var C = wrapper(function(that, iterable) { + anInstance(that, C, NAME, '_i'); + that._i = id++; // collection id + that._l = undefined; // leak store for uncaught frozen objects + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + }); + redefineAll(C.prototype, { + // 23.3.3.2 WeakMap.prototype.delete(key) + // 23.4.3.3 WeakSet.prototype.delete(value) + delete: function(key) { + if (!isObject(key)) return false; + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(this)['delete'](key); + return data && $has(data, this._i) && delete data[this._i]; + }, + // 23.3.3.4 WeakMap.prototype.has(key) + // 23.4.3.4 WeakSet.prototype.has(value) + has: function has(key) { + if (!isObject(key)) return false; + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(this).has(key); + return data && $has(data, this._i); + } + }); + return C; + }, + def: function(that, key, value) { + var data = getWeak(anObject(key), true); + if (data === true) uncaughtFrozenStore(that).set(key, value); + else data[that._i] = value; + return that; + }, + ufstore: uncaughtFrozenStore + }; + + /***/ + }, + /* 217 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var weak = __webpack_require__(216); + + // 23.4 WeakSet Objects + __webpack_require__(213)( + 'WeakSet', + function(get) { + return function WeakSet() { + return get(this, arguments.length > 0 ? arguments[0] : undefined); + }; + }, + { + // 23.4.3.1 WeakSet.prototype.add(value) + add: function add(value) { + return weak.def(this, value, true); + } + }, + weak, + false, + true + ); + + /***/ + }, + /* 218 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + $typed = __webpack_require__(219), + buffer = __webpack_require__(220), + anObject = __webpack_require__(12), + toIndex = __webpack_require__(39), + toLength = __webpack_require__(37), + isObject = __webpack_require__(13), + ArrayBuffer = __webpack_require__(4).ArrayBuffer, + speciesConstructor = __webpack_require__(207), + $ArrayBuffer = buffer.ArrayBuffer, + $DataView = buffer.DataView, + $isView = $typed.ABV && ArrayBuffer.isView, + $slice = $ArrayBuffer.prototype.slice, + VIEW = $typed.VIEW, + ARRAY_BUFFER = 'ArrayBuffer'; + + $export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), { + ArrayBuffer: $ArrayBuffer + }); + + $export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, { + // 24.1.3.1 ArrayBuffer.isView(arg) + isView: function isView(it) { + return ($isView && $isView(it)) || (isObject(it) && VIEW in it); + } + }); + + $export( + $export.P + + $export.U + + $export.F * + __webpack_require__(7)(function() { + return !new $ArrayBuffer(2).slice(1, undefined).byteLength; + }), + ARRAY_BUFFER, + { + // 24.1.4.3 ArrayBuffer.prototype.slice(start, end) + slice: function slice(start, end) { + if ($slice !== undefined && end === undefined) + return $slice.call(anObject(this), start); // FF fix + var len = anObject(this).byteLength, + first = toIndex(start, len), + final = toIndex(end === undefined ? len : end, len), + result = new (speciesConstructor(this, $ArrayBuffer))( + toLength(final - first) + ), + viewS = new $DataView(this), + viewT = new $DataView(result), + index = 0; + while (first < final) { + viewT.setUint8(index++, viewS.getUint8(first++)); + } + return result; + } + } + ); + + __webpack_require__(192)(ARRAY_BUFFER); + + /***/ + }, + /* 219 */ + /***/ function(module, exports, __webpack_require__) { + var global = __webpack_require__(4), + hide = __webpack_require__(10), + uid = __webpack_require__(19), + TYPED = uid('typed_array'), + VIEW = uid('view'), + ABV = !!(global.ArrayBuffer && global.DataView), + CONSTR = ABV, + i = 0, + l = 9, + Typed; + + var TypedArrayConstructors = 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array'.split( + ',' + ); + + while (i < l) { + if ((Typed = global[TypedArrayConstructors[i++]])) { + hide(Typed.prototype, TYPED, true); + hide(Typed.prototype, VIEW, true); + } else CONSTR = false; + } + + module.exports = { + ABV: ABV, + CONSTR: CONSTR, + TYPED: TYPED, + VIEW: VIEW + }; + + /***/ + }, + /* 220 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var global = __webpack_require__(4), + DESCRIPTORS = __webpack_require__(6), + LIBRARY = __webpack_require__(28), + $typed = __webpack_require__(219), + hide = __webpack_require__(10), + redefineAll = __webpack_require__(210), + fails = __webpack_require__(7), + anInstance = __webpack_require__(205), + toInteger = __webpack_require__(38), + toLength = __webpack_require__(37), + gOPN = __webpack_require__(50).f, + dP = __webpack_require__(11).f, + arrayFill = __webpack_require__(188), + setToStringTag = __webpack_require__(24), + ARRAY_BUFFER = 'ArrayBuffer', + DATA_VIEW = 'DataView', + PROTOTYPE = 'prototype', + WRONG_LENGTH = 'Wrong length!', + WRONG_INDEX = 'Wrong index!', + $ArrayBuffer = global[ARRAY_BUFFER], + $DataView = global[DATA_VIEW], + Math = global.Math, + RangeError = global.RangeError, + Infinity = global.Infinity, + BaseBuffer = $ArrayBuffer, + abs = Math.abs, + pow = Math.pow, + floor = Math.floor, + log = Math.log, + LN2 = Math.LN2, + BUFFER = 'buffer', + BYTE_LENGTH = 'byteLength', + BYTE_OFFSET = 'byteOffset', + $BUFFER = DESCRIPTORS ? '_b' : BUFFER, + $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH, + $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET; + + // IEEE754 conversions based on https://github.com/feross/ieee754 + var packIEEE754 = function(value, mLen, nBytes) { + var buffer = Array(nBytes), + eLen = nBytes * 8 - mLen - 1, + eMax = (1 << eLen) - 1, + eBias = eMax >> 1, + rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0, + i = 0, + s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0, + e, + m, + c; + value = abs(value); + if (value != value || value === Infinity) { + m = value != value ? 1 : 0; + e = eMax; + } else { + e = floor(log(value) / LN2); + if (value * (c = pow(2, -e)) < 1) { + e--; + c *= 2; + } + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * pow(2, 1 - eBias); + } + if (value * c >= 2) { + e++; + c /= 2; + } + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * pow(2, mLen); + e = e + eBias; + } else { + m = value * pow(2, eBias - 1) * pow(2, mLen); + e = 0; + } + } + for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8); + e = (e << mLen) | m; + eLen += mLen; + for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8); + buffer[--i] |= s * 128; + return buffer; + }; + var unpackIEEE754 = function(buffer, mLen, nBytes) { + var eLen = nBytes * 8 - mLen - 1, + eMax = (1 << eLen) - 1, + eBias = eMax >> 1, + nBits = eLen - 7, + i = nBytes - 1, + s = buffer[i--], + e = s & 127, + m; + s >>= 7; + for (; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8); + m = e & ((1 << -nBits) - 1); + e >>= -nBits; + nBits += mLen; + for (; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8); + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : s ? -Infinity : Infinity; + } else { + m = m + pow(2, mLen); + e = e - eBias; + } + return (s ? -1 : 1) * m * pow(2, e - mLen); + }; + + var unpackI32 = function(bytes) { + return (bytes[3] << 24) | (bytes[2] << 16) | (bytes[1] << 8) | bytes[0]; + }; + var packI8 = function(it) { + return [it & 0xff]; + }; + var packI16 = function(it) { + return [it & 0xff, (it >> 8) & 0xff]; + }; + var packI32 = function(it) { + return [it & 0xff, (it >> 8) & 0xff, (it >> 16) & 0xff, (it >> 24) & 0xff]; + }; + var packF64 = function(it) { + return packIEEE754(it, 52, 8); + }; + var packF32 = function(it) { + return packIEEE754(it, 23, 4); + }; + + var addGetter = function(C, key, internal) { + dP(C[PROTOTYPE], key, { + get: function() { + return this[internal]; + } + }); + }; + + var get = function(view, bytes, index, isLittleEndian) { + var numIndex = +index, + intIndex = toInteger(numIndex); + if (numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH]) + throw RangeError(WRONG_INDEX); + var store = view[$BUFFER]._b, + start = intIndex + view[$OFFSET], + pack = store.slice(start, start + bytes); + return isLittleEndian ? pack : pack.reverse(); + }; + var set = function(view, bytes, index, conversion, value, isLittleEndian) { + var numIndex = +index, + intIndex = toInteger(numIndex); + if (numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH]) + throw RangeError(WRONG_INDEX); + var store = view[$BUFFER]._b, + start = intIndex + view[$OFFSET], + pack = conversion(+value); + for (var i = 0; i < bytes; i++) + store[start + i] = pack[isLittleEndian ? i : bytes - i - 1]; + }; + + var validateArrayBufferArguments = function(that, length) { + anInstance(that, $ArrayBuffer, ARRAY_BUFFER); + var numberLength = +length, + byteLength = toLength(numberLength); + if (numberLength != byteLength) throw RangeError(WRONG_LENGTH); + return byteLength; + }; + + if (!$typed.ABV) { + $ArrayBuffer = function ArrayBuffer(length) { + var byteLength = validateArrayBufferArguments(this, length); + this._b = arrayFill.call(Array(byteLength), 0); + this[$LENGTH] = byteLength; + }; + + $DataView = function DataView(buffer, byteOffset, byteLength) { + anInstance(this, $DataView, DATA_VIEW); + anInstance(buffer, $ArrayBuffer, DATA_VIEW); + var bufferLength = buffer[$LENGTH], + offset = toInteger(byteOffset); + if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset!'); + byteLength = + byteLength === undefined ? bufferLength - offset : toLength(byteLength); + if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH); + this[$BUFFER] = buffer; + this[$OFFSET] = offset; + this[$LENGTH] = byteLength; + }; + + if (DESCRIPTORS) { + addGetter($ArrayBuffer, BYTE_LENGTH, '_l'); + addGetter($DataView, BUFFER, '_b'); + addGetter($DataView, BYTE_LENGTH, '_l'); + addGetter($DataView, BYTE_OFFSET, '_o'); + } + + redefineAll($DataView[PROTOTYPE], { + getInt8: function getInt8(byteOffset) { + return (get(this, 1, byteOffset)[0] << 24) >> 24; + }, + getUint8: function getUint8(byteOffset) { + return get(this, 1, byteOffset)[0]; + }, + getInt16: function getInt16(byteOffset /*, littleEndian */) { + var bytes = get(this, 2, byteOffset, arguments[1]); + return (((bytes[1] << 8) | bytes[0]) << 16) >> 16; + }, + getUint16: function getUint16(byteOffset /*, littleEndian */) { + var bytes = get(this, 2, byteOffset, arguments[1]); + return (bytes[1] << 8) | bytes[0]; + }, + getInt32: function getInt32(byteOffset /*, littleEndian */) { + return unpackI32(get(this, 4, byteOffset, arguments[1])); + }, + getUint32: function getUint32(byteOffset /*, littleEndian */) { + return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0; + }, + getFloat32: function getFloat32(byteOffset /*, littleEndian */) { + return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4); + }, + getFloat64: function getFloat64(byteOffset /*, littleEndian */) { + return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8); + }, + setInt8: function setInt8(byteOffset, value) { + set(this, 1, byteOffset, packI8, value); + }, + setUint8: function setUint8(byteOffset, value) { + set(this, 1, byteOffset, packI8, value); + }, + setInt16: function setInt16(byteOffset, value /*, littleEndian */) { + set(this, 2, byteOffset, packI16, value, arguments[2]); + }, + setUint16: function setUint16(byteOffset, value /*, littleEndian */) { + set(this, 2, byteOffset, packI16, value, arguments[2]); + }, + setInt32: function setInt32(byteOffset, value /*, littleEndian */) { + set(this, 4, byteOffset, packI32, value, arguments[2]); + }, + setUint32: function setUint32(byteOffset, value /*, littleEndian */) { + set(this, 4, byteOffset, packI32, value, arguments[2]); + }, + setFloat32: function setFloat32(byteOffset, value /*, littleEndian */) { + set(this, 4, byteOffset, packF32, value, arguments[2]); + }, + setFloat64: function setFloat64(byteOffset, value /*, littleEndian */) { + set(this, 8, byteOffset, packF64, value, arguments[2]); + } + }); + } else { + if ( + !fails(function() { + new $ArrayBuffer(); // eslint-disable-line no-new + }) || + !fails(function() { + new $ArrayBuffer(0.5); // eslint-disable-line no-new + }) + ) { + $ArrayBuffer = function ArrayBuffer(length) { + return new BaseBuffer(validateArrayBufferArguments(this, length)); + }; + var ArrayBufferProto = ($ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE]); + for (var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j; ) { + if (!((key = keys[j++]) in $ArrayBuffer)) + hide($ArrayBuffer, key, BaseBuffer[key]); + } + if (!LIBRARY) ArrayBufferProto.constructor = $ArrayBuffer; + } + // iOS Safari 7.x bug + var view = new $DataView(new $ArrayBuffer(2)), + $setInt8 = $DataView[PROTOTYPE].setInt8; + view.setInt8(0, 2147483648); + view.setInt8(1, 2147483649); + if (view.getInt8(0) || !view.getInt8(1)) + redefineAll( + $DataView[PROTOTYPE], + { + setInt8: function setInt8(byteOffset, value) { + $setInt8.call(this, byteOffset, (value << 24) >> 24); + }, + setUint8: function setUint8(byteOffset, value) { + $setInt8.call(this, byteOffset, (value << 24) >> 24); + } + }, + true + ); + } + setToStringTag($ArrayBuffer, ARRAY_BUFFER); + setToStringTag($DataView, DATA_VIEW); + hide($DataView[PROTOTYPE], $typed.VIEW, true); + exports[ARRAY_BUFFER] = $ArrayBuffer; + exports[DATA_VIEW] = $DataView; + + /***/ + }, + /* 221 */ + /***/ function(module, exports, __webpack_require__) { + var $export = __webpack_require__(8); + $export($export.G + $export.W + $export.F * !__webpack_require__(219).ABV, { + DataView: __webpack_require__(220).DataView + }); + + /***/ + }, + /* 222 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(223)('Int8', 1, function(init) { + return function Int8Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; + }); + + /***/ + }, + /* 223 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + if (__webpack_require__(6)) { + var LIBRARY = __webpack_require__(28), + global = __webpack_require__(4), + fails = __webpack_require__(7), + $export = __webpack_require__(8), + $typed = __webpack_require__(219), + $buffer = __webpack_require__(220), + ctx = __webpack_require__(20), + anInstance = __webpack_require__(205), + propertyDesc = __webpack_require__(17), + hide = __webpack_require__(10), + redefineAll = __webpack_require__(210), + toInteger = __webpack_require__(38), + toLength = __webpack_require__(37), + toIndex = __webpack_require__(39), + toPrimitive = __webpack_require__(16), + has = __webpack_require__(5), + same = __webpack_require__(71), + classof = __webpack_require__(75), + isObject = __webpack_require__(13), + toObject = __webpack_require__(58), + isArrayIter = __webpack_require__(162), + create = __webpack_require__(46), + getPrototypeOf = __webpack_require__(59), + gOPN = __webpack_require__(50).f, + getIterFn = __webpack_require__(164), + uid = __webpack_require__(19), + wks = __webpack_require__(25), + createArrayMethod = __webpack_require__(172), + createArrayIncludes = __webpack_require__(36), + speciesConstructor = __webpack_require__(207), + ArrayIterators = __webpack_require__(193), + Iterators = __webpack_require__(129), + $iterDetect = __webpack_require__(165), + setSpecies = __webpack_require__(192), + arrayFill = __webpack_require__(188), + arrayCopyWithin = __webpack_require__(185), + $DP = __webpack_require__(11), + $GOPD = __webpack_require__(51), + dP = $DP.f, + gOPD = $GOPD.f, + RangeError = global.RangeError, + TypeError = global.TypeError, + Uint8Array = global.Uint8Array, + ARRAY_BUFFER = 'ArrayBuffer', + SHARED_BUFFER = 'Shared' + ARRAY_BUFFER, + BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT', + PROTOTYPE = 'prototype', + ArrayProto = Array[PROTOTYPE], + $ArrayBuffer = $buffer.ArrayBuffer, + $DataView = $buffer.DataView, + arrayForEach = createArrayMethod(0), + arrayFilter = createArrayMethod(2), + arraySome = createArrayMethod(3), + arrayEvery = createArrayMethod(4), + arrayFind = createArrayMethod(5), + arrayFindIndex = createArrayMethod(6), + arrayIncludes = createArrayIncludes(true), + arrayIndexOf = createArrayIncludes(false), + arrayValues = ArrayIterators.values, + arrayKeys = ArrayIterators.keys, + arrayEntries = ArrayIterators.entries, + arrayLastIndexOf = ArrayProto.lastIndexOf, + arrayReduce = ArrayProto.reduce, + arrayReduceRight = ArrayProto.reduceRight, + arrayJoin = ArrayProto.join, + arraySort = ArrayProto.sort, + arraySlice = ArrayProto.slice, + arrayToString = ArrayProto.toString, + arrayToLocaleString = ArrayProto.toLocaleString, + ITERATOR = wks('iterator'), + TAG = wks('toStringTag'), + TYPED_CONSTRUCTOR = uid('typed_constructor'), + DEF_CONSTRUCTOR = uid('def_constructor'), + ALL_CONSTRUCTORS = $typed.CONSTR, + TYPED_ARRAY = $typed.TYPED, + VIEW = $typed.VIEW, + WRONG_LENGTH = 'Wrong length!'; + + var $map = createArrayMethod(1, function(O, length) { + return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length); + }); + + var LITTLE_ENDIAN = fails(function() { + return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1; + }); + + var FORCED_SET = + !!Uint8Array && + !!Uint8Array[PROTOTYPE].set && + fails(function() { + new Uint8Array(1).set({}); + }); + + var strictToLength = function(it, SAME) { + if (it === undefined) throw TypeError(WRONG_LENGTH); + var number = +it, + length = toLength(it); + if (SAME && !same(number, length)) throw RangeError(WRONG_LENGTH); + return length; + }; + + var toOffset = function(it, BYTES) { + var offset = toInteger(it); + if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset!'); + return offset; + }; + + var validate = function(it) { + if (isObject(it) && TYPED_ARRAY in it) return it; + throw TypeError(it + ' is not a typed array!'); + }; + + var allocate = function(C, length) { + if (!(isObject(C) && TYPED_CONSTRUCTOR in C)) { + throw TypeError('It is not a typed array constructor!'); + } + return new C(length); + }; + + var speciesFromList = function(O, list) { + return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list); + }; + + var fromList = function(C, list) { + var index = 0, + length = list.length, + result = allocate(C, length); + while (length > index) result[index] = list[index++]; + return result; + }; + + var addGetter = function(it, key, internal) { + dP(it, key, { + get: function() { + return this._d[internal]; + } + }); + }; + + var $from = function from(source /*, mapfn, thisArg */) { + var O = toObject(source), + aLen = arguments.length, + mapfn = aLen > 1 ? arguments[1] : undefined, + mapping = mapfn !== undefined, + iterFn = getIterFn(O), + i, + length, + values, + result, + step, + iterator; + if (iterFn != undefined && !isArrayIter(iterFn)) { + for ( + iterator = iterFn.call(O), values = [], i = 0; + !(step = iterator.next()).done; + i++ + ) { + values.push(step.value); + } + O = values; + } + if (mapping && aLen > 2) mapfn = ctx(mapfn, arguments[2], 2); + for ( + i = 0, length = toLength(O.length), result = allocate(this, length); + length > i; + i++ + ) { + result[i] = mapping ? mapfn(O[i], i) : O[i]; + } + return result; + }; + + var $of = function of(/*...items*/) { + var index = 0, + length = arguments.length, + result = allocate(this, length); + while (length > index) result[index] = arguments[index++]; + return result; + }; + + // iOS Safari 6.x fails here + var TO_LOCALE_BUG = + !!Uint8Array && + fails(function() { + arrayToLocaleString.call(new Uint8Array(1)); + }); + + var $toLocaleString = function toLocaleString() { + return arrayToLocaleString.apply( + TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), + arguments + ); + }; + + var proto = { + copyWithin: function copyWithin(target, start /*, end */) { + return arrayCopyWithin.call( + validate(this), + target, + start, + arguments.length > 2 ? arguments[2] : undefined + ); + }, + every: function every(callbackfn /*, thisArg */) { + return arrayEvery( + validate(this), + callbackfn, + arguments.length > 1 ? arguments[1] : undefined + ); + }, + fill: function fill(value /*, start, end */) { + // eslint-disable-line no-unused-vars + return arrayFill.apply(validate(this), arguments); + }, + filter: function filter(callbackfn /*, thisArg */) { + return speciesFromList( + this, + arrayFilter( + validate(this), + callbackfn, + arguments.length > 1 ? arguments[1] : undefined + ) + ); + }, + find: function find(predicate /*, thisArg */) { + return arrayFind( + validate(this), + predicate, + arguments.length > 1 ? arguments[1] : undefined + ); + }, + findIndex: function findIndex(predicate /*, thisArg */) { + return arrayFindIndex( + validate(this), + predicate, + arguments.length > 1 ? arguments[1] : undefined + ); + }, + forEach: function forEach(callbackfn /*, thisArg */) { + arrayForEach( + validate(this), + callbackfn, + arguments.length > 1 ? arguments[1] : undefined + ); + }, + indexOf: function indexOf(searchElement /*, fromIndex */) { + return arrayIndexOf( + validate(this), + searchElement, + arguments.length > 1 ? arguments[1] : undefined + ); + }, + includes: function includes(searchElement /*, fromIndex */) { + return arrayIncludes( + validate(this), + searchElement, + arguments.length > 1 ? arguments[1] : undefined + ); + }, + join: function join(separator) { + // eslint-disable-line no-unused-vars + return arrayJoin.apply(validate(this), arguments); + }, + lastIndexOf: function lastIndexOf(searchElement /*, fromIndex */) { + // eslint-disable-line no-unused-vars + return arrayLastIndexOf.apply(validate(this), arguments); + }, + map: function map(mapfn /*, thisArg */) { + return $map( + validate(this), + mapfn, + arguments.length > 1 ? arguments[1] : undefined + ); + }, + reduce: function reduce(callbackfn /*, initialValue */) { + // eslint-disable-line no-unused-vars + return arrayReduce.apply(validate(this), arguments); + }, + reduceRight: function reduceRight(callbackfn /*, initialValue */) { + // eslint-disable-line no-unused-vars + return arrayReduceRight.apply(validate(this), arguments); + }, + reverse: function reverse() { + var that = this, + length = validate(that).length, + middle = Math.floor(length / 2), + index = 0, + value; + while (index < middle) { + value = that[index]; + that[index++] = that[--length]; + that[length] = value; + } + return that; + }, + some: function some(callbackfn /*, thisArg */) { + return arraySome( + validate(this), + callbackfn, + arguments.length > 1 ? arguments[1] : undefined + ); + }, + sort: function sort(comparefn) { + return arraySort.call(validate(this), comparefn); + }, + subarray: function subarray(begin, end) { + var O = validate(this), + length = O.length, + $begin = toIndex(begin, length); + return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))( + O.buffer, + O.byteOffset + $begin * O.BYTES_PER_ELEMENT, + toLength( + (end === undefined ? length : toIndex(end, length)) - $begin + ) + ); + } + }; + + var $slice = function slice(start, end) { + return speciesFromList(this, arraySlice.call(validate(this), start, end)); + }; + + var $set = function set(arrayLike /*, offset */) { + validate(this); + var offset = toOffset(arguments[1], 1), + length = this.length, + src = toObject(arrayLike), + len = toLength(src.length), + index = 0; + if (len + offset > length) throw RangeError(WRONG_LENGTH); + while (index < len) this[offset + index] = src[index++]; + }; + + var $iterators = { + entries: function entries() { + return arrayEntries.call(validate(this)); + }, + keys: function keys() { + return arrayKeys.call(validate(this)); + }, + values: function values() { + return arrayValues.call(validate(this)); + } + }; + + var isTAIndex = function(target, key) { + return ( + isObject(target) && + target[TYPED_ARRAY] && + typeof key != 'symbol' && + key in target && + String(+key) == String(key) + ); + }; + var $getDesc = function getOwnPropertyDescriptor(target, key) { + return isTAIndex(target, (key = toPrimitive(key, true))) + ? propertyDesc(2, target[key]) + : gOPD(target, key); + }; + var $setDesc = function defineProperty(target, key, desc) { + if ( + isTAIndex(target, (key = toPrimitive(key, true))) && + isObject(desc) && + has(desc, 'value') && + !has(desc, 'get') && + !has(desc, 'set') && + // TODO: add validation descriptor w/o calling accessors + !desc.configurable && + (!has(desc, 'writable') || desc.writable) && + (!has(desc, 'enumerable') || desc.enumerable) + ) { + target[key] = desc.value; + return target; + } else return dP(target, key, desc); + }; + + if (!ALL_CONSTRUCTORS) { + $GOPD.f = $getDesc; + $DP.f = $setDesc; + } + + $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', { + getOwnPropertyDescriptor: $getDesc, + defineProperty: $setDesc + }); + + if ( + fails(function() { + arrayToString.call({}); + }) + ) { + arrayToString = arrayToLocaleString = function toString() { + return arrayJoin.call(this); + }; + } + + var $TypedArrayPrototype$ = redefineAll({}, proto); + redefineAll($TypedArrayPrototype$, $iterators); + hide($TypedArrayPrototype$, ITERATOR, $iterators.values); + redefineAll($TypedArrayPrototype$, { + slice: $slice, + set: $set, + constructor: function() { + /* noop */ + }, + toString: arrayToString, + toLocaleString: $toLocaleString + }); + addGetter($TypedArrayPrototype$, 'buffer', 'b'); + addGetter($TypedArrayPrototype$, 'byteOffset', 'o'); + addGetter($TypedArrayPrototype$, 'byteLength', 'l'); + addGetter($TypedArrayPrototype$, 'length', 'e'); + dP($TypedArrayPrototype$, TAG, { + get: function() { + return this[TYPED_ARRAY]; + } + }); + + module.exports = function(KEY, BYTES, wrapper, CLAMPED) { + CLAMPED = !!CLAMPED; + var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array', + ISNT_UINT8 = NAME != 'Uint8Array', + GETTER = 'get' + KEY, + SETTER = 'set' + KEY, + TypedArray = global[NAME], + Base = TypedArray || {}, + TAC = TypedArray && getPrototypeOf(TypedArray), + FORCED = !TypedArray || !$typed.ABV, + O = {}, + TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE]; + var getter = function(that, index) { + var data = that._d; + return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN); + }; + var setter = function(that, index, value) { + var data = that._d; + if (CLAMPED) + value = + (value = Math.round(value)) < 0 + ? 0 + : value > 0xff ? 0xff : value & 0xff; + data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN); + }; + var addElement = function(that, index) { + dP(that, index, { + get: function() { + return getter(this, index); + }, + set: function(value) { + return setter(this, index, value); + }, + enumerable: true + }); + }; + if (FORCED) { + TypedArray = wrapper(function(that, data, $offset, $length) { + anInstance(that, TypedArray, NAME, '_d'); + var index = 0, + offset = 0, + buffer, + byteLength, + length, + klass; + if (!isObject(data)) { + length = strictToLength(data, true); + byteLength = length * BYTES; + buffer = new $ArrayBuffer(byteLength); + } else if ( + data instanceof $ArrayBuffer || + (klass = classof(data)) == ARRAY_BUFFER || + klass == SHARED_BUFFER + ) { + buffer = data; + offset = toOffset($offset, BYTES); + var $len = data.byteLength; + if ($length === undefined) { + if ($len % BYTES) throw RangeError(WRONG_LENGTH); + byteLength = $len - offset; + if (byteLength < 0) throw RangeError(WRONG_LENGTH); + } else { + byteLength = toLength($length) * BYTES; + if (byteLength + offset > $len) + throw RangeError(WRONG_LENGTH); + } + length = byteLength / BYTES; + } else if (TYPED_ARRAY in data) { + return fromList(TypedArray, data); + } else { + return $from.call(TypedArray, data); + } + hide(that, '_d', { + b: buffer, + o: offset, + l: byteLength, + e: length, + v: new $DataView(buffer) + }); + while (index < length) addElement(that, index++); + }); + TypedArrayPrototype = TypedArray[PROTOTYPE] = create( + $TypedArrayPrototype$ + ); + hide(TypedArrayPrototype, 'constructor', TypedArray); + } else if ( + !$iterDetect(function(iter) { + // V8 works with iterators, but fails in many other cases + // https://code.google.com/p/v8/issues/detail?id=4552 + new TypedArray(null); // eslint-disable-line no-new + new TypedArray(iter); // eslint-disable-line no-new + }, true) + ) { + TypedArray = wrapper(function(that, data, $offset, $length) { + anInstance(that, TypedArray, NAME); + var klass; + // `ws` module bug, temporarily remove validation length for Uint8Array + // https://github.com/websockets/ws/pull/645 + if (!isObject(data)) + return new Base(strictToLength(data, ISNT_UINT8)); + if ( + data instanceof $ArrayBuffer || + (klass = classof(data)) == ARRAY_BUFFER || + klass == SHARED_BUFFER + ) { + return $length !== undefined + ? new Base(data, toOffset($offset, BYTES), $length) + : $offset !== undefined + ? new Base(data, toOffset($offset, BYTES)) + : new Base(data); + } + if (TYPED_ARRAY in data) return fromList(TypedArray, data); + return $from.call(TypedArray, data); + }); + arrayForEach( + TAC !== Function.prototype + ? gOPN(Base).concat(gOPN(TAC)) + : gOPN(Base), + function(key) { + if (!(key in TypedArray)) hide(TypedArray, key, Base[key]); + } + ); + TypedArray[PROTOTYPE] = TypedArrayPrototype; + if (!LIBRARY) TypedArrayPrototype.constructor = TypedArray; + } + var $nativeIterator = TypedArrayPrototype[ITERATOR], + CORRECT_ITER_NAME = + !!$nativeIterator && + ($nativeIterator.name == 'values' || + $nativeIterator.name == undefined), + $iterator = $iterators.values; + hide(TypedArray, TYPED_CONSTRUCTOR, true); + hide(TypedArrayPrototype, TYPED_ARRAY, NAME); + hide(TypedArrayPrototype, VIEW, true); + hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray); + + if ( + CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype) + ) { + dP(TypedArrayPrototype, TAG, { + get: function() { + return NAME; + } + }); + } + + O[NAME] = TypedArray; + + $export($export.G + $export.W + $export.F * (TypedArray != Base), O); + + $export($export.S, NAME, { + BYTES_PER_ELEMENT: BYTES, + from: $from, + of: $of + }); + + if (!(BYTES_PER_ELEMENT in TypedArrayPrototype)) + hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES); + + $export($export.P, NAME, proto); + + setSpecies(NAME); + + $export($export.P + $export.F * FORCED_SET, NAME, { set: $set }); + + $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators); + + $export( + $export.P + $export.F * (TypedArrayPrototype.toString != arrayToString), + NAME, + { toString: arrayToString } + ); + + $export( + $export.P + + $export.F * + fails(function() { + new TypedArray(1).slice(); + }), + NAME, + { slice: $slice } + ); + + $export( + $export.P + + $export.F * + (fails(function() { + return ( + [1, 2].toLocaleString() != + new TypedArray([1, 2]).toLocaleString() + ); + }) || + !fails(function() { + TypedArrayPrototype.toLocaleString.call([1, 2]); + })), + NAME, + { toLocaleString: $toLocaleString } + ); + + Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator; + if (!LIBRARY && !CORRECT_ITER_NAME) + hide(TypedArrayPrototype, ITERATOR, $iterator); + }; + } else + module.exports = function() { + /* empty */ + }; + + /***/ + }, + /* 224 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(223)('Uint8', 1, function(init) { + return function Uint8Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; + }); + + /***/ + }, + /* 225 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(223)( + 'Uint8', + 1, + function(init) { + return function Uint8ClampedArray(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; + }, + true + ); + + /***/ + }, + /* 226 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(223)('Int16', 2, function(init) { + return function Int16Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; + }); + + /***/ + }, + /* 227 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(223)('Uint16', 2, function(init) { + return function Uint16Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; + }); + + /***/ + }, + /* 228 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(223)('Int32', 4, function(init) { + return function Int32Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; + }); + + /***/ + }, + /* 229 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(223)('Uint32', 4, function(init) { + return function Uint32Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; + }); + + /***/ + }, + /* 230 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(223)('Float32', 4, function(init) { + return function Float32Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; + }); + + /***/ + }, + /* 231 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(223)('Float64', 8, function(init) { + return function Float64Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; + }); + + /***/ + }, + /* 232 */ + /***/ function(module, exports, __webpack_require__) { + // 26.1.1 Reflect.apply(target, thisArgument, argumentsList) + var $export = __webpack_require__(8), + aFunction = __webpack_require__(21), + anObject = __webpack_require__(12), + rApply = (__webpack_require__(4).Reflect || {}).apply, + fApply = Function.apply; + // MS Edge argumentsList argument is optional + $export( + $export.S + + $export.F * + !__webpack_require__(7)(function() { + rApply(function() {}); + }), + 'Reflect', + { + apply: function apply(target, thisArgument, argumentsList) { + var T = aFunction(target), + L = anObject(argumentsList); + return rApply + ? rApply(T, thisArgument, L) + : fApply.call(T, thisArgument, L); + } + } + ); + + /***/ + }, + /* 233 */ + /***/ function(module, exports, __webpack_require__) { + // 26.1.2 Reflect.construct(target, argumentsList [, newTarget]) + var $export = __webpack_require__(8), + create = __webpack_require__(46), + aFunction = __webpack_require__(21), + anObject = __webpack_require__(12), + isObject = __webpack_require__(13), + fails = __webpack_require__(7), + bind = __webpack_require__(77), + rConstruct = (__webpack_require__(4).Reflect || {}).construct; + + // MS Edge supports only 2 arguments and argumentsList argument is optional + // FF Nightly sets third argument as `new.target`, but does not create `this` from it + var NEW_TARGET_BUG = fails(function() { + function F() {} + return !(rConstruct(function() {}, [], F) instanceof F); + }); + var ARGS_BUG = !fails(function() { + rConstruct(function() {}); + }); + + $export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', { + construct: function construct(Target, args /*, newTarget*/) { + aFunction(Target); + anObject(args); + var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]); + if (ARGS_BUG && !NEW_TARGET_BUG) return rConstruct(Target, args, newTarget); + if (Target == newTarget) { + // w/o altered newTarget, optimization for 0-4 arguments + switch (args.length) { + case 0: + return new Target(); + case 1: + return new Target(args[0]); + case 2: + return new Target(args[0], args[1]); + case 3: + return new Target(args[0], args[1], args[2]); + case 4: + return new Target(args[0], args[1], args[2], args[3]); + } + // w/o altered newTarget, lot of arguments case + var $args = [null]; + $args.push.apply($args, args); + return new (bind.apply(Target, $args))(); + } + // with altered newTarget, not support built-in constructors + var proto = newTarget.prototype, + instance = create(isObject(proto) ? proto : Object.prototype), + result = Function.apply.call(Target, instance, args); + return isObject(result) ? result : instance; + } + }); + + /***/ + }, + /* 234 */ + /***/ function(module, exports, __webpack_require__) { + // 26.1.3 Reflect.defineProperty(target, propertyKey, attributes) + var dP = __webpack_require__(11), + $export = __webpack_require__(8), + anObject = __webpack_require__(12), + toPrimitive = __webpack_require__(16); + + // MS Edge has broken Reflect.defineProperty - throwing instead of returning false + $export( + $export.S + + $export.F * + __webpack_require__(7)(function() { + Reflect.defineProperty(dP.f({}, 1, { value: 1 }), 1, { value: 2 }); + }), + 'Reflect', + { + defineProperty: function defineProperty(target, propertyKey, attributes) { + anObject(target); + propertyKey = toPrimitive(propertyKey, true); + anObject(attributes); + try { + dP.f(target, propertyKey, attributes); + return true; + } catch (e) { + return false; + } + } + } + ); + + /***/ + }, + /* 235 */ + /***/ function(module, exports, __webpack_require__) { + // 26.1.4 Reflect.deleteProperty(target, propertyKey) + var $export = __webpack_require__(8), + gOPD = __webpack_require__(51).f, + anObject = __webpack_require__(12); + + $export($export.S, 'Reflect', { + deleteProperty: function deleteProperty(target, propertyKey) { + var desc = gOPD(anObject(target), propertyKey); + return desc && !desc.configurable ? false : delete target[propertyKey]; + } + }); + + /***/ + }, + /* 236 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // 26.1.5 Reflect.enumerate(target) + var $export = __webpack_require__(8), + anObject = __webpack_require__(12); + var Enumerate = function(iterated) { + this._t = anObject(iterated); // target + this._i = 0; // next index + var keys = (this._k = []), // keys + key; + for (key in iterated) keys.push(key); + }; + __webpack_require__(130)(Enumerate, 'Object', function() { + var that = this, + keys = that._k, + key; + do { + if (that._i >= keys.length) return { value: undefined, done: true }; + } while (!((key = keys[that._i++]) in that._t)); + return { value: key, done: false }; + }); + + $export($export.S, 'Reflect', { + enumerate: function enumerate(target) { + return new Enumerate(target); + } + }); + + /***/ + }, + /* 237 */ + /***/ function(module, exports, __webpack_require__) { + // 26.1.6 Reflect.get(target, propertyKey [, receiver]) + var gOPD = __webpack_require__(51), + getPrototypeOf = __webpack_require__(59), + has = __webpack_require__(5), + $export = __webpack_require__(8), + isObject = __webpack_require__(13), + anObject = __webpack_require__(12); + + function get(target, propertyKey /*, receiver*/) { + var receiver = arguments.length < 3 ? target : arguments[2], + desc, + proto; + if (anObject(target) === receiver) return target[propertyKey]; + if ((desc = gOPD.f(target, propertyKey))) + return has(desc, 'value') + ? desc.value + : desc.get !== undefined ? desc.get.call(receiver) : undefined; + if (isObject((proto = getPrototypeOf(target)))) + return get(proto, propertyKey, receiver); + } + + $export($export.S, 'Reflect', { get: get }); + + /***/ + }, + /* 238 */ + /***/ function(module, exports, __webpack_require__) { + // 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey) + var gOPD = __webpack_require__(51), + $export = __webpack_require__(8), + anObject = __webpack_require__(12); + + $export($export.S, 'Reflect', { + getOwnPropertyDescriptor: function getOwnPropertyDescriptor( + target, + propertyKey + ) { + return gOPD.f(anObject(target), propertyKey); + } + }); + + /***/ + }, + /* 239 */ + /***/ function(module, exports, __webpack_require__) { + // 26.1.8 Reflect.getPrototypeOf(target) + var $export = __webpack_require__(8), + getProto = __webpack_require__(59), + anObject = __webpack_require__(12); + + $export($export.S, 'Reflect', { + getPrototypeOf: function getPrototypeOf(target) { + return getProto(anObject(target)); + } + }); + + /***/ + }, + /* 240 */ + /***/ function(module, exports, __webpack_require__) { + // 26.1.9 Reflect.has(target, propertyKey) + var $export = __webpack_require__(8); + + $export($export.S, 'Reflect', { + has: function has(target, propertyKey) { + return propertyKey in target; + } + }); + + /***/ + }, + /* 241 */ + /***/ function(module, exports, __webpack_require__) { + // 26.1.10 Reflect.isExtensible(target) + var $export = __webpack_require__(8), + anObject = __webpack_require__(12), + $isExtensible = Object.isExtensible; + + $export($export.S, 'Reflect', { + isExtensible: function isExtensible(target) { + anObject(target); + return $isExtensible ? $isExtensible(target) : true; + } + }); + + /***/ + }, + /* 242 */ + /***/ function(module, exports, __webpack_require__) { + // 26.1.11 Reflect.ownKeys(target) + var $export = __webpack_require__(8); + + $export($export.S, 'Reflect', { ownKeys: __webpack_require__(243) }); + + /***/ + }, + /* 243 */ + /***/ function(module, exports, __webpack_require__) { + // all object keys, includes non-enumerable and symbols + var gOPN = __webpack_require__(50), + gOPS = __webpack_require__(43), + anObject = __webpack_require__(12), + Reflect = __webpack_require__(4).Reflect; + module.exports = + (Reflect && Reflect.ownKeys) || + function ownKeys(it) { + var keys = gOPN.f(anObject(it)), + getSymbols = gOPS.f; + return getSymbols ? keys.concat(getSymbols(it)) : keys; + }; + + /***/ + }, + /* 244 */ + /***/ function(module, exports, __webpack_require__) { + // 26.1.12 Reflect.preventExtensions(target) + var $export = __webpack_require__(8), + anObject = __webpack_require__(12), + $preventExtensions = Object.preventExtensions; + + $export($export.S, 'Reflect', { + preventExtensions: function preventExtensions(target) { + anObject(target); + try { + if ($preventExtensions) $preventExtensions(target); + return true; + } catch (e) { + return false; + } + } + }); + + /***/ + }, + /* 245 */ + /***/ function(module, exports, __webpack_require__) { + // 26.1.13 Reflect.set(target, propertyKey, V [, receiver]) + var dP = __webpack_require__(11), + gOPD = __webpack_require__(51), + getPrototypeOf = __webpack_require__(59), + has = __webpack_require__(5), + $export = __webpack_require__(8), + createDesc = __webpack_require__(17), + anObject = __webpack_require__(12), + isObject = __webpack_require__(13); + + function set(target, propertyKey, V /*, receiver*/) { + var receiver = arguments.length < 4 ? target : arguments[3], + ownDesc = gOPD.f(anObject(target), propertyKey), + existingDescriptor, + proto; + if (!ownDesc) { + if (isObject((proto = getPrototypeOf(target)))) { + return set(proto, propertyKey, V, receiver); + } + ownDesc = createDesc(0); + } + if (has(ownDesc, 'value')) { + if (ownDesc.writable === false || !isObject(receiver)) return false; + existingDescriptor = gOPD.f(receiver, propertyKey) || createDesc(0); + existingDescriptor.value = V; + dP.f(receiver, propertyKey, existingDescriptor); + return true; + } + return ownDesc.set === undefined + ? false + : (ownDesc.set.call(receiver, V), true); + } + + $export($export.S, 'Reflect', { set: set }); + + /***/ + }, + /* 246 */ + /***/ function(module, exports, __webpack_require__) { + // 26.1.14 Reflect.setPrototypeOf(target, proto) + var $export = __webpack_require__(8), + setProto = __webpack_require__(73); + + if (setProto) + $export($export.S, 'Reflect', { + setPrototypeOf: function setPrototypeOf(target, proto) { + setProto.check(target, proto); + try { + setProto.set(target, proto); + return true; + } catch (e) { + return false; + } + } + }); + + /***/ + }, + /* 247 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // https://github.com/tc39/Array.prototype.includes + var $export = __webpack_require__(8), + $includes = __webpack_require__(36)(true); + + $export($export.P, 'Array', { + includes: function includes(el /*, fromIndex = 0 */) { + return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + __webpack_require__(186)('includes'); + + /***/ + }, + /* 248 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // https://github.com/mathiasbynens/String.prototype.at + var $export = __webpack_require__(8), + $at = __webpack_require__(127)(true); + + $export($export.P, 'String', { + at: function at(pos) { + return $at(this, pos); + } + }); + + /***/ + }, + /* 249 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // https://github.com/tc39/proposal-string-pad-start-end + var $export = __webpack_require__(8), + $pad = __webpack_require__(250); + + $export($export.P, 'String', { + padStart: function padStart(maxLength /*, fillString = ' ' */) { + return $pad( + this, + maxLength, + arguments.length > 1 ? arguments[1] : undefined, + true + ); + } + }); + + /***/ + }, + /* 250 */ + /***/ function(module, exports, __webpack_require__) { + // https://github.com/tc39/proposal-string-pad-start-end + var toLength = __webpack_require__(37), + repeat = __webpack_require__(91), + defined = __webpack_require__(35); + + module.exports = function(that, maxLength, fillString, left) { + var S = String(defined(that)), + stringLength = S.length, + fillStr = fillString === undefined ? ' ' : String(fillString), + intMaxLength = toLength(maxLength); + if (intMaxLength <= stringLength || fillStr == '') return S; + var fillLen = intMaxLength - stringLength, + stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length)); + if (stringFiller.length > fillLen) + stringFiller = stringFiller.slice(0, fillLen); + return left ? stringFiller + S : S + stringFiller; + }; + + /***/ + }, + /* 251 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // https://github.com/tc39/proposal-string-pad-start-end + var $export = __webpack_require__(8), + $pad = __webpack_require__(250); + + $export($export.P, 'String', { + padEnd: function padEnd(maxLength /*, fillString = ' ' */) { + return $pad( + this, + maxLength, + arguments.length > 1 ? arguments[1] : undefined, + false + ); + } + }); + + /***/ + }, + /* 252 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // https://github.com/sebmarkbage/ecmascript-string-left-right-trim + __webpack_require__(83)( + 'trimLeft', + function($trim) { + return function trimLeft() { + return $trim(this, 1); + }; + }, + 'trimStart' + ); + + /***/ + }, + /* 253 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // https://github.com/sebmarkbage/ecmascript-string-left-right-trim + __webpack_require__(83)( + 'trimRight', + function($trim) { + return function trimRight() { + return $trim(this, 2); + }; + }, + 'trimEnd' + ); + + /***/ + }, + /* 254 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // https://tc39.github.io/String.prototype.matchAll/ + var $export = __webpack_require__(8), + defined = __webpack_require__(35), + toLength = __webpack_require__(37), + isRegExp = __webpack_require__(134), + getFlags = __webpack_require__(196), + RegExpProto = RegExp.prototype; + + var $RegExpStringIterator = function(regexp, string) { + this._r = regexp; + this._s = string; + }; + + __webpack_require__(130)($RegExpStringIterator, 'RegExp String', function next() { + var match = this._r.exec(this._s); + return { value: match, done: match === null }; + }); + + $export($export.P, 'String', { + matchAll: function matchAll(regexp) { + defined(this); + if (!isRegExp(regexp)) throw TypeError(regexp + ' is not a regexp!'); + var S = String(this), + flags = + 'flags' in RegExpProto + ? String(regexp.flags) + : getFlags.call(regexp), + rx = new RegExp( + regexp.source, + ~flags.indexOf('g') ? flags : 'g' + flags + ); + rx.lastIndex = toLength(regexp.lastIndex); + return new $RegExpStringIterator(rx, S); + } + }); + + /***/ + }, + /* 255 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(27)('asyncIterator'); + + /***/ + }, + /* 256 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(27)('observable'); + + /***/ + }, + /* 257 */ + /***/ function(module, exports, __webpack_require__) { + // https://github.com/tc39/proposal-object-getownpropertydescriptors + var $export = __webpack_require__(8), + ownKeys = __webpack_require__(243), + toIObject = __webpack_require__(32), + gOPD = __webpack_require__(51), + createProperty = __webpack_require__(163); + + $export($export.S, 'Object', { + getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { + var O = toIObject(object), + getDesc = gOPD.f, + keys = ownKeys(O), + result = {}, + i = 0, + key; + while (keys.length > i) + createProperty(result, (key = keys[i++]), getDesc(O, key)); + return result; + } + }); + + /***/ + }, + /* 258 */ + /***/ function(module, exports, __webpack_require__) { + // https://github.com/tc39/proposal-object-values-entries + var $export = __webpack_require__(8), + $values = __webpack_require__(259)(false); + + $export($export.S, 'Object', { + values: function values(it) { + return $values(it); + } + }); + + /***/ + }, + /* 259 */ + /***/ function(module, exports, __webpack_require__) { + var getKeys = __webpack_require__(30), + toIObject = __webpack_require__(32), + isEnum = __webpack_require__(44).f; + module.exports = function(isEntries) { + return function(it) { + var O = toIObject(it), + keys = getKeys(O), + length = keys.length, + i = 0, + result = [], + key; + while (length > i) + if (isEnum.call(O, (key = keys[i++]))) { + result.push(isEntries ? [key, O[key]] : O[key]); + } + return result; + }; + }; + + /***/ + }, + /* 260 */ + /***/ function(module, exports, __webpack_require__) { + // https://github.com/tc39/proposal-object-values-entries + var $export = __webpack_require__(8), + $entries = __webpack_require__(259)(true); + + $export($export.S, 'Object', { + entries: function entries(it) { + return $entries(it); + } + }); + + /***/ + }, + /* 261 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + toObject = __webpack_require__(58), + aFunction = __webpack_require__(21), + $defineProperty = __webpack_require__(11); + + // B.2.2.2 Object.prototype.__defineGetter__(P, getter) + __webpack_require__(6) && + $export($export.P + __webpack_require__(262), 'Object', { + __defineGetter__: function __defineGetter__(P, getter) { + $defineProperty.f(toObject(this), P, { + get: aFunction(getter), + enumerable: true, + configurable: true + }); + } + }); + + /***/ + }, + /* 262 */ + /***/ function(module, exports, __webpack_require__) { + // Forced replacement prototype accessors methods + module.exports = + __webpack_require__(28) || + !__webpack_require__(7)(function() { + var K = Math.random(); + // In FF throws only define methods + __defineSetter__.call(null, K, function() { + /* empty */ + }); + delete __webpack_require__(4)[K]; + }); + + /***/ + }, + /* 263 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + toObject = __webpack_require__(58), + aFunction = __webpack_require__(21), + $defineProperty = __webpack_require__(11); + + // B.2.2.3 Object.prototype.__defineSetter__(P, setter) + __webpack_require__(6) && + $export($export.P + __webpack_require__(262), 'Object', { + __defineSetter__: function __defineSetter__(P, setter) { + $defineProperty.f(toObject(this), P, { + set: aFunction(setter), + enumerable: true, + configurable: true + }); + } + }); + + /***/ + }, + /* 264 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + toObject = __webpack_require__(58), + toPrimitive = __webpack_require__(16), + getPrototypeOf = __webpack_require__(59), + getOwnPropertyDescriptor = __webpack_require__(51).f; + + // B.2.2.4 Object.prototype.__lookupGetter__(P) + __webpack_require__(6) && + $export($export.P + __webpack_require__(262), 'Object', { + __lookupGetter__: function __lookupGetter__(P) { + var O = toObject(this), + K = toPrimitive(P, true), + D; + do { + if ((D = getOwnPropertyDescriptor(O, K))) return D.get; + } while ((O = getPrototypeOf(O))); + } + }); + + /***/ + }, + /* 265 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var $export = __webpack_require__(8), + toObject = __webpack_require__(58), + toPrimitive = __webpack_require__(16), + getPrototypeOf = __webpack_require__(59), + getOwnPropertyDescriptor = __webpack_require__(51).f; + + // B.2.2.5 Object.prototype.__lookupSetter__(P) + __webpack_require__(6) && + $export($export.P + __webpack_require__(262), 'Object', { + __lookupSetter__: function __lookupSetter__(P) { + var O = toObject(this), + K = toPrimitive(P, true), + D; + do { + if ((D = getOwnPropertyDescriptor(O, K))) return D.set; + } while ((O = getPrototypeOf(O))); + } + }); + + /***/ + }, + /* 266 */ + /***/ function(module, exports, __webpack_require__) { + // https://github.com/DavidBruant/Map-Set.prototype.toJSON + var $export = __webpack_require__(8); + + $export($export.P + $export.R, 'Map', { toJSON: __webpack_require__(267)('Map') }); + + /***/ + }, + /* 267 */ + /***/ function(module, exports, __webpack_require__) { + // https://github.com/DavidBruant/Map-Set.prototype.toJSON + var classof = __webpack_require__(75), + from = __webpack_require__(268); + module.exports = function(NAME) { + return function toJSON() { + if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic"); + return from(this); + }; + }; + + /***/ + }, + /* 268 */ + /***/ function(module, exports, __webpack_require__) { + var forOf = __webpack_require__(206); + + module.exports = function(iter, ITERATOR) { + var result = []; + forOf(iter, false, result.push, result, ITERATOR); + return result; + }; + + /***/ + }, + /* 269 */ + /***/ function(module, exports, __webpack_require__) { + // https://github.com/DavidBruant/Map-Set.prototype.toJSON + var $export = __webpack_require__(8); + + $export($export.P + $export.R, 'Set', { toJSON: __webpack_require__(267)('Set') }); + + /***/ + }, + /* 270 */ + /***/ function(module, exports, __webpack_require__) { + // https://github.com/ljharb/proposal-global + var $export = __webpack_require__(8); + + $export($export.S, 'System', { global: __webpack_require__(4) }); + + /***/ + }, + /* 271 */ + /***/ function(module, exports, __webpack_require__) { + // https://github.com/ljharb/proposal-is-error + var $export = __webpack_require__(8), + cof = __webpack_require__(34); + + $export($export.S, 'Error', { + isError: function isError(it) { + return cof(it) === 'Error'; + } + }); + + /***/ + }, + /* 272 */ + /***/ function(module, exports, __webpack_require__) { + // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 + var $export = __webpack_require__(8); + + $export($export.S, 'Math', { + iaddh: function iaddh(x0, x1, y0, y1) { + var $x0 = x0 >>> 0, + $x1 = x1 >>> 0, + $y0 = y0 >>> 0; + return ( + ($x1 + + (y1 >>> 0) + + ((($x0 & $y0) | (($x0 | $y0) & ~(($x0 + $y0) >>> 0))) >>> 31)) | + 0 + ); + } + }); + + /***/ + }, + /* 273 */ + /***/ function(module, exports, __webpack_require__) { + // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 + var $export = __webpack_require__(8); + + $export($export.S, 'Math', { + isubh: function isubh(x0, x1, y0, y1) { + var $x0 = x0 >>> 0, + $x1 = x1 >>> 0, + $y0 = y0 >>> 0; + return ( + ($x1 - + (y1 >>> 0) - + (((~$x0 & $y0) | (~($x0 ^ $y0) & (($x0 - $y0) >>> 0))) >>> 31)) | + 0 + ); + } + }); + + /***/ + }, + /* 274 */ + /***/ function(module, exports, __webpack_require__) { + // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 + var $export = __webpack_require__(8); + + $export($export.S, 'Math', { + imulh: function imulh(u, v) { + var UINT16 = 0xffff, + $u = +u, + $v = +v, + u0 = $u & UINT16, + v0 = $v & UINT16, + u1 = $u >> 16, + v1 = $v >> 16, + t = ((u1 * v0) >>> 0) + ((u0 * v0) >>> 16); + return u1 * v1 + (t >> 16) + ((((u0 * v1) >>> 0) + (t & UINT16)) >> 16); + } + }); + + /***/ + }, + /* 275 */ + /***/ function(module, exports, __webpack_require__) { + // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 + var $export = __webpack_require__(8); + + $export($export.S, 'Math', { + umulh: function umulh(u, v) { + var UINT16 = 0xffff, + $u = +u, + $v = +v, + u0 = $u & UINT16, + v0 = $v & UINT16, + u1 = $u >>> 16, + v1 = $v >>> 16, + t = ((u1 * v0) >>> 0) + ((u0 * v0) >>> 16); + return u1 * v1 + (t >>> 16) + ((((u0 * v1) >>> 0) + (t & UINT16)) >>> 16); + } + }); + + /***/ + }, + /* 276 */ + /***/ function(module, exports, __webpack_require__) { + var metadata = __webpack_require__(277), + anObject = __webpack_require__(12), + toMetaKey = metadata.key, + ordinaryDefineOwnMetadata = metadata.set; + + metadata.exp({ + defineMetadata: function defineMetadata( + metadataKey, + metadataValue, + target, + targetKey + ) { + ordinaryDefineOwnMetadata( + metadataKey, + metadataValue, + anObject(target), + toMetaKey(targetKey) + ); + } + }); + + /***/ + }, + /* 277 */ + /***/ function(module, exports, __webpack_require__) { + var Map = __webpack_require__(211), + $export = __webpack_require__(8), + shared = __webpack_require__(23)('metadata'), + store = shared.store || (shared.store = new (__webpack_require__(215))()); + + var getOrCreateMetadataMap = function(target, targetKey, create) { + var targetMetadata = store.get(target); + if (!targetMetadata) { + if (!create) return undefined; + store.set(target, (targetMetadata = new Map())); + } + var keyMetadata = targetMetadata.get(targetKey); + if (!keyMetadata) { + if (!create) return undefined; + targetMetadata.set(targetKey, (keyMetadata = new Map())); + } + return keyMetadata; + }; + var ordinaryHasOwnMetadata = function(MetadataKey, O, P) { + var metadataMap = getOrCreateMetadataMap(O, P, false); + return metadataMap === undefined ? false : metadataMap.has(MetadataKey); + }; + var ordinaryGetOwnMetadata = function(MetadataKey, O, P) { + var metadataMap = getOrCreateMetadataMap(O, P, false); + return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey); + }; + var ordinaryDefineOwnMetadata = function(MetadataKey, MetadataValue, O, P) { + getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue); + }; + var ordinaryOwnMetadataKeys = function(target, targetKey) { + var metadataMap = getOrCreateMetadataMap(target, targetKey, false), + keys = []; + if (metadataMap) + metadataMap.forEach(function(_, key) { + keys.push(key); + }); + return keys; + }; + var toMetaKey = function(it) { + return it === undefined || typeof it == 'symbol' ? it : String(it); + }; + var exp = function(O) { + $export($export.S, 'Reflect', O); + }; + + module.exports = { + store: store, + map: getOrCreateMetadataMap, + has: ordinaryHasOwnMetadata, + get: ordinaryGetOwnMetadata, + set: ordinaryDefineOwnMetadata, + keys: ordinaryOwnMetadataKeys, + key: toMetaKey, + exp: exp + }; + + /***/ + }, + /* 278 */ + /***/ function(module, exports, __webpack_require__) { + var metadata = __webpack_require__(277), + anObject = __webpack_require__(12), + toMetaKey = metadata.key, + getOrCreateMetadataMap = metadata.map, + store = metadata.store; + + metadata.exp({ + deleteMetadata: function deleteMetadata(metadataKey, target /*, targetKey */) { + var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]), + metadataMap = getOrCreateMetadataMap( + anObject(target), + targetKey, + false + ); + if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) + return false; + if (metadataMap.size) return true; + var targetMetadata = store.get(target); + targetMetadata['delete'](targetKey); + return !!targetMetadata.size || store['delete'](target); + } + }); + + /***/ + }, + /* 279 */ + /***/ function(module, exports, __webpack_require__) { + var metadata = __webpack_require__(277), + anObject = __webpack_require__(12), + getPrototypeOf = __webpack_require__(59), + ordinaryHasOwnMetadata = metadata.has, + ordinaryGetOwnMetadata = metadata.get, + toMetaKey = metadata.key; + + var ordinaryGetMetadata = function(MetadataKey, O, P) { + var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P); + var parent = getPrototypeOf(O); + return parent !== null + ? ordinaryGetMetadata(MetadataKey, parent, P) + : undefined; + }; + + metadata.exp({ + getMetadata: function getMetadata(metadataKey, target /*, targetKey */) { + return ordinaryGetMetadata( + metadataKey, + anObject(target), + arguments.length < 3 ? undefined : toMetaKey(arguments[2]) + ); + } + }); + + /***/ + }, + /* 280 */ + /***/ function(module, exports, __webpack_require__) { + var Set = __webpack_require__(214), + from = __webpack_require__(268), + metadata = __webpack_require__(277), + anObject = __webpack_require__(12), + getPrototypeOf = __webpack_require__(59), + ordinaryOwnMetadataKeys = metadata.keys, + toMetaKey = metadata.key; + + var ordinaryMetadataKeys = function(O, P) { + var oKeys = ordinaryOwnMetadataKeys(O, P), + parent = getPrototypeOf(O); + if (parent === null) return oKeys; + var pKeys = ordinaryMetadataKeys(parent, P); + return pKeys.length + ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys + : oKeys; + }; + + metadata.exp({ + getMetadataKeys: function getMetadataKeys(target /*, targetKey */) { + return ordinaryMetadataKeys( + anObject(target), + arguments.length < 2 ? undefined : toMetaKey(arguments[1]) + ); + } + }); + + /***/ + }, + /* 281 */ + /***/ function(module, exports, __webpack_require__) { + var metadata = __webpack_require__(277), + anObject = __webpack_require__(12), + ordinaryGetOwnMetadata = metadata.get, + toMetaKey = metadata.key; + + metadata.exp({ + getOwnMetadata: function getOwnMetadata(metadataKey, target /*, targetKey */) { + return ordinaryGetOwnMetadata( + metadataKey, + anObject(target), + arguments.length < 3 ? undefined : toMetaKey(arguments[2]) + ); + } + }); + + /***/ + }, + /* 282 */ + /***/ function(module, exports, __webpack_require__) { + var metadata = __webpack_require__(277), + anObject = __webpack_require__(12), + ordinaryOwnMetadataKeys = metadata.keys, + toMetaKey = metadata.key; + + metadata.exp({ + getOwnMetadataKeys: function getOwnMetadataKeys(target /*, targetKey */) { + return ordinaryOwnMetadataKeys( + anObject(target), + arguments.length < 2 ? undefined : toMetaKey(arguments[1]) + ); + } + }); + + /***/ + }, + /* 283 */ + /***/ function(module, exports, __webpack_require__) { + var metadata = __webpack_require__(277), + anObject = __webpack_require__(12), + getPrototypeOf = __webpack_require__(59), + ordinaryHasOwnMetadata = metadata.has, + toMetaKey = metadata.key; + + var ordinaryHasMetadata = function(MetadataKey, O, P) { + var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) return true; + var parent = getPrototypeOf(O); + return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false; + }; + + metadata.exp({ + hasMetadata: function hasMetadata(metadataKey, target /*, targetKey */) { + return ordinaryHasMetadata( + metadataKey, + anObject(target), + arguments.length < 3 ? undefined : toMetaKey(arguments[2]) + ); + } + }); + + /***/ + }, + /* 284 */ + /***/ function(module, exports, __webpack_require__) { + var metadata = __webpack_require__(277), + anObject = __webpack_require__(12), + ordinaryHasOwnMetadata = metadata.has, + toMetaKey = metadata.key; + + metadata.exp({ + hasOwnMetadata: function hasOwnMetadata(metadataKey, target /*, targetKey */) { + return ordinaryHasOwnMetadata( + metadataKey, + anObject(target), + arguments.length < 3 ? undefined : toMetaKey(arguments[2]) + ); + } + }); + + /***/ + }, + /* 285 */ + /***/ function(module, exports, __webpack_require__) { + var metadata = __webpack_require__(277), + anObject = __webpack_require__(12), + aFunction = __webpack_require__(21), + toMetaKey = metadata.key, + ordinaryDefineOwnMetadata = metadata.set; + + metadata.exp({ + metadata: function metadata(metadataKey, metadataValue) { + return function decorator(target, targetKey) { + ordinaryDefineOwnMetadata( + metadataKey, + metadataValue, + (targetKey !== undefined ? anObject : aFunction)(target), + toMetaKey(targetKey) + ); + }; + } + }); + + /***/ + }, + /* 286 */ + /***/ function(module, exports, __webpack_require__) { + // https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask + var $export = __webpack_require__(8), + microtask = __webpack_require__(209)(), + process = __webpack_require__(4).process, + isNode = __webpack_require__(34)(process) == 'process'; + + $export($export.G, { + asap: function asap(fn) { + var domain = isNode && process.domain; + microtask(domain ? domain.bind(fn) : fn); + } + }); + + /***/ + }, + /* 287 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + // https://github.com/zenparsing/es-observable + var $export = __webpack_require__(8), + global = __webpack_require__(4), + core = __webpack_require__(9), + microtask = __webpack_require__(209)(), + OBSERVABLE = __webpack_require__(25)('observable'), + aFunction = __webpack_require__(21), + anObject = __webpack_require__(12), + anInstance = __webpack_require__(205), + redefineAll = __webpack_require__(210), + hide = __webpack_require__(10), + forOf = __webpack_require__(206), + RETURN = forOf.RETURN; + + var getMethod = function(fn) { + return fn == null ? undefined : aFunction(fn); + }; + + var cleanupSubscription = function(subscription) { + var cleanup = subscription._c; + if (cleanup) { + subscription._c = undefined; + cleanup(); + } + }; + + var subscriptionClosed = function(subscription) { + return subscription._o === undefined; + }; + + var closeSubscription = function(subscription) { + if (!subscriptionClosed(subscription)) { + subscription._o = undefined; + cleanupSubscription(subscription); + } + }; + + var Subscription = function(observer, subscriber) { + anObject(observer); + this._c = undefined; + this._o = observer; + observer = new SubscriptionObserver(this); + try { + var cleanup = subscriber(observer), + subscription = cleanup; + if (cleanup != null) { + if (typeof cleanup.unsubscribe === 'function') + cleanup = function() { + subscription.unsubscribe(); + }; + else aFunction(cleanup); + this._c = cleanup; + } + } catch (e) { + observer.error(e); + return; + } + if (subscriptionClosed(this)) cleanupSubscription(this); + }; + + Subscription.prototype = redefineAll( + {}, + { + unsubscribe: function unsubscribe() { + closeSubscription(this); + } + } + ); + + var SubscriptionObserver = function(subscription) { + this._s = subscription; + }; + + SubscriptionObserver.prototype = redefineAll( + {}, + { + next: function next(value) { + var subscription = this._s; + if (!subscriptionClosed(subscription)) { + var observer = subscription._o; + try { + var m = getMethod(observer.next); + if (m) return m.call(observer, value); + } catch (e) { + try { + closeSubscription(subscription); + } finally { + throw e; + } + } + } + }, + error: function error(value) { + var subscription = this._s; + if (subscriptionClosed(subscription)) throw value; + var observer = subscription._o; + subscription._o = undefined; + try { + var m = getMethod(observer.error); + if (!m) throw value; + value = m.call(observer, value); + } catch (e) { + try { + cleanupSubscription(subscription); + } finally { + throw e; + } + } + cleanupSubscription(subscription); + return value; + }, + complete: function complete(value) { + var subscription = this._s; + if (!subscriptionClosed(subscription)) { + var observer = subscription._o; + subscription._o = undefined; + try { + var m = getMethod(observer.complete); + value = m ? m.call(observer, value) : undefined; + } catch (e) { + try { + cleanupSubscription(subscription); + } finally { + throw e; + } + } + cleanupSubscription(subscription); + return value; + } + } + } + ); + + var $Observable = function Observable(subscriber) { + anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber); + }; + + redefineAll($Observable.prototype, { + subscribe: function subscribe(observer) { + return new Subscription(observer, this._f); + }, + forEach: function forEach(fn) { + var that = this; + return new (core.Promise || global.Promise)(function(resolve, reject) { + aFunction(fn); + var subscription = that.subscribe({ + next: function(value) { + try { + return fn(value); + } catch (e) { + reject(e); + subscription.unsubscribe(); + } + }, + error: reject, + complete: resolve + }); + }); + } + }); + + redefineAll($Observable, { + from: function from(x) { + var C = typeof this === 'function' ? this : $Observable; + var method = getMethod(anObject(x)[OBSERVABLE]); + if (method) { + var observable = anObject(method.call(x)); + return observable.constructor === C + ? observable + : new C(function(observer) { + return observable.subscribe(observer); + }); + } + return new C(function(observer) { + var done = false; + microtask(function() { + if (!done) { + try { + if ( + forOf(x, false, function(it) { + observer.next(it); + if (done) return RETURN; + }) === RETURN + ) + return; + } catch (e) { + if (done) throw e; + observer.error(e); + return; + } + observer.complete(); + } + }); + return function() { + done = true; + }; + }); + }, + of: function of() { + for (var i = 0, l = arguments.length, items = Array(l); i < l; ) + items[i] = arguments[i++]; + return new (typeof this === 'function' ? this : $Observable)(function( + observer + ) { + var done = false; + microtask(function() { + if (!done) { + for (var i = 0; i < items.length; ++i) { + observer.next(items[i]); + if (done) return; + } + observer.complete(); + } + }); + return function() { + done = true; + }; + }); + } + }); + + hide($Observable.prototype, OBSERVABLE, function() { + return this; + }); + + $export($export.G, { Observable: $Observable }); + + __webpack_require__(192)('Observable'); + + /***/ + }, + /* 288 */ + /***/ function(module, exports, __webpack_require__) { + // ie9- setTimeout & setInterval additional parameters fix + var global = __webpack_require__(4), + $export = __webpack_require__(8), + invoke = __webpack_require__(78), + partial = __webpack_require__(289), + navigator = global.navigator, + MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check + var wrap = function(set) { + return MSIE + ? function(fn, time /*, ...args */) { + return set( + invoke( + partial, + [].slice.call(arguments, 2), + typeof fn == 'function' ? fn : Function(fn) + ), + time + ); + } + : set; + }; + $export($export.G + $export.B + $export.F * MSIE, { + setTimeout: wrap(global.setTimeout), + setInterval: wrap(global.setInterval) + }); + + /***/ + }, + /* 289 */ + /***/ function(module, exports, __webpack_require__) { + 'use strict'; + var path = __webpack_require__(290), + invoke = __webpack_require__(78), + aFunction = __webpack_require__(21); + module.exports = function(/* ...pargs */) { + var fn = aFunction(this), + length = arguments.length, + pargs = Array(length), + i = 0, + _ = path._, + holder = false; + while (length > i) if ((pargs[i] = arguments[i++]) === _) holder = true; + return function(/* ...args */) { + var that = this, + aLen = arguments.length, + j = 0, + k = 0, + args; + if (!holder && !aLen) return invoke(fn, pargs, that); + args = pargs.slice(); + if (holder) + for (; length > j; j++) if (args[j] === _) args[j] = arguments[k++]; + while (aLen > k) args.push(arguments[k++]); + return invoke(fn, args, that); + }; + }; + + /***/ + }, + /* 290 */ + /***/ function(module, exports, __webpack_require__) { + module.exports = __webpack_require__(4); + + /***/ + }, + /* 291 */ + /***/ function(module, exports, __webpack_require__) { + var $export = __webpack_require__(8), + $task = __webpack_require__(208); + $export($export.G + $export.B, { + setImmediate: $task.set, + clearImmediate: $task.clear + }); + + /***/ + }, + /* 292 */ + /***/ function(module, exports, __webpack_require__) { + var $iterators = __webpack_require__(193), + redefine = __webpack_require__(18), + global = __webpack_require__(4), + hide = __webpack_require__(10), + Iterators = __webpack_require__(129), + wks = __webpack_require__(25), + ITERATOR = wks('iterator'), + TO_STRING_TAG = wks('toStringTag'), + ArrayValues = Iterators.Array; + + for ( + var collections = [ + 'NodeList', + 'DOMTokenList', + 'MediaList', + 'StyleSheetList', + 'CSSRuleList' + ], + i = 0; + i < 5; + i++ + ) { + var NAME = collections[i], + Collection = global[NAME], + proto = Collection && Collection.prototype, + key; + if (proto) { + if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues); + if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); + Iterators[NAME] = ArrayValues; + for (key in $iterators) + if (!proto[key]) redefine(proto, key, $iterators[key], true); + } + } + + /***/ + }, + /* 293 */ + /***/ function(module, exports, __webpack_require__) { + /* WEBPACK VAR INJECTION */ (function(global, process) { + /** + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * https://raw.github.com/facebook/regenerator/master/LICENSE file. An + * additional grant of patent rights can be found in the PATENTS file in + * the same directory. + */ + + !(function(global) { + 'use strict'; + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === 'function' ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || '@@iterator'; + var toStringTagSymbol = $Symbol.toStringTag || '@@toStringTag'; + + var inModule = typeof module === 'object'; + var runtime = global.regeneratorRuntime; + if (runtime) { + if (inModule) { + // If regeneratorRuntime is defined globally and we're in a module, + // make the exports object identical to regeneratorRuntime. + module.exports = runtime; + } + // Don't bother evaluating the rest of this file if the runtime was + // already defined globally. + return; + } + + // Define the runtime globally (as expected by generated code) as either + // module.exports (if we're in a module) or a new, empty object. + runtime = global.regeneratorRuntime = inModule ? module.exports : {}; + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = + outerFn && outerFn.prototype instanceof Generator + ? outerFn + : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); + + return generator; + } + runtime.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: 'normal', arg: fn.call(obj, arg) }; + } catch (err) { + return { type: 'throw', arg: err }; + } + } + + var GenStateSuspendedStart = 'suspendedStart'; + var GenStateSuspendedYield = 'suspendedYield'; + var GenStateExecuting = 'executing'; + var GenStateCompleted = 'completed'; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + IteratorPrototype[iteratorSymbol] = function() { + return this; + }; + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if ( + NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol) + ) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = (GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create( + IteratorPrototype + )); + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[ + toStringTagSymbol + ] = GeneratorFunction.displayName = 'GeneratorFunction'; + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ['next', 'throw', 'return'].forEach(function(method) { + prototype[method] = function(arg) { + return this._invoke(method, arg); + }; + }); + } + + runtime.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === 'function' && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === 'GeneratorFunction' + : false; + }; + + runtime.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = 'GeneratorFunction'; + } + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + runtime.awrap = function(arg) { + return { __await: arg }; + }; + + function AsyncIterator(generator) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === 'throw') { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if ( + value && + typeof value === 'object' && + hasOwn.call(value, '__await') + ) { + return Promise.resolve(value.__await).then( + function(value) { + invoke('next', value, resolve, reject); + }, + function(err) { + invoke('throw', err, resolve, reject); + } + ); + } + + return Promise.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. If the Promise is rejected, however, the + // result for this iteration will be rejected with the same + // reason. Note that rejections of yielded Promises are not + // thrown back into the generator function, as is the case + // when an awaited Promise is rejected. This difference in + // behavior between yield and await is important, because it + // allows the consumer to decide what to do with the yielded + // rejection (swallow it and continue, manually .throw it back + // into the generator, abandon iteration, whatever). With + // await, by contrast, there is no opportunity to examine the + // rejection reason outside the generator function, so the + // only option is to throw it from the await expression, and + // let the generator function handle the exception. + result.value = unwrapped; + resolve(result); + }, reject); + } + } + + if (typeof process === 'object' && process.domain) { + invoke = process.domain.bind(invoke); + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return (previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise + ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) + : callInvokeWithMethodAndArg()); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + runtime.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + runtime.async = function(innerFn, outerFn, self, tryLocsList) { + var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList)); + + return runtime.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error('Generator is already running'); + } + + if (state === GenStateCompleted) { + if (method === 'throw') { + throw arg; + } + + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } + + while (true) { + var delegate = context.delegate; + if (delegate) { + if ( + method === 'return' || + (method === 'throw' && + delegate.iterator[method] === undefined) + ) { + // A return or throw (when the delegate iterator has no throw + // method) always terminates the yield* loop. + context.delegate = null; + + // If the delegate iterator has a return method, give it a + // chance to clean up. + var returnMethod = delegate.iterator['return']; + if (returnMethod) { + var record = tryCatch( + returnMethod, + delegate.iterator, + arg + ); + if (record.type === 'throw') { + // If the return method threw an exception, let that + // exception prevail over the original return or throw. + method = 'throw'; + arg = record.arg; + continue; + } + } + + if (method === 'return') { + // Continue with the outer return, now that the delegate + // iterator has been terminated. + continue; + } + } + + var record = tryCatch( + delegate.iterator[method], + delegate.iterator, + arg + ); + + if (record.type === 'throw') { + context.delegate = null; + + // Like returning generator.throw(uncaught), but without the + // overhead of an extra function call. + method = 'throw'; + arg = record.arg; + continue; + } + + // Delegate generator ran and handled its own exceptions so + // regardless of what the method was, we continue as if it is + // "next" with an undefined arg. + method = 'next'; + arg = undefined; + + var info = record.arg; + if (info.done) { + context[delegate.resultName] = info.value; + context.next = delegate.nextLoc; + } else { + state = GenStateSuspendedYield; + return info; + } + + context.delegate = null; + } + + if (method === 'next') { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = arg; + } else if (method === 'throw') { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw arg; + } + + if (context.dispatchException(arg)) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + method = 'next'; + arg = undefined; + } + } else if (method === 'return') { + context.abrupt('return', arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === 'normal') { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; + + var info = { + value: record.arg, + done: context.done + }; + + if (record.arg === ContinueSentinel) { + if (context.delegate && method === 'next') { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + arg = undefined; + } + } else { + return info; + } + } else if (record.type === 'throw') { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(arg) call above. + method = 'throw'; + arg = record.arg; + } + } + }; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + Gp[toStringTagSymbol] = 'Generator'; + + Gp.toString = function() { + return '[object Generator]'; + }; + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = 'normal'; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: 'root' }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + runtime.keys = function(object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === 'function') { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, + next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return (next.next = next); + } + } + + // Return an iterator with no values. + return { next: doneResult }; + } + runtime.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if ( + name.charAt(0) === 't' && + hasOwn.call(this, name) && + !isNaN(+name.slice(1)) + ) { + this[name] = undefined; + } + } + } + }, + + stop: function() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === 'throw') { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = 'throw'; + record.arg = exception; + context.next = loc; + return !!caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === 'root') { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle('end'); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, 'catchLoc'); + var hasFinally = hasOwn.call(entry, 'finallyLoc'); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + } else { + throw new Error( + 'try statement without catch or finally' + ); + } + } + } + }, + + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if ( + entry.tryLoc <= this.prev && + hasOwn.call(entry, 'finallyLoc') && + this.prev < entry.finallyLoc + ) { + var finallyEntry = entry; + break; + } + } + + if ( + finallyEntry && + (type === 'break' || type === 'continue') && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc + ) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.next = finallyEntry.finallyLoc; + } else { + this.complete(record); + } + + return ContinueSentinel; + }, + + complete: function(record, afterLoc) { + if (record.type === 'throw') { + throw record.arg; + } + + if (record.type === 'break' || record.type === 'continue') { + this.next = record.arg; + } else if (record.type === 'return') { + this.rval = record.arg; + this.next = 'end'; + } else if (record.type === 'normal' && afterLoc) { + this.next = afterLoc; + } + }, + + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + + catch: function(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === 'throw') { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error('illegal catch attempt'); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + return ContinueSentinel; + } + }; + })( + // Among the various tricks for obtaining a reference to the global + // object, this seems to be the most reliable technique that does not + // use indirect eval (which violates Content Security Policy). + typeof global === 'object' + ? global + : typeof window === 'object' + ? window + : typeof self === 'object' ? self : this + ); + + /* WEBPACK VAR INJECTION */ + }.call( + exports, + (function() { + return this; + })(), + __webpack_require__(294) + )); + + /***/ + }, + /* 294 */ + /***/ function(module, exports) { + // shim for using process in browser + var process = (module.exports = {}); + + // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); + } + (function() { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + })(); + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ( + (cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && + setTimeout + ) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ( + (cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && + clearTimeout + ) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while (len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function(fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; + + // v8 likes predictible objects + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function() { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + + process.binding = function(name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function() { + return '/'; + }; + process.chdir = function(dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function() { + return 0; + }; + + /***/ + }, + /* 295 */ + /***/ function(module, exports, __webpack_require__) { + __webpack_require__(296); + module.exports = __webpack_require__(9).RegExp.escape; + + /***/ + }, + /* 296 */ + /***/ function(module, exports, __webpack_require__) { + // https://github.com/benjamingr/RexExp.escape + var $export = __webpack_require__(8), + $re = __webpack_require__(297)(/[\\^$*+?.()|[\]{}]/g, '\\$&'); + + $export($export.S, 'RegExp', { + escape: function escape(it) { + return $re(it); + } + }); + + /***/ + }, + /* 297 */ + /***/ function(module, exports) { + module.exports = function(regExp, replace) { + var replacer = + replace === Object(replace) + ? function(part) { + return replace[part]; + } + : replace; + return function(it) { + return String(it).replace(regExp, replacer); + }; + }; + + /***/ + }, + /* 298 */ + /***/ function(module, exports, __webpack_require__) { + var BSON = __webpack_require__(299), + Binary = __webpack_require__(318), + Code = __webpack_require__(313), + DBRef = __webpack_require__(317), + Decimal128 = __webpack_require__(314), + Double = __webpack_require__(307), + Int32 = __webpack_require__(312), + Long = __webpack_require__(306), + Map = __webpack_require__(305), + MaxKey = __webpack_require__(316), + MinKey = __webpack_require__(315), + ObjectId = __webpack_require__(309), + BSONRegExp = __webpack_require__(310), + Symbol = __webpack_require__(311), + Timestamp = __webpack_require__(308); + + // BSON MAX VALUES + BSON.BSON_INT32_MAX = 0x7fffffff; + BSON.BSON_INT32_MIN = -0x80000000; + + BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; + BSON.BSON_INT64_MIN = -Math.pow(2, 63); + + // JS MAX PRECISE VALUES + BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. + BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. + + // Add BSON types to function creation + BSON.Binary = Binary; + BSON.Code = Code; + BSON.DBRef = DBRef; + BSON.Decimal128 = Decimal128; + BSON.Double = Double; + BSON.Int32 = Int32; + BSON.Long = Long; + BSON.Map = Map; + BSON.MaxKey = MaxKey; + BSON.MinKey = MinKey; + BSON.ObjectId = ObjectId; + BSON.ObjectID = ObjectId; + BSON.BSONRegExp = BSONRegExp; + BSON.Symbol = Symbol; + BSON.Timestamp = Timestamp; + + // Return the BSON + module.exports = BSON; + + /***/ + }, + /* 299 */ + /***/ function(module, exports, __webpack_require__) { + /* WEBPACK VAR INJECTION */ (function(Buffer) { + 'use strict'; + + var writeIEEE754 = __webpack_require__(304).writeIEEE754, + readIEEE754 = __webpack_require__(304).readIEEE754, + Map = __webpack_require__(305), + Long = __webpack_require__(306), + Double = __webpack_require__(307), + Timestamp = __webpack_require__(308), + ObjectID = __webpack_require__(309), + BSONRegExp = __webpack_require__(310), + Symbol = __webpack_require__(311), + Int32 = __webpack_require__(312), + Code = __webpack_require__(313), + Decimal128 = __webpack_require__(314), + MinKey = __webpack_require__(315), + MaxKey = __webpack_require__(316), + DBRef = __webpack_require__(317), + Binary = __webpack_require__(318); + + // Parts of the parser + var deserialize = __webpack_require__(319), + serializer = __webpack_require__(323), + calculateObjectSize = __webpack_require__(324); + + /** + * @ignore + * @api private + */ + // Max Size + var MAXSIZE = 1024 * 1024 * 17; + // Max Document Buffer size + var buffer = new Buffer(MAXSIZE); + + var BSON = function() {}; + + /** + * Serialize a Javascript object. + * + * @param {Object} object the Javascript object to serialize. + * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid. + * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**. + * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**. + * @return {Buffer} returns the Buffer object containing the serialized object. + * @api public + */ + BSON.prototype.serialize = function serialize(object, options) { + options = options || {}; + // Unpack the options + var checkKeys = + typeof options.checkKeys == 'boolean' ? options.checkKeys : false; + var serializeFunctions = + typeof options.serializeFunctions == 'boolean' + ? options.serializeFunctions + : false; + var ignoreUndefined = + typeof options.ignoreUndefined == 'boolean' + ? options.ignoreUndefined + : true; + + // Attempt to serialize + var serializationIndex = serializer( + buffer, + object, + checkKeys, + 0, + 0, + serializeFunctions, + ignoreUndefined, + [] + ); + // Create the final buffer + var finishedBuffer = new Buffer(serializationIndex); + // Copy into the finished buffer + buffer.copy(finishedBuffer, 0, 0, finishedBuffer.length); + // Return the buffer + return finishedBuffer; + }; + + /** + * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. + * + * @param {Object} object the Javascript object to serialize. + * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. + * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid. + * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**. + * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**. + * @param {Number} [options.index] the index in the buffer where we wish to start serializing into. + * @return {Number} returns the index pointing to the last written byte in the buffer. + * @api public + */ + BSON.prototype.serializeWithBufferAndIndex = function( + object, + finalBuffer, + options + ) { + options = options || {}; + // Unpack the options + var checkKeys = + typeof options.checkKeys == 'boolean' ? options.checkKeys : false; + var serializeFunctions = + typeof options.serializeFunctions == 'boolean' + ? options.serializeFunctions + : false; + var ignoreUndefined = + typeof options.ignoreUndefined == 'boolean' + ? options.ignoreUndefined + : true; + var startIndex = typeof options.index == 'number' ? options.index : 0; + + // Attempt to serialize + var serializationIndex = serializer( + buffer, + object, + checkKeys, + startIndex || 0, + 0, + serializeFunctions, + ignoreUndefined + ); + buffer.copy(finalBuffer, startIndex, 0, serializationIndex); + + // Return the index + return serializationIndex - 1; + }; + + /** + * Deserialize data as BSON. + * + * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. + * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized. + * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse. + * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function. + * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits + * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance. + * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types. + * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer. + * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances. + * @return {Object} returns the deserialized Javascript Object. + * @api public + */ + BSON.prototype.deserialize = function(buffer, options) { + return deserialize(buffer, options); + }; + + /** + * Calculate the bson size for a passed in Javascript object. + * + * @param {Object} object the Javascript object to calculate the BSON byte size for. + * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**. + * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**. + * @return {Number} returns the number of bytes the BSON object will take up. + * @api public + */ + BSON.prototype.calculateObjectSize = function(object, options) { + options = options || {}; + + var serializeFunctions = + typeof options.serializeFunctions == 'boolean' + ? options.serializeFunctions + : false; + var ignoreUndefined = + typeof options.ignoreUndefined == 'boolean' + ? options.ignoreUndefined + : true; + + return calculateObjectSize(object, serializeFunctions, ignoreUndefined); + }; + + /** + * Deserialize stream data as BSON documents. + * + * @param {Buffer} data the buffer containing the serialized set of BSON documents. + * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. + * @param {Number} numberOfDocuments number of documents to deserialize. + * @param {Array} documents an array where to store the deserialized documents. + * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. + * @param {Object} [options] additional options used for the deserialization. + * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized. + * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse. + * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function. + * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits + * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance. + * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types. + * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer. + * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances. + * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. + * @api public + */ + BSON.prototype.deserializeStream = function( + data, + startIndex, + numberOfDocuments, + documents, + docStartIndex, + options + ) { + options = options != null ? options : {}; + var index = startIndex; + // Loop over all documents + for (var i = 0; i < numberOfDocuments; i++) { + // Find size of the document + var size = + data[index] | + (data[index + 1] << 8) | + (data[index + 2] << 16) | + (data[index + 3] << 24); + // Update options with index + options['index'] = index; + // Parse the document at this point + documents[docStartIndex + i] = this.deserialize(data, options); + // Adjust index by the document size + index = index + size; + } + + // Return object containing end index of parsing and list of documents + return index; + }; + + /** + * @ignore + * @api private + */ + // BSON MAX VALUES + BSON.BSON_INT32_MAX = 0x7fffffff; + BSON.BSON_INT32_MIN = -0x80000000; + + BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; + BSON.BSON_INT64_MIN = -Math.pow(2, 63); + + // JS MAX PRECISE VALUES + BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. + BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. + + // Internal long versions + var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. + var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. + + /** + * Number BSON Type + * + * @classconstant BSON_DATA_NUMBER + **/ + BSON.BSON_DATA_NUMBER = 1; + /** + * String BSON Type + * + * @classconstant BSON_DATA_STRING + **/ + BSON.BSON_DATA_STRING = 2; + /** + * Object BSON Type + * + * @classconstant BSON_DATA_OBJECT + **/ + BSON.BSON_DATA_OBJECT = 3; + /** + * Array BSON Type + * + * @classconstant BSON_DATA_ARRAY + **/ + BSON.BSON_DATA_ARRAY = 4; + /** + * Binary BSON Type + * + * @classconstant BSON_DATA_BINARY + **/ + BSON.BSON_DATA_BINARY = 5; + /** + * ObjectID BSON Type + * + * @classconstant BSON_DATA_OID + **/ + BSON.BSON_DATA_OID = 7; + /** + * Boolean BSON Type + * + * @classconstant BSON_DATA_BOOLEAN + **/ + BSON.BSON_DATA_BOOLEAN = 8; + /** + * Date BSON Type + * + * @classconstant BSON_DATA_DATE + **/ + BSON.BSON_DATA_DATE = 9; + /** + * null BSON Type + * + * @classconstant BSON_DATA_NULL + **/ + BSON.BSON_DATA_NULL = 10; + /** + * RegExp BSON Type + * + * @classconstant BSON_DATA_REGEXP + **/ + BSON.BSON_DATA_REGEXP = 11; + /** + * Code BSON Type + * + * @classconstant BSON_DATA_CODE + **/ + BSON.BSON_DATA_CODE = 13; + /** + * Symbol BSON Type + * + * @classconstant BSON_DATA_SYMBOL + **/ + BSON.BSON_DATA_SYMBOL = 14; + /** + * Code with Scope BSON Type + * + * @classconstant BSON_DATA_CODE_W_SCOPE + **/ + BSON.BSON_DATA_CODE_W_SCOPE = 15; + /** + * 32 bit Integer BSON Type + * + * @classconstant BSON_DATA_INT + **/ + BSON.BSON_DATA_INT = 16; + /** + * Timestamp BSON Type + * + * @classconstant BSON_DATA_TIMESTAMP + **/ + BSON.BSON_DATA_TIMESTAMP = 17; + /** + * Long BSON Type + * + * @classconstant BSON_DATA_LONG + **/ + BSON.BSON_DATA_LONG = 18; + /** + * MinKey BSON Type + * + * @classconstant BSON_DATA_MIN_KEY + **/ + BSON.BSON_DATA_MIN_KEY = 0xff; + /** + * MaxKey BSON Type + * + * @classconstant BSON_DATA_MAX_KEY + **/ + BSON.BSON_DATA_MAX_KEY = 0x7f; + + /** + * Binary Default Type + * + * @classconstant BSON_BINARY_SUBTYPE_DEFAULT + **/ + BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; + /** + * Binary Function Type + * + * @classconstant BSON_BINARY_SUBTYPE_FUNCTION + **/ + BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; + /** + * Binary Byte Array Type + * + * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY + **/ + BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; + /** + * Binary UUID Type + * + * @classconstant BSON_BINARY_SUBTYPE_UUID + **/ + BSON.BSON_BINARY_SUBTYPE_UUID = 3; + /** + * Binary MD5 Type + * + * @classconstant BSON_BINARY_SUBTYPE_MD5 + **/ + BSON.BSON_BINARY_SUBTYPE_MD5 = 4; + /** + * Binary User Defined Type + * + * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED + **/ + BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; + + // Return BSON + module.exports = BSON; + module.exports.Code = Code; + module.exports.Map = Map; + module.exports.Symbol = Symbol; + module.exports.BSON = BSON; + module.exports.DBRef = DBRef; + module.exports.Binary = Binary; + module.exports.ObjectID = ObjectID; + module.exports.Long = Long; + module.exports.Timestamp = Timestamp; + module.exports.Double = Double; + module.exports.Int32 = Int32; + module.exports.MinKey = MinKey; + module.exports.MaxKey = MaxKey; + module.exports.BSONRegExp = BSONRegExp; + module.exports.Decimal128 = Decimal128; + /* WEBPACK VAR INJECTION */ + }.call(exports, __webpack_require__(300).Buffer)); + + /***/ + }, + /* 300 */ + /***/ function(module, exports, __webpack_require__) { + /* WEBPACK VAR INJECTION */ (function(global) { + /*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + /* eslint-disable no-proto */ + + 'use strict'; + + var base64 = __webpack_require__(301); + var ieee754 = __webpack_require__(302); + var isArray = __webpack_require__(303); + + exports.Buffer = Buffer; + exports.SlowBuffer = SlowBuffer; + exports.INSPECT_MAX_BYTES = 50; + + /** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Use Object implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * Due to various browser bugs, sometimes the Object implementation will be used even + * when the browser supports typed arrays. + * + * Note: + * + * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, + * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. + * + * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. + * + * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of + * incorrect length in some situations. + + * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they + * get the Object implementation, which is slower but behaves correctly. + */ + Buffer.TYPED_ARRAY_SUPPORT = + global.TYPED_ARRAY_SUPPORT !== undefined + ? global.TYPED_ARRAY_SUPPORT + : typedArraySupport(); + + /* + * Export kMaxLength after typed array support is determined. + */ + exports.kMaxLength = kMaxLength(); + + function typedArraySupport() { + try { + var arr = new Uint8Array(1); + arr.__proto__ = { + __proto__: Uint8Array.prototype, + foo: function() { + return 42; + } + }; + return ( + arr.foo() === 42 && // typed array instances can be augmented + typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` + arr.subarray(1, 1).byteLength === 0 + ); // ie10 has broken `subarray` + } catch (e) { + return false; + } + } + + function kMaxLength() { + return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff; + } + + function createBuffer(that, length) { + if (kMaxLength() < length) { + throw new RangeError('Invalid typed array length'); + } + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = new Uint8Array(length); + that.__proto__ = Buffer.prototype; + } else { + // Fallback: Return an object instance of the Buffer class + if (that === null) { + that = new Buffer(length); + } + that.length = length; + } + + return that; + } + + /** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ + + function Buffer(arg, encodingOrOffset, length) { + if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { + return new Buffer(arg, encodingOrOffset, length); + } + + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new Error( + 'If encoding is specified then the first argument must be a string' + ); + } + return allocUnsafe(this, arg); + } + return from(this, arg, encodingOrOffset, length); + } + + Buffer.poolSize = 8192; // not used by this implementation + + // TODO: Legacy, not needed anymore. Remove in next major version. + Buffer._augment = function(arr) { + arr.__proto__ = Buffer.prototype; + return arr; + }; + + function from(that, value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number'); + } + + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + return fromArrayBuffer(that, value, encodingOrOffset, length); + } + + if (typeof value === 'string') { + return fromString(that, value, encodingOrOffset); + } + + return fromObject(that, value); + } + + /** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ + Buffer.from = function(value, encodingOrOffset, length) { + return from(null, value, encodingOrOffset, length); + }; + + if (Buffer.TYPED_ARRAY_SUPPORT) { + Buffer.prototype.__proto__ = Uint8Array.prototype; + Buffer.__proto__ = Uint8Array; + if ( + typeof Symbol !== 'undefined' && + Symbol.species && + Buffer[Symbol.species] === Buffer + ) { + // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 + Object.defineProperty(Buffer, Symbol.species, { + value: null, + configurable: true + }); + } + } + + function assertSize(size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be a number'); + } else if (size < 0) { + throw new RangeError('"size" argument must not be negative'); + } + } + + function alloc(that, size, fill, encoding) { + assertSize(size); + if (size <= 0) { + return createBuffer(that, size); + } + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpretted as a start offset. + return typeof encoding === 'string' + ? createBuffer(that, size).fill(fill, encoding) + : createBuffer(that, size).fill(fill); + } + return createBuffer(that, size); + } + + /** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ + Buffer.alloc = function(size, fill, encoding) { + return alloc(null, size, fill, encoding); + }; + + function allocUnsafe(that, size) { + assertSize(size); + that = createBuffer(that, size < 0 ? 0 : checked(size) | 0); + if (!Buffer.TYPED_ARRAY_SUPPORT) { + for (var i = 0; i < size; ++i) { + that[i] = 0; + } + } + return that; + } + + /** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ + Buffer.allocUnsafe = function(size) { + return allocUnsafe(null, size); + }; + /** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ + Buffer.allocUnsafeSlow = function(size) { + return allocUnsafe(null, size); + }; + + function fromString(that, string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8'; + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('"encoding" must be a valid string encoding'); + } + + var length = byteLength(string, encoding) | 0; + that = createBuffer(that, length); + + var actual = that.write(string, encoding); + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + that = that.slice(0, actual); + } + + return that; + } + + function fromArrayLike(that, array) { + var length = array.length < 0 ? 0 : checked(array.length) | 0; + that = createBuffer(that, length); + for (var i = 0; i < length; i += 1) { + that[i] = array[i] & 255; + } + return that; + } + + function fromArrayBuffer(that, array, byteOffset, length) { + array.byteLength; // this throws if `array` is not a valid ArrayBuffer + + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError("'offset' is out of bounds"); + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError("'length' is out of bounds"); + } + + if (byteOffset === undefined && length === undefined) { + array = new Uint8Array(array); + } else if (length === undefined) { + array = new Uint8Array(array, byteOffset); + } else { + array = new Uint8Array(array, byteOffset, length); + } + + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = array; + that.__proto__ = Buffer.prototype; + } else { + // Fallback: Return an object instance of the Buffer class + that = fromArrayLike(that, array); + } + return that; + } + + function fromObject(that, obj) { + if (Buffer.isBuffer(obj)) { + var len = checked(obj.length) | 0; + that = createBuffer(that, len); + + if (that.length === 0) { + return that; + } + + obj.copy(that, 0, 0, len); + return that; + } + + if (obj) { + if ( + (typeof ArrayBuffer !== 'undefined' && + obj.buffer instanceof ArrayBuffer) || + 'length' in obj + ) { + if (typeof obj.length !== 'number' || isnan(obj.length)) { + return createBuffer(that, 0); + } + return fromArrayLike(that, obj); + } + + if (obj.type === 'Buffer' && isArray(obj.data)) { + return fromArrayLike(that, obj.data); + } + } + + throw new TypeError( + 'First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.' + ); + } + + function checked(length) { + // Note: cannot use `length < kMaxLength()` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= kMaxLength()) { + throw new RangeError( + 'Attempt to allocate Buffer larger than maximum ' + + 'size: 0x' + + kMaxLength().toString(16) + + ' bytes' + ); + } + return length | 0; + } + + function SlowBuffer(length) { + if (+length != length) { + // eslint-disable-line eqeqeq + length = 0; + } + return Buffer.alloc(+length); + } + + Buffer.isBuffer = function isBuffer(b) { + return !!(b != null && b._isBuffer); + }; + + Buffer.compare = function compare(a, b) { + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError('Arguments must be Buffers'); + } + + if (a === b) return 0; + + var x = a.length; + var y = b.length; + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i]; + y = b[i]; + break; + } + } + + if (x < y) return -1; + if (y < x) return 1; + return 0; + }; + + Buffer.isEncoding = function isEncoding(encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'latin1': + case 'binary': + case 'base64': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true; + default: + return false; + } + }; + + Buffer.concat = function concat(list, length) { + if (!isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers'); + } + + if (list.length === 0) { + return Buffer.alloc(0); + } + + var i; + if (length === undefined) { + length = 0; + for (i = 0; i < list.length; ++i) { + length += list[i].length; + } + } + + var buffer = Buffer.allocUnsafe(length); + var pos = 0; + for (i = 0; i < list.length; ++i) { + var buf = list[i]; + if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers'); + } + buf.copy(buffer, pos); + pos += buf.length; + } + return buffer; + }; + + function byteLength(string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length; + } + if ( + typeof ArrayBuffer !== 'undefined' && + typeof ArrayBuffer.isView === 'function' && + (ArrayBuffer.isView(string) || string instanceof ArrayBuffer) + ) { + return string.byteLength; + } + if (typeof string !== 'string') { + string = '' + string; + } + + var len = string.length; + if (len === 0) return 0; + + // Use a for loop to avoid recursion + var loweredCase = false; + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len; + case 'utf8': + case 'utf-8': + case undefined: + return utf8ToBytes(string).length; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2; + case 'hex': + return len >>> 1; + case 'base64': + return base64ToBytes(string).length; + default: + if (loweredCase) return utf8ToBytes(string).length; // assume utf8 + encoding = ('' + encoding).toLowerCase(); + loweredCase = true; + } + } + } + Buffer.byteLength = byteLength; + + function slowToString(encoding, start, end) { + var loweredCase = false; + + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + if (start === undefined || start < 0) { + start = 0; + } + // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + if (start > this.length) { + return ''; + } + + if (end === undefined || end > this.length) { + end = this.length; + } + + if (end <= 0) { + return ''; + } + + // Force coersion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0; + start >>>= 0; + + if (end <= start) { + return ''; + } + + if (!encoding) encoding = 'utf8'; + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end); + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end); + + case 'ascii': + return asciiSlice(this, start, end); + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end); + + case 'base64': + return base64Slice(this, start, end); + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end); + + default: + if (loweredCase) + throw new TypeError('Unknown encoding: ' + encoding); + encoding = (encoding + '').toLowerCase(); + loweredCase = true; + } + } + } + + // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect + // Buffer instances. + Buffer.prototype._isBuffer = true; + + function swap(b, n, m) { + var i = b[n]; + b[n] = b[m]; + b[m] = i; + } + + Buffer.prototype.swap16 = function swap16() { + var len = this.length; + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits'); + } + for (var i = 0; i < len; i += 2) { + swap(this, i, i + 1); + } + return this; + }; + + Buffer.prototype.swap32 = function swap32() { + var len = this.length; + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits'); + } + for (var i = 0; i < len; i += 4) { + swap(this, i, i + 3); + swap(this, i + 1, i + 2); + } + return this; + }; + + Buffer.prototype.swap64 = function swap64() { + var len = this.length; + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits'); + } + for (var i = 0; i < len; i += 8) { + swap(this, i, i + 7); + swap(this, i + 1, i + 6); + swap(this, i + 2, i + 5); + swap(this, i + 3, i + 4); + } + return this; + }; + + Buffer.prototype.toString = function toString() { + var length = this.length | 0; + if (length === 0) return ''; + if (arguments.length === 0) return utf8Slice(this, 0, length); + return slowToString.apply(this, arguments); + }; + + Buffer.prototype.equals = function equals(b) { + if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer'); + if (this === b) return true; + return Buffer.compare(this, b) === 0; + }; + + Buffer.prototype.inspect = function inspect() { + var str = ''; + var max = exports.INSPECT_MAX_BYTES; + if (this.length > 0) { + str = this.toString('hex', 0, max) + .match(/.{2}/g) + .join(' '); + if (this.length > max) str += ' ... '; + } + return ''; + }; + + Buffer.prototype.compare = function compare( + target, + start, + end, + thisStart, + thisEnd + ) { + if (!Buffer.isBuffer(target)) { + throw new TypeError('Argument must be a Buffer'); + } + + if (start === undefined) { + start = 0; + } + if (end === undefined) { + end = target ? target.length : 0; + } + if (thisStart === undefined) { + thisStart = 0; + } + if (thisEnd === undefined) { + thisEnd = this.length; + } + + if ( + start < 0 || + end > target.length || + thisStart < 0 || + thisEnd > this.length + ) { + throw new RangeError('out of range index'); + } + + if (thisStart >= thisEnd && start >= end) { + return 0; + } + if (thisStart >= thisEnd) { + return -1; + } + if (start >= end) { + return 1; + } + + start >>>= 0; + end >>>= 0; + thisStart >>>= 0; + thisEnd >>>= 0; + + if (this === target) return 0; + + var x = thisEnd - thisStart; + var y = end - start; + var len = Math.min(x, y); + + var thisCopy = this.slice(thisStart, thisEnd); + var targetCopy = target.slice(start, end); + + for (var i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i]; + y = targetCopy[i]; + break; + } + } + + if (x < y) return -1; + if (y < x) return 1; + return 0; + }; + + // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, + // OR the last index of `val` in `buffer` at offset <= `byteOffset`. + // + // Arguments: + // - buffer - a Buffer to search + // - val - a string, Buffer, or number + // - byteOffset - an index into `buffer`; will be clamped to an int32 + // - encoding - an optional encoding, relevant is val is a string + // - dir - true for indexOf, false for lastIndexOf + function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1; + + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset; + byteOffset = 0; + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff; + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000; + } + byteOffset = +byteOffset; // Coerce to Number. + if (isNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : buffer.length - 1; + } + + // Normalize byteOffset: negative offsets start from the end of the buffer + if (byteOffset < 0) byteOffset = buffer.length + byteOffset; + if (byteOffset >= buffer.length) { + if (dir) return -1; + else byteOffset = buffer.length - 1; + } else if (byteOffset < 0) { + if (dir) byteOffset = 0; + else return -1; + } + + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, encoding); + } + + // Finally, search either indexOf (if dir is true) or lastIndexOf + if (Buffer.isBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1; + } + return arrayIndexOf(buffer, val, byteOffset, encoding, dir); + } else if (typeof val === 'number') { + val = val & 0xff; // Search for a byte value [0-255] + if ( + Buffer.TYPED_ARRAY_SUPPORT && + typeof Uint8Array.prototype.indexOf === 'function' + ) { + if (dir) { + return Uint8Array.prototype.indexOf.call( + buffer, + val, + byteOffset + ); + } else { + return Uint8Array.prototype.lastIndexOf.call( + buffer, + val, + byteOffset + ); + } + } + return arrayIndexOf(buffer, [val], byteOffset, encoding, dir); + } + + throw new TypeError('val must be string, number or Buffer'); + } + + function arrayIndexOf(arr, val, byteOffset, encoding, dir) { + var indexSize = 1; + var arrLength = arr.length; + var valLength = val.length; + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase(); + if ( + encoding === 'ucs2' || + encoding === 'ucs-2' || + encoding === 'utf16le' || + encoding === 'utf-16le' + ) { + if (arr.length < 2 || val.length < 2) { + return -1; + } + indexSize = 2; + arrLength /= 2; + valLength /= 2; + byteOffset /= 2; + } + } + + function read(buf, i) { + if (indexSize === 1) { + return buf[i]; + } else { + return buf.readUInt16BE(i * indexSize); + } + } + + var i; + if (dir) { + var foundIndex = -1; + for (i = byteOffset; i < arrLength; i++) { + if ( + read(arr, i) === + read(val, foundIndex === -1 ? 0 : i - foundIndex) + ) { + if (foundIndex === -1) foundIndex = i; + if (i - foundIndex + 1 === valLength) + return foundIndex * indexSize; + } else { + if (foundIndex !== -1) i -= i - foundIndex; + foundIndex = -1; + } + } + } else { + if (byteOffset + valLength > arrLength) + byteOffset = arrLength - valLength; + for (i = byteOffset; i >= 0; i--) { + var found = true; + for (var j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false; + break; + } + } + if (found) return i; + } + } + + return -1; + } + + Buffer.prototype.includes = function includes(val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1; + }; + + Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true); + }; + + Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false); + }; + + function hexWrite(buf, string, offset, length) { + offset = Number(offset) || 0; + var remaining = buf.length - offset; + if (!length) { + length = remaining; + } else { + length = Number(length); + if (length > remaining) { + length = remaining; + } + } + + // must be an even number of digits + var strLen = string.length; + if (strLen % 2 !== 0) throw new TypeError('Invalid hex string'); + + if (length > strLen / 2) { + length = strLen / 2; + } + for (var i = 0; i < length; ++i) { + var parsed = parseInt(string.substr(i * 2, 2), 16); + if (isNaN(parsed)) return i; + buf[offset + i] = parsed; + } + return i; + } + + function utf8Write(buf, string, offset, length) { + return blitBuffer( + utf8ToBytes(string, buf.length - offset), + buf, + offset, + length + ); + } + + function asciiWrite(buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length); + } + + function latin1Write(buf, string, offset, length) { + return asciiWrite(buf, string, offset, length); + } + + function base64Write(buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length); + } + + function ucs2Write(buf, string, offset, length) { + return blitBuffer( + utf16leToBytes(string, buf.length - offset), + buf, + offset, + length + ); + } + + Buffer.prototype.write = function write(string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8'; + length = this.length; + offset = 0; + // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset; + length = this.length; + offset = 0; + // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset | 0; + if (isFinite(length)) { + length = length | 0; + if (encoding === undefined) encoding = 'utf8'; + } else { + encoding = length; + length = undefined; + } + // legacy write(string, encoding, offset, length) - remove in v0.13 + } else { + throw new Error( + 'Buffer.write(string, encoding, offset[, length]) is no longer supported' + ); + } + + var remaining = this.length - offset; + if (length === undefined || length > remaining) length = remaining; + + if ( + (string.length > 0 && (length < 0 || offset < 0)) || + offset > this.length + ) { + throw new RangeError('Attempt to write outside buffer bounds'); + } + + if (!encoding) encoding = 'utf8'; + + var loweredCase = false; + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length); + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length); + + case 'ascii': + return asciiWrite(this, string, offset, length); + + case 'latin1': + case 'binary': + return latin1Write(this, string, offset, length); + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length); + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length); + + default: + if (loweredCase) + throw new TypeError('Unknown encoding: ' + encoding); + encoding = ('' + encoding).toLowerCase(); + loweredCase = true; + } + } + }; + + Buffer.prototype.toJSON = function toJSON() { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + }; + }; + + function base64Slice(buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf); + } else { + return base64.fromByteArray(buf.slice(start, end)); + } + } + + function utf8Slice(buf, start, end) { + end = Math.min(buf.length, end); + var res = []; + + var i = start; + while (i < end) { + var firstByte = buf[i]; + var codePoint = null; + var bytesPerSequence = + firstByte > 0xef + ? 4 + : firstByte > 0xdf ? 3 : firstByte > 0xbf ? 2 : 1; + + if (i + bytesPerSequence <= end) { + var secondByte, thirdByte, fourthByte, tempCodePoint; + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte; + } + break; + case 2: + secondByte = buf[i + 1]; + if ((secondByte & 0xc0) === 0x80) { + tempCodePoint = + ((firstByte & 0x1f) << 0x6) | (secondByte & 0x3f); + if (tempCodePoint > 0x7f) { + codePoint = tempCodePoint; + } + } + break; + case 3: + secondByte = buf[i + 1]; + thirdByte = buf[i + 2]; + if ( + (secondByte & 0xc0) === 0x80 && + (thirdByte & 0xc0) === 0x80 + ) { + tempCodePoint = + ((firstByte & 0xf) << 0xc) | + ((secondByte & 0x3f) << 0x6) | + (thirdByte & 0x3f); + if ( + tempCodePoint > 0x7ff && + (tempCodePoint < 0xd800 || tempCodePoint > 0xdfff) + ) { + codePoint = tempCodePoint; + } + } + break; + case 4: + secondByte = buf[i + 1]; + thirdByte = buf[i + 2]; + fourthByte = buf[i + 3]; + if ( + (secondByte & 0xc0) === 0x80 && + (thirdByte & 0xc0) === 0x80 && + (fourthByte & 0xc0) === 0x80 + ) { + tempCodePoint = + ((firstByte & 0xf) << 0x12) | + ((secondByte & 0x3f) << 0xc) | + ((thirdByte & 0x3f) << 0x6) | + (fourthByte & 0x3f); + if ( + tempCodePoint > 0xffff && + tempCodePoint < 0x110000 + ) { + codePoint = tempCodePoint; + } + } + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xfffd; + bytesPerSequence = 1; + } else if (codePoint > 0xffff) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000; + res.push(((codePoint >>> 10) & 0x3ff) | 0xd800); + codePoint = 0xdc00 | (codePoint & 0x3ff); + } + + res.push(codePoint); + i += bytesPerSequence; + } + + return decodeCodePointsArray(res); + } + + // Based on http://stackoverflow.com/a/22747272/680742, the browser with + // the lowest limit is Chrome, with 0x10000 args. + // We go 1 magnitude less, for safety + var MAX_ARGUMENTS_LENGTH = 0x1000; + + function decodeCodePointsArray(codePoints) { + var len = codePoints.length; + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints); // avoid extra slice() + } + + // Decode in chunks to avoid "call stack size exceeded". + var res = ''; + var i = 0; + while (i < len) { + res += String.fromCharCode.apply( + String, + codePoints.slice(i, (i += MAX_ARGUMENTS_LENGTH)) + ); + } + return res; + } + + function asciiSlice(buf, start, end) { + var ret = ''; + end = Math.min(buf.length, end); + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7f); + } + return ret; + } + + function latin1Slice(buf, start, end) { + var ret = ''; + end = Math.min(buf.length, end); + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]); + } + return ret; + } + + function hexSlice(buf, start, end) { + var len = buf.length; + + if (!start || start < 0) start = 0; + if (!end || end < 0 || end > len) end = len; + + var out = ''; + for (var i = start; i < end; ++i) { + out += toHex(buf[i]); + } + return out; + } + + function utf16leSlice(buf, start, end) { + var bytes = buf.slice(start, end); + var res = ''; + for (var i = 0; i < bytes.length; i += 2) { + res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); + } + return res; + } + + Buffer.prototype.slice = function slice(start, end) { + var len = this.length; + start = ~~start; + end = end === undefined ? len : ~~end; + + if (start < 0) { + start += len; + if (start < 0) start = 0; + } else if (start > len) { + start = len; + } + + if (end < 0) { + end += len; + if (end < 0) end = 0; + } else if (end > len) { + end = len; + } + + if (end < start) end = start; + + var newBuf; + if (Buffer.TYPED_ARRAY_SUPPORT) { + newBuf = this.subarray(start, end); + newBuf.__proto__ = Buffer.prototype; + } else { + var sliceLen = end - start; + newBuf = new Buffer(sliceLen, undefined); + for (var i = 0; i < sliceLen; ++i) { + newBuf[i] = this[i + start]; + } + } + + return newBuf; + }; + + /* + * Need to make sure that buffer isn't trying to write out of bounds. + */ + function checkOffset(offset, ext, length) { + if (offset % 1 !== 0 || offset < 0) + throw new RangeError('offset is not uint'); + if (offset + ext > length) + throw new RangeError('Trying to access beyond buffer length'); + } + + Buffer.prototype.readUIntLE = function readUIntLE( + offset, + byteLength, + noAssert + ) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) checkOffset(offset, byteLength, this.length); + + var val = this[offset]; + var mul = 1; + var i = 0; + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul; + } + + return val; + }; + + Buffer.prototype.readUIntBE = function readUIntBE( + offset, + byteLength, + noAssert + ) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) { + checkOffset(offset, byteLength, this.length); + } + + var val = this[offset + --byteLength]; + var mul = 1; + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul; + } + + return val; + }; + + Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length); + return this[offset]; + }; + + Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + return this[offset] | (this[offset + 1] << 8); + }; + + Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + return (this[offset] << 8) | this[offset + 1]; + }; + + Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return ( + (this[offset] | (this[offset + 1] << 8) | (this[offset + 2] << 16)) + + this[offset + 3] * 0x1000000 + ); + }; + + Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return ( + this[offset] * 0x1000000 + + ((this[offset + 1] << 16) | (this[offset + 2] << 8) | this[offset + 3]) + ); + }; + + Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) checkOffset(offset, byteLength, this.length); + + var val = this[offset]; + var mul = 1; + var i = 0; + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul; + } + mul *= 0x80; + + if (val >= mul) val -= Math.pow(2, 8 * byteLength); + + return val; + }; + + Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) checkOffset(offset, byteLength, this.length); + + var i = byteLength; + var mul = 1; + var val = this[offset + --i]; + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul; + } + mul *= 0x80; + + if (val >= mul) val -= Math.pow(2, 8 * byteLength); + + return val; + }; + + Buffer.prototype.readInt8 = function readInt8(offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length); + if (!(this[offset] & 0x80)) return this[offset]; + return (0xff - this[offset] + 1) * -1; + }; + + Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + var val = this[offset] | (this[offset + 1] << 8); + return val & 0x8000 ? val | 0xffff0000 : val; + }; + + Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + var val = this[offset + 1] | (this[offset] << 8); + return val & 0x8000 ? val | 0xffff0000 : val; + }; + + Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return ( + this[offset] | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) + ); + }; + + Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + + return ( + (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + this[offset + 3] + ); + }; + + Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + return ieee754.read(this, offset, true, 23, 4); + }; + + Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + return ieee754.read(this, offset, false, 23, 4); + }; + + Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length); + return ieee754.read(this, offset, true, 52, 8); + }; + + Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length); + return ieee754.read(this, offset, false, 52, 8); + }; + + function checkInt(buf, value, offset, ext, max, min) { + if (!Buffer.isBuffer(buf)) + throw new TypeError('"buffer" argument must be a Buffer instance'); + if (value > max || value < min) + throw new RangeError('"value" argument is out of bounds'); + if (offset + ext > buf.length) throw new RangeError('Index out of range'); + } + + Buffer.prototype.writeUIntLE = function writeUIntLE( + value, + offset, + byteLength, + noAssert + ) { + value = +value; + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1; + checkInt(this, value, offset, byteLength, maxBytes, 0); + } + + var mul = 1; + var i = 0; + this[offset] = value & 0xff; + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xff; + } + + return offset + byteLength; + }; + + Buffer.prototype.writeUIntBE = function writeUIntBE( + value, + offset, + byteLength, + noAssert + ) { + value = +value; + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1; + checkInt(this, value, offset, byteLength, maxBytes, 0); + } + + var i = byteLength - 1; + var mul = 1; + this[offset + i] = value & 0xff; + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xff; + } + + return offset + byteLength; + }; + + Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0); + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value); + this[offset] = value & 0xff; + return offset + 1; + }; + + function objectWriteUInt16(buf, value, offset, littleEndian) { + if (value < 0) value = 0xffff + value + 1; + for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { + buf[offset + i] = + (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> + ((littleEndian ? i : 1 - i) * 8); + } + } + + Buffer.prototype.writeUInt16LE = function writeUInt16LE( + value, + offset, + noAssert + ) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value & 0xff; + this[offset + 1] = value >>> 8; + } else { + objectWriteUInt16(this, value, offset, true); + } + return offset + 2; + }; + + Buffer.prototype.writeUInt16BE = function writeUInt16BE( + value, + offset, + noAssert + ) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 8; + this[offset + 1] = value & 0xff; + } else { + objectWriteUInt16(this, value, offset, false); + } + return offset + 2; + }; + + function objectWriteUInt32(buf, value, offset, littleEndian) { + if (value < 0) value = 0xffffffff + value + 1; + for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { + buf[offset + i] = (value >>> ((littleEndian ? i : 3 - i) * 8)) & 0xff; + } + } + + Buffer.prototype.writeUInt32LE = function writeUInt32LE( + value, + offset, + noAssert + ) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset + 3] = value >>> 24; + this[offset + 2] = value >>> 16; + this[offset + 1] = value >>> 8; + this[offset] = value & 0xff; + } else { + objectWriteUInt32(this, value, offset, true); + } + return offset + 4; + }; + + Buffer.prototype.writeUInt32BE = function writeUInt32BE( + value, + offset, + noAssert + ) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 24; + this[offset + 1] = value >>> 16; + this[offset + 2] = value >>> 8; + this[offset + 3] = value & 0xff; + } else { + objectWriteUInt32(this, value, offset, false); + } + return offset + 4; + }; + + Buffer.prototype.writeIntLE = function writeIntLE( + value, + offset, + byteLength, + noAssert + ) { + value = +value; + offset = offset | 0; + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1); + + checkInt(this, value, offset, byteLength, limit - 1, -limit); + } + + var i = 0; + var mul = 1; + var sub = 0; + this[offset] = value & 0xff; + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1; + } + this[offset + i] = (((value / mul) >> 0) - sub) & 0xff; + } + + return offset + byteLength; + }; + + Buffer.prototype.writeIntBE = function writeIntBE( + value, + offset, + byteLength, + noAssert + ) { + value = +value; + offset = offset | 0; + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1); + + checkInt(this, value, offset, byteLength, limit - 1, -limit); + } + + var i = byteLength - 1; + var mul = 1; + var sub = 0; + this[offset + i] = value & 0xff; + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1; + } + this[offset + i] = (((value / mul) >> 0) - sub) & 0xff; + } + + return offset + byteLength; + }; + + Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80); + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value); + if (value < 0) value = 0xff + value + 1; + this[offset] = value & 0xff; + return offset + 1; + }; + + Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value & 0xff; + this[offset + 1] = value >>> 8; + } else { + objectWriteUInt16(this, value, offset, true); + } + return offset + 2; + }; + + Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 8; + this[offset + 1] = value & 0xff; + } else { + objectWriteUInt16(this, value, offset, false); + } + return offset + 2; + }; + + Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value & 0xff; + this[offset + 1] = value >>> 8; + this[offset + 2] = value >>> 16; + this[offset + 3] = value >>> 24; + } else { + objectWriteUInt32(this, value, offset, true); + } + return offset + 4; + }; + + Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); + if (value < 0) value = 0xffffffff + value + 1; + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 24; + this[offset + 1] = value >>> 16; + this[offset + 2] = value >>> 8; + this[offset + 3] = value & 0xff; + } else { + objectWriteUInt32(this, value, offset, false); + } + return offset + 4; + }; + + function checkIEEE754(buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range'); + if (offset < 0) throw new RangeError('Index out of range'); + } + + function writeFloat(buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754( + buf, + value, + offset, + 4, + 3.4028234663852886e38, + -3.4028234663852886e38 + ); + } + ieee754.write(buf, value, offset, littleEndian, 23, 4); + return offset + 4; + } + + Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert); + }; + + Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert); + }; + + function writeDouble(buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754( + buf, + value, + offset, + 8, + 1.7976931348623157e308, + -1.7976931348623157e308 + ); + } + ieee754.write(buf, value, offset, littleEndian, 52, 8); + return offset + 8; + } + + Buffer.prototype.writeDoubleLE = function writeDoubleLE( + value, + offset, + noAssert + ) { + return writeDouble(this, value, offset, true, noAssert); + }; + + Buffer.prototype.writeDoubleBE = function writeDoubleBE( + value, + offset, + noAssert + ) { + return writeDouble(this, value, offset, false, noAssert); + }; + + // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) + Buffer.prototype.copy = function copy(target, targetStart, start, end) { + if (!start) start = 0; + if (!end && end !== 0) end = this.length; + if (targetStart >= target.length) targetStart = target.length; + if (!targetStart) targetStart = 0; + if (end > 0 && end < start) end = start; + + // Copy 0 bytes; we're done + if (end === start) return 0; + if (target.length === 0 || this.length === 0) return 0; + + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds'); + } + if (start < 0 || start >= this.length) + throw new RangeError('sourceStart out of bounds'); + if (end < 0) throw new RangeError('sourceEnd out of bounds'); + + // Are we oob? + if (end > this.length) end = this.length; + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start; + } + + var len = end - start; + var i; + + if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start]; + } + } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { + // ascending copy from start + for (i = 0; i < len; ++i) { + target[i + targetStart] = this[i + start]; + } + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, start + len), + targetStart + ); + } + + return len; + }; + + // Usage: + // buffer.fill(number[, offset[, end]]) + // buffer.fill(buffer[, offset[, end]]) + // buffer.fill(string[, offset[, end]][, encoding]) + Buffer.prototype.fill = function fill(val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start; + start = 0; + end = this.length; + } else if (typeof end === 'string') { + encoding = end; + end = this.length; + } + if (val.length === 1) { + var code = val.charCodeAt(0); + if (code < 256) { + val = code; + } + } + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string'); + } + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding); + } + } else if (typeof val === 'number') { + val = val & 255; + } + + // Invalid ranges are not set to a default, so can range check early. + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index'); + } + + if (end <= start) { + return this; + } + + start = start >>> 0; + end = end === undefined ? this.length : end >>> 0; + + if (!val) val = 0; + + var i; + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val; + } + } else { + var bytes = Buffer.isBuffer(val) + ? val + : utf8ToBytes(new Buffer(val, encoding).toString()); + var len = bytes.length; + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len]; + } + } + + return this; + }; + + // HELPER FUNCTIONS + // ================ + + var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g; + + function base64clean(str) { + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = stringtrim(str).replace(INVALID_BASE64_RE, ''); + // Node converts strings with length < 2 to '' + if (str.length < 2) return ''; + // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + while (str.length % 4 !== 0) { + str = str + '='; + } + return str; + } + + function stringtrim(str) { + if (str.trim) return str.trim(); + return str.replace(/^\s+|\s+$/g, ''); + } + + function toHex(n) { + if (n < 16) return '0' + n.toString(16); + return n.toString(16); + } + + function utf8ToBytes(string, units) { + units = units || Infinity; + var codePoint; + var length = string.length; + var leadSurrogate = null; + var bytes = []; + + for (var i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i); + + // is surrogate component + if (codePoint > 0xd7ff && codePoint < 0xe000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xdbff) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xef, 0xbf, 0xbd); + continue; + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xef, 0xbf, 0xbd); + continue; + } + + // valid lead + leadSurrogate = codePoint; + + continue; + } + + // 2 leads in a row + if (codePoint < 0xdc00) { + if ((units -= 3) > -1) bytes.push(0xef, 0xbf, 0xbd); + leadSurrogate = codePoint; + continue; + } + + // valid surrogate pair + codePoint = + (((leadSurrogate - 0xd800) << 10) | (codePoint - 0xdc00)) + + 0x10000; + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xef, 0xbf, 0xbd); + } + + leadSurrogate = null; + + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break; + bytes.push(codePoint); + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break; + bytes.push((codePoint >> 0x6) | 0xc0, (codePoint & 0x3f) | 0x80); + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break; + bytes.push( + (codePoint >> 0xc) | 0xe0, + ((codePoint >> 0x6) & 0x3f) | 0x80, + (codePoint & 0x3f) | 0x80 + ); + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break; + bytes.push( + (codePoint >> 0x12) | 0xf0, + ((codePoint >> 0xc) & 0x3f) | 0x80, + ((codePoint >> 0x6) & 0x3f) | 0x80, + (codePoint & 0x3f) | 0x80 + ); + } else { + throw new Error('Invalid code point'); + } + } + + return bytes; + } + + function asciiToBytes(str) { + var byteArray = []; + for (var i = 0; i < str.length; ++i) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xff); + } + return byteArray; + } + + function utf16leToBytes(str, units) { + var c, hi, lo; + var byteArray = []; + for (var i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break; + + c = str.charCodeAt(i); + hi = c >> 8; + lo = c % 256; + byteArray.push(lo); + byteArray.push(hi); + } + + return byteArray; + } + + function base64ToBytes(str) { + return base64.toByteArray(base64clean(str)); + } + + function blitBuffer(src, dst, offset, length) { + for (var i = 0; i < length; ++i) { + if (i + offset >= dst.length || i >= src.length) break; + dst[i + offset] = src[i]; + } + return i; + } + + function isnan(val) { + return val !== val; // eslint-disable-line no-self-compare + } + + /* WEBPACK VAR INJECTION */ + }.call( + exports, + (function() { + return this; + })() + )); + + /***/ + }, + /* 301 */ + /***/ function(module, exports) { + 'use strict'; + + exports.byteLength = byteLength; + exports.toByteArray = toByteArray; + exports.fromByteArray = fromByteArray; + + var lookup = []; + var revLookup = []; + var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; + + var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i]; + revLookup[code.charCodeAt(i)] = i; + } + + revLookup['-'.charCodeAt(0)] = 62; + revLookup['_'.charCodeAt(0)] = 63; + + function placeHoldersCount(b64) { + var len = b64.length; + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4'); + } + + // the number of equal signs (place holders) + // if there are two placeholders, than the two characters before it + // represent one byte + // if there is only one, then the three characters before it represent 2 bytes + // this is just a cheap hack to not do indexOf twice + return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0; + } + + function byteLength(b64) { + // base64 is 4/3 + up to two characters of the original data + return b64.length * 3 / 4 - placeHoldersCount(b64); + } + + function toByteArray(b64) { + var i, j, l, tmp, placeHolders, arr; + var len = b64.length; + placeHolders = placeHoldersCount(b64); + + arr = new Arr(len * 3 / 4 - placeHolders); + + // if there are placeholders, only get up to the last complete 4 chars + l = placeHolders > 0 ? len - 4 : len; + + var L = 0; + + for (i = 0, j = 0; i < l; i += 4, j += 3) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)]; + arr[L++] = (tmp >> 16) & 0xff; + arr[L++] = (tmp >> 8) & 0xff; + arr[L++] = tmp & 0xff; + } + + if (placeHolders === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4); + arr[L++] = tmp & 0xff; + } else if (placeHolders === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2); + arr[L++] = (tmp >> 8) & 0xff; + arr[L++] = tmp & 0xff; + } + + return arr; + } + + function tripletToBase64(num) { + return ( + lookup[(num >> 18) & 0x3f] + + lookup[(num >> 12) & 0x3f] + + lookup[(num >> 6) & 0x3f] + + lookup[num & 0x3f] + ); + } + + function encodeChunk(uint8, start, end) { + var tmp; + var output = []; + for (var i = start; i < end; i += 3) { + tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2]; + output.push(tripletToBase64(tmp)); + } + return output.join(''); + } + + function fromByteArray(uint8) { + var tmp; + var len = uint8.length; + var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes + var output = ''; + var parts = []; + var maxChunkLength = 16383; // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push( + encodeChunk( + uint8, + i, + i + maxChunkLength > len2 ? len2 : i + maxChunkLength + ) + ); + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1]; + output += lookup[tmp >> 2]; + output += lookup[(tmp << 4) & 0x3f]; + output += '=='; + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1]; + output += lookup[tmp >> 10]; + output += lookup[(tmp >> 4) & 0x3f]; + output += lookup[(tmp << 2) & 0x3f]; + output += '='; + } + + parts.push(output); + + return parts.join(''); + } + + /***/ + }, + /* 302 */ + /***/ function(module, exports) { + exports.read = function(buffer, offset, isLE, mLen, nBytes) { + var e, m; + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var nBits = -7; + var i = isLE ? nBytes - 1 : 0; + var d = isLE ? -1 : 1; + var s = buffer[offset + i]; + + i += d; + + e = s & ((1 << -nBits) - 1); + s >>= -nBits; + nBits += eLen; + for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} + + m = e & ((1 << -nBits) - 1); + e >>= -nBits; + nBits += mLen; + for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : (s ? -1 : 1) * Infinity; + } else { + m = m + Math.pow(2, mLen); + e = e - eBias; + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen); + }; + + exports.write = function(buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c; + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; + var i = isLE ? 0 : nBytes - 1; + var d = isLE ? 1 : -1; + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; + + value = Math.abs(value); + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0; + e = eMax; + } else { + e = Math.floor(Math.log(value) / Math.LN2); + if (value * (c = Math.pow(2, -e)) < 1) { + e--; + c *= 2; + } + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * Math.pow(2, 1 - eBias); + } + if (value * c >= 2) { + e++; + c /= 2; + } + + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * Math.pow(2, mLen); + e = e + eBias; + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); + e = 0; + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = (e << mLen) | m; + eLen += mLen; + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128; + }; + + /***/ + }, + /* 303 */ + /***/ function(module, exports) { + var toString = {}.toString; + + module.exports = + Array.isArray || + function(arr) { + return toString.call(arr) == '[object Array]'; + }; + + /***/ + }, + /* 304 */ + /***/ function(module, exports) { + // Copyright (c) 2008, Fair Oaks Labs, Inc. + // 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 Fair Oaks Labs, 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. + // + // + // Modifications to writeIEEE754 to support negative zeroes made by Brian White + + var readIEEE754 = function(buffer, offset, endian, mLen, nBytes) { + var e, + m, + bBE = endian === 'big', + eLen = nBytes * 8 - mLen - 1, + eMax = (1 << eLen) - 1, + eBias = eMax >> 1, + nBits = -7, + i = bBE ? 0 : nBytes - 1, + d = bBE ? 1 : -1, + s = buffer[offset + i]; + + i += d; + + e = s & ((1 << -nBits) - 1); + s >>= -nBits; + nBits += eLen; + for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); + + m = e & ((1 << -nBits) - 1); + e >>= -nBits; + nBits += mLen; + for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); + + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : (s ? -1 : 1) * Infinity; + } else { + m = m + Math.pow(2, mLen); + e = e - eBias; + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen); + }; + + var writeIEEE754 = function(buffer, value, offset, endian, mLen, nBytes) { + var e, + m, + c, + bBE = endian === 'big', + eLen = nBytes * 8 - mLen - 1, + eMax = (1 << eLen) - 1, + eBias = eMax >> 1, + rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, + i = bBE ? nBytes - 1 : 0, + d = bBE ? -1 : 1, + s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; + + value = Math.abs(value); + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0; + e = eMax; + } else { + e = Math.floor(Math.log(value) / Math.LN2); + if (value * (c = Math.pow(2, -e)) < 1) { + e--; + c *= 2; + } + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * Math.pow(2, 1 - eBias); + } + if (value * c >= 2) { + e++; + c /= 2; + } + + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * Math.pow(2, mLen); + e = e + eBias; + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); + e = 0; + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); + + e = (e << mLen) | m; + eLen += mLen; + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); + + buffer[offset + i - d] |= s * 128; + }; + + exports.readIEEE754 = readIEEE754; + exports.writeIEEE754 = writeIEEE754; + + /***/ + }, + /* 305 */ + /***/ function(module, exports) { + /* WEBPACK VAR INJECTION */ (function(global) { + 'use strict'; + + // We have an ES6 Map available, return the native instance + + if (typeof global.Map !== 'undefined') { + module.exports = global.Map; + module.exports.Map = global.Map; + } else { + // We will return a polyfill + var Map = function(array) { + this._keys = []; + this._values = {}; + + for (var i = 0; i < array.length; i++) { + if (array[i] == null) continue; // skip null and undefined + var entry = array[i]; + var key = entry[0]; + var value = entry[1]; + // Add the key to the list of keys in order + this._keys.push(key); + // Add the key and value to the values dictionary with a point + // to the location in the ordered keys list + this._values[key] = { v: value, i: this._keys.length - 1 }; + } + }; + + Map.prototype.clear = function() { + this._keys = []; + this._values = {}; + }; + + Map.prototype.delete = function(key) { + var value = this._values[key]; + if (value == null) return false; + // Delete entry + delete this._values[key]; + // Remove the key from the ordered keys list + this._keys.splice(value.i, 1); + return true; + }; + + Map.prototype.entries = function() { + var self = this; + var index = 0; + + return { + next: function() { + var key = self._keys[index++]; + return { + value: + key !== undefined + ? [key, self._values[key].v] + : undefined, + done: key !== undefined ? false : true + }; + } + }; + }; + + Map.prototype.forEach = function(callback, self) { + self = self || this; + + for (var i = 0; i < this._keys.length; i++) { + var key = this._keys[i]; + // Call the forEach callback + callback.call(self, this._values[key].v, key, self); + } + }; + + Map.prototype.get = function(key) { + return this._values[key] ? this._values[key].v : undefined; + }; + + Map.prototype.has = function(key) { + return this._values[key] != null; + }; + + Map.prototype.keys = function(key) { + var self = this; + var index = 0; + + return { + next: function() { + var key = self._keys[index++]; + return { + value: key !== undefined ? key : undefined, + done: key !== undefined ? false : true + }; + } + }; + }; + + Map.prototype.set = function(key, value) { + if (this._values[key]) { + this._values[key].v = value; + return this; + } + + // Add the key to the list of keys in order + this._keys.push(key); + // Add the key and value to the values dictionary with a point + // to the location in the ordered keys list + this._values[key] = { v: value, i: this._keys.length - 1 }; + return this; + }; + + Map.prototype.values = function(key, value) { + var self = this; + var index = 0; + + return { + next: function() { + var key = self._keys[index++]; + return { + value: key !== undefined ? self._values[key].v : undefined, + done: key !== undefined ? false : true + }; + } + }; + }; + + // Last ismaster + Object.defineProperty(Map.prototype, 'size', { + enumerable: true, + get: function() { + return this._keys.length; + } + }); + + module.exports = Map; + module.exports.Map = Map; + } + /* WEBPACK VAR INJECTION */ + }.call( + exports, + (function() { + return this; + })() + )); + + /***/ + }, + /* 306 */ + /***/ function(module, exports) { + // Licensed under the Apache License, Version 2.0 (the "License"); + // you may not use this file except in compliance with the License. + // You may obtain a copy of the License at + // + // http://www.apache.org/licenses/LICENSE-2.0 + // + // Unless required by applicable law or agreed to in writing, software + // distributed under the License is distributed on an "AS IS" BASIS, + // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + // See the License for the specific language governing permissions and + // limitations under the License. + // + // Copyright 2009 Google Inc. All Rights Reserved + + /** + * Defines a Long class for representing a 64-bit two's-complement + * integer value, which faithfully simulates the behavior of a Java "Long". This + * implementation is derived from LongLib in GWT. + * + * Constructs a 64-bit two's-complement integer, given its low and high 32-bit + * values as *signed* integers. See the from* functions below for more + * convenient ways of constructing Longs. + * + * The internal representation of a Long is the two given signed, 32-bit values. + * We use 32-bit pieces because these are the size of integers on which + * Javascript performs bit-operations. For operations like addition and + * multiplication, we split each number into 16-bit pieces, which can easily be + * multiplied within Javascript's floating-point representation without overflow + * or change in sign. + * + * In the algorithms below, we frequently reduce the negative case to the + * positive case by negating the input(s) and then post-processing the result. + * Note that we must ALWAYS check specially whether those values are MIN_VALUE + * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as + * a positive number, it overflows back into a negative). Not handling this + * case would often result in infinite recursion. + * + * @class + * @param {number} low the low (signed) 32 bits of the Long. + * @param {number} high the high (signed) 32 bits of the Long. + * @return {Long} + */ + function Long(low, high) { + if (!(this instanceof Long)) return new Long(low, high); + + this._bsontype = 'Long'; + /** + * @type {number} + * @ignore + */ + this.low_ = low | 0; // force into 32 signed bits. + + /** + * @type {number} + * @ignore + */ + this.high_ = high | 0; // force into 32 signed bits. + } + + /** + * Return the int value. + * + * @method + * @return {number} the value, assuming it is a 32-bit integer. + */ + Long.prototype.toInt = function() { + return this.low_; + }; + + /** + * Return the Number value. + * + * @method + * @return {number} the closest floating-point representation to this value. + */ + Long.prototype.toNumber = function() { + return this.high_ * Long.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned(); + }; + + /** + * Return the JSON value. + * + * @method + * @return {string} the JSON representation. + */ + Long.prototype.toJSON = function() { + return this.toString(); + }; + + /** + * Return the String value. + * + * @method + * @param {number} [opt_radix] the radix in which the text should be written. + * @return {string} the textual representation of this value. + */ + Long.prototype.toString = function(opt_radix) { + var radix = opt_radix || 10; + if (radix < 2 || 36 < radix) { + throw Error('radix out of range: ' + radix); + } + + if (this.isZero()) { + return '0'; + } + + if (this.isNegative()) { + if (this.equals(Long.MIN_VALUE)) { + // We need to change the Long value before it can be negated, so we remove + // the bottom-most digit in this base and then recurse to do the rest. + var radixLong = Long.fromNumber(radix); + var div = this.div(radixLong); + var rem = div.multiply(radixLong).subtract(this); + return div.toString(radix) + rem.toInt().toString(radix); + } else { + return '-' + this.negate().toString(radix); + } + } + + // Do several (6) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = Long.fromNumber(Math.pow(radix, 6)); + + var rem = this; + var result = ''; + while (true) { + var remDiv = rem.div(radixToPower); + var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); + var digits = intval.toString(radix); + + rem = remDiv; + if (rem.isZero()) { + return digits + result; + } else { + while (digits.length < 6) { + digits = '0' + digits; + } + result = '' + digits + result; + } + } + }; + + /** + * Return the high 32-bits value. + * + * @method + * @return {number} the high 32-bits as a signed value. + */ + Long.prototype.getHighBits = function() { + return this.high_; + }; + + /** + * Return the low 32-bits value. + * + * @method + * @return {number} the low 32-bits as a signed value. + */ + Long.prototype.getLowBits = function() { + return this.low_; + }; + + /** + * Return the low unsigned 32-bits value. + * + * @method + * @return {number} the low 32-bits as an unsigned value. + */ + Long.prototype.getLowBitsUnsigned = function() { + return this.low_ >= 0 ? this.low_ : Long.TWO_PWR_32_DBL_ + this.low_; + }; + + /** + * Returns the number of bits needed to represent the absolute value of this Long. + * + * @method + * @return {number} Returns the number of bits needed to represent the absolute value of this Long. + */ + Long.prototype.getNumBitsAbs = function() { + if (this.isNegative()) { + if (this.equals(Long.MIN_VALUE)) { + return 64; + } else { + return this.negate().getNumBitsAbs(); + } + } else { + var val = this.high_ != 0 ? this.high_ : this.low_; + for (var bit = 31; bit > 0; bit--) { + if ((val & (1 << bit)) != 0) { + break; + } + } + return this.high_ != 0 ? bit + 33 : bit + 1; + } + }; + + /** + * Return whether this value is zero. + * + * @method + * @return {boolean} whether this value is zero. + */ + Long.prototype.isZero = function() { + return this.high_ == 0 && this.low_ == 0; + }; + + /** + * Return whether this value is negative. + * + * @method + * @return {boolean} whether this value is negative. + */ + Long.prototype.isNegative = function() { + return this.high_ < 0; + }; + + /** + * Return whether this value is odd. + * + * @method + * @return {boolean} whether this value is odd. + */ + Long.prototype.isOdd = function() { + return (this.low_ & 1) == 1; + }; + + /** + * Return whether this Long equals the other + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long equals the other + */ + Long.prototype.equals = function(other) { + return this.high_ == other.high_ && this.low_ == other.low_; + }; + + /** + * Return whether this Long does not equal the other. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long does not equal the other. + */ + Long.prototype.notEquals = function(other) { + return this.high_ != other.high_ || this.low_ != other.low_; + }; + + /** + * Return whether this Long is less than the other. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long is less than the other. + */ + Long.prototype.lessThan = function(other) { + return this.compare(other) < 0; + }; + + /** + * Return whether this Long is less than or equal to the other. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long is less than or equal to the other. + */ + Long.prototype.lessThanOrEqual = function(other) { + return this.compare(other) <= 0; + }; + + /** + * Return whether this Long is greater than the other. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long is greater than the other. + */ + Long.prototype.greaterThan = function(other) { + return this.compare(other) > 0; + }; + + /** + * Return whether this Long is greater than or equal to the other. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long is greater than or equal to the other. + */ + Long.prototype.greaterThanOrEqual = function(other) { + return this.compare(other) >= 0; + }; + + /** + * Compares this Long with the given one. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. + */ + Long.prototype.compare = function(other) { + if (this.equals(other)) { + return 0; + } + + var thisNeg = this.isNegative(); + var otherNeg = other.isNegative(); + if (thisNeg && !otherNeg) { + return -1; + } + if (!thisNeg && otherNeg) { + return 1; + } + + // at this point, the signs are the same, so subtraction will not overflow + if (this.subtract(other).isNegative()) { + return -1; + } else { + return 1; + } + }; + + /** + * The negation of this value. + * + * @method + * @return {Long} the negation of this value. + */ + Long.prototype.negate = function() { + if (this.equals(Long.MIN_VALUE)) { + return Long.MIN_VALUE; + } else { + return this.not().add(Long.ONE); + } + }; + + /** + * Returns the sum of this and the given Long. + * + * @method + * @param {Long} other Long to add to this one. + * @return {Long} the sum of this and the given Long. + */ + Long.prototype.add = function(other) { + // Divide each number into 4 chunks of 16 bits, and then sum the chunks. + + var a48 = this.high_ >>> 16; + var a32 = this.high_ & 0xffff; + var a16 = this.low_ >>> 16; + var a00 = this.low_ & 0xffff; + + var b48 = other.high_ >>> 16; + var b32 = other.high_ & 0xffff; + var b16 = other.low_ >>> 16; + var b00 = other.low_ & 0xffff; + + var c48 = 0, + c32 = 0, + c16 = 0, + c00 = 0; + c00 += a00 + b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 + b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 + b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 + b48; + c48 &= 0xffff; + return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); + }; + + /** + * Returns the difference of this and the given Long. + * + * @method + * @param {Long} other Long to subtract from this. + * @return {Long} the difference of this and the given Long. + */ + Long.prototype.subtract = function(other) { + return this.add(other.negate()); + }; + + /** + * Returns the product of this and the given Long. + * + * @method + * @param {Long} other Long to multiply with this. + * @return {Long} the product of this and the other. + */ + Long.prototype.multiply = function(other) { + if (this.isZero()) { + return Long.ZERO; + } else if (other.isZero()) { + return Long.ZERO; + } + + if (this.equals(Long.MIN_VALUE)) { + return other.isOdd() ? Long.MIN_VALUE : Long.ZERO; + } else if (other.equals(Long.MIN_VALUE)) { + return this.isOdd() ? Long.MIN_VALUE : Long.ZERO; + } + + if (this.isNegative()) { + if (other.isNegative()) { + return this.negate().multiply(other.negate()); + } else { + return this.negate() + .multiply(other) + .negate(); + } + } else if (other.isNegative()) { + return this.multiply(other.negate()).negate(); + } + + // If both Longs are small, use float multiplication + if (this.lessThan(Long.TWO_PWR_24_) && other.lessThan(Long.TWO_PWR_24_)) { + return Long.fromNumber(this.toNumber() * other.toNumber()); + } + + // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products. + // We can skip products that would overflow. + + var a48 = this.high_ >>> 16; + var a32 = this.high_ & 0xffff; + var a16 = this.low_ >>> 16; + var a00 = this.low_ & 0xffff; + + var b48 = other.high_ >>> 16; + var b32 = other.high_ & 0xffff; + var b16 = other.low_ >>> 16; + var b00 = other.low_ & 0xffff; + + var c48 = 0, + c32 = 0, + c16 = 0, + c00 = 0; + c00 += a00 * b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 * b00; + c32 += c16 >>> 16; + c16 &= 0xffff; + c16 += a00 * b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 * b00; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a16 * b16; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a00 * b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; + c48 &= 0xffff; + return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); + }; + + /** + * Returns this Long divided by the given one. + * + * @method + * @param {Long} other Long by which to divide. + * @return {Long} this Long divided by the given one. + */ + Long.prototype.div = function(other) { + if (other.isZero()) { + throw Error('division by zero'); + } else if (this.isZero()) { + return Long.ZERO; + } + + if (this.equals(Long.MIN_VALUE)) { + if (other.equals(Long.ONE) || other.equals(Long.NEG_ONE)) { + return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE + } else if (other.equals(Long.MIN_VALUE)) { + return Long.ONE; + } else { + // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. + var halfThis = this.shiftRight(1); + var approx = halfThis.div(other).shiftLeft(1); + if (approx.equals(Long.ZERO)) { + return other.isNegative() ? Long.ONE : Long.NEG_ONE; + } else { + var rem = this.subtract(other.multiply(approx)); + var result = approx.add(rem.div(other)); + return result; + } + } + } else if (other.equals(Long.MIN_VALUE)) { + return Long.ZERO; + } + + if (this.isNegative()) { + if (other.isNegative()) { + return this.negate().div(other.negate()); + } else { + return this.negate() + .div(other) + .negate(); + } + } else if (other.isNegative()) { + return this.div(other.negate()).negate(); + } + + // Repeat the following until the remainder is less than other: find a + // floating-point that approximates remainder / other *from below*, add this + // into the result, and subtract it from the remainder. It is critical that + // the approximate value is less than or equal to the real value so that the + // remainder never becomes negative. + var res = Long.ZERO; + var rem = this; + while (rem.greaterThanOrEqual(other)) { + // Approximate the result of division. This may be a little greater or + // smaller than the actual value. + var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); + + // We will tweak the approximate result by changing it in the 48-th digit or + // the smallest non-fractional digit, whichever is larger. + var log2 = Math.ceil(Math.log(approx) / Math.LN2); + var delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48); + + // Decrease the approximation until it is smaller than the remainder. Note + // that if it is too large, the product overflows and is negative. + var approxRes = Long.fromNumber(approx); + var approxRem = approxRes.multiply(other); + while (approxRem.isNegative() || approxRem.greaterThan(rem)) { + approx -= delta; + approxRes = Long.fromNumber(approx); + approxRem = approxRes.multiply(other); + } + + // We know the answer can't be zero... and actually, zero would cause + // infinite recursion since we would make no progress. + if (approxRes.isZero()) { + approxRes = Long.ONE; + } + + res = res.add(approxRes); + rem = rem.subtract(approxRem); + } + return res; + }; + + /** + * Returns this Long modulo the given one. + * + * @method + * @param {Long} other Long by which to mod. + * @return {Long} this Long modulo the given one. + */ + Long.prototype.modulo = function(other) { + return this.subtract(this.div(other).multiply(other)); + }; + + /** + * The bitwise-NOT of this value. + * + * @method + * @return {Long} the bitwise-NOT of this value. + */ + Long.prototype.not = function() { + return Long.fromBits(~this.low_, ~this.high_); + }; + + /** + * Returns the bitwise-AND of this Long and the given one. + * + * @method + * @param {Long} other the Long with which to AND. + * @return {Long} the bitwise-AND of this and the other. + */ + Long.prototype.and = function(other) { + return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_); + }; + + /** + * Returns the bitwise-OR of this Long and the given one. + * + * @method + * @param {Long} other the Long with which to OR. + * @return {Long} the bitwise-OR of this and the other. + */ + Long.prototype.or = function(other) { + return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_); + }; + + /** + * Returns the bitwise-XOR of this Long and the given one. + * + * @method + * @param {Long} other the Long with which to XOR. + * @return {Long} the bitwise-XOR of this and the other. + */ + Long.prototype.xor = function(other) { + return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); + }; + + /** + * Returns this Long with bits shifted to the left by the given amount. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Long} this shifted to the left by the given amount. + */ + Long.prototype.shiftLeft = function(numBits) { + numBits &= 63; + if (numBits == 0) { + return this; + } else { + var low = this.low_; + if (numBits < 32) { + var high = this.high_; + return Long.fromBits( + low << numBits, + (high << numBits) | (low >>> (32 - numBits)) + ); + } else { + return Long.fromBits(0, low << (numBits - 32)); + } + } + }; + + /** + * Returns this Long with bits shifted to the right by the given amount. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Long} this shifted to the right by the given amount. + */ + Long.prototype.shiftRight = function(numBits) { + numBits &= 63; + if (numBits == 0) { + return this; + } else { + var high = this.high_; + if (numBits < 32) { + var low = this.low_; + return Long.fromBits( + (low >>> numBits) | (high << (32 - numBits)), + high >> numBits + ); + } else { + return Long.fromBits(high >> (numBits - 32), high >= 0 ? 0 : -1); + } + } + }; + + /** + * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits. + */ + Long.prototype.shiftRightUnsigned = function(numBits) { + numBits &= 63; + if (numBits == 0) { + return this; + } else { + var high = this.high_; + if (numBits < 32) { + var low = this.low_; + return Long.fromBits( + (low >>> numBits) | (high << (32 - numBits)), + high >>> numBits + ); + } else if (numBits == 32) { + return Long.fromBits(high, 0); + } else { + return Long.fromBits(high >>> (numBits - 32), 0); + } + } + }; + + /** + * Returns a Long representing the given (32-bit) integer value. + * + * @method + * @param {number} value the 32-bit integer in question. + * @return {Long} the corresponding Long value. + */ + Long.fromInt = function(value) { + if (-128 <= value && value < 128) { + var cachedObj = Long.INT_CACHE_[value]; + if (cachedObj) { + return cachedObj; + } + } + + var obj = new Long(value | 0, value < 0 ? -1 : 0); + if (-128 <= value && value < 128) { + Long.INT_CACHE_[value] = obj; + } + return obj; + }; + + /** + * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + * + * @method + * @param {number} value the number in question. + * @return {Long} the corresponding Long value. + */ + Long.fromNumber = function(value) { + if (isNaN(value) || !isFinite(value)) { + return Long.ZERO; + } else if (value <= -Long.TWO_PWR_63_DBL_) { + return Long.MIN_VALUE; + } else if (value + 1 >= Long.TWO_PWR_63_DBL_) { + return Long.MAX_VALUE; + } else if (value < 0) { + return Long.fromNumber(-value).negate(); + } else { + return new Long( + (value % Long.TWO_PWR_32_DBL_) | 0, + (value / Long.TWO_PWR_32_DBL_) | 0 + ); + } + }; + + /** + * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. + * + * @method + * @param {number} lowBits the low 32-bits. + * @param {number} highBits the high 32-bits. + * @return {Long} the corresponding Long value. + */ + Long.fromBits = function(lowBits, highBits) { + return new Long(lowBits, highBits); + }; + + /** + * Returns a Long representation of the given string, written using the given radix. + * + * @method + * @param {string} str the textual representation of the Long. + * @param {number} opt_radix the radix in which the text is written. + * @return {Long} the corresponding Long value. + */ + Long.fromString = function(str, opt_radix) { + if (str.length == 0) { + throw Error('number format error: empty string'); + } + + var radix = opt_radix || 10; + if (radix < 2 || 36 < radix) { + throw Error('radix out of range: ' + radix); + } + + if (str.charAt(0) == '-') { + return Long.fromString(str.substring(1), radix).negate(); + } else if (str.indexOf('-') >= 0) { + throw Error('number format error: interior "-" character: ' + str); + } + + // Do several (8) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = Long.fromNumber(Math.pow(radix, 8)); + + var result = Long.ZERO; + for (var i = 0; i < str.length; i += 8) { + var size = Math.min(8, str.length - i); + var value = parseInt(str.substring(i, i + size), radix); + if (size < 8) { + var power = Long.fromNumber(Math.pow(radix, size)); + result = result.multiply(power).add(Long.fromNumber(value)); + } else { + result = result.multiply(radixToPower); + result = result.add(Long.fromNumber(value)); + } + } + return result; + }; + + // NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the + // from* methods on which they depend. + + /** + * A cache of the Long representations of small integer values. + * @type {Object} + * @ignore + */ + Long.INT_CACHE_ = {}; + + // NOTE: the compiler should inline these constant values below and then remove + // these variables, so there should be no runtime penalty for these. + + /** + * Number used repeated below in calculations. This must appear before the + * first call to any from* function below. + * @type {number} + * @ignore + */ + Long.TWO_PWR_16_DBL_ = 1 << 16; + + /** + * @type {number} + * @ignore + */ + Long.TWO_PWR_24_DBL_ = 1 << 24; + + /** + * @type {number} + * @ignore + */ + Long.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_; + + /** + * @type {number} + * @ignore + */ + Long.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2; + + /** + * @type {number} + * @ignore + */ + Long.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_; + + /** + * @type {number} + * @ignore + */ + Long.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_; + + /** + * @type {number} + * @ignore + */ + Long.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2; + + /** @type {Long} */ + Long.ZERO = Long.fromInt(0); + + /** @type {Long} */ + Long.ONE = Long.fromInt(1); + + /** @type {Long} */ + Long.NEG_ONE = Long.fromInt(-1); + + /** @type {Long} */ + Long.MAX_VALUE = Long.fromBits(0xffffffff | 0, 0x7fffffff | 0); + + /** @type {Long} */ + Long.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0); + + /** + * @type {Long} + * @ignore + */ + Long.TWO_PWR_24_ = Long.fromInt(1 << 24); + + /** + * Expose. + */ + module.exports = Long; + module.exports.Long = Long; + + /***/ + }, + /* 307 */ + /***/ function(module, exports) { + /** + * A class representation of the BSON Double type. + * + * @class + * @param {number} value the number we want to represent as a double. + * @return {Double} + */ + function Double(value) { + if (!(this instanceof Double)) return new Double(value); + + this._bsontype = 'Double'; + this.value = value; + } + + /** + * Access the number value. + * + * @method + * @return {number} returns the wrapped double number. + */ + Double.prototype.valueOf = function() { + return this.value; + }; + + /** + * @ignore + */ + Double.prototype.toJSON = function() { + return this.value; + }; + + module.exports = Double; + module.exports.Double = Double; + + /***/ + }, + /* 308 */ + /***/ function(module, exports) { + // Licensed under the Apache License, Version 2.0 (the "License"); + // you may not use this file except in compliance with the License. + // You may obtain a copy of the License at + // + // http://www.apache.org/licenses/LICENSE-2.0 + // + // Unless required by applicable law or agreed to in writing, software + // distributed under the License is distributed on an "AS IS" BASIS, + // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + // See the License for the specific language governing permissions and + // limitations under the License. + // + // Copyright 2009 Google Inc. All Rights Reserved + + /** + * This type is for INTERNAL use in MongoDB only and should not be used in applications. + * The appropriate corresponding type is the JavaScript Date type. + * + * Defines a Timestamp class for representing a 64-bit two's-complement + * integer value, which faithfully simulates the behavior of a Java "Timestamp". This + * implementation is derived from TimestampLib in GWT. + * + * Constructs a 64-bit two's-complement integer, given its low and high 32-bit + * values as *signed* integers. See the from* functions below for more + * convenient ways of constructing Timestamps. + * + * The internal representation of a Timestamp is the two given signed, 32-bit values. + * We use 32-bit pieces because these are the size of integers on which + * Javascript performs bit-operations. For operations like addition and + * multiplication, we split each number into 16-bit pieces, which can easily be + * multiplied within Javascript's floating-point representation without overflow + * or change in sign. + * + * In the algorithms below, we frequently reduce the negative case to the + * positive case by negating the input(s) and then post-processing the result. + * Note that we must ALWAYS check specially whether those values are MIN_VALUE + * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as + * a positive number, it overflows back into a negative). Not handling this + * case would often result in infinite recursion. + * + * @class + * @param {number} low the low (signed) 32 bits of the Timestamp. + * @param {number} high the high (signed) 32 bits of the Timestamp. + */ + function Timestamp(low, high) { + if (!(this instanceof Timestamp)) return new Timestamp(low, high); + this._bsontype = 'Timestamp'; + /** + * @type {number} + * @ignore + */ + this.low_ = low | 0; // force into 32 signed bits. + + /** + * @type {number} + * @ignore + */ + this.high_ = high | 0; // force into 32 signed bits. + } + + /** + * Return the int value. + * + * @return {number} the value, assuming it is a 32-bit integer. + */ + Timestamp.prototype.toInt = function() { + return this.low_; + }; + + /** + * Return the Number value. + * + * @method + * @return {number} the closest floating-point representation to this value. + */ + Timestamp.prototype.toNumber = function() { + return this.high_ * Timestamp.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned(); + }; + + /** + * Return the JSON value. + * + * @method + * @return {string} the JSON representation. + */ + Timestamp.prototype.toJSON = function() { + return this.toString(); + }; + + /** + * Return the String value. + * + * @method + * @param {number} [opt_radix] the radix in which the text should be written. + * @return {string} the textual representation of this value. + */ + Timestamp.prototype.toString = function(opt_radix) { + var radix = opt_radix || 10; + if (radix < 2 || 36 < radix) { + throw Error('radix out of range: ' + radix); + } + + if (this.isZero()) { + return '0'; + } + + if (this.isNegative()) { + if (this.equals(Timestamp.MIN_VALUE)) { + // We need to change the Timestamp value before it can be negated, so we remove + // the bottom-most digit in this base and then recurse to do the rest. + var radixTimestamp = Timestamp.fromNumber(radix); + var div = this.div(radixTimestamp); + var rem = div.multiply(radixTimestamp).subtract(this); + return div.toString(radix) + rem.toInt().toString(radix); + } else { + return '-' + this.negate().toString(radix); + } + } + + // Do several (6) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6)); + + var rem = this; + var result = ''; + while (true) { + var remDiv = rem.div(radixToPower); + var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); + var digits = intval.toString(radix); + + rem = remDiv; + if (rem.isZero()) { + return digits + result; + } else { + while (digits.length < 6) { + digits = '0' + digits; + } + result = '' + digits + result; + } + } + }; + + /** + * Return the high 32-bits value. + * + * @method + * @return {number} the high 32-bits as a signed value. + */ + Timestamp.prototype.getHighBits = function() { + return this.high_; + }; + + /** + * Return the low 32-bits value. + * + * @method + * @return {number} the low 32-bits as a signed value. + */ + Timestamp.prototype.getLowBits = function() { + return this.low_; + }; + + /** + * Return the low unsigned 32-bits value. + * + * @method + * @return {number} the low 32-bits as an unsigned value. + */ + Timestamp.prototype.getLowBitsUnsigned = function() { + return this.low_ >= 0 ? this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_; + }; + + /** + * Returns the number of bits needed to represent the absolute value of this Timestamp. + * + * @method + * @return {number} Returns the number of bits needed to represent the absolute value of this Timestamp. + */ + Timestamp.prototype.getNumBitsAbs = function() { + if (this.isNegative()) { + if (this.equals(Timestamp.MIN_VALUE)) { + return 64; + } else { + return this.negate().getNumBitsAbs(); + } + } else { + var val = this.high_ != 0 ? this.high_ : this.low_; + for (var bit = 31; bit > 0; bit--) { + if ((val & (1 << bit)) != 0) { + break; + } + } + return this.high_ != 0 ? bit + 33 : bit + 1; + } + }; + + /** + * Return whether this value is zero. + * + * @method + * @return {boolean} whether this value is zero. + */ + Timestamp.prototype.isZero = function() { + return this.high_ == 0 && this.low_ == 0; + }; + + /** + * Return whether this value is negative. + * + * @method + * @return {boolean} whether this value is negative. + */ + Timestamp.prototype.isNegative = function() { + return this.high_ < 0; + }; + + /** + * Return whether this value is odd. + * + * @method + * @return {boolean} whether this value is odd. + */ + Timestamp.prototype.isOdd = function() { + return (this.low_ & 1) == 1; + }; + + /** + * Return whether this Timestamp equals the other + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp equals the other + */ + Timestamp.prototype.equals = function(other) { + return this.high_ == other.high_ && this.low_ == other.low_; + }; + + /** + * Return whether this Timestamp does not equal the other. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp does not equal the other. + */ + Timestamp.prototype.notEquals = function(other) { + return this.high_ != other.high_ || this.low_ != other.low_; + }; + + /** + * Return whether this Timestamp is less than the other. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp is less than the other. + */ + Timestamp.prototype.lessThan = function(other) { + return this.compare(other) < 0; + }; + + /** + * Return whether this Timestamp is less than or equal to the other. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp is less than or equal to the other. + */ + Timestamp.prototype.lessThanOrEqual = function(other) { + return this.compare(other) <= 0; + }; + + /** + * Return whether this Timestamp is greater than the other. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp is greater than the other. + */ + Timestamp.prototype.greaterThan = function(other) { + return this.compare(other) > 0; + }; + + /** + * Return whether this Timestamp is greater than or equal to the other. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp is greater than or equal to the other. + */ + Timestamp.prototype.greaterThanOrEqual = function(other) { + return this.compare(other) >= 0; + }; + + /** + * Compares this Timestamp with the given one. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. + */ + Timestamp.prototype.compare = function(other) { + if (this.equals(other)) { + return 0; + } + + var thisNeg = this.isNegative(); + var otherNeg = other.isNegative(); + if (thisNeg && !otherNeg) { + return -1; + } + if (!thisNeg && otherNeg) { + return 1; + } + + // at this point, the signs are the same, so subtraction will not overflow + if (this.subtract(other).isNegative()) { + return -1; + } else { + return 1; + } + }; + + /** + * The negation of this value. + * + * @method + * @return {Timestamp} the negation of this value. + */ + Timestamp.prototype.negate = function() { + if (this.equals(Timestamp.MIN_VALUE)) { + return Timestamp.MIN_VALUE; + } else { + return this.not().add(Timestamp.ONE); + } + }; + + /** + * Returns the sum of this and the given Timestamp. + * + * @method + * @param {Timestamp} other Timestamp to add to this one. + * @return {Timestamp} the sum of this and the given Timestamp. + */ + Timestamp.prototype.add = function(other) { + // Divide each number into 4 chunks of 16 bits, and then sum the chunks. + + var a48 = this.high_ >>> 16; + var a32 = this.high_ & 0xffff; + var a16 = this.low_ >>> 16; + var a00 = this.low_ & 0xffff; + + var b48 = other.high_ >>> 16; + var b32 = other.high_ & 0xffff; + var b16 = other.low_ >>> 16; + var b00 = other.low_ & 0xffff; + + var c48 = 0, + c32 = 0, + c16 = 0, + c00 = 0; + c00 += a00 + b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 + b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 + b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 + b48; + c48 &= 0xffff; + return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); + }; + + /** + * Returns the difference of this and the given Timestamp. + * + * @method + * @param {Timestamp} other Timestamp to subtract from this. + * @return {Timestamp} the difference of this and the given Timestamp. + */ + Timestamp.prototype.subtract = function(other) { + return this.add(other.negate()); + }; + + /** + * Returns the product of this and the given Timestamp. + * + * @method + * @param {Timestamp} other Timestamp to multiply with this. + * @return {Timestamp} the product of this and the other. + */ + Timestamp.prototype.multiply = function(other) { + if (this.isZero()) { + return Timestamp.ZERO; + } else if (other.isZero()) { + return Timestamp.ZERO; + } + + if (this.equals(Timestamp.MIN_VALUE)) { + return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; + } else if (other.equals(Timestamp.MIN_VALUE)) { + return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; + } + + if (this.isNegative()) { + if (other.isNegative()) { + return this.negate().multiply(other.negate()); + } else { + return this.negate() + .multiply(other) + .negate(); + } + } else if (other.isNegative()) { + return this.multiply(other.negate()).negate(); + } + + // If both Timestamps are small, use float multiplication + if ( + this.lessThan(Timestamp.TWO_PWR_24_) && + other.lessThan(Timestamp.TWO_PWR_24_) + ) { + return Timestamp.fromNumber(this.toNumber() * other.toNumber()); + } + + // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products. + // We can skip products that would overflow. + + var a48 = this.high_ >>> 16; + var a32 = this.high_ & 0xffff; + var a16 = this.low_ >>> 16; + var a00 = this.low_ & 0xffff; + + var b48 = other.high_ >>> 16; + var b32 = other.high_ & 0xffff; + var b16 = other.low_ >>> 16; + var b00 = other.low_ & 0xffff; + + var c48 = 0, + c32 = 0, + c16 = 0, + c00 = 0; + c00 += a00 * b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 * b00; + c32 += c16 >>> 16; + c16 &= 0xffff; + c16 += a00 * b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 * b00; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a16 * b16; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a00 * b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; + c48 &= 0xffff; + return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); + }; + + /** + * Returns this Timestamp divided by the given one. + * + * @method + * @param {Timestamp} other Timestamp by which to divide. + * @return {Timestamp} this Timestamp divided by the given one. + */ + Timestamp.prototype.div = function(other) { + if (other.isZero()) { + throw Error('division by zero'); + } else if (this.isZero()) { + return Timestamp.ZERO; + } + + if (this.equals(Timestamp.MIN_VALUE)) { + if (other.equals(Timestamp.ONE) || other.equals(Timestamp.NEG_ONE)) { + return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE + } else if (other.equals(Timestamp.MIN_VALUE)) { + return Timestamp.ONE; + } else { + // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. + var halfThis = this.shiftRight(1); + var approx = halfThis.div(other).shiftLeft(1); + if (approx.equals(Timestamp.ZERO)) { + return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE; + } else { + var rem = this.subtract(other.multiply(approx)); + var result = approx.add(rem.div(other)); + return result; + } + } + } else if (other.equals(Timestamp.MIN_VALUE)) { + return Timestamp.ZERO; + } + + if (this.isNegative()) { + if (other.isNegative()) { + return this.negate().div(other.negate()); + } else { + return this.negate() + .div(other) + .negate(); + } + } else if (other.isNegative()) { + return this.div(other.negate()).negate(); + } + + // Repeat the following until the remainder is less than other: find a + // floating-point that approximates remainder / other *from below*, add this + // into the result, and subtract it from the remainder. It is critical that + // the approximate value is less than or equal to the real value so that the + // remainder never becomes negative. + var res = Timestamp.ZERO; + var rem = this; + while (rem.greaterThanOrEqual(other)) { + // Approximate the result of division. This may be a little greater or + // smaller than the actual value. + var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); + + // We will tweak the approximate result by changing it in the 48-th digit or + // the smallest non-fractional digit, whichever is larger. + var log2 = Math.ceil(Math.log(approx) / Math.LN2); + var delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48); + + // Decrease the approximation until it is smaller than the remainder. Note + // that if it is too large, the product overflows and is negative. + var approxRes = Timestamp.fromNumber(approx); + var approxRem = approxRes.multiply(other); + while (approxRem.isNegative() || approxRem.greaterThan(rem)) { + approx -= delta; + approxRes = Timestamp.fromNumber(approx); + approxRem = approxRes.multiply(other); + } + + // We know the answer can't be zero... and actually, zero would cause + // infinite recursion since we would make no progress. + if (approxRes.isZero()) { + approxRes = Timestamp.ONE; + } + + res = res.add(approxRes); + rem = rem.subtract(approxRem); + } + return res; + }; + + /** + * Returns this Timestamp modulo the given one. + * + * @method + * @param {Timestamp} other Timestamp by which to mod. + * @return {Timestamp} this Timestamp modulo the given one. + */ + Timestamp.prototype.modulo = function(other) { + return this.subtract(this.div(other).multiply(other)); + }; + + /** + * The bitwise-NOT of this value. + * + * @method + * @return {Timestamp} the bitwise-NOT of this value. + */ + Timestamp.prototype.not = function() { + return Timestamp.fromBits(~this.low_, ~this.high_); + }; + + /** + * Returns the bitwise-AND of this Timestamp and the given one. + * + * @method + * @param {Timestamp} other the Timestamp with which to AND. + * @return {Timestamp} the bitwise-AND of this and the other. + */ + Timestamp.prototype.and = function(other) { + return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_); + }; + + /** + * Returns the bitwise-OR of this Timestamp and the given one. + * + * @method + * @param {Timestamp} other the Timestamp with which to OR. + * @return {Timestamp} the bitwise-OR of this and the other. + */ + Timestamp.prototype.or = function(other) { + return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_); + }; + + /** + * Returns the bitwise-XOR of this Timestamp and the given one. + * + * @method + * @param {Timestamp} other the Timestamp with which to XOR. + * @return {Timestamp} the bitwise-XOR of this and the other. + */ + Timestamp.prototype.xor = function(other) { + return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); + }; + + /** + * Returns this Timestamp with bits shifted to the left by the given amount. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Timestamp} this shifted to the left by the given amount. + */ + Timestamp.prototype.shiftLeft = function(numBits) { + numBits &= 63; + if (numBits == 0) { + return this; + } else { + var low = this.low_; + if (numBits < 32) { + var high = this.high_; + return Timestamp.fromBits( + low << numBits, + (high << numBits) | (low >>> (32 - numBits)) + ); + } else { + return Timestamp.fromBits(0, low << (numBits - 32)); + } + } + }; + + /** + * Returns this Timestamp with bits shifted to the right by the given amount. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Timestamp} this shifted to the right by the given amount. + */ + Timestamp.prototype.shiftRight = function(numBits) { + numBits &= 63; + if (numBits == 0) { + return this; + } else { + var high = this.high_; + if (numBits < 32) { + var low = this.low_; + return Timestamp.fromBits( + (low >>> numBits) | (high << (32 - numBits)), + high >> numBits + ); + } else { + return Timestamp.fromBits(high >> (numBits - 32), high >= 0 ? 0 : -1); + } + } + }; + + /** + * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits. + */ + Timestamp.prototype.shiftRightUnsigned = function(numBits) { + numBits &= 63; + if (numBits == 0) { + return this; + } else { + var high = this.high_; + if (numBits < 32) { + var low = this.low_; + return Timestamp.fromBits( + (low >>> numBits) | (high << (32 - numBits)), + high >>> numBits + ); + } else if (numBits == 32) { + return Timestamp.fromBits(high, 0); + } else { + return Timestamp.fromBits(high >>> (numBits - 32), 0); + } + } + }; + + /** + * Returns a Timestamp representing the given (32-bit) integer value. + * + * @method + * @param {number} value the 32-bit integer in question. + * @return {Timestamp} the corresponding Timestamp value. + */ + Timestamp.fromInt = function(value) { + if (-128 <= value && value < 128) { + var cachedObj = Timestamp.INT_CACHE_[value]; + if (cachedObj) { + return cachedObj; + } + } + + var obj = new Timestamp(value | 0, value < 0 ? -1 : 0); + if (-128 <= value && value < 128) { + Timestamp.INT_CACHE_[value] = obj; + } + return obj; + }; + + /** + * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned. + * + * @method + * @param {number} value the number in question. + * @return {Timestamp} the corresponding Timestamp value. + */ + Timestamp.fromNumber = function(value) { + if (isNaN(value) || !isFinite(value)) { + return Timestamp.ZERO; + } else if (value <= -Timestamp.TWO_PWR_63_DBL_) { + return Timestamp.MIN_VALUE; + } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) { + return Timestamp.MAX_VALUE; + } else if (value < 0) { + return Timestamp.fromNumber(-value).negate(); + } else { + return new Timestamp( + (value % Timestamp.TWO_PWR_32_DBL_) | 0, + (value / Timestamp.TWO_PWR_32_DBL_) | 0 + ); + } + }; + + /** + * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. + * + * @method + * @param {number} lowBits the low 32-bits. + * @param {number} highBits the high 32-bits. + * @return {Timestamp} the corresponding Timestamp value. + */ + Timestamp.fromBits = function(lowBits, highBits) { + return new Timestamp(lowBits, highBits); + }; + + /** + * Returns a Timestamp representation of the given string, written using the given radix. + * + * @method + * @param {string} str the textual representation of the Timestamp. + * @param {number} opt_radix the radix in which the text is written. + * @return {Timestamp} the corresponding Timestamp value. + */ + Timestamp.fromString = function(str, opt_radix) { + if (str.length == 0) { + throw Error('number format error: empty string'); + } + + var radix = opt_radix || 10; + if (radix < 2 || 36 < radix) { + throw Error('radix out of range: ' + radix); + } + + if (str.charAt(0) == '-') { + return Timestamp.fromString(str.substring(1), radix).negate(); + } else if (str.indexOf('-') >= 0) { + throw Error('number format error: interior "-" character: ' + str); + } + + // Do several (8) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8)); + + var result = Timestamp.ZERO; + for (var i = 0; i < str.length; i += 8) { + var size = Math.min(8, str.length - i); + var value = parseInt(str.substring(i, i + size), radix); + if (size < 8) { + var power = Timestamp.fromNumber(Math.pow(radix, size)); + result = result.multiply(power).add(Timestamp.fromNumber(value)); + } else { + result = result.multiply(radixToPower); + result = result.add(Timestamp.fromNumber(value)); + } + } + return result; + }; + + // NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the + // from* methods on which they depend. + + /** + * A cache of the Timestamp representations of small integer values. + * @type {Object} + * @ignore + */ + Timestamp.INT_CACHE_ = {}; + + // NOTE: the compiler should inline these constant values below and then remove + // these variables, so there should be no runtime penalty for these. + + /** + * Number used repeated below in calculations. This must appear before the + * first call to any from* function below. + * @type {number} + * @ignore + */ + Timestamp.TWO_PWR_16_DBL_ = 1 << 16; + + /** + * @type {number} + * @ignore + */ + Timestamp.TWO_PWR_24_DBL_ = 1 << 24; + + /** + * @type {number} + * @ignore + */ + Timestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_; + + /** + * @type {number} + * @ignore + */ + Timestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2; + + /** + * @type {number} + * @ignore + */ + Timestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_; + + /** + * @type {number} + * @ignore + */ + Timestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_; + + /** + * @type {number} + * @ignore + */ + Timestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2; + + /** @type {Timestamp} */ + Timestamp.ZERO = Timestamp.fromInt(0); + + /** @type {Timestamp} */ + Timestamp.ONE = Timestamp.fromInt(1); + + /** @type {Timestamp} */ + Timestamp.NEG_ONE = Timestamp.fromInt(-1); + + /** @type {Timestamp} */ + Timestamp.MAX_VALUE = Timestamp.fromBits(0xffffffff | 0, 0x7fffffff | 0); + + /** @type {Timestamp} */ + Timestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0); + + /** + * @type {Timestamp} + * @ignore + */ + Timestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24); + + /** + * Expose. + */ + module.exports = Timestamp; + module.exports.Timestamp = Timestamp; + + /***/ + }, + /* 309 */ + /***/ function(module, exports, __webpack_require__) { + /* WEBPACK VAR INJECTION */ (function(Buffer, process) { + /** + * Machine id. + * + * Create a random 3-byte value (i.e. unique for this + * process). Other drivers use a md5 of the machine id here, but + * that would mean an asyc call to gethostname, so we don't bother. + * @ignore + */ + var MACHINE_ID = parseInt(Math.random() * 0xffffff, 10); + + // Regular expression that checks for hex value + var checkForHexRegExp = new RegExp('^[0-9a-fA-F]{24}$'); + var hasBufferType = false; + + // Check if buffer exists + try { + if (Buffer && Buffer.from) hasBufferType = true; + } catch (err) {} + + /** + * Create a new ObjectID instance + * + * @class + * @param {(string|number)} id Can be a 24 byte hex string, 12 byte binary string or a Number. + * @property {number} generationTime The generation time of this ObjectId instance + * @return {ObjectID} instance of ObjectID. + */ + var ObjectID = function ObjectID(id) { + // Duck-typing to support ObjectId from different npm packages + if (id instanceof ObjectID) return id; + if (!(this instanceof ObjectID)) return new ObjectID(id); + + this._bsontype = 'ObjectID'; + + // The most common usecase (blank id, new objectId instance) + if (id == null || typeof id == 'number') { + // Generate a new id + this.id = this.generate(id); + // If we are caching the hex string + if (ObjectID.cacheHexString) this.__id = this.toString('hex'); + // Return the object + return; + } + + // Check if the passed in id is valid + var valid = ObjectID.isValid(id); + + // Throw an error if it's not a valid setup + if (!valid && id != null) { + throw new Error( + 'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters' + ); + } else if ( + valid && + typeof id == 'string' && + id.length == 24 && + hasBufferType + ) { + return new ObjectID(new Buffer(id, 'hex')); + } else if (valid && typeof id == 'string' && id.length == 24) { + return ObjectID.createFromHexString(id); + } else if (id != null && id.length === 12) { + // assume 12 byte string + this.id = id; + } else if (id != null && id.toHexString) { + // Duck-typing to support ObjectId from different npm packages + return id; + } else { + throw new Error( + 'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters' + ); + } + + if (ObjectID.cacheHexString) this.__id = this.toString('hex'); + }; + + // Allow usage of ObjectId as well as ObjectID + var ObjectId = ObjectID; + + // Precomputed hex table enables speedy hex string conversion + var hexTable = []; + for (var i = 0; i < 256; i++) { + hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16); + } + + /** + * Return the ObjectID id as a 24 byte hex string representation + * + * @method + * @return {string} return the 24 byte hex string representation. + */ + ObjectID.prototype.toHexString = function() { + if (ObjectID.cacheHexString && this.__id) return this.__id; + + var hexString = ''; + if (!this.id || !this.id.length) { + throw new Error( + 'invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is [' + + JSON.stringify(this.id) + + ']' + ); + } + + if (this.id instanceof _Buffer) { + hexString = convertToHex(this.id); + if (ObjectID.cacheHexString) this.__id = hexString; + return hexString; + } + + for (var i = 0; i < this.id.length; i++) { + hexString += hexTable[this.id.charCodeAt(i)]; + } + + if (ObjectID.cacheHexString) this.__id = hexString; + return hexString; + }; + + /** + * Update the ObjectID index used in generating new ObjectID's on the driver + * + * @method + * @return {number} returns next index value. + * @ignore + */ + ObjectID.prototype.get_inc = function() { + return (ObjectID.index = (ObjectID.index + 1) % 0xffffff); + }; + + /** + * Update the ObjectID index used in generating new ObjectID's on the driver + * + * @method + * @return {number} returns next index value. + * @ignore + */ + ObjectID.prototype.getInc = function() { + return this.get_inc(); + }; + + /** + * Generate a 12 byte id buffer used in ObjectID's + * + * @method + * @param {number} [time] optional parameter allowing to pass in a second based timestamp. + * @return {Buffer} return the 12 byte id buffer string. + */ + ObjectID.prototype.generate = function(time) { + if ('number' != typeof time) { + time = ~~(Date.now() / 1000); + } + + // Use pid + var pid = + (typeof process === 'undefined' + ? Math.floor(Math.random() * 100000) + : process.pid) % 0xffff; + var inc = this.get_inc(); + // Buffer used + var buffer = new Buffer(12); + // Encode time + buffer[3] = time & 0xff; + buffer[2] = (time >> 8) & 0xff; + buffer[1] = (time >> 16) & 0xff; + buffer[0] = (time >> 24) & 0xff; + // Encode machine + buffer[6] = MACHINE_ID & 0xff; + buffer[5] = (MACHINE_ID >> 8) & 0xff; + buffer[4] = (MACHINE_ID >> 16) & 0xff; + // Encode pid + buffer[8] = pid & 0xff; + buffer[7] = (pid >> 8) & 0xff; + // Encode index + buffer[11] = inc & 0xff; + buffer[10] = (inc >> 8) & 0xff; + buffer[9] = (inc >> 16) & 0xff; + // Return the buffer + return buffer; + }; + + /** + * Converts the id into a 24 byte hex string for printing + * + * @param {String} format The Buffer toString format parameter. + * @return {String} return the 24 byte hex string representation. + * @ignore + */ + ObjectID.prototype.toString = function(format) { + // Is the id a buffer then use the buffer toString method to return the format + if (this.id && this.id.copy) { + return this.id.toString(typeof format === 'string' ? format : 'hex'); + } + + // if(this.buffer ) + return this.toHexString(); + }; + + /** + * Converts to a string representation of this Id. + * + * @return {String} return the 24 byte hex string representation. + * @ignore + */ + ObjectID.prototype.inspect = ObjectID.prototype.toString; + + /** + * Converts to its JSON representation. + * + * @return {String} return the 24 byte hex string representation. + * @ignore + */ + ObjectID.prototype.toJSON = function() { + return this.toHexString(); + }; + + /** + * Compares the equality of this ObjectID with `otherID`. + * + * @method + * @param {object} otherID ObjectID instance to compare against. + * @return {boolean} the result of comparing two ObjectID's + */ + ObjectID.prototype.equals = function equals(otherId) { + var id; + + if (otherId instanceof ObjectID) { + return this.toString() == otherId.toString(); + } else if ( + typeof otherId == 'string' && + ObjectID.isValid(otherId) && + otherId.length == 12 && + this.id instanceof _Buffer + ) { + return otherId === this.id.toString('binary'); + } else if ( + typeof otherId == 'string' && + ObjectID.isValid(otherId) && + otherId.length == 24 + ) { + return otherId.toLowerCase() === this.toHexString(); + } else if ( + typeof otherId == 'string' && + ObjectID.isValid(otherId) && + otherId.length == 12 + ) { + return otherId === this.id; + } else if ( + otherId != null && + (otherId instanceof ObjectID || otherId.toHexString) + ) { + return otherId.toHexString() === this.toHexString(); + } else { + return false; + } + }; + + /** + * Returns the generation date (accurate up to the second) that this ID was generated. + * + * @method + * @return {date} the generation date + */ + ObjectID.prototype.getTimestamp = function() { + var timestamp = new Date(); + var time = + this.id[3] | + (this.id[2] << 8) | + (this.id[1] << 16) | + (this.id[0] << 24); + timestamp.setTime(Math.floor(time) * 1000); + return timestamp; + }; + + /** + * @ignore + */ + ObjectID.index = ~~(Math.random() * 0xffffff); + + /** + * @ignore + */ + ObjectID.createPk = function createPk() { + return new ObjectID(); + }; + + /** + * Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID. + * + * @method + * @param {number} time an integer number representing a number of seconds. + * @return {ObjectID} return the created ObjectID + */ + ObjectID.createFromTime = function createFromTime(time) { + var buffer = new Buffer([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); + // Encode time into first 4 bytes + buffer[3] = time & 0xff; + buffer[2] = (time >> 8) & 0xff; + buffer[1] = (time >> 16) & 0xff; + buffer[0] = (time >> 24) & 0xff; + // Return the new objectId + return new ObjectID(buffer); + }; + + // Lookup tables + var encodeLookup = '0123456789abcdef'.split(''); + var decodeLookup = []; + var i = 0; + while (i < 10) decodeLookup[0x30 + i] = i++; + while (i < 16) decodeLookup[0x41 - 10 + i] = decodeLookup[0x61 - 10 + i] = i++; + + var _Buffer = Buffer; + var convertToHex = function(bytes) { + return bytes.toString('hex'); + }; + + /** + * Creates an ObjectID from a hex string representation of an ObjectID. + * + * @method + * @param {string} hexString create a ObjectID from a passed in 24 byte hexstring. + * @return {ObjectID} return the created ObjectID + */ + ObjectID.createFromHexString = function createFromHexString(string) { + // Throw an error if it's not a valid setup + if ( + typeof string === 'undefined' || + (string != null && string.length != 24) + ) { + throw new Error( + 'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters' + ); + } + + // Use Buffer.from method if available + if (hasBufferType) return new ObjectID(new Buffer(string, 'hex')); + + // Calculate lengths + var array = new _Buffer(12); + var n = 0; + var i = 0; + + while (i < 24) { + array[n++] = + (decodeLookup[string.charCodeAt(i++)] << 4) | + decodeLookup[string.charCodeAt(i++)]; + } + + return new ObjectID(array); + }; + + /** + * Checks if a value is a valid bson ObjectId + * + * @method + * @return {boolean} return true if the value is a valid bson ObjectId, return false otherwise. + */ + ObjectID.isValid = function isValid(id) { + if (id == null) return false; + + if (typeof id == 'number') { + return true; + } + + if (typeof id == 'string') { + return ( + id.length == 12 || (id.length == 24 && checkForHexRegExp.test(id)) + ); + } + + if (id instanceof ObjectID) { + return true; + } + + if (id instanceof _Buffer) { + return true; + } + + // Duck-Typing detection of ObjectId like objects + if (id.toHexString) { + return ( + id.id.length == 12 || + (id.id.length == 24 && checkForHexRegExp.test(id.id)) + ); + } + + return false; + }; + + /** + * @ignore + */ + Object.defineProperty(ObjectID.prototype, 'generationTime', { + enumerable: true, + get: function() { + return ( + this.id[3] | + (this.id[2] << 8) | + (this.id[1] << 16) | + (this.id[0] << 24) + ); + }, + set: function(value) { + // Encode time into first 4 bytes + this.id[3] = value & 0xff; + this.id[2] = (value >> 8) & 0xff; + this.id[1] = (value >> 16) & 0xff; + this.id[0] = (value >> 24) & 0xff; + } + }); + + /** + * Expose. + */ + module.exports = ObjectID; + module.exports.ObjectID = ObjectID; + module.exports.ObjectId = ObjectID; + /* WEBPACK VAR INJECTION */ + }.call(exports, __webpack_require__(300).Buffer, __webpack_require__(294))); + + /***/ + }, + /* 310 */ + /***/ function(module, exports) { + /** + * A class representation of the BSON RegExp type. + * + * @class + * @return {BSONRegExp} A MinKey instance + */ + function BSONRegExp(pattern, options) { + if (!(this instanceof BSONRegExp)) return new BSONRegExp(); + + // Execute + this._bsontype = 'BSONRegExp'; + this.pattern = pattern || ''; + this.options = options || ''; + + // Validate options + for (var i = 0; i < this.options.length; i++) { + if ( + !( + this.options[i] == 'i' || + this.options[i] == 'm' || + this.options[i] == 'x' || + this.options[i] == 'l' || + this.options[i] == 's' || + this.options[i] == 'u' + ) + ) { + throw new Error( + 'the regular expression options [' + + this.options[i] + + '] is not supported' + ); + } + } + } + + module.exports = BSONRegExp; + module.exports.BSONRegExp = BSONRegExp; + + /***/ + }, + /* 311 */ + /***/ function(module, exports) { + /** + * A class representation of the BSON Symbol type. + * + * @class + * @deprecated + * @param {string} value the string representing the symbol. + * @return {Symbol} + */ + function Symbol(value) { + if (!(this instanceof Symbol)) return new Symbol(value); + this._bsontype = 'Symbol'; + this.value = value; + } + + /** + * Access the wrapped string value. + * + * @method + * @return {String} returns the wrapped string. + */ + Symbol.prototype.valueOf = function() { + return this.value; + }; + + /** + * @ignore + */ + Symbol.prototype.toString = function() { + return this.value; + }; + + /** + * @ignore + */ + Symbol.prototype.inspect = function() { + return this.value; + }; + + /** + * @ignore + */ + Symbol.prototype.toJSON = function() { + return this.value; + }; + + module.exports = Symbol; + module.exports.Symbol = Symbol; + + /***/ + }, + /* 312 */ + /***/ function(module, exports) { + var Int32 = function(value) { + if (!(this instanceof Int32)) return new Int32(value); + + this._bsontype = 'Int32'; + this.value = value; + }; + + /** + * Access the number value. + * + * @method + * @return {number} returns the wrapped int32 number. + */ + Int32.prototype.valueOf = function() { + return this.value; + }; + + /** + * @ignore + */ + Int32.prototype.toJSON = function() { + return this.value; + }; + + module.exports = Int32; + module.exports.Int32 = Int32; + + /***/ + }, + /* 313 */ + /***/ function(module, exports) { + /** + * A class representation of the BSON Code type. + * + * @class + * @param {(string|function)} code a string or function. + * @param {Object} [scope] an optional scope for the function. + * @return {Code} + */ + var Code = function Code(code, scope) { + if (!(this instanceof Code)) return new Code(code, scope); + this._bsontype = 'Code'; + this.code = code; + this.scope = scope; + }; + + /** + * @ignore + */ + Code.prototype.toJSON = function() { + return { scope: this.scope, code: this.code }; + }; + + module.exports = Code; + module.exports.Code = Code; + + /***/ + }, + /* 314 */ + /***/ function(module, exports, __webpack_require__) { + /* WEBPACK VAR INJECTION */ (function(Buffer) { + 'use strict'; + + var Long = __webpack_require__(306); + + var PARSE_STRING_REGEXP = /^(\+|\-)?(\d+|(\d*\.\d*))?(E|e)?([\-\+])?(\d+)?$/; + var PARSE_INF_REGEXP = /^(\+|\-)?(Infinity|inf)$/i; + var PARSE_NAN_REGEXP = /^(\+|\-)?NaN$/i; + + var EXPONENT_MAX = 6111; + var EXPONENT_MIN = -6176; + var EXPONENT_BIAS = 6176; + var MAX_DIGITS = 34; + + // Nan value bits as 32 bit values (due to lack of longs) + var NAN_BUFFER = [ + 0x7c, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + ].reverse(); + // Infinity value bits 32 bit values (due to lack of longs) + var INF_NEGATIVE_BUFFER = [ + 0xf8, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + ].reverse(); + var INF_POSITIVE_BUFFER = [ + 0x78, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 + ].reverse(); + + var EXPONENT_REGEX = /^([\-\+])?(\d+)?$/; + + // Detect if the value is a digit + var isDigit = function(value) { + return !isNaN(parseInt(value, 10)); + }; + + // Divide two uint128 values + var divideu128 = function(value) { + var DIVISOR = Long.fromNumber(1000 * 1000 * 1000); + var _rem = Long.fromNumber(0); + var i = 0; + + if ( + !value.parts[0] && + !value.parts[1] && + !value.parts[2] && + !value.parts[3] + ) { + return { quotient: value, rem: _rem }; + } + + for (var i = 0; i <= 3; i++) { + // Adjust remainder to match value of next dividend + _rem = _rem.shiftLeft(32); + // Add the divided to _rem + _rem = _rem.add(new Long(value.parts[i], 0)); + value.parts[i] = _rem.div(DIVISOR).low_; + _rem = _rem.modulo(DIVISOR); + } + + return { quotient: value, rem: _rem }; + }; + + // Multiply two Long values and return the 128 bit value + var multiply64x2 = function(left, right) { + if (!left && !right) { + return { high: Long.fromNumber(0), low: Long.fromNumber(0) }; + } + + var leftHigh = left.shiftRightUnsigned(32); + var leftLow = new Long(left.getLowBits(), 0); + var rightHigh = right.shiftRightUnsigned(32); + var rightLow = new Long(right.getLowBits(), 0); + + var productHigh = leftHigh.multiply(rightHigh); + var productMid = leftHigh.multiply(rightLow); + var productMid2 = leftLow.multiply(rightHigh); + var productLow = leftLow.multiply(rightLow); + + productHigh = productHigh.add(productMid.shiftRightUnsigned(32)); + productMid = new Long(productMid.getLowBits(), 0) + .add(productMid2) + .add(productLow.shiftRightUnsigned(32)); + + productHigh = productHigh.add(productMid.shiftRightUnsigned(32)); + productLow = productMid + .shiftLeft(32) + .add(new Long(productLow.getLowBits(), 0)); + + // Return the 128 bit result + return { high: productHigh, low: productLow }; + }; + + var lessThan = function(left, right) { + // Make values unsigned + var uhleft = left.high_ >>> 0; + var uhright = right.high_ >>> 0; + + // Compare high bits first + if (uhleft < uhright) { + return true; + } else if (uhleft == uhright) { + var ulleft = left.low_ >>> 0; + var ulright = right.low_ >>> 0; + if (ulleft < ulright) return true; + } + + return false; + }; + + var longtoHex = function(value) { + var buffer = new Buffer(8); + var index = 0; + // Encode the low 64 bits of the decimal + // Encode low bits + buffer[index++] = value.low_ & 0xff; + buffer[index++] = (value.low_ >> 8) & 0xff; + buffer[index++] = (value.low_ >> 16) & 0xff; + buffer[index++] = (value.low_ >> 24) & 0xff; + // Encode high bits + buffer[index++] = value.high_ & 0xff; + buffer[index++] = (value.high_ >> 8) & 0xff; + buffer[index++] = (value.high_ >> 16) & 0xff; + buffer[index++] = (value.high_ >> 24) & 0xff; + return buffer.reverse().toString('hex'); + }; + + var int32toHex = function(value) { + var buffer = new Buffer(4); + var index = 0; + // Encode the low 64 bits of the decimal + // Encode low bits + buffer[index++] = value & 0xff; + buffer[index++] = (value >> 8) & 0xff; + buffer[index++] = (value >> 16) & 0xff; + buffer[index++] = (value >> 24) & 0xff; + return buffer.reverse().toString('hex'); + }; + + var Decimal128 = function(bytes) { + this._bsontype = 'Decimal128'; + this.bytes = bytes; + }; + + Decimal128.fromString = function(string) { + // Parse state tracking + var isNegative = false; + var sawRadix = false; + var foundNonZero = false; + + // Total number of significant digits (no leading or trailing zero) + var significantDigits = 0; + // Total number of significand digits read + var nDigitsRead = 0; + // Total number of digits (no leading zeros) + var nDigits = 0; + // The number of the digits after radix + var radixPosition = 0; + // The index of the first non-zero in *str* + var firstNonZero = 0; + + // Digits Array + var digits = [0]; + // The number of digits in digits + var nDigitsStored = 0; + // Insertion pointer for digits + var digitsInsert = 0; + // The index of the first non-zero digit + var firstDigit = 0; + // The index of the last digit + var lastDigit = 0; + + // Exponent + var exponent = 0; + // loop index over array + var i = 0; + // The high 17 digits of the significand + var significandHigh = [0, 0]; + // The low 17 digits of the significand + var significandLow = [0, 0]; + // The biased exponent + var biasedExponent = 0; + + // Read index + var index = 0; + + // Trim the string + string = string.trim(); + + // Results + var stringMatch = string.match(PARSE_STRING_REGEXP); + var infMatch = string.match(PARSE_INF_REGEXP); + var nanMatch = string.match(PARSE_NAN_REGEXP); + + // Validate the string + if ((!stringMatch && !infMatch && !nanMatch) || string.length == 0) { + throw new Error('' + string + ' not a valid Decimal128 string'); + } + + // Check if we have an illegal exponent format + if (stringMatch && stringMatch[4] && stringMatch[2] === undefined) { + throw new Error('' + string + ' not a valid Decimal128 string'); + } + + // Get the negative or positive sign + if (string[index] == '+' || string[index] == '-') { + isNegative = string[index++] == '-'; + } + + // Check if user passed Infinity or NaN + if (!isDigit(string[index]) && string[index] != '.') { + if (string[index] == 'i' || string[index] == 'I') { + return new Decimal128( + new Buffer( + isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER + ) + ); + } else if (string[index] == 'N') { + return new Decimal128(new Buffer(NAN_BUFFER)); + } + } + + // Read all the digits + while (isDigit(string[index]) || string[index] == '.') { + if (string[index] == '.') { + if (sawRadix) { + return new Decimal128(new Buffer(NAN_BUFFER)); + } + + sawRadix = true; + index = index + 1; + continue; + } + + if (nDigitsStored < 34) { + if (string[index] != '0' || foundNonZero) { + if (!foundNonZero) { + firstNonZero = nDigitsRead; + } + + foundNonZero = true; + + // Only store 34 digits + digits[digitsInsert++] = parseInt(string[index], 10); + nDigitsStored = nDigitsStored + 1; + } + } + + if (foundNonZero) { + nDigits = nDigits + 1; + } + + if (sawRadix) { + radixPosition = radixPosition + 1; + } + + nDigitsRead = nDigitsRead + 1; + index = index + 1; + } + + if (sawRadix && !nDigitsRead) { + throw new Error('' + string + ' not a valid Decimal128 string'); + } + + // Read exponent if exists + if (string[index] == 'e' || string[index] == 'E') { + // Read exponent digits + var match = string.substr(++index).match(EXPONENT_REGEX); + + // No digits read + if (!match || !match[2]) { + return new Decimal128(new Buffer(NAN_BUFFER)); + } + + // Get exponent + exponent = parseInt(match[0], 10); + + // Adjust the index + index = index + match[0].length; + } + + // Return not a number + if (string[index]) { + return new Decimal128(new Buffer(NAN_BUFFER)); + } + + // Done reading input + // Find first non-zero digit in digits + firstDigit = 0; + + if (!nDigitsStored) { + firstDigit = 0; + lastDigit = 0; + digits[0] = 0; + nDigits = 1; + nDigitsStored = 1; + significantDigits = 0; + } else { + lastDigit = nDigitsStored - 1; + significantDigits = nDigits; + + if (exponent != 0 && significantDigits != 1) { + while (string[firstNonZero + significantDigits - 1] == '0') { + significantDigits = significantDigits - 1; + } + } + } + + // Normalization of exponent + // Correct exponent based on radix position, and shift significand as needed + // to represent user input + + // Overflow prevention + if (exponent <= radixPosition && radixPosition - exponent > 1 << 14) { + exponent = EXPONENT_MIN; + } else { + exponent = exponent - radixPosition; + } + + // Attempt to normalize the exponent + while (exponent > EXPONENT_MAX) { + // Shift exponent to significand and decrease + lastDigit = lastDigit + 1; + + if (lastDigit - firstDigit > MAX_DIGITS) { + // Check if we have a zero then just hard clamp, otherwise fail + var digitsString = digits.join(''); + if (digitsString.match(/^0+$/)) { + exponent = EXPONENT_MAX; + break; + } else { + return new Decimal128( + new Buffer( + isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER + ) + ); + } + } + + exponent = exponent - 1; + } + + while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) { + // Shift last digit + if (lastDigit == 0) { + exponent = EXPONENT_MIN; + significantDigits = 0; + break; + } + + if (nDigitsStored < nDigits) { + // adjust to match digits not stored + nDigits = nDigits - 1; + } else { + // adjust to round + lastDigit = lastDigit - 1; + } + + if (exponent < EXPONENT_MAX) { + exponent = exponent + 1; + } else { + // Check if we have a zero then just hard clamp, otherwise fail + var digitsString = digits.join(''); + if (digitsString.match(/^0+$/)) { + exponent = EXPONENT_MAX; + break; + } else { + return new Decimal128( + new Buffer( + isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER + ) + ); + } + } + } + + // Round + // We've normalized the exponent, but might still need to round. + if ( + lastDigit - firstDigit + 1 < significantDigits && + string[significantDigits] != '0' + ) { + var endOfString = nDigitsRead; + + // If we have seen a radix point, 'string' is 1 longer than we have + // documented with ndigits_read, so inc the position of the first nonzero + // digit and the position that digits are read to. + if (sawRadix && exponent == EXPONENT_MIN) { + firstNonZero = firstNonZero + 1; + endOfString = endOfString + 1; + } + + var roundDigit = parseInt(string[firstNonZero + lastDigit + 1], 10); + var roundBit = 0; + + if (roundDigit >= 5) { + roundBit = 1; + + if (roundDigit == 5) { + roundBit = digits[lastDigit] % 2 == 1; + + for ( + var i = firstNonZero + lastDigit + 2; + i < endOfString; + i++ + ) { + if (parseInt(string[i], 10)) { + roundBit = 1; + break; + } + } + } + } + + if (roundBit) { + var dIdx = lastDigit; + + for (; dIdx >= 0; dIdx--) { + if (++digits[dIdx] > 9) { + digits[dIdx] = 0; + + // overflowed most significant digit + if (dIdx == 0) { + if (exponent < EXPONENT_MAX) { + exponent = exponent + 1; + digits[dIdx] = 1; + } else { + return new Decimal128( + new Buffer( + isNegative + ? INF_NEGATIVE_BUFFER + : INF_POSITIVE_BUFFER + ) + ); + } + } + } else { + break; + } + } + } + } + + // Encode significand + // The high 17 digits of the significand + significandHigh = Long.fromNumber(0); + // The low 17 digits of the significand + significandLow = Long.fromNumber(0); + + // read a zero + if (significantDigits == 0) { + significandHigh = Long.fromNumber(0); + significandLow = Long.fromNumber(0); + } else if (lastDigit - firstDigit < 17) { + var dIdx = firstDigit; + significandLow = Long.fromNumber(digits[dIdx++]); + significandHigh = new Long(0, 0); + + for (; dIdx <= lastDigit; dIdx++) { + significandLow = significandLow.multiply(Long.fromNumber(10)); + significandLow = significandLow.add(Long.fromNumber(digits[dIdx])); + } + } else { + var dIdx = firstDigit; + significandHigh = Long.fromNumber(digits[dIdx++]); + + for (; dIdx <= lastDigit - 17; dIdx++) { + significandHigh = significandHigh.multiply(Long.fromNumber(10)); + significandHigh = significandHigh.add( + Long.fromNumber(digits[dIdx]) + ); + } + + significandLow = Long.fromNumber(digits[dIdx++]); + + for (; dIdx <= lastDigit; dIdx++) { + significandLow = significandLow.multiply(Long.fromNumber(10)); + significandLow = significandLow.add(Long.fromNumber(digits[dIdx])); + } + } + + var significand = multiply64x2( + significandHigh, + Long.fromString('100000000000000000') + ); + + significand.low = significand.low.add(significandLow); + + if (lessThan(significand.low, significandLow)) { + significand.high = significand.high.add(Long.fromNumber(1)); + } + + // Biased exponent + var biasedExponent = exponent + EXPONENT_BIAS; + var dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) }; + + // Encode combination, exponent, and significand. + if ( + significand.high + .shiftRightUnsigned(49) + .and(Long.fromNumber(1)) + .equals(Long.fromNumber) + ) { + // Encode '11' into bits 1 to 3 + dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61)); + dec.high = dec.high.or( + Long.fromNumber(biasedExponent).and( + Long.fromNumber(0x3fff).shiftLeft(47) + ) + ); + dec.high = dec.high.or( + significand.high.and(Long.fromNumber(0x7fffffffffff)) + ); + } else { + dec.high = dec.high.or( + Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49) + ); + dec.high = dec.high.or( + significand.high.and(Long.fromNumber(0x1ffffffffffff)) + ); + } + + dec.low = significand.low; + + // Encode sign + if (isNegative) { + dec.high = dec.high.or(Long.fromString('9223372036854775808')); + } + + // Encode into a buffer + var buffer = new Buffer(16); + var index = 0; + + // Encode the low 64 bits of the decimal + // Encode low bits + buffer[index++] = dec.low.low_ & 0xff; + buffer[index++] = (dec.low.low_ >> 8) & 0xff; + buffer[index++] = (dec.low.low_ >> 16) & 0xff; + buffer[index++] = (dec.low.low_ >> 24) & 0xff; + // Encode high bits + buffer[index++] = dec.low.high_ & 0xff; + buffer[index++] = (dec.low.high_ >> 8) & 0xff; + buffer[index++] = (dec.low.high_ >> 16) & 0xff; + buffer[index++] = (dec.low.high_ >> 24) & 0xff; + + // Encode the high 64 bits of the decimal + // Encode low bits + buffer[index++] = dec.high.low_ & 0xff; + buffer[index++] = (dec.high.low_ >> 8) & 0xff; + buffer[index++] = (dec.high.low_ >> 16) & 0xff; + buffer[index++] = (dec.high.low_ >> 24) & 0xff; + // Encode high bits + buffer[index++] = dec.high.high_ & 0xff; + buffer[index++] = (dec.high.high_ >> 8) & 0xff; + buffer[index++] = (dec.high.high_ >> 16) & 0xff; + buffer[index++] = (dec.high.high_ >> 24) & 0xff; + + // Return the new Decimal128 + return new Decimal128(buffer); + }; + + // Extract least significant 5 bits + var COMBINATION_MASK = 0x1f; + // Extract least significant 14 bits + var EXPONENT_MASK = 0x3fff; + // Value of combination field for Inf + var COMBINATION_INFINITY = 30; + // Value of combination field for NaN + var COMBINATION_NAN = 31; + // Value of combination field for NaN + var COMBINATION_SNAN = 32; + // decimal128 exponent bias + var EXPONENT_BIAS = 6176; + + Decimal128.prototype.toString = function() { + // Note: bits in this routine are referred to starting at 0, + // from the sign bit, towards the coefficient. + + // bits 0 - 31 + var high; + // bits 32 - 63 + var midh; + // bits 64 - 95 + var midl; + // bits 96 - 127 + var low; + // bits 1 - 5 + var combination; + // decoded biased exponent (14 bits) + var biased_exponent; + // the number of significand digits + var significand_digits = 0; + // the base-10 digits in the significand + var significand = new Array(36); + for (var i = 0; i < significand.length; i++) significand[i] = 0; + // read pointer into significand + var index = 0; + + // unbiased exponent + var exponent; + // the exponent if scientific notation is used + var scientific_exponent; + + // true if the number is zero + var is_zero = false; + + // the most signifcant significand bits (50-46) + var significand_msb; + // temporary storage for significand decoding + var significand128 = { parts: new Array(4) }; + // indexing variables + var i; + var j, k; + + // Output string + var string = []; + + // Unpack index + var index = 0; + + // Buffer reference + var buffer = this.bytes; + + // Unpack the low 64bits into a long + low = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + midl = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + + // Unpack the high 64bits into a long + midh = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + high = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + + // Unpack index + var index = 0; + + // Create the state of the decimal + var dec = { + low: new Long(low, midl), + high: new Long(midh, high) + }; + + if (dec.high.lessThan(Long.ZERO)) { + string.push('-'); + } + + // Decode combination field and exponent + combination = (high >> 26) & COMBINATION_MASK; + + if (combination >> 3 == 3) { + // Check for 'special' values + if (combination == COMBINATION_INFINITY) { + return string.join('') + 'Infinity'; + } else if (combination == COMBINATION_NAN) { + return 'NaN'; + } else { + biased_exponent = (high >> 15) & EXPONENT_MASK; + significand_msb = 0x08 + ((high >> 14) & 0x01); + } + } else { + significand_msb = (high >> 14) & 0x07; + biased_exponent = (high >> 17) & EXPONENT_MASK; + } + + exponent = biased_exponent - EXPONENT_BIAS; + + // Create string of significand digits + + // Convert the 114-bit binary number represented by + // (significand_high, significand_low) to at most 34 decimal + // digits through modulo and division. + significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14); + significand128.parts[1] = midh; + significand128.parts[2] = midl; + significand128.parts[3] = low; + + if ( + significand128.parts[0] == 0 && + significand128.parts[1] == 0 && + significand128.parts[2] == 0 && + significand128.parts[3] == 0 + ) { + is_zero = true; + } else { + for (var k = 3; k >= 0; k--) { + var least_digits = 0; + // Peform the divide + var result = divideu128(significand128); + significand128 = result.quotient; + least_digits = result.rem.low_; + + // We now have the 9 least significant digits (in base 2). + // Convert and output to string. + if (!least_digits) continue; + + for (var j = 8; j >= 0; j--) { + // significand[k * 9 + j] = Math.round(least_digits % 10); + significand[k * 9 + j] = least_digits % 10; + // least_digits = Math.round(least_digits / 10); + least_digits = Math.floor(least_digits / 10); + } + } + } + + // Output format options: + // Scientific - [-]d.dddE(+/-)dd or [-]dE(+/-)dd + // Regular - ddd.ddd + + if (is_zero) { + significand_digits = 1; + significand[index] = 0; + } else { + significand_digits = 36; + var i = 0; + + while (!significand[index]) { + i++; + significand_digits = significand_digits - 1; + index = index + 1; + } + } + + scientific_exponent = significand_digits - 1 + exponent; + + // The scientific exponent checks are dictated by the string conversion + // specification and are somewhat arbitrary cutoffs. + // + // We must check exponent > 0, because if this is the case, the number + // has trailing zeros. However, we *cannot* output these trailing zeros, + // because doing so would change the precision of the value, and would + // change stored data if the string converted number is round tripped. + + if ( + scientific_exponent >= 34 || + scientific_exponent <= -7 || + exponent > 0 + ) { + // Scientific format + string.push(significand[index++]); + significand_digits = significand_digits - 1; + + if (significand_digits) { + string.push('.'); + } + + for (var i = 0; i < significand_digits; i++) { + string.push(significand[index++]); + } + + // Exponent + string.push('E'); + if (scientific_exponent > 0) { + string.push('+' + scientific_exponent); + } else { + string.push(scientific_exponent); + } + } else { + // Regular format with no decimal place + if (exponent >= 0) { + for (var i = 0; i < significand_digits; i++) { + string.push(significand[index++]); + } + } else { + var radix_position = significand_digits + exponent; + + // non-zero digits before radix + if (radix_position > 0) { + for (var i = 0; i < radix_position; i++) { + string.push(significand[index++]); + } + } else { + string.push('0'); + } + + string.push('.'); + // add leading zeros after radix + while (radix_position++ < 0) { + string.push('0'); + } + + for ( + var i = 0; + i < significand_digits - Math.max(radix_position - 1, 0); + i++ + ) { + string.push(significand[index++]); + } + } + } + + return string.join(''); + }; + + Decimal128.prototype.toJSON = function() { + return { $numberDecimal: this.toString() }; + }; + + module.exports = Decimal128; + module.exports.Decimal128 = Decimal128; + /* WEBPACK VAR INJECTION */ + }.call(exports, __webpack_require__(300).Buffer)); + + /***/ + }, + /* 315 */ + /***/ function(module, exports) { + /** + * A class representation of the BSON MinKey type. + * + * @class + * @return {MinKey} A MinKey instance + */ + function MinKey() { + if (!(this instanceof MinKey)) return new MinKey(); + + this._bsontype = 'MinKey'; + } + + module.exports = MinKey; + module.exports.MinKey = MinKey; + + /***/ + }, + /* 316 */ + /***/ function(module, exports) { + /** + * A class representation of the BSON MaxKey type. + * + * @class + * @return {MaxKey} A MaxKey instance + */ + function MaxKey() { + if (!(this instanceof MaxKey)) return new MaxKey(); + + this._bsontype = 'MaxKey'; + } + + module.exports = MaxKey; + module.exports.MaxKey = MaxKey; + + /***/ + }, + /* 317 */ + /***/ function(module, exports) { + /** + * A class representation of the BSON DBRef type. + * + * @class + * @param {string} namespace the collection name. + * @param {ObjectID} oid the reference ObjectID. + * @param {string} [db] optional db name, if omitted the reference is local to the current db. + * @return {DBRef} + */ + function DBRef(namespace, oid, db) { + if (!(this instanceof DBRef)) return new DBRef(namespace, oid, db); + + this._bsontype = 'DBRef'; + this.namespace = namespace; + this.oid = oid; + this.db = db; + } + + /** + * @ignore + * @api private + */ + DBRef.prototype.toJSON = function() { + return { + $ref: this.namespace, + $id: this.oid, + $db: this.db == null ? '' : this.db + }; + }; + + module.exports = DBRef; + module.exports.DBRef = DBRef; + + /***/ + }, + /* 318 */ + /***/ function(module, exports, __webpack_require__) { + /* WEBPACK VAR INJECTION */ (function(global) { + /** + * Module dependencies. + * @ignore + */ + + // Test if we're in Node via presence of "global" not absence of "window" + // to support hybrid environments like Electron + if (typeof global !== 'undefined') { + var Buffer = __webpack_require__(300).Buffer; // TODO just use global Buffer + } + + /** + * A class representation of the BSON Binary type. + * + * Sub types + * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type. + * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type. + * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type. + * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type. + * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type. + * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type. + * + * @class + * @param {Buffer} buffer a buffer object containing the binary data. + * @param {Number} [subType] the option binary type. + * @return {Binary} + */ + function Binary(buffer, subType) { + if (!(this instanceof Binary)) return new Binary(buffer, subType); + + this._bsontype = 'Binary'; + + if (buffer instanceof Number) { + this.sub_type = buffer; + this.position = 0; + } else { + this.sub_type = subType == null ? BSON_BINARY_SUBTYPE_DEFAULT : subType; + this.position = 0; + } + + if (buffer != null && !(buffer instanceof Number)) { + // Only accept Buffer, Uint8Array or Arrays + if (typeof buffer == 'string') { + // Different ways of writing the length of the string for the different types + if (typeof Buffer != 'undefined') { + this.buffer = new Buffer(buffer); + } else if ( + typeof Uint8Array != 'undefined' || + Object.prototype.toString.call(buffer) == '[object Array]' + ) { + this.buffer = writeStringToArray(buffer); + } else { + throw new Error( + 'only String, Buffer, Uint8Array or Array accepted' + ); + } + } else { + this.buffer = buffer; + } + this.position = buffer.length; + } else { + if (typeof Buffer != 'undefined') { + this.buffer = new Buffer(Binary.BUFFER_SIZE); + } else if (typeof Uint8Array != 'undefined') { + this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE)); + } else { + this.buffer = new Array(Binary.BUFFER_SIZE); + } + // Set position to start of buffer + this.position = 0; + } + } + + /** + * Updates this binary with byte_value. + * + * @method + * @param {string} byte_value a single byte we wish to write. + */ + Binary.prototype.put = function put(byte_value) { + // If it's a string and a has more than one character throw an error + if ( + byte_value['length'] != null && + typeof byte_value != 'number' && + byte_value.length != 1 + ) + throw new Error( + 'only accepts single character String, Uint8Array or Array' + ); + if ((typeof byte_value != 'number' && byte_value < 0) || byte_value > 255) + throw new Error( + 'only accepts number in a valid unsigned byte range 0-255' + ); + + // Decode the byte value once + var decoded_byte = null; + if (typeof byte_value == 'string') { + decoded_byte = byte_value.charCodeAt(0); + } else if (byte_value['length'] != null) { + decoded_byte = byte_value[0]; + } else { + decoded_byte = byte_value; + } + + if (this.buffer.length > this.position) { + this.buffer[this.position++] = decoded_byte; + } else { + if (typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { + // Create additional overflow buffer + var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length); + // Combine the two buffers together + this.buffer.copy(buffer, 0, 0, this.buffer.length); + this.buffer = buffer; + this.buffer[this.position++] = decoded_byte; + } else { + var buffer = null; + // Create a new buffer (typed or normal array) + if ( + Object.prototype.toString.call(this.buffer) == + '[object Uint8Array]' + ) { + buffer = new Uint8Array( + new ArrayBuffer(Binary.BUFFER_SIZE + this.buffer.length) + ); + } else { + buffer = new Array(Binary.BUFFER_SIZE + this.buffer.length); + } + + // We need to copy all the content to the new array + for (var i = 0; i < this.buffer.length; i++) { + buffer[i] = this.buffer[i]; + } + + // Reassign the buffer + this.buffer = buffer; + // Write the byte + this.buffer[this.position++] = decoded_byte; + } + } + }; + + /** + * Writes a buffer or string to the binary. + * + * @method + * @param {(Buffer|string)} string a string or buffer to be written to the Binary BSON object. + * @param {number} offset specify the binary of where to write the content. + * @return {null} + */ + Binary.prototype.write = function write(string, offset) { + offset = typeof offset == 'number' ? offset : this.position; + + // If the buffer is to small let's extend the buffer + if (this.buffer.length < offset + string.length) { + var buffer = null; + // If we are in node.js + if (typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { + buffer = new Buffer(this.buffer.length + string.length); + this.buffer.copy(buffer, 0, 0, this.buffer.length); + } else if ( + Object.prototype.toString.call(this.buffer) == '[object Uint8Array]' + ) { + // Create a new buffer + buffer = new Uint8Array( + new ArrayBuffer(this.buffer.length + string.length) + ); + // Copy the content + for (var i = 0; i < this.position; i++) { + buffer[i] = this.buffer[i]; + } + } + + // Assign the new buffer + this.buffer = buffer; + } + + if ( + typeof Buffer != 'undefined' && + Buffer.isBuffer(string) && + Buffer.isBuffer(this.buffer) + ) { + string.copy(this.buffer, offset, 0, string.length); + this.position = + offset + string.length > this.position + ? offset + string.length + : this.position; + // offset = string.length + } else if ( + typeof Buffer != 'undefined' && + typeof string == 'string' && + Buffer.isBuffer(this.buffer) + ) { + this.buffer.write(string, offset, 'binary'); + this.position = + offset + string.length > this.position + ? offset + string.length + : this.position; + // offset = string.length; + } else if ( + Object.prototype.toString.call(string) == '[object Uint8Array]' || + (Object.prototype.toString.call(string) == '[object Array]' && + typeof string != 'string') + ) { + for (var i = 0; i < string.length; i++) { + this.buffer[offset++] = string[i]; + } + + this.position = offset > this.position ? offset : this.position; + } else if (typeof string == 'string') { + for (var i = 0; i < string.length; i++) { + this.buffer[offset++] = string.charCodeAt(i); + } + + this.position = offset > this.position ? offset : this.position; + } + }; + + /** + * Reads **length** bytes starting at **position**. + * + * @method + * @param {number} position read from the given position in the Binary. + * @param {number} length the number of bytes to read. + * @return {Buffer} + */ + Binary.prototype.read = function read(position, length) { + length = length && length > 0 ? length : this.position; + + // Let's return the data based on the type we have + if (this.buffer['slice']) { + return this.buffer.slice(position, position + length); + } else { + // Create a buffer to keep the result + var buffer = + typeof Uint8Array != 'undefined' + ? new Uint8Array(new ArrayBuffer(length)) + : new Array(length); + for (var i = 0; i < length; i++) { + buffer[i] = this.buffer[position++]; + } + } + // Return the buffer + return buffer; + }; + + /** + * Returns the value of this binary as a string. + * + * @method + * @return {string} + */ + Binary.prototype.value = function value(asRaw) { + asRaw = asRaw == null ? false : asRaw; + + // Optimize to serialize for the situation where the data == size of buffer + if ( + asRaw && + typeof Buffer != 'undefined' && + Buffer.isBuffer(this.buffer) && + this.buffer.length == this.position + ) + return this.buffer; + + // If it's a node.js buffer object + if (typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { + return asRaw + ? this.buffer.slice(0, this.position) + : this.buffer.toString('binary', 0, this.position); + } else { + if (asRaw) { + // we support the slice command use it + if (this.buffer['slice'] != null) { + return this.buffer.slice(0, this.position); + } else { + // Create a new buffer to copy content to + var newBuffer = + Object.prototype.toString.call(this.buffer) == + '[object Uint8Array]' + ? new Uint8Array(new ArrayBuffer(this.position)) + : new Array(this.position); + // Copy content + for (var i = 0; i < this.position; i++) { + newBuffer[i] = this.buffer[i]; + } + // Return the buffer + return newBuffer; + } + } else { + return convertArraytoUtf8BinaryString( + this.buffer, + 0, + this.position + ); + } + } + }; + + /** + * Length. + * + * @method + * @return {number} the length of the binary. + */ + Binary.prototype.length = function length() { + return this.position; + }; + + /** + * @ignore + */ + Binary.prototype.toJSON = function() { + return this.buffer != null ? this.buffer.toString('base64') : ''; + }; + + /** + * @ignore + */ + Binary.prototype.toString = function(format) { + return this.buffer != null + ? this.buffer.slice(0, this.position).toString(format) + : ''; + }; + + /** + * Binary default subtype + * @ignore + */ + var BSON_BINARY_SUBTYPE_DEFAULT = 0; + + /** + * @ignore + */ + var writeStringToArray = function(data) { + // Create a buffer + var buffer = + typeof Uint8Array != 'undefined' + ? new Uint8Array(new ArrayBuffer(data.length)) + : new Array(data.length); + // Write the content to the buffer + for (var i = 0; i < data.length; i++) { + buffer[i] = data.charCodeAt(i); + } + // Write the string to the buffer + return buffer; + }; + + /** + * Convert Array ot Uint8Array to Binary String + * + * @ignore + */ + var convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) { + var result = ''; + for (var i = startIndex; i < endIndex; i++) { + result = result + String.fromCharCode(byteArray[i]); + } + return result; + }; + + Binary.BUFFER_SIZE = 256; + + /** + * Default BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ + Binary.SUBTYPE_DEFAULT = 0; + /** + * Function BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ + Binary.SUBTYPE_FUNCTION = 1; + /** + * Byte Array BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ + Binary.SUBTYPE_BYTE_ARRAY = 2; + /** + * OLD UUID BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ + Binary.SUBTYPE_UUID_OLD = 3; + /** + * UUID BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ + Binary.SUBTYPE_UUID = 4; + /** + * MD5 BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ + Binary.SUBTYPE_MD5 = 5; + /** + * User BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ + Binary.SUBTYPE_USER_DEFINED = 128; + + /** + * Expose. + */ + module.exports = Binary; + module.exports.Binary = Binary; + /* WEBPACK VAR INJECTION */ + }.call( + exports, + (function() { + return this; + })() + )); + + /***/ + }, + /* 319 */ + /***/ function(module, exports, __webpack_require__) { + /* WEBPACK VAR INJECTION */ (function(Buffer) { + 'use strict'; + + var readIEEE754 = __webpack_require__(304).readIEEE754, + f = __webpack_require__(320).format, + Long = __webpack_require__(306).Long, + Double = __webpack_require__(307).Double, + Timestamp = __webpack_require__(308).Timestamp, + ObjectID = __webpack_require__(309).ObjectID, + Symbol = __webpack_require__(311).Symbol, + Code = __webpack_require__(313).Code, + MinKey = __webpack_require__(315).MinKey, + MaxKey = __webpack_require__(316).MaxKey, + Decimal128 = __webpack_require__(314), + Int32 = __webpack_require__(312), + DBRef = __webpack_require__(317).DBRef, + BSONRegExp = __webpack_require__(310).BSONRegExp, + Binary = __webpack_require__(318).Binary; + + var deserialize = function(buffer, options, isArray) { + options = options == null ? {} : options; + var index = options && options.index ? options.index : 0; + // Read the document size + var size = + buffer[index] | + (buffer[index + 1] << 8) | + (buffer[index + 2] << 16) | + (buffer[index + 3] << 24); + + // Ensure buffer is valid size + if (size < 5 || buffer.length < size || size + index > buffer.length) { + throw new Error('corrupt bson message'); + } + + // Illegal end value + if (buffer[index + size - 1] != 0) { + throw new Error( + "One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00" + ); + } + + // Start deserializtion + return deserializeObject(buffer, index, options, isArray); + }; + + var deserializeObject = function(buffer, index, options, isArray) { + var evalFunctions = + options['evalFunctions'] == null ? false : options['evalFunctions']; + var cacheFunctions = + options['cacheFunctions'] == null ? false : options['cacheFunctions']; + var cacheFunctionsCrc32 = + options['cacheFunctionsCrc32'] == null + ? false + : options['cacheFunctionsCrc32']; + var fieldsAsRaw = + options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw']; + + // Return raw bson buffer instead of parsing it + var raw = options['raw'] == null ? false : options['raw']; + + // Return BSONRegExp objects instead of native regular expressions + var bsonRegExp = + typeof options['bsonRegExp'] == 'boolean' + ? options['bsonRegExp'] + : false; + + // Controls the promotion of values vs wrapper classes + var promoteBuffers = + options['promoteBuffers'] == null ? false : options['promoteBuffers']; + var promoteLongs = + options['promoteLongs'] == null ? true : options['promoteLongs']; + var promoteValues = + options['promoteValues'] == null ? true : options['promoteValues']; + + // Set the start index + var startIndex = index; + + // Validate that we have at least 4 bytes of buffer + if (buffer.length < 5) + throw new Error('corrupt bson message < 5 bytes long'); + + // Read the document size + var size = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + + // Ensure buffer is valid size + if (size < 5 || size > buffer.length) + throw new Error('corrupt bson message'); + + // Create holding object + var object = isArray ? [] : {}; + // Used for arrays to skip having to perform utf8 decoding + var arrayIndex = 0; + + // While we have more left data left keep parsing + while (true) { + // Read the type + var elementType = buffer[index++]; + // If we get a zero it's the last byte, exit + if (elementType == 0) { + break; + } + + // Get the start search index + var i = index; + // Locate the end of the c string + while (buffer[i] !== 0x00 && i < buffer.length) { + i++; + } + + // If are at the end of the buffer there is a problem with the document + if (i >= buffer.length) + throw new Error('Bad BSON Document: illegal CString'); + var name = isArray ? arrayIndex++ : buffer.toString('utf8', index, i); + + index = i + 1; + + if (elementType == BSON.BSON_DATA_STRING) { + var stringSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + if ( + stringSize <= 0 || + stringSize > buffer.length - index || + buffer[index + stringSize - 1] != 0 + ) + throw new Error('bad string length in bson'); + object[name] = buffer.toString( + 'utf8', + index, + index + stringSize - 1 + ); + index = index + stringSize; + } else if (elementType == BSON.BSON_DATA_OID) { + var oid = new Buffer(12); + buffer.copy(oid, 0, index, index + 12); + object[name] = new ObjectID(oid); + index = index + 12; + } else if ( + elementType == BSON.BSON_DATA_INT && + promoteValues == false + ) { + object[name] = new Int32( + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24) + ); + } else if (elementType == BSON.BSON_DATA_INT) { + object[name] = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + } else if ( + elementType == BSON.BSON_DATA_NUMBER && + promoteValues == false + ) { + object[name] = new Double(buffer.readDoubleLE(index)); + index = index + 8; + } else if (elementType == BSON.BSON_DATA_NUMBER) { + object[name] = buffer.readDoubleLE(index); + index = index + 8; + } else if (elementType == BSON.BSON_DATA_DATE) { + var lowBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + var highBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + object[name] = new Date(new Long(lowBits, highBits).toNumber()); + } else if (elementType == BSON.BSON_DATA_BOOLEAN) { + if (buffer[index] != 0 && buffer[index] != 1) + throw new Error('illegal boolean type value'); + object[name] = buffer[index++] == 1; + } else if (elementType == BSON.BSON_DATA_OBJECT) { + var _index = index; + var objectSize = + buffer[index] | + (buffer[index + 1] << 8) | + (buffer[index + 2] << 16) | + (buffer[index + 3] << 24); + if (objectSize <= 0 || objectSize > buffer.length - index) + throw new Error('bad embedded document length in bson'); + + // We have a raw value + if (raw) { + object[name] = buffer.slice(index, index + objectSize); + } else { + object[name] = deserializeObject( + buffer, + _index, + options, + false + ); + } + + index = index + objectSize; + } else if (elementType == BSON.BSON_DATA_ARRAY) { + var _index = index; + var objectSize = + buffer[index] | + (buffer[index + 1] << 8) | + (buffer[index + 2] << 16) | + (buffer[index + 3] << 24); + var arrayOptions = options; + + // Stop index + var stopIndex = index + objectSize; + + // All elements of array to be returned as raw bson + if (fieldsAsRaw && fieldsAsRaw[name]) { + arrayOptions = {}; + for (var n in options) arrayOptions[n] = options[n]; + arrayOptions['raw'] = true; + } + + object[name] = deserializeObject( + buffer, + _index, + arrayOptions, + true + ); + index = index + objectSize; + + if (buffer[index - 1] != 0) + throw new Error('invalid array terminator byte'); + if (index != stopIndex) throw new Error('corrupted array bson'); + } else if (elementType == BSON.BSON_DATA_UNDEFINED) { + object[name] = undefined; + } else if (elementType == BSON.BSON_DATA_NULL) { + object[name] = null; + } else if (elementType == BSON.BSON_DATA_LONG) { + // Unpack the low and high bits + var lowBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + var highBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + var long = new Long(lowBits, highBits); + // Promote the long if possible + if (promoteLongs && promoteValues == true) { + object[name] = + long.lessThanOrEqual(JS_INT_MAX_LONG) && + long.greaterThanOrEqual(JS_INT_MIN_LONG) + ? long.toNumber() + : long; + } else { + object[name] = long; + } + } else if (elementType == BSON.BSON_DATA_DECIMAL128) { + // Buffer to contain the decimal bytes + var bytes = new Buffer(16); + // Copy the next 16 bytes into the bytes buffer + buffer.copy(bytes, 0, index, index + 16); + // Update index + index = index + 16; + // Assign the new Decimal128 value + var decimal128 = new Decimal128(bytes); + // If we have an alternative mapper use that + object[name] = decimal128.toObject + ? decimal128.toObject() + : decimal128; + } else if (elementType == BSON.BSON_DATA_BINARY) { + var binarySize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + var totalBinarySize = binarySize; + var subType = buffer[index++]; + + // Did we have a negative binary size, throw + if (binarySize < 0) + throw new Error('Negative binary type element size found'); + + // Is the length longer than the document + if (binarySize > buffer.length) + throw new Error('Binary type size larger than document size'); + + // Decode as raw Buffer object if options specifies it + if (buffer['slice'] != null) { + // If we have subtype 2 skip the 4 bytes for the size + if (subType == Binary.SUBTYPE_BYTE_ARRAY) { + binarySize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + if (binarySize < 0) + throw new Error( + 'Negative binary type element size found for subtype 0x02' + ); + if (binarySize > totalBinarySize - 4) + throw new Error( + 'Binary type with subtype 0x02 contains to long binary size' + ); + if (binarySize < totalBinarySize - 4) + throw new Error( + 'Binary type with subtype 0x02 contains to short binary size' + ); + } + + if (promoteBuffers && promoteValues) { + object[name] = buffer.slice(index, index + binarySize); + } else { + object[name] = new Binary( + buffer.slice(index, index + binarySize), + subType + ); + } + } else { + var _buffer = + typeof Uint8Array != 'undefined' + ? new Uint8Array(new ArrayBuffer(binarySize)) + : new Array(binarySize); + // If we have subtype 2 skip the 4 bytes for the size + if (subType == Binary.SUBTYPE_BYTE_ARRAY) { + binarySize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + if (binarySize < 0) + throw new Error( + 'Negative binary type element size found for subtype 0x02' + ); + if (binarySize > totalBinarySize - 4) + throw new Error( + 'Binary type with subtype 0x02 contains to long binary size' + ); + if (binarySize < totalBinarySize - 4) + throw new Error( + 'Binary type with subtype 0x02 contains to short binary size' + ); + } + + // Copy the data + for (var i = 0; i < binarySize; i++) { + _buffer[i] = buffer[index + i]; + } + + if (promoteBuffers && promoteValues) { + object[name] = _buffer; + } else { + object[name] = new Binary(_buffer, subType); + } + } + + // Update the index + index = index + binarySize; + } else if ( + elementType == BSON.BSON_DATA_REGEXP && + bsonRegExp == false + ) { + // Get the start search index + var i = index; + // Locate the end of the c string + while (buffer[i] !== 0x00 && i < buffer.length) { + i++; + } + // If are at the end of the buffer there is a problem with the document + if (i >= buffer.length) + throw new Error('Bad BSON Document: illegal CString'); + // Return the C string + var source = buffer.toString('utf8', index, i); + // Create the regexp + index = i + 1; + + // Get the start search index + var i = index; + // Locate the end of the c string + while (buffer[i] !== 0x00 && i < buffer.length) { + i++; + } + // If are at the end of the buffer there is a problem with the document + if (i >= buffer.length) + throw new Error('Bad BSON Document: illegal CString'); + // Return the C string + var regExpOptions = buffer.toString('utf8', index, i); + index = i + 1; + + // For each option add the corresponding one for javascript + var optionsArray = new Array(regExpOptions.length); + + // Parse options + for (var i = 0; i < regExpOptions.length; i++) { + switch (regExpOptions[i]) { + case 'm': + optionsArray[i] = 'm'; + break; + case 's': + optionsArray[i] = 'g'; + break; + case 'i': + optionsArray[i] = 'i'; + break; + } + } + + object[name] = new RegExp(source, optionsArray.join('')); + } else if (elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == true) { + // Get the start search index + var i = index; + // Locate the end of the c string + while (buffer[i] !== 0x00 && i < buffer.length) { + i++; + } + // If are at the end of the buffer there is a problem with the document + if (i >= buffer.length) + throw new Error('Bad BSON Document: illegal CString'); + // Return the C string + var source = buffer.toString('utf8', index, i); + index = i + 1; + + // Get the start search index + var i = index; + // Locate the end of the c string + while (buffer[i] !== 0x00 && i < buffer.length) { + i++; + } + // If are at the end of the buffer there is a problem with the document + if (i >= buffer.length) + throw new Error('Bad BSON Document: illegal CString'); + // Return the C string + var regExpOptions = buffer.toString('utf8', index, i); + index = i + 1; + + // Set the object + object[name] = new BSONRegExp(source, regExpOptions); + } else if (elementType == BSON.BSON_DATA_SYMBOL) { + var stringSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + if ( + stringSize <= 0 || + stringSize > buffer.length - index || + buffer[index + stringSize - 1] != 0 + ) + throw new Error('bad string length in bson'); + object[name] = new Symbol( + buffer.toString('utf8', index, index + stringSize - 1) + ); + index = index + stringSize; + } else if (elementType == BSON.BSON_DATA_TIMESTAMP) { + var lowBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + var highBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + object[name] = new Timestamp(lowBits, highBits); + } else if (elementType == BSON.BSON_DATA_MIN_KEY) { + object[name] = new MinKey(); + } else if (elementType == BSON.BSON_DATA_MAX_KEY) { + object[name] = new MaxKey(); + } else if (elementType == BSON.BSON_DATA_CODE) { + var stringSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + if ( + stringSize <= 0 || + stringSize > buffer.length - index || + buffer[index + stringSize - 1] != 0 + ) + throw new Error('bad string length in bson'); + var functionString = buffer.toString( + 'utf8', + index, + index + stringSize - 1 + ); + + // If we are evaluating the functions + if (evalFunctions) { + var value = null; + // If we have cache enabled let's look for the md5 of the function in the cache + if (cacheFunctions) { + var hash = cacheFunctionsCrc32 + ? crc32(functionString) + : functionString; + // Got to do this to avoid V8 deoptimizing the call due to finding eval + object[name] = isolateEvalWithHash( + functionCache, + hash, + functionString, + object + ); + } else { + object[name] = isolateEval(functionString); + } + } else { + object[name] = new Code(functionString); + } + + // Update parse index position + index = index + stringSize; + } else if (elementType == BSON.BSON_DATA_CODE_W_SCOPE) { + var totalSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + + // Element cannot be shorter than totalSize + stringSize + documentSize + terminator + if (totalSize < 4 + 4 + 4 + 1) { + throw new Error( + 'code_w_scope total size shorter minimum expected length' + ); + } + + // Get the code string size + var stringSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + // Check if we have a valid string + if ( + stringSize <= 0 || + stringSize > buffer.length - index || + buffer[index + stringSize - 1] != 0 + ) + throw new Error('bad string length in bson'); + + // Javascript function + var functionString = buffer.toString( + 'utf8', + index, + index + stringSize - 1 + ); + // Update parse index position + index = index + stringSize; + // Parse the element + var _index = index; + // Decode the size of the object document + var objectSize = + buffer[index] | + (buffer[index + 1] << 8) | + (buffer[index + 2] << 16) | + (buffer[index + 3] << 24); + // Decode the scope object + var scopeObject = deserializeObject(buffer, _index, options, false); + // Adjust the index + index = index + objectSize; + + // Check if field length is to short + if (totalSize < 4 + 4 + objectSize + stringSize) { + throw new Error( + 'code_w_scope total size is to short, truncating scope' + ); + } + + // Check if totalSize field is to long + if (totalSize > 4 + 4 + objectSize + stringSize) { + throw new Error( + 'code_w_scope total size is to long, clips outer document' + ); + } + + // If we are evaluating the functions + if (evalFunctions) { + // Contains the value we are going to set + var value = null; + // If we have cache enabled let's look for the md5 of the function in the cache + if (cacheFunctions) { + var hash = cacheFunctionsCrc32 + ? crc32(functionString) + : functionString; + // Got to do this to avoid V8 deoptimizing the call due to finding eval + object[name] = isolateEvalWithHash( + functionCache, + hash, + functionString, + object + ); + } else { + object[name] = isolateEval(functionString); + } + + object[name].scope = scopeObject; + } else { + object[name] = new Code(functionString, scopeObject); + } + } else if (elementType == BSON.BSON_DATA_DBPOINTER) { + // Get the code string size + var stringSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + // Check if we have a valid string + if ( + stringSize <= 0 || + stringSize > buffer.length - index || + buffer[index + stringSize - 1] != 0 + ) + throw new Error('bad string length in bson'); + // Namespace + var namespace = buffer.toString( + 'utf8', + index, + index + stringSize - 1 + ); + // Update parse index position + index = index + stringSize; + + // Read the oid + var oidBuffer = new Buffer(12); + buffer.copy(oidBuffer, 0, index, index + 12); + var oid = new ObjectID(oidBuffer); + + // Update the index + index = index + 12; + + // Split the namespace + var parts = namespace.split('.'); + var db = parts.shift(); + var collection = parts.join('.'); + // Upgrade to DBRef type + object[name] = new DBRef(collection, oid, db); + } else { + throw new Error( + 'Detected unknown BSON type ' + + elementType.toString(16) + + ' for fieldname "' + + name + + '", are you using the latest BSON parser' + ); + } + } + + // Check if the deserialization was against a valid array/object + if (size != index - startIndex) { + if (isArray) throw new Error('corrupt array bson'); + throw new Error('corrupt object bson'); + } + + // Check if we have a db ref object + if (object['$id'] != null) + object = new DBRef(object['$ref'], object['$id'], object['$db']); + return object; + }; + + /** + * Ensure eval is isolated. + * + * @ignore + * @api private + */ + var isolateEvalWithHash = function( + functionCache, + hash, + functionString, + object + ) { + // Contains the value we are going to set + var value = null; + + // Check for cache hit, eval if missing and return cached function + if (functionCache[hash] == null) { + eval('value = ' + functionString); + functionCache[hash] = value; + } + // Set the object + return functionCache[hash].bind(object); + }; + + /** + * Ensure eval is isolated. + * + * @ignore + * @api private + */ + var isolateEval = function(functionString) { + // Contains the value we are going to set + var value = null; + // Eval the function + eval('value = ' + functionString); + return value; + }; + + var BSON = {}; + + /** + * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 + * + * @ignore + * @api private + */ + var functionCache = (BSON.functionCache = {}); + + /** + * Number BSON Type + * + * @classconstant BSON_DATA_NUMBER + **/ + BSON.BSON_DATA_NUMBER = 1; + /** + * String BSON Type + * + * @classconstant BSON_DATA_STRING + **/ + BSON.BSON_DATA_STRING = 2; + /** + * Object BSON Type + * + * @classconstant BSON_DATA_OBJECT + **/ + BSON.BSON_DATA_OBJECT = 3; + /** + * Array BSON Type + * + * @classconstant BSON_DATA_ARRAY + **/ + BSON.BSON_DATA_ARRAY = 4; + /** + * Binary BSON Type + * + * @classconstant BSON_DATA_BINARY + **/ + BSON.BSON_DATA_BINARY = 5; + /** + * Binary BSON Type + * + * @classconstant BSON_DATA_UNDEFINED + **/ + BSON.BSON_DATA_UNDEFINED = 6; + /** + * ObjectID BSON Type + * + * @classconstant BSON_DATA_OID + **/ + BSON.BSON_DATA_OID = 7; + /** + * Boolean BSON Type + * + * @classconstant BSON_DATA_BOOLEAN + **/ + BSON.BSON_DATA_BOOLEAN = 8; + /** + * Date BSON Type + * + * @classconstant BSON_DATA_DATE + **/ + BSON.BSON_DATA_DATE = 9; + /** + * null BSON Type + * + * @classconstant BSON_DATA_NULL + **/ + BSON.BSON_DATA_NULL = 10; + /** + * RegExp BSON Type + * + * @classconstant BSON_DATA_REGEXP + **/ + BSON.BSON_DATA_REGEXP = 11; + /** + * Code BSON Type + * + * @classconstant BSON_DATA_DBPOINTER + **/ + BSON.BSON_DATA_DBPOINTER = 12; + /** + * Code BSON Type + * + * @classconstant BSON_DATA_CODE + **/ + BSON.BSON_DATA_CODE = 13; + /** + * Symbol BSON Type + * + * @classconstant BSON_DATA_SYMBOL + **/ + BSON.BSON_DATA_SYMBOL = 14; + /** + * Code with Scope BSON Type + * + * @classconstant BSON_DATA_CODE_W_SCOPE + **/ + BSON.BSON_DATA_CODE_W_SCOPE = 15; + /** + * 32 bit Integer BSON Type + * + * @classconstant BSON_DATA_INT + **/ + BSON.BSON_DATA_INT = 16; + /** + * Timestamp BSON Type + * + * @classconstant BSON_DATA_TIMESTAMP + **/ + BSON.BSON_DATA_TIMESTAMP = 17; + /** + * Long BSON Type + * + * @classconstant BSON_DATA_LONG + **/ + BSON.BSON_DATA_LONG = 18; + /** + * Long BSON Type + * + * @classconstant BSON_DATA_DECIMAL128 + **/ + BSON.BSON_DATA_DECIMAL128 = 19; + /** + * MinKey BSON Type + * + * @classconstant BSON_DATA_MIN_KEY + **/ + BSON.BSON_DATA_MIN_KEY = 0xff; + /** + * MaxKey BSON Type + * + * @classconstant BSON_DATA_MAX_KEY + **/ + BSON.BSON_DATA_MAX_KEY = 0x7f; + + /** + * Binary Default Type + * + * @classconstant BSON_BINARY_SUBTYPE_DEFAULT + **/ + BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; + /** + * Binary Function Type + * + * @classconstant BSON_BINARY_SUBTYPE_FUNCTION + **/ + BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; + /** + * Binary Byte Array Type + * + * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY + **/ + BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; + /** + * Binary UUID Type + * + * @classconstant BSON_BINARY_SUBTYPE_UUID + **/ + BSON.BSON_BINARY_SUBTYPE_UUID = 3; + /** + * Binary MD5 Type + * + * @classconstant BSON_BINARY_SUBTYPE_MD5 + **/ + BSON.BSON_BINARY_SUBTYPE_MD5 = 4; + /** + * Binary User Defined Type + * + * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED + **/ + BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; + + // BSON MAX VALUES + BSON.BSON_INT32_MAX = 0x7fffffff; + BSON.BSON_INT32_MIN = -0x80000000; + + BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; + BSON.BSON_INT64_MIN = -Math.pow(2, 63); + + // JS MAX PRECISE VALUES + BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. + BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. + + // Internal long versions + var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. + var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. + + module.exports = deserialize; + /* WEBPACK VAR INJECTION */ + }.call(exports, __webpack_require__(300).Buffer)); + + /***/ + }, + /* 320 */ + /***/ function(module, exports, __webpack_require__) { + /* WEBPACK VAR INJECTION */ (function(global, process) { + // Copyright Joyent, Inc. and other Node contributors. + // + // Permission is hereby granted, free of charge, to any person obtaining a + // copy of this software and associated documentation files (the + // "Software"), to deal in the Software without restriction, including + // without limitation the rights to use, copy, modify, merge, publish, + // distribute, sublicense, and/or sell copies of the Software, and to permit + // persons to whom the Software is furnished to do so, subject to the + // following conditions: + // + // The above copyright notice and this permission notice shall be included + // in all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + var formatRegExp = /%[sdj%]/g; + exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= 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 = __webpack_require__(321); + + 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 = __webpack_require__(322); + + 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); + } + + /* WEBPACK VAR INJECTION */ + }.call( + exports, + (function() { + return this; + })(), + __webpack_require__(294) + )); + + /***/ + }, + /* 321 */ + /***/ function(module, exports) { + module.exports = function isBuffer(arg) { + return ( + arg && + typeof arg === 'object' && + typeof arg.copy === 'function' && + typeof arg.fill === 'function' && + typeof arg.readUInt8 === 'function' + ); + }; + + /***/ + }, + /* 322 */ + /***/ function(module, exports) { + if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; + } else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function() {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + }; + } + + /***/ + }, + /* 323 */ + /***/ function(module, exports, __webpack_require__) { + /* WEBPACK VAR INJECTION */ (function(Buffer) { + 'use strict'; + + var writeIEEE754 = __webpack_require__(304).writeIEEE754, + readIEEE754 = __webpack_require__(304).readIEEE754, + Long = __webpack_require__(306).Long, + Map = __webpack_require__(305), + Double = __webpack_require__(307).Double, + Timestamp = __webpack_require__(308).Timestamp, + ObjectID = __webpack_require__(309).ObjectID, + Symbol = __webpack_require__(311).Symbol, + Code = __webpack_require__(313).Code, + BSONRegExp = __webpack_require__(310).BSONRegExp, + Int32 = __webpack_require__(312).Int32, + MinKey = __webpack_require__(315).MinKey, + MaxKey = __webpack_require__(316).MaxKey, + Decimal128 = __webpack_require__(314), + DBRef = __webpack_require__(317).DBRef, + Binary = __webpack_require__(318).Binary; + + try { + var _Buffer = Uint8Array; + } catch (e) { + var _Buffer = Buffer; + } + + var regexp = /\x00/; + + // To ensure that 0.4 of node works correctly + var isDate = function isDate(d) { + return ( + typeof d === 'object' && + Object.prototype.toString.call(d) === '[object Date]' + ); + }; + + var isRegExp = function isRegExp(d) { + return Object.prototype.toString.call(d) === '[object RegExp]'; + }; + + var serializeString = function(buffer, key, value, index, isArray) { + // Encode String type + buffer[index++] = BSON.BSON_DATA_STRING; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes + 1; + buffer[index - 1] = 0; + // Write the string + var size = buffer.write(value, index + 4, 'utf8'); + // Write the size of the string to buffer + buffer[index + 3] = ((size + 1) >> 24) & 0xff; + buffer[index + 2] = ((size + 1) >> 16) & 0xff; + buffer[index + 1] = ((size + 1) >> 8) & 0xff; + buffer[index] = (size + 1) & 0xff; + // Update index + index = index + 4 + size; + // Write zero + buffer[index++] = 0; + return index; + }; + + var serializeNumber = function(buffer, key, value, index, isArray) { + // We have an integer value + if ( + Math.floor(value) === value && + value >= BSON.JS_INT_MIN && + value <= BSON.JS_INT_MAX + ) { + // If the value fits in 32 bits encode as int, if it fits in a double + // encode it as a double, otherwise long + if (value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { + // Set int type 32 bits or less + buffer[index++] = BSON.BSON_DATA_INT; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write the int value + buffer[index++] = value & 0xff; + buffer[index++] = (value >> 8) & 0xff; + buffer[index++] = (value >> 16) & 0xff; + buffer[index++] = (value >> 24) & 0xff; + } else if (value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { + // Encode as double + buffer[index++] = BSON.BSON_DATA_NUMBER; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write float + writeIEEE754(buffer, value, index, 'little', 52, 8); + // Ajust index + index = index + 8; + } else { + // Set long type + buffer[index++] = BSON.BSON_DATA_LONG; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + var longVal = Long.fromNumber(value); + var lowBits = longVal.getLowBits(); + var highBits = longVal.getHighBits(); + // Encode low bits + buffer[index++] = lowBits & 0xff; + buffer[index++] = (lowBits >> 8) & 0xff; + buffer[index++] = (lowBits >> 16) & 0xff; + buffer[index++] = (lowBits >> 24) & 0xff; + // Encode high bits + buffer[index++] = highBits & 0xff; + buffer[index++] = (highBits >> 8) & 0xff; + buffer[index++] = (highBits >> 16) & 0xff; + buffer[index++] = (highBits >> 24) & 0xff; + } + } else { + // Encode as double + buffer[index++] = BSON.BSON_DATA_NUMBER; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write float + writeIEEE754(buffer, value, index, 'little', 52, 8); + // Ajust index + index = index + 8; + } + + return index; + }; + + var serializeNull = function(buffer, key, value, index, isArray) { + // Set long type + buffer[index++] = BSON.BSON_DATA_NULL; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + return index; + }; + + var serializeBoolean = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_BOOLEAN; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Encode the boolean value + buffer[index++] = value ? 1 : 0; + return index; + }; + + var serializeDate = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_DATE; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + + // Write the date + var dateInMilis = Long.fromNumber(value.getTime()); + var lowBits = dateInMilis.getLowBits(); + var highBits = dateInMilis.getHighBits(); + // Encode low bits + buffer[index++] = lowBits & 0xff; + buffer[index++] = (lowBits >> 8) & 0xff; + buffer[index++] = (lowBits >> 16) & 0xff; + buffer[index++] = (lowBits >> 24) & 0xff; + // Encode high bits + buffer[index++] = highBits & 0xff; + buffer[index++] = (highBits >> 8) & 0xff; + buffer[index++] = (highBits >> 16) & 0xff; + buffer[index++] = (highBits >> 24) & 0xff; + return index; + }; + + var serializeRegExp = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_REGEXP; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + if (value.source && value.source.match(regexp) != null) { + throw Error('value ' + value.source + ' must not contain null bytes'); + } + // Adjust the index + index = index + buffer.write(value.source, index, 'utf8'); + // Write zero + buffer[index++] = 0x00; + // Write the parameters + if (value.global) buffer[index++] = 0x73; // s + if (value.ignoreCase) buffer[index++] = 0x69; // i + if (value.multiline) buffer[index++] = 0x6d; // m + // Add ending zero + buffer[index++] = 0x00; + return index; + }; + + var serializeBSONRegExp = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_REGEXP; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + + // Check the pattern for 0 bytes + if (value.pattern.match(regexp) != null) { + // The BSON spec doesn't allow keys with null bytes because keys are + // null-terminated. + throw Error( + 'pattern ' + value.pattern + ' must not contain null bytes' + ); + } + + // Adjust the index + index = index + buffer.write(value.pattern, index, 'utf8'); + // Write zero + buffer[index++] = 0x00; + // Write the options + index = + index + + buffer.write( + value.options + .split('') + .sort() + .join(''), + index, + 'utf8' + ); + // Add ending zero + buffer[index++] = 0x00; + return index; + }; + + var serializeMinMax = function(buffer, key, value, index, isArray) { + // Write the type of either min or max key + if (value === null) { + buffer[index++] = BSON.BSON_DATA_NULL; + } else if (value instanceof MinKey) { + buffer[index++] = BSON.BSON_DATA_MIN_KEY; + } else { + buffer[index++] = BSON.BSON_DATA_MAX_KEY; + } + + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + return index; + }; + + var serializeObjectId = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_OID; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + + // Write the objectId into the shared buffer + if (typeof value.id == 'string') { + buffer.write(value.id, index, 'binary'); + } else if (value.id && value.id.copy) { + value.id.copy(buffer, index, 0, 12); + } else { + throw new Error( + 'object [' + JSON.stringify(value) + '] is not a valid ObjectId' + ); + } + + // Ajust index + return index + 12; + }; + + var serializeBuffer = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_BINARY; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Get size of the buffer (current write point) + var size = value.length; + // Write the size of the string to buffer + buffer[index++] = size & 0xff; + buffer[index++] = (size >> 8) & 0xff; + buffer[index++] = (size >> 16) & 0xff; + buffer[index++] = (size >> 24) & 0xff; + // Write the default subtype + buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT; + // Copy the content form the binary field to the buffer + value.copy(buffer, index, 0, size); + // Adjust the index + index = index + size; + return index; + }; + + var serializeObject = function( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + isArray, + path + ) { + for (var i = 0; i < path.length; i++) { + if (path[i] === value) throw new Error('cyclic dependency detected'); + } + + // Push value to stack + path.push(value); + // Write the type + buffer[index++] = Array.isArray(value) + ? BSON.BSON_DATA_ARRAY + : BSON.BSON_DATA_OBJECT; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + var endIndex = serializeInto( + buffer, + value, + checkKeys, + index, + depth + 1, + serializeFunctions, + ignoreUndefined, + path + ); + // Pop stack + path.pop(); + // Write size + var size = endIndex - index; + return endIndex; + }; + + var serializeDecimal128 = function(buffer, key, value, index, isArray) { + buffer[index++] = BSON.BSON_DATA_DECIMAL128; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write the data from the value + value.bytes.copy(buffer, index, 0, 16); + return index + 16; + }; + + var serializeLong = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = + value._bsontype == 'Long' + ? BSON.BSON_DATA_LONG + : BSON.BSON_DATA_TIMESTAMP; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write the date + var lowBits = value.getLowBits(); + var highBits = value.getHighBits(); + // Encode low bits + buffer[index++] = lowBits & 0xff; + buffer[index++] = (lowBits >> 8) & 0xff; + buffer[index++] = (lowBits >> 16) & 0xff; + buffer[index++] = (lowBits >> 24) & 0xff; + // Encode high bits + buffer[index++] = highBits & 0xff; + buffer[index++] = (highBits >> 8) & 0xff; + buffer[index++] = (highBits >> 16) & 0xff; + buffer[index++] = (highBits >> 24) & 0xff; + return index; + }; + + var serializeInt32 = function(buffer, key, value, index, isArray) { + // Set int type 32 bits or less + buffer[index++] = BSON.BSON_DATA_INT; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write the int value + buffer[index++] = value & 0xff; + buffer[index++] = (value >> 8) & 0xff; + buffer[index++] = (value >> 16) & 0xff; + buffer[index++] = (value >> 24) & 0xff; + return index; + }; + + var serializeDouble = function(buffer, key, value, index, isArray) { + // Encode as double + buffer[index++] = BSON.BSON_DATA_NUMBER; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write float + writeIEEE754(buffer, value, index, 'little', 52, 8); + // Ajust index + index = index + 8; + return index; + }; + + var serializeFunction = function( + buffer, + key, + value, + index, + checkKeys, + depth, + isArray + ) { + buffer[index++] = BSON.BSON_DATA_CODE; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Function string + var functionString = value.toString(); + // Write the string + var size = buffer.write(functionString, index + 4, 'utf8') + 1; + // Write the size of the string to buffer + buffer[index] = size & 0xff; + buffer[index + 1] = (size >> 8) & 0xff; + buffer[index + 2] = (size >> 16) & 0xff; + buffer[index + 3] = (size >> 24) & 0xff; + // Update index + index = index + 4 + size - 1; + // Write zero + buffer[index++] = 0; + return index; + }; + + var serializeCode = function( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + isArray + ) { + if (value.scope && typeof value.scope == 'object') { + // Write the type + buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + + // Starting index + var startIndex = index; + + // Serialize the function + // Get the function string + var functionString = + typeof value.code == 'string' ? value.code : value.code.toString(); + // Index adjustment + index = index + 4; + // Write string into buffer + var codeSize = buffer.write(functionString, index + 4, 'utf8') + 1; + // Write the size of the string to buffer + buffer[index] = codeSize & 0xff; + buffer[index + 1] = (codeSize >> 8) & 0xff; + buffer[index + 2] = (codeSize >> 16) & 0xff; + buffer[index + 3] = (codeSize >> 24) & 0xff; + // Write end 0 + buffer[index + 4 + codeSize - 1] = 0; + // Write the + index = index + codeSize + 4; + + // + // Serialize the scope value + var endIndex = serializeInto( + buffer, + value.scope, + checkKeys, + index, + depth + 1, + serializeFunctions, + ignoreUndefined + ); + index = endIndex - 1; + + // Writ the total + var totalSize = endIndex - startIndex; + + // Write the total size of the object + buffer[startIndex++] = totalSize & 0xff; + buffer[startIndex++] = (totalSize >> 8) & 0xff; + buffer[startIndex++] = (totalSize >> 16) & 0xff; + buffer[startIndex++] = (totalSize >> 24) & 0xff; + // Write trailing zero + buffer[index++] = 0; + } else { + buffer[index++] = BSON.BSON_DATA_CODE; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Function string + var functionString = value.code.toString(); + // Write the string + var size = buffer.write(functionString, index + 4, 'utf8') + 1; + // Write the size of the string to buffer + buffer[index] = size & 0xff; + buffer[index + 1] = (size >> 8) & 0xff; + buffer[index + 2] = (size >> 16) & 0xff; + buffer[index + 3] = (size >> 24) & 0xff; + // Update index + index = index + 4 + size - 1; + // Write zero + buffer[index++] = 0; + } + + return index; + }; + + var serializeBinary = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_BINARY; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Extract the buffer + var data = value.value(true); + // Calculate size + var size = value.position; + // Add the deprecated 02 type 4 bytes of size to total + if (value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) size = size + 4; + // Write the size of the string to buffer + buffer[index++] = size & 0xff; + buffer[index++] = (size >> 8) & 0xff; + buffer[index++] = (size >> 16) & 0xff; + buffer[index++] = (size >> 24) & 0xff; + // Write the subtype to the buffer + buffer[index++] = value.sub_type; + + // If we have binary type 2 the 4 first bytes are the size + if (value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { + size = size - 4; + buffer[index++] = size & 0xff; + buffer[index++] = (size >> 8) & 0xff; + buffer[index++] = (size >> 16) & 0xff; + buffer[index++] = (size >> 24) & 0xff; + } + + // Write the data to the object + data.copy(buffer, index, 0, value.position); + // Adjust the index + index = index + value.position; + return index; + }; + + var serializeSymbol = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_SYMBOL; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write the string + var size = buffer.write(value.value, index + 4, 'utf8') + 1; + // Write the size of the string to buffer + buffer[index] = size & 0xff; + buffer[index + 1] = (size >> 8) & 0xff; + buffer[index + 2] = (size >> 16) & 0xff; + buffer[index + 3] = (size >> 24) & 0xff; + // Update index + index = index + 4 + size - 1; + // Write zero + buffer[index++] = 0x00; + return index; + }; + + var serializeDBRef = function( + buffer, + key, + value, + index, + depth, + serializeFunctions, + isArray + ) { + // Write the type + buffer[index++] = BSON.BSON_DATA_OBJECT; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + + var startIndex = index; + var endIndex; + + // Serialize object + if (null != value.db) { + endIndex = serializeInto( + buffer, + { + $ref: value.namespace, + $id: value.oid, + $db: value.db + }, + false, + index, + depth + 1, + serializeFunctions + ); + } else { + endIndex = serializeInto( + buffer, + { + $ref: value.namespace, + $id: value.oid + }, + false, + index, + depth + 1, + serializeFunctions + ); + } + + // Calculate object size + var size = endIndex - startIndex; + // Write the size + buffer[startIndex++] = size & 0xff; + buffer[startIndex++] = (size >> 8) & 0xff; + buffer[startIndex++] = (size >> 16) & 0xff; + buffer[startIndex++] = (size >> 24) & 0xff; + // Set index + return endIndex; + }; + + var serializeInto = function serializeInto( + buffer, + object, + checkKeys, + startingIndex, + depth, + serializeFunctions, + ignoreUndefined, + path + ) { + startingIndex = startingIndex || 0; + path = path || []; + + // Push the object to the path + path.push(object); + + // Start place to serialize into + var index = startingIndex + 4; + var self = this; + + // Special case isArray + if (Array.isArray(object)) { + // Get object keys + for (var i = 0; i < object.length; i++) { + var key = '' + i; + var value = object[i]; + + // Is there an override value + if (value && value.toBSON) { + if (typeof value.toBSON != 'function') + throw new Error('toBSON is not a function'); + value = value.toBSON(); + } + + var type = typeof value; + if (type == 'string') { + index = serializeString(buffer, key, value, index, true); + } else if (type == 'number') { + index = serializeNumber(buffer, key, value, index, true); + } else if (type == 'boolean') { + index = serializeBoolean(buffer, key, value, index, true); + } else if (value instanceof Date || isDate(value)) { + index = serializeDate(buffer, key, value, index, true); + } else if (value === undefined) { + index = serializeNull(buffer, key, value, index, true); + } else if (value === null) { + index = serializeNull(buffer, key, value, index, true); + } else if (value['_bsontype'] == 'ObjectID') { + index = serializeObjectId(buffer, key, value, index, true); + } else if (Buffer.isBuffer(value)) { + index = serializeBuffer(buffer, key, value, index, true); + } else if (value instanceof RegExp || isRegExp(value)) { + index = serializeRegExp(buffer, key, value, index, true); + } else if (type == 'object' && value['_bsontype'] == null) { + index = serializeObject( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + true, + path + ); + } else if (type == 'object' && value['_bsontype'] == 'Decimal128') { + index = serializeDecimal128(buffer, key, value, index, true); + } else if ( + value['_bsontype'] == 'Long' || + value['_bsontype'] == 'Timestamp' + ) { + index = serializeLong(buffer, key, value, index, true); + } else if (value['_bsontype'] == 'Double') { + index = serializeDouble(buffer, key, value, index, true); + } else if (typeof value == 'function' && serializeFunctions) { + index = serializeFunction( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + true + ); + } else if (value['_bsontype'] == 'Code') { + index = serializeCode( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + true + ); + } else if (value['_bsontype'] == 'Binary') { + index = serializeBinary(buffer, key, value, index, true); + } else if (value['_bsontype'] == 'Symbol') { + index = serializeSymbol(buffer, key, value, index, true); + } else if (value['_bsontype'] == 'DBRef') { + index = serializeDBRef( + buffer, + key, + value, + index, + depth, + serializeFunctions, + true + ); + } else if (value['_bsontype'] == 'BSONRegExp') { + index = serializeBSONRegExp(buffer, key, value, index, true); + } else if (value['_bsontype'] == 'Int32') { + index = serializeInt32(buffer, key, value, index, true); + } else if ( + value['_bsontype'] == 'MinKey' || + value['_bsontype'] == 'MaxKey' + ) { + index = serializeMinMax(buffer, key, value, index, true); + } + } + } else if (object instanceof Map) { + var iterator = object.entries(); + var done = false; + + while (!done) { + // Unpack the next entry + var entry = iterator.next(); + done = entry.done; + // Are we done, then skip and terminate + if (done) continue; + + // Get the entry values + var key = entry.value[0]; + var value = entry.value[1]; + + // Check the type of the value + var type = typeof value; + + // Check the key and throw error if it's illegal + if (key != '$db' && key != '$ref' && key != '$id') { + if (key.match(regexp) != null) { + // The BSON spec doesn't allow keys with null bytes because keys are + // null-terminated. + throw Error('key ' + key + ' must not contain null bytes'); + } + + if (checkKeys) { + if ('$' == key[0]) { + throw Error('key ' + key + " must not start with '$'"); + } else if (!!~key.indexOf('.')) { + throw Error('key ' + key + " must not contain '.'"); + } + } + } + + if (type == 'string') { + index = serializeString(buffer, key, value, index); + } else if (type == 'number') { + index = serializeNumber(buffer, key, value, index); + } else if (type == 'boolean') { + index = serializeBoolean(buffer, key, value, index); + } else if (value instanceof Date || isDate(value)) { + index = serializeDate(buffer, key, value, index); + } else if (value === undefined && ignoreUndefined == true) { + } else if (value === null || value === undefined) { + index = serializeNull(buffer, key, value, index); + } else if (value['_bsontype'] == 'ObjectID') { + index = serializeObjectId(buffer, key, value, index); + } else if (Buffer.isBuffer(value)) { + index = serializeBuffer(buffer, key, value, index); + } else if (value instanceof RegExp || isRegExp(value)) { + index = serializeRegExp(buffer, key, value, index); + } else if (type == 'object' && value['_bsontype'] == null) { + index = serializeObject( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + false, + path + ); + } else if (type == 'object' && value['_bsontype'] == 'Decimal128') { + index = serializeDecimal128(buffer, key, value, index); + } else if ( + value['_bsontype'] == 'Long' || + value['_bsontype'] == 'Timestamp' + ) { + index = serializeLong(buffer, key, value, index); + } else if (value['_bsontype'] == 'Double') { + index = serializeDouble(buffer, key, value, index); + } else if (value['_bsontype'] == 'Code') { + index = serializeCode( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined + ); + } else if (typeof value == 'function' && serializeFunctions) { + index = serializeFunction( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions + ); + } else if (value['_bsontype'] == 'Binary') { + index = serializeBinary(buffer, key, value, index); + } else if (value['_bsontype'] == 'Symbol') { + index = serializeSymbol(buffer, key, value, index); + } else if (value['_bsontype'] == 'DBRef') { + index = serializeDBRef( + buffer, + key, + value, + index, + depth, + serializeFunctions + ); + } else if (value['_bsontype'] == 'BSONRegExp') { + index = serializeBSONRegExp(buffer, key, value, index); + } else if (value['_bsontype'] == 'Int32') { + index = serializeInt32(buffer, key, value, index); + } else if ( + value['_bsontype'] == 'MinKey' || + value['_bsontype'] == 'MaxKey' + ) { + index = serializeMinMax(buffer, key, value, index); + } + } + } else { + // Did we provide a custom serialization method + if (object.toBSON) { + if (typeof object.toBSON != 'function') + throw new Error('toBSON is not a function'); + object = object.toBSON(); + if (object != null && typeof object != 'object') + throw new Error('toBSON function did not return an object'); + } + + // Iterate over all the keys + for (var key in object) { + var value = object[key]; + // Is there an override value + if (value && value.toBSON) { + if (typeof value.toBSON != 'function') + throw new Error('toBSON is not a function'); + value = value.toBSON(); + } + + // Check the type of the value + var type = typeof value; + + // Check the key and throw error if it's illegal + if (key != '$db' && key != '$ref' && key != '$id') { + if (key.match(regexp) != null) { + // The BSON spec doesn't allow keys with null bytes because keys are + // null-terminated. + throw Error('key ' + key + ' must not contain null bytes'); + } + + if (checkKeys) { + if ('$' == key[0]) { + throw Error('key ' + key + " must not start with '$'"); + } else if (!!~key.indexOf('.')) { + throw Error('key ' + key + " must not contain '.'"); + } + } + } + + if (type == 'string') { + index = serializeString(buffer, key, value, index); + } else if (type == 'number') { + index = serializeNumber(buffer, key, value, index); + } else if (type == 'boolean') { + index = serializeBoolean(buffer, key, value, index); + } else if (value instanceof Date || isDate(value)) { + index = serializeDate(buffer, key, value, index); + } else if (value === undefined && ignoreUndefined == true) { + } else if (value === null || value === undefined) { + index = serializeNull(buffer, key, value, index); + } else if (value['_bsontype'] == 'ObjectID') { + index = serializeObjectId(buffer, key, value, index); + } else if (Buffer.isBuffer(value)) { + index = serializeBuffer(buffer, key, value, index); + } else if (value instanceof RegExp || isRegExp(value)) { + index = serializeRegExp(buffer, key, value, index); + } else if (type == 'object' && value['_bsontype'] == null) { + index = serializeObject( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + false, + path + ); + } else if (type == 'object' && value['_bsontype'] == 'Decimal128') { + index = serializeDecimal128(buffer, key, value, index); + } else if ( + value['_bsontype'] == 'Long' || + value['_bsontype'] == 'Timestamp' + ) { + index = serializeLong(buffer, key, value, index); + } else if (value['_bsontype'] == 'Double') { + index = serializeDouble(buffer, key, value, index); + } else if (value['_bsontype'] == 'Code') { + index = serializeCode( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined + ); + } else if (typeof value == 'function' && serializeFunctions) { + index = serializeFunction( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions + ); + } else if (value['_bsontype'] == 'Binary') { + index = serializeBinary(buffer, key, value, index); + } else if (value['_bsontype'] == 'Symbol') { + index = serializeSymbol(buffer, key, value, index); + } else if (value['_bsontype'] == 'DBRef') { + index = serializeDBRef( + buffer, + key, + value, + index, + depth, + serializeFunctions + ); + } else if (value['_bsontype'] == 'BSONRegExp') { + index = serializeBSONRegExp(buffer, key, value, index); + } else if (value['_bsontype'] == 'Int32') { + index = serializeInt32(buffer, key, value, index); + } else if ( + value['_bsontype'] == 'MinKey' || + value['_bsontype'] == 'MaxKey' + ) { + index = serializeMinMax(buffer, key, value, index); + } + } + } + + // Remove the path + path.pop(); + + // Final padding byte for object + buffer[index++] = 0x00; + + // Final size + var size = index - startingIndex; + // Write the size of the object + buffer[startingIndex++] = size & 0xff; + buffer[startingIndex++] = (size >> 8) & 0xff; + buffer[startingIndex++] = (size >> 16) & 0xff; + buffer[startingIndex++] = (size >> 24) & 0xff; + return index; + }; + + var BSON = {}; + + /** + * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 + * + * @ignore + * @api private + */ + var functionCache = (BSON.functionCache = {}); + + /** + * Number BSON Type + * + * @classconstant BSON_DATA_NUMBER + **/ + BSON.BSON_DATA_NUMBER = 1; + /** + * String BSON Type + * + * @classconstant BSON_DATA_STRING + **/ + BSON.BSON_DATA_STRING = 2; + /** + * Object BSON Type + * + * @classconstant BSON_DATA_OBJECT + **/ + BSON.BSON_DATA_OBJECT = 3; + /** + * Array BSON Type + * + * @classconstant BSON_DATA_ARRAY + **/ + BSON.BSON_DATA_ARRAY = 4; + /** + * Binary BSON Type + * + * @classconstant BSON_DATA_BINARY + **/ + BSON.BSON_DATA_BINARY = 5; + /** + * ObjectID BSON Type, deprecated + * + * @classconstant BSON_DATA_UNDEFINED + **/ + BSON.BSON_DATA_UNDEFINED = 6; + /** + * ObjectID BSON Type + * + * @classconstant BSON_DATA_OID + **/ + BSON.BSON_DATA_OID = 7; + /** + * Boolean BSON Type + * + * @classconstant BSON_DATA_BOOLEAN + **/ + BSON.BSON_DATA_BOOLEAN = 8; + /** + * Date BSON Type + * + * @classconstant BSON_DATA_DATE + **/ + BSON.BSON_DATA_DATE = 9; + /** + * null BSON Type + * + * @classconstant BSON_DATA_NULL + **/ + BSON.BSON_DATA_NULL = 10; + /** + * RegExp BSON Type + * + * @classconstant BSON_DATA_REGEXP + **/ + BSON.BSON_DATA_REGEXP = 11; + /** + * Code BSON Type + * + * @classconstant BSON_DATA_CODE + **/ + BSON.BSON_DATA_CODE = 13; + /** + * Symbol BSON Type + * + * @classconstant BSON_DATA_SYMBOL + **/ + BSON.BSON_DATA_SYMBOL = 14; + /** + * Code with Scope BSON Type + * + * @classconstant BSON_DATA_CODE_W_SCOPE + **/ + BSON.BSON_DATA_CODE_W_SCOPE = 15; + /** + * 32 bit Integer BSON Type + * + * @classconstant BSON_DATA_INT + **/ + BSON.BSON_DATA_INT = 16; + /** + * Timestamp BSON Type + * + * @classconstant BSON_DATA_TIMESTAMP + **/ + BSON.BSON_DATA_TIMESTAMP = 17; + /** + * Long BSON Type + * + * @classconstant BSON_DATA_LONG + **/ + BSON.BSON_DATA_LONG = 18; + /** + * Long BSON Type + * + * @classconstant BSON_DATA_DECIMAL128 + **/ + BSON.BSON_DATA_DECIMAL128 = 19; + /** + * MinKey BSON Type + * + * @classconstant BSON_DATA_MIN_KEY + **/ + BSON.BSON_DATA_MIN_KEY = 0xff; + /** + * MaxKey BSON Type + * + * @classconstant BSON_DATA_MAX_KEY + **/ + BSON.BSON_DATA_MAX_KEY = 0x7f; + /** + * Binary Default Type + * + * @classconstant BSON_BINARY_SUBTYPE_DEFAULT + **/ + BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; + /** + * Binary Function Type + * + * @classconstant BSON_BINARY_SUBTYPE_FUNCTION + **/ + BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; + /** + * Binary Byte Array Type + * + * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY + **/ + BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; + /** + * Binary UUID Type + * + * @classconstant BSON_BINARY_SUBTYPE_UUID + **/ + BSON.BSON_BINARY_SUBTYPE_UUID = 3; + /** + * Binary MD5 Type + * + * @classconstant BSON_BINARY_SUBTYPE_MD5 + **/ + BSON.BSON_BINARY_SUBTYPE_MD5 = 4; + /** + * Binary User Defined Type + * + * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED + **/ + BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; + + // BSON MAX VALUES + BSON.BSON_INT32_MAX = 0x7fffffff; + BSON.BSON_INT32_MIN = -0x80000000; + + BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; + BSON.BSON_INT64_MIN = -Math.pow(2, 63); + + // JS MAX PRECISE VALUES + BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. + BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. + + // Internal long versions + var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. + var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. + + module.exports = serializeInto; + /* WEBPACK VAR INJECTION */ + }.call(exports, __webpack_require__(300).Buffer)); + + /***/ + }, + /* 324 */ + /***/ function(module, exports, __webpack_require__) { + /* WEBPACK VAR INJECTION */ (function(Buffer) { + 'use strict'; + + var writeIEEE754 = __webpack_require__(304).writeIEEE754, + readIEEE754 = __webpack_require__(304).readIEEE754, + Long = __webpack_require__(306).Long, + Double = __webpack_require__(307).Double, + Timestamp = __webpack_require__(308).Timestamp, + ObjectID = __webpack_require__(309).ObjectID, + Symbol = __webpack_require__(311).Symbol, + BSONRegExp = __webpack_require__(310).BSONRegExp, + Code = __webpack_require__(313).Code, + Decimal128 = __webpack_require__(314), + MinKey = __webpack_require__(315).MinKey, + MaxKey = __webpack_require__(316).MaxKey, + DBRef = __webpack_require__(317).DBRef, + Binary = __webpack_require__(318).Binary; + + // To ensure that 0.4 of node works correctly + var isDate = function isDate(d) { + return ( + typeof d === 'object' && + Object.prototype.toString.call(d) === '[object Date]' + ); + }; + + var calculateObjectSize = function calculateObjectSize( + object, + serializeFunctions, + ignoreUndefined + ) { + var totalLength = 4 + 1; + + if (Array.isArray(object)) { + for (var i = 0; i < object.length; i++) { + totalLength += calculateElement( + i.toString(), + object[i], + serializeFunctions, + true, + ignoreUndefined + ); + } + } else { + // If we have toBSON defined, override the current object + if (object.toBSON) { + object = object.toBSON(); + } + + // Calculate size + for (var key in object) { + totalLength += calculateElement( + key, + object[key], + serializeFunctions, + false, + ignoreUndefined + ); + } + } + + return totalLength; + }; + + /** + * @ignore + * @api private + */ + function calculateElement( + name, + value, + serializeFunctions, + isArray, + ignoreUndefined + ) { + // If we have toBSON defined, override the current object + if (value && value.toBSON) { + value = value.toBSON(); + } + + switch (typeof value) { + case 'string': + return ( + 1 + + Buffer.byteLength(name, 'utf8') + + 1 + + 4 + + Buffer.byteLength(value, 'utf8') + + 1 + ); + case 'number': + if ( + Math.floor(value) === value && + value >= BSON.JS_INT_MIN && + value <= BSON.JS_INT_MAX + ) { + if ( + value >= BSON.BSON_INT32_MIN && + value <= BSON.BSON_INT32_MAX + ) { + // 32 bit + return ( + (name != null + ? Buffer.byteLength(name, 'utf8') + 1 + : 0) + + (4 + 1) + ); + } else { + return ( + (name != null + ? Buffer.byteLength(name, 'utf8') + 1 + : 0) + + (8 + 1) + ); + } + } else { + // 64 bit + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + (8 + 1) + ); + } + case 'undefined': + if (isArray || !ignoreUndefined) + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + ); + return 0; + case 'boolean': + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + (1 + 1) + ); + case 'object': + if ( + value == null || + value instanceof MinKey || + value instanceof MaxKey || + value['_bsontype'] == 'MinKey' || + value['_bsontype'] == 'MaxKey' + ) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1 + ); + } else if ( + value instanceof ObjectID || + value['_bsontype'] == 'ObjectID' + ) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + (12 + 1) + ); + } else if (value instanceof Date || isDate(value)) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + (8 + 1) + ); + } else if ( + typeof Buffer !== 'undefined' && + Buffer.isBuffer(value) + ) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + (1 + 4 + 1) + + value.length + ); + } else if ( + value instanceof Long || + value instanceof Double || + value instanceof Timestamp || + value['_bsontype'] == 'Long' || + value['_bsontype'] == 'Double' || + value['_bsontype'] == 'Timestamp' + ) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + (8 + 1) + ); + } else if ( + value instanceof Decimal128 || + value['_bsontype'] == 'Decimal128' + ) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + (16 + 1) + ); + } else if (value instanceof Code || value['_bsontype'] == 'Code') { + // Calculate size depending on the availability of a scope + if ( + value.scope != null && + Object.keys(value.scope).length > 0 + ) { + return ( + (name != null + ? Buffer.byteLength(name, 'utf8') + 1 + : 0) + + 1 + + 4 + + 4 + + Buffer.byteLength(value.code.toString(), 'utf8') + + 1 + + calculateObjectSize( + value.scope, + serializeFunctions, + ignoreUndefined + ) + ); + } else { + return ( + (name != null + ? Buffer.byteLength(name, 'utf8') + 1 + : 0) + + 1 + + 4 + + Buffer.byteLength(value.code.toString(), 'utf8') + + 1 + ); + } + } else if ( + value instanceof Binary || + value['_bsontype'] == 'Binary' + ) { + // Check what kind of subtype we have + if (value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { + return ( + (name != null + ? Buffer.byteLength(name, 'utf8') + 1 + : 0) + + (value.position + 1 + 4 + 1 + 4) + ); + } else { + return ( + (name != null + ? Buffer.byteLength(name, 'utf8') + 1 + : 0) + + (value.position + 1 + 4 + 1) + ); + } + } else if ( + value instanceof Symbol || + value['_bsontype'] == 'Symbol' + ) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + Buffer.byteLength(value.value, 'utf8') + + 4 + + 1 + + 1 + ); + } else if ( + value instanceof DBRef || + value['_bsontype'] == 'DBRef' + ) { + // Set up correct object for serialization + var ordered_values = { + $ref: value.namespace, + $id: value.oid + }; + + // Add db reference if it exists + if (null != value.db) { + ordered_values['$db'] = value.db; + } + + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + calculateObjectSize( + ordered_values, + serializeFunctions, + ignoreUndefined + ) + ); + } else if ( + value instanceof RegExp || + Object.prototype.toString.call(value) === '[object RegExp]' + ) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + Buffer.byteLength(value.source, 'utf8') + + 1 + + (value.global ? 1 : 0) + + (value.ignoreCase ? 1 : 0) + + (value.multiline ? 1 : 0) + + 1 + ); + } else if ( + value instanceof BSONRegExp || + value['_bsontype'] == 'BSONRegExp' + ) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + Buffer.byteLength(value.pattern, 'utf8') + + 1 + + Buffer.byteLength(value.options, 'utf8') + + 1 + ); + } else { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + calculateObjectSize( + value, + serializeFunctions, + ignoreUndefined + ) + + 1 + ); + } + case 'function': + // WTF for 0.4.X where typeof /someregexp/ === 'function' + if ( + value instanceof RegExp || + Object.prototype.toString.call(value) === '[object RegExp]' || + String.call(value) == '[object RegExp]' + ) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + Buffer.byteLength(value.source, 'utf8') + + 1 + + (value.global ? 1 : 0) + + (value.ignoreCase ? 1 : 0) + + (value.multiline ? 1 : 0) + + 1 + ); + } else { + if ( + serializeFunctions && + value.scope != null && + Object.keys(value.scope).length > 0 + ) { + return ( + (name != null + ? Buffer.byteLength(name, 'utf8') + 1 + : 0) + + 1 + + 4 + + 4 + + Buffer.byteLength(value.toString(), 'utf8') + + 1 + + calculateObjectSize( + value.scope, + serializeFunctions, + ignoreUndefined + ) + ); + } else if (serializeFunctions) { + return ( + (name != null + ? Buffer.byteLength(name, 'utf8') + 1 + : 0) + + 1 + + 4 + + Buffer.byteLength(value.toString(), 'utf8') + + 1 + ); + } + } + } + + return 0; + } + + var BSON = {}; + + // BSON MAX VALUES + BSON.BSON_INT32_MAX = 0x7fffffff; + BSON.BSON_INT32_MIN = -0x80000000; + + // JS MAX PRECISE VALUES + BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. + BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. + + module.exports = calculateObjectSize; + /* WEBPACK VAR INJECTION */ + }.call(exports, __webpack_require__(300).Buffer)); + + /***/ + } + /******/ + ] + ); +}); diff --git a/node_modules/bson/browser_build/package.json b/node_modules/bson/browser_build/package.json new file mode 100644 index 0000000..980db7f --- /dev/null +++ b/node_modules/bson/browser_build/package.json @@ -0,0 +1,8 @@ +{ "name" : "bson" +, "description" : "A bson parser for node.js and the browser" +, "main": "../" +, "directories" : { "lib" : "../lib/bson" } +, "engines" : { "node" : ">=0.6.0" } +, "licenses" : [ { "type" : "Apache License, Version 2.0" + , "url" : "http://www.apache.org/licenses/LICENSE-2.0" } ] +} diff --git a/node_modules/bson/index.js b/node_modules/bson/index.js new file mode 100644 index 0000000..6502552 --- /dev/null +++ b/node_modules/bson/index.js @@ -0,0 +1,46 @@ +var BSON = require('./lib/bson/bson'), + Binary = require('./lib/bson/binary'), + Code = require('./lib/bson/code'), + DBRef = require('./lib/bson/db_ref'), + Decimal128 = require('./lib/bson/decimal128'), + Double = require('./lib/bson/double'), + Int32 = require('./lib/bson/int_32'), + Long = require('./lib/bson/long'), + Map = require('./lib/bson/map'), + MaxKey = require('./lib/bson/max_key'), + MinKey = require('./lib/bson/min_key'), + ObjectId = require('./lib/bson/objectid'), + BSONRegExp = require('./lib/bson/regexp'), + Symbol = require('./lib/bson/symbol'), + Timestamp = require('./lib/bson/timestamp'); + +// BSON MAX VALUES +BSON.BSON_INT32_MAX = 0x7fffffff; +BSON.BSON_INT32_MIN = -0x80000000; + +BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; +BSON.BSON_INT64_MIN = -Math.pow(2, 63); + +// JS MAX PRECISE VALUES +BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. +BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. + +// Add BSON types to function creation +BSON.Binary = Binary; +BSON.Code = Code; +BSON.DBRef = DBRef; +BSON.Decimal128 = Decimal128; +BSON.Double = Double; +BSON.Int32 = Int32; +BSON.Long = Long; +BSON.Map = Map; +BSON.MaxKey = MaxKey; +BSON.MinKey = MinKey; +BSON.ObjectId = ObjectId; +BSON.ObjectID = ObjectId; +BSON.BSONRegExp = BSONRegExp; +BSON.Symbol = Symbol; +BSON.Timestamp = Timestamp; + +// Return the BSON +module.exports = BSON; diff --git a/node_modules/bson/lib/bson/binary.js b/node_modules/bson/lib/bson/binary.js new file mode 100644 index 0000000..279423e --- /dev/null +++ b/node_modules/bson/lib/bson/binary.js @@ -0,0 +1,372 @@ +/** + * Module dependencies. + * @ignore + */ + +// Test if we're in Node via presence of "global" not absence of "window" +// to support hybrid environments like Electron +if (typeof global !== 'undefined') { + var Buffer = require('buffer').Buffer; // TODO just use global Buffer +} + +/** + * A class representation of the BSON Binary type. + * + * Sub types + * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type. + * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type. + * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type. + * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type. + * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type. + * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type. + * + * @class + * @param {Buffer} buffer a buffer object containing the binary data. + * @param {Number} [subType] the option binary type. + * @return {Binary} + */ +function Binary(buffer, subType) { + if (!(this instanceof Binary)) return new Binary(buffer, subType); + + this._bsontype = 'Binary'; + + if (buffer instanceof Number) { + this.sub_type = buffer; + this.position = 0; + } else { + this.sub_type = subType == null ? BSON_BINARY_SUBTYPE_DEFAULT : subType; + this.position = 0; + } + + if (buffer != null && !(buffer instanceof Number)) { + // Only accept Buffer, Uint8Array or Arrays + if (typeof buffer === 'string') { + // Different ways of writing the length of the string for the different types + if (typeof Buffer !== 'undefined') { + this.buffer = new Buffer(buffer); + } else if ( + typeof Uint8Array !== 'undefined' || + Object.prototype.toString.call(buffer) === '[object Array]' + ) { + this.buffer = writeStringToArray(buffer); + } else { + throw new Error('only String, Buffer, Uint8Array or Array accepted'); + } + } else { + this.buffer = buffer; + } + this.position = buffer.length; + } else { + if (typeof Buffer !== 'undefined') { + this.buffer = new Buffer(Binary.BUFFER_SIZE); + } else if (typeof Uint8Array !== 'undefined') { + this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE)); + } else { + this.buffer = new Array(Binary.BUFFER_SIZE); + } + // Set position to start of buffer + this.position = 0; + } +} + +/** + * Updates this binary with byte_value. + * + * @method + * @param {string} byte_value a single byte we wish to write. + */ +Binary.prototype.put = function put(byte_value) { + // If it's a string and a has more than one character throw an error + if (byte_value['length'] != null && typeof byte_value !== 'number' && byte_value.length !== 1) + throw new Error('only accepts single character String, Uint8Array or Array'); + if ((typeof byte_value !== 'number' && byte_value < 0) || byte_value > 255) + throw new Error('only accepts number in a valid unsigned byte range 0-255'); + + // Decode the byte value once + var decoded_byte = null; + if (typeof byte_value === 'string') { + decoded_byte = byte_value.charCodeAt(0); + } else if (byte_value['length'] != null) { + decoded_byte = byte_value[0]; + } else { + decoded_byte = byte_value; + } + + if (this.buffer.length > this.position) { + this.buffer[this.position++] = decoded_byte; + } else { + if (typeof Buffer !== 'undefined' && Buffer.isBuffer(this.buffer)) { + // Create additional overflow buffer + var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length); + // Combine the two buffers together + this.buffer.copy(buffer, 0, 0, this.buffer.length); + this.buffer = buffer; + this.buffer[this.position++] = decoded_byte; + } else { + buffer = null; + // Create a new buffer (typed or normal array) + if (Object.prototype.toString.call(this.buffer) === '[object Uint8Array]') { + buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE + this.buffer.length)); + } else { + buffer = new Array(Binary.BUFFER_SIZE + this.buffer.length); + } + + // We need to copy all the content to the new array + for (var i = 0; i < this.buffer.length; i++) { + buffer[i] = this.buffer[i]; + } + + // Reassign the buffer + this.buffer = buffer; + // Write the byte + this.buffer[this.position++] = decoded_byte; + } + } +}; + +/** + * Writes a buffer or string to the binary. + * + * @method + * @param {(Buffer|string)} string a string or buffer to be written to the Binary BSON object. + * @param {number} offset specify the binary of where to write the content. + * @return {null} + */ +Binary.prototype.write = function write(string, offset) { + offset = typeof offset === 'number' ? offset : this.position; + + // If the buffer is to small let's extend the buffer + if (this.buffer.length < offset + string.length) { + var buffer = null; + // If we are in node.js + if (typeof Buffer !== 'undefined' && Buffer.isBuffer(this.buffer)) { + buffer = new Buffer(this.buffer.length + string.length); + this.buffer.copy(buffer, 0, 0, this.buffer.length); + } else if (Object.prototype.toString.call(this.buffer) === '[object Uint8Array]') { + // Create a new buffer + buffer = new Uint8Array(new ArrayBuffer(this.buffer.length + string.length)); + // Copy the content + for (var i = 0; i < this.position; i++) { + buffer[i] = this.buffer[i]; + } + } + + // Assign the new buffer + this.buffer = buffer; + } + + if (typeof Buffer !== 'undefined' && Buffer.isBuffer(string) && Buffer.isBuffer(this.buffer)) { + string.copy(this.buffer, offset, 0, string.length); + this.position = offset + string.length > this.position ? offset + string.length : this.position; + // offset = string.length + } else if ( + typeof Buffer !== 'undefined' && + typeof string === 'string' && + Buffer.isBuffer(this.buffer) + ) { + this.buffer.write(string, offset, 'binary'); + this.position = offset + string.length > this.position ? offset + string.length : this.position; + // offset = string.length; + } else if ( + Object.prototype.toString.call(string) === '[object Uint8Array]' || + (Object.prototype.toString.call(string) === '[object Array]' && typeof string !== 'string') + ) { + for (i = 0; i < string.length; i++) { + this.buffer[offset++] = string[i]; + } + + this.position = offset > this.position ? offset : this.position; + } else if (typeof string === 'string') { + for (i = 0; i < string.length; i++) { + this.buffer[offset++] = string.charCodeAt(i); + } + + this.position = offset > this.position ? offset : this.position; + } +}; + +/** + * Reads **length** bytes starting at **position**. + * + * @method + * @param {number} position read from the given position in the Binary. + * @param {number} length the number of bytes to read. + * @return {Buffer} + */ +Binary.prototype.read = function read(position, length) { + length = length && length > 0 ? length : this.position; + + // Let's return the data based on the type we have + if (this.buffer['slice']) { + return this.buffer.slice(position, position + length); + } else { + // Create a buffer to keep the result + var buffer = + typeof Uint8Array !== 'undefined' + ? new Uint8Array(new ArrayBuffer(length)) + : new Array(length); + for (var i = 0; i < length; i++) { + buffer[i] = this.buffer[position++]; + } + } + // Return the buffer + return buffer; +}; + +/** + * Returns the value of this binary as a string. + * + * @method + * @return {string} + */ +Binary.prototype.value = function value(asRaw) { + asRaw = asRaw == null ? false : asRaw; + + // Optimize to serialize for the situation where the data == size of buffer + if ( + asRaw && + typeof Buffer !== 'undefined' && + Buffer.isBuffer(this.buffer) && + this.buffer.length === this.position + ) + return this.buffer; + + // If it's a node.js buffer object + if (typeof Buffer !== 'undefined' && Buffer.isBuffer(this.buffer)) { + return asRaw + ? this.buffer.slice(0, this.position) + : this.buffer.toString('binary', 0, this.position); + } else { + if (asRaw) { + // we support the slice command use it + if (this.buffer['slice'] != null) { + return this.buffer.slice(0, this.position); + } else { + // Create a new buffer to copy content to + var newBuffer = + Object.prototype.toString.call(this.buffer) === '[object Uint8Array]' + ? new Uint8Array(new ArrayBuffer(this.position)) + : new Array(this.position); + // Copy content + for (var i = 0; i < this.position; i++) { + newBuffer[i] = this.buffer[i]; + } + // Return the buffer + return newBuffer; + } + } else { + return convertArraytoUtf8BinaryString(this.buffer, 0, this.position); + } + } +}; + +/** + * Length. + * + * @method + * @return {number} the length of the binary. + */ +Binary.prototype.length = function length() { + return this.position; +}; + +/** + * @ignore + */ +Binary.prototype.toJSON = function() { + return this.buffer != null ? this.buffer.toString('base64') : ''; +}; + +/** + * @ignore + */ +Binary.prototype.toString = function(format) { + return this.buffer != null ? this.buffer.slice(0, this.position).toString(format) : ''; +}; + +/** + * Binary default subtype + * @ignore + */ +var BSON_BINARY_SUBTYPE_DEFAULT = 0; + +/** + * @ignore + */ +var writeStringToArray = function(data) { + // Create a buffer + var buffer = + typeof Uint8Array !== 'undefined' + ? new Uint8Array(new ArrayBuffer(data.length)) + : new Array(data.length); + // Write the content to the buffer + for (var i = 0; i < data.length; i++) { + buffer[i] = data.charCodeAt(i); + } + // Write the string to the buffer + return buffer; +}; + +/** + * Convert Array ot Uint8Array to Binary String + * + * @ignore + */ +var convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) { + var result = ''; + for (var i = startIndex; i < endIndex; i++) { + result = result + String.fromCharCode(byteArray[i]); + } + return result; +}; + +Binary.BUFFER_SIZE = 256; + +/** + * Default BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ +Binary.SUBTYPE_DEFAULT = 0; +/** + * Function BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ +Binary.SUBTYPE_FUNCTION = 1; +/** + * Byte Array BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ +Binary.SUBTYPE_BYTE_ARRAY = 2; +/** + * OLD UUID BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ +Binary.SUBTYPE_UUID_OLD = 3; +/** + * UUID BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ +Binary.SUBTYPE_UUID = 4; +/** + * MD5 BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ +Binary.SUBTYPE_MD5 = 5; +/** + * User BSON type + * + * @classconstant SUBTYPE_DEFAULT + **/ +Binary.SUBTYPE_USER_DEFINED = 128; + +/** + * Expose. + */ +module.exports = Binary; +module.exports.Binary = Binary; diff --git a/node_modules/bson/lib/bson/bson.js b/node_modules/bson/lib/bson/bson.js new file mode 100644 index 0000000..a864d95 --- /dev/null +++ b/node_modules/bson/lib/bson/bson.js @@ -0,0 +1,377 @@ +'use strict'; + +var Map = require('./map'), + Long = require('./long'), + Double = require('./double'), + Timestamp = require('./timestamp'), + ObjectID = require('./objectid'), + BSONRegExp = require('./regexp'), + Symbol = require('./symbol'), + Int32 = require('./int_32'), + Code = require('./code'), + Decimal128 = require('./decimal128'), + MinKey = require('./min_key'), + MaxKey = require('./max_key'), + DBRef = require('./db_ref'), + Binary = require('./binary'); + +// Parts of the parser +var deserialize = require('./parser/deserializer'), + serializer = require('./parser/serializer'), + calculateObjectSize = require('./parser/calculate_size'); + +/** + * @ignore + * @api private + */ +// Max Size +var MAXSIZE = 1024 * 1024 * 17; +// Max Document Buffer size +var buffer = new Buffer(MAXSIZE); + +var BSON = function() {}; + +/** + * Serialize a Javascript object. + * + * @param {Object} object the Javascript object to serialize. + * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid. + * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**. + * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**. + * @return {Buffer} returns the Buffer object containing the serialized object. + * @api public + */ +BSON.prototype.serialize = function serialize(object, options) { + options = options || {}; + // Unpack the options + var checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false; + var serializeFunctions = + typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false; + var ignoreUndefined = + typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true; + + // Attempt to serialize + var serializationIndex = serializer( + buffer, + object, + checkKeys, + 0, + 0, + serializeFunctions, + ignoreUndefined, + [] + ); + // Create the final buffer + var finishedBuffer = new Buffer(serializationIndex); + // Copy into the finished buffer + buffer.copy(finishedBuffer, 0, 0, finishedBuffer.length); + // Return the buffer + return finishedBuffer; +}; + +/** + * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. + * + * @param {Object} object the Javascript object to serialize. + * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. + * @param {Boolean} [options.checkKeys] the serializer will check if keys are valid. + * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**. + * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**. + * @param {Number} [options.index] the index in the buffer where we wish to start serializing into. + * @return {Number} returns the index pointing to the last written byte in the buffer. + * @api public + */ +BSON.prototype.serializeWithBufferAndIndex = function(object, finalBuffer, options) { + options = options || {}; + // Unpack the options + var checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false; + var serializeFunctions = + typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false; + var ignoreUndefined = + typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true; + var startIndex = typeof options.index === 'number' ? options.index : 0; + + // Attempt to serialize + var serializationIndex = serializer( + buffer, + object, + checkKeys, + startIndex || 0, + 0, + serializeFunctions, + ignoreUndefined + ); + buffer.copy(finalBuffer, startIndex, 0, serializationIndex); + + // Return the index + return serializationIndex - 1; +}; + +/** + * Deserialize data as BSON. + * + * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. + * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized. + * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse. + * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function. + * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits + * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance. + * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types. + * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer. + * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances. + * @return {Object} returns the deserialized Javascript Object. + * @api public + */ +BSON.prototype.deserialize = function(buffer, options) { + return deserialize(buffer, options); +}; + +/** + * Calculate the bson size for a passed in Javascript object. + * + * @param {Object} object the Javascript object to calculate the BSON byte size for. + * @param {Boolean} [options.serializeFunctions=false] serialize the javascript functions **(default:false)**. + * @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**. + * @return {Number} returns the number of bytes the BSON object will take up. + * @api public + */ +BSON.prototype.calculateObjectSize = function(object, options) { + options = options || {}; + + var serializeFunctions = + typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false; + var ignoreUndefined = + typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true; + + return calculateObjectSize(object, serializeFunctions, ignoreUndefined); +}; + +/** + * Deserialize stream data as BSON documents. + * + * @param {Buffer} data the buffer containing the serialized set of BSON documents. + * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. + * @param {Number} numberOfDocuments number of documents to deserialize. + * @param {Array} documents an array where to store the deserialized documents. + * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. + * @param {Object} [options] additional options used for the deserialization. + * @param {Object} [options.evalFunctions=false] evaluate functions in the BSON document scoped to the object deserialized. + * @param {Object} [options.cacheFunctions=false] cache evaluated functions for reuse. + * @param {Object} [options.cacheFunctionsCrc32=false] use a crc32 code for caching, otherwise use the string of the function. + * @param {Object} [options.promoteLongs=true] when deserializing a Long will fit it into a Number if it's smaller than 53 bits + * @param {Object} [options.promoteBuffers=false] when deserializing a Binary will return it as a node.js Buffer instance. + * @param {Object} [options.promoteValues=false] when deserializing will promote BSON values to their Node.js closest equivalent types. + * @param {Object} [options.fieldsAsRaw=null] allow to specify if there what fields we wish to return as unserialized raw buffer. + * @param {Object} [options.bsonRegExp=false] return BSON regular expressions as BSONRegExp instances. + * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. + * @api public + */ +BSON.prototype.deserializeStream = function( + data, + startIndex, + numberOfDocuments, + documents, + docStartIndex, + options +) { + options = options != null ? options : {}; + var index = startIndex; + // Loop over all documents + for (var i = 0; i < numberOfDocuments; i++) { + // Find size of the document + var size = + data[index] | (data[index + 1] << 8) | (data[index + 2] << 16) | (data[index + 3] << 24); + // Update options with index + options['index'] = index; + // Parse the document at this point + documents[docStartIndex + i] = this.deserialize(data, options); + // Adjust index by the document size + index = index + size; + } + + // Return object containing end index of parsing and list of documents + return index; +}; + +/** + * @ignore + * @api private + */ +// BSON MAX VALUES +BSON.BSON_INT32_MAX = 0x7fffffff; +BSON.BSON_INT32_MIN = -0x80000000; + +BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; +BSON.BSON_INT64_MIN = -Math.pow(2, 63); + +// JS MAX PRECISE VALUES +BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. +BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. + +// Internal long versions +// var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. +// var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. + +/** + * Number BSON Type + * + * @classconstant BSON_DATA_NUMBER + **/ +BSON.BSON_DATA_NUMBER = 1; +/** + * String BSON Type + * + * @classconstant BSON_DATA_STRING + **/ +BSON.BSON_DATA_STRING = 2; +/** + * Object BSON Type + * + * @classconstant BSON_DATA_OBJECT + **/ +BSON.BSON_DATA_OBJECT = 3; +/** + * Array BSON Type + * + * @classconstant BSON_DATA_ARRAY + **/ +BSON.BSON_DATA_ARRAY = 4; +/** + * Binary BSON Type + * + * @classconstant BSON_DATA_BINARY + **/ +BSON.BSON_DATA_BINARY = 5; +/** + * ObjectID BSON Type + * + * @classconstant BSON_DATA_OID + **/ +BSON.BSON_DATA_OID = 7; +/** + * Boolean BSON Type + * + * @classconstant BSON_DATA_BOOLEAN + **/ +BSON.BSON_DATA_BOOLEAN = 8; +/** + * Date BSON Type + * + * @classconstant BSON_DATA_DATE + **/ +BSON.BSON_DATA_DATE = 9; +/** + * null BSON Type + * + * @classconstant BSON_DATA_NULL + **/ +BSON.BSON_DATA_NULL = 10; +/** + * RegExp BSON Type + * + * @classconstant BSON_DATA_REGEXP + **/ +BSON.BSON_DATA_REGEXP = 11; +/** + * Code BSON Type + * + * @classconstant BSON_DATA_CODE + **/ +BSON.BSON_DATA_CODE = 13; +/** + * Symbol BSON Type + * + * @classconstant BSON_DATA_SYMBOL + **/ +BSON.BSON_DATA_SYMBOL = 14; +/** + * Code with Scope BSON Type + * + * @classconstant BSON_DATA_CODE_W_SCOPE + **/ +BSON.BSON_DATA_CODE_W_SCOPE = 15; +/** + * 32 bit Integer BSON Type + * + * @classconstant BSON_DATA_INT + **/ +BSON.BSON_DATA_INT = 16; +/** + * Timestamp BSON Type + * + * @classconstant BSON_DATA_TIMESTAMP + **/ +BSON.BSON_DATA_TIMESTAMP = 17; +/** + * Long BSON Type + * + * @classconstant BSON_DATA_LONG + **/ +BSON.BSON_DATA_LONG = 18; +/** + * MinKey BSON Type + * + * @classconstant BSON_DATA_MIN_KEY + **/ +BSON.BSON_DATA_MIN_KEY = 0xff; +/** + * MaxKey BSON Type + * + * @classconstant BSON_DATA_MAX_KEY + **/ +BSON.BSON_DATA_MAX_KEY = 0x7f; + +/** + * Binary Default Type + * + * @classconstant BSON_BINARY_SUBTYPE_DEFAULT + **/ +BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; +/** + * Binary Function Type + * + * @classconstant BSON_BINARY_SUBTYPE_FUNCTION + **/ +BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; +/** + * Binary Byte Array Type + * + * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY + **/ +BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; +/** + * Binary UUID Type + * + * @classconstant BSON_BINARY_SUBTYPE_UUID + **/ +BSON.BSON_BINARY_SUBTYPE_UUID = 3; +/** + * Binary MD5 Type + * + * @classconstant BSON_BINARY_SUBTYPE_MD5 + **/ +BSON.BSON_BINARY_SUBTYPE_MD5 = 4; +/** + * Binary User Defined Type + * + * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED + **/ +BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; + +// Return BSON +module.exports = BSON; +module.exports.Code = Code; +module.exports.Map = Map; +module.exports.Symbol = Symbol; +module.exports.BSON = BSON; +module.exports.DBRef = DBRef; +module.exports.Binary = Binary; +module.exports.ObjectID = ObjectID; +module.exports.Long = Long; +module.exports.Timestamp = Timestamp; +module.exports.Double = Double; +module.exports.Int32 = Int32; +module.exports.MinKey = MinKey; +module.exports.MaxKey = MaxKey; +module.exports.BSONRegExp = BSONRegExp; +module.exports.Decimal128 = Decimal128; diff --git a/node_modules/bson/lib/bson/code.js b/node_modules/bson/lib/bson/code.js new file mode 100644 index 0000000..c2984cd --- /dev/null +++ b/node_modules/bson/lib/bson/code.js @@ -0,0 +1,24 @@ +/** + * A class representation of the BSON Code type. + * + * @class + * @param {(string|function)} code a string or function. + * @param {Object} [scope] an optional scope for the function. + * @return {Code} + */ +var Code = function Code(code, scope) { + if (!(this instanceof Code)) return new Code(code, scope); + this._bsontype = 'Code'; + this.code = code; + this.scope = scope; +}; + +/** + * @ignore + */ +Code.prototype.toJSON = function() { + return { scope: this.scope, code: this.code }; +}; + +module.exports = Code; +module.exports.Code = Code; diff --git a/node_modules/bson/lib/bson/db_ref.js b/node_modules/bson/lib/bson/db_ref.js new file mode 100644 index 0000000..f95795b --- /dev/null +++ b/node_modules/bson/lib/bson/db_ref.js @@ -0,0 +1,32 @@ +/** + * A class representation of the BSON DBRef type. + * + * @class + * @param {string} namespace the collection name. + * @param {ObjectID} oid the reference ObjectID. + * @param {string} [db] optional db name, if omitted the reference is local to the current db. + * @return {DBRef} + */ +function DBRef(namespace, oid, db) { + if (!(this instanceof DBRef)) return new DBRef(namespace, oid, db); + + this._bsontype = 'DBRef'; + this.namespace = namespace; + this.oid = oid; + this.db = db; +} + +/** + * @ignore + * @api private + */ +DBRef.prototype.toJSON = function() { + return { + $ref: this.namespace, + $id: this.oid, + $db: this.db == null ? '' : this.db + }; +}; + +module.exports = DBRef; +module.exports.DBRef = DBRef; diff --git a/node_modules/bson/lib/bson/decimal128.js b/node_modules/bson/lib/bson/decimal128.js new file mode 100644 index 0000000..1dc2f00 --- /dev/null +++ b/node_modules/bson/lib/bson/decimal128.js @@ -0,0 +1,818 @@ +'use strict'; + +var Long = require('./long'); + +var PARSE_STRING_REGEXP = /^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/; +var PARSE_INF_REGEXP = /^(\+|-)?(Infinity|inf)$/i; +var PARSE_NAN_REGEXP = /^(\+|-)?NaN$/i; + +var EXPONENT_MAX = 6111; +var EXPONENT_MIN = -6176; +var EXPONENT_BIAS = 6176; +var MAX_DIGITS = 34; + +// Nan value bits as 32 bit values (due to lack of longs) +var NAN_BUFFER = [ + 0x7c, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 +].reverse(); +// Infinity value bits 32 bit values (due to lack of longs) +var INF_NEGATIVE_BUFFER = [ + 0xf8, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 +].reverse(); +var INF_POSITIVE_BUFFER = [ + 0x78, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 +].reverse(); + +var EXPONENT_REGEX = /^([-+])?(\d+)?$/; + +// Detect if the value is a digit +var isDigit = function(value) { + return !isNaN(parseInt(value, 10)); +}; + +// Divide two uint128 values +var divideu128 = function(value) { + var DIVISOR = Long.fromNumber(1000 * 1000 * 1000); + var _rem = Long.fromNumber(0); + var i = 0; + + if (!value.parts[0] && !value.parts[1] && !value.parts[2] && !value.parts[3]) { + return { quotient: value, rem: _rem }; + } + + for (i = 0; i <= 3; i++) { + // Adjust remainder to match value of next dividend + _rem = _rem.shiftLeft(32); + // Add the divided to _rem + _rem = _rem.add(new Long(value.parts[i], 0)); + value.parts[i] = _rem.div(DIVISOR).low_; + _rem = _rem.modulo(DIVISOR); + } + + return { quotient: value, rem: _rem }; +}; + +// Multiply two Long values and return the 128 bit value +var multiply64x2 = function(left, right) { + if (!left && !right) { + return { high: Long.fromNumber(0), low: Long.fromNumber(0) }; + } + + var leftHigh = left.shiftRightUnsigned(32); + var leftLow = new Long(left.getLowBits(), 0); + var rightHigh = right.shiftRightUnsigned(32); + var rightLow = new Long(right.getLowBits(), 0); + + var productHigh = leftHigh.multiply(rightHigh); + var productMid = leftHigh.multiply(rightLow); + var productMid2 = leftLow.multiply(rightHigh); + var productLow = leftLow.multiply(rightLow); + + productHigh = productHigh.add(productMid.shiftRightUnsigned(32)); + productMid = new Long(productMid.getLowBits(), 0) + .add(productMid2) + .add(productLow.shiftRightUnsigned(32)); + + productHigh = productHigh.add(productMid.shiftRightUnsigned(32)); + productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0)); + + // Return the 128 bit result + return { high: productHigh, low: productLow }; +}; + +var lessThan = function(left, right) { + // Make values unsigned + var uhleft = left.high_ >>> 0; + var uhright = right.high_ >>> 0; + + // Compare high bits first + if (uhleft < uhright) { + return true; + } else if (uhleft === uhright) { + var ulleft = left.low_ >>> 0; + var ulright = right.low_ >>> 0; + if (ulleft < ulright) return true; + } + + return false; +}; + +// var longtoHex = function(value) { +// var buffer = new Buffer(8); +// var index = 0; +// // Encode the low 64 bits of the decimal +// // Encode low bits +// buffer[index++] = value.low_ & 0xff; +// buffer[index++] = (value.low_ >> 8) & 0xff; +// buffer[index++] = (value.low_ >> 16) & 0xff; +// buffer[index++] = (value.low_ >> 24) & 0xff; +// // Encode high bits +// buffer[index++] = value.high_ & 0xff; +// buffer[index++] = (value.high_ >> 8) & 0xff; +// buffer[index++] = (value.high_ >> 16) & 0xff; +// buffer[index++] = (value.high_ >> 24) & 0xff; +// return buffer.reverse().toString('hex'); +// }; + +// var int32toHex = function(value) { +// var buffer = new Buffer(4); +// var index = 0; +// // Encode the low 64 bits of the decimal +// // Encode low bits +// buffer[index++] = value & 0xff; +// buffer[index++] = (value >> 8) & 0xff; +// buffer[index++] = (value >> 16) & 0xff; +// buffer[index++] = (value >> 24) & 0xff; +// return buffer.reverse().toString('hex'); +// }; + +/** + * A class representation of the BSON Decimal128 type. + * + * @class + * @param {Buffer} bytes a buffer containing the raw Decimal128 bytes. + * @return {Double} + */ +var Decimal128 = function(bytes) { + this._bsontype = 'Decimal128'; + this.bytes = bytes; +}; + +/** + * Create a Decimal128 instance from a string representation + * + * @method + * @param {string} string a numeric string representation. + * @return {Decimal128} returns a Decimal128 instance. + */ +Decimal128.fromString = function(string) { + // Parse state tracking + var isNegative = false; + var sawRadix = false; + var foundNonZero = false; + + // Total number of significant digits (no leading or trailing zero) + var significantDigits = 0; + // Total number of significand digits read + var nDigitsRead = 0; + // Total number of digits (no leading zeros) + var nDigits = 0; + // The number of the digits after radix + var radixPosition = 0; + // The index of the first non-zero in *str* + var firstNonZero = 0; + + // Digits Array + var digits = [0]; + // The number of digits in digits + var nDigitsStored = 0; + // Insertion pointer for digits + var digitsInsert = 0; + // The index of the first non-zero digit + var firstDigit = 0; + // The index of the last digit + var lastDigit = 0; + + // Exponent + var exponent = 0; + // loop index over array + var i = 0; + // The high 17 digits of the significand + var significandHigh = [0, 0]; + // The low 17 digits of the significand + var significandLow = [0, 0]; + // The biased exponent + var biasedExponent = 0; + + // Read index + var index = 0; + + // Trim the string + string = string.trim(); + + // Naively prevent against REDOS attacks. + // TODO: implementing a custom parsing for this, or refactoring the regex would yield + // further gains. + if (string.length >= 7000) { + throw new Error('' + string + ' not a valid Decimal128 string'); + } + + // Results + var stringMatch = string.match(PARSE_STRING_REGEXP); + var infMatch = string.match(PARSE_INF_REGEXP); + var nanMatch = string.match(PARSE_NAN_REGEXP); + + // Validate the string + if ((!stringMatch && !infMatch && !nanMatch) || string.length === 0) { + throw new Error('' + string + ' not a valid Decimal128 string'); + } + + // Check if we have an illegal exponent format + if (stringMatch && stringMatch[4] && stringMatch[2] === undefined) { + throw new Error('' + string + ' not a valid Decimal128 string'); + } + + // Get the negative or positive sign + if (string[index] === '+' || string[index] === '-') { + isNegative = string[index++] === '-'; + } + + // Check if user passed Infinity or NaN + if (!isDigit(string[index]) && string[index] !== '.') { + if (string[index] === 'i' || string[index] === 'I') { + return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER)); + } else if (string[index] === 'N') { + return new Decimal128(new Buffer(NAN_BUFFER)); + } + } + + // Read all the digits + while (isDigit(string[index]) || string[index] === '.') { + if (string[index] === '.') { + if (sawRadix) { + return new Decimal128(new Buffer(NAN_BUFFER)); + } + + sawRadix = true; + index = index + 1; + continue; + } + + if (nDigitsStored < 34) { + if (string[index] !== '0' || foundNonZero) { + if (!foundNonZero) { + firstNonZero = nDigitsRead; + } + + foundNonZero = true; + + // Only store 34 digits + digits[digitsInsert++] = parseInt(string[index], 10); + nDigitsStored = nDigitsStored + 1; + } + } + + if (foundNonZero) { + nDigits = nDigits + 1; + } + + if (sawRadix) { + radixPosition = radixPosition + 1; + } + + nDigitsRead = nDigitsRead + 1; + index = index + 1; + } + + if (sawRadix && !nDigitsRead) { + throw new Error('' + string + ' not a valid Decimal128 string'); + } + + // Read exponent if exists + if (string[index] === 'e' || string[index] === 'E') { + // Read exponent digits + var match = string.substr(++index).match(EXPONENT_REGEX); + + // No digits read + if (!match || !match[2]) { + return new Decimal128(new Buffer(NAN_BUFFER)); + } + + // Get exponent + exponent = parseInt(match[0], 10); + + // Adjust the index + index = index + match[0].length; + } + + // Return not a number + if (string[index]) { + return new Decimal128(new Buffer(NAN_BUFFER)); + } + + // Done reading input + // Find first non-zero digit in digits + firstDigit = 0; + + if (!nDigitsStored) { + firstDigit = 0; + lastDigit = 0; + digits[0] = 0; + nDigits = 1; + nDigitsStored = 1; + significantDigits = 0; + } else { + lastDigit = nDigitsStored - 1; + significantDigits = nDigits; + + if (exponent !== 0 && significantDigits !== 1) { + while (string[firstNonZero + significantDigits - 1] === '0') { + significantDigits = significantDigits - 1; + } + } + } + + // Normalization of exponent + // Correct exponent based on radix position, and shift significand as needed + // to represent user input + + // Overflow prevention + if (exponent <= radixPosition && radixPosition - exponent > 1 << 14) { + exponent = EXPONENT_MIN; + } else { + exponent = exponent - radixPosition; + } + + // Attempt to normalize the exponent + while (exponent > EXPONENT_MAX) { + // Shift exponent to significand and decrease + lastDigit = lastDigit + 1; + + if (lastDigit - firstDigit > MAX_DIGITS) { + // Check if we have a zero then just hard clamp, otherwise fail + var digitsString = digits.join(''); + if (digitsString.match(/^0+$/)) { + exponent = EXPONENT_MAX; + break; + } else { + return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER)); + } + } + + exponent = exponent - 1; + } + + while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) { + // Shift last digit + if (lastDigit === 0) { + exponent = EXPONENT_MIN; + significantDigits = 0; + break; + } + + if (nDigitsStored < nDigits) { + // adjust to match digits not stored + nDigits = nDigits - 1; + } else { + // adjust to round + lastDigit = lastDigit - 1; + } + + if (exponent < EXPONENT_MAX) { + exponent = exponent + 1; + } else { + // Check if we have a zero then just hard clamp, otherwise fail + digitsString = digits.join(''); + if (digitsString.match(/^0+$/)) { + exponent = EXPONENT_MAX; + break; + } else { + return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER)); + } + } + } + + // Round + // We've normalized the exponent, but might still need to round. + if (lastDigit - firstDigit + 1 < significantDigits && string[significantDigits] !== '0') { + var endOfString = nDigitsRead; + + // If we have seen a radix point, 'string' is 1 longer than we have + // documented with ndigits_read, so inc the position of the first nonzero + // digit and the position that digits are read to. + if (sawRadix && exponent === EXPONENT_MIN) { + firstNonZero = firstNonZero + 1; + endOfString = endOfString + 1; + } + + var roundDigit = parseInt(string[firstNonZero + lastDigit + 1], 10); + var roundBit = 0; + + if (roundDigit >= 5) { + roundBit = 1; + + if (roundDigit === 5) { + roundBit = digits[lastDigit] % 2 === 1; + + for (i = firstNonZero + lastDigit + 2; i < endOfString; i++) { + if (parseInt(string[i], 10)) { + roundBit = 1; + break; + } + } + } + } + + if (roundBit) { + var dIdx = lastDigit; + + for (; dIdx >= 0; dIdx--) { + if (++digits[dIdx] > 9) { + digits[dIdx] = 0; + + // overflowed most significant digit + if (dIdx === 0) { + if (exponent < EXPONENT_MAX) { + exponent = exponent + 1; + digits[dIdx] = 1; + } else { + return new Decimal128( + new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER) + ); + } + } + } else { + break; + } + } + } + } + + // Encode significand + // The high 17 digits of the significand + significandHigh = Long.fromNumber(0); + // The low 17 digits of the significand + significandLow = Long.fromNumber(0); + + // read a zero + if (significantDigits === 0) { + significandHigh = Long.fromNumber(0); + significandLow = Long.fromNumber(0); + } else if (lastDigit - firstDigit < 17) { + dIdx = firstDigit; + significandLow = Long.fromNumber(digits[dIdx++]); + significandHigh = new Long(0, 0); + + for (; dIdx <= lastDigit; dIdx++) { + significandLow = significandLow.multiply(Long.fromNumber(10)); + significandLow = significandLow.add(Long.fromNumber(digits[dIdx])); + } + } else { + dIdx = firstDigit; + significandHigh = Long.fromNumber(digits[dIdx++]); + + for (; dIdx <= lastDigit - 17; dIdx++) { + significandHigh = significandHigh.multiply(Long.fromNumber(10)); + significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx])); + } + + significandLow = Long.fromNumber(digits[dIdx++]); + + for (; dIdx <= lastDigit; dIdx++) { + significandLow = significandLow.multiply(Long.fromNumber(10)); + significandLow = significandLow.add(Long.fromNumber(digits[dIdx])); + } + } + + var significand = multiply64x2(significandHigh, Long.fromString('100000000000000000')); + + significand.low = significand.low.add(significandLow); + + if (lessThan(significand.low, significandLow)) { + significand.high = significand.high.add(Long.fromNumber(1)); + } + + // Biased exponent + biasedExponent = exponent + EXPONENT_BIAS; + var dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) }; + + // Encode combination, exponent, and significand. + if ( + significand.high + .shiftRightUnsigned(49) + .and(Long.fromNumber(1)) + .equals(Long.fromNumber) + ) { + // Encode '11' into bits 1 to 3 + dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61)); + dec.high = dec.high.or( + Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47)) + ); + dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff))); + } else { + dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49)); + dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff))); + } + + dec.low = significand.low; + + // Encode sign + if (isNegative) { + dec.high = dec.high.or(Long.fromString('9223372036854775808')); + } + + // Encode into a buffer + var buffer = new Buffer(16); + index = 0; + + // Encode the low 64 bits of the decimal + // Encode low bits + buffer[index++] = dec.low.low_ & 0xff; + buffer[index++] = (dec.low.low_ >> 8) & 0xff; + buffer[index++] = (dec.low.low_ >> 16) & 0xff; + buffer[index++] = (dec.low.low_ >> 24) & 0xff; + // Encode high bits + buffer[index++] = dec.low.high_ & 0xff; + buffer[index++] = (dec.low.high_ >> 8) & 0xff; + buffer[index++] = (dec.low.high_ >> 16) & 0xff; + buffer[index++] = (dec.low.high_ >> 24) & 0xff; + + // Encode the high 64 bits of the decimal + // Encode low bits + buffer[index++] = dec.high.low_ & 0xff; + buffer[index++] = (dec.high.low_ >> 8) & 0xff; + buffer[index++] = (dec.high.low_ >> 16) & 0xff; + buffer[index++] = (dec.high.low_ >> 24) & 0xff; + // Encode high bits + buffer[index++] = dec.high.high_ & 0xff; + buffer[index++] = (dec.high.high_ >> 8) & 0xff; + buffer[index++] = (dec.high.high_ >> 16) & 0xff; + buffer[index++] = (dec.high.high_ >> 24) & 0xff; + + // Return the new Decimal128 + return new Decimal128(buffer); +}; + +// Extract least significant 5 bits +var COMBINATION_MASK = 0x1f; +// Extract least significant 14 bits +var EXPONENT_MASK = 0x3fff; +// Value of combination field for Inf +var COMBINATION_INFINITY = 30; +// Value of combination field for NaN +var COMBINATION_NAN = 31; +// Value of combination field for NaN +// var COMBINATION_SNAN = 32; +// decimal128 exponent bias +EXPONENT_BIAS = 6176; + +/** + * Create a string representation of the raw Decimal128 value + * + * @method + * @return {string} returns a Decimal128 string representation. + */ +Decimal128.prototype.toString = function() { + // Note: bits in this routine are referred to starting at 0, + // from the sign bit, towards the coefficient. + + // bits 0 - 31 + var high; + // bits 32 - 63 + var midh; + // bits 64 - 95 + var midl; + // bits 96 - 127 + var low; + // bits 1 - 5 + var combination; + // decoded biased exponent (14 bits) + var biased_exponent; + // the number of significand digits + var significand_digits = 0; + // the base-10 digits in the significand + var significand = new Array(36); + for (var i = 0; i < significand.length; i++) significand[i] = 0; + // read pointer into significand + var index = 0; + + // unbiased exponent + var exponent; + // the exponent if scientific notation is used + var scientific_exponent; + + // true if the number is zero + var is_zero = false; + + // the most signifcant significand bits (50-46) + var significand_msb; + // temporary storage for significand decoding + var significand128 = { parts: new Array(4) }; + // indexing variables + i; + var j, k; + + // Output string + var string = []; + + // Unpack index + index = 0; + + // Buffer reference + var buffer = this.bytes; + + // Unpack the low 64bits into a long + low = + buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24); + midl = + buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24); + + // Unpack the high 64bits into a long + midh = + buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24); + high = + buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24); + + // Unpack index + index = 0; + + // Create the state of the decimal + var dec = { + low: new Long(low, midl), + high: new Long(midh, high) + }; + + if (dec.high.lessThan(Long.ZERO)) { + string.push('-'); + } + + // Decode combination field and exponent + combination = (high >> 26) & COMBINATION_MASK; + + if (combination >> 3 === 3) { + // Check for 'special' values + if (combination === COMBINATION_INFINITY) { + return string.join('') + 'Infinity'; + } else if (combination === COMBINATION_NAN) { + return 'NaN'; + } else { + biased_exponent = (high >> 15) & EXPONENT_MASK; + significand_msb = 0x08 + ((high >> 14) & 0x01); + } + } else { + significand_msb = (high >> 14) & 0x07; + biased_exponent = (high >> 17) & EXPONENT_MASK; + } + + exponent = biased_exponent - EXPONENT_BIAS; + + // Create string of significand digits + + // Convert the 114-bit binary number represented by + // (significand_high, significand_low) to at most 34 decimal + // digits through modulo and division. + significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14); + significand128.parts[1] = midh; + significand128.parts[2] = midl; + significand128.parts[3] = low; + + if ( + significand128.parts[0] === 0 && + significand128.parts[1] === 0 && + significand128.parts[2] === 0 && + significand128.parts[3] === 0 + ) { + is_zero = true; + } else { + for (k = 3; k >= 0; k--) { + var least_digits = 0; + // Peform the divide + var result = divideu128(significand128); + significand128 = result.quotient; + least_digits = result.rem.low_; + + // We now have the 9 least significant digits (in base 2). + // Convert and output to string. + if (!least_digits) continue; + + for (j = 8; j >= 0; j--) { + // significand[k * 9 + j] = Math.round(least_digits % 10); + significand[k * 9 + j] = least_digits % 10; + // least_digits = Math.round(least_digits / 10); + least_digits = Math.floor(least_digits / 10); + } + } + } + + // Output format options: + // Scientific - [-]d.dddE(+/-)dd or [-]dE(+/-)dd + // Regular - ddd.ddd + + if (is_zero) { + significand_digits = 1; + significand[index] = 0; + } else { + significand_digits = 36; + i = 0; + + while (!significand[index]) { + i++; + significand_digits = significand_digits - 1; + index = index + 1; + } + } + + scientific_exponent = significand_digits - 1 + exponent; + + // The scientific exponent checks are dictated by the string conversion + // specification and are somewhat arbitrary cutoffs. + // + // We must check exponent > 0, because if this is the case, the number + // has trailing zeros. However, we *cannot* output these trailing zeros, + // because doing so would change the precision of the value, and would + // change stored data if the string converted number is round tripped. + + if (scientific_exponent >= 34 || scientific_exponent <= -7 || exponent > 0) { + // Scientific format + string.push(significand[index++]); + significand_digits = significand_digits - 1; + + if (significand_digits) { + string.push('.'); + } + + for (i = 0; i < significand_digits; i++) { + string.push(significand[index++]); + } + + // Exponent + string.push('E'); + if (scientific_exponent > 0) { + string.push('+' + scientific_exponent); + } else { + string.push(scientific_exponent); + } + } else { + // Regular format with no decimal place + if (exponent >= 0) { + for (i = 0; i < significand_digits; i++) { + string.push(significand[index++]); + } + } else { + var radix_position = significand_digits + exponent; + + // non-zero digits before radix + if (radix_position > 0) { + for (i = 0; i < radix_position; i++) { + string.push(significand[index++]); + } + } else { + string.push('0'); + } + + string.push('.'); + // add leading zeros after radix + while (radix_position++ < 0) { + string.push('0'); + } + + for (i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) { + string.push(significand[index++]); + } + } + } + + return string.join(''); +}; + +Decimal128.prototype.toJSON = function() { + return { $numberDecimal: this.toString() }; +}; + +module.exports = Decimal128; +module.exports.Decimal128 = Decimal128; diff --git a/node_modules/bson/lib/bson/double.js b/node_modules/bson/lib/bson/double.js new file mode 100644 index 0000000..523c21f --- /dev/null +++ b/node_modules/bson/lib/bson/double.js @@ -0,0 +1,33 @@ +/** + * A class representation of the BSON Double type. + * + * @class + * @param {number} value the number we want to represent as a double. + * @return {Double} + */ +function Double(value) { + if (!(this instanceof Double)) return new Double(value); + + this._bsontype = 'Double'; + this.value = value; +} + +/** + * Access the number value. + * + * @method + * @return {number} returns the wrapped double number. + */ +Double.prototype.valueOf = function() { + return this.value; +}; + +/** + * @ignore + */ +Double.prototype.toJSON = function() { + return this.value; +}; + +module.exports = Double; +module.exports.Double = Double; diff --git a/node_modules/bson/lib/bson/float_parser.js b/node_modules/bson/lib/bson/float_parser.js new file mode 100644 index 0000000..0054a2f --- /dev/null +++ b/node_modules/bson/lib/bson/float_parser.js @@ -0,0 +1,124 @@ +// Copyright (c) 2008, Fair Oaks Labs, Inc. +// 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 Fair Oaks Labs, 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. +// +// +// Modifications to writeIEEE754 to support negative zeroes made by Brian White + +var readIEEE754 = function(buffer, offset, endian, mLen, nBytes) { + var e, + m, + bBE = endian === 'big', + eLen = nBytes * 8 - mLen - 1, + eMax = (1 << eLen) - 1, + eBias = eMax >> 1, + nBits = -7, + i = bBE ? 0 : nBytes - 1, + d = bBE ? 1 : -1, + s = buffer[offset + i]; + + i += d; + + e = s & ((1 << -nBits) - 1); + s >>= -nBits; + nBits += eLen; + for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); + + m = e & ((1 << -nBits) - 1); + e >>= -nBits; + nBits += mLen; + for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); + + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : (s ? -1 : 1) * Infinity; + } else { + m = m + Math.pow(2, mLen); + e = e - eBias; + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen); +}; + +var writeIEEE754 = function(buffer, value, offset, endian, mLen, nBytes) { + var e, + m, + c, + bBE = endian === 'big', + eLen = nBytes * 8 - mLen - 1, + eMax = (1 << eLen) - 1, + eBias = eMax >> 1, + rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, + i = bBE ? nBytes - 1 : 0, + d = bBE ? -1 : 1, + s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; + + value = Math.abs(value); + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0; + e = eMax; + } else { + e = Math.floor(Math.log(value) / Math.LN2); + if (value * (c = Math.pow(2, -e)) < 1) { + e--; + c *= 2; + } + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * Math.pow(2, 1 - eBias); + } + if (value * c >= 2) { + e++; + c /= 2; + } + + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * Math.pow(2, mLen); + e = e + eBias; + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); + e = 0; + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); + + e = (e << mLen) | m; + eLen += mLen; + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); + + buffer[offset + i - d] |= s * 128; +}; + +exports.readIEEE754 = readIEEE754; +exports.writeIEEE754 = writeIEEE754; diff --git a/node_modules/bson/lib/bson/int_32.js b/node_modules/bson/lib/bson/int_32.js new file mode 100644 index 0000000..85dbdec --- /dev/null +++ b/node_modules/bson/lib/bson/int_32.js @@ -0,0 +1,33 @@ +/** + * A class representation of a BSON Int32 type. + * + * @class + * @param {number} value the number we want to represent as an int32. + * @return {Int32} + */ +var Int32 = function(value) { + if (!(this instanceof Int32)) return new Int32(value); + + this._bsontype = 'Int32'; + this.value = value; +}; + +/** + * Access the number value. + * + * @method + * @return {number} returns the wrapped int32 number. + */ +Int32.prototype.valueOf = function() { + return this.value; +}; + +/** + * @ignore + */ +Int32.prototype.toJSON = function() { + return this.value; +}; + +module.exports = Int32; +module.exports.Int32 = Int32; diff --git a/node_modules/bson/lib/bson/long.js b/node_modules/bson/lib/bson/long.js new file mode 100644 index 0000000..78215aa --- /dev/null +++ b/node_modules/bson/lib/bson/long.js @@ -0,0 +1,851 @@ +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Copyright 2009 Google Inc. All Rights Reserved + +/** + * Defines a Long class for representing a 64-bit two's-complement + * integer value, which faithfully simulates the behavior of a Java "Long". This + * implementation is derived from LongLib in GWT. + * + * Constructs a 64-bit two's-complement integer, given its low and high 32-bit + * values as *signed* integers. See the from* functions below for more + * convenient ways of constructing Longs. + * + * The internal representation of a Long is the two given signed, 32-bit values. + * We use 32-bit pieces because these are the size of integers on which + * Javascript performs bit-operations. For operations like addition and + * multiplication, we split each number into 16-bit pieces, which can easily be + * multiplied within Javascript's floating-point representation without overflow + * or change in sign. + * + * In the algorithms below, we frequently reduce the negative case to the + * positive case by negating the input(s) and then post-processing the result. + * Note that we must ALWAYS check specially whether those values are MIN_VALUE + * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as + * a positive number, it overflows back into a negative). Not handling this + * case would often result in infinite recursion. + * + * @class + * @param {number} low the low (signed) 32 bits of the Long. + * @param {number} high the high (signed) 32 bits of the Long. + * @return {Long} + */ +function Long(low, high) { + if (!(this instanceof Long)) return new Long(low, high); + + this._bsontype = 'Long'; + /** + * @type {number} + * @ignore + */ + this.low_ = low | 0; // force into 32 signed bits. + + /** + * @type {number} + * @ignore + */ + this.high_ = high | 0; // force into 32 signed bits. +} + +/** + * Return the int value. + * + * @method + * @return {number} the value, assuming it is a 32-bit integer. + */ +Long.prototype.toInt = function() { + return this.low_; +}; + +/** + * Return the Number value. + * + * @method + * @return {number} the closest floating-point representation to this value. + */ +Long.prototype.toNumber = function() { + return this.high_ * Long.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned(); +}; + +/** + * Return the JSON value. + * + * @method + * @return {string} the JSON representation. + */ +Long.prototype.toJSON = function() { + return this.toString(); +}; + +/** + * Return the String value. + * + * @method + * @param {number} [opt_radix] the radix in which the text should be written. + * @return {string} the textual representation of this value. + */ +Long.prototype.toString = function(opt_radix) { + var radix = opt_radix || 10; + if (radix < 2 || 36 < radix) { + throw Error('radix out of range: ' + radix); + } + + if (this.isZero()) { + return '0'; + } + + if (this.isNegative()) { + if (this.equals(Long.MIN_VALUE)) { + // We need to change the Long value before it can be negated, so we remove + // the bottom-most digit in this base and then recurse to do the rest. + var radixLong = Long.fromNumber(radix); + var div = this.div(radixLong); + var rem = div.multiply(radixLong).subtract(this); + return div.toString(radix) + rem.toInt().toString(radix); + } else { + return '-' + this.negate().toString(radix); + } + } + + // Do several (6) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = Long.fromNumber(Math.pow(radix, 6)); + + rem = this; + var result = ''; + + while (!rem.isZero()) { + var remDiv = rem.div(radixToPower); + var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); + var digits = intval.toString(radix); + + rem = remDiv; + if (rem.isZero()) { + return digits + result; + } else { + while (digits.length < 6) { + digits = '0' + digits; + } + result = '' + digits + result; + } + } +}; + +/** + * Return the high 32-bits value. + * + * @method + * @return {number} the high 32-bits as a signed value. + */ +Long.prototype.getHighBits = function() { + return this.high_; +}; + +/** + * Return the low 32-bits value. + * + * @method + * @return {number} the low 32-bits as a signed value. + */ +Long.prototype.getLowBits = function() { + return this.low_; +}; + +/** + * Return the low unsigned 32-bits value. + * + * @method + * @return {number} the low 32-bits as an unsigned value. + */ +Long.prototype.getLowBitsUnsigned = function() { + return this.low_ >= 0 ? this.low_ : Long.TWO_PWR_32_DBL_ + this.low_; +}; + +/** + * Returns the number of bits needed to represent the absolute value of this Long. + * + * @method + * @return {number} Returns the number of bits needed to represent the absolute value of this Long. + */ +Long.prototype.getNumBitsAbs = function() { + if (this.isNegative()) { + if (this.equals(Long.MIN_VALUE)) { + return 64; + } else { + return this.negate().getNumBitsAbs(); + } + } else { + var val = this.high_ !== 0 ? this.high_ : this.low_; + for (var bit = 31; bit > 0; bit--) { + if ((val & (1 << bit)) !== 0) { + break; + } + } + return this.high_ !== 0 ? bit + 33 : bit + 1; + } +}; + +/** + * Return whether this value is zero. + * + * @method + * @return {boolean} whether this value is zero. + */ +Long.prototype.isZero = function() { + return this.high_ === 0 && this.low_ === 0; +}; + +/** + * Return whether this value is negative. + * + * @method + * @return {boolean} whether this value is negative. + */ +Long.prototype.isNegative = function() { + return this.high_ < 0; +}; + +/** + * Return whether this value is odd. + * + * @method + * @return {boolean} whether this value is odd. + */ +Long.prototype.isOdd = function() { + return (this.low_ & 1) === 1; +}; + +/** + * Return whether this Long equals the other + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long equals the other + */ +Long.prototype.equals = function(other) { + return this.high_ === other.high_ && this.low_ === other.low_; +}; + +/** + * Return whether this Long does not equal the other. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long does not equal the other. + */ +Long.prototype.notEquals = function(other) { + return this.high_ !== other.high_ || this.low_ !== other.low_; +}; + +/** + * Return whether this Long is less than the other. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long is less than the other. + */ +Long.prototype.lessThan = function(other) { + return this.compare(other) < 0; +}; + +/** + * Return whether this Long is less than or equal to the other. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long is less than or equal to the other. + */ +Long.prototype.lessThanOrEqual = function(other) { + return this.compare(other) <= 0; +}; + +/** + * Return whether this Long is greater than the other. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long is greater than the other. + */ +Long.prototype.greaterThan = function(other) { + return this.compare(other) > 0; +}; + +/** + * Return whether this Long is greater than or equal to the other. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} whether this Long is greater than or equal to the other. + */ +Long.prototype.greaterThanOrEqual = function(other) { + return this.compare(other) >= 0; +}; + +/** + * Compares this Long with the given one. + * + * @method + * @param {Long} other Long to compare against. + * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. + */ +Long.prototype.compare = function(other) { + if (this.equals(other)) { + return 0; + } + + var thisNeg = this.isNegative(); + var otherNeg = other.isNegative(); + if (thisNeg && !otherNeg) { + return -1; + } + if (!thisNeg && otherNeg) { + return 1; + } + + // at this point, the signs are the same, so subtraction will not overflow + if (this.subtract(other).isNegative()) { + return -1; + } else { + return 1; + } +}; + +/** + * The negation of this value. + * + * @method + * @return {Long} the negation of this value. + */ +Long.prototype.negate = function() { + if (this.equals(Long.MIN_VALUE)) { + return Long.MIN_VALUE; + } else { + return this.not().add(Long.ONE); + } +}; + +/** + * Returns the sum of this and the given Long. + * + * @method + * @param {Long} other Long to add to this one. + * @return {Long} the sum of this and the given Long. + */ +Long.prototype.add = function(other) { + // Divide each number into 4 chunks of 16 bits, and then sum the chunks. + + var a48 = this.high_ >>> 16; + var a32 = this.high_ & 0xffff; + var a16 = this.low_ >>> 16; + var a00 = this.low_ & 0xffff; + + var b48 = other.high_ >>> 16; + var b32 = other.high_ & 0xffff; + var b16 = other.low_ >>> 16; + var b00 = other.low_ & 0xffff; + + var c48 = 0, + c32 = 0, + c16 = 0, + c00 = 0; + c00 += a00 + b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 + b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 + b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 + b48; + c48 &= 0xffff; + return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); +}; + +/** + * Returns the difference of this and the given Long. + * + * @method + * @param {Long} other Long to subtract from this. + * @return {Long} the difference of this and the given Long. + */ +Long.prototype.subtract = function(other) { + return this.add(other.negate()); +}; + +/** + * Returns the product of this and the given Long. + * + * @method + * @param {Long} other Long to multiply with this. + * @return {Long} the product of this and the other. + */ +Long.prototype.multiply = function(other) { + if (this.isZero()) { + return Long.ZERO; + } else if (other.isZero()) { + return Long.ZERO; + } + + if (this.equals(Long.MIN_VALUE)) { + return other.isOdd() ? Long.MIN_VALUE : Long.ZERO; + } else if (other.equals(Long.MIN_VALUE)) { + return this.isOdd() ? Long.MIN_VALUE : Long.ZERO; + } + + if (this.isNegative()) { + if (other.isNegative()) { + return this.negate().multiply(other.negate()); + } else { + return this.negate() + .multiply(other) + .negate(); + } + } else if (other.isNegative()) { + return this.multiply(other.negate()).negate(); + } + + // If both Longs are small, use float multiplication + if (this.lessThan(Long.TWO_PWR_24_) && other.lessThan(Long.TWO_PWR_24_)) { + return Long.fromNumber(this.toNumber() * other.toNumber()); + } + + // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products. + // We can skip products that would overflow. + + var a48 = this.high_ >>> 16; + var a32 = this.high_ & 0xffff; + var a16 = this.low_ >>> 16; + var a00 = this.low_ & 0xffff; + + var b48 = other.high_ >>> 16; + var b32 = other.high_ & 0xffff; + var b16 = other.low_ >>> 16; + var b00 = other.low_ & 0xffff; + + var c48 = 0, + c32 = 0, + c16 = 0, + c00 = 0; + c00 += a00 * b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 * b00; + c32 += c16 >>> 16; + c16 &= 0xffff; + c16 += a00 * b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 * b00; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a16 * b16; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a00 * b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; + c48 &= 0xffff; + return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); +}; + +/** + * Returns this Long divided by the given one. + * + * @method + * @param {Long} other Long by which to divide. + * @return {Long} this Long divided by the given one. + */ +Long.prototype.div = function(other) { + if (other.isZero()) { + throw Error('division by zero'); + } else if (this.isZero()) { + return Long.ZERO; + } + + if (this.equals(Long.MIN_VALUE)) { + if (other.equals(Long.ONE) || other.equals(Long.NEG_ONE)) { + return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE + } else if (other.equals(Long.MIN_VALUE)) { + return Long.ONE; + } else { + // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. + var halfThis = this.shiftRight(1); + var approx = halfThis.div(other).shiftLeft(1); + if (approx.equals(Long.ZERO)) { + return other.isNegative() ? Long.ONE : Long.NEG_ONE; + } else { + var rem = this.subtract(other.multiply(approx)); + var result = approx.add(rem.div(other)); + return result; + } + } + } else if (other.equals(Long.MIN_VALUE)) { + return Long.ZERO; + } + + if (this.isNegative()) { + if (other.isNegative()) { + return this.negate().div(other.negate()); + } else { + return this.negate() + .div(other) + .negate(); + } + } else if (other.isNegative()) { + return this.div(other.negate()).negate(); + } + + // Repeat the following until the remainder is less than other: find a + // floating-point that approximates remainder / other *from below*, add this + // into the result, and subtract it from the remainder. It is critical that + // the approximate value is less than or equal to the real value so that the + // remainder never becomes negative. + var res = Long.ZERO; + rem = this; + while (rem.greaterThanOrEqual(other)) { + // Approximate the result of division. This may be a little greater or + // smaller than the actual value. + approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); + + // We will tweak the approximate result by changing it in the 48-th digit or + // the smallest non-fractional digit, whichever is larger. + var log2 = Math.ceil(Math.log(approx) / Math.LN2); + var delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48); + + // Decrease the approximation until it is smaller than the remainder. Note + // that if it is too large, the product overflows and is negative. + var approxRes = Long.fromNumber(approx); + var approxRem = approxRes.multiply(other); + while (approxRem.isNegative() || approxRem.greaterThan(rem)) { + approx -= delta; + approxRes = Long.fromNumber(approx); + approxRem = approxRes.multiply(other); + } + + // We know the answer can't be zero... and actually, zero would cause + // infinite recursion since we would make no progress. + if (approxRes.isZero()) { + approxRes = Long.ONE; + } + + res = res.add(approxRes); + rem = rem.subtract(approxRem); + } + return res; +}; + +/** + * Returns this Long modulo the given one. + * + * @method + * @param {Long} other Long by which to mod. + * @return {Long} this Long modulo the given one. + */ +Long.prototype.modulo = function(other) { + return this.subtract(this.div(other).multiply(other)); +}; + +/** + * The bitwise-NOT of this value. + * + * @method + * @return {Long} the bitwise-NOT of this value. + */ +Long.prototype.not = function() { + return Long.fromBits(~this.low_, ~this.high_); +}; + +/** + * Returns the bitwise-AND of this Long and the given one. + * + * @method + * @param {Long} other the Long with which to AND. + * @return {Long} the bitwise-AND of this and the other. + */ +Long.prototype.and = function(other) { + return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_); +}; + +/** + * Returns the bitwise-OR of this Long and the given one. + * + * @method + * @param {Long} other the Long with which to OR. + * @return {Long} the bitwise-OR of this and the other. + */ +Long.prototype.or = function(other) { + return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_); +}; + +/** + * Returns the bitwise-XOR of this Long and the given one. + * + * @method + * @param {Long} other the Long with which to XOR. + * @return {Long} the bitwise-XOR of this and the other. + */ +Long.prototype.xor = function(other) { + return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); +}; + +/** + * Returns this Long with bits shifted to the left by the given amount. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Long} this shifted to the left by the given amount. + */ +Long.prototype.shiftLeft = function(numBits) { + numBits &= 63; + if (numBits === 0) { + return this; + } else { + var low = this.low_; + if (numBits < 32) { + var high = this.high_; + return Long.fromBits(low << numBits, (high << numBits) | (low >>> (32 - numBits))); + } else { + return Long.fromBits(0, low << (numBits - 32)); + } + } +}; + +/** + * Returns this Long with bits shifted to the right by the given amount. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Long} this shifted to the right by the given amount. + */ +Long.prototype.shiftRight = function(numBits) { + numBits &= 63; + if (numBits === 0) { + return this; + } else { + var high = this.high_; + if (numBits < 32) { + var low = this.low_; + return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >> numBits); + } else { + return Long.fromBits(high >> (numBits - 32), high >= 0 ? 0 : -1); + } + } +}; + +/** + * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits. + */ +Long.prototype.shiftRightUnsigned = function(numBits) { + numBits &= 63; + if (numBits === 0) { + return this; + } else { + var high = this.high_; + if (numBits < 32) { + var low = this.low_; + return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits); + } else if (numBits === 32) { + return Long.fromBits(high, 0); + } else { + return Long.fromBits(high >>> (numBits - 32), 0); + } + } +}; + +/** + * Returns a Long representing the given (32-bit) integer value. + * + * @method + * @param {number} value the 32-bit integer in question. + * @return {Long} the corresponding Long value. + */ +Long.fromInt = function(value) { + if (-128 <= value && value < 128) { + var cachedObj = Long.INT_CACHE_[value]; + if (cachedObj) { + return cachedObj; + } + } + + var obj = new Long(value | 0, value < 0 ? -1 : 0); + if (-128 <= value && value < 128) { + Long.INT_CACHE_[value] = obj; + } + return obj; +}; + +/** + * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + * + * @method + * @param {number} value the number in question. + * @return {Long} the corresponding Long value. + */ +Long.fromNumber = function(value) { + if (isNaN(value) || !isFinite(value)) { + return Long.ZERO; + } else if (value <= -Long.TWO_PWR_63_DBL_) { + return Long.MIN_VALUE; + } else if (value + 1 >= Long.TWO_PWR_63_DBL_) { + return Long.MAX_VALUE; + } else if (value < 0) { + return Long.fromNumber(-value).negate(); + } else { + return new Long((value % Long.TWO_PWR_32_DBL_) | 0, (value / Long.TWO_PWR_32_DBL_) | 0); + } +}; + +/** + * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. + * + * @method + * @param {number} lowBits the low 32-bits. + * @param {number} highBits the high 32-bits. + * @return {Long} the corresponding Long value. + */ +Long.fromBits = function(lowBits, highBits) { + return new Long(lowBits, highBits); +}; + +/** + * Returns a Long representation of the given string, written using the given radix. + * + * @method + * @param {string} str the textual representation of the Long. + * @param {number} opt_radix the radix in which the text is written. + * @return {Long} the corresponding Long value. + */ +Long.fromString = function(str, opt_radix) { + if (str.length === 0) { + throw Error('number format error: empty string'); + } + + var radix = opt_radix || 10; + if (radix < 2 || 36 < radix) { + throw Error('radix out of range: ' + radix); + } + + if (str.charAt(0) === '-') { + return Long.fromString(str.substring(1), radix).negate(); + } else if (str.indexOf('-') >= 0) { + throw Error('number format error: interior "-" character: ' + str); + } + + // Do several (8) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = Long.fromNumber(Math.pow(radix, 8)); + + var result = Long.ZERO; + for (var i = 0; i < str.length; i += 8) { + var size = Math.min(8, str.length - i); + var value = parseInt(str.substring(i, i + size), radix); + if (size < 8) { + var power = Long.fromNumber(Math.pow(radix, size)); + result = result.multiply(power).add(Long.fromNumber(value)); + } else { + result = result.multiply(radixToPower); + result = result.add(Long.fromNumber(value)); + } + } + return result; +}; + +// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the +// from* methods on which they depend. + +/** + * A cache of the Long representations of small integer values. + * @type {Object} + * @ignore + */ +Long.INT_CACHE_ = {}; + +// NOTE: the compiler should inline these constant values below and then remove +// these variables, so there should be no runtime penalty for these. + +/** + * Number used repeated below in calculations. This must appear before the + * first call to any from* function below. + * @type {number} + * @ignore + */ +Long.TWO_PWR_16_DBL_ = 1 << 16; + +/** + * @type {number} + * @ignore + */ +Long.TWO_PWR_24_DBL_ = 1 << 24; + +/** + * @type {number} + * @ignore + */ +Long.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_; + +/** + * @type {number} + * @ignore + */ +Long.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2; + +/** + * @type {number} + * @ignore + */ +Long.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_; + +/** + * @type {number} + * @ignore + */ +Long.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_; + +/** + * @type {number} + * @ignore + */ +Long.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2; + +/** @type {Long} */ +Long.ZERO = Long.fromInt(0); + +/** @type {Long} */ +Long.ONE = Long.fromInt(1); + +/** @type {Long} */ +Long.NEG_ONE = Long.fromInt(-1); + +/** @type {Long} */ +Long.MAX_VALUE = Long.fromBits(0xffffffff | 0, 0x7fffffff | 0); + +/** @type {Long} */ +Long.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0); + +/** + * @type {Long} + * @ignore + */ +Long.TWO_PWR_24_ = Long.fromInt(1 << 24); + +/** + * Expose. + */ +module.exports = Long; +module.exports.Long = Long; diff --git a/node_modules/bson/lib/bson/map.js b/node_modules/bson/lib/bson/map.js new file mode 100644 index 0000000..7edb4f2 --- /dev/null +++ b/node_modules/bson/lib/bson/map.js @@ -0,0 +1,128 @@ +'use strict'; + +// We have an ES6 Map available, return the native instance +if (typeof global.Map !== 'undefined') { + module.exports = global.Map; + module.exports.Map = global.Map; +} else { + // We will return a polyfill + var Map = function(array) { + this._keys = []; + this._values = {}; + + for (var i = 0; i < array.length; i++) { + if (array[i] == null) continue; // skip null and undefined + var entry = array[i]; + var key = entry[0]; + var value = entry[1]; + // Add the key to the list of keys in order + this._keys.push(key); + // Add the key and value to the values dictionary with a point + // to the location in the ordered keys list + this._values[key] = { v: value, i: this._keys.length - 1 }; + } + }; + + Map.prototype.clear = function() { + this._keys = []; + this._values = {}; + }; + + Map.prototype.delete = function(key) { + var value = this._values[key]; + if (value == null) return false; + // Delete entry + delete this._values[key]; + // Remove the key from the ordered keys list + this._keys.splice(value.i, 1); + return true; + }; + + Map.prototype.entries = function() { + var self = this; + var index = 0; + + return { + next: function() { + var key = self._keys[index++]; + return { + value: key !== undefined ? [key, self._values[key].v] : undefined, + done: key !== undefined ? false : true + }; + } + }; + }; + + Map.prototype.forEach = function(callback, self) { + self = self || this; + + for (var i = 0; i < this._keys.length; i++) { + var key = this._keys[i]; + // Call the forEach callback + callback.call(self, this._values[key].v, key, self); + } + }; + + Map.prototype.get = function(key) { + return this._values[key] ? this._values[key].v : undefined; + }; + + Map.prototype.has = function(key) { + return this._values[key] != null; + }; + + Map.prototype.keys = function() { + var self = this; + var index = 0; + + return { + next: function() { + var key = self._keys[index++]; + return { + value: key !== undefined ? key : undefined, + done: key !== undefined ? false : true + }; + } + }; + }; + + Map.prototype.set = function(key, value) { + if (this._values[key]) { + this._values[key].v = value; + return this; + } + + // Add the key to the list of keys in order + this._keys.push(key); + // Add the key and value to the values dictionary with a point + // to the location in the ordered keys list + this._values[key] = { v: value, i: this._keys.length - 1 }; + return this; + }; + + Map.prototype.values = function() { + var self = this; + var index = 0; + + return { + next: function() { + var key = self._keys[index++]; + return { + value: key !== undefined ? self._values[key].v : undefined, + done: key !== undefined ? false : true + }; + } + }; + }; + + // Last ismaster + Object.defineProperty(Map.prototype, 'size', { + enumerable: true, + get: function() { + return this._keys.length; + } + }); + + module.exports = Map; + module.exports.Map = Map; +} diff --git a/node_modules/bson/lib/bson/max_key.js b/node_modules/bson/lib/bson/max_key.js new file mode 100644 index 0000000..eebca7b --- /dev/null +++ b/node_modules/bson/lib/bson/max_key.js @@ -0,0 +1,14 @@ +/** + * A class representation of the BSON MaxKey type. + * + * @class + * @return {MaxKey} A MaxKey instance + */ +function MaxKey() { + if (!(this instanceof MaxKey)) return new MaxKey(); + + this._bsontype = 'MaxKey'; +} + +module.exports = MaxKey; +module.exports.MaxKey = MaxKey; diff --git a/node_modules/bson/lib/bson/min_key.js b/node_modules/bson/lib/bson/min_key.js new file mode 100644 index 0000000..15f4522 --- /dev/null +++ b/node_modules/bson/lib/bson/min_key.js @@ -0,0 +1,14 @@ +/** + * A class representation of the BSON MinKey type. + * + * @class + * @return {MinKey} A MinKey instance + */ +function MinKey() { + if (!(this instanceof MinKey)) return new MinKey(); + + this._bsontype = 'MinKey'; +} + +module.exports = MinKey; +module.exports.MinKey = MinKey; diff --git a/node_modules/bson/lib/bson/objectid.js b/node_modules/bson/lib/bson/objectid.js new file mode 100644 index 0000000..87c8925 --- /dev/null +++ b/node_modules/bson/lib/bson/objectid.js @@ -0,0 +1,381 @@ +/** + * Machine id. + * + * Create a random 3-byte value (i.e. unique for this + * process). Other drivers use a md5 of the machine id here, but + * that would mean an asyc call to gethostname, so we don't bother. + * @ignore + */ +var MACHINE_ID = parseInt(Math.random() * 0xffffff, 10); + +// Regular expression that checks for hex value +var checkForHexRegExp = new RegExp('^[0-9a-fA-F]{24}$'); + +// Check if buffer exists +try { + if (Buffer && Buffer.from) var hasBufferType = true; +} catch (err) { + hasBufferType = false; +} + +/** +* Create a new ObjectID instance +* +* @class +* @param {(string|number)} id Can be a 24 byte hex string, 12 byte binary string or a Number. +* @property {number} generationTime The generation time of this ObjectId instance +* @return {ObjectID} instance of ObjectID. +*/ +var ObjectID = function ObjectID(id) { + // Duck-typing to support ObjectId from different npm packages + if (id instanceof ObjectID) return id; + if (!(this instanceof ObjectID)) return new ObjectID(id); + + this._bsontype = 'ObjectID'; + + // The most common usecase (blank id, new objectId instance) + if (id == null || typeof id === 'number') { + // Generate a new id + this.id = this.generate(id); + // If we are caching the hex string + if (ObjectID.cacheHexString) this.__id = this.toString('hex'); + // Return the object + return; + } + + // Check if the passed in id is valid + var valid = ObjectID.isValid(id); + + // Throw an error if it's not a valid setup + if (!valid && id != null) { + throw new Error( + 'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters' + ); + } else if (valid && typeof id === 'string' && id.length === 24 && hasBufferType) { + return new ObjectID(new Buffer(id, 'hex')); + } else if (valid && typeof id === 'string' && id.length === 24) { + return ObjectID.createFromHexString(id); + } else if (id != null && id.length === 12) { + // assume 12 byte string + this.id = id; + } else if (id != null && id.toHexString) { + // Duck-typing to support ObjectId from different npm packages + return id; + } else { + throw new Error( + 'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters' + ); + } + + if (ObjectID.cacheHexString) this.__id = this.toString('hex'); +}; + +// Allow usage of ObjectId as well as ObjectID +// var ObjectId = ObjectID; + +// Precomputed hex table enables speedy hex string conversion +var hexTable = []; +for (var i = 0; i < 256; i++) { + hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16); +} + +/** +* Return the ObjectID id as a 24 byte hex string representation +* +* @method +* @return {string} return the 24 byte hex string representation. +*/ +ObjectID.prototype.toHexString = function() { + if (ObjectID.cacheHexString && this.__id) return this.__id; + + var hexString = ''; + if (!this.id || !this.id.length) { + throw new Error( + 'invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is [' + + JSON.stringify(this.id) + + ']' + ); + } + + if (this.id instanceof _Buffer) { + hexString = convertToHex(this.id); + if (ObjectID.cacheHexString) this.__id = hexString; + return hexString; + } + + for (var i = 0; i < this.id.length; i++) { + hexString += hexTable[this.id.charCodeAt(i)]; + } + + if (ObjectID.cacheHexString) this.__id = hexString; + return hexString; +}; + +/** +* Update the ObjectID index used in generating new ObjectID's on the driver +* +* @method +* @return {number} returns next index value. +* @ignore +*/ +ObjectID.prototype.get_inc = function() { + return (ObjectID.index = (ObjectID.index + 1) % 0xffffff); +}; + +/** +* Update the ObjectID index used in generating new ObjectID's on the driver +* +* @method +* @return {number} returns next index value. +* @ignore +*/ +ObjectID.prototype.getInc = function() { + return this.get_inc(); +}; + +/** +* Generate a 12 byte id buffer used in ObjectID's +* +* @method +* @param {number} [time] optional parameter allowing to pass in a second based timestamp. +* @return {Buffer} return the 12 byte id buffer string. +*/ +ObjectID.prototype.generate = function(time) { + if ('number' !== typeof time) { + time = ~~(Date.now() / 1000); + } + + // Use pid + var pid = + (typeof process === 'undefined' || process.pid === 1 + ? Math.floor(Math.random() * 100000) + : process.pid) % 0xffff; + var inc = this.get_inc(); + // Buffer used + var buffer = new Buffer(12); + // Encode time + buffer[3] = time & 0xff; + buffer[2] = (time >> 8) & 0xff; + buffer[1] = (time >> 16) & 0xff; + buffer[0] = (time >> 24) & 0xff; + // Encode machine + buffer[6] = MACHINE_ID & 0xff; + buffer[5] = (MACHINE_ID >> 8) & 0xff; + buffer[4] = (MACHINE_ID >> 16) & 0xff; + // Encode pid + buffer[8] = pid & 0xff; + buffer[7] = (pid >> 8) & 0xff; + // Encode index + buffer[11] = inc & 0xff; + buffer[10] = (inc >> 8) & 0xff; + buffer[9] = (inc >> 16) & 0xff; + // Return the buffer + return buffer; +}; + +/** +* Converts the id into a 24 byte hex string for printing +* +* @param {String} format The Buffer toString format parameter. +* @return {String} return the 24 byte hex string representation. +* @ignore +*/ +ObjectID.prototype.toString = function(format) { + // Is the id a buffer then use the buffer toString method to return the format + if (this.id && this.id.copy) { + return this.id.toString(typeof format === 'string' ? format : 'hex'); + } + + // if(this.buffer ) + return this.toHexString(); +}; + +/** +* Converts to a string representation of this Id. +* +* @return {String} return the 24 byte hex string representation. +* @ignore +*/ +ObjectID.prototype.inspect = ObjectID.prototype.toString; + +/** +* Converts to its JSON representation. +* +* @return {String} return the 24 byte hex string representation. +* @ignore +*/ +ObjectID.prototype.toJSON = function() { + return this.toHexString(); +}; + +/** +* Compares the equality of this ObjectID with `otherID`. +* +* @method +* @param {object} otherID ObjectID instance to compare against. +* @return {boolean} the result of comparing two ObjectID's +*/ +ObjectID.prototype.equals = function equals(otherId) { + // var id; + + if (otherId instanceof ObjectID) { + return this.toString() === otherId.toString(); + } else if ( + typeof otherId === 'string' && + ObjectID.isValid(otherId) && + otherId.length === 12 && + this.id instanceof _Buffer + ) { + return otherId === this.id.toString('binary'); + } else if (typeof otherId === 'string' && ObjectID.isValid(otherId) && otherId.length === 24) { + return otherId.toLowerCase() === this.toHexString(); + } else if (typeof otherId === 'string' && ObjectID.isValid(otherId) && otherId.length === 12) { + return otherId === this.id; + } else if (otherId != null && (otherId instanceof ObjectID || otherId.toHexString)) { + return otherId.toHexString() === this.toHexString(); + } else { + return false; + } +}; + +/** +* Returns the generation date (accurate up to the second) that this ID was generated. +* +* @method +* @return {date} the generation date +*/ +ObjectID.prototype.getTimestamp = function() { + var timestamp = new Date(); + var time = this.id[3] | (this.id[2] << 8) | (this.id[1] << 16) | (this.id[0] << 24); + timestamp.setTime(Math.floor(time) * 1000); + return timestamp; +}; + +/** +* @ignore +*/ +ObjectID.index = ~~(Math.random() * 0xffffff); + +/** +* @ignore +*/ +ObjectID.createPk = function createPk() { + return new ObjectID(); +}; + +/** +* Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID. +* +* @method +* @param {number} time an integer number representing a number of seconds. +* @return {ObjectID} return the created ObjectID +*/ +ObjectID.createFromTime = function createFromTime(time) { + var buffer = new Buffer([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); + // Encode time into first 4 bytes + buffer[3] = time & 0xff; + buffer[2] = (time >> 8) & 0xff; + buffer[1] = (time >> 16) & 0xff; + buffer[0] = (time >> 24) & 0xff; + // Return the new objectId + return new ObjectID(buffer); +}; + +// Lookup tables +//var encodeLookup = '0123456789abcdef'.split(''); +var decodeLookup = []; +i = 0; +while (i < 10) decodeLookup[0x30 + i] = i++; +while (i < 16) decodeLookup[0x41 - 10 + i] = decodeLookup[0x61 - 10 + i] = i++; + +var _Buffer = Buffer; +var convertToHex = function(bytes) { + return bytes.toString('hex'); +}; + +/** +* Creates an ObjectID from a hex string representation of an ObjectID. +* +* @method +* @param {string} hexString create a ObjectID from a passed in 24 byte hexstring. +* @return {ObjectID} return the created ObjectID +*/ +ObjectID.createFromHexString = function createFromHexString(string) { + // Throw an error if it's not a valid setup + if (typeof string === 'undefined' || (string != null && string.length !== 24)) { + throw new Error( + 'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters' + ); + } + + // Use Buffer.from method if available + if (hasBufferType) return new ObjectID(new Buffer(string, 'hex')); + + // Calculate lengths + var array = new _Buffer(12); + var n = 0; + var i = 0; + + while (i < 24) { + array[n++] = (decodeLookup[string.charCodeAt(i++)] << 4) | decodeLookup[string.charCodeAt(i++)]; + } + + return new ObjectID(array); +}; + +/** +* Checks if a value is a valid bson ObjectId +* +* @method +* @return {boolean} return true if the value is a valid bson ObjectId, return false otherwise. +*/ +ObjectID.isValid = function isValid(id) { + if (id == null) return false; + + if (typeof id === 'number') { + return true; + } + + if (typeof id === 'string') { + return id.length === 12 || (id.length === 24 && checkForHexRegExp.test(id)); + } + + if (id instanceof ObjectID) { + return true; + } + + if (id instanceof _Buffer) { + return true; + } + + // Duck-Typing detection of ObjectId like objects + if (id.toHexString) { + return id.id.length === 12 || (id.id.length === 24 && checkForHexRegExp.test(id.id)); + } + + return false; +}; + +/** +* @ignore +*/ +Object.defineProperty(ObjectID.prototype, 'generationTime', { + enumerable: true, + get: function() { + return this.id[3] | (this.id[2] << 8) | (this.id[1] << 16) | (this.id[0] << 24); + }, + set: function(value) { + // Encode time into first 4 bytes + this.id[3] = value & 0xff; + this.id[2] = (value >> 8) & 0xff; + this.id[1] = (value >> 16) & 0xff; + this.id[0] = (value >> 24) & 0xff; + } +}); + +/** + * Expose. + */ +module.exports = ObjectID; +module.exports.ObjectID = ObjectID; +module.exports.ObjectId = ObjectID; diff --git a/node_modules/bson/lib/bson/parser/calculate_size.js b/node_modules/bson/lib/bson/parser/calculate_size.js new file mode 100644 index 0000000..c43a0ab --- /dev/null +++ b/node_modules/bson/lib/bson/parser/calculate_size.js @@ -0,0 +1,253 @@ +'use strict'; + +var Long = require('../long').Long, + Double = require('../double').Double, + Timestamp = require('../timestamp').Timestamp, + ObjectID = require('../objectid').ObjectID, + Symbol = require('../symbol').Symbol, + BSONRegExp = require('../regexp').BSONRegExp, + Code = require('../code').Code, + Decimal128 = require('../decimal128'), + MinKey = require('../min_key').MinKey, + MaxKey = require('../max_key').MaxKey, + DBRef = require('../db_ref').DBRef, + Binary = require('../binary').Binary; + +// To ensure that 0.4 of node works correctly +var isDate = function isDate(d) { + return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]'; +}; + +var calculateObjectSize = function calculateObjectSize( + object, + serializeFunctions, + ignoreUndefined +) { + var totalLength = 4 + 1; + + if (Array.isArray(object)) { + for (var i = 0; i < object.length; i++) { + totalLength += calculateElement( + i.toString(), + object[i], + serializeFunctions, + true, + ignoreUndefined + ); + } + } else { + // If we have toBSON defined, override the current object + if (object.toBSON) { + object = object.toBSON(); + } + + // Calculate size + for (var key in object) { + totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined); + } + } + + return totalLength; +}; + +/** + * @ignore + * @api private + */ +function calculateElement(name, value, serializeFunctions, isArray, ignoreUndefined) { + // If we have toBSON defined, override the current object + if (value && value.toBSON) { + value = value.toBSON(); + } + + switch (typeof value) { + case 'string': + return 1 + Buffer.byteLength(name, 'utf8') + 1 + 4 + Buffer.byteLength(value, 'utf8') + 1; + case 'number': + if (Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { + if (value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { + // 32 bit + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (4 + 1); + } else { + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1); + } + } else { + // 64 bit + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1); + } + case 'undefined': + if (isArray || !ignoreUndefined) + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1; + return 0; + case 'boolean': + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (1 + 1); + case 'object': + if ( + value == null || + value instanceof MinKey || + value instanceof MaxKey || + value['_bsontype'] === 'MinKey' || + value['_bsontype'] === 'MaxKey' + ) { + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1; + } else if (value instanceof ObjectID || value['_bsontype'] === 'ObjectID') { + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (12 + 1); + } else if (value instanceof Date || isDate(value)) { + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1); + } else if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (1 + 4 + 1) + value.length + ); + } else if ( + value instanceof Long || + value instanceof Double || + value instanceof Timestamp || + value['_bsontype'] === 'Long' || + value['_bsontype'] === 'Double' || + value['_bsontype'] === 'Timestamp' + ) { + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1); + } else if (value instanceof Decimal128 || value['_bsontype'] === 'Decimal128') { + return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (16 + 1); + } else if (value instanceof Code || value['_bsontype'] === 'Code') { + // Calculate size depending on the availability of a scope + if (value.scope != null && Object.keys(value.scope).length > 0) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + 4 + + 4 + + Buffer.byteLength(value.code.toString(), 'utf8') + + 1 + + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined) + ); + } else { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + 4 + + Buffer.byteLength(value.code.toString(), 'utf8') + + 1 + ); + } + } else if (value instanceof Binary || value['_bsontype'] === 'Binary') { + // Check what kind of subtype we have + if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + (value.position + 1 + 4 + 1 + 4) + ); + } else { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (value.position + 1 + 4 + 1) + ); + } + } else if (value instanceof Symbol || value['_bsontype'] === 'Symbol') { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + Buffer.byteLength(value.value, 'utf8') + + 4 + + 1 + + 1 + ); + } else if (value instanceof DBRef || value['_bsontype'] === 'DBRef') { + // Set up correct object for serialization + var ordered_values = { + $ref: value.namespace, + $id: value.oid + }; + + // Add db reference if it exists + if (null != value.db) { + ordered_values['$db'] = value.db; + } + + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + calculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined) + ); + } else if ( + value instanceof RegExp || + Object.prototype.toString.call(value) === '[object RegExp]' + ) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + Buffer.byteLength(value.source, 'utf8') + + 1 + + (value.global ? 1 : 0) + + (value.ignoreCase ? 1 : 0) + + (value.multiline ? 1 : 0) + + 1 + ); + } else if (value instanceof BSONRegExp || value['_bsontype'] === 'BSONRegExp') { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + Buffer.byteLength(value.pattern, 'utf8') + + 1 + + Buffer.byteLength(value.options, 'utf8') + + 1 + ); + } else { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + calculateObjectSize(value, serializeFunctions, ignoreUndefined) + + 1 + ); + } + case 'function': + // WTF for 0.4.X where typeof /someregexp/ === 'function' + if ( + value instanceof RegExp || + Object.prototype.toString.call(value) === '[object RegExp]' || + String.call(value) === '[object RegExp]' + ) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + Buffer.byteLength(value.source, 'utf8') + + 1 + + (value.global ? 1 : 0) + + (value.ignoreCase ? 1 : 0) + + (value.multiline ? 1 : 0) + + 1 + ); + } else { + if (serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + 4 + + 4 + + Buffer.byteLength(value.toString(), 'utf8') + + 1 + + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined) + ); + } else if (serializeFunctions) { + return ( + (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + + 1 + + 4 + + Buffer.byteLength(value.toString(), 'utf8') + + 1 + ); + } + } + } + + return 0; +} + +var BSON = {}; + +// BSON MAX VALUES +BSON.BSON_INT32_MAX = 0x7fffffff; +BSON.BSON_INT32_MIN = -0x80000000; + +// JS MAX PRECISE VALUES +BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. +BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. + +module.exports = calculateObjectSize; diff --git a/node_modules/bson/lib/bson/parser/deserializer.js b/node_modules/bson/lib/bson/parser/deserializer.js new file mode 100644 index 0000000..b7f45d7 --- /dev/null +++ b/node_modules/bson/lib/bson/parser/deserializer.js @@ -0,0 +1,780 @@ +'use strict'; + +var Long = require('../long').Long, + Double = require('../double').Double, + Timestamp = require('../timestamp').Timestamp, + ObjectID = require('../objectid').ObjectID, + Symbol = require('../symbol').Symbol, + Code = require('../code').Code, + MinKey = require('../min_key').MinKey, + MaxKey = require('../max_key').MaxKey, + Decimal128 = require('../decimal128'), + Int32 = require('../int_32'), + DBRef = require('../db_ref').DBRef, + BSONRegExp = require('../regexp').BSONRegExp, + Binary = require('../binary').Binary; + +var deserialize = function(buffer, options, isArray) { + options = options == null ? {} : options; + var index = options && options.index ? options.index : 0; + // Read the document size + var size = + buffer[index] | + (buffer[index + 1] << 8) | + (buffer[index + 2] << 16) | + (buffer[index + 3] << 24); + + // Ensure buffer is valid size + if (size < 5 || buffer.length < size || size + index > buffer.length) { + throw new Error('corrupt bson message'); + } + + // Illegal end value + if (buffer[index + size - 1] !== 0) { + throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00"); + } + + // Start deserializtion + return deserializeObject(buffer, index, options, isArray); +}; + +var deserializeObject = function(buffer, index, options, isArray) { + var evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions']; + var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions']; + var cacheFunctionsCrc32 = + options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32']; + + if (!cacheFunctionsCrc32) var crc32 = null; + + var fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw']; + + // Return raw bson buffer instead of parsing it + var raw = options['raw'] == null ? false : options['raw']; + + // Return BSONRegExp objects instead of native regular expressions + var bsonRegExp = typeof options['bsonRegExp'] === 'boolean' ? options['bsonRegExp'] : false; + + // Controls the promotion of values vs wrapper classes + var promoteBuffers = options['promoteBuffers'] == null ? false : options['promoteBuffers']; + var promoteLongs = options['promoteLongs'] == null ? true : options['promoteLongs']; + var promoteValues = options['promoteValues'] == null ? true : options['promoteValues']; + + // Set the start index + var startIndex = index; + + // Validate that we have at least 4 bytes of buffer + if (buffer.length < 5) throw new Error('corrupt bson message < 5 bytes long'); + + // Read the document size + var size = + buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24); + + // Ensure buffer is valid size + if (size < 5 || size > buffer.length) throw new Error('corrupt bson message'); + + // Create holding object + var object = isArray ? [] : {}; + // Used for arrays to skip having to perform utf8 decoding + var arrayIndex = 0; + + var done = false; + + // While we have more left data left keep parsing + // while (buffer[index + 1] !== 0) { + while (!done) { + // Read the type + var elementType = buffer[index++]; + // If we get a zero it's the last byte, exit + if (elementType === 0) break; + + // Get the start search index + var i = index; + // Locate the end of the c string + while (buffer[i] !== 0x00 && i < buffer.length) { + i++; + } + + // If are at the end of the buffer there is a problem with the document + if (i >= buffer.length) throw new Error('Bad BSON Document: illegal CString'); + var name = isArray ? arrayIndex++ : buffer.toString('utf8', index, i); + + index = i + 1; + + if (elementType === BSON.BSON_DATA_STRING) { + var stringSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + if ( + stringSize <= 0 || + stringSize > buffer.length - index || + buffer[index + stringSize - 1] !== 0 + ) + throw new Error('bad string length in bson'); + object[name] = buffer.toString('utf8', index, index + stringSize - 1); + index = index + stringSize; + } else if (elementType === BSON.BSON_DATA_OID) { + var oid = new Buffer(12); + buffer.copy(oid, 0, index, index + 12); + object[name] = new ObjectID(oid); + index = index + 12; + } else if (elementType === BSON.BSON_DATA_INT && promoteValues === false) { + object[name] = new Int32( + buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24) + ); + } else if (elementType === BSON.BSON_DATA_INT) { + object[name] = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + } else if (elementType === BSON.BSON_DATA_NUMBER && promoteValues === false) { + object[name] = new Double(buffer.readDoubleLE(index)); + index = index + 8; + } else if (elementType === BSON.BSON_DATA_NUMBER) { + object[name] = buffer.readDoubleLE(index); + index = index + 8; + } else if (elementType === BSON.BSON_DATA_DATE) { + var lowBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + var highBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + object[name] = new Date(new Long(lowBits, highBits).toNumber()); + } else if (elementType === BSON.BSON_DATA_BOOLEAN) { + if (buffer[index] !== 0 && buffer[index] !== 1) throw new Error('illegal boolean type value'); + object[name] = buffer[index++] === 1; + } else if (elementType === BSON.BSON_DATA_OBJECT) { + var _index = index; + var objectSize = + buffer[index] | + (buffer[index + 1] << 8) | + (buffer[index + 2] << 16) | + (buffer[index + 3] << 24); + if (objectSize <= 0 || objectSize > buffer.length - index) + throw new Error('bad embedded document length in bson'); + + // We have a raw value + if (raw) { + object[name] = buffer.slice(index, index + objectSize); + } else { + object[name] = deserializeObject(buffer, _index, options, false); + } + + index = index + objectSize; + } else if (elementType === BSON.BSON_DATA_ARRAY) { + _index = index; + objectSize = + buffer[index] | + (buffer[index + 1] << 8) | + (buffer[index + 2] << 16) | + (buffer[index + 3] << 24); + var arrayOptions = options; + + // Stop index + var stopIndex = index + objectSize; + + // All elements of array to be returned as raw bson + if (fieldsAsRaw && fieldsAsRaw[name]) { + arrayOptions = {}; + for (var n in options) arrayOptions[n] = options[n]; + arrayOptions['raw'] = true; + } + + object[name] = deserializeObject(buffer, _index, arrayOptions, true); + index = index + objectSize; + + if (buffer[index - 1] !== 0) throw new Error('invalid array terminator byte'); + if (index !== stopIndex) throw new Error('corrupted array bson'); + } else if (elementType === BSON.BSON_DATA_UNDEFINED) { + object[name] = undefined; + } else if (elementType === BSON.BSON_DATA_NULL) { + object[name] = null; + } else if (elementType === BSON.BSON_DATA_LONG) { + // Unpack the low and high bits + lowBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + highBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + var long = new Long(lowBits, highBits); + // Promote the long if possible + if (promoteLongs && promoteValues === true) { + object[name] = + long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) + ? long.toNumber() + : long; + } else { + object[name] = long; + } + } else if (elementType === BSON.BSON_DATA_DECIMAL128) { + // Buffer to contain the decimal bytes + var bytes = new Buffer(16); + // Copy the next 16 bytes into the bytes buffer + buffer.copy(bytes, 0, index, index + 16); + // Update index + index = index + 16; + // Assign the new Decimal128 value + var decimal128 = new Decimal128(bytes); + // If we have an alternative mapper use that + object[name] = decimal128.toObject ? decimal128.toObject() : decimal128; + } else if (elementType === BSON.BSON_DATA_BINARY) { + var binarySize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + var totalBinarySize = binarySize; + var subType = buffer[index++]; + + // Did we have a negative binary size, throw + if (binarySize < 0) throw new Error('Negative binary type element size found'); + + // Is the length longer than the document + if (binarySize > buffer.length) throw new Error('Binary type size larger than document size'); + + // Decode as raw Buffer object if options specifies it + if (buffer['slice'] != null) { + // If we have subtype 2 skip the 4 bytes for the size + if (subType === Binary.SUBTYPE_BYTE_ARRAY) { + binarySize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + if (binarySize < 0) + throw new Error('Negative binary type element size found for subtype 0x02'); + if (binarySize > totalBinarySize - 4) + throw new Error('Binary type with subtype 0x02 contains to long binary size'); + if (binarySize < totalBinarySize - 4) + throw new Error('Binary type with subtype 0x02 contains to short binary size'); + } + + if (promoteBuffers && promoteValues) { + object[name] = buffer.slice(index, index + binarySize); + } else { + object[name] = new Binary(buffer.slice(index, index + binarySize), subType); + } + } else { + var _buffer = + typeof Uint8Array !== 'undefined' + ? new Uint8Array(new ArrayBuffer(binarySize)) + : new Array(binarySize); + // If we have subtype 2 skip the 4 bytes for the size + if (subType === Binary.SUBTYPE_BYTE_ARRAY) { + binarySize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + if (binarySize < 0) + throw new Error('Negative binary type element size found for subtype 0x02'); + if (binarySize > totalBinarySize - 4) + throw new Error('Binary type with subtype 0x02 contains to long binary size'); + if (binarySize < totalBinarySize - 4) + throw new Error('Binary type with subtype 0x02 contains to short binary size'); + } + + // Copy the data + for (i = 0; i < binarySize; i++) { + _buffer[i] = buffer[index + i]; + } + + if (promoteBuffers && promoteValues) { + object[name] = _buffer; + } else { + object[name] = new Binary(_buffer, subType); + } + } + + // Update the index + index = index + binarySize; + } else if (elementType === BSON.BSON_DATA_REGEXP && bsonRegExp === false) { + // Get the start search index + i = index; + // Locate the end of the c string + while (buffer[i] !== 0x00 && i < buffer.length) { + i++; + } + // If are at the end of the buffer there is a problem with the document + if (i >= buffer.length) throw new Error('Bad BSON Document: illegal CString'); + // Return the C string + var source = buffer.toString('utf8', index, i); + // Create the regexp + index = i + 1; + + // Get the start search index + i = index; + // Locate the end of the c string + while (buffer[i] !== 0x00 && i < buffer.length) { + i++; + } + // If are at the end of the buffer there is a problem with the document + if (i >= buffer.length) throw new Error('Bad BSON Document: illegal CString'); + // Return the C string + var regExpOptions = buffer.toString('utf8', index, i); + index = i + 1; + + // For each option add the corresponding one for javascript + var optionsArray = new Array(regExpOptions.length); + + // Parse options + for (i = 0; i < regExpOptions.length; i++) { + switch (regExpOptions[i]) { + case 'm': + optionsArray[i] = 'm'; + break; + case 's': + optionsArray[i] = 'g'; + break; + case 'i': + optionsArray[i] = 'i'; + break; + } + } + + object[name] = new RegExp(source, optionsArray.join('')); + } else if (elementType === BSON.BSON_DATA_REGEXP && bsonRegExp === true) { + // Get the start search index + i = index; + // Locate the end of the c string + while (buffer[i] !== 0x00 && i < buffer.length) { + i++; + } + // If are at the end of the buffer there is a problem with the document + if (i >= buffer.length) throw new Error('Bad BSON Document: illegal CString'); + // Return the C string + source = buffer.toString('utf8', index, i); + index = i + 1; + + // Get the start search index + i = index; + // Locate the end of the c string + while (buffer[i] !== 0x00 && i < buffer.length) { + i++; + } + // If are at the end of the buffer there is a problem with the document + if (i >= buffer.length) throw new Error('Bad BSON Document: illegal CString'); + // Return the C string + regExpOptions = buffer.toString('utf8', index, i); + index = i + 1; + + // Set the object + object[name] = new BSONRegExp(source, regExpOptions); + } else if (elementType === BSON.BSON_DATA_SYMBOL) { + stringSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + if ( + stringSize <= 0 || + stringSize > buffer.length - index || + buffer[index + stringSize - 1] !== 0 + ) + throw new Error('bad string length in bson'); + object[name] = new Symbol(buffer.toString('utf8', index, index + stringSize - 1)); + index = index + stringSize; + } else if (elementType === BSON.BSON_DATA_TIMESTAMP) { + lowBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + highBits = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + object[name] = new Timestamp(lowBits, highBits); + } else if (elementType === BSON.BSON_DATA_MIN_KEY) { + object[name] = new MinKey(); + } else if (elementType === BSON.BSON_DATA_MAX_KEY) { + object[name] = new MaxKey(); + } else if (elementType === BSON.BSON_DATA_CODE) { + stringSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + if ( + stringSize <= 0 || + stringSize > buffer.length - index || + buffer[index + stringSize - 1] !== 0 + ) + throw new Error('bad string length in bson'); + var functionString = buffer.toString('utf8', index, index + stringSize - 1); + + // If we are evaluating the functions + if (evalFunctions) { + // If we have cache enabled let's look for the md5 of the function in the cache + if (cacheFunctions) { + var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; + // Got to do this to avoid V8 deoptimizing the call due to finding eval + object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); + } else { + object[name] = isolateEval(functionString); + } + } else { + object[name] = new Code(functionString); + } + + // Update parse index position + index = index + stringSize; + } else if (elementType === BSON.BSON_DATA_CODE_W_SCOPE) { + var totalSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + + // Element cannot be shorter than totalSize + stringSize + documentSize + terminator + if (totalSize < 4 + 4 + 4 + 1) { + throw new Error('code_w_scope total size shorter minimum expected length'); + } + + // Get the code string size + stringSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + // Check if we have a valid string + if ( + stringSize <= 0 || + stringSize > buffer.length - index || + buffer[index + stringSize - 1] !== 0 + ) + throw new Error('bad string length in bson'); + + // Javascript function + functionString = buffer.toString('utf8', index, index + stringSize - 1); + // Update parse index position + index = index + stringSize; + // Parse the element + _index = index; + // Decode the size of the object document + objectSize = + buffer[index] | + (buffer[index + 1] << 8) | + (buffer[index + 2] << 16) | + (buffer[index + 3] << 24); + // Decode the scope object + var scopeObject = deserializeObject(buffer, _index, options, false); + // Adjust the index + index = index + objectSize; + + // Check if field length is to short + if (totalSize < 4 + 4 + objectSize + stringSize) { + throw new Error('code_w_scope total size is to short, truncating scope'); + } + + // Check if totalSize field is to long + if (totalSize > 4 + 4 + objectSize + stringSize) { + throw new Error('code_w_scope total size is to long, clips outer document'); + } + + // If we are evaluating the functions + if (evalFunctions) { + // If we have cache enabled let's look for the md5 of the function in the cache + if (cacheFunctions) { + hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; + // Got to do this to avoid V8 deoptimizing the call due to finding eval + object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); + } else { + object[name] = isolateEval(functionString); + } + + object[name].scope = scopeObject; + } else { + object[name] = new Code(functionString, scopeObject); + } + } else if (elementType === BSON.BSON_DATA_DBPOINTER) { + // Get the code string size + stringSize = + buffer[index++] | + (buffer[index++] << 8) | + (buffer[index++] << 16) | + (buffer[index++] << 24); + // Check if we have a valid string + if ( + stringSize <= 0 || + stringSize > buffer.length - index || + buffer[index + stringSize - 1] !== 0 + ) + throw new Error('bad string length in bson'); + // Namespace + var namespace = buffer.toString('utf8', index, index + stringSize - 1); + // Update parse index position + index = index + stringSize; + + // Read the oid + var oidBuffer = new Buffer(12); + buffer.copy(oidBuffer, 0, index, index + 12); + oid = new ObjectID(oidBuffer); + + // Update the index + index = index + 12; + + // Split the namespace + var parts = namespace.split('.'); + var db = parts.shift(); + var collection = parts.join('.'); + // Upgrade to DBRef type + object[name] = new DBRef(collection, oid, db); + } else { + throw new Error( + 'Detected unknown BSON type ' + + elementType.toString(16) + + ' for fieldname "' + + name + + '", are you using the latest BSON parser' + ); + } + } + + // Check if the deserialization was against a valid array/object + if (size !== index - startIndex) { + if (isArray) throw new Error('corrupt array bson'); + throw new Error('corrupt object bson'); + } + + // Check if we have a db ref object + if (object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']); + return object; +}; + +/** + * Ensure eval is isolated. + * + * @ignore + * @api private + */ +var isolateEvalWithHash = function(functionCache, hash, functionString, object) { + // Contains the value we are going to set + var value = null; + + // Check for cache hit, eval if missing and return cached function + if (functionCache[hash] == null) { + eval('value = ' + functionString); + functionCache[hash] = value; + } + // Set the object + return functionCache[hash].bind(object); +}; + +/** + * Ensure eval is isolated. + * + * @ignore + * @api private + */ +var isolateEval = function(functionString) { + // Contains the value we are going to set + var value = null; + // Eval the function + eval('value = ' + functionString); + return value; +}; + +var BSON = {}; + +/** + * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 + * + * @ignore + * @api private + */ +var functionCache = (BSON.functionCache = {}); + +/** + * Number BSON Type + * + * @classconstant BSON_DATA_NUMBER + **/ +BSON.BSON_DATA_NUMBER = 1; +/** + * String BSON Type + * + * @classconstant BSON_DATA_STRING + **/ +BSON.BSON_DATA_STRING = 2; +/** + * Object BSON Type + * + * @classconstant BSON_DATA_OBJECT + **/ +BSON.BSON_DATA_OBJECT = 3; +/** + * Array BSON Type + * + * @classconstant BSON_DATA_ARRAY + **/ +BSON.BSON_DATA_ARRAY = 4; +/** + * Binary BSON Type + * + * @classconstant BSON_DATA_BINARY + **/ +BSON.BSON_DATA_BINARY = 5; +/** + * Binary BSON Type + * + * @classconstant BSON_DATA_UNDEFINED + **/ +BSON.BSON_DATA_UNDEFINED = 6; +/** + * ObjectID BSON Type + * + * @classconstant BSON_DATA_OID + **/ +BSON.BSON_DATA_OID = 7; +/** + * Boolean BSON Type + * + * @classconstant BSON_DATA_BOOLEAN + **/ +BSON.BSON_DATA_BOOLEAN = 8; +/** + * Date BSON Type + * + * @classconstant BSON_DATA_DATE + **/ +BSON.BSON_DATA_DATE = 9; +/** + * null BSON Type + * + * @classconstant BSON_DATA_NULL + **/ +BSON.BSON_DATA_NULL = 10; +/** + * RegExp BSON Type + * + * @classconstant BSON_DATA_REGEXP + **/ +BSON.BSON_DATA_REGEXP = 11; +/** + * Code BSON Type + * + * @classconstant BSON_DATA_DBPOINTER + **/ +BSON.BSON_DATA_DBPOINTER = 12; +/** + * Code BSON Type + * + * @classconstant BSON_DATA_CODE + **/ +BSON.BSON_DATA_CODE = 13; +/** + * Symbol BSON Type + * + * @classconstant BSON_DATA_SYMBOL + **/ +BSON.BSON_DATA_SYMBOL = 14; +/** + * Code with Scope BSON Type + * + * @classconstant BSON_DATA_CODE_W_SCOPE + **/ +BSON.BSON_DATA_CODE_W_SCOPE = 15; +/** + * 32 bit Integer BSON Type + * + * @classconstant BSON_DATA_INT + **/ +BSON.BSON_DATA_INT = 16; +/** + * Timestamp BSON Type + * + * @classconstant BSON_DATA_TIMESTAMP + **/ +BSON.BSON_DATA_TIMESTAMP = 17; +/** + * Long BSON Type + * + * @classconstant BSON_DATA_LONG + **/ +BSON.BSON_DATA_LONG = 18; +/** + * Long BSON Type + * + * @classconstant BSON_DATA_DECIMAL128 + **/ +BSON.BSON_DATA_DECIMAL128 = 19; +/** + * MinKey BSON Type + * + * @classconstant BSON_DATA_MIN_KEY + **/ +BSON.BSON_DATA_MIN_KEY = 0xff; +/** + * MaxKey BSON Type + * + * @classconstant BSON_DATA_MAX_KEY + **/ +BSON.BSON_DATA_MAX_KEY = 0x7f; + +/** + * Binary Default Type + * + * @classconstant BSON_BINARY_SUBTYPE_DEFAULT + **/ +BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; +/** + * Binary Function Type + * + * @classconstant BSON_BINARY_SUBTYPE_FUNCTION + **/ +BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; +/** + * Binary Byte Array Type + * + * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY + **/ +BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; +/** + * Binary UUID Type + * + * @classconstant BSON_BINARY_SUBTYPE_UUID + **/ +BSON.BSON_BINARY_SUBTYPE_UUID = 3; +/** + * Binary MD5 Type + * + * @classconstant BSON_BINARY_SUBTYPE_MD5 + **/ +BSON.BSON_BINARY_SUBTYPE_MD5 = 4; +/** + * Binary User Defined Type + * + * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED + **/ +BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; + +// BSON MAX VALUES +BSON.BSON_INT32_MAX = 0x7fffffff; +BSON.BSON_INT32_MIN = -0x80000000; + +BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; +BSON.BSON_INT64_MIN = -Math.pow(2, 63); + +// JS MAX PRECISE VALUES +BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. +BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. + +// Internal long versions +var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. +var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. + +module.exports = deserialize; diff --git a/node_modules/bson/lib/bson/parser/serializer.js b/node_modules/bson/lib/bson/parser/serializer.js new file mode 100644 index 0000000..56b7d8e --- /dev/null +++ b/node_modules/bson/lib/bson/parser/serializer.js @@ -0,0 +1,1179 @@ +'use strict'; + +var writeIEEE754 = require('../float_parser').writeIEEE754, + Long = require('../long').Long, + MinKey = require('../min_key').MinKey, + Map = require('../map'), + Binary = require('../binary').Binary; + +// try { +// var _Buffer = Uint8Array; +// } catch (e) { +// _Buffer = Buffer; +// } + +var regexp = /\x00/; // eslint-disable-line no-control-regex + +// To ensure that 0.4 of node works correctly +var isDate = function isDate(d) { + return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]'; +}; + +var isRegExp = function isRegExp(d) { + return Object.prototype.toString.call(d) === '[object RegExp]'; +}; + +var serializeString = function(buffer, key, value, index, isArray) { + // Encode String type + buffer[index++] = BSON.BSON_DATA_STRING; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes + 1; + buffer[index - 1] = 0; + // Write the string + var size = buffer.write(value, index + 4, 'utf8'); + // Write the size of the string to buffer + buffer[index + 3] = ((size + 1) >> 24) & 0xff; + buffer[index + 2] = ((size + 1) >> 16) & 0xff; + buffer[index + 1] = ((size + 1) >> 8) & 0xff; + buffer[index] = (size + 1) & 0xff; + // Update index + index = index + 4 + size; + // Write zero + buffer[index++] = 0; + return index; +}; + +var serializeNumber = function(buffer, key, value, index, isArray) { + // We have an integer value + if (Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { + // If the value fits in 32 bits encode as int, if it fits in a double + // encode it as a double, otherwise long + if (value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { + // Set int type 32 bits or less + buffer[index++] = BSON.BSON_DATA_INT; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write the int value + buffer[index++] = value & 0xff; + buffer[index++] = (value >> 8) & 0xff; + buffer[index++] = (value >> 16) & 0xff; + buffer[index++] = (value >> 24) & 0xff; + } else if (value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { + // Encode as double + buffer[index++] = BSON.BSON_DATA_NUMBER; + // Number of written bytes + numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write float + writeIEEE754(buffer, value, index, 'little', 52, 8); + // Ajust index + index = index + 8; + } else { + // Set long type + buffer[index++] = BSON.BSON_DATA_LONG; + // Number of written bytes + numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + var longVal = Long.fromNumber(value); + var lowBits = longVal.getLowBits(); + var highBits = longVal.getHighBits(); + // Encode low bits + buffer[index++] = lowBits & 0xff; + buffer[index++] = (lowBits >> 8) & 0xff; + buffer[index++] = (lowBits >> 16) & 0xff; + buffer[index++] = (lowBits >> 24) & 0xff; + // Encode high bits + buffer[index++] = highBits & 0xff; + buffer[index++] = (highBits >> 8) & 0xff; + buffer[index++] = (highBits >> 16) & 0xff; + buffer[index++] = (highBits >> 24) & 0xff; + } + } else { + // Encode as double + buffer[index++] = BSON.BSON_DATA_NUMBER; + // Number of written bytes + numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write float + writeIEEE754(buffer, value, index, 'little', 52, 8); + // Ajust index + index = index + 8; + } + + return index; +}; + +var serializeNull = function(buffer, key, value, index, isArray) { + // Set long type + buffer[index++] = BSON.BSON_DATA_NULL; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + return index; +}; + +var serializeBoolean = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_BOOLEAN; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Encode the boolean value + buffer[index++] = value ? 1 : 0; + return index; +}; + +var serializeDate = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_DATE; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + + // Write the date + var dateInMilis = Long.fromNumber(value.getTime()); + var lowBits = dateInMilis.getLowBits(); + var highBits = dateInMilis.getHighBits(); + // Encode low bits + buffer[index++] = lowBits & 0xff; + buffer[index++] = (lowBits >> 8) & 0xff; + buffer[index++] = (lowBits >> 16) & 0xff; + buffer[index++] = (lowBits >> 24) & 0xff; + // Encode high bits + buffer[index++] = highBits & 0xff; + buffer[index++] = (highBits >> 8) & 0xff; + buffer[index++] = (highBits >> 16) & 0xff; + buffer[index++] = (highBits >> 24) & 0xff; + return index; +}; + +var serializeRegExp = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_REGEXP; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + if (value.source && value.source.match(regexp) != null) { + throw Error('value ' + value.source + ' must not contain null bytes'); + } + // Adjust the index + index = index + buffer.write(value.source, index, 'utf8'); + // Write zero + buffer[index++] = 0x00; + // Write the parameters + if (value.global) buffer[index++] = 0x73; // s + if (value.ignoreCase) buffer[index++] = 0x69; // i + if (value.multiline) buffer[index++] = 0x6d; // m + // Add ending zero + buffer[index++] = 0x00; + return index; +}; + +var serializeBSONRegExp = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_REGEXP; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + + // Check the pattern for 0 bytes + if (value.pattern.match(regexp) != null) { + // The BSON spec doesn't allow keys with null bytes because keys are + // null-terminated. + throw Error('pattern ' + value.pattern + ' must not contain null bytes'); + } + + // Adjust the index + index = index + buffer.write(value.pattern, index, 'utf8'); + // Write zero + buffer[index++] = 0x00; + // Write the options + index = + index + + buffer.write( + value.options + .split('') + .sort() + .join(''), + index, + 'utf8' + ); + // Add ending zero + buffer[index++] = 0x00; + return index; +}; + +var serializeMinMax = function(buffer, key, value, index, isArray) { + // Write the type of either min or max key + if (value === null) { + buffer[index++] = BSON.BSON_DATA_NULL; + } else if (value instanceof MinKey) { + buffer[index++] = BSON.BSON_DATA_MIN_KEY; + } else { + buffer[index++] = BSON.BSON_DATA_MAX_KEY; + } + + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + return index; +}; + +var serializeObjectId = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_OID; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + + // Write the objectId into the shared buffer + if (typeof value.id === 'string') { + buffer.write(value.id, index, 'binary'); + } else if (value.id && value.id.copy) { + value.id.copy(buffer, index, 0, 12); + } else { + throw new Error('object [' + JSON.stringify(value) + '] is not a valid ObjectId'); + } + + // Ajust index + return index + 12; +}; + +var serializeBuffer = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_BINARY; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Get size of the buffer (current write point) + var size = value.length; + // Write the size of the string to buffer + buffer[index++] = size & 0xff; + buffer[index++] = (size >> 8) & 0xff; + buffer[index++] = (size >> 16) & 0xff; + buffer[index++] = (size >> 24) & 0xff; + // Write the default subtype + buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT; + // Copy the content form the binary field to the buffer + value.copy(buffer, index, 0, size); + // Adjust the index + index = index + size; + return index; +}; + +var serializeObject = function( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + isArray, + path +) { + for (var i = 0; i < path.length; i++) { + if (path[i] === value) throw new Error('cyclic dependency detected'); + } + + // Push value to stack + path.push(value); + // Write the type + buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + var endIndex = serializeInto( + buffer, + value, + checkKeys, + index, + depth + 1, + serializeFunctions, + ignoreUndefined, + path + ); + // Pop stack + path.pop(); + // Write size + return endIndex; +}; + +var serializeDecimal128 = function(buffer, key, value, index, isArray) { + buffer[index++] = BSON.BSON_DATA_DECIMAL128; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write the data from the value + value.bytes.copy(buffer, index, 0, 16); + return index + 16; +}; + +var serializeLong = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = value._bsontype === 'Long' ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write the date + var lowBits = value.getLowBits(); + var highBits = value.getHighBits(); + // Encode low bits + buffer[index++] = lowBits & 0xff; + buffer[index++] = (lowBits >> 8) & 0xff; + buffer[index++] = (lowBits >> 16) & 0xff; + buffer[index++] = (lowBits >> 24) & 0xff; + // Encode high bits + buffer[index++] = highBits & 0xff; + buffer[index++] = (highBits >> 8) & 0xff; + buffer[index++] = (highBits >> 16) & 0xff; + buffer[index++] = (highBits >> 24) & 0xff; + return index; +}; + +var serializeInt32 = function(buffer, key, value, index, isArray) { + // Set int type 32 bits or less + buffer[index++] = BSON.BSON_DATA_INT; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write the int value + buffer[index++] = value & 0xff; + buffer[index++] = (value >> 8) & 0xff; + buffer[index++] = (value >> 16) & 0xff; + buffer[index++] = (value >> 24) & 0xff; + return index; +}; + +var serializeDouble = function(buffer, key, value, index, isArray) { + // Encode as double + buffer[index++] = BSON.BSON_DATA_NUMBER; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write float + writeIEEE754(buffer, value, index, 'little', 52, 8); + // Ajust index + index = index + 8; + return index; +}; + +var serializeFunction = function(buffer, key, value, index, checkKeys, depth, isArray) { + buffer[index++] = BSON.BSON_DATA_CODE; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Function string + var functionString = value.toString(); + // Write the string + var size = buffer.write(functionString, index + 4, 'utf8') + 1; + // Write the size of the string to buffer + buffer[index] = size & 0xff; + buffer[index + 1] = (size >> 8) & 0xff; + buffer[index + 2] = (size >> 16) & 0xff; + buffer[index + 3] = (size >> 24) & 0xff; + // Update index + index = index + 4 + size - 1; + // Write zero + buffer[index++] = 0; + return index; +}; + +var serializeCode = function( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + isArray +) { + if (value.scope && typeof value.scope === 'object') { + // Write the type + buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + + // Starting index + var startIndex = index; + + // Serialize the function + // Get the function string + var functionString = typeof value.code === 'string' ? value.code : value.code.toString(); + // Index adjustment + index = index + 4; + // Write string into buffer + var codeSize = buffer.write(functionString, index + 4, 'utf8') + 1; + // Write the size of the string to buffer + buffer[index] = codeSize & 0xff; + buffer[index + 1] = (codeSize >> 8) & 0xff; + buffer[index + 2] = (codeSize >> 16) & 0xff; + buffer[index + 3] = (codeSize >> 24) & 0xff; + // Write end 0 + buffer[index + 4 + codeSize - 1] = 0; + // Write the + index = index + codeSize + 4; + + // + // Serialize the scope value + var endIndex = serializeInto( + buffer, + value.scope, + checkKeys, + index, + depth + 1, + serializeFunctions, + ignoreUndefined + ); + index = endIndex - 1; + + // Writ the total + var totalSize = endIndex - startIndex; + + // Write the total size of the object + buffer[startIndex++] = totalSize & 0xff; + buffer[startIndex++] = (totalSize >> 8) & 0xff; + buffer[startIndex++] = (totalSize >> 16) & 0xff; + buffer[startIndex++] = (totalSize >> 24) & 0xff; + // Write trailing zero + buffer[index++] = 0; + } else { + buffer[index++] = BSON.BSON_DATA_CODE; + // Number of written bytes + numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Function string + functionString = value.code.toString(); + // Write the string + var size = buffer.write(functionString, index + 4, 'utf8') + 1; + // Write the size of the string to buffer + buffer[index] = size & 0xff; + buffer[index + 1] = (size >> 8) & 0xff; + buffer[index + 2] = (size >> 16) & 0xff; + buffer[index + 3] = (size >> 24) & 0xff; + // Update index + index = index + 4 + size - 1; + // Write zero + buffer[index++] = 0; + } + + return index; +}; + +var serializeBinary = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_BINARY; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Extract the buffer + var data = value.value(true); + // Calculate size + var size = value.position; + // Add the deprecated 02 type 4 bytes of size to total + if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) size = size + 4; + // Write the size of the string to buffer + buffer[index++] = size & 0xff; + buffer[index++] = (size >> 8) & 0xff; + buffer[index++] = (size >> 16) & 0xff; + buffer[index++] = (size >> 24) & 0xff; + // Write the subtype to the buffer + buffer[index++] = value.sub_type; + + // If we have binary type 2 the 4 first bytes are the size + if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) { + size = size - 4; + buffer[index++] = size & 0xff; + buffer[index++] = (size >> 8) & 0xff; + buffer[index++] = (size >> 16) & 0xff; + buffer[index++] = (size >> 24) & 0xff; + } + + // Write the data to the object + data.copy(buffer, index, 0, value.position); + // Adjust the index + index = index + value.position; + return index; +}; + +var serializeSymbol = function(buffer, key, value, index, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_SYMBOL; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + // Write the string + var size = buffer.write(value.value, index + 4, 'utf8') + 1; + // Write the size of the string to buffer + buffer[index] = size & 0xff; + buffer[index + 1] = (size >> 8) & 0xff; + buffer[index + 2] = (size >> 16) & 0xff; + buffer[index + 3] = (size >> 24) & 0xff; + // Update index + index = index + 4 + size - 1; + // Write zero + buffer[index++] = 0x00; + return index; +}; + +var serializeDBRef = function(buffer, key, value, index, depth, serializeFunctions, isArray) { + // Write the type + buffer[index++] = BSON.BSON_DATA_OBJECT; + // Number of written bytes + var numberOfWrittenBytes = !isArray + ? buffer.write(key, index, 'utf8') + : buffer.write(key, index, 'ascii'); + + // Encode the name + index = index + numberOfWrittenBytes; + buffer[index++] = 0; + + var startIndex = index; + var endIndex; + + // Serialize object + if (null != value.db) { + endIndex = serializeInto( + buffer, + { + $ref: value.namespace, + $id: value.oid, + $db: value.db + }, + false, + index, + depth + 1, + serializeFunctions + ); + } else { + endIndex = serializeInto( + buffer, + { + $ref: value.namespace, + $id: value.oid + }, + false, + index, + depth + 1, + serializeFunctions + ); + } + + // Calculate object size + var size = endIndex - startIndex; + // Write the size + buffer[startIndex++] = size & 0xff; + buffer[startIndex++] = (size >> 8) & 0xff; + buffer[startIndex++] = (size >> 16) & 0xff; + buffer[startIndex++] = (size >> 24) & 0xff; + // Set index + return endIndex; +}; + +var serializeInto = function serializeInto( + buffer, + object, + checkKeys, + startingIndex, + depth, + serializeFunctions, + ignoreUndefined, + path +) { + startingIndex = startingIndex || 0; + path = path || []; + + // Push the object to the path + path.push(object); + + // Start place to serialize into + var index = startingIndex + 4; + // var self = this; + + // Special case isArray + if (Array.isArray(object)) { + // Get object keys + for (var i = 0; i < object.length; i++) { + var key = '' + i; + var value = object[i]; + + // Is there an override value + if (value && value.toBSON) { + if (typeof value.toBSON !== 'function') throw new Error('toBSON is not a function'); + value = value.toBSON(); + } + + var type = typeof value; + if (type === 'string') { + index = serializeString(buffer, key, value, index, true); + } else if (type === 'number') { + index = serializeNumber(buffer, key, value, index, true); + } else if (type === 'boolean') { + index = serializeBoolean(buffer, key, value, index, true); + } else if (value instanceof Date || isDate(value)) { + index = serializeDate(buffer, key, value, index, true); + } else if (value === undefined) { + index = serializeNull(buffer, key, value, index, true); + } else if (value === null) { + index = serializeNull(buffer, key, value, index, true); + } else if (value['_bsontype'] === 'ObjectID') { + index = serializeObjectId(buffer, key, value, index, true); + } else if (Buffer.isBuffer(value)) { + index = serializeBuffer(buffer, key, value, index, true); + } else if (value instanceof RegExp || isRegExp(value)) { + index = serializeRegExp(buffer, key, value, index, true); + } else if (type === 'object' && value['_bsontype'] == null) { + index = serializeObject( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + true, + path + ); + } else if (type === 'object' && value['_bsontype'] === 'Decimal128') { + index = serializeDecimal128(buffer, key, value, index, true); + } else if (value['_bsontype'] === 'Long' || value['_bsontype'] === 'Timestamp') { + index = serializeLong(buffer, key, value, index, true); + } else if (value['_bsontype'] === 'Double') { + index = serializeDouble(buffer, key, value, index, true); + } else if (typeof value === 'function' && serializeFunctions) { + index = serializeFunction( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + true + ); + } else if (value['_bsontype'] === 'Code') { + index = serializeCode( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + true + ); + } else if (value['_bsontype'] === 'Binary') { + index = serializeBinary(buffer, key, value, index, true); + } else if (value['_bsontype'] === 'Symbol') { + index = serializeSymbol(buffer, key, value, index, true); + } else if (value['_bsontype'] === 'DBRef') { + index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, true); + } else if (value['_bsontype'] === 'BSONRegExp') { + index = serializeBSONRegExp(buffer, key, value, index, true); + } else if (value['_bsontype'] === 'Int32') { + index = serializeInt32(buffer, key, value, index, true); + } else if (value['_bsontype'] === 'MinKey' || value['_bsontype'] === 'MaxKey') { + index = serializeMinMax(buffer, key, value, index, true); + } + } + } else if (object instanceof Map) { + var iterator = object.entries(); + var done = false; + + while (!done) { + // Unpack the next entry + var entry = iterator.next(); + done = entry.done; + // Are we done, then skip and terminate + if (done) continue; + + // Get the entry values + key = entry.value[0]; + value = entry.value[1]; + + // Check the type of the value + type = typeof value; + + // Check the key and throw error if it's illegal + if (key !== '$db' && key !== '$ref' && key !== '$id') { + if (key.match(regexp) != null) { + // The BSON spec doesn't allow keys with null bytes because keys are + // null-terminated. + throw Error('key ' + key + ' must not contain null bytes'); + } + + if (checkKeys) { + if ('$' === key[0]) { + throw Error('key ' + key + " must not start with '$'"); + } else if (~key.indexOf('.')) { + throw Error('key ' + key + " must not contain '.'"); + } + } + } + + if (type === 'string') { + index = serializeString(buffer, key, value, index); + } else if (type === 'number') { + index = serializeNumber(buffer, key, value, index); + } else if (type === 'boolean') { + index = serializeBoolean(buffer, key, value, index); + } else if (value instanceof Date || isDate(value)) { + index = serializeDate(buffer, key, value, index); + // } else if (value === undefined && ignoreUndefined === true) { + } else if (value === null || (value === undefined && ignoreUndefined === false)) { + index = serializeNull(buffer, key, value, index); + } else if (value['_bsontype'] === 'ObjectID') { + index = serializeObjectId(buffer, key, value, index); + } else if (Buffer.isBuffer(value)) { + index = serializeBuffer(buffer, key, value, index); + } else if (value instanceof RegExp || isRegExp(value)) { + index = serializeRegExp(buffer, key, value, index); + } else if (type === 'object' && value['_bsontype'] == null) { + index = serializeObject( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + false, + path + ); + } else if (type === 'object' && value['_bsontype'] === 'Decimal128') { + index = serializeDecimal128(buffer, key, value, index); + } else if (value['_bsontype'] === 'Long' || value['_bsontype'] === 'Timestamp') { + index = serializeLong(buffer, key, value, index); + } else if (value['_bsontype'] === 'Double') { + index = serializeDouble(buffer, key, value, index); + } else if (value['_bsontype'] === 'Code') { + index = serializeCode( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined + ); + } else if (typeof value === 'function' && serializeFunctions) { + index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions); + } else if (value['_bsontype'] === 'Binary') { + index = serializeBinary(buffer, key, value, index); + } else if (value['_bsontype'] === 'Symbol') { + index = serializeSymbol(buffer, key, value, index); + } else if (value['_bsontype'] === 'DBRef') { + index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions); + } else if (value['_bsontype'] === 'BSONRegExp') { + index = serializeBSONRegExp(buffer, key, value, index); + } else if (value['_bsontype'] === 'Int32') { + index = serializeInt32(buffer, key, value, index); + } else if (value['_bsontype'] === 'MinKey' || value['_bsontype'] === 'MaxKey') { + index = serializeMinMax(buffer, key, value, index); + } + } + } else { + // Did we provide a custom serialization method + if (object.toBSON) { + if (typeof object.toBSON !== 'function') throw new Error('toBSON is not a function'); + object = object.toBSON(); + if (object != null && typeof object !== 'object') + throw new Error('toBSON function did not return an object'); + } + + // Iterate over all the keys + for (key in object) { + value = object[key]; + // Is there an override value + if (value && value.toBSON) { + if (typeof value.toBSON !== 'function') throw new Error('toBSON is not a function'); + value = value.toBSON(); + } + + // Check the type of the value + type = typeof value; + + // Check the key and throw error if it's illegal + if (key !== '$db' && key !== '$ref' && key !== '$id') { + if (key.match(regexp) != null) { + // The BSON spec doesn't allow keys with null bytes because keys are + // null-terminated. + throw Error('key ' + key + ' must not contain null bytes'); + } + + if (checkKeys) { + if ('$' === key[0]) { + throw Error('key ' + key + " must not start with '$'"); + } else if (~key.indexOf('.')) { + throw Error('key ' + key + " must not contain '.'"); + } + } + } + + if (type === 'string') { + index = serializeString(buffer, key, value, index); + } else if (type === 'number') { + index = serializeNumber(buffer, key, value, index); + } else if (type === 'boolean') { + index = serializeBoolean(buffer, key, value, index); + } else if (value instanceof Date || isDate(value)) { + index = serializeDate(buffer, key, value, index); + } else if (value === undefined) { + if (ignoreUndefined === false) index = serializeNull(buffer, key, value, index); + } else if (value === null) { + index = serializeNull(buffer, key, value, index); + } else if (value['_bsontype'] === 'ObjectID') { + index = serializeObjectId(buffer, key, value, index); + } else if (Buffer.isBuffer(value)) { + index = serializeBuffer(buffer, key, value, index); + } else if (value instanceof RegExp || isRegExp(value)) { + index = serializeRegExp(buffer, key, value, index); + } else if (type === 'object' && value['_bsontype'] == null) { + index = serializeObject( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined, + false, + path + ); + } else if (type === 'object' && value['_bsontype'] === 'Decimal128') { + index = serializeDecimal128(buffer, key, value, index); + } else if (value['_bsontype'] === 'Long' || value['_bsontype'] === 'Timestamp') { + index = serializeLong(buffer, key, value, index); + } else if (value['_bsontype'] === 'Double') { + index = serializeDouble(buffer, key, value, index); + } else if (value['_bsontype'] === 'Code') { + index = serializeCode( + buffer, + key, + value, + index, + checkKeys, + depth, + serializeFunctions, + ignoreUndefined + ); + } else if (typeof value === 'function' && serializeFunctions) { + index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions); + } else if (value['_bsontype'] === 'Binary') { + index = serializeBinary(buffer, key, value, index); + } else if (value['_bsontype'] === 'Symbol') { + index = serializeSymbol(buffer, key, value, index); + } else if (value['_bsontype'] === 'DBRef') { + index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions); + } else if (value['_bsontype'] === 'BSONRegExp') { + index = serializeBSONRegExp(buffer, key, value, index); + } else if (value['_bsontype'] === 'Int32') { + index = serializeInt32(buffer, key, value, index); + } else if (value['_bsontype'] === 'MinKey' || value['_bsontype'] === 'MaxKey') { + index = serializeMinMax(buffer, key, value, index); + } + } + } + + // Remove the path + path.pop(); + + // Final padding byte for object + buffer[index++] = 0x00; + + // Final size + var size = index - startingIndex; + // Write the size of the object + buffer[startingIndex++] = size & 0xff; + buffer[startingIndex++] = (size >> 8) & 0xff; + buffer[startingIndex++] = (size >> 16) & 0xff; + buffer[startingIndex++] = (size >> 24) & 0xff; + return index; +}; + +var BSON = {}; + +/** + * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 + * + * @ignore + * @api private + */ +// var functionCache = (BSON.functionCache = {}); + +/** + * Number BSON Type + * + * @classconstant BSON_DATA_NUMBER + **/ +BSON.BSON_DATA_NUMBER = 1; +/** + * String BSON Type + * + * @classconstant BSON_DATA_STRING + **/ +BSON.BSON_DATA_STRING = 2; +/** + * Object BSON Type + * + * @classconstant BSON_DATA_OBJECT + **/ +BSON.BSON_DATA_OBJECT = 3; +/** + * Array BSON Type + * + * @classconstant BSON_DATA_ARRAY + **/ +BSON.BSON_DATA_ARRAY = 4; +/** + * Binary BSON Type + * + * @classconstant BSON_DATA_BINARY + **/ +BSON.BSON_DATA_BINARY = 5; +/** + * ObjectID BSON Type, deprecated + * + * @classconstant BSON_DATA_UNDEFINED + **/ +BSON.BSON_DATA_UNDEFINED = 6; +/** + * ObjectID BSON Type + * + * @classconstant BSON_DATA_OID + **/ +BSON.BSON_DATA_OID = 7; +/** + * Boolean BSON Type + * + * @classconstant BSON_DATA_BOOLEAN + **/ +BSON.BSON_DATA_BOOLEAN = 8; +/** + * Date BSON Type + * + * @classconstant BSON_DATA_DATE + **/ +BSON.BSON_DATA_DATE = 9; +/** + * null BSON Type + * + * @classconstant BSON_DATA_NULL + **/ +BSON.BSON_DATA_NULL = 10; +/** + * RegExp BSON Type + * + * @classconstant BSON_DATA_REGEXP + **/ +BSON.BSON_DATA_REGEXP = 11; +/** + * Code BSON Type + * + * @classconstant BSON_DATA_CODE + **/ +BSON.BSON_DATA_CODE = 13; +/** + * Symbol BSON Type + * + * @classconstant BSON_DATA_SYMBOL + **/ +BSON.BSON_DATA_SYMBOL = 14; +/** + * Code with Scope BSON Type + * + * @classconstant BSON_DATA_CODE_W_SCOPE + **/ +BSON.BSON_DATA_CODE_W_SCOPE = 15; +/** + * 32 bit Integer BSON Type + * + * @classconstant BSON_DATA_INT + **/ +BSON.BSON_DATA_INT = 16; +/** + * Timestamp BSON Type + * + * @classconstant BSON_DATA_TIMESTAMP + **/ +BSON.BSON_DATA_TIMESTAMP = 17; +/** + * Long BSON Type + * + * @classconstant BSON_DATA_LONG + **/ +BSON.BSON_DATA_LONG = 18; +/** + * Long BSON Type + * + * @classconstant BSON_DATA_DECIMAL128 + **/ +BSON.BSON_DATA_DECIMAL128 = 19; +/** + * MinKey BSON Type + * + * @classconstant BSON_DATA_MIN_KEY + **/ +BSON.BSON_DATA_MIN_KEY = 0xff; +/** + * MaxKey BSON Type + * + * @classconstant BSON_DATA_MAX_KEY + **/ +BSON.BSON_DATA_MAX_KEY = 0x7f; +/** + * Binary Default Type + * + * @classconstant BSON_BINARY_SUBTYPE_DEFAULT + **/ +BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; +/** + * Binary Function Type + * + * @classconstant BSON_BINARY_SUBTYPE_FUNCTION + **/ +BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; +/** + * Binary Byte Array Type + * + * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY + **/ +BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; +/** + * Binary UUID Type + * + * @classconstant BSON_BINARY_SUBTYPE_UUID + **/ +BSON.BSON_BINARY_SUBTYPE_UUID = 3; +/** + * Binary MD5 Type + * + * @classconstant BSON_BINARY_SUBTYPE_MD5 + **/ +BSON.BSON_BINARY_SUBTYPE_MD5 = 4; +/** + * Binary User Defined Type + * + * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED + **/ +BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; + +// BSON MAX VALUES +BSON.BSON_INT32_MAX = 0x7fffffff; +BSON.BSON_INT32_MIN = -0x80000000; + +BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; +BSON.BSON_INT64_MIN = -Math.pow(2, 63); + +// JS MAX PRECISE VALUES +BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. +BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. + +// Internal long versions +// var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. +// var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. + +module.exports = serializeInto; diff --git a/node_modules/bson/lib/bson/regexp.js b/node_modules/bson/lib/bson/regexp.js new file mode 100644 index 0000000..108f016 --- /dev/null +++ b/node_modules/bson/lib/bson/regexp.js @@ -0,0 +1,33 @@ +/** + * A class representation of the BSON RegExp type. + * + * @class + * @return {BSONRegExp} A MinKey instance + */ +function BSONRegExp(pattern, options) { + if (!(this instanceof BSONRegExp)) return new BSONRegExp(); + + // Execute + this._bsontype = 'BSONRegExp'; + this.pattern = pattern || ''; + this.options = options || ''; + + // Validate options + for (var i = 0; i < this.options.length; i++) { + if ( + !( + this.options[i] === 'i' || + this.options[i] === 'm' || + this.options[i] === 'x' || + this.options[i] === 'l' || + this.options[i] === 's' || + this.options[i] === 'u' + ) + ) { + throw new Error('the regular expression options [' + this.options[i] + '] is not supported'); + } + } +} + +module.exports = BSONRegExp; +module.exports.BSONRegExp = BSONRegExp; diff --git a/node_modules/bson/lib/bson/symbol.js b/node_modules/bson/lib/bson/symbol.js new file mode 100644 index 0000000..ed8bc13 --- /dev/null +++ b/node_modules/bson/lib/bson/symbol.js @@ -0,0 +1,47 @@ +/** + * A class representation of the BSON Symbol type. + * + * @class + * @deprecated + * @param {string} value the string representing the symbol. + * @return {Symbol} + */ +function Symbol(value) { + if (!(this instanceof Symbol)) return new Symbol(value); + this._bsontype = 'Symbol'; + this.value = value; +} + +/** + * Access the wrapped string value. + * + * @method + * @return {String} returns the wrapped string. + */ +Symbol.prototype.valueOf = function() { + return this.value; +}; + +/** + * @ignore + */ +Symbol.prototype.toString = function() { + return this.value; +}; + +/** + * @ignore + */ +Symbol.prototype.inspect = function() { + return this.value; +}; + +/** + * @ignore + */ +Symbol.prototype.toJSON = function() { + return this.value; +}; + +module.exports = Symbol; +module.exports.Symbol = Symbol; diff --git a/node_modules/bson/lib/bson/timestamp.js b/node_modules/bson/lib/bson/timestamp.js new file mode 100644 index 0000000..dc61a6c --- /dev/null +++ b/node_modules/bson/lib/bson/timestamp.js @@ -0,0 +1,854 @@ +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Copyright 2009 Google Inc. All Rights Reserved + +/** + * This type is for INTERNAL use in MongoDB only and should not be used in applications. + * The appropriate corresponding type is the JavaScript Date type. + * + * Defines a Timestamp class for representing a 64-bit two's-complement + * integer value, which faithfully simulates the behavior of a Java "Timestamp". This + * implementation is derived from TimestampLib in GWT. + * + * Constructs a 64-bit two's-complement integer, given its low and high 32-bit + * values as *signed* integers. See the from* functions below for more + * convenient ways of constructing Timestamps. + * + * The internal representation of a Timestamp is the two given signed, 32-bit values. + * We use 32-bit pieces because these are the size of integers on which + * Javascript performs bit-operations. For operations like addition and + * multiplication, we split each number into 16-bit pieces, which can easily be + * multiplied within Javascript's floating-point representation without overflow + * or change in sign. + * + * In the algorithms below, we frequently reduce the negative case to the + * positive case by negating the input(s) and then post-processing the result. + * Note that we must ALWAYS check specially whether those values are MIN_VALUE + * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as + * a positive number, it overflows back into a negative). Not handling this + * case would often result in infinite recursion. + * + * @class + * @param {number} low the low (signed) 32 bits of the Timestamp. + * @param {number} high the high (signed) 32 bits of the Timestamp. + */ +function Timestamp(low, high) { + if (!(this instanceof Timestamp)) return new Timestamp(low, high); + this._bsontype = 'Timestamp'; + /** + * @type {number} + * @ignore + */ + this.low_ = low | 0; // force into 32 signed bits. + + /** + * @type {number} + * @ignore + */ + this.high_ = high | 0; // force into 32 signed bits. +} + +/** + * Return the int value. + * + * @return {number} the value, assuming it is a 32-bit integer. + */ +Timestamp.prototype.toInt = function() { + return this.low_; +}; + +/** + * Return the Number value. + * + * @method + * @return {number} the closest floating-point representation to this value. + */ +Timestamp.prototype.toNumber = function() { + return this.high_ * Timestamp.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned(); +}; + +/** + * Return the JSON value. + * + * @method + * @return {string} the JSON representation. + */ +Timestamp.prototype.toJSON = function() { + return this.toString(); +}; + +/** + * Return the String value. + * + * @method + * @param {number} [opt_radix] the radix in which the text should be written. + * @return {string} the textual representation of this value. + */ +Timestamp.prototype.toString = function(opt_radix) { + var radix = opt_radix || 10; + if (radix < 2 || 36 < radix) { + throw Error('radix out of range: ' + radix); + } + + if (this.isZero()) { + return '0'; + } + + if (this.isNegative()) { + if (this.equals(Timestamp.MIN_VALUE)) { + // We need to change the Timestamp value before it can be negated, so we remove + // the bottom-most digit in this base and then recurse to do the rest. + var radixTimestamp = Timestamp.fromNumber(radix); + var div = this.div(radixTimestamp); + var rem = div.multiply(radixTimestamp).subtract(this); + return div.toString(radix) + rem.toInt().toString(radix); + } else { + return '-' + this.negate().toString(radix); + } + } + + // Do several (6) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6)); + + rem = this; + var result = ''; + + while (!rem.isZero()) { + var remDiv = rem.div(radixToPower); + var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); + var digits = intval.toString(radix); + + rem = remDiv; + if (rem.isZero()) { + return digits + result; + } else { + while (digits.length < 6) { + digits = '0' + digits; + } + result = '' + digits + result; + } + } +}; + +/** + * Return the high 32-bits value. + * + * @method + * @return {number} the high 32-bits as a signed value. + */ +Timestamp.prototype.getHighBits = function() { + return this.high_; +}; + +/** + * Return the low 32-bits value. + * + * @method + * @return {number} the low 32-bits as a signed value. + */ +Timestamp.prototype.getLowBits = function() { + return this.low_; +}; + +/** + * Return the low unsigned 32-bits value. + * + * @method + * @return {number} the low 32-bits as an unsigned value. + */ +Timestamp.prototype.getLowBitsUnsigned = function() { + return this.low_ >= 0 ? this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_; +}; + +/** + * Returns the number of bits needed to represent the absolute value of this Timestamp. + * + * @method + * @return {number} Returns the number of bits needed to represent the absolute value of this Timestamp. + */ +Timestamp.prototype.getNumBitsAbs = function() { + if (this.isNegative()) { + if (this.equals(Timestamp.MIN_VALUE)) { + return 64; + } else { + return this.negate().getNumBitsAbs(); + } + } else { + var val = this.high_ !== 0 ? this.high_ : this.low_; + for (var bit = 31; bit > 0; bit--) { + if ((val & (1 << bit)) !== 0) { + break; + } + } + return this.high_ !== 0 ? bit + 33 : bit + 1; + } +}; + +/** + * Return whether this value is zero. + * + * @method + * @return {boolean} whether this value is zero. + */ +Timestamp.prototype.isZero = function() { + return this.high_ === 0 && this.low_ === 0; +}; + +/** + * Return whether this value is negative. + * + * @method + * @return {boolean} whether this value is negative. + */ +Timestamp.prototype.isNegative = function() { + return this.high_ < 0; +}; + +/** + * Return whether this value is odd. + * + * @method + * @return {boolean} whether this value is odd. + */ +Timestamp.prototype.isOdd = function() { + return (this.low_ & 1) === 1; +}; + +/** + * Return whether this Timestamp equals the other + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp equals the other + */ +Timestamp.prototype.equals = function(other) { + return this.high_ === other.high_ && this.low_ === other.low_; +}; + +/** + * Return whether this Timestamp does not equal the other. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp does not equal the other. + */ +Timestamp.prototype.notEquals = function(other) { + return this.high_ !== other.high_ || this.low_ !== other.low_; +}; + +/** + * Return whether this Timestamp is less than the other. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp is less than the other. + */ +Timestamp.prototype.lessThan = function(other) { + return this.compare(other) < 0; +}; + +/** + * Return whether this Timestamp is less than or equal to the other. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp is less than or equal to the other. + */ +Timestamp.prototype.lessThanOrEqual = function(other) { + return this.compare(other) <= 0; +}; + +/** + * Return whether this Timestamp is greater than the other. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp is greater than the other. + */ +Timestamp.prototype.greaterThan = function(other) { + return this.compare(other) > 0; +}; + +/** + * Return whether this Timestamp is greater than or equal to the other. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} whether this Timestamp is greater than or equal to the other. + */ +Timestamp.prototype.greaterThanOrEqual = function(other) { + return this.compare(other) >= 0; +}; + +/** + * Compares this Timestamp with the given one. + * + * @method + * @param {Timestamp} other Timestamp to compare against. + * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. + */ +Timestamp.prototype.compare = function(other) { + if (this.equals(other)) { + return 0; + } + + var thisNeg = this.isNegative(); + var otherNeg = other.isNegative(); + if (thisNeg && !otherNeg) { + return -1; + } + if (!thisNeg && otherNeg) { + return 1; + } + + // at this point, the signs are the same, so subtraction will not overflow + if (this.subtract(other).isNegative()) { + return -1; + } else { + return 1; + } +}; + +/** + * The negation of this value. + * + * @method + * @return {Timestamp} the negation of this value. + */ +Timestamp.prototype.negate = function() { + if (this.equals(Timestamp.MIN_VALUE)) { + return Timestamp.MIN_VALUE; + } else { + return this.not().add(Timestamp.ONE); + } +}; + +/** + * Returns the sum of this and the given Timestamp. + * + * @method + * @param {Timestamp} other Timestamp to add to this one. + * @return {Timestamp} the sum of this and the given Timestamp. + */ +Timestamp.prototype.add = function(other) { + // Divide each number into 4 chunks of 16 bits, and then sum the chunks. + + var a48 = this.high_ >>> 16; + var a32 = this.high_ & 0xffff; + var a16 = this.low_ >>> 16; + var a00 = this.low_ & 0xffff; + + var b48 = other.high_ >>> 16; + var b32 = other.high_ & 0xffff; + var b16 = other.low_ >>> 16; + var b00 = other.low_ & 0xffff; + + var c48 = 0, + c32 = 0, + c16 = 0, + c00 = 0; + c00 += a00 + b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 + b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 + b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 + b48; + c48 &= 0xffff; + return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); +}; + +/** + * Returns the difference of this and the given Timestamp. + * + * @method + * @param {Timestamp} other Timestamp to subtract from this. + * @return {Timestamp} the difference of this and the given Timestamp. + */ +Timestamp.prototype.subtract = function(other) { + return this.add(other.negate()); +}; + +/** + * Returns the product of this and the given Timestamp. + * + * @method + * @param {Timestamp} other Timestamp to multiply with this. + * @return {Timestamp} the product of this and the other. + */ +Timestamp.prototype.multiply = function(other) { + if (this.isZero()) { + return Timestamp.ZERO; + } else if (other.isZero()) { + return Timestamp.ZERO; + } + + if (this.equals(Timestamp.MIN_VALUE)) { + return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; + } else if (other.equals(Timestamp.MIN_VALUE)) { + return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; + } + + if (this.isNegative()) { + if (other.isNegative()) { + return this.negate().multiply(other.negate()); + } else { + return this.negate() + .multiply(other) + .negate(); + } + } else if (other.isNegative()) { + return this.multiply(other.negate()).negate(); + } + + // If both Timestamps are small, use float multiplication + if (this.lessThan(Timestamp.TWO_PWR_24_) && other.lessThan(Timestamp.TWO_PWR_24_)) { + return Timestamp.fromNumber(this.toNumber() * other.toNumber()); + } + + // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products. + // We can skip products that would overflow. + + var a48 = this.high_ >>> 16; + var a32 = this.high_ & 0xffff; + var a16 = this.low_ >>> 16; + var a00 = this.low_ & 0xffff; + + var b48 = other.high_ >>> 16; + var b32 = other.high_ & 0xffff; + var b16 = other.low_ >>> 16; + var b00 = other.low_ & 0xffff; + + var c48 = 0, + c32 = 0, + c16 = 0, + c00 = 0; + c00 += a00 * b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 * b00; + c32 += c16 >>> 16; + c16 &= 0xffff; + c16 += a00 * b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 * b00; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a16 * b16; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a00 * b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; + c48 &= 0xffff; + return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); +}; + +/** + * Returns this Timestamp divided by the given one. + * + * @method + * @param {Timestamp} other Timestamp by which to divide. + * @return {Timestamp} this Timestamp divided by the given one. + */ +Timestamp.prototype.div = function(other) { + if (other.isZero()) { + throw Error('division by zero'); + } else if (this.isZero()) { + return Timestamp.ZERO; + } + + if (this.equals(Timestamp.MIN_VALUE)) { + if (other.equals(Timestamp.ONE) || other.equals(Timestamp.NEG_ONE)) { + return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE + } else if (other.equals(Timestamp.MIN_VALUE)) { + return Timestamp.ONE; + } else { + // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. + var halfThis = this.shiftRight(1); + var approx = halfThis.div(other).shiftLeft(1); + if (approx.equals(Timestamp.ZERO)) { + return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE; + } else { + var rem = this.subtract(other.multiply(approx)); + var result = approx.add(rem.div(other)); + return result; + } + } + } else if (other.equals(Timestamp.MIN_VALUE)) { + return Timestamp.ZERO; + } + + if (this.isNegative()) { + if (other.isNegative()) { + return this.negate().div(other.negate()); + } else { + return this.negate() + .div(other) + .negate(); + } + } else if (other.isNegative()) { + return this.div(other.negate()).negate(); + } + + // Repeat the following until the remainder is less than other: find a + // floating-point that approximates remainder / other *from below*, add this + // into the result, and subtract it from the remainder. It is critical that + // the approximate value is less than or equal to the real value so that the + // remainder never becomes negative. + var res = Timestamp.ZERO; + rem = this; + while (rem.greaterThanOrEqual(other)) { + // Approximate the result of division. This may be a little greater or + // smaller than the actual value. + approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); + + // We will tweak the approximate result by changing it in the 48-th digit or + // the smallest non-fractional digit, whichever is larger. + var log2 = Math.ceil(Math.log(approx) / Math.LN2); + var delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48); + + // Decrease the approximation until it is smaller than the remainder. Note + // that if it is too large, the product overflows and is negative. + var approxRes = Timestamp.fromNumber(approx); + var approxRem = approxRes.multiply(other); + while (approxRem.isNegative() || approxRem.greaterThan(rem)) { + approx -= delta; + approxRes = Timestamp.fromNumber(approx); + approxRem = approxRes.multiply(other); + } + + // We know the answer can't be zero... and actually, zero would cause + // infinite recursion since we would make no progress. + if (approxRes.isZero()) { + approxRes = Timestamp.ONE; + } + + res = res.add(approxRes); + rem = rem.subtract(approxRem); + } + return res; +}; + +/** + * Returns this Timestamp modulo the given one. + * + * @method + * @param {Timestamp} other Timestamp by which to mod. + * @return {Timestamp} this Timestamp modulo the given one. + */ +Timestamp.prototype.modulo = function(other) { + return this.subtract(this.div(other).multiply(other)); +}; + +/** + * The bitwise-NOT of this value. + * + * @method + * @return {Timestamp} the bitwise-NOT of this value. + */ +Timestamp.prototype.not = function() { + return Timestamp.fromBits(~this.low_, ~this.high_); +}; + +/** + * Returns the bitwise-AND of this Timestamp and the given one. + * + * @method + * @param {Timestamp} other the Timestamp with which to AND. + * @return {Timestamp} the bitwise-AND of this and the other. + */ +Timestamp.prototype.and = function(other) { + return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_); +}; + +/** + * Returns the bitwise-OR of this Timestamp and the given one. + * + * @method + * @param {Timestamp} other the Timestamp with which to OR. + * @return {Timestamp} the bitwise-OR of this and the other. + */ +Timestamp.prototype.or = function(other) { + return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_); +}; + +/** + * Returns the bitwise-XOR of this Timestamp and the given one. + * + * @method + * @param {Timestamp} other the Timestamp with which to XOR. + * @return {Timestamp} the bitwise-XOR of this and the other. + */ +Timestamp.prototype.xor = function(other) { + return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); +}; + +/** + * Returns this Timestamp with bits shifted to the left by the given amount. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Timestamp} this shifted to the left by the given amount. + */ +Timestamp.prototype.shiftLeft = function(numBits) { + numBits &= 63; + if (numBits === 0) { + return this; + } else { + var low = this.low_; + if (numBits < 32) { + var high = this.high_; + return Timestamp.fromBits(low << numBits, (high << numBits) | (low >>> (32 - numBits))); + } else { + return Timestamp.fromBits(0, low << (numBits - 32)); + } + } +}; + +/** + * Returns this Timestamp with bits shifted to the right by the given amount. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Timestamp} this shifted to the right by the given amount. + */ +Timestamp.prototype.shiftRight = function(numBits) { + numBits &= 63; + if (numBits === 0) { + return this; + } else { + var high = this.high_; + if (numBits < 32) { + var low = this.low_; + return Timestamp.fromBits((low >>> numBits) | (high << (32 - numBits)), high >> numBits); + } else { + return Timestamp.fromBits(high >> (numBits - 32), high >= 0 ? 0 : -1); + } + } +}; + +/** + * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. + * + * @method + * @param {number} numBits the number of bits by which to shift. + * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits. + */ +Timestamp.prototype.shiftRightUnsigned = function(numBits) { + numBits &= 63; + if (numBits === 0) { + return this; + } else { + var high = this.high_; + if (numBits < 32) { + var low = this.low_; + return Timestamp.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits); + } else if (numBits === 32) { + return Timestamp.fromBits(high, 0); + } else { + return Timestamp.fromBits(high >>> (numBits - 32), 0); + } + } +}; + +/** + * Returns a Timestamp representing the given (32-bit) integer value. + * + * @method + * @param {number} value the 32-bit integer in question. + * @return {Timestamp} the corresponding Timestamp value. + */ +Timestamp.fromInt = function(value) { + if (-128 <= value && value < 128) { + var cachedObj = Timestamp.INT_CACHE_[value]; + if (cachedObj) { + return cachedObj; + } + } + + var obj = new Timestamp(value | 0, value < 0 ? -1 : 0); + if (-128 <= value && value < 128) { + Timestamp.INT_CACHE_[value] = obj; + } + return obj; +}; + +/** + * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned. + * + * @method + * @param {number} value the number in question. + * @return {Timestamp} the corresponding Timestamp value. + */ +Timestamp.fromNumber = function(value) { + if (isNaN(value) || !isFinite(value)) { + return Timestamp.ZERO; + } else if (value <= -Timestamp.TWO_PWR_63_DBL_) { + return Timestamp.MIN_VALUE; + } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) { + return Timestamp.MAX_VALUE; + } else if (value < 0) { + return Timestamp.fromNumber(-value).negate(); + } else { + return new Timestamp( + (value % Timestamp.TWO_PWR_32_DBL_) | 0, + (value / Timestamp.TWO_PWR_32_DBL_) | 0 + ); + } +}; + +/** + * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. + * + * @method + * @param {number} lowBits the low 32-bits. + * @param {number} highBits the high 32-bits. + * @return {Timestamp} the corresponding Timestamp value. + */ +Timestamp.fromBits = function(lowBits, highBits) { + return new Timestamp(lowBits, highBits); +}; + +/** + * Returns a Timestamp representation of the given string, written using the given radix. + * + * @method + * @param {string} str the textual representation of the Timestamp. + * @param {number} opt_radix the radix in which the text is written. + * @return {Timestamp} the corresponding Timestamp value. + */ +Timestamp.fromString = function(str, opt_radix) { + if (str.length === 0) { + throw Error('number format error: empty string'); + } + + var radix = opt_radix || 10; + if (radix < 2 || 36 < radix) { + throw Error('radix out of range: ' + radix); + } + + if (str.charAt(0) === '-') { + return Timestamp.fromString(str.substring(1), radix).negate(); + } else if (str.indexOf('-') >= 0) { + throw Error('number format error: interior "-" character: ' + str); + } + + // Do several (8) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8)); + + var result = Timestamp.ZERO; + for (var i = 0; i < str.length; i += 8) { + var size = Math.min(8, str.length - i); + var value = parseInt(str.substring(i, i + size), radix); + if (size < 8) { + var power = Timestamp.fromNumber(Math.pow(radix, size)); + result = result.multiply(power).add(Timestamp.fromNumber(value)); + } else { + result = result.multiply(radixToPower); + result = result.add(Timestamp.fromNumber(value)); + } + } + return result; +}; + +// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the +// from* methods on which they depend. + +/** + * A cache of the Timestamp representations of small integer values. + * @type {Object} + * @ignore + */ +Timestamp.INT_CACHE_ = {}; + +// NOTE: the compiler should inline these constant values below and then remove +// these variables, so there should be no runtime penalty for these. + +/** + * Number used repeated below in calculations. This must appear before the + * first call to any from* function below. + * @type {number} + * @ignore + */ +Timestamp.TWO_PWR_16_DBL_ = 1 << 16; + +/** + * @type {number} + * @ignore + */ +Timestamp.TWO_PWR_24_DBL_ = 1 << 24; + +/** + * @type {number} + * @ignore + */ +Timestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_; + +/** + * @type {number} + * @ignore + */ +Timestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2; + +/** + * @type {number} + * @ignore + */ +Timestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_; + +/** + * @type {number} + * @ignore + */ +Timestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_; + +/** + * @type {number} + * @ignore + */ +Timestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2; + +/** @type {Timestamp} */ +Timestamp.ZERO = Timestamp.fromInt(0); + +/** @type {Timestamp} */ +Timestamp.ONE = Timestamp.fromInt(1); + +/** @type {Timestamp} */ +Timestamp.NEG_ONE = Timestamp.fromInt(-1); + +/** @type {Timestamp} */ +Timestamp.MAX_VALUE = Timestamp.fromBits(0xffffffff | 0, 0x7fffffff | 0); + +/** @type {Timestamp} */ +Timestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0); + +/** + * @type {Timestamp} + * @ignore + */ +Timestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24); + +/** + * Expose. + */ +module.exports = Timestamp; +module.exports.Timestamp = Timestamp; diff --git a/node_modules/bson/package.json b/node_modules/bson/package.json new file mode 100644 index 0000000..49cfb9f --- /dev/null +++ b/node_modules/bson/package.json @@ -0,0 +1,88 @@ +{ + "_from": "bson@~1.0.4", + "_id": "bson@1.0.5", + "_inBundle": false, + "_integrity": "sha512-D4SCtud6mlEb48kXdTHU31DRU0bsgOJ+4St1Dcx30uYNnf/aGc+hC9gHB/z0Eth8HYYs/hr0SFdyZViht19SwA==", + "_location": "/bson", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "bson@~1.0.4", + "name": "bson", + "escapedName": "bson", + "rawSpec": "~1.0.4", + "saveSpec": null, + "fetchSpec": "~1.0.4" + }, + "_requiredBy": [ + "/mongodb-core", + "/mongoose" + ], + "_resolved": "https://registry.npmjs.org/bson/-/bson-1.0.5.tgz", + "_shasum": "34563b73ff1fde9387c1b9fb5afd845ecc4ba623", + "_spec": "bson@~1.0.4", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/mongoose", + "author": { + "name": "Christian Amor Kvalheim", + "email": "christkv@gmail.com" + }, + "browser": "lib/bson/bson.js", + "bugs": { + "url": "https://github.com/mongodb/js-bson/issues" + }, + "bundleDependencies": false, + "config": { + "native": false + }, + "contributors": [], + "deprecated": false, + "description": "A bson parser for node.js and the browser", + "devDependencies": { + "babel-core": "^6.14.0", + "babel-loader": "^6.2.5", + "babel-polyfill": "^6.13.0", + "babel-preset-es2015": "^6.14.0", + "babel-preset-stage-0": "^6.5.0", + "babel-register": "^6.14.0", + "benchmark": "1.0.0", + "colors": "1.1.0", + "conventional-changelog-cli": "^1.3.5", + "nodeunit": "0.9.0", + "webpack": "^1.13.2", + "webpack-polyfills-plugin": "0.0.9" + }, + "directories": { + "lib": "./lib/bson" + }, + "engines": { + "node": ">=0.6.19" + }, + "files": [ + "lib", + "index.js", + "browser_build", + "bower.json" + ], + "homepage": "https://github.com/mongodb/js-bson#readme", + "keywords": [ + "mongodb", + "bson", + "parser" + ], + "license": "Apache-2.0", + "main": "./index", + "name": "bson", + "repository": { + "type": "git", + "url": "git+https://github.com/mongodb/js-bson.git" + }, + "scripts": { + "build": "webpack --config ./webpack.dist.config.js", + "changelog": "conventional-changelog -p angular -i HISTORY.md -s", + "format": "prettier --print-width 100 --tab-width 2 --single-quote --write 'test/**/*.js' 'lib/**/*.js'", + "lint": "eslint lib test", + "test": "nodeunit ./test/node" + }, + "version": "1.0.5" +} diff --git a/node_modules/bytes/History.md b/node_modules/bytes/History.md new file mode 100644 index 0000000..13d463a --- /dev/null +++ b/node_modules/bytes/History.md @@ -0,0 +1,82 @@ +3.0.0 / 2017-08-31 +================== + + * Change "kB" to "KB" in format output + * Remove support for Node.js 0.6 + * Remove support for ComponentJS + +2.5.0 / 2017-03-24 +================== + + * Add option "unit" + +2.4.0 / 2016-06-01 +================== + + * Add option "unitSeparator" + +2.3.0 / 2016-02-15 +================== + + * Drop partial bytes on all parsed units + * Fix non-finite numbers to `.format` to return `null` + * Fix parsing byte string that looks like hex + * perf: hoist regular expressions + +2.2.0 / 2015-11-13 +================== + + * add option "decimalPlaces" + * add option "fixedDecimals" + +2.1.0 / 2015-05-21 +================== + + * add `.format` export + * add `.parse` export + +2.0.2 / 2015-05-20 +================== + + * remove map recreation + * remove unnecessary object construction + +2.0.1 / 2015-05-07 +================== + + * fix browserify require + * remove node.extend dependency + +2.0.0 / 2015-04-12 +================== + + * add option "case" + * add option "thousandsSeparator" + * return "null" on invalid parse input + * support proper round-trip: bytes(bytes(num)) === num + * units no longer case sensitive when parsing + +1.0.0 / 2014-05-05 +================== + + * add negative support. fixes #6 + +0.3.0 / 2014-03-19 +================== + + * added terabyte support + +0.2.1 / 2013-04-01 +================== + + * add .component + +0.2.0 / 2012-10-28 +================== + + * bytes(200).should.eql('200b') + +0.1.0 / 2012-07-04 +================== + + * add bytes to string conversion [yields] diff --git a/node_modules/bytes/LICENSE b/node_modules/bytes/LICENSE new file mode 100644 index 0000000..63e95a9 --- /dev/null +++ b/node_modules/bytes/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2012-2014 TJ Holowaychuk +Copyright (c) 2015 Jed Watson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/bytes/Readme.md b/node_modules/bytes/Readme.md new file mode 100644 index 0000000..9b53745 --- /dev/null +++ b/node_modules/bytes/Readme.md @@ -0,0 +1,125 @@ +# Bytes utility + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Utility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa. + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```bash +$ npm install bytes +``` + +## Usage + +```js +var bytes = require('bytes'); +``` + +#### bytes.format(number value, [options]): string|null + +Format the given value in bytes into a string. If the value is negative, it is kept as such. If it is a float, it is + rounded. + +**Arguments** + +| Name | Type | Description | +|---------|----------|--------------------| +| value | `number` | Value in bytes | +| options | `Object` | Conversion options | + +**Options** + +| Property | Type | Description | +|-------------------|--------|-----------------------------------------------------------------------------------------| +| decimalPlaces | `number`|`null` | Maximum number of decimal places to include in output. Default value to `2`. | +| fixedDecimals | `boolean`|`null` | Whether to always display the maximum number of decimal places. Default value to `false` | +| thousandsSeparator | `string`|`null` | Example of values: `' '`, `','` and `.`... Default value to `''`. | +| unit | `string`|`null` | The unit in which the result will be returned (B/KB/MB/GB/TB). Default value to `''` (which means auto detect). | +| unitSeparator | `string`|`null` | Separator to use between number and unit. Default value to `''`. | + +**Returns** + +| Name | Type | Description | +|---------|------------------|-------------------------------------------------| +| results | `string`|`null` | Return null upon error. String value otherwise. | + +**Example** + +```js +bytes(1024); +// output: '1KB' + +bytes(1000); +// output: '1000B' + +bytes(1000, {thousandsSeparator: ' '}); +// output: '1 000B' + +bytes(1024 * 1.7, {decimalPlaces: 0}); +// output: '2KB' + +bytes(1024, {unitSeparator: ' '}); +// output: '1 KB' + +``` + +#### bytes.parse(string|number value): number|null + +Parse the string value into an integer in bytes. If no unit is given, or `value` +is a number, it is assumed the value is in bytes. + +Supported units and abbreviations are as follows and are case-insensitive: + + * `b` for bytes + * `kb` for kilobytes + * `mb` for megabytes + * `gb` for gigabytes + * `tb` for terabytes + +The units are in powers of two, not ten. This means 1kb = 1024b according to this parser. + +**Arguments** + +| Name | Type | Description | +|---------------|--------|--------------------| +| value | `string`|`number` | String to parse, or number in bytes. | + +**Returns** + +| Name | Type | Description | +|---------|-------------|-------------------------| +| results | `number`|`null` | Return null upon error. Value in bytes otherwise. | + +**Example** + +```js +bytes('1KB'); +// output: 1024 + +bytes('1024'); +// output: 1024 + +bytes(1024); +// output: 1024 +``` + +## License + +[MIT](LICENSE) + +[downloads-image]: https://img.shields.io/npm/dm/bytes.svg +[downloads-url]: https://npmjs.org/package/bytes +[npm-image]: https://img.shields.io/npm/v/bytes.svg +[npm-url]: https://npmjs.org/package/bytes +[travis-image]: https://img.shields.io/travis/visionmedia/bytes.js/master.svg +[travis-url]: https://travis-ci.org/visionmedia/bytes.js +[coveralls-image]: https://img.shields.io/coveralls/visionmedia/bytes.js/master.svg +[coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master diff --git a/node_modules/bytes/index.js b/node_modules/bytes/index.js new file mode 100644 index 0000000..1e39afd --- /dev/null +++ b/node_modules/bytes/index.js @@ -0,0 +1,159 @@ +/*! + * bytes + * Copyright(c) 2012-2014 TJ Holowaychuk + * Copyright(c) 2015 Jed Watson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +module.exports = bytes; +module.exports.format = format; +module.exports.parse = parse; + +/** + * Module variables. + * @private + */ + +var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g; + +var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/; + +var map = { + b: 1, + kb: 1 << 10, + mb: 1 << 20, + gb: 1 << 30, + tb: ((1 << 30) * 1024) +}; + +var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb)$/i; + +/** + * Convert the given value in bytes into a string or parse to string to an integer in bytes. + * + * @param {string|number} value + * @param {{ + * case: [string], + * decimalPlaces: [number] + * fixedDecimals: [boolean] + * thousandsSeparator: [string] + * unitSeparator: [string] + * }} [options] bytes options. + * + * @returns {string|number|null} + */ + +function bytes(value, options) { + if (typeof value === 'string') { + return parse(value); + } + + if (typeof value === 'number') { + return format(value, options); + } + + return null; +} + +/** + * Format the given value in bytes into a string. + * + * If the value is negative, it is kept as such. If it is a float, + * it is rounded. + * + * @param {number} value + * @param {object} [options] + * @param {number} [options.decimalPlaces=2] + * @param {number} [options.fixedDecimals=false] + * @param {string} [options.thousandsSeparator=] + * @param {string} [options.unit=] + * @param {string} [options.unitSeparator=] + * + * @returns {string|null} + * @public + */ + +function format(value, options) { + if (!Number.isFinite(value)) { + return null; + } + + var mag = Math.abs(value); + var thousandsSeparator = (options && options.thousandsSeparator) || ''; + var unitSeparator = (options && options.unitSeparator) || ''; + var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2; + var fixedDecimals = Boolean(options && options.fixedDecimals); + var unit = (options && options.unit) || ''; + + if (!unit || !map[unit.toLowerCase()]) { + if (mag >= map.tb) { + unit = 'TB'; + } else if (mag >= map.gb) { + unit = 'GB'; + } else if (mag >= map.mb) { + unit = 'MB'; + } else if (mag >= map.kb) { + unit = 'KB'; + } else { + unit = 'B'; + } + } + + var val = value / map[unit.toLowerCase()]; + var str = val.toFixed(decimalPlaces); + + if (!fixedDecimals) { + str = str.replace(formatDecimalsRegExp, '$1'); + } + + if (thousandsSeparator) { + str = str.replace(formatThousandsRegExp, thousandsSeparator); + } + + return str + unitSeparator + unit; +} + +/** + * Parse the string value into an integer in bytes. + * + * If no unit is given, it is assumed the value is in bytes. + * + * @param {number|string} val + * + * @returns {number|null} + * @public + */ + +function parse(val) { + if (typeof val === 'number' && !isNaN(val)) { + return val; + } + + if (typeof val !== 'string') { + return null; + } + + // Test if the string passed is valid + var results = parseRegExp.exec(val); + var floatValue; + var unit = 'b'; + + if (!results) { + // Nothing could be extracted from the given string + floatValue = parseInt(val, 10); + unit = 'b' + } else { + // Retrieve the value and the unit + floatValue = parseFloat(results[1]); + unit = results[4].toLowerCase(); + } + + return Math.floor(map[unit] * floatValue); +} diff --git a/node_modules/bytes/package.json b/node_modules/bytes/package.json new file mode 100644 index 0000000..83b73c4 --- /dev/null +++ b/node_modules/bytes/package.json @@ -0,0 +1,82 @@ +{ + "_from": "bytes@3.0.0", + "_id": "bytes@3.0.0", + "_inBundle": false, + "_integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", + "_location": "/bytes", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "bytes@3.0.0", + "name": "bytes", + "escapedName": "bytes", + "rawSpec": "3.0.0", + "saveSpec": null, + "fetchSpec": "3.0.0" + }, + "_requiredBy": [ + "/body-parser", + "/raw-body" + ], + "_resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "_shasum": "d32815404d689699f85a4ea4fa8755dd13a96048", + "_spec": "bytes@3.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/body-parser", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca", + "url": "http://tjholowaychuk.com" + }, + "bugs": { + "url": "https://github.com/visionmedia/bytes.js/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Jed Watson", + "email": "jed.watson@me.com" + }, + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "deprecated": false, + "description": "Utility to parse a string bytes to bytes and vice-versa", + "devDependencies": { + "mocha": "2.5.3", + "nyc": "10.3.2" + }, + "engines": { + "node": ">= 0.8" + }, + "files": [ + "History.md", + "LICENSE", + "Readme.md", + "index.js" + ], + "homepage": "https://github.com/visionmedia/bytes.js#readme", + "keywords": [ + "byte", + "bytes", + "utility", + "parse", + "parser", + "convert", + "converter" + ], + "license": "MIT", + "name": "bytes", + "repository": { + "type": "git", + "url": "git+https://github.com/visionmedia/bytes.js.git" + }, + "scripts": { + "test": "mocha --check-leaks --reporter spec", + "test-ci": "nyc --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + }, + "version": "3.0.0" +} diff --git a/node_modules/cache-base/LICENSE b/node_modules/cache-base/LICENSE new file mode 100644 index 0000000..943e71d --- /dev/null +++ b/node_modules/cache-base/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, 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. \ No newline at end of file diff --git a/node_modules/cache-base/README.md b/node_modules/cache-base/README.md new file mode 100644 index 0000000..62c6ffe --- /dev/null +++ b/node_modules/cache-base/README.md @@ -0,0 +1,291 @@ +# cache-base [![NPM version](https://img.shields.io/npm/v/cache-base.svg?style=flat)](https://www.npmjs.com/package/cache-base) [![NPM monthly downloads](https://img.shields.io/npm/dm/cache-base.svg?style=flat)](https://npmjs.org/package/cache-base) [![NPM total downloads](https://img.shields.io/npm/dt/cache-base.svg?style=flat)](https://npmjs.org/package/cache-base) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/cache-base.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/cache-base) + +> Basic object cache with `get`, `set`, `del`, and `has` methods for node.js/javascript projects. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save cache-base +``` + +## Usage + +```js +var Cache = require('cache-base'); + +// instantiate +var app = new Cache(); + +// set values +app.set('a', 'b'); +app.set('c.d', 'e'); + +// get values +app.get('a'); +//=> 'b' +app.get('c'); +//=> {d: 'e'} + +console.log(app.cache); +//=> {a: 'b'} +``` + +**Inherit** + +```js +var util = require('util'); +var Cache = require('cache-base'); + +function MyApp() { + Cache.call(this); +} +util.inherits(MyApp, Cache); + +var app = new MyApp(); +app.set('a', 'b'); +app.get('a'); +//=> 'b' +``` + +**Namespace** + +Define a custom property for storing values. + +```js +var Cache = require('cache-base').namespace('data'); +var app = new Cache(); +app.set('a', 'b'); +console.log(app.data); +//=> {a: 'b'} +``` + +## API + +### [namespace](index.js#L29) + +Create a `Cache` constructor that when instantiated will store values on the given `prop`. + +**Params** + +* `prop` **{String}**: The property name to use for storing values. +* `returns` **{Function}**: Returns a custom `Cache` constructor + +**Example** + +```js +var Cache = require('cache-base').namespace('data'); +var cache = new Cache(); + +cache.set('foo', 'bar'); +//=> {data: {foo: 'bar'}} +``` + +### [Cache](index.js#L43) + +Create a new `Cache`. Internally the `Cache` constructor is created using the `namespace` function, with `cache` defined as the storage object. + +**Params** + +* `cache` **{Object}**: Optionally pass an object to initialize with. + +**Example** + +```js +var app = new Cache(); +``` + +### [.set](index.js#L84) + +Assign `value` to `key`. Also emits `set` with the key and value. + +**Params** + +* `key` **{String}** +* `value` **{any}** +* `returns` **{Object}**: Returns the instance for chaining. + +**Events** + +* `emits`: `set` with `key` and `value` as arguments. + +**Example** + +```js +app.on('set', function(key, val) { + // do something when `set` is emitted +}); + +app.set(key, value); + +// also takes an object or array +app.set({name: 'Halle'}); +app.set([{foo: 'bar'}, {baz: 'quux'}]); +console.log(app); +//=> {name: 'Halle', foo: 'bar', baz: 'quux'} +``` + +### [.union](index.js#L114) + +Union `array` to `key`. Also emits `set` with the key and value. + +**Params** + +* `key` **{String}** +* `value` **{any}** +* `returns` **{Object}**: Returns the instance for chaining. + +**Example** + +```js +app.union('a.b', ['foo']); +app.union('a.b', ['bar']); +console.log(app.get('a')); +//=> {b: ['foo', 'bar']} +``` + +### [.get](index.js#L144) + +Return the value of `key`. Dot notation may be used to get [nested property values](https://github.com/jonschlinkert/get-value). + +**Params** + +* `key` **{String}**: The name of the property to get. Dot-notation may be used. +* `returns` **{any}**: Returns the value of `key` + +**Events** + +* `emits`: `get` with `key` and `value` as arguments. + +**Example** + +```js +app.set('a.b.c', 'd'); +app.get('a.b'); +//=> {c: 'd'} + +app.get(['a', 'b']); +//=> {c: 'd'} +``` + +### [.has](index.js#L171) + +Return true if app has a stored value for `key`, false only if value is `undefined`. + +**Params** + +* `key` **{String}** +* `returns` **{Boolean}** + +**Events** + +* `emits`: `has` with `key` and true or false as arguments. + +**Example** + +```js +app.set('foo', 'bar'); +app.has('foo'); +//=> true +``` + +### [.del](index.js#L199) + +Delete one or more properties from the instance. + +**Params** + +* `key` **{String|Array}**: Property name or array of property names. +* `returns` **{Object}**: Returns the instance for chaining. + +**Events** + +* `emits`: `del` with the `key` as the only argument. + +**Example** + +```js +app.del(); // delete all +// or +app.del('foo'); +// or +app.del(['foo', 'bar']); +``` + +### [.clear](index.js#L218) + +Reset the entire cache to an empty object. + +**Example** + +```js +app.clear(); +``` + +### [.visit](index.js#L235) + +Visit `method` over the properties in the given object, or map +visit over the object-elements in an array. + +**Params** + +* `method` **{String}**: The name of the `base` method to call. +* `val` **{Object|Array}**: The object or array to iterate over. +* `returns` **{Object}**: Returns the instance for chaining. + +## About + +### Related projects + +* [base-methods](https://www.npmjs.com/package/base-methods): base-methods is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… [more](https://github.com/jonschlinkert/base-methods) | [homepage](https://github.com/jonschlinkert/base-methods "base-methods is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting with a handful of common methods, like `set`, `get`, `del` and `use`.") +* [get-value](https://www.npmjs.com/package/get-value): Use property paths (`a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value "Use property paths (`a.b.c`) to get a nested value from an object.") +* [has-value](https://www.npmjs.com/package/has-value): Returns true if a value exists, false if empty. Works with deeply nested values using… [more](https://github.com/jonschlinkert/has-value) | [homepage](https://github.com/jonschlinkert/has-value "Returns true if a value exists, false if empty. Works with deeply nested values using object paths.") +* [option-cache](https://www.npmjs.com/package/option-cache): Simple API for managing options in JavaScript applications. | [homepage](https://github.com/jonschlinkert/option-cache "Simple API for managing options in JavaScript applications.") +* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value "Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths.") +* [unset-value](https://www.npmjs.com/package/unset-value): Delete nested properties from an object using dot notation. | [homepage](https://github.com/jonschlinkert/unset-value "Delete nested properties from an object using dot notation.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 54 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 22, 2017._ \ No newline at end of file diff --git a/node_modules/cache-base/index.js b/node_modules/cache-base/index.js new file mode 100644 index 0000000..4128024 --- /dev/null +++ b/node_modules/cache-base/index.js @@ -0,0 +1,261 @@ +'use strict'; + +var isObject = require('isobject'); +var Emitter = require('component-emitter'); +var visit = require('collection-visit'); +var toPath = require('to-object-path'); +var union = require('union-value'); +var del = require('unset-value'); +var get = require('get-value'); +var has = require('has-value'); +var set = require('set-value'); + +/** + * Create a `Cache` constructor that when instantiated will + * store values on the given `prop`. + * + * ```js + * var Cache = require('cache-base').namespace('data'); + * var cache = new Cache(); + * + * cache.set('foo', 'bar'); + * //=> {data: {foo: 'bar'}} + * ``` + * @param {String} `prop` The property name to use for storing values. + * @return {Function} Returns a custom `Cache` constructor + * @api public + */ + +function namespace(prop) { + + /** + * Create a new `Cache`. Internally the `Cache` constructor is created using + * the `namespace` function, with `cache` defined as the storage object. + * + * ```js + * var app = new Cache(); + * ``` + * @param {Object} `cache` Optionally pass an object to initialize with. + * @constructor + * @api public + */ + + function Cache(cache) { + if (prop) { + this[prop] = {}; + } + if (cache) { + this.set(cache); + } + } + + /** + * Inherit Emitter + */ + + Emitter(Cache.prototype); + + /** + * Assign `value` to `key`. Also emits `set` with + * the key and value. + * + * ```js + * app.on('set', function(key, val) { + * // do something when `set` is emitted + * }); + * + * app.set(key, value); + * + * // also takes an object or array + * app.set({name: 'Halle'}); + * app.set([{foo: 'bar'}, {baz: 'quux'}]); + * console.log(app); + * //=> {name: 'Halle', foo: 'bar', baz: 'quux'} + * ``` + * + * @name .set + * @emits `set` with `key` and `value` as arguments. + * @param {String} `key` + * @param {any} `value` + * @return {Object} Returns the instance for chaining. + * @api public + */ + + Cache.prototype.set = function(key, val) { + if (Array.isArray(key) && arguments.length === 2) { + key = toPath(key); + } + if (isObject(key) || Array.isArray(key)) { + this.visit('set', key); + } else { + set(prop ? this[prop] : this, key, val); + this.emit('set', key, val); + } + return this; + }; + + /** + * Union `array` to `key`. Also emits `set` with + * the key and value. + * + * ```js + * app.union('a.b', ['foo']); + * app.union('a.b', ['bar']); + * console.log(app.get('a')); + * //=> {b: ['foo', 'bar']} + * ``` + * @name .union + * @param {String} `key` + * @param {any} `value` + * @return {Object} Returns the instance for chaining. + * @api public + */ + + Cache.prototype.union = function(key, val) { + if (Array.isArray(key) && arguments.length === 2) { + key = toPath(key); + } + var ctx = prop ? this[prop] : this; + union(ctx, key, arrayify(val)); + this.emit('union', val); + return this; + }; + + /** + * Return the value of `key`. Dot notation may be used + * to get [nested property values][get-value]. + * + * ```js + * app.set('a.b.c', 'd'); + * app.get('a.b'); + * //=> {c: 'd'} + * + * app.get(['a', 'b']); + * //=> {c: 'd'} + * ``` + * + * @name .get + * @emits `get` with `key` and `value` as arguments. + * @param {String} `key` The name of the property to get. Dot-notation may be used. + * @return {any} Returns the value of `key` + * @api public + */ + + Cache.prototype.get = function(key) { + key = toPath(arguments); + + var ctx = prop ? this[prop] : this; + var val = get(ctx, key); + + this.emit('get', key, val); + return val; + }; + + /** + * Return true if app has a stored value for `key`, + * false only if value is `undefined`. + * + * ```js + * app.set('foo', 'bar'); + * app.has('foo'); + * //=> true + * ``` + * + * @name .has + * @emits `has` with `key` and true or false as arguments. + * @param {String} `key` + * @return {Boolean} + * @api public + */ + + Cache.prototype.has = function(key) { + key = toPath(arguments); + + var ctx = prop ? this[prop] : this; + var val = get(ctx, key); + + var has = typeof val !== 'undefined'; + this.emit('has', key, has); + return has; + }; + + /** + * Delete one or more properties from the instance. + * + * ```js + * app.del(); // delete all + * // or + * app.del('foo'); + * // or + * app.del(['foo', 'bar']); + * ``` + * @name .del + * @emits `del` with the `key` as the only argument. + * @param {String|Array} `key` Property name or array of property names. + * @return {Object} Returns the instance for chaining. + * @api public + */ + + Cache.prototype.del = function(key) { + if (Array.isArray(key)) { + this.visit('del', key); + } else { + del(prop ? this[prop] : this, key); + this.emit('del', key); + } + return this; + }; + + /** + * Reset the entire cache to an empty object. + * + * ```js + * app.clear(); + * ``` + * @api public + */ + + Cache.prototype.clear = function() { + if (prop) { + this[prop] = {}; + } + }; + + /** + * Visit `method` over the properties in the given object, or map + * visit over the object-elements in an array. + * + * @name .visit + * @param {String} `method` The name of the `base` method to call. + * @param {Object|Array} `val` The object or array to iterate over. + * @return {Object} Returns the instance for chaining. + * @api public + */ + + Cache.prototype.visit = function(method, val) { + visit(this, method, val); + return this; + }; + + return Cache; +} + +/** + * Cast val to an array + */ + +function arrayify(val) { + return val ? (Array.isArray(val) ? val : [val]) : []; +} + +/** + * Expose `Cache` + */ + +module.exports = namespace(); + +/** + * Expose `Cache.namespace` + */ + +module.exports.namespace = namespace; diff --git a/node_modules/cache-base/package.json b/node_modules/cache-base/package.json new file mode 100644 index 0000000..ebe4f4a --- /dev/null +++ b/node_modules/cache-base/package.json @@ -0,0 +1,118 @@ +{ + "_from": "cache-base@^1.0.1", + "_id": "cache-base@1.0.1", + "_inBundle": false, + "_integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "_location": "/cache-base", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "cache-base@^1.0.1", + "name": "cache-base", + "escapedName": "cache-base", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/base" + ], + "_resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "_shasum": "0a7f46416831c8b662ee36fe4e7c59d76f666ab2", + "_spec": "cache-base@^1.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/base", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/cache-base/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "url": "https://github.com/wtgtybhertgeghgtwtg" + } + ], + "dependencies": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + }, + "deprecated": false, + "description": "Basic object cache with `get`, `set`, `del`, and `has` methods for node.js/javascript projects.", + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.4.2" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/cache-base", + "keywords": [ + "base", + "cache", + "config", + "data", + "get", + "has", + "hash", + "hasown", + "object", + "set", + "store" + ], + "license": "MIT", + "main": "index.js", + "name": "cache-base", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/cache-base.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "highligh": "base", + "list": [ + "base-methods", + "get-value", + "has-value", + "option-cache", + "set-value", + "unset-value" + ] + }, + "reflinks": [ + "verb" + ], + "lint": { + "reflinks": true + } + }, + "version": "1.0.1" +} diff --git a/node_modules/camelcase/index.js b/node_modules/camelcase/index.js new file mode 100644 index 0000000..b46e100 --- /dev/null +++ b/node_modules/camelcase/index.js @@ -0,0 +1,27 @@ +'use strict'; +module.exports = function () { + var str = [].map.call(arguments, function (str) { + return str.trim(); + }).filter(function (str) { + return str.length; + }).join('-'); + + if (!str.length) { + return ''; + } + + if (str.length === 1 || !(/[_.\- ]+/).test(str) ) { + if (str[0] === str[0].toLowerCase() && str.slice(1) !== str.slice(1).toLowerCase()) { + return str; + } + + return str.toLowerCase(); + } + + return str + .replace(/^[_.\- ]+/, '') + .toLowerCase() + .replace(/[_.\- ]+(\w|$)/g, function (m, p1) { + return p1.toUpperCase(); + }); +}; diff --git a/node_modules/camelcase/license b/node_modules/camelcase/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/camelcase/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/camelcase/package.json b/node_modules/camelcase/package.json new file mode 100644 index 0000000..b1ab1a4 --- /dev/null +++ b/node_modules/camelcase/package.json @@ -0,0 +1,70 @@ +{ + "_from": "camelcase@^1.0.2", + "_id": "camelcase@1.2.1", + "_inBundle": false, + "_integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "_location": "/camelcase", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "camelcase@^1.0.2", + "name": "camelcase", + "escapedName": "camelcase", + "rawSpec": "^1.0.2", + "saveSpec": null, + "fetchSpec": "^1.0.2" + }, + "_requiredBy": [ + "/yargs" + ], + "_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "_shasum": "9bb5304d2e0b56698b2c758b08a3eaa9daa58a39", + "_spec": "camelcase@^1.0.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/yargs", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/camelcase/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar", + "devDependencies": { + "ava": "0.0.4" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/camelcase#readme", + "keywords": [ + "camelcase", + "camel-case", + "camel", + "case", + "dash", + "hyphen", + "dot", + "underscore", + "separator", + "string", + "text", + "convert" + ], + "license": "MIT", + "name": "camelcase", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/camelcase.git" + }, + "scripts": { + "test": "node test.js" + }, + "version": "1.2.1" +} diff --git a/node_modules/camelcase/readme.md b/node_modules/camelcase/readme.md new file mode 100644 index 0000000..516dc39 --- /dev/null +++ b/node_modules/camelcase/readme.md @@ -0,0 +1,56 @@ +# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase) + +> Convert a dash/dot/underscore/space separated string to camelCase: `foo-bar` → `fooBar` + + +## Install + +```sh +$ npm install --save camelcase +``` + + +## Usage + +```js +var camelCase = require('camelcase'); + +camelCase('foo-bar'); +//=> fooBar + +camelCase('foo_bar'); +//=> fooBar + +camelCase('Foo-Bar'); +//=> fooBar + +camelCase('--foo.bar'); +//=> fooBar + +camelCase('__foo__bar__'); +//=> fooBar + +camelCase('foo bar'); +//=> fooBar + +console.log(process.argv[3]); +//=> --foo-bar +camelCase(process.argv[3]); +//=> fooBar + +camelCase('foo', 'bar'); +//=> fooBar + +camelCase('__foo__', '--bar'); +//=> fooBar +``` + + +## Related + +See [`decamelize`](https://github.com/sindresorhus/decamelize) for the inverse. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/capture-stack-trace/index.js b/node_modules/capture-stack-trace/index.js new file mode 100644 index 0000000..1b696c8 --- /dev/null +++ b/node_modules/capture-stack-trace/index.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = Error.captureStackTrace || function (error) { + var container = new Error(); + + Object.defineProperty(error, 'stack', { + configurable: true, + get: function getStack() { + var stack = container.stack; + + Object.defineProperty(this, 'stack', { + value: stack + }); + + return stack; + } + }); +}; diff --git a/node_modules/capture-stack-trace/package.json b/node_modules/capture-stack-trace/package.json new file mode 100644 index 0000000..76ba316 --- /dev/null +++ b/node_modules/capture-stack-trace/package.json @@ -0,0 +1,61 @@ +{ + "_from": "capture-stack-trace@^1.0.0", + "_id": "capture-stack-trace@1.0.0", + "_inBundle": false, + "_integrity": "sha1-Sm+gc5nCa7pH8LJJa00PtAjFVQ0=", + "_location": "/capture-stack-trace", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "capture-stack-trace@^1.0.0", + "name": "capture-stack-trace", + "escapedName": "capture-stack-trace", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/create-error-class" + ], + "_resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz", + "_shasum": "4a6fa07399c26bba47f0b2496b4d0fb408c5550d", + "_spec": "capture-stack-trace@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/create-error-class", + "author": { + "name": "Vsevolod Strukchinsky", + "email": "floatdrop@gmail.com", + "url": "github.com/floatdrop" + }, + "bugs": { + "url": "https://github.com/floatdrop/capture-stack-trace/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Error.captureStackTrace ponyfill", + "devDependencies": { + "mocha": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/floatdrop/capture-stack-trace#readme", + "keywords": [ + "Error", + "captureStackTrace" + ], + "license": "MIT", + "name": "capture-stack-trace", + "repository": { + "type": "git", + "url": "git+https://github.com/floatdrop/capture-stack-trace.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "1.0.0" +} diff --git a/node_modules/capture-stack-trace/readme.md b/node_modules/capture-stack-trace/readme.md new file mode 100644 index 0000000..a944ab9 --- /dev/null +++ b/node_modules/capture-stack-trace/readme.md @@ -0,0 +1,36 @@ +# capture-stack-trace [![Build Status](https://travis-ci.org/floatdrop/capture-stack-trace.svg?branch=master)](https://travis-ci.org/floatdrop/capture-stack-trace) + +> Ponyfill for Error.captureStackTrace + + +## Install + +``` +$ npm install --save capture-stack-trace +``` + + +## Usage + +```js +var captureStackTrace = require('capture-stack-trace'); + +captureStackTrace({}); +// => {stack: ...} +``` + + +## API + +### captureStackTrace(error) + +#### error + +*Required* +Type: `Object` + +Target Object, that will recieve stack property. + +## License + +MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop) diff --git a/node_modules/center-align/LICENSE b/node_modules/center-align/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/node_modules/center-align/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 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/node_modules/center-align/README.md b/node_modules/center-align/README.md new file mode 100644 index 0000000..cbcf3be --- /dev/null +++ b/node_modules/center-align/README.md @@ -0,0 +1,74 @@ +# center-align [![NPM version](https://badge.fury.io/js/center-align.svg)](http://badge.fury.io/js/center-align) + +> Center-align the text in a string. + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i center-align --save +``` + +## Usage + +```js +var centerAlign = require('center-align'); +``` + +**Example** + +If used on the following: + +``` +Lorem ipsum dolor sit amet, +consectetur adipiscing +elit, sed do eiusmod tempor incididunt +ut labore et dolore +magna aliqua. Ut enim ad minim +veniam, quis +``` + +The result would be: + +``` + Lorem ipsum dolor sit amet, + consectetur adipiscing +elit, sed do eiusmod tempor incididunt + ut labore et dolore + magna aliqua. Ut enim ad minim + veniam, quis +``` + +## Related projects + +* [align-text](https://www.npmjs.com/package/align-text): Align the text in a string. | [homepage](https://github.com/jonschlinkert/align-text) +* [justified](https://www.npmjs.com/package/justified): Wrap words to a specified length and justified the text. | [homepage](https://github.com/jonschlinkert/justified) +* [right-align](https://www.npmjs.com/package/right-align): Right-align the text in a string. | [homepage](https://github.com/jonschlinkert/right-align) +* [word-wrap](https://www.npmjs.com/package/word-wrap): Wrap words to a specified length. | [homepage](https://github.com/jonschlinkert/word-wrap) + +## Running tests + +Install dev dependencies: + +```sh +$ 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/center-align/issues/new). + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 Jon Schlinkert +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 27, 2015._ \ No newline at end of file diff --git a/node_modules/center-align/index.js b/node_modules/center-align/index.js new file mode 100644 index 0000000..c6ed54a --- /dev/null +++ b/node_modules/center-align/index.js @@ -0,0 +1,16 @@ +/*! + * center-align + * + * Copycenter (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var utils = require('./utils'); + +module.exports = function centerAlign(val) { + return utils.align(val, function (len, longest) { + return Math.floor((longest - len) / 2); + }); +}; diff --git a/node_modules/center-align/package.json b/node_modules/center-align/package.json new file mode 100644 index 0000000..d850602 --- /dev/null +++ b/node_modules/center-align/package.json @@ -0,0 +1,82 @@ +{ + "_from": "center-align@^0.1.1", + "_id": "center-align@0.1.3", + "_inBundle": false, + "_integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "_location": "/center-align", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "center-align@^0.1.1", + "name": "center-align", + "escapedName": "center-align", + "rawSpec": "^0.1.1", + "saveSpec": null, + "fetchSpec": "^0.1.1" + }, + "_requiredBy": [ + "/cliui" + ], + "_resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "_shasum": "aa0d32629b6ee972200411cbd4461c907bc2b7ad", + "_spec": "center-align@^0.1.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/cliui", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/center-align/issues" + }, + "bundleDependencies": false, + "dependencies": { + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" + }, + "deprecated": false, + "description": "Center-align the text in a string.", + "devDependencies": { + "mocha": "^2.2.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js", + "utils.js" + ], + "homepage": "https://github.com/jonschlinkert/center-align", + "keywords": [ + "align", + "align-center", + "center", + "center-align", + "right", + "right-align", + "text", + "typography" + ], + "license": "MIT", + "main": "index.js", + "name": "center-align", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/center-align.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "description": "", + "list": [ + "align-text", + "right-align", + "justified", + "word-wrap" + ] + } + }, + "version": "0.1.3" +} diff --git a/node_modules/center-align/utils.js b/node_modules/center-align/utils.js new file mode 100644 index 0000000..aead6d2 --- /dev/null +++ b/node_modules/center-align/utils.js @@ -0,0 +1,40 @@ +'use strict'; + +/** + * Lazily-required module dependencies (makes the application + * faster) + */ + +var utils = require('lazy-cache')(require); + +/** + * Temporarily re-assign `require` to trick browserify and + * webpack into reconizing lazy dependencies. + * + * This tiny bit of ugliness has the huge dual advantage of + * only loading modules that are actually called at some + * point in the lifecycle of the application, whilst also + * allowing browserify and webpack to find modules that + * are depended on but never actually called. + */ + +var fn = require; +require = utils; + +/** + * Lazily required module dependencies + */ + +require('align-text', 'align'); + +/** + * Restore `require` + */ + +require = fn; + +/** + * Expose `utils` modules + */ + +module.exports = utils; diff --git a/node_modules/chalk/index.js b/node_modules/chalk/index.js new file mode 100644 index 0000000..1cc5fa8 --- /dev/null +++ b/node_modules/chalk/index.js @@ -0,0 +1,228 @@ +'use strict'; +const escapeStringRegexp = require('escape-string-regexp'); +const ansiStyles = require('ansi-styles'); +const stdoutColor = require('supports-color').stdout; + +const template = require('./templates.js'); + +const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); + +// `supportsColor.level` → `ansiStyles.color[name]` mapping +const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; + +// `color-convert` models to exclude from the Chalk API due to conflicts and such +const skipModels = new Set(['gray']); + +const styles = Object.create(null); + +function applyOptions(obj, options) { + options = options || {}; + + // Detect level if not set manually + const scLevel = stdoutColor ? stdoutColor.level : 0; + obj.level = options.level === undefined ? scLevel : options.level; + obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0; +} + +function Chalk(options) { + // We check for this.template here since calling `chalk.constructor()` + // by itself will have a `this` of a previously constructed chalk object + if (!this || !(this instanceof Chalk) || this.template) { + const chalk = {}; + applyOptions(chalk, options); + + chalk.template = function () { + const args = [].slice.call(arguments); + return chalkTag.apply(null, [chalk.template].concat(args)); + }; + + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); + + chalk.template.constructor = Chalk; + + return chalk.template; + } + + applyOptions(this, options); +} + +// Use bright blue on Windows as the normal blue color is illegible +if (isSimpleWindowsTerm) { + ansiStyles.blue.open = '\u001B[94m'; +} + +for (const key of Object.keys(ansiStyles)) { + ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); + + styles[key] = { + get() { + const codes = ansiStyles[key]; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key); + } + }; +} + +styles.visible = { + get() { + return build.call(this, this._styles || [], true, 'visible'); + } +}; + +ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g'); +for (const model of Object.keys(ansiStyles.color.ansi)) { + if (skipModels.has(model)) { + continue; + } + + styles[model] = { + get() { + const level = this.level; + return function () { + const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments); + const codes = { + open, + close: ansiStyles.color.close, + closeRe: ansiStyles.color.closeRe + }; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + }; + } + }; +} + +ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g'); +for (const model of Object.keys(ansiStyles.bgColor.ansi)) { + if (skipModels.has(model)) { + continue; + } + + const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); + styles[bgModel] = { + get() { + const level = this.level; + return function () { + const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments); + const codes = { + open, + close: ansiStyles.bgColor.close, + closeRe: ansiStyles.bgColor.closeRe + }; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + }; + } + }; +} + +const proto = Object.defineProperties(() => {}, styles); + +function build(_styles, _empty, key) { + const builder = function () { + return applyStyle.apply(builder, arguments); + }; + + builder._styles = _styles; + builder._empty = _empty; + + const self = this; + + Object.defineProperty(builder, 'level', { + enumerable: true, + get() { + return self.level; + }, + set(level) { + self.level = level; + } + }); + + Object.defineProperty(builder, 'enabled', { + enumerable: true, + get() { + return self.enabled; + }, + set(enabled) { + self.enabled = enabled; + } + }); + + // See below for fix regarding invisible grey/dim combination on Windows + builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; + + // `__proto__` is used because we must return a function, but there is + // no way to create a function with a different prototype + builder.__proto__ = proto; // eslint-disable-line no-proto + + return builder; +} + +function applyStyle() { + // Support varags, but simply cast to string in case there's only one arg + const args = arguments; + const argsLen = args.length; + let str = String(arguments[0]); + + if (argsLen === 0) { + return ''; + } + + if (argsLen > 1) { + // Don't slice `arguments`, it prevents V8 optimizations + for (let a = 1; a < argsLen; a++) { + str += ' ' + args[a]; + } + } + + if (!this.enabled || this.level <= 0 || !str) { + return this._empty ? '' : str; + } + + // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, + // see https://github.com/chalk/chalk/issues/58 + // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. + const originalDim = ansiStyles.dim.open; + if (isSimpleWindowsTerm && this.hasGrey) { + ansiStyles.dim.open = ''; + } + + for (const code of this._styles.slice().reverse()) { + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + str = code.open + str.replace(code.closeRe, code.open) + code.close; + + // Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS + // https://github.com/chalk/chalk/pull/92 + str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`); + } + + // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue + ansiStyles.dim.open = originalDim; + + return str; +} + +function chalkTag(chalk, strings) { + if (!Array.isArray(strings)) { + // If chalk() was called by itself or with a string, + // return the string itself as a string. + return [].slice.call(arguments, 1).join(' '); + } + + const args = [].slice.call(arguments, 2); + const parts = [strings.raw[0]]; + + for (let i = 1; i < strings.length; i++) { + parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&')); + parts.push(String(strings.raw[i])); + } + + return template(chalk, parts.join('')); +} + +Object.defineProperties(Chalk.prototype, styles); + +module.exports = Chalk(); // eslint-disable-line new-cap +module.exports.supportsColor = stdoutColor; +module.exports.default = module.exports; // For TypeScript diff --git a/node_modules/chalk/license b/node_modules/chalk/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/chalk/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/chalk/package.json b/node_modules/chalk/package.json new file mode 100644 index 0000000..4e651b9 --- /dev/null +++ b/node_modules/chalk/package.json @@ -0,0 +1,99 @@ +{ + "_from": "chalk@^2.0.1", + "_id": "chalk@2.3.2", + "_inBundle": false, + "_integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", + "_location": "/chalk", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "chalk@^2.0.1", + "name": "chalk", + "escapedName": "chalk", + "rawSpec": "^2.0.1", + "saveSpec": null, + "fetchSpec": "^2.0.1" + }, + "_requiredBy": [ + "/boxen", + "/update-notifier" + ], + "_resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "_shasum": "250dc96b07491bfd601e648d66ddf5f60c7a5c65", + "_spec": "chalk@^2.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/update-notifier", + "bugs": { + "url": "https://github.com/chalk/chalk/issues" + }, + "bundleDependencies": false, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "deprecated": false, + "description": "Terminal string styling done right", + "devDependencies": { + "ava": "*", + "coveralls": "^3.0.0", + "execa": "^0.9.0", + "import-fresh": "^2.0.0", + "matcha": "^0.7.0", + "nyc": "^11.0.2", + "resolve-from": "^4.0.0", + "typescript": "^2.5.3", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js", + "templates.js", + "types/index.d.ts" + ], + "homepage": "https://github.com/chalk/chalk#readme", + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "str", + "ansi", + "style", + "styles", + "tty", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "license": "MIT", + "name": "chalk", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/chalk.git" + }, + "scripts": { + "bench": "matcha benchmark.js", + "coveralls": "nyc report --reporter=text-lcov | coveralls", + "test": "xo && tsc --project types && nyc ava" + }, + "types": "types/index.d.ts", + "version": "2.3.2", + "xo": { + "envs": [ + "node", + "mocha" + ] + } +} diff --git a/node_modules/chalk/readme.md b/node_modules/chalk/readme.md new file mode 100644 index 0000000..f96a964 --- /dev/null +++ b/node_modules/chalk/readme.md @@ -0,0 +1,309 @@ +

+
+
+ chalk +
+
+
+

+ +> Terminal string styling done right + +[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) [![Mentioned in Awesome Node.js](https://awesome.re/mentioned-badge.svg)](https://github.com/sindresorhus/awesome-nodejs) + +### [See what's new in Chalk 2](https://github.com/chalk/chalk/releases/tag/v2.0.0) + + + + +## Highlights + +- Expressive API +- Highly performant +- Ability to nest styles +- [256/Truecolor color support](#256-and-truecolor-color-support) +- Auto-detects color support +- Doesn't extend `String.prototype` +- Clean and focused +- Actively maintained +- [Used by ~23,000 packages](https://www.npmjs.com/browse/depended/chalk) as of December 31, 2017 + + +## Install + +```console +$ npm install chalk +``` + + +## Usage + +```js +const chalk = require('chalk'); + +console.log(chalk.blue('Hello world!')); +``` + +Chalk comes with an easy to use composable API where you just chain and nest the styles you want. + +```js +const chalk = require('chalk'); +const log = console.log; + +// Combine styled and normal strings +log(chalk.blue('Hello') + ' World' + chalk.red('!')); + +// Compose multiple styles using the chainable API +log(chalk.blue.bgRed.bold('Hello world!')); + +// Pass in multiple arguments +log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')); + +// Nest styles +log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!')); + +// Nest styles of the same type even (color, underline, background) +log(chalk.green( + 'I am a green line ' + + chalk.blue.underline.bold('with a blue substring') + + ' that becomes green again!' +)); + +// ES2015 template literal +log(` +CPU: ${chalk.red('90%')} +RAM: ${chalk.green('40%')} +DISK: ${chalk.yellow('70%')} +`); + +// ES2015 tagged template literal +log(chalk` +CPU: {red ${cpu.totalPercent}%} +RAM: {green ${ram.used / ram.total * 100}%} +DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} +`); + +// Use RGB colors in terminal emulators that support it. +log(chalk.keyword('orange')('Yay for orange colored text!')); +log(chalk.rgb(123, 45, 67).underline('Underlined reddish color')); +log(chalk.hex('#DEADED').bold('Bold gray!')); +``` + +Easily define your own themes: + +```js +const chalk = require('chalk'); + +const error = chalk.bold.red; +const warning = chalk.keyword('orange'); + +console.log(error('Error!')); +console.log(warning('Warning!')); +``` + +Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args): + +```js +const name = 'Sindre'; +console.log(chalk.green('Hello %s'), name); +//=> 'Hello Sindre' +``` + + +## API + +### chalk.` + + +
+ + + +

nodemon reload, automatically.

+ +
+ +

Nodemon is a utility that will monitor for any changes in your source and automatically restart your server. Perfect for development. Install it using npm.

+ +

Just use nodemon instead of node to run your code, and now your process will automatically restart when your code changes. To install, get node.js, then from your terminal run:

+ +
npm install -g nodemon
+ + +

Features

+ +
    +
  • Automatic restarting of application.
  • +
  • Detects default file extension to monitor.
  • +
  • Default support for node & coffeescript, but easy to run any executable (such as python, make, etc).
  • +
  • Ignoring specific files or directories.
  • +
  • Watch specific directories.
  • +
  • Works with server applications or one time run utilities and REPLs.
  • +
  • Requirable in node apps.
  • +
  • Open source and available on github.
  • +
+ +

Read the full documentation.

+ + + + diff --git a/node_modules/nodemon/website/mixmax.png b/node_modules/nodemon/website/mixmax.png new file mode 100644 index 0000000000000000000000000000000000000000..5f043a9c31d4a7cdc0a50eb258428ab97ab7c405 GIT binary patch literal 7319 zcmb_>XIPU<)GdOjAc%)1ihxS!L3*zuEmR3zKzavh(whng=}73IgpNp&-UA8(0s*8; z2}qY-LT~xrpq~5tyZ8RcGtVUZU3<;iYtPIJVb9bQNQv(eSDvP>mUvGroXjjAKpai2EuogC7Tzvhmg0DL_eCJGPqe%y z*3*f+47Jf6TPYA;BD76bmFggvg7T_`hIBijGiRtIakfmY!%r6C8w{ZVat``uA70~E zu=WoA3$=|kvSEv_xWO6``t7=+6|*g@rpiIJQgvw>bFQvgmg@=Y8tj8$P9^&H^7-7h zBo2{>O@|W8)4uYyC3JYNXQlCo@bKF3@jjRRH*kY5XTX3*aue^*fQtcU|M#JPa{TYX z2NgOLr@ivxhxnh`8+6Bc7E!YHQc@=}V278B#xlc@@P)@N!-^%9An?)lUGP(*x5PGY zP2cQOQYFxF)MJF>r71{m7PHWhpyUYozm$FUX`S8ej|F|d+V*zVl@;}r;POl2n?2DQ z-N%oVGKoS6M=40ILC67=FV2eOi-=gzj^!mv$P?HzH;pT*+~Bf|?Cc74w!G%>%P?+5 z@+tFRW*TY|g4Wr=ocju@Pl*6n6JZM?*i|@*81H+N1q~?l7?P3}N^T?5ioZ56@eqPb zb)c!IcR-Yv7WWJv2irpSfN@({>ymQ8hYx$sofXH3xdmQBBWW+_c)dam;h=ZP^icV z2O1;v5#Q^_KBqb-8CkF#r0l+4gtevA(cr`AchR@A~%XDf~{+g236KMQ(T+D&^6>Z$3IhW*Ca2a@eKEb~m-kBKj}wS3u~ROTzxkw| zo#}fk6%zk7!?&}Pl+4TZ3TPH2F57Kr0W>1D>Xd{dzjYHQgJPpDl`R4UOfRmMB)C-R z)Klxh5nmn-(uVvkn(~gW8mub?&=v$PqtDxuQxXxm6k1Oe(uF$D^|`1%v?^Rl2D$&U~(MLey~gmmNRYuzdbQJ_-G0_7WWGNZMLycnwF0zGGi72rF^}q|Ul&TddvD59oo3!a_ zv(Xg9d|>z1^vT3HJH+hxWF#?O-Z+BU!wyJHbyj|yb?_LSa8RBOf;26AZ|>We6#yji z(nn<*D~pdG8icz!f@`*o_{-G+-VP95M?nx#7ddB`?4EyZAdr__GntC}iaTg4+IPJDxA9IUtBOl$Uh20 zUw4;AO4475Z&0 zCYtQOUqUO1ZM-aSvmXl5iI-zvj-nMDeknt7ic=rDCI6k;K#^$fFHLYr7IL@qQ$+>iRHH{Hmdqj`Vib zz?xkC)x+{1t)#ecpkQCK+7hZE4W z37e`0de!wIz$_efLm;ABwZrRR<9i4*8upcbv zRGN)DbtnHv4#Krfs9?MtTXj`=`3Wg*g*3t>KZO<`*>1+Pu;BSuMsIMX0Tu5Ra1@eh zuWi;W3hgJ#J&G_^__M-Iee6-bV6C~?NnG%}cZM(Fe^LY3RZNg6`Up-xs=tf$oS&zi zY>Ga2P$Ulv_7(XfUFS%KoAS94;1M=tc2?E_)nBQbN!1-}FcU0!QV^S=vxfVZRmZt+ zYYc4)u^mRNu6{KBQ%B;9v!%GT$*JhB%YI18x|GmTuA!lDIuSHGMHQuk4F25*oGTye zdmRyGPxS#Sk^HvOo-S~-35{X95`7~#!`i8vLx0CoiEl4ys+PPo$RM?ZfTooHYZ4N08q+a(s!vYj&-S0Xw5v|F zi|jvEPfp+ke;ZIc6%pp>J{j)78UgJS$9e6?{x%~e8z^ioClIKGIC+>BmJr84QBP<4 zd%pD}7$|(>Lt0ZRm=4HU&?N=x@m;^E2p~1`&u$?FX*!>issTMGtIh%|Ii8N(iNe{(gM021dEci>CdjX( zN3rlmoOwRqiod(*@%3dB^!^p@b(${sM9Kf|mAK31|L5x^07v6t@!-q$!~2iV>*lW( z^dNwv+S*9SMHyUEMqp`@n^`r==rJD=(G!k;g=J`~GBI&g?NC z)LNu0wa`(j_PDJQA$9lT9v`g4xces$j}ED^;i@CfTZ^%6ilvo|qNarSUlL$ix3*6m zP{}T1FDDk#g!Y(47FBpM*5dAma&;|~Wo)VA4(X-iwrH#B4TqdGf~Q%iqQ!pRk35l~ zq7hdi{pOV__wMZ~7HL@qE|1%P`nhb`$8*u+*4)>OPhy{2n~(s%eM|kg@7ZI%`;R4* z5`BN+!SS9PJjA>1%aBhcY;Kd3q#^SDxXJ_ZeZm%lMd`O^;FH`W=?rPBloX}B3Fo(6 zVl7V^y2k4Su5k_;ofd&rP0@F8jJ?Qg^XygC+nm633>Z8dc~+HLiIr~W?-X*(hbL7a+Uom1VEvjii2 z5LnSlfFdHi!{3)%nUyu!zYM(0XG8Sbbi*eW-{)CxYh)x!N$YARq^|L3Zn&^gd9=hp zYYeNe-V0Ugj}I1@^KZ$`oqI60zk8ph&hx=f0q=~%kowH;W0AAl#rU0FqELIMaQ>1* zD$bb%Z*zm%j{>PeV^t(_CY)M7-i@RmMTo^+-r4scM7HAUjD%= zya{Q{O>_2O>Uz+X$_$pp#=ubdqD1((q+!UeW;}5k*CggH5BvB{tnKaO#YozMdGk&k z@YeeJk+j;0EdtrsO8wa1Eab$Vx)mYy{76J@akKt2xB$Y4|B#5`-1 z2}5sXs+@Mek@8+nnx1t@Uv4BPI`s1nWI$}uuL_$xDOt+3w=Y_MJG9<24ADw)2@Cd| zKDDa$H(>sD+PUussh0#^UM?JYipDIb8I&w1xw^W3x@8ZLLyTh04CU6@@}#eOWCw?MMP{PVEA9xMvX5$P{PZ>msN#m^i+e2G4B1@jv8bV1&F(2^5NYaXV^s`bqECGT8n2C+f^M{n$5j z7f6iaC!i`rPZBmALS978*ERb1-KLA_wC-BqM1)t?LQ^8n4*Z4F#EjW7vywgbk)7^~ zn*#xdiR7dp6J_`FpF(3l%2)GWwoThM8ap}#VpxWiNQ%hjZZ0B9>8~3~_kCy6o^tl8 zvUOe9FQzmy3X^Nh*^7#bNVSN9kY|ai!PW2h)iousbT8aT5YN|_isb+oxQ#agpL*wI zect4Dn*+D?g6@jwxZ1!G3{MW|RoEBfnUTc=*+<$rH4X#w;{C@TQKwrkRC+u=q{Cnp zTpov?j^VRWrIRAsqyHq14Y<2&Q_Q#+t09$0<{=h4~(p zz`lb3x}idYwXu3ms-)s5**SM#vx76n+Sv}W zAbG`0YEKv^4VZeG`5=|MqHd{?$CD~~Y+mND3M0@YmduVZB*9K}yKtSo_JhqH1lg;r zCu|<>wQj&PCPbayT*9nmwG*85H~M;u2SN~k{9VktnfEB`5K{esT8;+<~jvC%~1%Gh}a ze~;fNUshS!?&}wPK2tm_oGlc?zlw`d1{jQbZx;$x*SmFBbKIIN)bxb{=Nb3ZyOEpF zar)SN&0OmlnFqIpHJKqC2HZ64Xng}D8({cmG?Fx5L_<%{!$)5J=Sl`+VmFqoyK8() zBqadFQV6_8hOLNAw|#>xf(bc1Ui0LQa1l zT}prwK=cT1=yw;yX{q{RGah2&nm%sp51S1=OpT7>t`!Zvf`UM&VwiX$85Ch*q_5JU zPmEXBn6>koY<8KoN0gDh_V9OR;af*sLOd^R$nduWuoQ7Z%}yKk^a)Ic2_Fx9XzfNr zNUKvn1b~V!gzTEWwwiFySI|}STKBB4XY%CLOSBk6p&m^s>%%ESdG>?#bOSc~0<+HT z{5(TkdC#8Mo0r2UuN(B9p2&;SI}nqa-L}iyyLRk()@QHdpApKUk}T=5g{*90^tsQ$ zBq6f|XFVO6;$!Yrt?t7#EnA3?b(k6G^zd(bu6;x$4H6l{_PJVT+gdJsw2wV4pHmL)AxE+lnEa5{)obf$jm(;w=&vTV zg)Mx^3N~NsKHZg)EP#-F*dPXSvZlaGh%&6SJSc0BbmdvbaJxJ zP;|3l({_m`PQpbBKI490fPGJ$hlNjR?bk3gjU6_|7G&gkSaR!R>P2&f0KKQ0vTp5_ zkZOgz;^!D?7gPaa2}OrxAa-m_Vji9^9-kP@cB-{B$nDyJ^W=j@_#RBg*RyQ4Z7M{+ zjrn#!RiN&B?pk3WqJn{v8!=atw%vohXQD!OFF!bKxEp2i4ttt=2k93YB7GNM?FM0x z&v>8iO{oWrG$d12C!PmY^WwL^aeLOQueYnA6iL*(>=V{I1DS>P-Ulo42k~3fWrDKa|tH zTkENZx&FFP=#J62kiszw?Wa*pS{v{Jc@y|Za(uFlRUFAOGTMl1uj^Ya>gUpiN%#!S zdx;j;d3Ap(bfg*0!Z245rWSklv5LKM9{geK`H-+a)x}0Dt#@;C zyZXM}&2j$xjA8n{3Fn%do;T&5wmEKvx}et^HXl|ntX=oaW<_Ky4A8c)dZ`H;eul^dIi@qYoGlp2KLLbJS=Yu+jA|UX0)o68P;O|s779ty6eT@}j2*5Ux#mm|S!D;Dt z44ygUxsS?V6`c0aJ4e2q--fqdZVU`gAsrtCQBSnjlouUflv{Xrpkf*;y#z*{^76j~ zu~+cj6PB5x55+Q6jDc;3m#mA!jxI!iMjZR){60b~W1pZfQn$G%cIjJvK+s5+N3oNW z6L288$oW2+RXJR<5ImQh-JVS%+cK&Vd}uJZS?T!ix#FlVDR?{)mC#k-pLo;+6`Ir4;N>f`r~)kf}p1n591FcYVQs|>)mKMpfdjc{CsMe5i&g;dAQ}y z7qb~^Y8032^WxzI1Ei#_?3&794Bdz8r#3PUq4JDmxs_??9Bx*=x0c@u{95>OnAVS8 z7#Z!4@Oq<`Rk(U#pXa8gh7RaTPgO`}C9#JDBkk=8ZYa{007+dfEe{9bG<*76QrS{# z9IV3reh+?5tzte`4qQ}hNQItW8TjRUhh?R|oANj*g=e$S8@&ylea-&5S?*TubV#!P zFq#s=AR-bMz(LV+Jr&Dzy!r^cRC+g$AH!g!HAvrEz&1XfgA(4Gp~*ijlCN12FX(*V z+wp9{-J5m65Rh!=j(3qpWR9F958X5(zMuG-Rw1t|wL{?70&7S{v}}!GIp&mOE=+cO zFEa8o2HLlt0dd~@RW9T(u@Dc%DC!YBx`#F!)Z`-AanIXd%{;EYmy))kX*!p&tg3$C zriqqv{h7WvQ|zh+V_q6>a|;}4VxIK3oQp=gI=3t$#Y?Q)NQ^(&Lt!RQ@uVf<&9sKR=FtC zy0)f<20L3FZ>a>wHAVOQO>6AlM01O`UE&I#%5KC{&*6~~u!^OB=^8vM&HrW2GxJ8L zSmBqlp7W75ZLo01(qV^!D*_Y+FlMJ(5YF9_0cxit$_a{ z?wO&$-gR9y(z#9s?l9S5xVj^Oo*EyQoP@XtQ}bD6|v5Rq;cYB{t*2J~R6>cRdM2}}fj*n-ehxgj_3U0uo zq5eDIg%ILqxB>U$pW**C^iPieCAjZBEZ1i|$K#{At9ytx;6IIc5IHs3QW=xC{{xVF B4L<+? literal 0 HcmV?d00001 diff --git a/node_modules/nodemon/website/nodemon.png b/node_modules/nodemon/website/nodemon.png new file mode 100644 index 0000000000000000000000000000000000000000..f7ca20a864cc7fe0570c93708478202d8f052404 GIT binary patch literal 16333 zcmZX5RahKd(=E;bgWF)iB>}=faCZ+LAo$=G+}+(ZxNC3?E)z7kySuvw4)6D0o{R2_ z-rY}^b?vHEtHYHPq|i}`QDIRbXIXf$s+^0O|ewYFpv*zJOpR@>K)|rZyJs z1%e0zBNQYfE~4fJd+LqsMcUW#Hli1QMzib?AKeyB0$Rr5K$rGcq8bv$3B{Av1MGIt z7~pm%eC3OXH%>>V#7vMP9-{Ug38eT=L*pOR-i`pKNr@s`VLd}9EL3f2TYa-tsHj_N zTV3XD7zRj31p(ooSwboueZPI>pj#Z<16=833_ZR%vyp zxQ`y#$_11nDt*z`TQyCuDuYu(B$rN5t1_){wvnU|3!o_sinG>FoHW!tXvOwNMO7&! zMn$1qCq!Vcw9s4TeAMxt!Ta+Ob_UouF@$Yw@A-oBT{?FTI2_Tr>NRL6q}J^IWv8NLhc`JzT=g->N-#RY#39uVaovMw}kL zV>|7j|3KgMqAft2@f225o)jEi3Y$9(*BEfLIYh}Dv6cj=C}_kz7_TnNb|U&JzPiYB z#eObvC6_xQ;B<5xz-)D{KSrHu8+Ri+c3`zr)xd(^CHrgmP&T<$deeS|Tac`A-fAKq z1|v%ez`bqxV00_+H=q<{XkR_pUI*(tMZMJLFk;pifOZ&w*3$bV2Mw#?bp}YZMQ^%N zOg@mnze^uH5_kG`m%J_MEK~Hi>8Lbnf&$yShoSQ-fPvUvL5;cK(2+_hh7Hu!-fnsO z7_>kkG8p{S=sYhc?G^Om^5xKHo`J~fTPj;@^13CgF)>frAlFWTDqP>MF(9p-=$ENa z3}L$dxtGPb#I_-WP7N_3h?EF0SsEJ`7R-i6$6B+wV^U*ZQK)bk)O1Y|;w-dq#6MRM zFa+h-6aUItr&%xYsW>m~2;o)b5HnX?tnM_uTXASC{S^dmG9)a_w4lUUW~r3^AV)?S z+?enkB99WU=*cV+6lVvSUYT3BSk=(uq6s3}lik{B##VC*evdVR4}2CO={3oY0uc7# znu3m$xQ#gpyJMbs+)OMEt{L7V{Hb`Dt z0~A%b`|U^ZnoLR%Mej^?0+<8tiZO6L+EvY7N8$fDXCZIyMH_if{K6j%p(a%Z=t*zK1@ zc;G@38*@~3kys3ZeCKsKoRmyBs~G`ubclvf+FU0Mc{myu9n1u9$}5R_}kSw)-)Z$&Z%bM{~!;!tzzH zBuuJdu^blL2ReRvC|i30BqY-#F0Q5=uD1N=^k&*L^j(UQ18>$X%Wa-n<0-9(hBG7) z6T5<;yWpTMy*7fViQ~mAkvz62D*QXYWD_d>O0UI`N|-z~@ajiXKJpPZ4b-Ya`ZrE7 z#h}a0jPp@4HkN5N57L{TAm${NoQg~s8{>YmmdTrJGmi=6<0x0g!5cs|Yidev#I)nT zL^egiv=Kc=ATX^KAfT#%CR2Tq_=Wy^!b18Ea7Stq=#FwProI8}!l=1KC60HxM-iZfe z$BK{oX9U5m?q^{6-;pGkM(`KhT>uI34RyWC*@CN*_%bNt};)R2(aIFlis06Sz#2huD@ zXc3xPw^9tCEintH06usyqOGm9sbvpg z6|T=7Jo1DnAUDy5ELO4};QqzzV3*Z%oE4mVYDC`PAH~Y(xB3EM%Jk9ycD#N%MY;PU zaI&W9&f&rMUovj*Lf+<|0wXk_R%{Sa+=-td3Q#Bj3;;*v1XM3qW44-Z{J{g=T3P9* z#yO?HwssEUe2R><$*eufRfYilYn@hK+z;i8R~eMMcE3Cw;2}WoV}nF?HovXFR~xSO zMRD{PAR=(6gHYtse`#mT%n!L^fNIK@5)&A7lUeG$qJf^DvnX;0?cSVcKbRkj6{SDpdd|j0Y70wjcUqL$kLrVADS1ErlWDRX zqK4oBMEzhyrY1Q8{Z6|MHho(nCl5qV#ntlp_|cv`-F>`{#qHM6GD2 z_GJ?m65E7R)QKF(Rz%?!`=NJn2!<(=eD1SwANi{9tIs4v@d}8VwU0YArc|z39Te`q z*#Ch~$2Xp5@wifeVm&`;VDnvRIHnk;bP;gJ_=$v(V21&@DIZ%okDk-vyADV95`j^$ z;9dLU@p+5R<+i_Q_y`_#Fo%q1qZyQo>3}a&{FB>_*hokaIJ>6+5s2{sUeYG(wd#T4q zvshACs#S%tmJYXZ*x(R`tPlYzW2`wMVTc0Xk*L?LMTPuWo%3#an%>jMG~>UY`2|eB zjL%t#JknX$MbH{#<_~=G2=Sm-zh;Mj)#b8terdlic-8pPsZonPm0~>{E6k9*>K58q zw(6u zB@0C1!u-v*DOrW!a5F}itYZEW1N`zvR3$PzVWJ-hk%mY9Vh_eM`2Vxjh5-YX(#uXt zPmdBs?!ypsU|^oG@MWTQ2%*6Sc$GydI3~nbr9LXnRf{Cvs2KfE%^We2E^;6flc5G> z+b)OGc*}{UTxz21V8e*0+G;@Gfo;RZL3p)l-zsYKTpo}|NT_0u8Q*^0)nP{}A)f)gXK zt>2??M5wnDVaBAS6jBc!{3r#$gbTzAvRKp)u~=+%lujOrW@DyF!o43IEJ6_3%YqN_ zg8o8rWAkl}iB~!pF>%yh8kdz`?urXcdH9d&j?_*|)neH-NpkIFTw{{?Lbitw&RgQd9Ph7aD*A?&&J=%_= z)&PnLeaaemTUjcz&B$PIc-q6s;8%?&DzdASX z)9(zl9iQQi?+=3XClY(UfsOmYp+3wbdDRKyqaUD?3HJA+J~q{h4yMw129J!uG$5VKg5WuFB`;+0Vat6_f&v?4?e*;u-!esCXN`eDZ?# z8CF?@AuwD6Z)7#XuYFI-lr_~v*xR6aJ-0%z-G=OhcnaAy|&6QoCivbYc zFgTS`{UM5kVj>@f`HMHJriuXTcItq|WyA15bBO(N$P$sa_Y~c)2*f;6Ca@d*`_W8p za+?hC({Lkh?@j#&NLpqSksytg*h&spRljW+{R{9`M29EHCQHQb6EFZ)VTy6Uh2&fb zTVIi5W$>RR%g><0xA&rggM#%wl8SdK$#`aztH*|d`r`e|B*Av8U;`{oceX5k1fw7S zTKtl+le|)p?>HW*POPqkY$A3eAl(MZMH9%iBVT)XPBF2&-Kg1Tb9UH2#DI_v<7At< zP#D+c@DYJoKoAZt+6(TuVZL_5q1yg)tfW*mwC z!tI`fpJcJ*4QI^DM4tS!PZ5|GzTVLMP)Vo$+j#4$eBWj0zCL7!L4Rc@z_BSsK5s1E z2ODxNl@l?oKN6KrA4G6&Pe!{Wf|o-?#1U;L2||WkmcI_4y4`t?-&0*liCKV_LOHqU z(9VMDw=aDKDlf}6daE6Vf*B`hmNTq9!`7~{QRf1Edbvcuf?m-{oMxf8iv`?2D5N%- zTe|w5XexK^MsmHair28DCS^kdguD5sY4e!Bu8{=Q9qHf{X)ABoGNedJg3tF(;L zn9DXZ5Nk4fB7!Us8EtWGGjOuLC3>_|N8eRBn8I^?DR=JtvXGJKrb;UD>FTffykm6d zL^4Xa`)p$awwj(S(&vbcQLc5XAM_~jJ89!vH;n3-H7~`L8om7juumF83i|wMQU*7D zH|>b=G35}fkZGGsn;&$&LSf+zc$jb8+aV&KLW<>p`IMz5clpnLtpjn%d;OHudEUU} zWqo|rjMi5&MPPy1`G&Nf{-3RmjKidf;x@kc0}nHa&;4pb8u$F@>!&2Bwk#Qprk8s0 z-3*+8_Hp7au??-5wcioSJb*TMroYVWeB9|rdo)&g3M@fqrQKz%{xDoXE+rE`IxZm6 zr%81DQluOk27^#KB6JB!35y~z-vfzI{o9R1VL6J3`N&~#egOizGvrOLS`z%h*$0Kn zmnK}`pYFCwzx2??K4cBt?^}eIJl<4YtQ3KaZXh_Z6dBXrQ^i#q`%{rTrffa9huvre zEl+Yjnc_-HGMns~&l73ugTn`ss0_(Gwdg1f6INC$5R*E=*R0==32{E*_TLbM(mL~q zVe~+{CD^S#bZX&b2~{;45c?zs7K;rCwwx(F-vOE%?&9ZW4+SWhOyVVzAbo9s{}V|f z>GvtJxO4??F2S&*e ztJhY$y-{=1`Iv6j$VUu}>2Sr++nP?1b;h6H3bsbT<=pkY%&MCEz#p`0G()6q8JXbBT*O}h8w=Td`DRwztq6#L7lq(?R4qy-NE4ZH z0G!my+W{Y+4UvC!0Vc=HW^d;uMeeRky{3yI`xKmhCH(@7veD6-Z4yP3(}gM#*0q@} z=B?l7L4D6K&9)K|*)J`(9rYZx?9=4hd`9evSh9iH?`#>yxep) zpajoMjnAtSYw}`6d%y298Z2yq$=7c`n!m>n*Fj3tda5M5LUp6ZH1zlP)v%@e{(h3= zsjdEH6q2V#K1VO4i#M4uZ1vJC2QYZywr05`S5S5B1J8)|suSAws1ufyRbM-z0hE^b zvLhf2v$mQVuKqu<^;Pt?yKb@l<_^s=eyOuejPIW49);u)kQ*jeVr68OcIut%Q{rXK zYW{nntG2sX0VhRpInDTd#VgWhsK)3%A92{agHW;zN&)dO5SeKfrV4EC*3HJY=C5z^p|K(b)+MKAB6vzWGtpH!F+^o#cz!Gx=k z%)^K2Z##rRq|4dp^g%7Q0XIN%+5@`3L-mlUQ&u=|WjhU1i+}{Ab|ZjWVA+{Q@#7Kf zJoz&z*;aNv3Ak#^=LD+Q8^3ud_cqH)^WsC=F^vxCN3WO8fDT2xl%A8s{aZ0h=e>LF zv6lW}*m~3Ns0CBybA>(&FBB}$4cIQ4s9YUvr7XQ=B!>EF!rj$YFQW~xT4F_ILQQ|q zjykG0lMMY8&CY+X6xe)GkS@Qq;UgK4@zq*-?K(e%o-iX;z=c{s{o;+$3}_a=e9Ah_ zF?^wF*Rwpqy<$P6L#LkfSv;^wqN+yM*#F$SlWAq(Fy{N%>`^J#p9$&i&WQ$Jm=!xq zkEBM4%M~+a{9D1erv0ZKKm>h9fjl)6{z&MFpyxEV^?1q$5vUlc4!7gXP^@>8NJ3ke z6vK%QW07v11xP@Hin;%`Kg|=hj8N2s*!w;wn}kk0gX!QWb!qzyf(=A|H@NE^qaoEl zf7Yfzhu;dD@1_vk;$wG2=uK0SF_zyR8YdrX*}X>dXN!7=EYWdr;O9|MC~WQLD!2|2$SAFKwuUAmDSokn0C$(WLWtEwvgVudXoKy zmz>ELy`Aeyi0~H|GKZ2F43KKGWS?A@;|ua&*OPhxac?Sj_IZr>}d(M@`5UmyCY~2t#1&H`fCfFL2RN zw1M|x@fRPXOWJFCtaJr9fZ#B4e-WKi4uH=#W_2pGWIQtZ5l0U(lG#0xpEZis>e%v& zwDqmz?uK3Pklc9BPEmVc^6FebIi&j`Y_kS*1bbkD+ExjYyXgt^f`^;QnVtzx|4#|z z2C0#vGE&uc1KKRGLJ6mA|Y)Y774* z#2OdgSlKWtRovulWy8Qfx;Edqu7Git-zwSNUp6RzB0W?WJ**~VPfNgI=&q>EUTK%) z+0B3r;4T>{HcGMx5~dl$gi+toKF)WvufjkfkcgBOcrdRC_(z<6tU{6$Y*ruZXT*57 z!1k^gOGcWAH_7QS^don;9|ho^eblN0it$x0M1(*=&ZWJDP>We=88Y^_HPSDuZ(W`Q ziQVW86}aWV_=)W02TOT-=^xq2e3rz+1f|juC+8jnpA{ZKLFc5!UD90DaZO9}>StLO zLYhcPk>8}=UxGdEFiw&Uqgcm-?_Rq;I5|Z(evij`PCh?cnuEu@As-R`K7o+6G7@5K z9N2?rwzm7+cQ;~i;Gq|wZ48p6U$gE)grVLH**j7n-6c0RaT1XHx3n~RC~umRsQPcP z-@eR9eq<<~)#;Yu++_#P6#VlEd+Tw?0m~y`pCjriCfypMX(HKN^I8E5VU_* zvPy=5Y8${hbjLvijw_k11A>qc=zR%jFHM}0O2$0DiR^m{$@5C2%kb`O9~S#CV-&Bv{bobUGKa z<^ReD7o9qnwEVye`Ys6NevNHlabZbe!{MFF7S$y|wu`^K+>zcw{itXjk11AyNJCB< zWXjDf<7=PpCg^c!^jPUFXGG{=%`)i~XbTy1?KZg{>SUmFgW?o`R8?JH{`=-T@W!~G!1M?5n6cW`udkv;c3F084#VJ~gXn<+du?`j5%e0S6nX9~@F->@CM}tT-P103o z*Bw%_Z<364daolEDEW@(AQ&E|Rdj>a$T|>7$y)2kL2NlfNagBrN1)Mx!6f7G$h5PnLmFq({3t6W&PU*S(l%TVowcKT zYdLkaD~y6qKDh(+Fn3~Ua0dJ7QKbFozah}iw5*Xcr;xX2Ns_Fei9>~mgMUkkTL9b= zwR^rSM0(cqw%u|h(Prq052=3wIn2}Sqm-deY)tBHI~_R135Q$w;gS5md~kjf+H zUfLqUCZ{*ai+*J)w*{$N<+|Az^Z^)iDVILNkR+)6IS z`}F)eS7?=an#x*ULm$F=_UlHsKw0=DDR!hM{A)hBJ{FLl71-Rqu(h++(t^>-DB(s-eGMy*5UNW!nfd%{K)-FJ}@ZOW=|UT@EWC zg^El!;BY`6a-rn9+YNrsf#b-w(~*BmiI9j&dlLl^2JPUr-gkrvm9T4jB-n@$k*u9SeovLILLqjsjKe zVlxn4r2uDew$^3YjoajlPEj%b*POFdWcao|NwWpU9&8 z?}_938xCN{`!fv(^nwRNhaVsA1{i1>SFDndteUQunhmK@;giTm=8A&(#y)xpdSC34 zwa%az&GWtiLOGc-VZI`~d(#z!p~fhIRYnvduKW?XygQYKCW1oc3s9eGGiO5RNH(mJFfP9hgogd?vh$Tz*sBsr&^f)IDqh{-082$NkBedI}!) z#2nCWcIuLi+25?;hl_}#Ex-Dm_FG>3VK`z%>M^643d9-v=zeO4^~LD0XMGkxAkvl3 z-=e_ZpVK&ypGCDf>&ZQi=p{elks@po@(?M zS)%goQ`@>=DMneDZ&I`zE;m7{ssW$)*SLHJGr{Q`C8Vc5tt8Gixy{}|+BNUy;DRgp zzZ|@FB3J&6a=Q!eO1NM&W$$y+p~LUne(#dy>J%EX_m4;+#t2`QHGNGfWH3FeQ(nnm zT(Ax~GjZ9QCp_=7O`Z~?^;XzjfNt#U=s`h-DuiR5p>JH7uUv{^EzMbxhxbVm_0$%9 zY)=0j&0OlOothvT${w-dg8_Y%n?r0$95l2trtPFCj;N;!dpUiTz&u(p_eKK~+v03o zdIr?SahI9I`d!?wBCn)tnb6-=kC3PpC~fh+MyRk~S2>8M1U4iw5qud&Yi0hkchrO? z{d&@@t9pBMys3JiSAbx?Lv8MFH} z?B>>#hWU|k=>tR)$+oWM>L8Ban1|Ipy6z$<@0*k6$B(t`&;7&#+sVZUol=K!DSaBhAscqfCR$)NvuWLD2kv4Sd^5Z1?4uMj z)P#@>vUxvCH2iyRS9A2*Ajw>7s{-t-)m!etF&>*+gn zUKdSx(7)mldLo65dPB1RGcYP^u>>|oy6~{@pO?$>8jJN2gK-^@+Exy?uWUJ|fzQ|C z1d8%e()JF;a6IQJI|jk(@uSfqP#E(y*Os69p4QZxfY`R5Zkk^{Oxh~KK zY{-|=uoYkK>|^qc_TWP)MCtBk`Vx@~#lV)q%{n}~R^L7HSeUA9+{f^zgl9OQafns= z+OADO;@bXk@{#0uz2H|KCl_z%4<;Qh;CEQ_H#e9iAySkmNyZ$9)s(FCAt7uzVM+9!kQKklUqQ z-KN`{$UVB3{(;04%R-zRQ^Sdd8ewE(o2$H8fuV=Qcs{a|BZn|GqdP+8}i>#pNm ztZ5t6Vsn!Z8iyaccWagB{tx9bv!$T#%ub8@VGe8zL(n|m)Z@A5c;!A3yFuw8nTK6q zQ|3|rcf9ps4GeHwJo|UYg(*s-vS|iJ8wv@YpwHNEd}&b<6k5Ryf(!~X>vH+(@g`cN zjt4q8)$wJfjQO(xiISe~(u-a6?X{~NH+!(&A+I_Tq{2_(LKHlr>4x29U+@{2NbI!es>x2l91`p zJ0+vz0K-)*){8xj1DJo3FpBo6&-h;OAk^MzI3sm+^YPPUw3R$b2oU5J%Mx&}Nt>fB z0H^t*rbfDQ_DbZF23`oI1|aH#Cn}sj|30z^=XK6C>QHlTr zhq`kwxBNVN*rzG+LtF8Q~-ujOBdA>4AhjzK1IOg6d#FMMSy=Re{BGaD+sn)W{SJ{-0sTs zf#2MZ$je^8Jn&MINd_(N`jS?Ecp#W9>iw>eyeq~2kj868{Mz3*yzt|fv1%c-GL%gG z0e|JrEwY=Aer~Gp7qDQx3rRSe%kl?zsxkh@sb^K_S`=Sik3*@?S@)_g2~Lni^tF~g zdghJ<1K1TLSb0NB=1gxwa|r=4IK(STIO#C4O_PN5F_F_oYo6UNuEj8tV+E{09t!ib z;|YS+wB{W-PG}G_@MR0Us8X5@yO$_M0W8+()2;p5BHXS-uxDUn8h&ohm+PsID*8`8 z2Ujoo$S3f9I39Yuluy6SysVFgNlf{dx|UUQ*$u=r&%g|GMlQX*%c)*phr>p(B%%ri z(*@K)U8IszRMgA=YD?N(iS0u-+3w`HynHHt%5p?VzqIcC!A~_Y$l`DCCXEMoQVZTk z4MbW*Xnb;Jgbd50}E? z>0%b$+1Unh>2tm)>v5eQL{5;Je;{!$>a8&$i6UOPo z2O~TiN7A^lVq(D{U#&wZXKJj^(D(!l$lX#_AfSrgKYP{aU+H33k^GpQJgHJe;@vpg z00!;2bLX8c?l#9?Tx9U&+|R&Hmb`6JOeup{C(}-Km)bxIVY-nXh9&Y)#7$03Su{?Y zosZ;jD-Z^yA%z`}E>G4Q(-|>sae4d5Hzr<$3sX`Y8|&=lDRrmvV+NfY3?mEARSP1T z9w)m)YqHFTN-9a14+-qO53HJ`ub&q%9;LCx@@jKwp zTPf0N(=ix_poajr`a$XwZvvh~P_5gl3H`P_YD#h9=UjNkeHC_q!3^5ic8})o23Gsw za)r5D(GGk?YC_zDfG`EemYx2U9Tcj#|J$Bs%Q%}PDXht-ny>JARmH= z6s8W_J4a6ou=A;m>`7VVJ!ujF6tBBa@9WOeqcK-QG8OxwrC@AS2rE8c?AblrK?k{W z!KFsO(xd#-F+)$uUrtywuAUDpT`s>qlRAUm_y3YeDlL>=pI&DF=&4gahWyi5n)=1i zvB=z7G}$PE-A8V?Vr*$LSWoTvpla)&Vai^RuSA&z@fbljk=t)_LRl(T&g_>LNQwEf z1IU<4L$TG9(!hzYeK?exHVN11olqEx@m6N*r`DH-&2B2_N(}FJK^{XH_dd*;3vG=n z1bt=QzGI^i{~@3kGb9D@ry(g+GM~I^VeV=cTWFA!o6~30mM?-(5k6Ir_1mPbzMA9Q zl7ZTTs9lL|3iP~g!s{21#zfV)(E@rGSd#MdW|NlK zAar_{ZhoE5qbe{h+ZEY_O5=&!?d2H)^37&9b^%2{N6c>;e&~59>ZY7<{poe*LM=Xb zq*9c3-Frbq3gioHifs;3GKXwuro5?^#XF|YLud-cxfd_halPVJlT@i-2zm30JnmT< z_Megz0C_|6mmw1{YDKmZ@-}~SvxH#H^5XN8;nF?CbhfK7w=H`K?~PntGeLx$eW{p&_H4fSqlHnC)K4ztK6B|L0-yrKVS{rTeur<3!Ge2z3p-zo(3 zHxM-jd=tbEJ-0ZhmPXh1Y?3WpOSmr4rj|_TV9Y05{()GWBuW5{#(^7n$}2?~K@k{v zQn>vlO?@S$V$3a>OqfhD_54TcXz{D0%^k%@Xb#o^CB919jcYF$pvWFA!zoBo46c&HuljEiYb!g|I|#7R&kn$~?6sg3Ll)6c{ZlciSK0h9 z7;m{=^TC2@ksDZF8i@gb`A8ovgWzbJq-nrr&-!gEL3BK9Km{!)SwF%(Kc9P|t^TCY ziPr(Cn~`XszT3~Xu>w!zcZ~@q>jxswfv)nMwq0Q^uMNJ1G!=#D9VmsP3;{tnuC*@) zWDUnJO_)?lW(6o5vhkY%=TsjXqtwUJoItfQXFNdK!GZOVHMj@rkNkKA*f~-85OAn4 zL!;S^@!a;NkQm;juQyL(deY1H$FED;Yj1M;cd-X*Yy|n32MJMMYu`f77RCC17EW9? zmM=m+2NH(XGBVN8kxBm68N^^aS~2J%gPIp5+LI$|dDi+}QoWeK zbOF6$A~wuB{^|UBU`UK5FjQp(H*AtecVF0fU{G7Fmird+CBDRG!)I4e3QMXFpGwU! zOt5_8{h)^hY|_V~Y1DVWv3E(LcCSwi;mGEOYrv*pVN}PRR-8d`_6lZJN1w0u=-Zf{ zu14GE_9vRgpyuR3$f0{B;oB7NvnPHPH#pg~uCDKGfKt$LJULG0r_t<=OO?765~FX+ zQhj!<^^B&w#t4+B%6K`|%q3*IT$1K~>jeP$1Oh^QGgq6?h+yx?kj!OUzn6HWo+>F< zDftw}3O^1(oO+A;CiT?uFam#K5y7)Qwo+8pO25HwkVaEuh4z?icOBIavG(_IW!0OL zB8e2^g+wVfyE*5NCqf+SI)RMaw0$F~4kgO>+eq z9}3jD(0)&ksb*4t5ZT~~qPA-%qa*Jnmoe_YLP<@^ts}A)QW>$7QqNhs%vt460NcFr zm!KmIQt`L>taYhvmR`$E3@X+w_6-{|Nz7?2IFK(|`uVynxFNYIM*>Kn#8|j7Pjx4m z5^g0}>B#!^GzqflWBgJ9PCv$SF$HxP`{Z~s_eKk$7u!!M3L2y(`@RU8T9jWUGh{+3 z83$rXVOg;KOddOo&rxk9$&ftpcV$l<^Q)*R+}jRP8CzM8z&bq<@5Ev}0XS=3;0FV| z4#+bc4AN?p;oPaE&AWpDL_{wvYF6;>77|`qufLVw8 z!CB|ATN9$Y>lIyG@EMdYYeMWd82qWorZu97Q^k)g)%xM%!U;9S?x%f z=m)PSrh|o0gUR}ObFY!(Ke@hUQ;?e97_irvgc@Kh0Qe9L z=g&`=K#e7g@Y4zOl1Ss1GAMz804L82M50GQ>izjUE)d(`vahcg3evHCiK6btwgbHP zHKcF}iJO2@Yy*1%;2C(Pab%najuiGQ!u#8ScfMA06kVIz2%0+6iSO?I7i^o8w}lfW zB4#`V!At$-@Ph~L2FqXyA`SF#@u2JB;R*KplS|2V2p&w&=C?;^m-LH;UbG@{`^LaX zb*m!$i~=iRGfnQ7&D!ntV;M|fEINVu%MpH3>;bcRl+C%_;Faz z&;Q+S6=MQueV_*63(P$343FA}HN$uB+$1D?qa+~=4Xt}LK(CA#w7e=9|DO=EC*Rp5 zg>he_S9Qna2K;?AlAd0aSy{4!7V5+TgctaM?Fh^W(&DUVS1NcJfA-GyWJ&*;22YN( z4Nvx@dQ8T56(=>rJ!kYee+M~(Xq+&MU1QZz&2RdY)i?tu%O~AmSpT#YuzVhR4etPu z`6P44vL~?hRLGHigZD(Mz%kp{G(5s5DD9_%Er_V^HJ>rd51W+!}(8|;)D4>Y=4af%opzdrT!Y_ZY z(yy}IIO`Xv-`PI0dDPXnA~%o<{&5p>Sf)*M2&~+F1dd0)AkUl9#q!cGnwctY>Hx`X zWMzZ`-7t15eTKeL9MaE^)MaS-v4Je2H?`~flcDP;6AENK3&mraUI!7@6KdH zd?#2ps*9(LtxD?<+b+)nYD6`Z_3hpIpHEBIsvP^tw9~8P-lX2E&j&{Gx+q>Yb(1Ef z7{TRd8Ou|w7s<2#k@>M@x`wsUVA~FYp%lu0YNn~pXCC<@E)rXue)u=VuHWSgV&-Gg zks|dYZ_)Oag(qs=#d(m~fp%zWeMB1gR#&NHrh<3)OD&!wXv9Hhp(WU1RFe82iCy~Z zrZ9?yh=st3JdND_-CK6i3$im8;xFV>QC|XyAl>u;iXhu}e$-PKPKgMHn0rBI!I_~< zk`IOeLqXDf;DzV2tQ{y+#}4F2U=azDSfUzc&qIR~*O3&?wQ?l((0fu^7a_DpJV2g= z_jLCaAug1>UFwfO+I^tR*Vb>n1?gY<=QY zTvM!A^-W%ZEjOVzLJvfk1~yt?%BZ$3Lfo*QC6=&vCJw5EGvw1`+)5}S?aGMYES7x# zaonoD}FT1YaCd8^yjw*u8;>)uQjmVS!H+=s=CB4Vb`)earKao7I{;nHYs z+S`GX0~sF?I>JMyQBsq0As1Jdf;}7ZQ9gJPk~UWSkB?B7o!V1y(g^ud3x&(ZzcUXR z(dO=bxigv*p@G+#M_dpg$B1!BXNs$y57vN+=Gbt5oGw#(hLHJT&;?aY{&hoQRAYKSo%Y3P$U09h#!)t4kmmzHJbUYSzmc&*Dtz&Yzh)RXEs4MN4%2P}4ya*%U{_O+YR&MU2RlFU z{B!2A!w^H!|M%1?!$7-+x%MbGeEh;C)oly#3p@zAYw5qd#3gTs^cU2?K)|ZGWFa_L zK}lF1ylbtf#Rn{b2SyE7AKpf>FA(0R7j!`vy~RA0R{WdiaH^)HA;cNWoHJtwa(SWM z?la~8*~^a)uwmnt`ynd2Kl*)~A>-=iCYSs@G%pB0Kh~~pyVBN(hR$H-&~8`YHG|p! z8TMi30l62hL89Sh5hE)%i5WFCuPUnOl*4ffQ0;fH&3`N4GltFJCya{rFsW(1petD% zNSKTNds*TToYZ(TxOXh)Lfh<%>8FX>!LmE-`L38Bg>Z48Sn6x^=9FVEyc!)lieKFHilSA`-yue#3mx8#73HJS9ebIBIsQc|9rgyyWr-VGUuh{cTBn^!q z5WR%n!gw=PKp2J;TE8iMvu9GDv%CrGxu@w6x+$7W$2k`*dnbJ_{P&5&tF;pi<~aUl z(aBCgInXVZ4~W`0H=%cr2&(fDx@ng$>aKdw>~^|{!)vLneR}-bSHiCw-2%;xC<;aw*jKCK?FwIYRY30!QbsTiLUG1}o&Z(?=&7aeY7`yb*Moq=`W<}B)(8^?2! zkItJq7A%(ZCIcsv1!^+-;R`Mu~{gp_>R1g8A_aueL?2ee!Dy%uK6K&a{+@q1y`UIiQR0*Ot%%67U} z0XaVjgbB)8*Y>;dB?M(;t&y#y$hX%V|MzO%Kd&ajOM*&TtwbqFt$2bECk+znV+p^& shws*!2l0Pq^vQ3l)pgjoupi!%kZ^aaIK!OZ|Ide!kx&q?5;X|;e{+W*Qvd(} literal 0 HcmV?d00001 diff --git a/node_modules/nodemon/website/nodemon.svg b/node_modules/nodemon/website/nodemon.svg new file mode 100644 index 0000000..415cf20 --- /dev/null +++ b/node_modules/nodemon/website/nodemon.svg @@ -0,0 +1 @@ +nodemon \ No newline at end of file diff --git a/node_modules/nodemon/website/sparkpost.png b/node_modules/nodemon/website/sparkpost.png new file mode 100644 index 0000000000000000000000000000000000000000..675185e2bef6c76a3fe2507eac0ba4c8b1f1678f GIT binary patch literal 22321 zcmYhjV{oR;6E7UwcCxW;+qP}nwryi$Y;4=!Xk**D!;|NK>eTzze3`3eYPzSpr)&B* z-B*;NyaYT94h#?w5WJM6s4@@`@cmCe7z*O2H#y|Z^78>^AtWaR1k{iK`(XqQ1SAL~ zB`T!q34Emo>5Dh=cc+7RVjM!2fgEkBI1@v74zef=45c4Q)mFiMPX zUlzwrPnH*p!(>ilb{PR#P;!dkcj^Lfj_7;iF9O*ONf|kn*1HVbW0PDDxQXcq9qZn4 z_5)FaWU@J~9cIidiw;9&NdogY-H}}M{Ci|1Xa`G6``D4~i z(r^bcIGXi2PBkC0)3^nRlqz(aZpeP6&WcQ8qWt;{7P4zLly(5VIXjcxi*X!X6C1Si zh2{2E(e(QqzM0@0jh!-T)Y&C7tO;SJ_Givtpxb8~3=>GhR=wd7CDqf@yMY1&#Ko3b zLsczCpg{y}3OUT1S0t*&wIo1g5G+@<KI6~8J0NxKVp;}VjHaD}j#Pgk(+!}cY~znXam(e!~6SZ}qNwdZw}TkMgDuFlW9 zM&s-AKBNLAL3L-K0BcXKg8yPd5eSCX1uo$j(D?IJld!#yymyGnN*uc#JWDG(O5)+@ zenaxe&h9NPuor2u<2S}jzG;5rdHn0|2^C{jq(kN}93$dA5Pdy8CfW8lhud$ufsKs~ zWxeWtWZzsU!BY-1&5y{0zz~V1-H?}(sdT#UxXALFZFe$#b!@e)B+^8?%5rV5sFOs; zbl1@)s;A^>&H`-{?qf$4H5ulEJxYUP@)YxSvJ9sVZ%98KjU2N{=$b=jdW-0mzILVO zE~j#GT;oF$an)hb{6iD8XG;YINNg761Z;TlN!QHE&+@LW2X!IR!O(`m$+=97q1anr zAqj_$<_W?_zzh6Xu|p&>-axDs$_JIK|2{V6xHAxRKV0vU{6F=XTrL-uy=X@*O=jI= z$QSS3xJ0W&N>*iGY-WI?g2Ji?+^ZAA9_sg3IuoW1Z#qh0ERBV3IPO;FFkZNDB;pdN zvv6$WAOo{_`-D`KJSDLcNWpe+_~ry>c#6(9DGpV&EUJC90`rnHxtC53L$|dND{tvB zp_~E19mR6u>!u)KL|jmVBak7GC?-lsNm@3!aY6*hUfO8b$cbGa+tqg-UgRHUFki!q5TLnts#@WJ}(IObyp(WNok8l_2Q z7NOYNoMQmt`u%>X4CfwI35h8lDSE}90!I|K#%BQ#QsGssNBayRgyAT zl+~EQ}b}? z;&&bKK4#VXs(UIaK~@!%io)6C{1S9kWv|F-&ZkKcv@%+?qMT^5fc^n$OD>73c{8iS zbv-z6c`enj{F7jeOF7uwhGpZHewtw(wlf-0QxPTvTMOL?KuOdud&9k);|x#BS-nIF zD{q1k*$q3jU1IIQDA`)F6!n4p)UqF6Ct;^+VI60-Vo%fmymb=9XzBY`*Sdxc0SqZ57MaqhIPml!v(TF^v0^; z4sW2NQGA#7d?d$Zr2y#c79*e*h4C&PlRLJs{^l+ZOc4W)xC~w)4UK##E^Ibapw}g) z!P1R(^cuLY7F>XY4nQU1%-PX^?1FnKp=%PFVlay7gp4OFLf{GOZ;@oc>#S|2O~VN$ zTCL?T#IP+&vjo-tK_Kw8*^ngp$`)jyzB_13d0NlkNFW2=`J@=6qTw;Cl#St~eT&L! zznyAt>&&N1OFhx-RLujHPVLB*xEa|#3B~fTgux5_<>Ndxm_F$0IGNcG8__Zslws{> zinDGP858^^91x7yq4aJcBBF@BNQj*v+=NWOz@W_-YB_UG5UuAO*nu{6X-~$1foK@p>W_y5ZszB7J99(Im z{+WZoCZJM{s9?^69s!tEQp6p)ewmteC!^%-BQB``DYe0iV;@=|dxkMv?lI^M1anW_ z0XYGR1EVSscW3##xIch?=&8Bov?_h<1qceyL>ENffv*-%*xsFR^p_j6s{KYD8uvnH zsgPyAuvv{Mh!#Wx*I>k~gy8 z431G6j<1oTHb$eG!F2lFi4X<(8OR4SU6e@YDtqZ`NV0ia-b7HX5fD!$R!kveG>n*meHU859Q`_n_7#OnalN^)5VQ`y6gMl@?umOA zIVPyP(hS|{g75+$E{VjviYnr0=I6(nL1Wm<<|{@5fcp?)AxM0QaGnni5@V zNg8;jdt*p0zFGihE*vhqnVT?Lm(>PA(^u6GOY3#KRM*eh%5KC*>v$L`kM6l=Mv#D9 zZHJvucS2%S)&KBI4L84?nPjHjEF}MdNNtx3v(hEJ`^iS=WUXUB6+9o8i+g{Np<+u$ zJl6W+vR04TIexRM--T3?!gg@)6b7GQ)s@{}PcxtQXDw1q5}lej1DjAlh>#{5?7L=N zJ~})05n)cZA+a-!Z2h1?WZU8`h~#=rJuFhK6YXZ3iEIwm>BH?Zt$x>VrgF&len{L&%x;0iuGX_4STPTHSuZ zf(=XHs)TwYBTQs-Uk-M8UUHnHl(^f_0*Armevu-@F%k1UXKp7bQ?gc(&*eyp14XPw zXM!H!@~KvTL3@A@!Ono%Vq2(i)5?@%$d6atS&Zpo3O}%iQ_){bd#87wxD*EYh%Elj+yPEgZV}ime+_)%RkoEHe*TwL#dLOEKPrG=ys0|} z4BZrSURGM5qCY9WM7nyvmS1{pK@_VyEITTr6AH*F&p?5{)Z963$FI>w)zL9gZWuJ%Q7bW z1+nN`5t6A6gH^pIidSXH0aq#UZ2Lt9A8p-DUw* zQka5|29*jvqzo-Op)-DNYipP&oTF`fq2nY_4ok49DrO68TH*xuAK|Z&t_1r&&^Ld$ z_d;MIMKD0^?8U(UO+x3PBe0r)vVMxAeW~rOZNM|<*K~l)ZunF}%iGyu+zNLuStEn3 z+QzQ^P;4JW{56ec52*bEb?N=c0xR0iFDsbWQ-mDBIZ#ub6MCTj0T&eG`UM3#%@DRT zg*)>l@p@(Un~la6dyKxj&VK)l*}iVm3LIe+R`T|-1Qk(BbU8T+qjsXjGJAF=^n?`e z^9o)5c7DkCUz6t=#r$MW=-hkGDiK4R{;A(|Kvkhg)3)@r=nIMu65T?9m}cGf9mosd z<2{S%_W@n;?aW}UAw2xa;+_?NNQh^T81zMZ0gBTx9lC9aBYWvzp;2G@?K@f9C9mRh zVWNBLr~YPz`jkpoH2)v{TWK`z@76?t!}~I*sbl<`p{_2>USRUh z5>D|lG$&%@(Zt6Eds>W@UqSZPAdHM+$zDl0uM|$QGzHU+Kpav*i|K^7)v2HA_E1hB zFnn%-b1-vo@c;)m0|Qq+F}f46-8ZdUr#<%%b6Jj_6aaB8q71+v*(iehnC90xgq<_k ze6}0}U7Ui6DPB}UsmiViH9Jbl!!ijOKR7A^bMx*4jRH(xPFv($a5zLla{7b(p%e0( zlV2PYQcfv)7<`RW`;*)5gCesQDMl~wSL*1bk-GhF<2p4gYV)eI^2d1w5q&wWGZ@`b zq*1Wtnir;VKs4U*^i>Y<#p)GE#_S(xk1`Kd93K$QI*BKFFhNdd;9}!3<`J`*)lMft zv8t(51(=%xM6R7F4o-yb+CPaBlF!^r8vA@fA?~&k&{w3yD^zSp9sez9>f<`$D zrl2VY$$)Wis-Zah;tV7CGgBNH4ina+Xo33nPucd`9bb+M#`nasvNF0WrbUqh@Obnb z3(835c$|X9v&B4;4kQTAM2sj3YRt?_45&wUoSX5aq3S1BIrzq%jjMkW2rf7UvL?rM znOiy}yQe#UM!z0j?`(imb{ZSVIE^Fd4jC!z8J467ncuRf@#K`)%<}!)4aLvhW*{k; zYvXuIl_(9T?1wA7*guqouCA_d7a(QOqZ#DEH#q0F=A8)7msAkNH+!fQFyeRFgHn%$ z@-vhM_FoFdmlxnUb=U>YGRELwx zS?LiZ`>F?{tHC5<_B_cXh+}w??n=covvw@ENrSTXu#Lt&ChO#l=EoOI1vvIQo|*`j6hXHll7dG^Kw{XJeh{4B}%qF07{VsegV?Wu(iJ1?V(%gh%(e-{{#j$91 z-;~v305Z1XYi(hLdK3g=KN`CW+6}5ntWUn1wU5a>7hBGFPYfJ8%1~5>=f{mE$R`aV z4Z@WH)aQE1-pujqBo`)1 z{Sd)q!5gLwG&Pg*L#INk6JxPL>%iqq#N>F+z zQj!~COMe$tU~2Z39MV*g8k2gHg0Oo)v-cEoh&YW z16pOVLorGNg;6pveTGq%L-0wz4zTlAWOB)3eKO6$U9E0X4}`Ibsk|-ypB)D+1y|*s zH&@y*(wxli(z1!lU_>&d%Dp#5>MQ118usp*IH&6md(1MwzSxnXsqFI!w|&KY$oTSpaR zt3oTz<;a1As%?!+^f&G4#Wtr)$K%2fhz0kZkuS8@0x)!UeX{W3>)-(R$4V@hj(DL9 zrPl2p-4|kz?N*eoGvYXm(2o8jBHWONGk;rl&+ts4eA+s>+jqLX9+(kG?Cwjt^mUKv zyOOS(c|HzrtEj(k!(cJb>9NZkJLSP+77`}fuQ%adCLa#AQcIMWwnj4gp8>u*V)&bc zeFl?{oJG&T@)dE(KmP3SlmGD3M}6S~*~TOPldS0(m{5?f~dCQ)A%8A~^}nVrC31~;56&~B4B znCrk%RG60F@egxVRvlO>M}8L+VCY4eQn$f>H1frcS|ry?m(PIGre;hXJivr;9tu`1t)Ep^k+|(I}BY1>6o{KpT$7Bbn@VXA;qnl%U zSr~mrz?u0wP|XDEY9$^Y*ZeV}5?vARxh>xhRix{z7D_u+$@nZA7JEBPhh=mdrqzW+ z?|dkFs3plev02Pj>-0af{@%8rgxwO}a*k*6-WTdGFqh#!L35m zs%(QH{(jK@-6Z$=bo2U@szt^1`i%(Fo0oqRIA_HTN$Gr0?3p6%YUtk>7F72gs<;>b!Ikf|SLm#5!L0rQN&;tvSj zb0J=h!%|A?lv>2Xv|sNYg>u>d53waB3&x{G%k8Z#>nqxT-qGC`49b_hjnSumB_4q5 zyMgJujw@wkPVZ21EVgLc_9v0|xc{Y0QGQSpMxx}Z4Vo}l-XqKZTg(Ib5lH;5lbM=} z*^O5X;jL(qr=7nWDeLHkC(i8Sl?tm4-q%yA3^h%=`-st*5v+5cQ*{|xu=)-(tt(-*IucxyLT`%msJ`HXi=#z8fjMI z7~%+NcvDPG#qWW@c3vXjH@o2jcf8x5?fYfsBu1gvul5oT=NjzKxKo)P3zLoFkb#9Z z__x1fBQgZzRR#-0ejr0WpFR9&BVd;6#J0;yh19Os6kUO|alw@o1qyCQzignb2qBQT zn|cW4dab|-xV6%a3!lSh{I^s}6(h%AY#Ot=cH7NGMe+l(Ey#^js&#y3_Iq;P2M}Ry z4J4E0QcVw!F+5~wae@fwwnu*^&zI;v$*-E+0WKO4bC)m1nAV`Xj^K_=4HN3NqP~JZ zqS*&Rtf3OzI>`2)YUl%|NZV9o_gi`yNWKdaIus|GI$$}gf*`0i&m2+C_5hg=fD<%RUzraArru+iT<~j*=iYPrO~k%rI;t#SI7&xR7WD zpqnj^9lo8Bx4I)gy-;Pr9*!mh=UH<{# z*TL&ijwR;twVayI5l0+eSi#1om?@kiA5)AP-K4TqywTF-mvp5h2N`FktxUt%q9UXH z8S%_pldpZr0cgS==Y+zCdvY1hlLpustM&I|M;^+ZEz(Ct%BdE`@C(^N-5}wj*KinW zSL^P~BrF&Jr#Km*PRftpNBB_M? z$~qc1SibWGevRR1o+-(bh2IA>A?Ik#CU$S2kt!p+SC`7`2=2OF$n;m}_WIJc z*MLO#KtwN%56uTA>{@@$O>BMcI%smqug7!LKf)oNLxQ}GHV+i6HN%dJ3?h(IGaKno zB=$=T5{p#KkB@i1!D)Qo7jWA3xShQ1=treakmI#l#2kEB&_0~ABuowt^@Q%1i7#iiK>3j1|H9sr((RHvHP|!2$j6Rb zMhXY4gi;0RS5#k2WT6zo(GMU@zs3tSy-F@H1xwnYFbz3@4pp3q4@;FqJWfysT5eYC z74;y;!F}brR|GAJrrT3B-6q? zOT*03_R3jW;>>{L4vupg&jdhINp3LyqjDh8cm5*)zZ2!44H}$(Vjj8`3X}Y#t2!*# zZJ0SE6gN)&6Zlkssvw^%%SK3;X8U%o<2!UCemP~0&86D#+K~;*eXLEmn-}_xpir<@ z!0JHr%EB{{n2?*22(~(mJNf;90#!{-sPJM&1-WYTgXB6RWu%1}g5S$Mh-MArsFqMa zfW{-gt0Il38AVGYjkW|qV8q7WKHSM-4&1hS@OJUE1As_2+Znx*8a49JwO8?6|f4>+~7Z~Uz zlDo!D-vg4^LX#?=*8*mev>`hR)NAunBtPCB!=22SeG2>^#5-Br6*)ca#gAMqyrTQ?K<1? z+Ez&8>%0ziq)mTDDw|cc^<;<^|7=-{qa8;jaA$_4;mT5Zb);2HCdh+u{_{#lNPOI7 zewi@8bq@WBDaMr5yrN|SukD*qz*7UpFP~MV?bTq>x(~^aqC^d70J4WfpwbgAM4}_b zucU$y95qph08~p=X6cETKmJu{M}iwnXa?rN>A90lz_;{fp7*kE*oV>#45>CbqwJY%|{!6_)5=E!Y%df zk(Ry&4i@C@rh&#Q-#b%^rA4%Z4dNJ_siFb*IW(wjDvzm1>z|WVED~k_g`WkulEApX z+<&(ZFqr9<9+v8QQ(rkjldcZ;RSz4{1D75iJ1fnjBn!41y#L8LG#02ngCyL#r6l`r zuBtY5trbdthSYaD#5B_S7v(1wC941ksxyz!o(@72$KJ7k4(H_DaJIS*5)oTnsXNJ~~eTb3f?HFI6*+8C@g z@z31+(q4hoN=?3~ioZ_{277&M7^*KW}=p0QTAw?445ZJk{_ zgl-}>VLBQdz)z%~*j&z@Vm>}ToP5LB!*<(X8ix+(rrmg78X`q?8Q_}}T@6nA3k#GE zOhfQt+;c1;xJK~saxBJ7S4bqj{Wm$7Fm%4Y{RNI46AUJ{@U(lJ2Q!IduKMEJ>R(t1 zTNdcYV6&RVtKr=V8FwT}<1DvbZ|WPbceVe-N-hFoeDg>ik~iBRLpBt;Iy+Y+>siZj zxyq0&fK)Xg8Q7F`wXf`u!lJ-J8WU#U1JI*^#0gyeXHRP6Br}!#H!08~bU|yqM?=urXo$HEBn` z$%f#r140t4Kojl!mEt{0@XE3Gn;wfXzwuLj!^wh&fHYUNesV0V;Qbs`)yQmgRtloz zTwERyPCxi(Ln$Ike)Tn$m&>dH9TL&$aGhsj^QNWs>Mc?W`F)1=6`H-J1FyzqXs7`s zXm#5iL$Hr}rCz&7yarj6IL+#4I2Y!Kk10nk~0;)H%l!EXWF2t(5@W;wLIxA|F zmiIrfY4C!7-4f*)11Hc=c9#mtd#iv1Q9ufq_4y!)q&mO`54iY_7X{F>z-bHx1_DW^ z-MpIy>@62Et4H@ z+1SB-%Vae8n`zHcU;(Z~mpEZgWC2m(kn@ueSG{h;WAxvm$fgL=syU@WDK^>Dy}4uX z-@kI*Skmd;V|jXU-X0<7b#M`b1+fc@Bq*0RiM2K{{ErWsrzZ!)6e{bIPVlHj>ic?`->GhV7%{#1)szd$qluNCdq>gb_=Kv7e}3LXHii(&>#mj0neepCihv;3 z?r>rmQ|GEXqA~dx#aT9;v94b<{K?R&5{{|)dH5?Rt{Aud3mg^WRsL;kEaG5ZO24P$ zBgWLfF#Yy}5$HOT#G%4TSy~JPDg^F~*xh}hvL!>z+A|FwNE@3v$eYcHTm9 zd^8FI*hfSo&yM#9b=n@4iT`X%CTjuvSZs5wJ@m9blMaH|26+mhN(zf3V3*# zMTv7xJY1n7Mb_OU2Q8PkBOl6SDm|;Kdr7jKVq@MX+sr>kuZ zBke2}j+rb>9eFZI`(=J;!m!{wjkk{+%Ok9UzUYv_^%%0%Midu!Lzc*8qi8L_L*RiY zt>}oAEKp1@f^3q3Ae1ue9f*}U<@8e>;@-tis`*-09Gm2KRig{YA_l7)g@vZ{^vn4M zanWG353~)!zpZOFF{TbcGyC>^TC1pgoDRWo)vRqfk=)h!cBbzv3;qk zs^=lg%>C`doMbGHfKO-0wsqCAR-GvStIaBZS*%-{ytP%W!`8SjLn7%4r$IjSLd@4s zx$5d|Ibu@3o1ENup+^cb`s+(Y^QdHEy0xot1_s?He5b{@zk{%6rN7C1CcG4sKhK86 z`zCdP4lUb^_I1>zS?;*+FX`Ad3l$gKS)YoD;?TTtfk%M z0$++3Ids6snLDV#*7zMByTX|zGEd@WTv|-QVs6B^Qlr)P3mNs@@NU0@Fj|udhH9EJ z`uzsY$=urnj8kT5zYDnZ$rVr6Qi?q!8PvsP+6435 z`6C>Qk5{R8QQ}VrsNTeeZH$5DE7k{MG*T`vNZ%m?xUm)P<1}6M_(xiVbueA%%ipvH6c^_y_F~1xW}rtiRnabVnn_6Jt|p zGkEjv2ZQ2n2BmwzVCd08O14YI)2R4!jXX4gn{}7i%l2K*Bncqn6Trw7@_CIv-+HI& z$@Wlw^JwWeb0c{%7u{}XB+X^$i6^mnXD6eMfx}`HJ}tNtb5IW*DP|fBomB~w>R4*9 zq7`IBFnymf<9ly|)=)=$h9|Hv;<4{Ig{Os4aayrS#FsnTf9n?|zUzgu1~lv32j%jM z-gL;c0wi%v@tcIQmD{m`S{BT!&;*@{F5xNQyG8dWuvdC{hf#}yEUz~^GVQHWGd%rA z6ABtlNE^>yDq@T`ULD3i<`Myw5R2X3a%sBpOdatbI>BVA67TRRevPpvM-X4@rYuMJZuEenf&)@aJU3cBFWn0*qpRcH61en%49JUgB^2|L40xTj z9PUyYg+DU_ga~>GjIcjRWg&RKVh4y=Bi^SIjRLYjXXLMowVEww$96FY^NR5-k1S|i zPte*eiX;m1yD~4i%v7DT@L=AlKknecOp*1v+=rG^CgEYvD`sbB)jIYqhRO*gej$XSbfd$p8*)Jjn{nf$RUuZSnV(Yjd9#id z+2WWmoJ`Ct8izJKZ=NNu2qv4r$idO z3I2XVsej4w4o8`+K-sZtLW ze(|M`Sa0vMLQS_zJi5=rH#xi_V~sRm*%!3G5w`ci+B@87XOf+g9%M8N--lth)imsq z%ONh%MtvF@KbpNZo}r2O)jo#^Idfqazjm%Yqw`#8*0iHbKh)DsQmwAsyF_ql$HBH) z_Nx=DklxksFpx^s7Dw^{C4xz+Gav7vNzPPM=*Xu(((=Ya9(_K3rmNYV=DWU)H`MFs zK^`6N?5kG~tOIIje#JFw2G-#qI&c~keIVi^5ubfu9Bixi_{`YUj&?1?HRqa5;$l5Q9%jgZLqK=N?(G)3%rHUFcA9HD z8VxX@eF6BV8P*l1QUZ<5Ybr7}AK7Dps((wAieD$q@y*KAYk97P?PYVt&oq0(G^N;Y z&{K}hi^-UJHVe&v8KQgZGDyO&D>3i|5}j=>SYnr?=zeSTqNZwjGIaV_I*k_B-xm0Q ziA~0n@&wDaJ8IcpR6^ zg2^Ajy>gw*{b}|EXL6URRTx5u)|+D4RbpQn7rb7cMHbAG*oou4un35MJ}>>~idH3X zavBri(;ZCbW5AWwCTJEcneP4gR!?keHE`zp{OZDzBBu{F7!#?DY zLWWuR`>u?2D@mQS0PG%1UwCSPOxdsU`Hj#*o|{F)=)w(nh;6- zFtu(!AT?X*^s_`;_WKD9S>E9?hLGfa0v_;Zc#I;waCVM4yyI?ZMj+8{6RT&(-=wUw zXa)kanvk~k?__vUp;*y}ZaeHF`&CvV!koJ7{I*@1`Z#Lgp+4W2P32kPHaBzWvF&E>8!Ri(913sE zU7BL!GMd_)&{A;FIer}D&(oJ51#};Ki_kg2YJyGr3njx_|`f1)arFDzvt59H^yCOC)#C;?36JG;(O1N3y|Kf{2rMe*W!UWST&m=YRX_fB zC!Bj6j=)pQ8!oi)(x0Z7aKsFAKCphNf7w^>&-gSv(IbBfdsSW@kzyB8R?GBw?Lk`B z6NU6vu7qUEu}Z{C%%Df^3Ac+rn5OI;9Sf7^?bas{*wbA{caU@I)V82_O9GqZhzuF( z+3SeA^Y<@0W4_soA=y+iBupD0&-K}ICcoAw{VEB)-R3fC0Hm1;XmkjxbG zEzONv5ByNJ%M`6Z{G04~!NAddmN(;QHAH*C@|;Mg#PH`g2R@LvZ=VUr%jl!E9t!OA;`Vzn`cpk?0r zm9bI&L9X>B9{)S7V;yvRu5X&Y?PqvkoQ_qD`LmF7FRPDhCw+t_sUxE_AqObo;NU&> z5~)^Lv6Vo42IsXwH%K1PxRuAocA6MehC7m5I-wLMD%!t>yJ&z%tXnXOIn=j}vLo&b z0t(Oo!5GHwuJ)iJHqLbU#umAE=!#4Ie~5m1{B24`?4^`_XDdujYn>prhyaATWHL$r z`-0R5j9W#9W0PN170493UGzq3iWl58UQMAiNGVy+7ZsaJk>$yHDNY(+^z|zb<368p zgoeG5^u$!HXoRQ#>*GR~*x&~5V--arC8O|g8M(Wj}{{v`7*xzY8WWQF1vBRcHVX8$FFNQ0!K^aHBQ@%l6avCjlRhG^!@+i2f6QMABQ zTfkH$^jAiznah9HQJh7IY>p?0P(epjBxtaFmkI<|Furo=)t>cI_mas7JRe^&D<=BC zOOlZQXRbL6(~l6wfSKT)e1q^`QFan3^)GjIlNJ7J)8E!o>-Z0@Rz#r`_z#BmWHUdg zL>*q+@A2at^%+tT|4#GaN73_lrar-|#P;IKsGH3BfwTJ)6M?v|{yC~%zmHBEfAZoP zZX{*q^_jw{eBCDnW+!DRXjSD>LQ_J+DM1^Gr*nJK#{iMP5SgDah?m84DTLE_cu5Jm z9UiIWQ*->ssE85>e_yQ|8%EsBNL*R^ss+4QQkqJ>nuNZ5Y2|(K&!!nk$pRe=eA!e+ zoow!MZ<~Ai@}U*NGV=cujJH{ta?Sq)Y?vz8gKT)7AnyF!;-K;c!%2yvhz}@?)Dx@v z-*_S}w5Ybt+=yE#56_;sXHq&-O71Ro?qbr9&}7PMRHf6vQh%B&%Fo3?ZSR4%?IIAH zmx(T&+a(`Z4Ll?AKWfC_rOB25kJ@2K8lsU!=T-Sw94pSMHK2JzZ)q1svGIqj*91nM zbo+n8QcM>NkeTtl17~b=j=Vhuwzop_zmxvi|Nl?-WhjCa+jUO<@m7VPLDDEO%J1CP=V>M-usUcaAz>W`wa_EB~-2-s-5zfx8k$a^K|MT2~Hx5vQ= zM@l$J4Si}2oJf^Qg{1_4n&Ihx@V*`@w9TJFRKj#vs=@^W+}tK(Q+iJ-f{|aqE#mrk zM}^8o|5vu;K|kd#OM{;q|2ocxQIYE@mWY)DlhXs4YcpK$Du-!)%ptWJte)VDLihPT zPxl0IhyG@kO<}~rk*tvWeju$cTJL{U1u1~}{VwH`zGkKz7pB-d1Mxf!)f3*To8O)L zr5h-Tp(&TVkV^o5YzdiqQPm=+DLfmhR>G zcaj6Sm1kffrH>|p#^X#xJmma9&d!41GNmu?SjworMi+P26tUgo4v||OsxRv_P7hn;m-gGqnHgPhL@6lGnrW6W5Ts=6}b+{O7Ei&m7TxwyxH&JY0UN)sDg>bMPcoRF*0%Q~k(r{e}nl=PDaCAef~r|3}zce*U!sI9IUK2b6$_es^R2Nj2s4s zMzP#a7K)xPkRg}(y6CDusP0WY0h*>l0Oqze{KhyE6eBlubbVM9BR;&*yYKelm7f)924cH<@zh#&m z*qVU|;j_TPSFXy=pbS-YK`WzgdmC&_X_V zDyGwmcngMZDm87Vb|QWf+D}-t{rC9)iL*!ebd=fU&3Q84iLVcX{3U5MYwPXCuz7r9 zys_xE!DsHo%LB}0dHO(OenPrh6T5a#!XjotSc#>-_Az3@ zfltxS8H%%V}*tb34bH67P)kTvb;bB8UbF}naRm*eSJ zjm2~~34W`^-&JwALx>`dW95e|?eQM-l?vM3?L&7KuhGpU3R1}E4+Z=NBd;SdH+oqh z$MZq*!LwoUPm?HT7Z2~%9y-kxpDKTNyXVn;BqIsQh5F(iU~jtlg+A&qF_30+;zc)BW@=$JEuifh);WfRud4o9{+e&@;MB z?mq6F;_NC(uT89@?7Tk2P4#^GH#l>|!r;H3>Z>!xQT|E^La~q(5xRC;aXbN`txm3- zc3MxJ;G`Fmq?a)>Fim)bh*@5SA?Ll;+@z9UpXi|vL%O2Lgao}QB1Q4BWgW&h<7DgI ze72gq6+d{5FZn>Db1^YrU^FW|4LOlGXnpd7lh5(SZ`+Kz#q)7U=isBrrUpExZy?g9 z>Un%G5s@ViB?f{}f1j;O7#dLx^(nQm%kf(2!Um^Bf(A{2^zG)QSWe5^0z`K7bX^>OnmO%bE<_%5AGM}&N}J_f&doK?g|z1Iz5+ED`_W#mb6UH7lW1S-%>elCl? z(c+(N9gW73Z8>Fh03G^8wQJsb>=XX+FEv(-vQD;4z@KWK09;o3o;A)# ziG;jYnxEoSyDU2j{!He?1O0B#Z6D2TZhU}IJ%p?%R&B``;rL1Ymw#_--F0pW80}Kd z%Q9fdhND+WKF^bPuHh8b*Luc3>z-jyX)Jy$A5Yss-fbTXYYUi5{MBkS&T~Vg zNIvs$3>>If>op@taHKcTuT3$Jv$Ql(LE9um{1kz8i^5wLOqTTW*Ys{(&~3I6gh0A1 zbY^L8R1%i>?PbO*9k@e{Uspi?iw5QIh4nhA&V-Iav;D zG6GFn5``3S67UA6P{Q|@9!nmk)0w@YwXW$gdoy5n-}#drf{RUl-`7y=fPp;{aclma zB-w|pz-?PC1eL%PYn&L-7K^*Q$GxoAMQ7UcHBe@Px8N*3zC6=6`cn}M(dG3is57~f(zbxpb#@**7;?QcrRJ5(X<+dhKxAzv%i&0ev2*G0;B-n*$i<_dg@c!Xj&XQEg>Afn z|D@$KFSCz&Hm^f@Tu9&}fcp*<)OYO^s*s;4bOBIy(7%CzFgE}D7l1Y8l_cc7%Y;D{ zo%l(Y3hU?RHf%}}Id`;C#|??dD8pGUbv*M2u#n+B$y890prXA0n< z*xbC`bT;bkITqLbR$3lzZvMgSeMCm*;EwJXz$dy-@m(PdNq#w_GJ$%9ysqf^lbpq$ zgdSy#Jh{m&ZyrtX77bU3H@NN zkg0?-!b&54%SB!Ois4K1N!MrDjF4b%Zc7pWCo2}z>0^lu1K;RUq{DS54jp_1dKbi? zZAf(DvdAkc7&gS|9&}8-tvZP0q0Mbvi!G2quAHb~&ju^1cBWZ2X596bowzHm31l{F z+3LXT71O{s7~CeXCF1&n2R3mM=>9SITHB@e^!#8$`1(-jp3e<1<;}4KbR9Vq{;Tf! z^Nd^j-SAAVTYZNbP;`bqypKtal-;l?8eAIWV2R;)FA2g%9LMG;+L?<+`z6HVc+`!? z`mc~N%!#bmUHW1Vjvqg1A9pmRi;aQi&#=R`-b)TJ8~&CTx@>4*HNoI9Y1Gm-wtUET&u>_IY><98HwxcQbHyXmcUi0cd* zFrb`o^AaC!`}ieo=(D1Q9NsX54R2^Tr`7;d-W*Fn*O8-e-*L+yqqOUtt|7VQjoRk< zSc2QQ@`;Zl7E94E+~+?urgcphQ zKaZQ3wsb>N%D6aM7D{j29p%XJCLu@MY>==w;%oSAgig9%k^x)XphY|GyLRg8>U!TM znjsRzKQLr;M}t4^1$dSYEH?}3XJZ!cVzJljQ0=kYIEMN7&meDR)G$0(NyeH79pNxtPld^hb z383Tjvf09sS(Y}(LFR|a@nvvFaeLkoV#Y;B-jF`GR)gW#)%(IwDr?B-(+qMo31&I9 zSeZniku?VEy0l5_1^iMwh0SoyV8|D4!|L+6JvL{?tBhcW%Xxu}-je;o9oAg$DS9Qa z>%<+|U2nc8cnsE?*3~O!uh<)3J^Q1pG{m$PEByBM_KgUm{Z6R|ZN#x?qyCF4ymwCl zl_RGT&~@Z6v(5+iEOtEdW6-HTf<`5l=-4N4DnPhr;bxyR>grl`n;>$UlOkt^S(2_{ zaFSfmz{F?&VDR));JLcg11AYi#rfD(GG|;;@GSgOWtao^7!2GzT?pcUcTu6xeg!m0 zN4iZEIsli;7VctzeqFJ8^=EzF(#Bv09lkYY;g$`vyVR5iHgxJrlvi4Q{9lPrca&hvDd)5GJEzg#l+7bYZu@~CG6f^uc07iw*P~5JiyLFH=yi5D>0!Pf;;7A|>2OWMtgIbM zb`UxR$0rw1zNdob7AS9qO)zFLmIjQ@Uq_>xUiOgM{vCE0InM)~0}{3qGOAlNPC-2O{> z&zm!?BgbytUL2v?dgI3a*U(6h&Rfh0#@nN-Z$`mlRQs{q$>ZY&zU!epArv%pr8FP9 zJ`i6V`zt!}qdnx{f1ICjlcsf=lH%_BL(qvYG7Yo zb@ZV8F2PRr<)}M%IwB|$q{NQ%=mLDa&#^4@S@T`(K$V zghPM;_5N1K^kRKh**w&1Q=Q>41}mGhLZI{AY}VT=^}LJ6$7c3!#y#v8BR6T52lG^N zY9lf}sB3LNYMU@&(wK0#pDeyd;g@>QcEHL-A92yO{}CWOkHO|YaF72#tE$*@xxDc* z6?qvs(mHa=+q}f*D{E-CAvy~jXX3jSIL~7-itEOVqnl>%=ztdCp8N|!q4qBdoDSE~ zC9Zu8Q)AG=`N!3+8Kek&O;%T;jvwE;T{ODkpD9#lj#to0J2V5s!A_v1#+lxDqKTJ>f2y;Y22CE=W=rx) zWhL{pTRGc^i5@2nd~&GNIS)A<({#Ls+B<1DEa=wWEq0&bxXX!qkicq=p;J*sJ3a7CQtI>3_*uM z5qk_5jrHue-{`-I{XX%)A^2z7kqbE_zXmjl{OD9Cqk;QPqQMgwg?Xc($HOc?9%=Xz z4J1s0`TZIf;+u>C1oG?tiAMX~6B#J5hJ70Hh)SCN)YbL)qtPWVp&T5W^uT33uGVxs ztE7uBFdIDrN2hvClq@|_NeGrt9>qXrG#w$dM9OOb-wATL#(NY_o8?R~u&Xg>x*-$R zAcP-?FX63+9{mF8yJ`^PFN!FWUwpd|b>#}kqQaOcbP_+qzJbhl2l!$YTFgjo?)P*5 zzs*C62g=%)zZsq~x(`~Av26iP7LycB>*-neFmg`6)I$@LNMyrt=x6>9?ffxldk#XN zKZPJUP4e%^>>qd!aNW$(1@$mQHa@#n%%zxXa$Y_ORK=lS@- zG~(_%*TDDmpkTMe??rU7xaeZsAyzY1Pt1#e2$gpOzJ#`~{g==l#69>_iJd>V74PeA zuhtBO7QPE}`I%6b2c5=5ojwLKD4$D5mFs>7J6WIuSkC#dqY88Z#urEnHKvYrSfm~0 z^kZ~jmvZj^20lOfF99F?H{T6)ZiCl!1cLzv^DQnt(MHlQ7V~X~{XPdnuZ}>T_Xpp2 zrx12eWS9n{U2z5H7ts3GEV&?$MXr(q{Ajho#Ji$&!nwA7zg<`ZI1Sx4yzC z9M_EiF-Wfa-2*56QV+g;y#tOUeG?`V96@8>gs^u`1?JXqAY)5bGg+u*Z;&j8za z!;@nMC5ZU>QdQsDMJf;{1UTA=E z49dGz1f6(X43GzHvc;3=WRX`B@vx6jw-@?+!8^TLkYdra%TG+=NrD(Z6t2gu5e7db z8ulZNQHKd(1s?#SBc}o-%Le^)`xY7-n~y*Te<{io-#t%t?pQM8*blPgMzntq;>%}e zm#YchQ%7!9(hC;*RauOBg(4{yj-4u@DQ6l3C*CKO>xcn zL?MH%3 zh8F=4>*K$0nhfsuEpdul2t2f*&mo>h`r%&u3dWY-fpU=sxcm%!`(QJ5_)gl}LZmsD zaj;x6bIS`2K7(KFK53FMjUF8!zBkPA<+WmX*hVxmi(!)c4R++e z;WS0q7=nRM)ONP+lviQ#GJZ_QGC3%>$tX9S#m5r4Z~+lSbtGoOn8oJq!K}C$+!nax z_zKO)Wg5urT*z#m40GpZ8?nB4OuqM^P?|7sz%egPw+{rL5rY4eEQG{BK^C!i1`+=SPXj{nx3Vv z_<7?ow5S4=+Lh4t^$v608fh7Qr$gL=p@pZ6`GM0;oDvoAGY^)*f@LQa5t-4kT)97V z{o@o6jz}bYm+UVGx2fXT6e+mA6JjlMIFaX zkyp>3F?Ae?14O#ZyuUw8G8t6MiG!qCqM-iF$Avh{3vu}f%58IZ_xu%>iO~nZB;C9S zYl43T*p+;-2jo(8cH{81#siCOk4AD0@Wk=s&p9v}jXsSA+QaT*e#C|i{hKhuzY03< z*xafY@6hm(sXW|LdnW3U&bnZg`xw`zg;mV^ z*`@66-q)Su4=yIj7`i$Ov-0btlpH3x%fe|oBd6;qVHQ}O?8GUfm1q!dM@LISSxFr{ z8VplfuTrV2J8ydk{i|;2Ip6vvw=|`I4|!t;E{6$*k0^!o+NBZZr6;hCyOSNxV1!}K z^zT(we#n=3SUcr=(ig_)JnUekJyV?Y*L4}=O;`t=FE*=}w+!Wp zDmZ&N27~M(r|h8*r@)jQi%cEe;FKoUc;RV#e?2^(;eoJN3B_y6$};D+4)y11`gpEn=`n3Fk3_a|6Cc`^pW};Z*SMi69$ao%&u1@`+i|p1M-D}8Mq}o7!wrska9Yqm z)_BDp3jQ683*Nwc6$qKG45-%73sQlqTfKPHkQZlHt z1`G48tC=3;{6{p}KP^Ni5zo1(F9#zoN7pna(!_UOvu6F{a35WWG`fugv)AuqfN~$| z=TgwR98mHG$m5%pmA?HG-?DZadw%hgHzMwX0W-|G{14DsFV-|PhRZjD$K_ZCE6P0r z`ITa3?t$68bNTc!&qVt9%k;U=%oJz=frs+Aw|~m$d(oynt1;gXg6+#OXv*Egr|r8x zK0Ev?*zr$wdU2bG9g4uU06QUgSMO2*vwD-|2JH}~eK^|w%TP~lv%)PD9227NV&d5( z$A`_v*UJ8Ka0kdlj@dQs;M*sM84935#B7q+;+=d_4gtvKy%{?X55Tp5bi|~r9t@_Y z(Hg9qOhI|x!?(q4tSD}{Im4x!;?}L}`w-Zeu{nN@g0kO>+3R_ZDGG>)0m>7w8Vp~v zX2X9_cWYcmz0Ky$u@ABA)PfD1b6nCE1RV|QLx{+a0ZR|`vd&wivEQPOUW>-?NH?1{ zy~R~}RJc!_PNP)9bPgGFS270vks6OaiB6qHlGyvhp2SDumjwO(2c3TQlwZ96j?s;q zPDg8d2I%PnFqPqmHzNuL7LNyZ9d#0GTN=q!5~x!TAg*yzdw(kix3_}sMQlE8aItqK zQ&f(_G3fjOmWN@Dk{|YK+$#5o3@Hb<4;^_7JF54^m+5G&@PQJ@)Z4hgVr25}-V#Wz z^CV*P)d^4rSG!utGErISr*Dh9H)}XgS{i2ZrnqC$0x|;lBy+!&?GG#Iepe7}D$==*10I3RCZ;u{RFqa6Q^dKd7*qugnN zvwQ1<)x)qag!OvKD>`C7X6wgkJa%h15`Gt*J9qL6Z`iaN8|vE8p?(MDROuydObk8> z`dAI}aGaA)oZ>*8I&s~>_%ak`5*mzoZkPf8Ml2sJ$I+1c-Ov>h7iqh!v2o&k zFv~rO^tv@ge*-h~jrh#$A;mgtOTqrsz@lj{d^IUd%$FnG+sZ2xxG49c8< z-S*nY$l@4&(cZg+H%A}FI^;pcon`h;kOfX*v)^3qC7sFrFH=A}g+3k?jfSyQ%ca3S zKLTMdpfeZjF2O!er+zSjnd2EkOsu z%fXfE$mPu7{^bwgKV85Y8YY~D4`N&a|4{-~m^WRZ!moze__jjNI17`%L@adcT{!$P z?Y?)plhStyzWckhkZCo>g|+4R=#=pdb9c)Dz`qY8XB^+^eAURaSp1Of(>PCEjiXrq zMw(nLJ)x7U!bUjET8rYwG)s}vI_8WSGw#B-6P^Il;g*QD0kN6L=k3Pq&Z#tCln0NiI`i5OMjJIY-p z5%sVS1pC7B@GCSRuFY~N*ES4T>UY{{n?v&VZE{yxN<&Vj>j=zjFi?*y1p-W@?jCBO zao72BK=+UA6odC zA7uU?;EQLUy651IBDoAl8*%A}$T_R8Klez+qT^9-&IDwX1xIWIq`JtHoxgsjt*2pc z!E}B{AfV0f?Ciwm>Y?@IZ5@va>-_W2AHHr~tlH<}_%ZC+h^9-`{mqQ?2Fys0LR~7ki + + + + + + + + + + + + + + + + + + + + + + diff --git a/node_modules/nopt/.npmignore b/node_modules/nopt/.npmignore new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/nopt/LICENSE b/node_modules/nopt/LICENSE new file mode 100644 index 0000000..05a4010 --- /dev/null +++ b/node_modules/nopt/LICENSE @@ -0,0 +1,23 @@ +Copyright 2009, 2010, 2011 Isaac Z. Schlueter. +All rights reserved. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/nopt/README.md b/node_modules/nopt/README.md new file mode 100644 index 0000000..eeddfd4 --- /dev/null +++ b/node_modules/nopt/README.md @@ -0,0 +1,208 @@ +If you want to write an option parser, and have it be good, there are +two ways to do it. The Right Way, and the Wrong Way. + +The Wrong Way is to sit down and write an option parser. We've all done +that. + +The Right Way is to write some complex configurable program with so many +options that you go half-insane just trying to manage them all, and put +it off with duct-tape solutions until you see exactly to the core of the +problem, and finally snap and write an awesome option parser. + +If you want to write an option parser, don't write an option parser. +Write a package manager, or a source control system, or a service +restarter, or an operating system. You probably won't end up with a +good one of those, but if you don't give up, and you are relentless and +diligent enough in your procrastination, you may just end up with a very +nice option parser. + +## USAGE + + // my-program.js + var nopt = require("nopt") + , Stream = require("stream").Stream + , path = require("path") + , knownOpts = { "foo" : [String, null] + , "bar" : [Stream, Number] + , "baz" : path + , "bloo" : [ "big", "medium", "small" ] + , "flag" : Boolean + , "pick" : Boolean + , "many" : [String, Array] + } + , shortHands = { "foofoo" : ["--foo", "Mr. Foo"] + , "b7" : ["--bar", "7"] + , "m" : ["--bloo", "medium"] + , "p" : ["--pick"] + , "f" : ["--flag"] + } + // everything is optional. + // knownOpts and shorthands default to {} + // arg list defaults to process.argv + // slice defaults to 2 + , parsed = nopt(knownOpts, shortHands, process.argv, 2) + console.log(parsed) + +This would give you support for any of the following: + +```bash +$ node my-program.js --foo "blerp" --no-flag +{ "foo" : "blerp", "flag" : false } + +$ node my-program.js ---bar 7 --foo "Mr. Hand" --flag +{ bar: 7, foo: "Mr. Hand", flag: true } + +$ node my-program.js --foo "blerp" -f -----p +{ foo: "blerp", flag: true, pick: true } + +$ node my-program.js -fp --foofoo +{ foo: "Mr. Foo", flag: true, pick: true } + +$ node my-program.js --foofoo -- -fp # -- stops the flag parsing. +{ foo: "Mr. Foo", argv: { remain: ["-fp"] } } + +$ node my-program.js --blatzk 1000 -fp # unknown opts are ok. +{ blatzk: 1000, flag: true, pick: true } + +$ node my-program.js --blatzk true -fp # but they need a value +{ blatzk: true, flag: true, pick: true } + +$ node my-program.js --no-blatzk -fp # unless they start with "no-" +{ blatzk: false, flag: true, pick: true } + +$ node my-program.js --baz b/a/z # known paths are resolved. +{ baz: "/Users/isaacs/b/a/z" } + +# if Array is one of the types, then it can take many +# values, and will always be an array. The other types provided +# specify what types are allowed in the list. + +$ node my-program.js --many 1 --many null --many foo +{ many: ["1", "null", "foo"] } + +$ node my-program.js --many foo +{ many: ["foo"] } +``` + +Read the tests at the bottom of `lib/nopt.js` for more examples of +what this puppy can do. + +## Types + +The following types are supported, and defined on `nopt.typeDefs` + +* String: A normal string. No parsing is done. +* path: A file system path. Gets resolved against cwd if not absolute. +* url: A url. If it doesn't parse, it isn't accepted. +* Number: Must be numeric. +* Date: Must parse as a date. If it does, and `Date` is one of the options, + then it will return a Date object, not a string. +* Boolean: Must be either `true` or `false`. If an option is a boolean, + then it does not need a value, and its presence will imply `true` as + the value. To negate boolean flags, do `--no-whatever` or `--whatever + false` +* NaN: Means that the option is strictly not allowed. Any value will + fail. +* Stream: An object matching the "Stream" class in node. Valuable + for use when validating programmatically. (npm uses this to let you + supply any WriteStream on the `outfd` and `logfd` config options.) +* Array: If `Array` is specified as one of the types, then the value + will be parsed as a list of options. This means that multiple values + can be specified, and that the value will always be an array. + +If a type is an array of values not on this list, then those are +considered valid values. For instance, in the example above, the +`--bloo` option can only be one of `"big"`, `"medium"`, or `"small"`, +and any other value will be rejected. + +When parsing unknown fields, `"true"`, `"false"`, and `"null"` will be +interpreted as their JavaScript equivalents, and numeric values will be +interpreted as a number. + +You can also mix types and values, or multiple types, in a list. For +instance `{ blah: [Number, null] }` would allow a value to be set to +either a Number or null. + +To define a new type, add it to `nopt.typeDefs`. Each item in that +hash is an object with a `type` member and a `validate` method. The +`type` member is an object that matches what goes in the type list. The +`validate` method is a function that gets called with `validate(data, +key, val)`. Validate methods should assign `data[key]` to the valid +value of `val` if it can be handled properly, or return boolean +`false` if it cannot. + +You can also call `nopt.clean(data, types, typeDefs)` to clean up a +config object and remove its invalid properties. + +## Error Handling + +By default, nopt outputs a warning to standard error when invalid +options are found. You can change this behavior by assigning a method +to `nopt.invalidHandler`. This method will be called with +the offending `nopt.invalidHandler(key, val, types)`. + +If no `nopt.invalidHandler` is assigned, then it will console.error +its whining. If it is assigned to boolean `false` then the warning is +suppressed. + +## Abbreviations + +Yes, they are supported. If you define options like this: + +```javascript +{ "foolhardyelephants" : Boolean +, "pileofmonkeys" : Boolean } +``` + +Then this will work: + +```bash +node program.js --foolhar --pil +node program.js --no-f --pileofmon +# etc. +``` + +## Shorthands + +Shorthands are a hash of shorter option names to a snippet of args that +they expand to. + +If multiple one-character shorthands are all combined, and the +combination does not unambiguously match any other option or shorthand, +then they will be broken up into their constituent parts. For example: + +```json +{ "s" : ["--loglevel", "silent"] +, "g" : "--global" +, "f" : "--force" +, "p" : "--parseable" +, "l" : "--long" +} +``` + +```bash +npm ls -sgflp +# just like doing this: +npm ls --loglevel silent --global --force --long --parseable +``` + +## The Rest of the args + +The config object returned by nopt is given a special member called +`argv`, which is an object with the following fields: + +* `remain`: The remaining args after all the parsing has occurred. +* `original`: The args as they originally appeared. +* `cooked`: The args after flags and shorthands are expanded. + +## Slicing + +Node programs are called with more or less the exact argv as it appears +in C land, after the v8 and node-specific options have been plucked off. +As such, `argv[0]` is always `node` and `argv[1]` is always the +JavaScript program being run. + +That's usually not very useful to you. So they're sliced off by +default. If you want them, then you can pass in `0` as the last +argument, or any other number that you'd like to slice off the start of +the list. diff --git a/node_modules/nopt/bin/nopt.js b/node_modules/nopt/bin/nopt.js new file mode 100755 index 0000000..df90c72 --- /dev/null +++ b/node_modules/nopt/bin/nopt.js @@ -0,0 +1,44 @@ +#!/usr/bin/env node +var nopt = require("../lib/nopt") + , types = { num: Number + , bool: Boolean + , help: Boolean + , list: Array + , "num-list": [Number, Array] + , "str-list": [String, Array] + , "bool-list": [Boolean, Array] + , str: String } + , shorthands = { s: [ "--str", "astring" ] + , b: [ "--bool" ] + , nb: [ "--no-bool" ] + , tft: [ "--bool-list", "--no-bool-list", "--bool-list", "true" ] + , "?": ["--help"] + , h: ["--help"] + , H: ["--help"] + , n: [ "--num", "125" ] } + , parsed = nopt( types + , shorthands + , process.argv + , 2 ) + +console.log("parsed", parsed) + +if (parsed.help) { + console.log("") + console.log("nopt cli tester") + console.log("") + console.log("types") + console.log(Object.keys(types).map(function M (t) { + var type = types[t] + if (Array.isArray(type)) { + return [t, type.map(function (type) { return type.name })] + } + return [t, type && type.name] + }).reduce(function (s, i) { + s[i[0]] = i[1] + return s + }, {})) + console.log("") + console.log("shorthands") + console.log(shorthands) +} diff --git a/node_modules/nopt/examples/my-program.js b/node_modules/nopt/examples/my-program.js new file mode 100755 index 0000000..142447e --- /dev/null +++ b/node_modules/nopt/examples/my-program.js @@ -0,0 +1,30 @@ +#!/usr/bin/env node + +//process.env.DEBUG_NOPT = 1 + +// my-program.js +var nopt = require("../lib/nopt") + , Stream = require("stream").Stream + , path = require("path") + , knownOpts = { "foo" : [String, null] + , "bar" : [Stream, Number] + , "baz" : path + , "bloo" : [ "big", "medium", "small" ] + , "flag" : Boolean + , "pick" : Boolean + } + , shortHands = { "foofoo" : ["--foo", "Mr. Foo"] + , "b7" : ["--bar", "7"] + , "m" : ["--bloo", "medium"] + , "p" : ["--pick"] + , "f" : ["--flag", "true"] + , "g" : ["--flag"] + , "s" : "--flag" + } + // everything is optional. + // knownOpts and shorthands default to {} + // arg list defaults to process.argv + // slice defaults to 2 + , parsed = nopt(knownOpts, shortHands, process.argv, 2) + +console.log("parsed =\n"+ require("util").inspect(parsed)) diff --git a/node_modules/nopt/lib/nopt.js b/node_modules/nopt/lib/nopt.js new file mode 100644 index 0000000..ff802da --- /dev/null +++ b/node_modules/nopt/lib/nopt.js @@ -0,0 +1,552 @@ +// info about each config option. + +var debug = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG + ? function () { console.error.apply(console, arguments) } + : function () {} + +var url = require("url") + , path = require("path") + , Stream = require("stream").Stream + , abbrev = require("abbrev") + +module.exports = exports = nopt +exports.clean = clean + +exports.typeDefs = + { String : { type: String, validate: validateString } + , Boolean : { type: Boolean, validate: validateBoolean } + , url : { type: url, validate: validateUrl } + , Number : { type: Number, validate: validateNumber } + , path : { type: path, validate: validatePath } + , Stream : { type: Stream, validate: validateStream } + , Date : { type: Date, validate: validateDate } + } + +function nopt (types, shorthands, args, slice) { + args = args || process.argv + types = types || {} + shorthands = shorthands || {} + if (typeof slice !== "number") slice = 2 + + debug(types, shorthands, args, slice) + + args = args.slice(slice) + var data = {} + , key + , remain = [] + , cooked = args + , original = args.slice(0) + + parse(args, data, remain, types, shorthands) + // now data is full + clean(data, types, exports.typeDefs) + data.argv = {remain:remain,cooked:cooked,original:original} + data.argv.toString = function () { + return this.original.map(JSON.stringify).join(" ") + } + return data +} + +function clean (data, types, typeDefs) { + typeDefs = typeDefs || exports.typeDefs + var remove = {} + , typeDefault = [false, true, null, String, Number] + + Object.keys(data).forEach(function (k) { + if (k === "argv") return + var val = data[k] + , isArray = Array.isArray(val) + , type = types[k] + if (!isArray) val = [val] + if (!type) type = typeDefault + if (type === Array) type = typeDefault.concat(Array) + if (!Array.isArray(type)) type = [type] + + debug("val=%j", val) + debug("types=", type) + val = val.map(function (val) { + // if it's an unknown value, then parse false/true/null/numbers/dates + if (typeof val === "string") { + debug("string %j", val) + val = val.trim() + if ((val === "null" && ~type.indexOf(null)) + || (val === "true" && + (~type.indexOf(true) || ~type.indexOf(Boolean))) + || (val === "false" && + (~type.indexOf(false) || ~type.indexOf(Boolean)))) { + val = JSON.parse(val) + debug("jsonable %j", val) + } else if (~type.indexOf(Number) && !isNaN(val)) { + debug("convert to number", val) + val = +val + } else if (~type.indexOf(Date) && !isNaN(Date.parse(val))) { + debug("convert to date", val) + val = new Date(val) + } + } + + if (!types.hasOwnProperty(k)) { + return val + } + + // allow `--no-blah` to set 'blah' to null if null is allowed + if (val === false && ~type.indexOf(null) && + !(~type.indexOf(false) || ~type.indexOf(Boolean))) { + val = null + } + + var d = {} + d[k] = val + debug("prevalidated val", d, val, types[k]) + if (!validate(d, k, val, types[k], typeDefs)) { + if (exports.invalidHandler) { + exports.invalidHandler(k, val, types[k], data) + } else if (exports.invalidHandler !== false) { + debug("invalid: "+k+"="+val, types[k]) + } + return remove + } + debug("validated val", d, val, types[k]) + return d[k] + }).filter(function (val) { return val !== remove }) + + if (!val.length) delete data[k] + else if (isArray) { + debug(isArray, data[k], val) + data[k] = val + } else data[k] = val[0] + + debug("k=%s val=%j", k, val, data[k]) + }) +} + +function validateString (data, k, val) { + data[k] = String(val) +} + +function validatePath (data, k, val) { + data[k] = path.resolve(String(val)) + return true +} + +function validateNumber (data, k, val) { + debug("validate Number %j %j %j", k, val, isNaN(val)) + if (isNaN(val)) return false + data[k] = +val +} + +function validateDate (data, k, val) { + debug("validate Date %j %j %j", k, val, Date.parse(val)) + var s = Date.parse(val) + if (isNaN(s)) return false + data[k] = new Date(val) +} + +function validateBoolean (data, k, val) { + if (val instanceof Boolean) val = val.valueOf() + else if (typeof val === "string") { + if (!isNaN(val)) val = !!(+val) + else if (val === "null" || val === "false") val = false + else val = true + } else val = !!val + data[k] = val +} + +function validateUrl (data, k, val) { + val = url.parse(String(val)) + if (!val.host) return false + data[k] = val.href +} + +function validateStream (data, k, val) { + if (!(val instanceof Stream)) return false + data[k] = val +} + +function validate (data, k, val, type, typeDefs) { + // arrays are lists of types. + if (Array.isArray(type)) { + for (var i = 0, l = type.length; i < l; i ++) { + if (type[i] === Array) continue + if (validate(data, k, val, type[i], typeDefs)) return true + } + delete data[k] + return false + } + + // an array of anything? + if (type === Array) return true + + // NaN is poisonous. Means that something is not allowed. + if (type !== type) { + debug("Poison NaN", k, val, type) + delete data[k] + return false + } + + // explicit list of values + if (val === type) { + debug("Explicitly allowed %j", val) + // if (isArray) (data[k] = data[k] || []).push(val) + // else data[k] = val + data[k] = val + return true + } + + // now go through the list of typeDefs, validate against each one. + var ok = false + , types = Object.keys(typeDefs) + for (var i = 0, l = types.length; i < l; i ++) { + debug("test type %j %j %j", k, val, types[i]) + var t = typeDefs[types[i]] + if (t && type === t.type) { + var d = {} + ok = false !== t.validate(d, k, val) + val = d[k] + if (ok) { + // if (isArray) (data[k] = data[k] || []).push(val) + // else data[k] = val + data[k] = val + break + } + } + } + debug("OK? %j (%j %j %j)", ok, k, val, types[i]) + + if (!ok) delete data[k] + return ok +} + +function parse (args, data, remain, types, shorthands) { + debug("parse", args, data, remain) + + var key = null + , abbrevs = abbrev(Object.keys(types)) + , shortAbbr = abbrev(Object.keys(shorthands)) + + for (var i = 0; i < args.length; i ++) { + var arg = args[i] + debug("arg", arg) + + if (arg.match(/^-{2,}$/)) { + // done with keys. + // the rest are args. + remain.push.apply(remain, args.slice(i + 1)) + args[i] = "--" + break + } + if (arg.charAt(0) === "-") { + if (arg.indexOf("=") !== -1) { + var v = arg.split("=") + arg = v.shift() + v = v.join("=") + args.splice.apply(args, [i, 1].concat([arg, v])) + } + // see if it's a shorthand + // if so, splice and back up to re-parse it. + var shRes = resolveShort(arg, shorthands, shortAbbr, abbrevs) + debug("arg=%j shRes=%j", arg, shRes) + if (shRes) { + debug(arg, shRes) + args.splice.apply(args, [i, 1].concat(shRes)) + if (arg !== shRes[0]) { + i -- + continue + } + } + arg = arg.replace(/^-+/, "") + var no = false + while (arg.toLowerCase().indexOf("no-") === 0) { + no = !no + arg = arg.substr(3) + } + + if (abbrevs[arg]) arg = abbrevs[arg] + + var isArray = types[arg] === Array || + Array.isArray(types[arg]) && types[arg].indexOf(Array) !== -1 + + var val + , la = args[i + 1] + + var isBool = no || + types[arg] === Boolean || + Array.isArray(types[arg]) && types[arg].indexOf(Boolean) !== -1 || + (la === "false" && + (types[arg] === null || + Array.isArray(types[arg]) && ~types[arg].indexOf(null))) + + if (isBool) { + // just set and move along + val = !no + // however, also support --bool true or --bool false + if (la === "true" || la === "false") { + val = JSON.parse(la) + la = null + if (no) val = !val + i ++ + } + + // also support "foo":[Boolean, "bar"] and "--foo bar" + if (Array.isArray(types[arg]) && la) { + if (~types[arg].indexOf(la)) { + // an explicit type + val = la + i ++ + } else if ( la === "null" && ~types[arg].indexOf(null) ) { + // null allowed + val = null + i ++ + } else if ( !la.match(/^-{2,}[^-]/) && + !isNaN(la) && + ~types[arg].indexOf(Number) ) { + // number + val = +la + i ++ + } else if ( !la.match(/^-[^-]/) && ~types[arg].indexOf(String) ) { + // string + val = la + i ++ + } + } + + if (isArray) (data[arg] = data[arg] || []).push(val) + else data[arg] = val + + continue + } + + if (la && la.match(/^-{2,}$/)) { + la = undefined + i -- + } + + val = la === undefined ? true : la + if (isArray) (data[arg] = data[arg] || []).push(val) + else data[arg] = val + + i ++ + continue + } + remain.push(arg) + } +} + +function resolveShort (arg, shorthands, shortAbbr, abbrevs) { + // handle single-char shorthands glommed together, like + // npm ls -glp, but only if there is one dash, and only if + // all of the chars are single-char shorthands, and it's + // not a match to some other abbrev. + arg = arg.replace(/^-+/, '') + if (abbrevs[arg] && !shorthands[arg]) { + return null + } + if (shortAbbr[arg]) { + arg = shortAbbr[arg] + } else { + var singles = shorthands.___singles + if (!singles) { + singles = Object.keys(shorthands).filter(function (s) { + return s.length === 1 + }).reduce(function (l,r) { l[r] = true ; return l }, {}) + shorthands.___singles = singles + } + var chrs = arg.split("").filter(function (c) { + return singles[c] + }) + if (chrs.join("") === arg) return chrs.map(function (c) { + return shorthands[c] + }).reduce(function (l, r) { + return l.concat(r) + }, []) + } + + if (shorthands[arg] && !Array.isArray(shorthands[arg])) { + shorthands[arg] = shorthands[arg].split(/\s+/) + } + return shorthands[arg] +} + +if (module === require.main) { +var assert = require("assert") + , util = require("util") + + , shorthands = + { s : ["--loglevel", "silent"] + , d : ["--loglevel", "info"] + , dd : ["--loglevel", "verbose"] + , ddd : ["--loglevel", "silly"] + , noreg : ["--no-registry"] + , reg : ["--registry"] + , "no-reg" : ["--no-registry"] + , silent : ["--loglevel", "silent"] + , verbose : ["--loglevel", "verbose"] + , h : ["--usage"] + , H : ["--usage"] + , "?" : ["--usage"] + , help : ["--usage"] + , v : ["--version"] + , f : ["--force"] + , desc : ["--description"] + , "no-desc" : ["--no-description"] + , "local" : ["--no-global"] + , l : ["--long"] + , p : ["--parseable"] + , porcelain : ["--parseable"] + , g : ["--global"] + } + + , types = + { aoa: Array + , nullstream: [null, Stream] + , date: Date + , str: String + , browser : String + , cache : path + , color : ["always", Boolean] + , depth : Number + , description : Boolean + , dev : Boolean + , editor : path + , force : Boolean + , global : Boolean + , globalconfig : path + , group : [String, Number] + , gzipbin : String + , logfd : [Number, Stream] + , loglevel : ["silent","win","error","warn","info","verbose","silly"] + , long : Boolean + , "node-version" : [false, String] + , npaturl : url + , npat : Boolean + , "onload-script" : [false, String] + , outfd : [Number, Stream] + , parseable : Boolean + , pre: Boolean + , prefix: path + , proxy : url + , "rebuild-bundle" : Boolean + , registry : url + , searchopts : String + , searchexclude: [null, String] + , shell : path + , t: [Array, String] + , tag : String + , tar : String + , tmp : path + , "unsafe-perm" : Boolean + , usage : Boolean + , user : String + , username : String + , userconfig : path + , version : Boolean + , viewer: path + , _exit : Boolean + } + +; [["-v", {version:true}, []] + ,["---v", {version:true}, []] + ,["ls -s --no-reg connect -d", + {loglevel:"info",registry:null},["ls","connect"]] + ,["ls ---s foo",{loglevel:"silent"},["ls","foo"]] + ,["ls --registry blargle", {}, ["ls"]] + ,["--no-registry", {registry:null}, []] + ,["--no-color true", {color:false}, []] + ,["--no-color false", {color:true}, []] + ,["--no-color", {color:false}, []] + ,["--color false", {color:false}, []] + ,["--color --logfd 7", {logfd:7,color:true}, []] + ,["--color=true", {color:true}, []] + ,["--logfd=10", {logfd:10}, []] + ,["--tmp=/tmp -tar=gtar",{tmp:"/tmp",tar:"gtar"},[]] + ,["--tmp=tmp -tar=gtar", + {tmp:path.resolve(process.cwd(), "tmp"),tar:"gtar"},[]] + ,["--logfd x", {}, []] + ,["a -true -- -no-false", {true:true},["a","-no-false"]] + ,["a -no-false", {false:false},["a"]] + ,["a -no-no-true", {true:true}, ["a"]] + ,["a -no-no-no-false", {false:false}, ["a"]] + ,["---NO-no-No-no-no-no-nO-no-no"+ + "-No-no-no-no-no-no-no-no-no"+ + "-no-no-no-no-NO-NO-no-no-no-no-no-no"+ + "-no-body-can-do-the-boogaloo-like-I-do" + ,{"body-can-do-the-boogaloo-like-I-do":false}, []] + ,["we are -no-strangers-to-love "+ + "--you-know the-rules --and so-do-i "+ + "---im-thinking-of=a-full-commitment "+ + "--no-you-would-get-this-from-any-other-guy "+ + "--no-gonna-give-you-up "+ + "-no-gonna-let-you-down=true "+ + "--no-no-gonna-run-around false "+ + "--desert-you=false "+ + "--make-you-cry false "+ + "--no-tell-a-lie "+ + "--no-no-and-hurt-you false" + ,{"strangers-to-love":false + ,"you-know":"the-rules" + ,"and":"so-do-i" + ,"you-would-get-this-from-any-other-guy":false + ,"gonna-give-you-up":false + ,"gonna-let-you-down":false + ,"gonna-run-around":false + ,"desert-you":false + ,"make-you-cry":false + ,"tell-a-lie":false + ,"and-hurt-you":false + },["we", "are"]] + ,["-t one -t two -t three" + ,{t: ["one", "two", "three"]} + ,[]] + ,["-t one -t null -t three four five null" + ,{t: ["one", "null", "three"]} + ,["four", "five", "null"]] + ,["-t foo" + ,{t:["foo"]} + ,[]] + ,["--no-t" + ,{t:["false"]} + ,[]] + ,["-no-no-t" + ,{t:["true"]} + ,[]] + ,["-aoa one -aoa null -aoa 100" + ,{aoa:["one", null, 100]} + ,[]] + ,["-str 100" + ,{str:"100"} + ,[]] + ,["--color always" + ,{color:"always"} + ,[]] + ,["--no-nullstream" + ,{nullstream:null} + ,[]] + ,["--nullstream false" + ,{nullstream:null} + ,[]] + ,["--notadate 2011-01-25" + ,{notadate: "2011-01-25"} + ,[]] + ,["--date 2011-01-25" + ,{date: new Date("2011-01-25")} + ,[]] + ].forEach(function (test) { + var argv = test[0].split(/\s+/) + , opts = test[1] + , rem = test[2] + , actual = nopt(types, shorthands, argv, 0) + , parsed = actual.argv + delete actual.argv + console.log(util.inspect(actual, false, 2, true), parsed.remain) + for (var i in opts) { + var e = JSON.stringify(opts[i]) + , a = JSON.stringify(actual[i] === undefined ? null : actual[i]) + if (e && typeof e === "object") { + assert.deepEqual(e, a) + } else { + assert.equal(e, a) + } + } + assert.deepEqual(rem, parsed.remain) + }) +} diff --git a/node_modules/nopt/package.json b/node_modules/nopt/package.json new file mode 100644 index 0000000..f5cc903 --- /dev/null +++ b/node_modules/nopt/package.json @@ -0,0 +1,60 @@ +{ + "_from": "nopt@~1.0.10", + "_id": "nopt@1.0.10", + "_inBundle": false, + "_integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "_location": "/nopt", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "nopt@~1.0.10", + "name": "nopt", + "escapedName": "nopt", + "rawSpec": "~1.0.10", + "saveSpec": null, + "fetchSpec": "~1.0.10" + }, + "_requiredBy": [ + "/touch" + ], + "_resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "_shasum": "6ddd21bd2a31417b92727dd585f8a6f37608ebee", + "_spec": "nopt@~1.0.10", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/touch", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bin": { + "nopt": "./bin/nopt.js" + }, + "bugs": { + "url": "https://github.com/isaacs/nopt/issues" + }, + "bundleDependencies": false, + "dependencies": { + "abbrev": "1" + }, + "deprecated": false, + "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.", + "engines": { + "node": "*" + }, + "homepage": "https://github.com/isaacs/nopt#readme", + "license": { + "type": "MIT", + "url": "https://github.com/isaacs/nopt/raw/master/LICENSE" + }, + "main": "lib/nopt.js", + "name": "nopt", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/isaacs/nopt.git" + }, + "scripts": { + "test": "node lib/nopt.js" + }, + "version": "1.0.10" +} diff --git a/node_modules/normalize-path/LICENSE b/node_modules/normalize-path/LICENSE new file mode 100644 index 0000000..d734237 --- /dev/null +++ b/node_modules/normalize-path/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, 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/node_modules/normalize-path/README.md b/node_modules/normalize-path/README.md new file mode 100644 index 0000000..daa0edd --- /dev/null +++ b/node_modules/normalize-path/README.md @@ -0,0 +1,92 @@ +# normalize-path [![NPM version](https://img.shields.io/npm/v/normalize-path.svg?style=flat)](https://www.npmjs.com/package/normalize-path) [![NPM monthly downloads](https://img.shields.io/npm/dm/normalize-path.svg?style=flat)](https://npmjs.org/package/normalize-path) [![NPM total downloads](https://img.shields.io/npm/dt/normalize-path.svg?style=flat)](https://npmjs.org/package/normalize-path) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/normalize-path.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/normalize-path) + +> Normalize file path slashes to be unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes unless disabled. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save normalize-path +``` + +## Usage + +```js +var normalize = require('normalize-path'); + +normalize('\\foo\\bar\\baz\\'); +//=> '/foo/bar/baz' + +normalize('./foo/bar/baz/'); +//=> './foo/bar/baz' +``` + +Pass `false` as the last argument to **keep** trailing slashes: + +```js +normalize('./foo/bar/baz/', false); +//=> './foo/bar/baz/' + +normalize('foo\\bar\\baz\\', false); +//=> 'foo/bar/baz/' +``` + +## About + +### Related projects + +* [contains-path](https://www.npmjs.com/package/contains-path): Return true if a file path contains the given path. | [homepage](https://github.com/jonschlinkert/contains-path "Return true if a file path contains the given path.") +* [ends-with](https://www.npmjs.com/package/ends-with): Returns `true` if the given `string` or `array` ends with `suffix` using strict equality for… [more](https://github.com/jonschlinkert/ends-with) | [homepage](https://github.com/jonschlinkert/ends-with "Returns `true` if the given `string` or `array` ends with `suffix` using strict equality for comparisons.") +* [is-absolute](https://www.npmjs.com/package/is-absolute): Polyfill for node.js `path.isAbolute`. Returns true if a file path is absolute. | [homepage](https://github.com/jonschlinkert/is-absolute "Polyfill for node.js `path.isAbolute`. Returns true if a file path is absolute.") +* [is-relative](https://www.npmjs.com/package/is-relative): Returns `true` if the path appears to be relative. | [homepage](https://github.com/jonschlinkert/is-relative "Returns `true` if the path appears to be relative.") +* [parse-filepath](https://www.npmjs.com/package/parse-filepath): Pollyfill for node.js `path.parse`, parses a filepath into an object. | [homepage](https://github.com/jonschlinkert/parse-filepath "Pollyfill for node.js `path.parse`, parses a filepath into an object.") +* [path-ends-with](https://www.npmjs.com/package/path-ends-with): Return `true` if a file path ends with the given string/suffix. | [homepage](https://github.com/jonschlinkert/path-ends-with "Return `true` if a file path ends with the given string/suffix.") +* [path-segments](https://www.npmjs.com/package/path-segments): Get n specific segments of a file path, e.g. first 2, last 3, etc. | [homepage](https://github.com/jonschlinkert/path-segments "Get n specific segments of a file path, e.g. first 2, last 3, etc.") +* [rewrite-ext](https://www.npmjs.com/package/rewrite-ext): Automatically re-write the destination extension of a filepath based on the source extension. e.g… [more](https://github.com/jonschlinkert/rewrite-ext) | [homepage](https://github.com/jonschlinkert/rewrite-ext "Automatically re-write the destination extension of a filepath based on the source extension. e.g `.coffee` => `.js`. This will only rename the ext, no other path parts are modified.") +* [unixify](https://www.npmjs.com/package/unixify): Convert Windows file paths to unix paths. | [homepage](https://github.com/jonschlinkert/unixify "Convert Windows file paths to unix paths.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 31 | [jonschlinkert](https://github.com/jonschlinkert) | +| 1 | [phated](https://github.com/phated) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.3, on March 29, 2017._ \ No newline at end of file diff --git a/node_modules/normalize-path/index.js b/node_modules/normalize-path/index.js new file mode 100644 index 0000000..4a4f8cc --- /dev/null +++ b/node_modules/normalize-path/index.js @@ -0,0 +1,19 @@ +/*! + * normalize-path + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +var removeTrailingSeparator = require('remove-trailing-separator'); + +module.exports = function normalizePath(str, stripTrailing) { + if (typeof str !== 'string') { + throw new TypeError('expected a string'); + } + str = str.replace(/[\\\/]+/g, '/'); + if (stripTrailing !== false) { + str = removeTrailingSeparator(str); + } + return str; +}; diff --git a/node_modules/normalize-path/package.json b/node_modules/normalize-path/package.json new file mode 100644 index 0000000..1739bad --- /dev/null +++ b/node_modules/normalize-path/package.json @@ -0,0 +1,118 @@ +{ + "_from": "normalize-path@^2.1.1", + "_id": "normalize-path@2.1.1", + "_inBundle": false, + "_integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "_location": "/normalize-path", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "normalize-path@^2.1.1", + "name": "normalize-path", + "escapedName": "normalize-path", + "rawSpec": "^2.1.1", + "saveSpec": null, + "fetchSpec": "^2.1.1" + }, + "_requiredBy": [ + "/anymatch", + "/chokidar" + ], + "_resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "_shasum": "1ab28b556e198363a8c1a6f7e6fa20137fe6aed9", + "_spec": "normalize-path@^2.1.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/chokidar", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/normalize-path/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Blaine Bublitz", + "email": "blaine.bublitz@gmail.com", + "url": "https://twitter.com/BlaineBublitz" + }, + { + "name": "Jon Schlinkert", + "email": "jon.schlinkert@sellside.com", + "url": "http://twitter.com/jonschlinkert" + } + ], + "dependencies": { + "remove-trailing-separator": "^1.0.1" + }, + "deprecated": false, + "description": "Normalize file path slashes to be unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes unless disabled.", + "devDependencies": { + "benchmarked": "^0.1.1", + "gulp-format-md": "^0.1.11", + "minimist": "^1.2.0", + "mocha": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/normalize-path", + "keywords": [ + "backslash", + "file", + "filepath", + "fix", + "forward", + "fp", + "fs", + "normalize", + "path", + "slash", + "slashes", + "trailing", + "unix", + "urix" + ], + "license": "MIT", + "main": "index.js", + "name": "normalize-path", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/normalize-path.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "contains-path", + "ends-with", + "is-absolute", + "is-relative", + "parse-filepath", + "path-ends-with", + "path-segments", + "rewrite-ext", + "unixify" + ], + "description": "Other useful libraries for working with paths in node.js:" + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + }, + "version": "2.1.1" +} diff --git a/node_modules/npm-run-path/index.js b/node_modules/npm-run-path/index.js new file mode 100644 index 0000000..56f31e4 --- /dev/null +++ b/node_modules/npm-run-path/index.js @@ -0,0 +1,39 @@ +'use strict'; +const path = require('path'); +const pathKey = require('path-key'); + +module.exports = opts => { + opts = Object.assign({ + cwd: process.cwd(), + path: process.env[pathKey()] + }, opts); + + let prev; + let pth = path.resolve(opts.cwd); + const ret = []; + + while (prev !== pth) { + ret.push(path.join(pth, 'node_modules/.bin')); + prev = pth; + pth = path.resolve(pth, '..'); + } + + // ensure the running `node` binary is used + ret.push(path.dirname(process.execPath)); + + return ret.concat(opts.path).join(path.delimiter); +}; + +module.exports.env = opts => { + opts = Object.assign({ + env: process.env + }, opts); + + const env = Object.assign({}, opts.env); + const path = pathKey({env}); + + opts.path = env[path]; + env[path] = module.exports(opts); + + return env; +}; diff --git a/node_modules/npm-run-path/license b/node_modules/npm-run-path/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/npm-run-path/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/npm-run-path/package.json b/node_modules/npm-run-path/package.json new file mode 100644 index 0000000..0c58bdf --- /dev/null +++ b/node_modules/npm-run-path/package.json @@ -0,0 +1,77 @@ +{ + "_from": "npm-run-path@^2.0.0", + "_id": "npm-run-path@2.0.2", + "_inBundle": false, + "_integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "_location": "/npm-run-path", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "npm-run-path@^2.0.0", + "name": "npm-run-path", + "escapedName": "npm-run-path", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/execa" + ], + "_resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "_shasum": "35a9232dfa35d7067b4cb2ddf2357b1871536c5f", + "_spec": "npm-run-path@^2.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/execa", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/npm-run-path/issues" + }, + "bundleDependencies": false, + "dependencies": { + "path-key": "^2.0.0" + }, + "deprecated": false, + "description": "Get your PATH prepended with locally installed binaries", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/npm-run-path#readme", + "keywords": [ + "npm", + "run", + "path", + "package", + "bin", + "binary", + "binaries", + "script", + "cli", + "command-line", + "execute", + "executable" + ], + "license": "MIT", + "name": "npm-run-path", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/npm-run-path.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "2.0.2", + "xo": { + "esnext": true + } +} diff --git a/node_modules/npm-run-path/readme.md b/node_modules/npm-run-path/readme.md new file mode 100644 index 0000000..4ff4722 --- /dev/null +++ b/node_modules/npm-run-path/readme.md @@ -0,0 +1,81 @@ +# npm-run-path [![Build Status](https://travis-ci.org/sindresorhus/npm-run-path.svg?branch=master)](https://travis-ci.org/sindresorhus/npm-run-path) + +> Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries + +In [npm run scripts](https://docs.npmjs.com/cli/run-script) you can execute locally installed binaries by name. This enables the same outside npm. + + +## Install + +``` +$ npm install --save npm-run-path +``` + + +## Usage + +```js +const childProcess = require('child_process'); +const npmRunPath = require('npm-run-path'); + +console.log(process.env.PATH); +//=> '/usr/local/bin' + +console.log(npmRunPath()); +//=> '/Users/sindresorhus/dev/foo/node_modules/.bin:/Users/sindresorhus/dev/node_modules/.bin:/Users/sindresorhus/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/usr/local/bin' + +// `foo` is a locally installed binary +childProcess.execFileSync('foo', { + env: npmRunPath.env() +}); +``` + + +## API + +### npmRunPath([options]) + +#### options + +##### cwd + +Type: `string`
+Default: `process.cwd()` + +Working directory. + +##### path + +Type: `string`
+Default: [`PATH`](https://github.com/sindresorhus/path-key) + +PATH to be appended.
+Set it to an empty string to exclude the default PATH. + +### npmRunPath.env([options]) + +#### options + +##### cwd + +Type: `string`
+Default: `process.cwd()` + +Working directory. + +##### env + +Type: `Object` + +Accepts an object of environment variables, like `process.env`, and modifies the PATH using the correct [PATH key](https://github.com/sindresorhus/path-key). Use this if you're modifying the PATH for use in the `child_process` options. + + +## Related + +- [npm-run-path-cli](https://github.com/sindresorhus/npm-run-path-cli) - CLI for this module +- [execa](https://github.com/sindresorhus/execa) - Execute a locally installed binary + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/object-assign/index.js b/node_modules/object-assign/index.js new file mode 100644 index 0000000..0930cf8 --- /dev/null +++ b/node_modules/object-assign/index.js @@ -0,0 +1,90 @@ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + +'use strict'; +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; diff --git a/node_modules/object-assign/license b/node_modules/object-assign/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/object-assign/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/object-assign/package.json b/node_modules/object-assign/package.json new file mode 100644 index 0000000..4d2a1a4 --- /dev/null +++ b/node_modules/object-assign/package.json @@ -0,0 +1,75 @@ +{ + "_from": "object-assign@^4.0.1", + "_id": "object-assign@4.1.1", + "_inBundle": false, + "_integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "_location": "/object-assign", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "object-assign@^4.0.1", + "name": "object-assign", + "escapedName": "object-assign", + "rawSpec": "^4.0.1", + "saveSpec": null, + "fetchSpec": "^4.0.1" + }, + "_requiredBy": [ + "/is-expression", + "/pug-load" + ], + "_resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "_shasum": "2109adc7965887cfc05cbbd442cac8bfbb360863", + "_spec": "object-assign@^4.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/is-expression", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/object-assign/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "ES2015 `Object.assign()` ponyfill", + "devDependencies": { + "ava": "^0.16.0", + "lodash": "^4.16.4", + "matcha": "^0.7.0", + "xo": "^0.16.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/object-assign#readme", + "keywords": [ + "object", + "assign", + "extend", + "properties", + "es2015", + "ecmascript", + "harmony", + "ponyfill", + "prollyfill", + "polyfill", + "shim", + "browser" + ], + "license": "MIT", + "name": "object-assign", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/object-assign.git" + }, + "scripts": { + "bench": "matcha bench.js", + "test": "xo && ava" + }, + "version": "4.1.1" +} diff --git a/node_modules/object-assign/readme.md b/node_modules/object-assign/readme.md new file mode 100644 index 0000000..1be09d3 --- /dev/null +++ b/node_modules/object-assign/readme.md @@ -0,0 +1,61 @@ +# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) + +> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com) + + +## Use the built-in + +Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari), +support `Object.assign()` :tada:. If you target only those environments, then by all +means, use `Object.assign()` instead of this package. + + +## Install + +``` +$ npm install --save object-assign +``` + + +## Usage + +```js +const objectAssign = require('object-assign'); + +objectAssign({foo: 0}, {bar: 1}); +//=> {foo: 0, bar: 1} + +// multiple sources +objectAssign({foo: 0}, {bar: 1}, {baz: 2}); +//=> {foo: 0, bar: 1, baz: 2} + +// overwrites equal keys +objectAssign({foo: 0}, {foo: 1}, {foo: 2}); +//=> {foo: 2} + +// ignores null and undefined sources +objectAssign({foo: 0}, null, {bar: 1}, undefined); +//=> {foo: 0, bar: 1} +``` + + +## API + +### objectAssign(target, [source, ...]) + +Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones. + + +## Resources + +- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign) + + +## Related + +- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/object-copy/LICENSE b/node_modules/object-copy/LICENSE new file mode 100644 index 0000000..e28e603 --- /dev/null +++ b/node_modules/object-copy/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016, 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/node_modules/object-copy/index.js b/node_modules/object-copy/index.js new file mode 100644 index 0000000..f9faa22 --- /dev/null +++ b/node_modules/object-copy/index.js @@ -0,0 +1,174 @@ +'use strict'; + +var typeOf = require('kind-of'); +var copyDescriptor = require('copy-descriptor'); +var define = require('define-property'); + +/** + * Copy static properties, prototype properties, and descriptors from one object to another. + * + * ```js + * function App() {} + * var proto = App.prototype; + * App.prototype.set = function() {}; + * App.prototype.get = function() {}; + * + * var obj = {}; + * copy(obj, proto); + * ``` + * @param {Object} `receiver` + * @param {Object} `provider` + * @param {String|Array} `omit` One or more properties to omit + * @return {Object} + * @api public + */ + +function copy(receiver, provider, omit) { + if (!isObject(receiver)) { + throw new TypeError('expected receiving object to be an object.'); + } + if (!isObject(provider)) { + throw new TypeError('expected providing object to be an object.'); + } + + var props = nativeKeys(provider); + var keys = Object.keys(provider); + var len = props.length; + omit = arrayify(omit); + + while (len--) { + var key = props[len]; + + if (has(keys, key)) { + define(receiver, key, provider[key]); + } else if (!(key in receiver) && !has(omit, key)) { + copyDescriptor(receiver, provider, key); + } + } +}; + +/** + * Return true if the given value is an object or function + */ + +function isObject(val) { + return typeOf(val) === 'object' || typeof val === 'function'; +} + +/** + * Returns true if an array has any of the given elements, or an + * object has any of the give keys. + * + * ```js + * has(['a', 'b', 'c'], 'c'); + * //=> true + * + * has(['a', 'b', 'c'], ['c', 'z']); + * //=> true + * + * has({a: 'b', c: 'd'}, ['c', 'z']); + * //=> true + * ``` + * @param {Object} `obj` + * @param {String|Array} `val` + * @return {Boolean} + */ + +function has(obj, val) { + val = arrayify(val); + var len = val.length; + + if (isObject(obj)) { + for (var key in obj) { + if (val.indexOf(key) > -1) { + return true; + } + } + + var keys = nativeKeys(obj); + return has(keys, val); + } + + if (Array.isArray(obj)) { + var arr = obj; + while (len--) { + if (arr.indexOf(val[len]) > -1) { + return true; + } + } + return false; + } + + throw new TypeError('expected an array or object.'); +} + +/** + * Cast the given value to an array. + * + * ```js + * arrayify('foo'); + * //=> ['foo'] + * + * arrayify(['foo']); + * //=> ['foo'] + * ``` + * + * @param {String|Array} `val` + * @return {Array} + */ + +function arrayify(val) { + return val ? (Array.isArray(val) ? val : [val]) : []; +} + +/** + * Returns true if a value has a `contructor` + * + * ```js + * hasConstructor({}); + * //=> true + * + * hasConstructor(Object.create(null)); + * //=> false + * ``` + * @param {Object} `value` + * @return {Boolean} + */ + +function hasConstructor(val) { + return isObject(val) && typeof val.constructor !== 'undefined'; +} + +/** + * Get the native `ownPropertyNames` from the constructor of the + * given `object`. An empty array is returned if the object does + * not have a constructor. + * + * ```js + * nativeKeys({a: 'b', b: 'c', c: 'd'}) + * //=> ['a', 'b', 'c'] + * + * nativeKeys(function(){}) + * //=> ['length', 'caller'] + * ``` + * + * @param {Object} `obj` Object that has a `constructor`. + * @return {Array} Array of keys. + */ + +function nativeKeys(val) { + if (!hasConstructor(val)) return []; + return Object.getOwnPropertyNames(val); +} + +/** + * Expose `copy` + */ + +module.exports = copy; + +/** + * Expose `copy.has` for tests + */ + +module.exports.has = has; diff --git a/node_modules/object-copy/node_modules/define-property/LICENSE b/node_modules/object-copy/node_modules/define-property/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/node_modules/object-copy/node_modules/define-property/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 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/node_modules/object-copy/node_modules/define-property/README.md b/node_modules/object-copy/node_modules/define-property/README.md new file mode 100644 index 0000000..8cac698 --- /dev/null +++ b/node_modules/object-copy/node_modules/define-property/README.md @@ -0,0 +1,77 @@ +# define-property [![NPM version](https://badge.fury.io/js/define-property.svg)](http://badge.fury.io/js/define-property) + +> Define a non-enumerable property on an object. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i define-property --save +``` + +## Usage + +**Params** + +* `obj`: The object on which to define the property. +* `prop`: The name of the property to be defined or modified. +* `descriptor`: The descriptor for the property being defined or modified. + +```js +var define = require('define-property'); +var obj = {}; +define(obj, 'foo', function(val) { + return val.toUpperCase(); +}); + +console.log(obj); +//=> {} + +console.log(obj.foo('bar')); +//=> 'BAR' +``` + +**get/set** + +```js +define(obj, 'foo', { + get: function() {}, + set: function() {} +}); +``` + +## Related projects + +* [delegate-object](https://www.npmjs.com/package/delegate-object): Copy properties from an object to another object, where properties with function values will be… [more](https://www.npmjs.com/package/delegate-object) | [homepage](https://github.com/doowb/delegate-object) +* [forward-object](https://www.npmjs.com/package/forward-object): Copy properties from an object to another object, where properties with function values will be… [more](https://www.npmjs.com/package/forward-object) | [homepage](https://github.com/doowb/forward-object) +* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep) +* [mixin-object](https://www.npmjs.com/package/mixin-object): Mixin the own and inherited properties of other objects onto the first object. Pass an… [more](https://www.npmjs.com/package/mixin-object) | [homepage](https://github.com/jonschlinkert/mixin-object) + +## Running tests + +Install dev dependencies: + +```sh +$ 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/define-property/issues/new). + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 Jon Schlinkert +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 31, 2015._ diff --git a/node_modules/object-copy/node_modules/define-property/index.js b/node_modules/object-copy/node_modules/define-property/index.js new file mode 100644 index 0000000..3e0e5e1 --- /dev/null +++ b/node_modules/object-copy/node_modules/define-property/index.js @@ -0,0 +1,31 @@ +/*! + * define-property + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var isDescriptor = require('is-descriptor'); + +module.exports = function defineProperty(obj, prop, val) { + if (typeof obj !== 'object' && typeof obj !== 'function') { + throw new TypeError('expected an object or function.'); + } + + if (typeof prop !== 'string') { + throw new TypeError('expected `prop` to be a string.'); + } + + if (isDescriptor(val) && ('set' in val || 'get' in val)) { + return Object.defineProperty(obj, prop, val); + } + + return Object.defineProperty(obj, prop, { + configurable: true, + enumerable: false, + writable: true, + value: val + }); +}; diff --git a/node_modules/object-copy/node_modules/define-property/package.json b/node_modules/object-copy/node_modules/define-property/package.json new file mode 100644 index 0000000..abe8732 --- /dev/null +++ b/node_modules/object-copy/node_modules/define-property/package.json @@ -0,0 +1,82 @@ +{ + "_from": "define-property@^0.2.5", + "_id": "define-property@0.2.5", + "_inBundle": false, + "_integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "_location": "/object-copy/define-property", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "define-property@^0.2.5", + "name": "define-property", + "escapedName": "define-property", + "rawSpec": "^0.2.5", + "saveSpec": null, + "fetchSpec": "^0.2.5" + }, + "_requiredBy": [ + "/object-copy" + ], + "_resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "_shasum": "c35b1ef918ec3c990f9a5bc57be04aacec5c8116", + "_spec": "define-property@^0.2.5", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/object-copy", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/define-property/issues" + }, + "bundleDependencies": false, + "dependencies": { + "is-descriptor": "^0.1.0" + }, + "deprecated": false, + "description": "Define a non-enumerable property on an object.", + "devDependencies": { + "mocha": "*", + "should": "^7.0.4" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/define-property", + "keywords": [ + "define", + "define-property", + "enumerable", + "key", + "non", + "non-enumerable", + "object", + "prop", + "property", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "define-property", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/define-property.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "mixin-deep", + "mixin-object", + "delegate-object", + "forward-object" + ] + } + }, + "version": "0.2.5" +} diff --git a/node_modules/object-copy/node_modules/is-accessor-descriptor/LICENSE b/node_modules/object-copy/node_modules/is-accessor-descriptor/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/node_modules/object-copy/node_modules/is-accessor-descriptor/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 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/node_modules/object-copy/node_modules/is-accessor-descriptor/README.md b/node_modules/object-copy/node_modules/is-accessor-descriptor/README.md new file mode 100644 index 0000000..3743fe6 --- /dev/null +++ b/node_modules/object-copy/node_modules/is-accessor-descriptor/README.md @@ -0,0 +1,123 @@ +# is-accessor-descriptor [![NPM version](https://img.shields.io/npm/v/is-accessor-descriptor.svg)](https://www.npmjs.com/package/is-accessor-descriptor) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-accessor-descriptor.svg)](https://travis-ci.org/jonschlinkert/is-accessor-descriptor) + +> Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. + +- [Install](#install) +- [Usage](#usage) +- [Examples](#examples) +- [API](#api) +- [Related projects](#related-projects) +- [Running tests](#running-tests) +- [Contributing](#contributing) +- [Author](#author) +- [License](#license) + +_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm i is-accessor-descriptor --save +``` + +## Usage + +```js +var isAccessor = require('is-accessor-descriptor'); + +isAccessor({get: function() {}}); +//=> true +``` + +You may also pass an object and property name to check if the property is an accessor: + +```js +isAccessor(foo, 'bar'); +``` + +## Examples + +`false` when not an object + +```js +isAccessor('a') +isAccessor(null) +isAccessor([]) +//=> false +``` + +`true` when the object has valid properties + +and the properties all have the correct JavaScript types: + +```js +isAccessor({get: noop, set: noop}) +isAccessor({get: noop}) +isAccessor({set: noop}) +//=> true +``` + +`false` when the object has invalid properties + +```js +isAccessor({get: noop, set: noop, bar: 'baz'}) +isAccessor({get: noop, writable: true}) +isAccessor({get: noop, value: true}) +//=> false +``` + +`false` when an accessor is not a function + +```js +isAccessor({get: noop, set: 'baz'}) +isAccessor({get: 'foo', set: noop}) +isAccessor({get: 'foo', bar: 'baz'}) +isAccessor({get: 'foo', set: 'baz'}) +//=> false +``` + +`false` when a value is not the correct type + +```js +isAccessor({get: noop, set: noop, enumerable: 'foo'}) +isAccessor({set: noop, configurable: 'foo'}) +isAccessor({get: noop, configurable: 'foo'}) +//=> false +``` + +## Related projects + +* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor) +* [is-data-descriptor](https://www.npmjs.com/package/is-data-descriptor): Returns true if a value has the characteristics of a valid JavaScript data descriptor. | [homepage](https://github.com/jonschlinkert/is-data-descriptor) +* [is-descriptor](https://www.npmjs.com/package/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://www.npmjs.com/package/is-descriptor) | [homepage](https://github.com/jonschlinkert/is-descriptor) +* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject) + +## Running tests + +Install dev dependencies: + +```sh +$ 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-accessor-descriptor/issues/new). + +## Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert) +Released under the MIT license. + +*** + +_This file was generated by [verb](https://github.com/verbose/verb) on December 28, 2015._ \ No newline at end of file diff --git a/node_modules/object-copy/node_modules/is-accessor-descriptor/index.js b/node_modules/object-copy/node_modules/is-accessor-descriptor/index.js new file mode 100644 index 0000000..2ca4af8 --- /dev/null +++ b/node_modules/object-copy/node_modules/is-accessor-descriptor/index.js @@ -0,0 +1,69 @@ +/*! + * is-accessor-descriptor + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var typeOf = require('kind-of'); + +// accessor descriptor properties +var accessor = { + get: 'function', + set: 'function', + configurable: 'boolean', + enumerable: 'boolean' +}; + +function isAccessorDescriptor(obj, prop) { + if (typeof prop === 'string') { + var val = Object.getOwnPropertyDescriptor(obj, prop); + return typeof val !== 'undefined'; + } + + if (typeOf(obj) !== 'object') { + return false; + } + + if (has(obj, 'value') || has(obj, 'writable')) { + return false; + } + + if (!has(obj, 'get') || typeof obj.get !== 'function') { + return false; + } + + // tldr: it's valid to have "set" be undefined + // "set" might be undefined if `Object.getOwnPropertyDescriptor` + // was used to get the value, and only `get` was defined by the user + if (has(obj, 'set') && typeof obj[key] !== 'function' && typeof obj[key] !== 'undefined') { + return false; + } + + for (var key in obj) { + if (!accessor.hasOwnProperty(key)) { + continue; + } + + if (typeOf(obj[key]) === accessor[key]) { + continue; + } + + if (typeof obj[key] !== 'undefined') { + return false; + } + } + return true; +} + +function has(obj, key) { + return {}.hasOwnProperty.call(obj, key); +} + +/** + * Expose `isAccessorDescriptor` + */ + +module.exports = isAccessorDescriptor; diff --git a/node_modules/object-copy/node_modules/is-accessor-descriptor/package.json b/node_modules/object-copy/node_modules/is-accessor-descriptor/package.json new file mode 100644 index 0000000..8c2aa39 --- /dev/null +++ b/node_modules/object-copy/node_modules/is-accessor-descriptor/package.json @@ -0,0 +1,92 @@ +{ + "_from": "is-accessor-descriptor@^0.1.6", + "_id": "is-accessor-descriptor@0.1.6", + "_inBundle": false, + "_integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "_location": "/object-copy/is-accessor-descriptor", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-accessor-descriptor@^0.1.6", + "name": "is-accessor-descriptor", + "escapedName": "is-accessor-descriptor", + "rawSpec": "^0.1.6", + "saveSpec": null, + "fetchSpec": "^0.1.6" + }, + "_requiredBy": [ + "/object-copy/is-descriptor" + ], + "_resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "_shasum": "a9e12cb3ae8d876727eeef3843f8a0897b5c98d6", + "_spec": "is-accessor-descriptor@^0.1.6", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/object-copy/node_modules/is-descriptor", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-accessor-descriptor/issues" + }, + "bundleDependencies": false, + "dependencies": { + "kind-of": "^3.0.2" + }, + "deprecated": false, + "description": "Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/is-accessor-descriptor", + "keywords": [ + "accessor", + "check", + "data", + "descriptor", + "get", + "getter", + "is", + "keys", + "object", + "properties", + "property", + "set", + "setter", + "type", + "valid", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "is-accessor-descriptor", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/is-accessor-descriptor.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-accessor-descriptor", + "is-data-descriptor", + "is-descriptor", + "isobject" + ] + }, + "plugins": [ + "gulp-format-md" + ], + "layout": "default" + }, + "version": "0.1.6" +} diff --git a/node_modules/object-copy/node_modules/is-data-descriptor/LICENSE b/node_modules/object-copy/node_modules/is-data-descriptor/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/node_modules/object-copy/node_modules/is-data-descriptor/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 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/node_modules/object-copy/node_modules/is-data-descriptor/README.md b/node_modules/object-copy/node_modules/is-data-descriptor/README.md new file mode 100644 index 0000000..41e1643 --- /dev/null +++ b/node_modules/object-copy/node_modules/is-data-descriptor/README.md @@ -0,0 +1,128 @@ +# is-data-descriptor [![NPM version](https://img.shields.io/npm/v/is-data-descriptor.svg)](https://www.npmjs.com/package/is-data-descriptor) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-data-descriptor.svg)](https://travis-ci.org/jonschlinkert/is-data-descriptor) + +> Returns true if a value has the characteristics of a valid JavaScript data descriptor. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm i is-data-descriptor --save +``` + +## Usage + +```js +var isDataDesc = require('is-data-descriptor'); +``` + +## Examples + +`true` when the descriptor has valid properties with valid values. + +```js +// `value` can be anything +isDataDesc({value: 'foo'}) +isDataDesc({value: function() {}}) +isDataDesc({value: true}) +//=> true +``` + +`false` when not an object + +```js +isDataDesc('a') +//=> false +isDataDesc(null) +//=> false +isDataDesc([]) +//=> false +``` + +`false` when the object has invalid properties + +```js +isDataDesc({value: 'foo', bar: 'baz'}) +//=> false +isDataDesc({value: 'foo', bar: 'baz'}) +//=> false +isDataDesc({value: 'foo', get: function(){}}) +//=> false +isDataDesc({get: function(){}, value: 'foo'}) +//=> false +``` + +`false` when a value is not the correct type + +```js +isDataDesc({value: 'foo', enumerable: 'foo'}) +//=> false +isDataDesc({value: 'foo', configurable: 'foo'}) +//=> false +isDataDesc({value: 'foo', writable: 'foo'}) +//=> false +``` + +## Valid properties + +The only valid data descriptor properties are the following: + +* `configurable` (required) +* `enumerable` (required) +* `value` (optional) +* `writable` (optional) + +To be a valid data descriptor, either `value` or `writable` must be defined. + +**Invalid properties** + +A descriptor may have additional _invalid_ properties (an error will **not** be thrown). + +```js +var foo = {}; + +Object.defineProperty(foo, 'bar', { + enumerable: true, + whatever: 'blah', // invalid, but doesn't cause an error + get: function() { + return 'baz'; + } +}); + +console.log(foo.bar); +//=> 'baz' +``` + +## Related projects + +* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor) +* [is-descriptor](https://www.npmjs.com/package/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://www.npmjs.com/package/is-descriptor) | [homepage](https://github.com/jonschlinkert/is-descriptor) +* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject) + +## Running tests + +Install dev dependencies: + +```sh +$ 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-data-descriptor/issues/new). + +## Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert) +Released under the MIT license. + +*** + +_This file was generated by [verb](https://github.com/verbose/verb) on December 28, 2015._ \ No newline at end of file diff --git a/node_modules/object-copy/node_modules/is-data-descriptor/index.js b/node_modules/object-copy/node_modules/is-data-descriptor/index.js new file mode 100644 index 0000000..d4d09c9 --- /dev/null +++ b/node_modules/object-copy/node_modules/is-data-descriptor/index.js @@ -0,0 +1,55 @@ +/*! + * is-data-descriptor + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var typeOf = require('kind-of'); + +// data descriptor properties +var data = { + configurable: 'boolean', + enumerable: 'boolean', + writable: 'boolean' +}; + +function isDataDescriptor(obj, prop) { + if (typeOf(obj) !== 'object') { + return false; + } + + if (typeof prop === 'string') { + var val = Object.getOwnPropertyDescriptor(obj, prop); + return typeof val !== 'undefined'; + } + + if (!('value' in obj) && !('writable' in obj)) { + return false; + } + + for (var key in obj) { + if (key === 'value') continue; + + if (!data.hasOwnProperty(key)) { + continue; + } + + if (typeOf(obj[key]) === data[key]) { + continue; + } + + if (typeof obj[key] !== 'undefined') { + return false; + } + } + return true; +} + +/** + * Expose `isDataDescriptor` + */ + +module.exports = isDataDescriptor; diff --git a/node_modules/object-copy/node_modules/is-data-descriptor/package.json b/node_modules/object-copy/node_modules/is-data-descriptor/package.json new file mode 100644 index 0000000..7ad2973 --- /dev/null +++ b/node_modules/object-copy/node_modules/is-data-descriptor/package.json @@ -0,0 +1,91 @@ +{ + "_from": "is-data-descriptor@^0.1.4", + "_id": "is-data-descriptor@0.1.4", + "_inBundle": false, + "_integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "_location": "/object-copy/is-data-descriptor", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-data-descriptor@^0.1.4", + "name": "is-data-descriptor", + "escapedName": "is-data-descriptor", + "rawSpec": "^0.1.4", + "saveSpec": null, + "fetchSpec": "^0.1.4" + }, + "_requiredBy": [ + "/object-copy/is-descriptor" + ], + "_resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "_shasum": "0b5ee648388e2c860282e793f1856fec3f301b56", + "_spec": "is-data-descriptor@^0.1.4", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/object-copy/node_modules/is-descriptor", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-data-descriptor/issues" + }, + "bundleDependencies": false, + "dependencies": { + "kind-of": "^3.0.2" + }, + "deprecated": false, + "description": "Returns true if a value has the characteristics of a valid JavaScript data descriptor.", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/is-data-descriptor", + "keywords": [ + "accessor", + "check", + "data", + "descriptor", + "get", + "getter", + "is", + "keys", + "object", + "properties", + "property", + "set", + "setter", + "type", + "valid", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "is-data-descriptor", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/is-data-descriptor.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-accessor-descriptor", + "is-data-descriptor", + "is-descriptor", + "isobject" + ] + }, + "plugins": [ + "gulp-format-md" + ] + }, + "version": "0.1.4" +} diff --git a/node_modules/object-copy/node_modules/is-descriptor/LICENSE b/node_modules/object-copy/node_modules/is-descriptor/LICENSE new file mode 100644 index 0000000..c0d7f13 --- /dev/null +++ b/node_modules/object-copy/node_modules/is-descriptor/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-2017, 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. \ No newline at end of file diff --git a/node_modules/object-copy/node_modules/is-descriptor/README.md b/node_modules/object-copy/node_modules/is-descriptor/README.md new file mode 100644 index 0000000..658e533 --- /dev/null +++ b/node_modules/object-copy/node_modules/is-descriptor/README.md @@ -0,0 +1,193 @@ +# is-descriptor [![NPM version](https://img.shields.io/npm/v/is-descriptor.svg?style=flat)](https://www.npmjs.com/package/is-descriptor) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-descriptor.svg?style=flat)](https://npmjs.org/package/is-descriptor) [![NPM total downloads](https://img.shields.io/npm/dt/is-descriptor.svg?style=flat)](https://npmjs.org/package/is-descriptor) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-descriptor.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-descriptor) + +> Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-descriptor +``` + +## Usage + +```js +var isDescriptor = require('is-descriptor'); + +isDescriptor({value: 'foo'}) +//=> true +isDescriptor({get: function(){}, set: function(){}}) +//=> true +isDescriptor({get: 'foo', set: function(){}}) +//=> false +``` + +You may also check for a descriptor by passing an object as the first argument and property name (`string`) as the second argument. + +```js +var obj = {}; +obj.foo = 'abc'; + +Object.defineProperty(obj, 'bar', { + value: 'xyz' +}); + +isDescriptor(obj, 'foo'); +//=> true +isDescriptor(obj, 'bar'); +//=> true +``` + +## Examples + +### value type + +`false` when not an object + +```js +isDescriptor('a'); +//=> false +isDescriptor(null); +//=> false +isDescriptor([]); +//=> false +``` + +### data descriptor + +`true` when the object has valid properties with valid values. + +```js +isDescriptor({value: 'foo'}); +//=> true +isDescriptor({value: noop}); +//=> true +``` + +`false` when the object has invalid properties + +```js +isDescriptor({value: 'foo', bar: 'baz'}); +//=> false +isDescriptor({value: 'foo', bar: 'baz'}); +//=> false +isDescriptor({value: 'foo', get: noop}); +//=> false +isDescriptor({get: noop, value: noop}); +//=> false +``` + +`false` when a value is not the correct type + +```js +isDescriptor({value: 'foo', enumerable: 'foo'}); +//=> false +isDescriptor({value: 'foo', configurable: 'foo'}); +//=> false +isDescriptor({value: 'foo', writable: 'foo'}); +//=> false +``` + +### accessor descriptor + +`true` when the object has valid properties with valid values. + +```js +isDescriptor({get: noop, set: noop}); +//=> true +isDescriptor({get: noop}); +//=> true +isDescriptor({set: noop}); +//=> true +``` + +`false` when the object has invalid properties + +```js +isDescriptor({get: noop, set: noop, bar: 'baz'}); +//=> false +isDescriptor({get: noop, writable: true}); +//=> false +isDescriptor({get: noop, value: true}); +//=> false +``` + +`false` when an accessor is not a function + +```js +isDescriptor({get: noop, set: 'baz'}); +//=> false +isDescriptor({get: 'foo', set: noop}); +//=> false +isDescriptor({get: 'foo', bar: 'baz'}); +//=> false +isDescriptor({get: 'foo', set: 'baz'}); +//=> false +``` + +`false` when a value is not the correct type + +```js +isDescriptor({get: noop, set: noop, enumerable: 'foo'}); +//=> false +isDescriptor({set: noop, configurable: 'foo'}); +//=> false +isDescriptor({get: noop, configurable: 'foo'}); +//=> false +``` + +## About + +### Related projects + +* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor "Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.") +* [is-data-descriptor](https://www.npmjs.com/package/is-data-descriptor): Returns true if a value has the characteristics of a valid JavaScript data descriptor. | [homepage](https://github.com/jonschlinkert/is-data-descriptor "Returns true if a value has the characteristics of a valid JavaScript data descriptor.") +* [is-descriptor](https://www.npmjs.com/package/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://github.com/jonschlinkert/is-descriptor) | [homepage](https://github.com/jonschlinkert/is-descriptor "Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.") +* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 24 | [jonschlinkert](https://github.com/jonschlinkert) | +| 1 | [doowb](https://github.com/doowb) | +| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 22, 2017._ \ No newline at end of file diff --git a/node_modules/object-copy/node_modules/is-descriptor/index.js b/node_modules/object-copy/node_modules/is-descriptor/index.js new file mode 100644 index 0000000..c9b91d7 --- /dev/null +++ b/node_modules/object-copy/node_modules/is-descriptor/index.js @@ -0,0 +1,22 @@ +/*! + * is-descriptor + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var typeOf = require('kind-of'); +var isAccessor = require('is-accessor-descriptor'); +var isData = require('is-data-descriptor'); + +module.exports = function isDescriptor(obj, key) { + if (typeOf(obj) !== 'object') { + return false; + } + if ('get' in obj) { + return isAccessor(obj, key); + } + return isData(obj, key); +}; diff --git a/node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/LICENSE b/node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/LICENSE new file mode 100644 index 0000000..3f2eca1 --- /dev/null +++ b/node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, 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/node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/README.md b/node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/README.md new file mode 100644 index 0000000..170bf30 --- /dev/null +++ b/node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/README.md @@ -0,0 +1,342 @@ +# kind-of [![NPM version](https://img.shields.io/npm/v/kind-of.svg?style=flat)](https://www.npmjs.com/package/kind-of) [![NPM monthly downloads](https://img.shields.io/npm/dm/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![NPM total downloads](https://img.shields.io/npm/dt/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/kind-of.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/kind-of) + +> Get the native type of a value. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save kind-of +``` + +Install with [bower](https://bower.io/) + +```sh +$ bower install kind-of --save +``` + +## Why use this? + +1. [it's fast](#benchmarks) | [optimizations](#optimizations) +2. [better type checking](#better-type-checking) + +## Usage + +> es5, browser and es6 ready + +```js +var kindOf = require('kind-of'); + +kindOf(undefined); +//=> 'undefined' + +kindOf(null); +//=> 'null' + +kindOf(true); +//=> 'boolean' + +kindOf(false); +//=> 'boolean' + +kindOf(new Boolean(true)); +//=> 'boolean' + +kindOf(new Buffer('')); +//=> 'buffer' + +kindOf(42); +//=> 'number' + +kindOf(new Number(42)); +//=> 'number' + +kindOf('str'); +//=> 'string' + +kindOf(new String('str')); +//=> 'string' + +kindOf(arguments); +//=> 'arguments' + +kindOf({}); +//=> 'object' + +kindOf(Object.create(null)); +//=> 'object' + +kindOf(new Test()); +//=> 'object' + +kindOf(new Date()); +//=> 'date' + +kindOf([]); +//=> 'array' + +kindOf([1, 2, 3]); +//=> 'array' + +kindOf(new Array()); +//=> 'array' + +kindOf(/foo/); +//=> 'regexp' + +kindOf(new RegExp('foo')); +//=> 'regexp' + +kindOf(function () {}); +//=> 'function' + +kindOf(function * () {}); +//=> 'function' + +kindOf(new Function()); +//=> 'function' + +kindOf(new Map()); +//=> 'map' + +kindOf(new WeakMap()); +//=> 'weakmap' + +kindOf(new Set()); +//=> 'set' + +kindOf(new WeakSet()); +//=> 'weakset' + +kindOf(Symbol('str')); +//=> 'symbol' + +kindOf(new Int8Array()); +//=> 'int8array' + +kindOf(new Uint8Array()); +//=> 'uint8array' + +kindOf(new Uint8ClampedArray()); +//=> 'uint8clampedarray' + +kindOf(new Int16Array()); +//=> 'int16array' + +kindOf(new Uint16Array()); +//=> 'uint16array' + +kindOf(new Int32Array()); +//=> 'int32array' + +kindOf(new Uint32Array()); +//=> 'uint32array' + +kindOf(new Float32Array()); +//=> 'float32array' + +kindOf(new Float64Array()); +//=> 'float64array' +``` + +## Release history + +### v4.0.0 + +**Added** + +* `promise` support + +### v5.0.0 + +**Added** + +* `Set Iterator` and `Map Iterator` support + +**Fixed** + +* Now returns `generatorfunction` for generator functions + +## Benchmarks + +Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of). +Note that performaces is slower for es6 features `Map`, `WeakMap`, `Set` and `WeakSet`. + +```bash +#1: array + current x 23,329,397 ops/sec ±0.82% (94 runs sampled) + lib-type-of x 4,170,273 ops/sec ±0.55% (94 runs sampled) + lib-typeof x 9,686,935 ops/sec ±0.59% (98 runs sampled) + +#2: boolean + current x 27,197,115 ops/sec ±0.85% (94 runs sampled) + lib-type-of x 3,145,791 ops/sec ±0.73% (97 runs sampled) + lib-typeof x 9,199,562 ops/sec ±0.44% (99 runs sampled) + +#3: date + current x 20,190,117 ops/sec ±0.86% (92 runs sampled) + lib-type-of x 5,166,970 ops/sec ±0.74% (94 runs sampled) + lib-typeof x 9,610,821 ops/sec ±0.50% (96 runs sampled) + +#4: function + current x 23,855,460 ops/sec ±0.60% (97 runs sampled) + lib-type-of x 5,667,740 ops/sec ±0.54% (100 runs sampled) + lib-typeof x 10,010,644 ops/sec ±0.44% (100 runs sampled) + +#5: null + current x 27,061,047 ops/sec ±0.97% (96 runs sampled) + lib-type-of x 13,965,573 ops/sec ±0.62% (97 runs sampled) + lib-typeof x 8,460,194 ops/sec ±0.61% (97 runs sampled) + +#6: number + current x 25,075,682 ops/sec ±0.53% (99 runs sampled) + lib-type-of x 2,266,405 ops/sec ±0.41% (98 runs sampled) + lib-typeof x 9,821,481 ops/sec ±0.45% (99 runs sampled) + +#7: object + current x 3,348,980 ops/sec ±0.49% (99 runs sampled) + lib-type-of x 3,245,138 ops/sec ±0.60% (94 runs sampled) + lib-typeof x 9,262,952 ops/sec ±0.59% (99 runs sampled) + +#8: regex + current x 21,284,827 ops/sec ±0.72% (96 runs sampled) + lib-type-of x 4,689,241 ops/sec ±0.43% (100 runs sampled) + lib-typeof x 8,957,593 ops/sec ±0.62% (98 runs sampled) + +#9: string + current x 25,379,234 ops/sec ±0.58% (96 runs sampled) + lib-type-of x 3,635,148 ops/sec ±0.76% (93 runs sampled) + lib-typeof x 9,494,134 ops/sec ±0.49% (98 runs sampled) + +#10: undef + current x 27,459,221 ops/sec ±1.01% (93 runs sampled) + lib-type-of x 14,360,433 ops/sec ±0.52% (99 runs sampled) + lib-typeof x 23,202,868 ops/sec ±0.59% (94 runs sampled) + +``` + +## Optimizations + +In 7 out of 8 cases, this library is 2x-10x faster than other top libraries included in the benchmarks. There are a few things that lead to this performance advantage, none of them hard and fast rules, but all of them simple and repeatable in almost any code library: + +1. Optimize around the fastest and most common use cases first. Of course, this will change from project-to-project, but I took some time to understand how and why `typeof` checks were being used in my own libraries and other libraries I use a lot. +2. Optimize around bottlenecks - In other words, the order in which conditionals are implemented is significant, because each check is only as fast as the failing checks that came before it. Here, the biggest bottleneck by far is checking for plain objects (an object that was created by the `Object` constructor). I opted to make this check happen by process of elimination rather than brute force up front (e.g. by using something like `val.constructor.name`), so that every other type check would not be penalized it. +3. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'` +4. There is no reason to make the code in a microlib as terse as possible, just to win points for making it shorter. It's always better to favor performant code over terse code. You will always only be using a single `require()` statement to use the library anyway, regardless of how the code is written. + +## Better type checking + +kind-of is more correct than other type checking libs I've looked at. For example, here are some differing results from other popular libs: + +### [typeof](https://github.com/CodingFu/typeof) lib + +Incorrectly tests instances of custom constructors (pretty common): + +```js +var typeOf = require('typeof'); +function Test() {} +console.log(typeOf(new Test())); +//=> 'test' +``` + +Returns `object` instead of `arguments`: + +```js +function foo() { + console.log(typeOf(arguments)) //=> 'object' +} +foo(); +``` + +### [type-of](https://github.com/ForbesLindesay/type-of) lib + +Incorrectly returns `object` for generator functions, buffers, `Map`, `Set`, `WeakMap` and `WeakSet`: + +```js +function * foo() {} +console.log(typeOf(foo)); +//=> 'object' +console.log(typeOf(new Buffer(''))); +//=> 'object' +console.log(typeOf(new Map())); +//=> 'object' +console.log(typeOf(new Set())); +//=> 'object' +console.log(typeOf(new WeakMap())); +//=> 'object' +console.log(typeOf(new WeakSet())); +//=> 'object' +``` + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Related projects + +You might also be interested in these projects: + +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number "Returns true if the value is a number. comprehensive tests.") +* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 82 | [jonschlinkert](https://github.com/jonschlinkert) | +| 3 | [aretecode](https://github.com/aretecode) | +| 2 | [miguelmota](https://github.com/miguelmota) | +| 1 | [dtothefp](https://github.com/dtothefp) | +| 1 | [ksheedlo](https://github.com/ksheedlo) | +| 1 | [pdehaan](https://github.com/pdehaan) | +| 1 | [laggingreflex](https://github.com/laggingreflex) | +| 1 | [charlike](https://github.com/charlike) | + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on October 13, 2017._ \ No newline at end of file diff --git a/node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/index.js b/node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/index.js new file mode 100644 index 0000000..fc5cde9 --- /dev/null +++ b/node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/index.js @@ -0,0 +1,147 @@ +var toString = Object.prototype.toString; + +/** + * Get the native `typeof` a value. + * + * @param {*} `val` + * @return {*} Native javascript type + */ + +module.exports = function kindOf(val) { + var type = typeof val; + + // primitivies + if (type === 'undefined') { + return 'undefined'; + } + if (val === null) { + return 'null'; + } + if (val === true || val === false || val instanceof Boolean) { + return 'boolean'; + } + if (type === 'string' || val instanceof String) { + return 'string'; + } + if (type === 'number' || val instanceof Number) { + return 'number'; + } + + // functions + if (type === 'function' || val instanceof Function) { + if (typeof val.constructor.name !== 'undefined' && val.constructor.name.slice(0, 9) === 'Generator') { + return 'generatorfunction'; + } + return 'function'; + } + + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; + } + + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } + + // other objects + type = toString.call(val); + + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + if (type === '[object Error]') { + return 'error'; + } + if (type === '[object Promise]') { + return 'promise'; + } + + // buffer + if (isBuffer(val)) { + return 'buffer'; + } + + // es6: Map, WeakMap, Set, WeakSet + if (type === '[object Set]') { + return 'set'; + } + if (type === '[object WeakSet]') { + return 'weakset'; + } + if (type === '[object Map]') { + return 'map'; + } + if (type === '[object WeakMap]') { + return 'weakmap'; + } + if (type === '[object Symbol]') { + return 'symbol'; + } + + if (type === '[object Map Iterator]') { + return 'mapiterator'; + } + if (type === '[object Set Iterator]') { + return 'setiterator'; + } + if (type === '[object String Iterator]') { + return 'stringiterator'; + } + if (type === '[object Array Iterator]') { + return 'arrayiterator'; + } + + // typed arrays + if (type === '[object Int8Array]') { + return 'int8array'; + } + if (type === '[object Uint8Array]') { + return 'uint8array'; + } + if (type === '[object Uint8ClampedArray]') { + return 'uint8clampedarray'; + } + if (type === '[object Int16Array]') { + return 'int16array'; + } + if (type === '[object Uint16Array]') { + return 'uint16array'; + } + if (type === '[object Int32Array]') { + return 'int32array'; + } + if (type === '[object Uint32Array]') { + return 'uint32array'; + } + if (type === '[object Float32Array]') { + return 'float32array'; + } + if (type === '[object Float64Array]') { + return 'float64array'; + } + + // must be a plain object + return 'object'; +}; + +/** + * If you need to support Safari 5-7 (8-10 yr-old browser), + * take a look at https://github.com/feross/is-buffer + */ + +function isBuffer(val) { + return val.constructor + && typeof val.constructor.isBuffer === 'function' + && val.constructor.isBuffer(val); +} diff --git a/node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/package.json b/node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/package.json new file mode 100644 index 0000000..294dc18 --- /dev/null +++ b/node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of/package.json @@ -0,0 +1,146 @@ +{ + "_from": "kind-of@^5.0.0", + "_id": "kind-of@5.1.0", + "_inBundle": false, + "_integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "_location": "/object-copy/is-descriptor/kind-of", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "kind-of@^5.0.0", + "name": "kind-of", + "escapedName": "kind-of", + "rawSpec": "^5.0.0", + "saveSpec": null, + "fetchSpec": "^5.0.0" + }, + "_requiredBy": [ + "/object-copy/is-descriptor" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "_shasum": "729c91e2d857b7a419a1f9aa65685c4c33f5845d", + "_spec": "kind-of@^5.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/object-copy/node_modules/is-descriptor", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/kind-of/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "David Fox-Powell", + "url": "https://dtothefp.github.io/me" + }, + { + "name": "James", + "url": "https://twitter.com/aretecode" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Ken Sheedlo", + "url": "kensheedlo.com" + }, + { + "name": "laggingreflex", + "url": "https://github.com/laggingreflex" + }, + { + "name": "Miguel Mota", + "url": "https://miguelmota.com" + }, + { + "name": "Peter deHaan", + "url": "http://about.me/peterdehaan" + }, + { + "name": "tunnckoCore", + "url": "https://i.am.charlike.online" + } + ], + "deprecated": false, + "description": "Get the native type of a value.", + "devDependencies": { + "ansi-bold": "^0.1.1", + "benchmarked": "^1.1.1", + "browserify": "^14.4.0", + "gulp-format-md": "^0.1.12", + "matched": "^0.4.4", + "mocha": "^3.4.2", + "type-of": "^2.0.1", + "typeof": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/kind-of", + "keywords": [ + "arguments", + "array", + "boolean", + "check", + "date", + "function", + "is", + "is-type", + "is-type-of", + "kind", + "kind-of", + "number", + "object", + "of", + "regexp", + "string", + "test", + "type", + "type-of", + "typeof", + "types" + ], + "license": "MIT", + "main": "index.js", + "name": "kind-of", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/kind-of.git" + }, + "scripts": { + "prepublish": "browserify -o browser.js -e index.js -s index --bare", + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-glob", + "is-number", + "is-primitive" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "type-of", + "typeof", + "verb" + ] + }, + "version": "5.1.0" +} diff --git a/node_modules/object-copy/node_modules/is-descriptor/package.json b/node_modules/object-copy/node_modules/is-descriptor/package.json new file mode 100644 index 0000000..17f87c6 --- /dev/null +++ b/node_modules/object-copy/node_modules/is-descriptor/package.json @@ -0,0 +1,114 @@ +{ + "_from": "is-descriptor@^0.1.0", + "_id": "is-descriptor@0.1.6", + "_inBundle": false, + "_integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "_location": "/object-copy/is-descriptor", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-descriptor@^0.1.0", + "name": "is-descriptor", + "escapedName": "is-descriptor", + "rawSpec": "^0.1.0", + "saveSpec": null, + "fetchSpec": "^0.1.0" + }, + "_requiredBy": [ + "/object-copy/define-property" + ], + "_resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "_shasum": "366d8240dde487ca51823b1ab9f07a10a78251ca", + "_spec": "is-descriptor@^0.1.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/object-copy/node_modules/define-property", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-descriptor/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Brian Woodward", + "url": "https://twitter.com/doowb" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "url": "https://github.com/wtgtybhertgeghgtwtg" + } + ], + "dependencies": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "deprecated": false, + "description": "Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.", + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.4.2" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/is-descriptor", + "keywords": [ + "accessor", + "check", + "data", + "descriptor", + "get", + "getter", + "is", + "keys", + "object", + "properties", + "property", + "set", + "setter", + "type", + "valid", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "is-descriptor", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/is-descriptor.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-accessor-descriptor", + "is-data-descriptor", + "is-descriptor", + "isobject" + ] + }, + "plugins": [ + "gulp-format-md" + ], + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "lint": { + "reflinks": true + } + }, + "version": "0.1.6" +} diff --git a/node_modules/object-copy/package.json b/node_modules/object-copy/package.json new file mode 100644 index 0000000..4ef9afc --- /dev/null +++ b/node_modules/object-copy/package.json @@ -0,0 +1,80 @@ +{ + "_from": "object-copy@^0.1.0", + "_id": "object-copy@0.1.0", + "_inBundle": false, + "_integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "_location": "/object-copy", + "_phantomChildren": { + "kind-of": "3.2.2" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "object-copy@^0.1.0", + "name": "object-copy", + "escapedName": "object-copy", + "rawSpec": "^0.1.0", + "saveSpec": null, + "fetchSpec": "^0.1.0" + }, + "_requiredBy": [ + "/static-extend" + ], + "_resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "_shasum": "7e7d858b781bd7c991a41ba975ed3812754e998c", + "_spec": "object-copy@^0.1.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/static-extend", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/object-copy/issues" + }, + "bundleDependencies": false, + "dependencies": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "deprecated": false, + "description": "Copy static properties, prototype properties, and descriptors from one object to another.", + "devDependencies": { + "gulp-format-md": "*", + "mocha": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/object-copy", + "keywords": [ + "copy", + "object" + ], + "license": "MIT", + "main": "index.js", + "name": "object-copy", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/object-copy.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "layout": "default", + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [] + }, + "reflinks": [ + "verb" + ] + }, + "version": "0.1.0" +} diff --git a/node_modules/object-visit/LICENSE b/node_modules/object-visit/LICENSE new file mode 100644 index 0000000..ec85897 --- /dev/null +++ b/node_modules/object-visit/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 2017, 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/node_modules/object-visit/README.md b/node_modules/object-visit/README.md new file mode 100644 index 0000000..64015cb --- /dev/null +++ b/node_modules/object-visit/README.md @@ -0,0 +1,83 @@ +# object-visit [![NPM version](https://img.shields.io/npm/v/object-visit.svg?style=flat)](https://www.npmjs.com/package/object-visit) [![NPM monthly downloads](https://img.shields.io/npm/dm/object-visit.svg?style=flat)](https://npmjs.org/package/object-visit) [![NPM total downloads](https://img.shields.io/npm/dt/object-visit.svg?style=flat)](https://npmjs.org/package/object-visit) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/object-visit.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/object-visit) + +> Call a specified method on each value in the given object. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save object-visit +``` + +## Usage + +```js +var visit = require('object-visit'); + +var ctx = { + data: {}, + set: function (key, value) { + if (typeof key === 'object') { + visit(ctx, 'set', key); + } else { + ctx.data[key] = value; + } + } +}; + +ctx.set('a', 'a'); +ctx.set('b', 'b'); +ctx.set('c', 'c'); +ctx.set({d: {e: 'f'}}); + +console.log(ctx.data); +//=> {a: 'a', b: 'b', c: 'c', d: { e: 'f' }}; +``` + +## About + +### Related projects + +* [base-methods](https://www.npmjs.com/package/base-methods): base-methods is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… [more](https://github.com/jonschlinkert/base-methods) | [homepage](https://github.com/jonschlinkert/base-methods "base-methods is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting with a handful of common methods, like `set`, `get`, `del` and `use`.") +* [collection-visit](https://www.npmjs.com/package/collection-visit): Visit a method over the items in an object, or map visit over the objects… [more](https://github.com/jonschlinkert/collection-visit) | [homepage](https://github.com/jonschlinkert/collection-visit "Visit a method over the items in an object, or map visit over the objects in an array.") +* [define-property](https://www.npmjs.com/package/define-property): Define a non-enumerable property on an object. | [homepage](https://github.com/jonschlinkert/define-property "Define a non-enumerable property on an object.") +* [map-visit](https://www.npmjs.com/package/map-visit): Map `visit` over an array of objects. | [homepage](https://github.com/jonschlinkert/map-visit "Map `visit` over an array of objects.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 30, 2017._ \ No newline at end of file diff --git a/node_modules/object-visit/index.js b/node_modules/object-visit/index.js new file mode 100644 index 0000000..fcaeda9 --- /dev/null +++ b/node_modules/object-visit/index.js @@ -0,0 +1,33 @@ +/*! + * object-visit + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var isObject = require('isobject'); + +module.exports = function visit(thisArg, method, target, val) { + if (!isObject(thisArg) && typeof thisArg !== 'function') { + throw new Error('object-visit expects `thisArg` to be an object.'); + } + + if (typeof method !== 'string') { + throw new Error('object-visit expects `method` name to be a string'); + } + + if (typeof thisArg[method] !== 'function') { + return thisArg; + } + + var args = [].slice.call(arguments, 3); + target = target || {}; + + for (var key in target) { + var arr = [key, target[key]].concat(args); + thisArg[method].apply(thisArg, arr); + } + return thisArg; +}; diff --git a/node_modules/object-visit/package.json b/node_modules/object-visit/package.json new file mode 100644 index 0000000..6ceb8bd --- /dev/null +++ b/node_modules/object-visit/package.json @@ -0,0 +1,97 @@ +{ + "_from": "object-visit@^1.0.0", + "_id": "object-visit@1.0.1", + "_inBundle": false, + "_integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "_location": "/object-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "object-visit@^1.0.0", + "name": "object-visit", + "escapedName": "object-visit", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/collection-visit", + "/map-visit" + ], + "_resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "_shasum": "f79c4493af0c5377b59fe39d395e41042dd045bb", + "_spec": "object-visit@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/collection-visit", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/object-visit/issues" + }, + "bundleDependencies": false, + "dependencies": { + "isobject": "^3.0.0" + }, + "deprecated": false, + "description": "Call a specified method on each value in the given object.", + "devDependencies": { + "gulp": "^3.9.1", + "gulp-eslint": "^3.0.1", + "gulp-format-md": "^0.1.12", + "gulp-istanbul": "^1.1.1", + "gulp-mocha": "^3.0.0", + "mocha": "^3.2.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/object-visit", + "keywords": [ + "context", + "function", + "helper", + "key", + "method", + "object", + "value", + "visit", + "visitor" + ], + "license": "MIT", + "main": "index.js", + "name": "object-visit", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/object-visit.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "base-methods", + "collection-visit", + "define-property", + "map-visit" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + }, + "version": "1.0.1" +} diff --git a/node_modules/object.pick/LICENSE b/node_modules/object.pick/LICENSE new file mode 100644 index 0000000..39245ac --- /dev/null +++ b/node_modules/object.pick/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2016, 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/node_modules/object.pick/README.md b/node_modules/object.pick/README.md new file mode 100644 index 0000000..48f7453 --- /dev/null +++ b/node_modules/object.pick/README.md @@ -0,0 +1,76 @@ +# object.pick [![NPM version](https://img.shields.io/npm/v/object.pick.svg?style=flat)](https://www.npmjs.com/package/object.pick) [![NPM monthly downloads](https://img.shields.io/npm/dm/object.pick.svg?style=flat)](https://npmjs.org/package/object.pick) [![NPM total downloads](https://img.shields.io/npm/dt/object.pick.svg?style=flat)](https://npmjs.org/package/object.pick) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/object.pick.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/object.pick) + +> Returns a filtered copy of an object with only the specified keys, similar to `_.pick` from lodash / underscore. + +You might also be interested in [object.omit](https://github.com/jonschlinkert/object.omit). + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save object.pick +``` + +## benchmarks + +This is the [fastest implementation](http://jsperf.com/pick-props) I tested. Pull requests welcome! + +## Usage + +```js +var pick = require('object.pick'); + +pick({a: 'a', b: 'b'}, 'a') +//=> {a: 'a'} + +pick({a: 'a', b: 'b', c: 'c'}, ['a', 'b']) +//=> {a: 'a', b: 'b'} +``` + +## About + +### Related projects + +* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.") +* [get-value](https://www.npmjs.com/package/get-value): Use property paths (`a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value "Use property paths (`a.b.c`) to get a nested value from an object.") +* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.") +* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value "Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Building docs + +_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ + +To generate the readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm install -g verb verb-generate-readme && verb +``` + +### Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +### License + +Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT license](https://github.com/jonschlinkert/object.pick/blob/master/LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on October 27, 2016._ \ No newline at end of file diff --git a/node_modules/object.pick/index.js b/node_modules/object.pick/index.js new file mode 100644 index 0000000..0ce0178 --- /dev/null +++ b/node_modules/object.pick/index.js @@ -0,0 +1,35 @@ +/*! + * object.pick + * + * Copyright (c) 2014-2015 Jon Schlinkert, contributors. + * Licensed under the MIT License + */ + +'use strict'; + +var isObject = require('isobject'); + +module.exports = function pick(obj, keys) { + if (!isObject(obj) && typeof obj !== 'function') { + return {}; + } + + var res = {}; + if (typeof keys === 'string') { + if (keys in obj) { + res[keys] = obj[keys]; + } + return res; + } + + var len = keys.length; + var idx = -1; + + while (++idx < len) { + var key = keys[idx]; + if (key in obj) { + res[key] = obj[key]; + } + } + return res; +}; diff --git a/node_modules/object.pick/package.json b/node_modules/object.pick/package.json new file mode 100644 index 0000000..34f0dd0 --- /dev/null +++ b/node_modules/object.pick/package.json @@ -0,0 +1,92 @@ +{ + "_from": "object.pick@^1.3.0", + "_id": "object.pick@1.3.0", + "_inBundle": false, + "_integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "_location": "/object.pick", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "object.pick@^1.3.0", + "name": "object.pick", + "escapedName": "object.pick", + "rawSpec": "^1.3.0", + "saveSpec": null, + "fetchSpec": "^1.3.0" + }, + "_requiredBy": [ + "/micromatch", + "/nanomatch" + ], + "_resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "_shasum": "87a10ac4c1694bd2e1cbf53591a66141fb5dd747", + "_spec": "object.pick@^1.3.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/micromatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/object.pick/issues" + }, + "bundleDependencies": false, + "dependencies": { + "isobject": "^3.0.1" + }, + "deprecated": false, + "description": "Returns a filtered copy of an object with only the specified keys, similar to `_.pick` from lodash / underscore.", + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.1.2", + "vinyl": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/object.pick", + "keywords": [ + "object", + "pick" + ], + "license": "MIT", + "main": "index.js", + "name": "object.pick", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/object.pick.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "extend-shallow", + "get-value", + "mixin-deep", + "set-value" + ], + "highlight": "object.omit" + }, + "reflinks": [ + "verb" + ], + "lint": { + "reflinks": true + } + }, + "version": "1.3.0" +} diff --git a/node_modules/on-finished/HISTORY.md b/node_modules/on-finished/HISTORY.md new file mode 100644 index 0000000..98ff0e9 --- /dev/null +++ b/node_modules/on-finished/HISTORY.md @@ -0,0 +1,88 @@ +2.3.0 / 2015-05-26 +================== + + * Add defined behavior for HTTP `CONNECT` requests + * Add defined behavior for HTTP `Upgrade` requests + * deps: ee-first@1.1.1 + +2.2.1 / 2015-04-22 +================== + + * Fix `isFinished(req)` when data buffered + +2.2.0 / 2014-12-22 +================== + + * Add message object to callback arguments + +2.1.1 / 2014-10-22 +================== + + * Fix handling of pipelined requests + +2.1.0 / 2014-08-16 +================== + + * Check if `socket` is detached + * Return `undefined` for `isFinished` if state unknown + +2.0.0 / 2014-08-16 +================== + + * Add `isFinished` function + * Move to `jshttp` organization + * Remove support for plain socket argument + * Rename to `on-finished` + * Support both `req` and `res` as arguments + * deps: ee-first@1.0.5 + +1.2.2 / 2014-06-10 +================== + + * Reduce listeners added to emitters + - avoids "event emitter leak" warnings when used multiple times on same request + +1.2.1 / 2014-06-08 +================== + + * Fix returned value when already finished + +1.2.0 / 2014-06-05 +================== + + * Call callback when called on already-finished socket + +1.1.4 / 2014-05-27 +================== + + * Support node.js 0.8 + +1.1.3 / 2014-04-30 +================== + + * Make sure errors passed as instanceof `Error` + +1.1.2 / 2014-04-18 +================== + + * Default the `socket` to passed-in object + +1.1.1 / 2014-01-16 +================== + + * Rename module to `finished` + +1.1.0 / 2013-12-25 +================== + + * Call callback when called on already-errored socket + +1.0.1 / 2013-12-20 +================== + + * Actually pass the error to the callback + +1.0.0 / 2013-12-20 +================== + + * Initial release diff --git a/node_modules/on-finished/LICENSE b/node_modules/on-finished/LICENSE new file mode 100644 index 0000000..5931fd2 --- /dev/null +++ b/node_modules/on-finished/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2013 Jonathan Ong +Copyright (c) 2014 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/on-finished/README.md b/node_modules/on-finished/README.md new file mode 100644 index 0000000..a0e1157 --- /dev/null +++ b/node_modules/on-finished/README.md @@ -0,0 +1,154 @@ +# on-finished + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Execute a callback when a HTTP request closes, finishes, or errors. + +## Install + +```sh +$ npm install on-finished +``` + +## API + +```js +var onFinished = require('on-finished') +``` + +### onFinished(res, listener) + +Attach a listener to listen for the response to finish. The listener will +be invoked only once when the response finished. If the response finished +to an error, the first argument will contain the error. If the response +has already finished, the listener will be invoked. + +Listening to the end of a response would be used to close things associated +with the response, like open files. + +Listener is invoked as `listener(err, res)`. + +```js +onFinished(res, function (err, res) { + // clean up open fds, etc. + // err contains the error is request error'd +}) +``` + +### onFinished(req, listener) + +Attach a listener to listen for the request to finish. The listener will +be invoked only once when the request finished. If the request finished +to an error, the first argument will contain the error. If the request +has already finished, the listener will be invoked. + +Listening to the end of a request would be used to know when to continue +after reading the data. + +Listener is invoked as `listener(err, req)`. + +```js +var data = '' + +req.setEncoding('utf8') +res.on('data', function (str) { + data += str +}) + +onFinished(req, function (err, req) { + // data is read unless there is err +}) +``` + +### onFinished.isFinished(res) + +Determine if `res` is already finished. This would be useful to check and +not even start certain operations if the response has already finished. + +### onFinished.isFinished(req) + +Determine if `req` is already finished. This would be useful to check and +not even start certain operations if the request has already finished. + +## Special Node.js requests + +### HTTP CONNECT method + +The meaning of the `CONNECT` method from RFC 7231, section 4.3.6: + +> The CONNECT method requests that the recipient establish a tunnel to +> the destination origin server identified by the request-target and, +> if successful, thereafter restrict its behavior to blind forwarding +> of packets, in both directions, until the tunnel is closed. Tunnels +> are commonly used to create an end-to-end virtual connection, through +> one or more proxies, which can then be secured using TLS (Transport +> Layer Security, [RFC5246]). + +In Node.js, these request objects come from the `'connect'` event on +the HTTP server. + +When this module is used on a HTTP `CONNECT` request, the request is +considered "finished" immediately, **due to limitations in the Node.js +interface**. This means if the `CONNECT` request contains a request entity, +the request will be considered "finished" even before it has been read. + +There is no such thing as a response object to a `CONNECT` request in +Node.js, so there is no support for for one. + +### HTTP Upgrade request + +The meaning of the `Upgrade` header from RFC 7230, section 6.1: + +> The "Upgrade" header field is intended to provide a simple mechanism +> for transitioning from HTTP/1.1 to some other protocol on the same +> connection. + +In Node.js, these request objects come from the `'upgrade'` event on +the HTTP server. + +When this module is used on a HTTP request with an `Upgrade` header, the +request is considered "finished" immediately, **due to limitations in the +Node.js interface**. This means if the `Upgrade` request contains a request +entity, the request will be considered "finished" even before it has been +read. + +There is no such thing as a response object to a `Upgrade` request in +Node.js, so there is no support for for one. + +## Example + +The following code ensures that file descriptors are always closed +once the response finishes. + +```js +var destroy = require('destroy') +var http = require('http') +var onFinished = require('on-finished') + +http.createServer(function onRequest(req, res) { + var stream = fs.createReadStream('package.json') + stream.pipe(res) + onFinished(res, function (err) { + destroy(stream) + }) +}) +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/on-finished.svg +[npm-url]: https://npmjs.org/package/on-finished +[node-version-image]: https://img.shields.io/node/v/on-finished.svg +[node-version-url]: http://nodejs.org/download/ +[travis-image]: https://img.shields.io/travis/jshttp/on-finished/master.svg +[travis-url]: https://travis-ci.org/jshttp/on-finished +[coveralls-image]: https://img.shields.io/coveralls/jshttp/on-finished/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/on-finished?branch=master +[downloads-image]: https://img.shields.io/npm/dm/on-finished.svg +[downloads-url]: https://npmjs.org/package/on-finished diff --git a/node_modules/on-finished/index.js b/node_modules/on-finished/index.js new file mode 100644 index 0000000..9abd98f --- /dev/null +++ b/node_modules/on-finished/index.js @@ -0,0 +1,196 @@ +/*! + * on-finished + * Copyright(c) 2013 Jonathan Ong + * Copyright(c) 2014 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = onFinished +module.exports.isFinished = isFinished + +/** + * Module dependencies. + * @private + */ + +var first = require('ee-first') + +/** + * Variables. + * @private + */ + +/* istanbul ignore next */ +var defer = typeof setImmediate === 'function' + ? setImmediate + : function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) } + +/** + * Invoke callback when the response has finished, useful for + * cleaning up resources afterwards. + * + * @param {object} msg + * @param {function} listener + * @return {object} + * @public + */ + +function onFinished(msg, listener) { + if (isFinished(msg) !== false) { + defer(listener, null, msg) + return msg + } + + // attach the listener to the message + attachListener(msg, listener) + + return msg +} + +/** + * Determine if message is already finished. + * + * @param {object} msg + * @return {boolean} + * @public + */ + +function isFinished(msg) { + var socket = msg.socket + + if (typeof msg.finished === 'boolean') { + // OutgoingMessage + return Boolean(msg.finished || (socket && !socket.writable)) + } + + if (typeof msg.complete === 'boolean') { + // IncomingMessage + return Boolean(msg.upgrade || !socket || !socket.readable || (msg.complete && !msg.readable)) + } + + // don't know + return undefined +} + +/** + * Attach a finished listener to the message. + * + * @param {object} msg + * @param {function} callback + * @private + */ + +function attachFinishedListener(msg, callback) { + var eeMsg + var eeSocket + var finished = false + + function onFinish(error) { + eeMsg.cancel() + eeSocket.cancel() + + finished = true + callback(error) + } + + // finished on first message event + eeMsg = eeSocket = first([[msg, 'end', 'finish']], onFinish) + + function onSocket(socket) { + // remove listener + msg.removeListener('socket', onSocket) + + if (finished) return + if (eeMsg !== eeSocket) return + + // finished on first socket event + eeSocket = first([[socket, 'error', 'close']], onFinish) + } + + if (msg.socket) { + // socket already assigned + onSocket(msg.socket) + return + } + + // wait for socket to be assigned + msg.on('socket', onSocket) + + if (msg.socket === undefined) { + // node.js 0.8 patch + patchAssignSocket(msg, onSocket) + } +} + +/** + * Attach the listener to the message. + * + * @param {object} msg + * @return {function} + * @private + */ + +function attachListener(msg, listener) { + var attached = msg.__onFinished + + // create a private single listener with queue + if (!attached || !attached.queue) { + attached = msg.__onFinished = createListener(msg) + attachFinishedListener(msg, attached) + } + + attached.queue.push(listener) +} + +/** + * Create listener on message. + * + * @param {object} msg + * @return {function} + * @private + */ + +function createListener(msg) { + function listener(err) { + if (msg.__onFinished === listener) msg.__onFinished = null + if (!listener.queue) return + + var queue = listener.queue + listener.queue = null + + for (var i = 0; i < queue.length; i++) { + queue[i](err, msg) + } + } + + listener.queue = [] + + return listener +} + +/** + * Patch ServerResponse.prototype.assignSocket for node.js 0.8. + * + * @param {ServerResponse} res + * @param {function} callback + * @private + */ + +function patchAssignSocket(res, callback) { + var assignSocket = res.assignSocket + + if (typeof assignSocket !== 'function') return + + // res.on('socket', callback) is broken in 0.8 + res.assignSocket = function _assignSocket(socket) { + assignSocket.call(this, socket) + callback(socket) + } +} diff --git a/node_modules/on-finished/package.json b/node_modules/on-finished/package.json new file mode 100644 index 0000000..27e9b21 --- /dev/null +++ b/node_modules/on-finished/package.json @@ -0,0 +1,74 @@ +{ + "_from": "on-finished@~2.3.0", + "_id": "on-finished@2.3.0", + "_inBundle": false, + "_integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "_location": "/on-finished", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "on-finished@~2.3.0", + "name": "on-finished", + "escapedName": "on-finished", + "rawSpec": "~2.3.0", + "saveSpec": null, + "fetchSpec": "~2.3.0" + }, + "_requiredBy": [ + "/body-parser", + "/express", + "/finalhandler", + "/morgan", + "/send" + ], + "_resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "_shasum": "20f1336481b083cd75337992a16971aa2d906947", + "_spec": "on-finished@~2.3.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/body-parser", + "bugs": { + "url": "https://github.com/jshttp/on-finished/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com" + } + ], + "dependencies": { + "ee-first": "1.1.1" + }, + "deprecated": false, + "description": "Execute a callback when a request closes, finishes, or errors", + "devDependencies": { + "istanbul": "0.3.9", + "mocha": "2.2.5" + }, + "engines": { + "node": ">= 0.8" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "index.js" + ], + "homepage": "https://github.com/jshttp/on-finished#readme", + "license": "MIT", + "name": "on-finished", + "repository": { + "type": "git", + "url": "git+https://github.com/jshttp/on-finished.git" + }, + "scripts": { + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + }, + "version": "2.3.0" +} diff --git a/node_modules/on-headers/HISTORY.md b/node_modules/on-headers/HISTORY.md new file mode 100644 index 0000000..e51ff01 --- /dev/null +++ b/node_modules/on-headers/HISTORY.md @@ -0,0 +1,16 @@ +1.0.1 / 2015-09-29 +================== + + * perf: enable strict mode + +1.0.0 / 2014-08-10 +================== + + * Honor `res.statusCode` change in `listener` + * Move to `jshttp` orgainzation + * Prevent `arguments`-related de-opt + +0.0.0 / 2014-05-13 +================== + + * Initial implementation diff --git a/node_modules/on-headers/LICENSE b/node_modules/on-headers/LICENSE new file mode 100644 index 0000000..b7dce6c --- /dev/null +++ b/node_modules/on-headers/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/on-headers/README.md b/node_modules/on-headers/README.md new file mode 100644 index 0000000..48ed9ae --- /dev/null +++ b/node_modules/on-headers/README.md @@ -0,0 +1,76 @@ +# on-headers + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Execute a listener when a response is about to write headers. + +## Installation + +```sh +$ npm install on-headers +``` + +## API + +```js +var onHeaders = require('on-headers') +``` + +### onHeaders(res, listener) + +This will add the listener `listener` to fire when headers are emitted for `res`. +The listener is passed the `response` object as it's context (`this`). Headers are +considered to be emitted only once, right before they are sent to the client. + +When this is called multiple times on the same `res`, the `listener`s are fired +in the reverse order they were added. + +## Examples + +```js +var http = require('http') +var onHeaders = require('on-headers') + +http +.createServer(onRequest) +.listen(3000) + +function addPoweredBy() { + // set if not set by end of request + if (!this.getHeader('X-Powered-By')) { + this.setHeader('X-Powered-By', 'Node.js') + } +} + +function onRequest(req, res) { + onHeaders(res, addPoweredBy) + + res.setHeader('Content-Type', 'text/plain') + res.end('hello!') +} +``` + +## Testing + +```sh +$ npm test +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/on-headers.svg +[npm-url]: https://npmjs.org/package/on-headers +[node-version-image]: https://img.shields.io/node/v/on-headers.svg +[node-version-url]: http://nodejs.org/download/ +[travis-image]: https://img.shields.io/travis/jshttp/on-headers/master.svg +[travis-url]: https://travis-ci.org/jshttp/on-headers +[coveralls-image]: https://img.shields.io/coveralls/jshttp/on-headers/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/on-headers?branch=master +[downloads-image]: https://img.shields.io/npm/dm/on-headers.svg +[downloads-url]: https://npmjs.org/package/on-headers diff --git a/node_modules/on-headers/index.js b/node_modules/on-headers/index.js new file mode 100644 index 0000000..089f2b3 --- /dev/null +++ b/node_modules/on-headers/index.js @@ -0,0 +1,93 @@ +/*! + * on-headers + * Copyright(c) 2014 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Reference to Array slice. + */ + +var slice = Array.prototype.slice + +/** + * Execute a listener when a response is about to write headers. + * + * @param {Object} res + * @return {Function} listener + * @api public + */ + +module.exports = function onHeaders(res, listener) { + if (!res) { + throw new TypeError('argument res is required') + } + + if (typeof listener !== 'function') { + throw new TypeError('argument listener must be a function') + } + + res.writeHead = createWriteHead(res.writeHead, listener) +} + +function createWriteHead(prevWriteHead, listener) { + var fired = false; + + // return function with core name and argument list + return function writeHead(statusCode) { + // set headers from arguments + var args = setWriteHeadHeaders.apply(this, arguments); + + // fire listener + if (!fired) { + fired = true + listener.call(this) + + // pass-along an updated status code + if (typeof args[0] === 'number' && this.statusCode !== args[0]) { + args[0] = this.statusCode + args.length = 1 + } + } + + prevWriteHead.apply(this, args); + } +} + +function setWriteHeadHeaders(statusCode) { + var length = arguments.length + var headerIndex = length > 1 && typeof arguments[1] === 'string' + ? 2 + : 1 + + var headers = length >= headerIndex + 1 + ? arguments[headerIndex] + : undefined + + this.statusCode = statusCode + + // the following block is from node.js core + if (Array.isArray(headers)) { + // handle array case + for (var i = 0, len = headers.length; i < len; ++i) { + this.setHeader(headers[i][0], headers[i][1]) + } + } else if (headers) { + // handle object case + var keys = Object.keys(headers) + for (var i = 0; i < keys.length; i++) { + var k = keys[i] + if (k) this.setHeader(k, headers[k]) + } + } + + // copy leading arguments + var args = new Array(Math.min(length, headerIndex)) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + + return args +} diff --git a/node_modules/on-headers/package.json b/node_modules/on-headers/package.json new file mode 100644 index 0000000..faecc43 --- /dev/null +++ b/node_modules/on-headers/package.json @@ -0,0 +1,69 @@ +{ + "_from": "on-headers@~1.0.1", + "_id": "on-headers@1.0.1", + "_inBundle": false, + "_integrity": "sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c=", + "_location": "/on-headers", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "on-headers@~1.0.1", + "name": "on-headers", + "escapedName": "on-headers", + "rawSpec": "~1.0.1", + "saveSpec": null, + "fetchSpec": "~1.0.1" + }, + "_requiredBy": [ + "/morgan" + ], + "_resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.1.tgz", + "_shasum": "928f5d0f470d49342651ea6794b0857c100693f7", + "_spec": "on-headers@~1.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/morgan", + "author": { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + "bugs": { + "url": "https://github.com/jshttp/on-headers/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Execute a listener when a response is about to write headers", + "devDependencies": { + "istanbul": "0.3.21", + "mocha": "2.3.3", + "supertest": "1.1.0" + }, + "engines": { + "node": ">= 0.8" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "README.md", + "index.js" + ], + "homepage": "https://github.com/jshttp/on-headers#readme", + "keywords": [ + "event", + "headers", + "http", + "onheaders" + ], + "license": "MIT", + "name": "on-headers", + "repository": { + "type": "git", + "url": "git+https://github.com/jshttp/on-headers.git" + }, + "scripts": { + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + }, + "version": "1.0.1" +} diff --git a/node_modules/p-finally/index.js b/node_modules/p-finally/index.js new file mode 100644 index 0000000..52b7b49 --- /dev/null +++ b/node_modules/p-finally/index.js @@ -0,0 +1,15 @@ +'use strict'; +module.exports = (promise, onFinally) => { + onFinally = onFinally || (() => {}); + + return promise.then( + val => new Promise(resolve => { + resolve(onFinally()); + }).then(() => val), + err => new Promise(resolve => { + resolve(onFinally()); + }).then(() => { + throw err; + }) + ); +}; diff --git a/node_modules/p-finally/license b/node_modules/p-finally/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/p-finally/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/p-finally/package.json b/node_modules/p-finally/package.json new file mode 100644 index 0000000..31ac4bc --- /dev/null +++ b/node_modules/p-finally/package.json @@ -0,0 +1,74 @@ +{ + "_from": "p-finally@^1.0.0", + "_id": "p-finally@1.0.0", + "_inBundle": false, + "_integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "_location": "/p-finally", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "p-finally@^1.0.0", + "name": "p-finally", + "escapedName": "p-finally", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/execa" + ], + "_resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "_shasum": "3fbcfb15b899a44123b34b6dcc18b724336a2cae", + "_spec": "p-finally@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/execa", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/p-finally/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "`Promise#finally()` ponyfill - Invoked when the promise is settled regardless of outcome", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/p-finally#readme", + "keywords": [ + "promise", + "finally", + "handler", + "function", + "async", + "await", + "promises", + "settled", + "ponyfill", + "polyfill", + "shim", + "bluebird" + ], + "license": "MIT", + "name": "p-finally", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/p-finally.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.0.0", + "xo": { + "esnext": true + } +} diff --git a/node_modules/p-finally/readme.md b/node_modules/p-finally/readme.md new file mode 100644 index 0000000..09ef364 --- /dev/null +++ b/node_modules/p-finally/readme.md @@ -0,0 +1,47 @@ +# p-finally [![Build Status](https://travis-ci.org/sindresorhus/p-finally.svg?branch=master)](https://travis-ci.org/sindresorhus/p-finally) + +> [`Promise#finally()`](https://github.com/tc39/proposal-promise-finally) [ponyfill](https://ponyfill.com) - Invoked when the promise is settled regardless of outcome + +Useful for cleanup. + + +## Install + +``` +$ npm install --save p-finally +``` + + +## Usage + +```js +const pFinally = require('p-finally'); + +const dir = createTempDir(); + +pFinally(write(dir), () => cleanup(dir)); +``` + + +## API + +### pFinally(promise, [onFinally]) + +Returns a `Promise`. + +#### onFinally + +Type: `Function` + +Note: Throwing or returning a rejected promise will reject `promise` with the rejection reason. + + +## Related + +- [p-try](https://github.com/sindresorhus/p-try) - `Promise#try()` ponyfill - Starts a promise chain +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/package-json/index.js b/node_modules/package-json/index.js new file mode 100644 index 0000000..1e588b2 --- /dev/null +++ b/node_modules/package-json/index.js @@ -0,0 +1,67 @@ +'use strict'; +const url = require('url'); +const got = require('got'); +const registryUrl = require('registry-url'); +const registryAuthToken = require('registry-auth-token'); +const semver = require('semver'); + +module.exports = (name, opts) => { + const scope = name.split('/')[0]; + const regUrl = registryUrl(scope); + const pkgUrl = url.resolve(regUrl, encodeURIComponent(name).replace(/^%40/, '@')); + const authInfo = registryAuthToken(regUrl, {recursive: true}); + + opts = Object.assign({ + version: 'latest' + }, opts); + + const headers = { + accept: 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*' + }; + + if (opts.fullMetadata) { + delete headers.accept; + } + + if (authInfo) { + headers.authorization = `${authInfo.type} ${authInfo.token}`; + } + + return got(pkgUrl, {json: true, headers}) + .then(res => { + let data = res.body; + let version = opts.version; + + if (opts.allVersions) { + return data; + } + + if (data['dist-tags'][version]) { + data = data.versions[data['dist-tags'][version]]; + } else if (version) { + if (!data.versions[version]) { + const versions = Object.keys(data.versions); + version = semver.maxSatisfying(versions, version); + + if (!version) { + throw new Error('Version doesn\'t exist'); + } + } + + data = data.versions[version]; + + if (!data) { + throw new Error('Version doesn\'t exist'); + } + } + + return data; + }) + .catch(err => { + if (err.statusCode === 404) { + throw new Error(`Package \`${name}\` doesn't exist`); + } + + throw err; + }); +}; diff --git a/node_modules/package-json/license b/node_modules/package-json/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/package-json/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/package-json/package.json b/node_modules/package-json/package.json new file mode 100644 index 0000000..a4ba16f --- /dev/null +++ b/node_modules/package-json/package.json @@ -0,0 +1,75 @@ +{ + "_from": "package-json@^4.0.0", + "_id": "package-json@4.0.1", + "_inBundle": false, + "_integrity": "sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0=", + "_location": "/package-json", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "package-json@^4.0.0", + "name": "package-json", + "escapedName": "package-json", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/latest-version" + ], + "_resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", + "_shasum": "8869a0401253661c4c4ca3da6c2121ed555f5eed", + "_spec": "package-json@^4.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/latest-version", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/package-json/issues" + }, + "bundleDependencies": false, + "dependencies": { + "got": "^6.7.1", + "registry-auth-token": "^3.0.1", + "registry-url": "^3.0.3", + "semver": "^5.1.0" + }, + "deprecated": false, + "description": "Get metadata of a package from the npm registry", + "devDependencies": { + "ava": "*", + "mock-private-registry": "^1.1.0", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/package-json#readme", + "keywords": [ + "npm", + "registry", + "package", + "pkg", + "package.json", + "json", + "module", + "scope", + "scoped" + ], + "license": "MIT", + "name": "package-json", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/package-json.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "4.0.1" +} diff --git a/node_modules/package-json/readme.md b/node_modules/package-json/readme.md new file mode 100644 index 0000000..477e25c --- /dev/null +++ b/node_modules/package-json/readme.md @@ -0,0 +1,91 @@ +# package-json [![Build Status](https://travis-ci.org/sindresorhus/package-json.svg?branch=master)](https://travis-ci.org/sindresorhus/package-json) + +> Get metadata of a package from the npm registry + + +## Install + +``` +$ npm install --save package-json +``` + + +## Usage + +```js +const packageJson = require('package-json'); + +packageJson('ava').then(json => { + console.log(json); + //=> {name: 'ava', ...} +}); + +// Also works with scoped packages +packageJson('@sindresorhus/df').then(json => { + console.log(json); + //=> {name: '@sindresorhus/df', ...} +}); +``` + + +## API + +### packageJson(name, [options]) + +#### name + +Type: `string` + +Name of the package. + +#### options + +Type: `Object` + +##### version + +Type: `string`
+Default: `latest` + +Package version such as `1.0.0` or a [dist tag](https://docs.npmjs.com/cli/dist-tag) such as `latest`. + +The version can also be in any format supported by the [semver](https://github.com/npm/node-semver) module. For example: + +- `1` - get the latest `1.x.x` +- `1.2` - get the latest `1.2.x` +- `^1.2.3` - get the latest `1.x.x` but at least `1.2.3` +- `~1.2.3` - get the latest `1.2.x` but at least `1.2.3` + +##### fullMetadata + +Type: `boolean`
+Default: `false` + +By default, only an abbreviated metadata object is returned for performance reasons. [Read more.](https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md) + +##### allVersions + +Type: `boolean`
+Default: `false` + +Return the [main entry](https://registry.npmjs.org/ava) containing all versions. + + +## Authentication + +Both public and private registries are supported, for both scoped and unscoped packages, as long as the registry uses either bearer tokens or basic authentication. + + +## Related + +- [package-json-cli](https://github.com/sindresorhus/package-json-cli) - CLI for this module +- [latest-version](https://github.com/sindresorhus/latest-version) - Get the latest version of an npm package +- [pkg-versions](https://github.com/sindresorhus/pkg-versions) - Get the version numbers of a package from the npm registry +- [npm-keyword](https://github.com/sindresorhus/npm-keyword) - Get a list of npm packages with a certain keyword +- [npm-user](https://github.com/sindresorhus/npm-user) - Get user info of an npm user +- [npm-email](https://github.com/sindresorhus/npm-email) - Get the email of an npm user + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/parseurl/HISTORY.md b/node_modules/parseurl/HISTORY.md new file mode 100644 index 0000000..4803393 --- /dev/null +++ b/node_modules/parseurl/HISTORY.md @@ -0,0 +1,53 @@ +1.3.2 / 2017-09-09 +================== + + * perf: reduce overhead for full URLs + * perf: unroll the "fast-path" `RegExp` + +1.3.1 / 2016-01-17 +================== + + * perf: enable strict mode + +1.3.0 / 2014-08-09 +================== + + * Add `parseurl.original` for parsing `req.originalUrl` with fallback + * Return `undefined` if `req.url` is `undefined` + +1.2.0 / 2014-07-21 +================== + + * Cache URLs based on original value + * Remove no-longer-needed URL mis-parse work-around + * Simplify the "fast-path" `RegExp` + +1.1.3 / 2014-07-08 +================== + + * Fix typo + +1.1.2 / 2014-07-08 +================== + + * Seriously fix Node.js 0.8 compatibility + +1.1.1 / 2014-07-08 +================== + + * Fix Node.js 0.8 compatibility + +1.1.0 / 2014-07-08 +================== + + * Incorporate URL href-only parse fast-path + +1.0.1 / 2014-03-08 +================== + + * Add missing `require` + +1.0.0 / 2014-03-08 +================== + + * Genesis from `connect` diff --git a/node_modules/parseurl/LICENSE b/node_modules/parseurl/LICENSE new file mode 100644 index 0000000..27653d3 --- /dev/null +++ b/node_modules/parseurl/LICENSE @@ -0,0 +1,24 @@ + +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2014-2017 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/parseurl/README.md b/node_modules/parseurl/README.md new file mode 100644 index 0000000..a5ccc51 --- /dev/null +++ b/node_modules/parseurl/README.md @@ -0,0 +1,124 @@ +# parseurl + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Parse a URL with memoization. + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install parseurl +``` + +## API + +```js +var parseurl = require('parseurl') +``` + +### parseurl(req) + +Parse the URL of the given request object (looks at the `req.url` property) +and return the result. The result is the same as `url.parse` in Node.js core. +Calling this function multiple times on the same `req` where `req.url` does +not change will return a cached parsed object, rather than parsing again. + +### parseurl.original(req) + +Parse the original URL of the given request object and return the result. +This works by trying to parse `req.originalUrl` if it is a string, otherwise +parses `req.url`. The result is the same as `url.parse` in Node.js core. +Calling this function multiple times on the same `req` where `req.originalUrl` +does not change will return a cached parsed object, rather than parsing again. + +## Benchmark + +```bash +$ npm run-script bench + +> parseurl@1.3.2 bench nodejs-parseurl +> node benchmark/index.js + + http_parser@2.7.0 + node@4.8.4 + v8@4.5.103.47 + uv@1.9.1 + zlib@1.2.11 + ares@1.10.1-DEV + icu@56.1 + modules@46 + openssl@1.0.2k + +> node benchmark/fullurl.js + + Parsing URL "http://localhost:8888/foo/bar?user=tj&pet=fluffy" + + 3 tests completed. + + fasturl x 1,246,766 ops/sec ±0.74% (188 runs sampled) + nativeurl x 91,536 ops/sec ±0.54% (189 runs sampled) + parseurl x 90,645 ops/sec ±0.38% (189 runs sampled) + +> node benchmark/pathquery.js + + Parsing URL "/foo/bar?user=tj&pet=fluffy" + + 3 tests completed. + + fasturl x 2,077,650 ops/sec ±0.69% (186 runs sampled) + nativeurl x 638,669 ops/sec ±0.67% (189 runs sampled) + parseurl x 2,431,842 ops/sec ±0.71% (189 runs sampled) + +> node benchmark/samerequest.js + + Parsing URL "/foo/bar?user=tj&pet=fluffy" on same request object + + 3 tests completed. + + fasturl x 2,135,391 ops/sec ±0.69% (188 runs sampled) + nativeurl x 672,809 ops/sec ±3.83% (186 runs sampled) + parseurl x 11,604,947 ops/sec ±0.70% (189 runs sampled) + +> node benchmark/simplepath.js + + Parsing URL "/foo/bar" + + 3 tests completed. + + fasturl x 4,961,391 ops/sec ±0.97% (186 runs sampled) + nativeurl x 914,931 ops/sec ±0.83% (186 runs sampled) + parseurl x 7,559,196 ops/sec ±0.66% (188 runs sampled) + +> node benchmark/slash.js + + Parsing URL "/" + + 3 tests completed. + + fasturl x 4,053,379 ops/sec ±0.91% (187 runs sampled) + nativeurl x 963,999 ops/sec ±0.58% (189 runs sampled) + parseurl x 11,516,143 ops/sec ±0.58% (188 runs sampled) +``` + +## License + + [MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/parseurl.svg +[npm-url]: https://npmjs.org/package/parseurl +[node-version-image]: https://img.shields.io/node/v/parseurl.svg +[node-version-url]: https://nodejs.org/en/download/ +[travis-image]: https://img.shields.io/travis/pillarjs/parseurl/master.svg +[travis-url]: https://travis-ci.org/pillarjs/parseurl +[coveralls-image]: https://img.shields.io/coveralls/pillarjs/parseurl/master.svg +[coveralls-url]: https://coveralls.io/r/pillarjs/parseurl?branch=master +[downloads-image]: https://img.shields.io/npm/dm/parseurl.svg +[downloads-url]: https://npmjs.org/package/parseurl diff --git a/node_modules/parseurl/index.js b/node_modules/parseurl/index.js new file mode 100644 index 0000000..603eabe --- /dev/null +++ b/node_modules/parseurl/index.js @@ -0,0 +1,154 @@ +/*! + * parseurl + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2014-2017 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var url = require('url') +var parse = url.parse +var Url = url.Url + +/** + * Module exports. + * @public + */ + +module.exports = parseurl +module.exports.original = originalurl + +/** + * Parse the `req` url with memoization. + * + * @param {ServerRequest} req + * @return {Object} + * @public + */ + +function parseurl (req) { + var url = req.url + + if (url === undefined) { + // URL is undefined + return undefined + } + + var parsed = req._parsedUrl + + if (fresh(url, parsed)) { + // Return cached URL parse + return parsed + } + + // Parse the URL + parsed = fastparse(url) + parsed._raw = url + + return (req._parsedUrl = parsed) +}; + +/** + * Parse the `req` original url with fallback and memoization. + * + * @param {ServerRequest} req + * @return {Object} + * @public + */ + +function originalurl (req) { + var url = req.originalUrl + + if (typeof url !== 'string') { + // Fallback + return parseurl(req) + } + + var parsed = req._parsedOriginalUrl + + if (fresh(url, parsed)) { + // Return cached URL parse + return parsed + } + + // Parse the URL + parsed = fastparse(url) + parsed._raw = url + + return (req._parsedOriginalUrl = parsed) +}; + +/** + * Parse the `str` url with fast-path short-cut. + * + * @param {string} str + * @return {Object} + * @private + */ + +function fastparse (str) { + if (typeof str !== 'string' || str.charCodeAt(0) !== 0x2f /* / */) { + return parse(str) + } + + var pathname = str + var query = null + var search = null + + // This takes the regexp from https://github.com/joyent/node/pull/7878 + // Which is /^(\/[^?#\s]*)(\?[^#\s]*)?$/ + // And unrolls it into a for loop + for (var i = 1; i < str.length; i++) { + switch (str.charCodeAt(i)) { + case 0x3f: /* ? */ + if (search === null) { + pathname = str.substring(0, i) + query = str.substring(i + 1) + search = str.substring(i) + } + break + case 0x09: /* \t */ + case 0x0a: /* \n */ + case 0x0c: /* \f */ + case 0x0d: /* \r */ + case 0x20: /* */ + case 0x23: /* # */ + case 0xa0: + case 0xfeff: + return parse(str) + } + } + + var url = Url !== undefined + ? new Url() + : {} + url.path = str + url.href = str + url.pathname = pathname + url.query = query + url.search = search + + return url +} + +/** + * Determine if parsed is still fresh for url. + * + * @param {string} url + * @param {object} parsedUrl + * @return {boolean} + * @private + */ + +function fresh (url, parsedUrl) { + return typeof parsedUrl === 'object' && + parsedUrl !== null && + (Url === undefined || parsedUrl instanceof Url) && + parsedUrl._raw === url +} diff --git a/node_modules/parseurl/package.json b/node_modules/parseurl/package.json new file mode 100644 index 0000000..dcff864 --- /dev/null +++ b/node_modules/parseurl/package.json @@ -0,0 +1,82 @@ +{ + "_from": "parseurl@~1.3.1", + "_id": "parseurl@1.3.2", + "_inBundle": false, + "_integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=", + "_location": "/parseurl", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "parseurl@~1.3.1", + "name": "parseurl", + "escapedName": "parseurl", + "rawSpec": "~1.3.1", + "saveSpec": null, + "fetchSpec": "~1.3.1" + }, + "_requiredBy": [ + "/express", + "/finalhandler", + "/serve-favicon", + "/serve-static" + ], + "_resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "_shasum": "fc289d4ed8993119460c156253262cdc8de65bf3", + "_spec": "parseurl@~1.3.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/express", + "bugs": { + "url": "https://github.com/pillarjs/parseurl/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com" + } + ], + "deprecated": false, + "description": "parse a url with memoization", + "devDependencies": { + "beautify-benchmark": "0.2.4", + "benchmark": "2.1.4", + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.7.0", + "eslint-plugin-node": "5.1.1", + "eslint-plugin-promise": "3.5.0", + "eslint-plugin-standard": "3.0.1", + "fast-url-parser": "1.1.3", + "istanbul": "0.4.5", + "mocha": "2.5.3" + }, + "engines": { + "node": ">= 0.8" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "README.md", + "index.js" + ], + "homepage": "https://github.com/pillarjs/parseurl#readme", + "license": "MIT", + "name": "parseurl", + "repository": { + "type": "git", + "url": "git+https://github.com/pillarjs/parseurl.git" + }, + "scripts": { + "bench": "node benchmark/index.js", + "lint": "eslint .", + "test": "mocha --check-leaks --bail --reporter spec test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec test/" + }, + "version": "1.3.2" +} diff --git a/node_modules/pascalcase/LICENSE b/node_modules/pascalcase/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/node_modules/pascalcase/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 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/node_modules/pascalcase/README.md b/node_modules/pascalcase/README.md new file mode 100644 index 0000000..fa3fd00 --- /dev/null +++ b/node_modules/pascalcase/README.md @@ -0,0 +1,80 @@ +# pascalcase [![NPM version](https://badge.fury.io/js/pascalcase.svg)](http://badge.fury.io/js/pascalcase) + +> Convert a string to pascal-case. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i pascalcase --save +``` + +## Usage + +```js +var pascalcase = require('pascalcase'); + +pascalcase('a'); +//=> 'A' + +pascalcase('foo bar baz'); +//=> 'FooBarBaz' + +pascalcase('foo_bar-baz'); +//=> 'FooBarBaz' + +pascalcase('foo.bar.baz'); +//=> 'FooBarBaz' + +pascalcase('foo/bar/baz'); +//=> 'FooBarBaz' + +pascalcase('foo[bar)baz'); +//=> 'FooBarBaz' + +pascalcase('#foo+bar*baz'); +//=> 'FooBarBaz' + +pascalcase('$foo~bar`baz'); +//=> 'FooBarBaz' + +pascalcase('_foo_bar-baz-'); +//=> 'FooBarBaz' +``` + +## Related projects + +* [justified](https://github.com/jonschlinkert/justified): Wrap words to a specified length and justified the text. +* [pad-left](https://github.com/jonschlinkert/pad-left): Left pad a string with zeros or a specified string. Fastest implementation. +* [pad-right](https://github.com/jonschlinkert/pad-right): Right pad a string with zeros or a specified string. Fastest implementation. +* [repeat-string](https://github.com/jonschlinkert/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string. +* [word-wrap](https://github.com/jonschlinkert/word-wrap): Wrap words to a specified length. + +## Running tests + +Install dev dependencies: + +```sh +$ 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/pascalcase/issues/new) + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 Jon Schlinkert +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 19, 2015._ \ No newline at end of file diff --git a/node_modules/pascalcase/index.js b/node_modules/pascalcase/index.js new file mode 100644 index 0000000..7e8159c --- /dev/null +++ b/node_modules/pascalcase/index.js @@ -0,0 +1,21 @@ +/*! + * pascalcase + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +function pascalcase(str) { + if (typeof str !== 'string') { + throw new TypeError('expected a string.'); + } + str = str.replace(/([A-Z])/g, ' $1'); + if (str.length === 1) { return str.toUpperCase(); } + str = str.replace(/^[\W_]+|[\W_]+$/g, '').toLowerCase(); + str = str.charAt(0).toUpperCase() + str.slice(1); + return str.replace(/[\W_]+(\w|$)/g, function (_, ch) { + return ch.toUpperCase(); + }); +} + +module.exports = pascalcase; diff --git a/node_modules/pascalcase/package.json b/node_modules/pascalcase/package.json new file mode 100644 index 0000000..f5d90f9 --- /dev/null +++ b/node_modules/pascalcase/package.json @@ -0,0 +1,77 @@ +{ + "_from": "pascalcase@^0.1.1", + "_id": "pascalcase@0.1.1", + "_inBundle": false, + "_integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "_location": "/pascalcase", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "pascalcase@^0.1.1", + "name": "pascalcase", + "escapedName": "pascalcase", + "rawSpec": "^0.1.1", + "saveSpec": null, + "fetchSpec": "^0.1.1" + }, + "_requiredBy": [ + "/base" + ], + "_resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "_shasum": "b363e55e8006ca6fe21784d2db22bd15d7917f14", + "_spec": "pascalcase@^0.1.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/base", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/pascalcase/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Convert a string to pascal-case.", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/pascalcase", + "keywords": [ + "camelcase", + "case", + "casing", + "pascal", + "pascal-case", + "pascalcase", + "string" + ], + "license": "MIT", + "main": "index.js", + "name": "pascalcase", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/pascalcase.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "pad-left", + "pad-right", + "word-wrap", + "repeat-string", + "justified" + ] + } + }, + "version": "0.1.1" +} diff --git a/node_modules/path-dirname/index.js b/node_modules/path-dirname/index.js new file mode 100644 index 0000000..ed67817 --- /dev/null +++ b/node_modules/path-dirname/index.js @@ -0,0 +1,143 @@ +'use strict'; + +var path = require('path'); +var inspect = require('util').inspect; + +function assertPath(path) { + if (typeof path !== 'string') { + throw new TypeError('Path must be a string. Received ' + inspect(path)); + } +} + +function posix(path) { + assertPath(path); + if (path.length === 0) + return '.'; + var code = path.charCodeAt(0); + var hasRoot = (code === 47/*/*/); + var end = -1; + var matchedSlash = true; + for (var i = path.length - 1; i >= 1; --i) { + code = path.charCodeAt(i); + if (code === 47/*/*/) { + if (!matchedSlash) { + end = i; + break; + } + } else { + // We saw the first non-path separator + matchedSlash = false; + } + } + + if (end === -1) + return hasRoot ? '/' : '.'; + if (hasRoot && end === 1) + return '//'; + return path.slice(0, end); +} + +function win32(path) { + assertPath(path); + var len = path.length; + if (len === 0) + return '.'; + var rootEnd = -1; + var end = -1; + var matchedSlash = true; + var offset = 0; + var code = path.charCodeAt(0); + + // Try to match a root + if (len > 1) { + if (code === 47/*/*/ || code === 92/*\*/) { + // Possible UNC root + + rootEnd = offset = 1; + + code = path.charCodeAt(1); + if (code === 47/*/*/ || code === 92/*\*/) { + // Matched double path separator at beginning + var j = 2; + var last = j; + // Match 1 or more non-path separators + for (; j < len; ++j) { + code = path.charCodeAt(j); + if (code === 47/*/*/ || code === 92/*\*/) + break; + } + if (j < len && j !== last) { + // Matched! + last = j; + // Match 1 or more path separators + for (; j < len; ++j) { + code = path.charCodeAt(j); + if (code !== 47/*/*/ && code !== 92/*\*/) + break; + } + if (j < len && j !== last) { + // Matched! + last = j; + // Match 1 or more non-path separators + for (; j < len; ++j) { + code = path.charCodeAt(j); + if (code === 47/*/*/ || code === 92/*\*/) + break; + } + if (j === len) { + // We matched a UNC root only + return path; + } + if (j !== last) { + // We matched a UNC root with leftovers + + // Offset by 1 to include the separator after the UNC root to + // treat it as a "normal root" on top of a (UNC) root + rootEnd = offset = j + 1; + } + } + } + } + } else if ((code >= 65/*A*/ && code <= 90/*Z*/) || + (code >= 97/*a*/ && code <= 122/*z*/)) { + // Possible device root + + code = path.charCodeAt(1); + if (path.charCodeAt(1) === 58/*:*/) { + rootEnd = offset = 2; + if (len > 2) { + code = path.charCodeAt(2); + if (code === 47/*/*/ || code === 92/*\*/) + rootEnd = offset = 3; + } + } + } + } else if (code === 47/*/*/ || code === 92/*\*/) { + return path[0]; + } + + for (var i = len - 1; i >= offset; --i) { + code = path.charCodeAt(i); + if (code === 47/*/*/ || code === 92/*\*/) { + if (!matchedSlash) { + end = i; + break; + } + } else { + // We saw the first non-path separator + matchedSlash = false; + } + } + + if (end === -1) { + if (rootEnd === -1) + return '.'; + else + end = rootEnd; + } + return path.slice(0, end); +} + +module.exports = process.platform === 'win32' ? win32 : posix; +module.exports.posix = posix; +module.exports.win32 = win32; diff --git a/node_modules/path-dirname/license b/node_modules/path-dirname/license new file mode 100644 index 0000000..1981663 --- /dev/null +++ b/node_modules/path-dirname/license @@ -0,0 +1,22 @@ + +The MIT License (MIT) + +Copyright (c) Elan Shanker and Node.js contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/node_modules/path-dirname/package.json b/node_modules/path-dirname/package.json new file mode 100644 index 0000000..db15f5b --- /dev/null +++ b/node_modules/path-dirname/package.json @@ -0,0 +1,63 @@ +{ + "_from": "path-dirname@^1.0.0", + "_id": "path-dirname@1.0.2", + "_inBundle": false, + "_integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "_location": "/path-dirname", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "path-dirname@^1.0.0", + "name": "path-dirname", + "escapedName": "path-dirname", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/glob-parent" + ], + "_resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "_shasum": "cc33d24d525e099a5388c0336c6e32b9160609e0", + "_spec": "path-dirname@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/glob-parent", + "author": { + "name": "Elan Shanker" + }, + "bugs": { + "url": "https://github.com/es128/path-dirname/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Node.js path.dirname() ponyfill", + "files": [ + "index.js" + ], + "homepage": "https://github.com/es128/path-dirname#readme", + "keywords": [ + "dirname", + "dir", + "path", + "paths", + "file", + "built-in", + "util", + "utils", + "core", + "stdlib", + "ponyfill", + "polyfill", + "shim" + ], + "license": "MIT", + "name": "path-dirname", + "repository": { + "type": "git", + "url": "git+https://github.com/es128/path-dirname.git" + }, + "scripts": { + "test": "node test.js" + }, + "version": "1.0.2" +} diff --git a/node_modules/path-dirname/readme.md b/node_modules/path-dirname/readme.md new file mode 100644 index 0000000..652a562 --- /dev/null +++ b/node_modules/path-dirname/readme.md @@ -0,0 +1,53 @@ +# path-dirname [![Build Status](https://travis-ci.org/es128/path-dirname.svg?branch=master)](https://travis-ci.org/es128/path-dirname) + +> Node.js [`path.dirname()`](https://nodejs.org/api/path.html#path_path_dirname_path) [ponyfill](https://ponyfill.com) + +This was needed in order to expose `path.posix.dirname()` on Node.js v0.10 + +## Install + +``` +$ npm install --save path-dirname +``` + + +## Usage + +```js +const pathDirname = require('path-dirname'); + +pathDirname('/home/foo'); +//=> '/home' +pathDirname('C:\\Users\\foo'); +//=> 'C:\\Users' +pathDirname('foo'); +//=> '.' +pathDirname('foo/bar'); +//=> 'foo' + +//Using posix version for consistent output when dealing with glob escape chars +pathDirname.win32('C:\\Users\\foo/\\*bar'); +//=> 'C:\\Users\\foo/' +pathDirname.posix('C:\\Users\\foo/\\*bar'); +//=> 'C:\\Users\\foo' +``` + + +## API + +See the [`path.dirname()` docs](https://nodejs.org/api/path.html#path_path_dirname_path). + +### pathDirname(path) + +### pathDirname.posix(path) + +POSIX specific version. + +### pathDirname.win32(path) + +Windows specific version. + + +## License + +MIT diff --git a/node_modules/path-is-absolute/index.js b/node_modules/path-is-absolute/index.js new file mode 100644 index 0000000..22aa6c3 --- /dev/null +++ b/node_modules/path-is-absolute/index.js @@ -0,0 +1,20 @@ +'use strict'; + +function posix(path) { + return path.charAt(0) === '/'; +} + +function win32(path) { + // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + var result = splitDeviceRe.exec(path); + var device = result[1] || ''; + var isUnc = Boolean(device && device.charAt(1) !== ':'); + + // UNC paths are always absolute + return Boolean(result[2] || isUnc); +} + +module.exports = process.platform === 'win32' ? win32 : posix; +module.exports.posix = posix; +module.exports.win32 = win32; diff --git a/node_modules/path-is-absolute/license b/node_modules/path-is-absolute/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/path-is-absolute/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/path-is-absolute/package.json b/node_modules/path-is-absolute/package.json new file mode 100644 index 0000000..ac7a12f --- /dev/null +++ b/node_modules/path-is-absolute/package.json @@ -0,0 +1,75 @@ +{ + "_from": "path-is-absolute@^1.0.0", + "_id": "path-is-absolute@1.0.1", + "_inBundle": false, + "_integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "_location": "/path-is-absolute", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "path-is-absolute@^1.0.0", + "name": "path-is-absolute", + "escapedName": "path-is-absolute", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/chokidar" + ], + "_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "_shasum": "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f", + "_spec": "path-is-absolute@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/chokidar", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/path-is-absolute/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Node.js 0.12 path.isAbsolute() ponyfill", + "devDependencies": { + "xo": "^0.16.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/path-is-absolute#readme", + "keywords": [ + "path", + "paths", + "file", + "dir", + "absolute", + "isabsolute", + "is-absolute", + "built-in", + "util", + "utils", + "core", + "ponyfill", + "polyfill", + "shim", + "is", + "detect", + "check" + ], + "license": "MIT", + "name": "path-is-absolute", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/path-is-absolute.git" + }, + "scripts": { + "test": "xo && node test.js" + }, + "version": "1.0.1" +} diff --git a/node_modules/path-is-absolute/readme.md b/node_modules/path-is-absolute/readme.md new file mode 100644 index 0000000..8dbdf5f --- /dev/null +++ b/node_modules/path-is-absolute/readme.md @@ -0,0 +1,59 @@ +# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) + +> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com) + + +## Install + +``` +$ npm install --save path-is-absolute +``` + + +## Usage + +```js +const pathIsAbsolute = require('path-is-absolute'); + +// Running on Linux +pathIsAbsolute('/home/foo'); +//=> true +pathIsAbsolute('C:/Users/foo'); +//=> false + +// Running on Windows +pathIsAbsolute('C:/Users/foo'); +//=> true +pathIsAbsolute('/home/foo'); +//=> false + +// Running on any OS +pathIsAbsolute.posix('/home/foo'); +//=> true +pathIsAbsolute.posix('C:/Users/foo'); +//=> false +pathIsAbsolute.win32('C:/Users/foo'); +//=> true +pathIsAbsolute.win32('/home/foo'); +//=> false +``` + + +## API + +See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path). + +### pathIsAbsolute(path) + +### pathIsAbsolute.posix(path) + +POSIX specific version. + +### pathIsAbsolute.win32(path) + +Windows specific version. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/path-is-inside/LICENSE.txt b/node_modules/path-is-inside/LICENSE.txt new file mode 100644 index 0000000..0bdbb61 --- /dev/null +++ b/node_modules/path-is-inside/LICENSE.txt @@ -0,0 +1,47 @@ +Dual licensed under WTFPL and MIT: + +--- + +Copyright © 2013–2016 Domenic Denicola + +This work is free. You can redistribute it and/or modify it under the +terms of the Do What The Fuck You Want To Public License, Version 2, +as published by Sam Hocevar. See below for more details. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. + +--- + +The MIT License (MIT) + +Copyright © 2013–2016 Domenic Denicola + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/path-is-inside/lib/path-is-inside.js b/node_modules/path-is-inside/lib/path-is-inside.js new file mode 100644 index 0000000..596dfd3 --- /dev/null +++ b/node_modules/path-is-inside/lib/path-is-inside.js @@ -0,0 +1,28 @@ +"use strict"; + +var path = require("path"); + +module.exports = function (thePath, potentialParent) { + // For inside-directory checking, we want to allow trailing slashes, so normalize. + thePath = stripTrailingSep(thePath); + potentialParent = stripTrailingSep(potentialParent); + + // Node treats only Windows as case-insensitive in its path module; we follow those conventions. + if (process.platform === "win32") { + thePath = thePath.toLowerCase(); + potentialParent = potentialParent.toLowerCase(); + } + + return thePath.lastIndexOf(potentialParent, 0) === 0 && + ( + thePath[potentialParent.length] === path.sep || + thePath[potentialParent.length] === undefined + ); +}; + +function stripTrailingSep(thePath) { + if (thePath[thePath.length - 1] === path.sep) { + return thePath.slice(0, -1); + } + return thePath; +} diff --git a/node_modules/path-is-inside/package.json b/node_modules/path-is-inside/package.json new file mode 100644 index 0000000..2eba976 --- /dev/null +++ b/node_modules/path-is-inside/package.json @@ -0,0 +1,63 @@ +{ + "_from": "path-is-inside@^1.0.1", + "_id": "path-is-inside@1.0.2", + "_inBundle": false, + "_integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "_location": "/path-is-inside", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "path-is-inside@^1.0.1", + "name": "path-is-inside", + "escapedName": "path-is-inside", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/is-path-inside" + ], + "_resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "_shasum": "365417dede44430d1c11af61027facf074bdfc53", + "_spec": "path-is-inside@^1.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/is-path-inside", + "author": { + "name": "Domenic Denicola", + "email": "d@domenic.me", + "url": "https://domenic.me" + }, + "bugs": { + "url": "https://github.com/domenic/path-is-inside/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tests whether one path is inside another path", + "devDependencies": { + "jshint": "~2.3.0", + "mocha": "~1.15.1" + }, + "files": [ + "lib" + ], + "homepage": "https://github.com/domenic/path-is-inside#readme", + "keywords": [ + "path", + "directory", + "folder", + "inside", + "relative" + ], + "license": "(WTFPL OR MIT)", + "main": "lib/path-is-inside.js", + "name": "path-is-inside", + "repository": { + "type": "git", + "url": "git+https://github.com/domenic/path-is-inside.git" + }, + "scripts": { + "lint": "jshint lib", + "test": "mocha" + }, + "version": "1.0.2" +} diff --git a/node_modules/path-key/index.js b/node_modules/path-key/index.js new file mode 100644 index 0000000..62c8250 --- /dev/null +++ b/node_modules/path-key/index.js @@ -0,0 +1,13 @@ +'use strict'; +module.exports = opts => { + opts = opts || {}; + + const env = opts.env || process.env; + const platform = opts.platform || process.platform; + + if (platform !== 'win32') { + return 'PATH'; + } + + return Object.keys(env).find(x => x.toUpperCase() === 'PATH') || 'Path'; +}; diff --git a/node_modules/path-key/license b/node_modules/path-key/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/path-key/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/path-key/package.json b/node_modules/path-key/package.json new file mode 100644 index 0000000..0f573f3 --- /dev/null +++ b/node_modules/path-key/package.json @@ -0,0 +1,71 @@ +{ + "_from": "path-key@^2.0.0", + "_id": "path-key@2.0.1", + "_inBundle": false, + "_integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "_location": "/path-key", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "path-key@^2.0.0", + "name": "path-key", + "escapedName": "path-key", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/npm-run-path" + ], + "_resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "_shasum": "411cadb574c5a140d3a4b1910d40d80cc9f40b40", + "_spec": "path-key@^2.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/npm-run-path", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/path-key/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Get the PATH environment variable key cross-platform", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/path-key#readme", + "keywords": [ + "path", + "key", + "environment", + "env", + "variable", + "var", + "get", + "cross-platform", + "windows" + ], + "license": "MIT", + "name": "path-key", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/path-key.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "2.0.1", + "xo": { + "esnext": true + } +} diff --git a/node_modules/path-key/readme.md b/node_modules/path-key/readme.md new file mode 100644 index 0000000..cb5710a --- /dev/null +++ b/node_modules/path-key/readme.md @@ -0,0 +1,51 @@ +# path-key [![Build Status](https://travis-ci.org/sindresorhus/path-key.svg?branch=master)](https://travis-ci.org/sindresorhus/path-key) + +> Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform + +It's usually `PATH`, but on Windows it can be any casing like `Path`... + + +## Install + +``` +$ npm install --save path-key +``` + + +## Usage + +```js +const pathKey = require('path-key'); + +const key = pathKey(); +//=> 'PATH' + +const PATH = process.env[key]; +//=> '/usr/local/bin:/usr/bin:/bin' +``` + + +## API + +### pathKey([options]) + +#### options + +##### env + +Type: `Object`
+Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env) + +Use a custom environment variables object. + +#### platform + +Type: `string`
+Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform) + +Get the PATH key for a specific platform. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/path-parse/.travis.yml b/node_modules/path-parse/.travis.yml new file mode 100644 index 0000000..dae31da --- /dev/null +++ b/node_modules/path-parse/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - "0.12" + - "0.11" + - "0.10" + - "0.10.12" + - "0.8" + - "0.6" + - "iojs" diff --git a/node_modules/path-parse/README.md b/node_modules/path-parse/README.md new file mode 100644 index 0000000..c6af02c --- /dev/null +++ b/node_modules/path-parse/README.md @@ -0,0 +1,44 @@ +# path-parse [![Build Status](https://travis-ci.org/jbgutierrez/path-parse.svg?branch=master)](https://travis-ci.org/jbgutierrez/path-parse) + +> Node.js [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) ponyfill. + +> Ponyfill: A polyfill that doesn't overwrite the native method + +## Install + +``` +$ npm install --save path-parse +``` + +## Usage + +```js +var pathParse = require('path-parse'); + +pathParse('/home/user/dir/file.txt'); +//=> { +// root : "/", +// dir : "/home/user/dir", +// base : "file.txt", +// ext : ".txt", +// name : "file" +// } +``` + +## API + +See [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) docs. + +### pathParse(path) + +### pathParse.posix(path) + +The Posix specific version. + +### pathParse.win32(path) + +The Windows specific version. + +## License + +MIT © [Javier Blanco](http://jbgutierrez.info) diff --git a/node_modules/path-parse/index.js b/node_modules/path-parse/index.js new file mode 100644 index 0000000..3b7601f --- /dev/null +++ b/node_modules/path-parse/index.js @@ -0,0 +1,93 @@ +'use strict'; + +var isWindows = process.platform === 'win32'; + +// Regex to split a windows path into three parts: [*, device, slash, +// tail] windows-only +var splitDeviceRe = + /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + +// Regex to split the tail part of the above into [*, dir, basename, ext] +var splitTailRe = + /^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/; + +var win32 = {}; + +// Function to split a filename into [root, dir, basename, ext] +function win32SplitPath(filename) { + // Separate device+slash from tail + var result = splitDeviceRe.exec(filename), + device = (result[1] || '') + (result[2] || ''), + tail = result[3] || ''; + // Split the tail into dir, basename and extension + var result2 = splitTailRe.exec(tail), + dir = result2[1], + basename = result2[2], + ext = result2[3]; + return [device, dir, basename, ext]; +} + +win32.parse = function(pathString) { + if (typeof pathString !== 'string') { + throw new TypeError( + "Parameter 'pathString' must be a string, not " + typeof pathString + ); + } + var allParts = win32SplitPath(pathString); + if (!allParts || allParts.length !== 4) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + return { + root: allParts[0], + dir: allParts[0] + allParts[1].slice(0, -1), + base: allParts[2], + ext: allParts[3], + name: allParts[2].slice(0, allParts[2].length - allParts[3].length) + }; +}; + + + +// Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; +var posix = {}; + + +function posixSplitPath(filename) { + return splitPathRe.exec(filename).slice(1); +} + + +posix.parse = function(pathString) { + if (typeof pathString !== 'string') { + throw new TypeError( + "Parameter 'pathString' must be a string, not " + typeof pathString + ); + } + var allParts = posixSplitPath(pathString); + if (!allParts || allParts.length !== 4) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + allParts[1] = allParts[1] || ''; + allParts[2] = allParts[2] || ''; + allParts[3] = allParts[3] || ''; + + return { + root: allParts[0], + dir: allParts[0] + allParts[1].slice(0, -1), + base: allParts[2], + ext: allParts[3], + name: allParts[2].slice(0, allParts[2].length - allParts[3].length) + }; +}; + + +if (isWindows) + module.exports = win32.parse; +else /* posix */ + module.exports = posix.parse; + +module.exports.posix = posix.parse; +module.exports.win32 = win32.parse; diff --git a/node_modules/path-parse/index.min.js b/node_modules/path-parse/index.min.js new file mode 100644 index 0000000..027da51 --- /dev/null +++ b/node_modules/path-parse/index.min.js @@ -0,0 +1 @@ +"use strict";var isWindows=process.platform==="win32";var splitDeviceRe=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;var splitTailRe=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;var win32={};function win32SplitPath(b){var a=splitDeviceRe.exec(b),g=(a[1]||"")+(a[2]||""),e=a[3]||"";var d=splitTailRe.exec(e),c=d[1],h=d[2],f=d[3];return[g,c,h,f]}win32.parse=function(b){if(typeof b!=="string"){throw new TypeError("Parameter 'pathString' must be a string, not "+typeof b)}var a=win32SplitPath(b);if(!a||a.length!==4){throw new TypeError("Invalid path '"+b+"'")}return{root:a[0],dir:a[0]+a[1].slice(0,-1),base:a[2],ext:a[3],name:a[2].slice(0,a[2].length-a[3].length)}};var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var posix={};function posixSplitPath(a){return splitPathRe.exec(a).slice(1)}posix.parse=function(b){if(typeof b!=="string"){throw new TypeError("Parameter 'pathString' must be a string, not "+typeof b)}var a=posixSplitPath(b);if(!a||a.length!==4){throw new TypeError("Invalid path '"+b+"'")}a[1]=a[1]||"";a[2]=a[2]||"";a[3]=a[3]||"";return{root:a[0],dir:a[0]+a[1].slice(0,-1),base:a[2],ext:a[3],name:a[2].slice(0,a[2].length-a[3].length)}};if(isWindows){module.exports=win32.parse}else{module.exports=posix.parse}module.exports.posix=posix.parse;module.exports.win32=win32.parse; \ No newline at end of file diff --git a/node_modules/path-parse/package.json b/node_modules/path-parse/package.json new file mode 100644 index 0000000..f28c640 --- /dev/null +++ b/node_modules/path-parse/package.json @@ -0,0 +1,61 @@ +{ + "_from": "path-parse@^1.0.5", + "_id": "path-parse@1.0.5", + "_inBundle": false, + "_integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "_location": "/path-parse", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "path-parse@^1.0.5", + "name": "path-parse", + "escapedName": "path-parse", + "rawSpec": "^1.0.5", + "saveSpec": null, + "fetchSpec": "^1.0.5" + }, + "_requiredBy": [ + "/resolve" + ], + "_resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "_shasum": "3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1", + "_spec": "path-parse@^1.0.5", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/resolve", + "author": { + "name": "Javier Blanco", + "email": "http://jbgutierrez.info" + }, + "bugs": { + "url": "https://github.com/jbgutierrez/path-parse/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Node.js path.parse() ponyfill", + "homepage": "https://github.com/jbgutierrez/path-parse#readme", + "keywords": [ + "path", + "paths", + "file", + "dir", + "parse", + "built-in", + "util", + "utils", + "core", + "ponyfill", + "polyfill", + "shim" + ], + "license": "MIT", + "main": "index.js", + "name": "path-parse", + "repository": { + "type": "git", + "url": "git+https://github.com/jbgutierrez/path-parse.git" + }, + "scripts": { + "test": "node test.js" + }, + "version": "1.0.5" +} diff --git a/node_modules/path-parse/test.js b/node_modules/path-parse/test.js new file mode 100644 index 0000000..0b30c12 --- /dev/null +++ b/node_modules/path-parse/test.js @@ -0,0 +1,77 @@ +var assert = require('assert'); +var pathParse = require('./index'); + +var winParseTests = [ + [{ root: 'C:\\', dir: 'C:\\path\\dir', base: 'index.html', ext: '.html', name: 'index' }, 'C:\\path\\dir\\index.html'], + [{ root: 'C:\\', dir: 'C:\\another_path\\DIR\\1\\2\\33', base: 'index', ext: '', name: 'index' }, 'C:\\another_path\\DIR\\1\\2\\33\\index'], + [{ root: '', dir: 'another_path\\DIR with spaces\\1\\2\\33', base: 'index', ext: '', name: 'index' }, 'another_path\\DIR with spaces\\1\\2\\33\\index'], + [{ root: '\\', dir: '\\foo', base: 'C:', ext: '', name: 'C:' }, '\\foo\\C:'], + [{ root: '', dir: '', base: 'file', ext: '', name: 'file' }, 'file'], + [{ root: '', dir: '.', base: 'file', ext: '', name: 'file' }, '.\\file'], + + // unc + [{ root: '\\\\server\\share\\', dir: '\\\\server\\share\\', base: 'file_path', ext: '', name: 'file_path' }, '\\\\server\\share\\file_path'], + [{ root: '\\\\server two\\shared folder\\', dir: '\\\\server two\\shared folder\\', base: 'file path.zip', ext: '.zip', name: 'file path' }, '\\\\server two\\shared folder\\file path.zip'], + [{ root: '\\\\teela\\admin$\\', dir: '\\\\teela\\admin$\\', base: 'system32', ext: '', name: 'system32' }, '\\\\teela\\admin$\\system32'], + [{ root: '\\\\?\\UNC\\', dir: '\\\\?\\UNC\\server', base: 'share', ext: '', name: 'share' }, '\\\\?\\UNC\\server\\share'] +]; + +var winSpecialCaseFormatTests = [ + [{dir: 'some\\dir'}, 'some\\dir\\'], + [{base: 'index.html'}, 'index.html'], + [{}, ''] +]; + +var unixParseTests = [ + [{ root: '/', dir: '/home/user/dir', base: 'file.txt', ext: '.txt', name: 'file' }, '/home/user/dir/file.txt'], + [{ root: '/', dir: '/home/user/a dir', base: 'another File.zip', ext: '.zip', name: 'another File' }, '/home/user/a dir/another File.zip'], + [{ root: '/', dir: '/home/user/a dir/', base: 'another&File.', ext: '.', name: 'another&File' }, '/home/user/a dir//another&File.'], + [{ root: '/', dir: '/home/user/a$$$dir/', base: 'another File.zip', ext: '.zip', name: 'another File' }, '/home/user/a$$$dir//another File.zip'], + [{ root: '', dir: 'user/dir', base: 'another File.zip', ext: '.zip', name: 'another File' }, 'user/dir/another File.zip'], + [{ root: '', dir: '', base: 'file', ext: '', name: 'file' }, 'file'], + [{ root: '', dir: '', base: '.\\file', ext: '', name: '.\\file' }, '.\\file'], + [{ root: '', dir: '.', base: 'file', ext: '', name: 'file' }, './file'], + [{ root: '', dir: '', base: 'C:\\foo', ext: '', name: 'C:\\foo' }, 'C:\\foo'] +]; + +var unixSpecialCaseFormatTests = [ + [{dir: 'some/dir'}, 'some/dir/'], + [{base: 'index.html'}, 'index.html'], + [{}, ''] +]; + +var errors = [ + {input: null, message: /Parameter 'pathString' must be a string, not/}, + {input: {}, message: /Parameter 'pathString' must be a string, not object/}, + {input: true, message: /Parameter 'pathString' must be a string, not boolean/}, + {input: 1, message: /Parameter 'pathString' must be a string, not number/}, + {input: undefined, message: /Parameter 'pathString' must be a string, not undefined/}, +]; + +checkParseFormat(pathParse.win32, winParseTests); +checkParseFormat(pathParse.posix, unixParseTests); +checkErrors(pathParse.win32); +checkErrors(pathParse.posix); + +function checkErrors(parse) { + errors.forEach(function(errorCase) { + try { + parse(errorCase.input); + } catch(err) { + assert.ok(err instanceof TypeError); + assert.ok( + errorCase.message.test(err.message), + 'expected ' + errorCase.message + ' to match ' + err.message + ); + return; + } + + assert.fail('should have thrown'); + }); +} + +function checkParseFormat(parse, testCases) { + testCases.forEach(function(testCase) { + assert.deepEqual(parse(testCase[1]), testCase[0]); + }); +} diff --git a/node_modules/path-parse/test.min.js b/node_modules/path-parse/test.min.js new file mode 100644 index 0000000..90cc2b8 --- /dev/null +++ b/node_modules/path-parse/test.min.js @@ -0,0 +1 @@ +var assert=require("assert");var pathParse=require("./index");var winParseTests=[[{root:"C:\\",dir:"C:\\path\\dir",base:"index.html",ext:".html",name:"index"},"C:\\path\\dir\\index.html"],[{root:"C:\\",dir:"C:\\another_path\\DIR\\1\\2\\33",base:"index",ext:"",name:"index"},"C:\\another_path\\DIR\\1\\2\\33\\index"],[{root:"",dir:"another_path\\DIR with spaces\\1\\2\\33",base:"index",ext:"",name:"index"},"another_path\\DIR with spaces\\1\\2\\33\\index"],[{root:"\\",dir:"\\foo",base:"C:",ext:"",name:"C:"},"\\foo\\C:"],[{root:"",dir:"",base:"file",ext:"",name:"file"},"file"],[{root:"",dir:".",base:"file",ext:"",name:"file"},".\\file"],[{root:"\\\\server\\share\\",dir:"\\\\server\\share\\",base:"file_path",ext:"",name:"file_path"},"\\\\server\\share\\file_path"],[{root:"\\\\server two\\shared folder\\",dir:"\\\\server two\\shared folder\\",base:"file path.zip",ext:".zip",name:"file path"},"\\\\server two\\shared folder\\file path.zip"],[{root:"\\\\teela\\admin$\\",dir:"\\\\teela\\admin$\\",base:"system32",ext:"",name:"system32"},"\\\\teela\\admin$\\system32"],[{root:"\\\\?\\UNC\\",dir:"\\\\?\\UNC\\server",base:"share",ext:"",name:"share"},"\\\\?\\UNC\\server\\share"]];var winSpecialCaseFormatTests=[[{dir:"some\\dir"},"some\\dir\\"],[{base:"index.html"},"index.html"],[{},""]];var unixParseTests=[[{root:"/",dir:"/home/user/dir",base:"file.txt",ext:".txt",name:"file"},"/home/user/dir/file.txt"],[{root:"/",dir:"/home/user/a dir",base:"another File.zip",ext:".zip",name:"another File"},"/home/user/a dir/another File.zip"],[{root:"/",dir:"/home/user/a dir/",base:"another&File.",ext:".",name:"another&File"},"/home/user/a dir//another&File."],[{root:"/",dir:"/home/user/a$$$dir/",base:"another File.zip",ext:".zip",name:"another File"},"/home/user/a$$$dir//another File.zip"],[{root:"",dir:"user/dir",base:"another File.zip",ext:".zip",name:"another File"},"user/dir/another File.zip"],[{root:"",dir:"",base:"file",ext:"",name:"file"},"file"],[{root:"",dir:"",base:".\\file",ext:"",name:".\\file"},".\\file"],[{root:"",dir:".",base:"file",ext:"",name:"file"},"./file"],[{root:"",dir:"",base:"C:\\foo",ext:"",name:"C:\\foo"},"C:\\foo"]];var unixSpecialCaseFormatTests=[[{dir:"some/dir"},"some/dir/"],[{base:"index.html"},"index.html"],[{},""]];var errors=[{input:null,message:/Parameter 'pathString' must be a string, not/},{input:{},message:/Parameter 'pathString' must be a string, not object/},{input:true,message:/Parameter 'pathString' must be a string, not boolean/},{input:1,message:/Parameter 'pathString' must be a string, not number/},{input:undefined,message:/Parameter 'pathString' must be a string, not undefined/},];checkParseFormat(pathParse.win32,winParseTests);checkParseFormat(pathParse.posix,unixParseTests);checkErrors(pathParse.win32);checkErrors(pathParse.posix);function checkErrors(a){errors.forEach(function(c){try{a(c.input)}catch(b){assert.ok(b instanceof TypeError);assert.ok(c.message.test(b.message),"expected "+c.message+" to match "+b.message);return}assert.fail("should have thrown")})}function checkParseFormat(b,a){a.forEach(function(c){assert.deepEqual(b(c[1]),c[0])})}; \ No newline at end of file diff --git a/node_modules/path-to-regexp/History.md b/node_modules/path-to-regexp/History.md new file mode 100644 index 0000000..7f65878 --- /dev/null +++ b/node_modules/path-to-regexp/History.md @@ -0,0 +1,36 @@ +0.1.7 / 2015-07-28 +================== + + * Fixed regression with escaped round brackets and matching groups. + +0.1.6 / 2015-06-19 +================== + + * Replace `index` feature by outputting all parameters, unnamed and named. + +0.1.5 / 2015-05-08 +================== + + * Add an index property for position in match result. + +0.1.4 / 2015-03-05 +================== + + * Add license information + +0.1.3 / 2014-07-06 +================== + + * Better array support + * Improved support for trailing slash in non-ending mode + +0.1.0 / 2014-03-06 +================== + + * add options.end + +0.0.2 / 2013-02-10 +================== + + * Update to match current express + * add .license property to component.json diff --git a/node_modules/path-to-regexp/LICENSE b/node_modules/path-to-regexp/LICENSE new file mode 100644 index 0000000..983fbe8 --- /dev/null +++ b/node_modules/path-to-regexp/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/path-to-regexp/Readme.md b/node_modules/path-to-regexp/Readme.md new file mode 100644 index 0000000..95452a6 --- /dev/null +++ b/node_modules/path-to-regexp/Readme.md @@ -0,0 +1,35 @@ +# Path-to-RegExp + +Turn an Express-style path string such as `/user/:name` into a regular expression. + +**Note:** This is a legacy branch. You should upgrade to `1.x`. + +## Usage + +```javascript +var pathToRegexp = require('path-to-regexp'); +``` + +### pathToRegexp(path, keys, options) + + - **path** A string in the express format, an array of such strings, or a regular expression + - **keys** An array to be populated with the keys present in the url. Once the function completes, this will be an array of strings. + - **options** + - **options.sensitive** Defaults to false, set this to true to make routes case sensitive + - **options.strict** Defaults to false, set this to true to make the trailing slash matter. + - **options.end** Defaults to true, set this to false to only match the prefix of the URL. + +```javascript +var keys = []; +var exp = pathToRegexp('/foo/:bar', keys); +//keys = ['bar'] +//exp = /^\/foo\/(?:([^\/]+?))\/?$/i +``` + +## Live Demo + +You can see a live demo of this library in use at [express-route-tester](http://forbeslindesay.github.com/express-route-tester/). + +## License + + MIT diff --git a/node_modules/path-to-regexp/index.js b/node_modules/path-to-regexp/index.js new file mode 100644 index 0000000..500d1da --- /dev/null +++ b/node_modules/path-to-regexp/index.js @@ -0,0 +1,129 @@ +/** + * Expose `pathtoRegexp`. + */ + +module.exports = pathtoRegexp; + +/** + * Match matching groups in a regular expression. + */ +var MATCHING_GROUP_REGEXP = /\((?!\?)/g; + +/** + * Normalize the given path string, + * returning a regular expression. + * + * An empty array should be passed, + * which will contain the placeholder + * key names. For example "/user/:id" will + * then contain ["id"]. + * + * @param {String|RegExp|Array} path + * @param {Array} keys + * @param {Object} options + * @return {RegExp} + * @api private + */ + +function pathtoRegexp(path, keys, options) { + options = options || {}; + keys = keys || []; + var strict = options.strict; + var end = options.end !== false; + var flags = options.sensitive ? '' : 'i'; + var extraOffset = 0; + var keysOffset = keys.length; + var i = 0; + var name = 0; + var m; + + if (path instanceof RegExp) { + while (m = MATCHING_GROUP_REGEXP.exec(path.source)) { + keys.push({ + name: name++, + optional: false, + offset: m.index + }); + } + + return path; + } + + if (Array.isArray(path)) { + // Map array parts into regexps and return their source. We also pass + // the same keys and options instance into every generation to get + // consistent matching groups before we join the sources together. + path = path.map(function (value) { + return pathtoRegexp(value, keys, options).source; + }); + + return new RegExp('(?:' + path.join('|') + ')', flags); + } + + path = ('^' + path + (strict ? '' : path[path.length - 1] === '/' ? '?' : '/?')) + .replace(/\/\(/g, '/(?:') + .replace(/([\/\.])/g, '\\$1') + .replace(/(\\\/)?(\\\.)?:(\w+)(\(.*?\))?(\*)?(\?)?/g, function (match, slash, format, key, capture, star, optional, offset) { + slash = slash || ''; + format = format || ''; + capture = capture || '([^\\/' + format + ']+?)'; + optional = optional || ''; + + keys.push({ + name: key, + optional: !!optional, + offset: offset + extraOffset + }); + + var result = '' + + (optional ? '' : slash) + + '(?:' + + format + (optional ? slash : '') + capture + + (star ? '((?:[\\/' + format + '].+?)?)' : '') + + ')' + + optional; + + extraOffset += result.length - match.length; + + return result; + }) + .replace(/\*/g, function (star, index) { + var len = keys.length + + while (len-- > keysOffset && keys[len].offset > index) { + keys[len].offset += 3; // Replacement length minus asterisk length. + } + + return '(.*)'; + }); + + // This is a workaround for handling unnamed matching groups. + while (m = MATCHING_GROUP_REGEXP.exec(path)) { + var escapeCount = 0; + var index = m.index; + + while (path.charAt(--index) === '\\') { + escapeCount++; + } + + // It's possible to escape the bracket. + if (escapeCount % 2 === 1) { + continue; + } + + if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) { + keys.splice(keysOffset + i, 0, { + name: name++, // Unnamed matching groups must be consistently linear. + optional: false, + offset: m.index + }); + } + + i++; + } + + // If the path is non-ending, match until the end or a slash. + path += (end ? '$' : (path[path.length - 1] === '/' ? '' : '(?=\\/|$)')); + + return new RegExp(path, flags); +}; diff --git a/node_modules/path-to-regexp/package.json b/node_modules/path-to-regexp/package.json new file mode 100644 index 0000000..79e1d59 --- /dev/null +++ b/node_modules/path-to-regexp/package.json @@ -0,0 +1,59 @@ +{ + "_from": "path-to-regexp@0.1.7", + "_id": "path-to-regexp@0.1.7", + "_inBundle": false, + "_integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=", + "_location": "/path-to-regexp", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "path-to-regexp@0.1.7", + "name": "path-to-regexp", + "escapedName": "path-to-regexp", + "rawSpec": "0.1.7", + "saveSpec": null, + "fetchSpec": "0.1.7" + }, + "_requiredBy": [ + "/express" + ], + "_resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "_shasum": "df604178005f522f15eb4490e7247a1bfaa67f8c", + "_spec": "path-to-regexp@0.1.7", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/express", + "bugs": { + "url": "https://github.com/component/path-to-regexp/issues" + }, + "bundleDependencies": false, + "component": { + "scripts": { + "path-to-regexp": "index.js" + } + }, + "deprecated": false, + "description": "Express style path to RegExp utility", + "devDependencies": { + "istanbul": "^0.2.6", + "mocha": "^1.17.1" + }, + "files": [ + "index.js", + "LICENSE" + ], + "homepage": "https://github.com/component/path-to-regexp#readme", + "keywords": [ + "express", + "regexp" + ], + "license": "MIT", + "name": "path-to-regexp", + "repository": { + "type": "git", + "url": "git+https://github.com/component/path-to-regexp.git" + }, + "scripts": { + "test": "istanbul cover _mocha -- -R spec" + }, + "version": "0.1.7" +} diff --git a/node_modules/pause-stream/.npmignore b/node_modules/pause-stream/.npmignore new file mode 100644 index 0000000..13abef4 --- /dev/null +++ b/node_modules/pause-stream/.npmignore @@ -0,0 +1,3 @@ +node_modules +node_modules/* +npm_debug.log diff --git a/node_modules/pause-stream/LICENSE b/node_modules/pause-stream/LICENSE new file mode 100644 index 0000000..6a477d4 --- /dev/null +++ b/node_modules/pause-stream/LICENSE @@ -0,0 +1,231 @@ +Dual Licensed MIT and Apache 2 + +The MIT License + +Copyright (c) 2013 Dominic Tarr + +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. + + + ----------------------------------------------------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c) 2013 Dominic Tarr + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/node_modules/pause-stream/index.js b/node_modules/pause-stream/index.js new file mode 100644 index 0000000..0e0bf96 --- /dev/null +++ b/node_modules/pause-stream/index.js @@ -0,0 +1,3 @@ +//through@2 handles this by default! +module.exports = require('through') + diff --git a/node_modules/pause-stream/package.json b/node_modules/pause-stream/package.json new file mode 100644 index 0000000..9743ea9 --- /dev/null +++ b/node_modules/pause-stream/package.json @@ -0,0 +1,68 @@ +{ + "_from": "pause-stream@0.0.11", + "_id": "pause-stream@0.0.11", + "_inBundle": false, + "_integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", + "_location": "/pause-stream", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "pause-stream@0.0.11", + "name": "pause-stream", + "escapedName": "pause-stream", + "rawSpec": "0.0.11", + "saveSpec": null, + "fetchSpec": "0.0.11" + }, + "_requiredBy": [ + "/event-stream" + ], + "_resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "_shasum": "fe5a34b0cbce12b5aa6a2b403ee2e73b602f1445", + "_spec": "pause-stream@0.0.11", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/event-stream", + "author": { + "name": "Dominic Tarr", + "email": "dominic.tarr@gmail.com", + "url": "dominictarr.com" + }, + "bugs": { + "url": "https://github.com/dominictarr/pause-stream/issues" + }, + "bundleDependencies": false, + "dependencies": { + "through": "~2.3" + }, + "deprecated": false, + "description": "a ThroughStream that strictly buffers all readable events when paused.", + "devDependencies": { + "stream-spec": "~0.2.0", + "stream-tester": "0.0.2" + }, + "directories": { + "test": "test" + }, + "homepage": "https://github.com/dominictarr/pause-stream#readme", + "keywords": [ + "stream", + "pipe", + "pause", + "drain", + "buffer" + ], + "license": [ + "MIT", + "Apache2" + ], + "main": "index.js", + "name": "pause-stream", + "repository": { + "type": "git", + "url": "git://github.com/dominictarr/pause-stream.git" + }, + "scripts": { + "test": "node test/index.js && node test/pause-end.js" + }, + "version": "0.0.11" +} diff --git a/node_modules/pause-stream/readme.markdown b/node_modules/pause-stream/readme.markdown new file mode 100644 index 0000000..2366939 --- /dev/null +++ b/node_modules/pause-stream/readme.markdown @@ -0,0 +1,29 @@ +# PauseStream + +This is a `Stream` that will strictly buffer when paused. +Connect it to anything you need buffered. + +``` js + var ps = require('pause-stream')(); + + badlyBehavedStream.pipe(ps.pause()) + + aLittleLater(function (err, data) { + ps.pipe(createAnotherStream(data)) + ps.resume() + }) +``` + +`PauseStream` will buffer whenever paused. +it will buffer when yau have called `pause` manually. +but also when it's downstream `dest.write()===false`. +it will attempt to drain the buffer when you call resume +or the downstream emits `'drain'` + +`PauseStream` is tested using [stream-spec](https://github.com/dominictarr/stream-spec) +and [stream-tester](https://github.com/dominictarr/stream-tester) + +This is now the default case of +[through](https://github.com/dominictarr/through) + +https://github.com/dominictarr/pause-stream/commit/4a6fe3dc2c11091b1efbfde912e0473719ed9cc0 diff --git a/node_modules/pause-stream/test/index.js b/node_modules/pause-stream/test/index.js new file mode 100644 index 0000000..db8778d --- /dev/null +++ b/node_modules/pause-stream/test/index.js @@ -0,0 +1,17 @@ +var spec = require('stream-spec') +var tester = require('stream-tester') +var ps = require('..')() + +spec(ps) + .through({strict: false}) + .validateOnExit() + +var master = tester.createConsistent + +tester.createRandomStream(1000) //1k random numbers + .pipe(master = tester.createConsistentStream()) + .pipe(tester.createUnpauseStream()) + .pipe(ps) + .pipe(tester.createPauseStream()) + .pipe(master.createSlave()) + diff --git a/node_modules/pause-stream/test/pause-end.js b/node_modules/pause-stream/test/pause-end.js new file mode 100644 index 0000000..a6c27ef --- /dev/null +++ b/node_modules/pause-stream/test/pause-end.js @@ -0,0 +1,33 @@ + +var pause = require('..') +var assert = require('assert') + +var ps = pause() +var read = [], ended = false + +ps.on('data', function (i) { + read.push(i) +}) + +ps.on('end', function () { + ended = true +}) + +assert.deepEqual(read, []) + +ps.write(0) +ps.write(1) +ps.write(2) + +assert.deepEqual(read, [0, 1, 2]) + +ps.pause() + +assert.deepEqual(read, [0, 1, 2]) + +ps.end() +assert.equal(ended, false) +ps.resume() +assert.equal(ended, true) + + diff --git a/node_modules/pify/index.js b/node_modules/pify/index.js new file mode 100644 index 0000000..1dee43a --- /dev/null +++ b/node_modules/pify/index.js @@ -0,0 +1,84 @@ +'use strict'; + +const processFn = (fn, opts) => function () { + const P = opts.promiseModule; + const args = new Array(arguments.length); + + for (let i = 0; i < arguments.length; i++) { + args[i] = arguments[i]; + } + + return new P((resolve, reject) => { + if (opts.errorFirst) { + args.push(function (err, result) { + if (opts.multiArgs) { + const results = new Array(arguments.length - 1); + + for (let i = 1; i < arguments.length; i++) { + results[i - 1] = arguments[i]; + } + + if (err) { + results.unshift(err); + reject(results); + } else { + resolve(results); + } + } else if (err) { + reject(err); + } else { + resolve(result); + } + }); + } else { + args.push(function (result) { + if (opts.multiArgs) { + const results = new Array(arguments.length - 1); + + for (let i = 0; i < arguments.length; i++) { + results[i] = arguments[i]; + } + + resolve(results); + } else { + resolve(result); + } + }); + } + + fn.apply(this, args); + }); +}; + +module.exports = (obj, opts) => { + opts = Object.assign({ + exclude: [/.+(Sync|Stream)$/], + errorFirst: true, + promiseModule: Promise + }, opts); + + const filter = key => { + const match = pattern => typeof pattern === 'string' ? key === pattern : pattern.test(key); + return opts.include ? opts.include.some(match) : !opts.exclude.some(match); + }; + + let ret; + if (typeof obj === 'function') { + ret = function () { + if (opts.excludeMain) { + return obj.apply(this, arguments); + } + + return processFn(obj, opts).apply(this, arguments); + }; + } else { + ret = Object.create(Object.getPrototypeOf(obj)); + } + + for (const key in obj) { // eslint-disable-line guard-for-in + const x = obj[key]; + ret[key] = typeof x === 'function' && filter(key) ? processFn(x, opts) : x; + } + + return ret; +}; diff --git a/node_modules/pify/license b/node_modules/pify/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/pify/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/pify/package.json b/node_modules/pify/package.json new file mode 100644 index 0000000..127debe --- /dev/null +++ b/node_modules/pify/package.json @@ -0,0 +1,83 @@ +{ + "_from": "pify@^3.0.0", + "_id": "pify@3.0.0", + "_inBundle": false, + "_integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "_location": "/pify", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "pify@^3.0.0", + "name": "pify", + "escapedName": "pify", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/make-dir" + ], + "_resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "_shasum": "e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176", + "_spec": "pify@^3.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/make-dir", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/pify/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Promisify a callback-style function", + "devDependencies": { + "ava": "*", + "pinkie-promise": "^2.0.0", + "v8-natives": "^1.0.0", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/pify#readme", + "keywords": [ + "promise", + "promises", + "promisify", + "all", + "denodify", + "denodeify", + "callback", + "cb", + "node", + "then", + "thenify", + "convert", + "transform", + "wrap", + "wrapper", + "bind", + "to", + "async", + "await", + "es2015", + "bluebird" + ], + "license": "MIT", + "name": "pify", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/pify.git" + }, + "scripts": { + "optimization-test": "node --allow-natives-syntax optimization-test.js", + "test": "xo && ava && npm run optimization-test" + }, + "version": "3.0.0" +} diff --git a/node_modules/pify/readme.md b/node_modules/pify/readme.md new file mode 100644 index 0000000..376ca4e --- /dev/null +++ b/node_modules/pify/readme.md @@ -0,0 +1,131 @@ +# pify [![Build Status](https://travis-ci.org/sindresorhus/pify.svg?branch=master)](https://travis-ci.org/sindresorhus/pify) + +> Promisify a callback-style function + + +## Install + +``` +$ npm install --save pify +``` + + +## Usage + +```js +const fs = require('fs'); +const pify = require('pify'); + +// Promisify a single function +pify(fs.readFile)('package.json', 'utf8').then(data => { + console.log(JSON.parse(data).name); + //=> 'pify' +}); + +// Promisify all methods in a module +pify(fs).readFile('package.json', 'utf8').then(data => { + console.log(JSON.parse(data).name); + //=> 'pify' +}); +``` + + +## API + +### pify(input, [options]) + +Returns a `Promise` wrapped version of the supplied function or module. + +#### input + +Type: `Function` `Object` + +Callback-style function or module whose methods you want to promisify. + +#### options + +##### multiArgs + +Type: `boolean`
+Default: `false` + +By default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like `request` that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument. This also applies to rejections, where it returns an array of all the callback arguments, including the error. + +```js +const request = require('request'); +const pify = require('pify'); + +pify(request, {multiArgs: true})('https://sindresorhus.com').then(result => { + const [httpResponse, body] = result; +}); +``` + +##### include + +Type: `string[]` `RegExp[]` + +Methods in a module to promisify. Remaining methods will be left untouched. + +##### exclude + +Type: `string[]` `RegExp[]`
+Default: `[/.+(Sync|Stream)$/]` + +Methods in a module **not** to promisify. Methods with names ending with `'Sync'` are excluded by default. + +##### excludeMain + +Type: `boolean`
+Default: `false` + +If given module is a function itself, it will be promisified. Turn this option on if you want to promisify only methods of the module. + +```js +const pify = require('pify'); + +function fn() { + return true; +} + +fn.method = (data, callback) => { + setImmediate(() => { + callback(null, data); + }); +}; + +// Promisify methods but not `fn()` +const promiseFn = pify(fn, {excludeMain: true}); + +if (promiseFn()) { + promiseFn.method('hi').then(data => { + console.log(data); + }); +} +``` + +##### errorFirst + +Type: `boolean`
+Default: `true` + +Whether the callback has an error as the first argument. You'll want to set this to `false` if you're dealing with an API that doesn't have an error as the first argument, like `fs.exists()`, some browser APIs, Chrome Extension APIs, etc. + +##### promiseModule + +Type: `Function` + +Custom promise module to use instead of the native one. + +Check out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill. + + +## Related + +- [p-event](https://github.com/sindresorhus/p-event) - Promisify an event by waiting for it to be emitted +- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/posix-character-classes/LICENSE b/node_modules/posix-character-classes/LICENSE new file mode 100644 index 0000000..b11cb79 --- /dev/null +++ b/node_modules/posix-character-classes/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016-2017, 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/node_modules/posix-character-classes/README.md b/node_modules/posix-character-classes/README.md new file mode 100644 index 0000000..894ae23 --- /dev/null +++ b/node_modules/posix-character-classes/README.md @@ -0,0 +1,103 @@ +# posix-character-classes [![NPM version](https://img.shields.io/npm/v/posix-character-classes.svg?style=flat)](https://www.npmjs.com/package/posix-character-classes) [![NPM monthly downloads](https://img.shields.io/npm/dm/posix-character-classes.svg?style=flat)](https://npmjs.org/package/posix-character-classes) [![NPM total downloads](https://img.shields.io/npm/dt/posix-character-classes.svg?style=flat)](https://npmjs.org/package/posix-character-classes) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/posix-character-classes.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/posix-character-classes) + +> POSIX character classes for creating regular expressions. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save posix-character-classes +``` + +Install with [yarn](https://yarnpkg.com): + +```sh +$ yarn add posix-character-classes +``` + +## Usage + +```js +var posix = require('posix-character-classes'); +console.log(posix.alpha); +//=> 'A-Za-z' +``` + +## POSIX Character classes + +The POSIX standard supports the following classes or categories of charactersh (note that classes must be defined within brackets)[1]: + +| **POSIX class** | **Equivalent to** | **Matches** | +| --- | --- | --- | +| `[:alnum:]` | `[A-Za-z0-9]` | digits, uppercase and lowercase letters | +| `[:alpha:]` | `[A-Za-z]` | upper- and lowercase letters | +| `[:ascii:]` | `[\x00-\x7F]` | ASCII characters | +| `[:blank:]` | `[ \t]` | space and TAB characters only | +| `[:cntrl:]` | `[\x00-\x1F\x7F]` | Control characters | +| `[:digit:]` | `[0-9]` | digits | +| `[:graph:]` | `[^[:cntrl:]]` | graphic characters (all characters which have graphic representation) | +| `[:lower:]` | `[a-z]` | lowercase letters | +| `[:print:]` | `[[:graph] ]` | graphic characters and space | +| `[:punct:]` | ``[-!"#$%&'()*+,./:;<=>?@[]^_`{ | }~]`` | all punctuation characters (all graphic characters except letters and digits) | +| `[:space:]` | `[ \t\n\r\f\v]` | all blank (whitespace) characters, including spaces, tabs, new lines, carriage returns, form feeds, and vertical tabs | +| `[:upper:]` | `[A-Z]` | uppercase letters | +| `[:word:]` | `[A-Za-z0-9_]` | word characters | +| `[:xdigit:]` | `[0-9A-Fa-f]` | hexadecimal digits | + +## Examples + +* `a[[:digit:]]b` matches `a0b`, `a1b`, ..., `a9b`. +* `a[:digit:]b` is invalid, character classes must be enclosed in brackets +* `[[:digit:]abc]` matches any digit, as well as `a`, `b`, and `c`. +* `[abc[:digit:]]` is the same as the previous, matching any digit, as well as `a`, `b`, and `c` +* `[^ABZ[:lower:]]` matches any character except lowercase letters, `A`, `B`, and `Z`. + +## About + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 20, 2017._ + +
+
+
    +
  1. table and examples are based on the WikiBooks page for [Regular Expressions/POSIX Basic Regular Expressions](https://en.wikibooks.org/wiki/Regular_Expressions/POSIX_Basic_Regular_Expressions), which is available under the [Creative Commons Attribution-ShareAlike License](https://creativecommons.org/licenses/by-sa/3.0/). + +
  2. +
+
\ No newline at end of file diff --git a/node_modules/posix-character-classes/index.js b/node_modules/posix-character-classes/index.js new file mode 100644 index 0000000..19f1c98 --- /dev/null +++ b/node_modules/posix-character-classes/index.js @@ -0,0 +1,22 @@ +'use strict'; + +/** + * POSIX character classes + */ + +module.exports = { + alnum: 'a-zA-Z0-9', + alpha: 'a-zA-Z', + ascii: '\\x00-\\x7F', + blank: ' \\t', + cntrl: '\\x00-\\x1F\\x7F', + digit: '0-9', + graph: '\\x21-\\x7E', + lower: 'a-z', + print: '\\x20-\\x7E ', + punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', + space: ' \\t\\r\\n\\v\\f', + upper: 'A-Z', + word: 'A-Za-z0-9_', + xdigit: 'A-Fa-f0-9' +}; diff --git a/node_modules/posix-character-classes/package.json b/node_modules/posix-character-classes/package.json new file mode 100644 index 0000000..2d1cdd2 --- /dev/null +++ b/node_modules/posix-character-classes/package.json @@ -0,0 +1,85 @@ +{ + "_from": "posix-character-classes@^0.1.0", + "_id": "posix-character-classes@0.1.1", + "_inBundle": false, + "_integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "_location": "/posix-character-classes", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "posix-character-classes@^0.1.0", + "name": "posix-character-classes", + "escapedName": "posix-character-classes", + "rawSpec": "^0.1.0", + "saveSpec": null, + "fetchSpec": "^0.1.0" + }, + "_requiredBy": [ + "/expand-brackets" + ], + "_resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "_shasum": "01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab", + "_spec": "posix-character-classes@^0.1.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/expand-brackets", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/posix-character-classes/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "POSIX character classes for creating regular expressions.", + "devDependencies": { + "gulp-format-md": "^0.1.12", + "mocha": "^3.2.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/posix-character-classes", + "keywords": [ + "character", + "classes", + "posix" + ], + "license": "MIT", + "main": "index.js", + "name": "posix-character-classes", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/posix-character-classes.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "reflinks": [ + "verb", + "verb-generate-readme" + ], + "lint": { + "reflinks": true + }, + "related-list": [ + "micromatch", + "nanomatch", + "extglob", + "expand-brackets" + ] + }, + "version": "0.1.1" +} diff --git a/node_modules/prepend-http/index.js b/node_modules/prepend-http/index.js new file mode 100644 index 0000000..60f532a --- /dev/null +++ b/node_modules/prepend-http/index.js @@ -0,0 +1,14 @@ +'use strict'; +module.exports = function (url) { + if (typeof url !== 'string') { + throw new TypeError('Expected a string, got ' + typeof url); + } + + url = url.trim(); + + if (/^\.*\/|^(?!localhost)\w+:/.test(url)) { + return url; + } + + return url.replace(/^(?!(?:\w+:)?\/\/)/, 'http://'); +}; diff --git a/node_modules/prepend-http/license b/node_modules/prepend-http/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/prepend-http/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/prepend-http/package.json b/node_modules/prepend-http/package.json new file mode 100644 index 0000000..f541b94 --- /dev/null +++ b/node_modules/prepend-http/package.json @@ -0,0 +1,67 @@ +{ + "_from": "prepend-http@^1.0.1", + "_id": "prepend-http@1.0.4", + "_inBundle": false, + "_integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "_location": "/prepend-http", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "prepend-http@^1.0.1", + "name": "prepend-http", + "escapedName": "prepend-http", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/url-parse-lax" + ], + "_resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "_shasum": "d4f4562b0ce3696e41ac52d0e002e57a635dc6dc", + "_spec": "prepend-http@^1.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/url-parse-lax", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/prepend-http/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Prepend `http://` to humanized URLs like todomvc.com and localhost", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/prepend-http#readme", + "keywords": [ + "prepend", + "protocol", + "scheme", + "url", + "uri", + "http", + "https", + "humanized" + ], + "license": "MIT", + "name": "prepend-http", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/prepend-http.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.0.4" +} diff --git a/node_modules/prepend-http/readme.md b/node_modules/prepend-http/readme.md new file mode 100644 index 0000000..df7557e --- /dev/null +++ b/node_modules/prepend-http/readme.md @@ -0,0 +1,31 @@ +# prepend-http [![Build Status](https://travis-ci.org/sindresorhus/prepend-http.svg?branch=master)](https://travis-ci.org/sindresorhus/prepend-http) + +> Prepend `http://` to humanized URLs like `todomvc.com` and `localhost` + + +## Install + +``` +$ npm install --save prepend-http +``` + + +## Usage + +```js +const prependHttp = require('prepend-http'); + +prependHttp('todomvc.com'); +//=> 'http://todomvc.com' + +prependHttp('localhost'); +//=> 'http://localhost' + +prependHttp('http://todomvc.com'); +//=> 'http://todomvc.com' +``` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/process-nextick-args/index.js b/node_modules/process-nextick-args/index.js new file mode 100644 index 0000000..5f585e8 --- /dev/null +++ b/node_modules/process-nextick-args/index.js @@ -0,0 +1,44 @@ +'use strict'; + +if (!process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = { nextTick: nextTick }; +} else { + module.exports = process +} + +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); + } +} + diff --git a/node_modules/process-nextick-args/license.md b/node_modules/process-nextick-args/license.md new file mode 100644 index 0000000..c67e353 --- /dev/null +++ b/node_modules/process-nextick-args/license.md @@ -0,0 +1,19 @@ +# Copyright (c) 2015 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/node_modules/process-nextick-args/package.json b/node_modules/process-nextick-args/package.json new file mode 100644 index 0000000..0f46a8b --- /dev/null +++ b/node_modules/process-nextick-args/package.json @@ -0,0 +1,50 @@ +{ + "_from": "process-nextick-args@~2.0.0", + "_id": "process-nextick-args@2.0.0", + "_inBundle": false, + "_integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "_location": "/process-nextick-args", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "process-nextick-args@~2.0.0", + "name": "process-nextick-args", + "escapedName": "process-nextick-args", + "rawSpec": "~2.0.0", + "saveSpec": null, + "fetchSpec": "~2.0.0" + }, + "_requiredBy": [ + "/readable-stream" + ], + "_resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "_shasum": "a37d732f4271b4ab1ad070d35508e8290788ffaa", + "_spec": "process-nextick-args@~2.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/readable-stream", + "author": "", + "bugs": { + "url": "https://github.com/calvinmetcalf/process-nextick-args/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "process.nextTick but always with args", + "devDependencies": { + "tap": "~0.2.6" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/calvinmetcalf/process-nextick-args", + "license": "MIT", + "main": "index.js", + "name": "process-nextick-args", + "repository": { + "type": "git", + "url": "git+https://github.com/calvinmetcalf/process-nextick-args.git" + }, + "scripts": { + "test": "node test.js" + }, + "version": "2.0.0" +} diff --git a/node_modules/process-nextick-args/readme.md b/node_modules/process-nextick-args/readme.md new file mode 100644 index 0000000..ecb432c --- /dev/null +++ b/node_modules/process-nextick-args/readme.md @@ -0,0 +1,18 @@ +process-nextick-args +===== + +[![Build Status](https://travis-ci.org/calvinmetcalf/process-nextick-args.svg?branch=master)](https://travis-ci.org/calvinmetcalf/process-nextick-args) + +```bash +npm install --save process-nextick-args +``` + +Always be able to pass arguments to process.nextTick, no matter the platform + +```js +var pna = require('process-nextick-args'); + +pna.nextTick(function (a, b, c) { + console.log(a, b, c); +}, 'step', 3, 'profit'); +``` diff --git a/node_modules/promise/.jshintrc b/node_modules/promise/.jshintrc new file mode 100644 index 0000000..47c256f --- /dev/null +++ b/node_modules/promise/.jshintrc @@ -0,0 +1,5 @@ +{ + "asi": true, + "node": true, + "strict": true +} diff --git a/node_modules/promise/.npmignore b/node_modules/promise/.npmignore new file mode 100644 index 0000000..ad5be4a --- /dev/null +++ b/node_modules/promise/.npmignore @@ -0,0 +1,7 @@ +components +node_modules +test +.gitignore +.travis.yml +component.json +coverage diff --git a/node_modules/promise/LICENSE b/node_modules/promise/LICENSE new file mode 100644 index 0000000..7a1f763 --- /dev/null +++ b/node_modules/promise/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 Forbes Lindesay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/promise/Readme.md b/node_modules/promise/Readme.md new file mode 100644 index 0000000..9e281a7 --- /dev/null +++ b/node_modules/promise/Readme.md @@ -0,0 +1,231 @@ + +# promise + +This is a simple implementation of Promises. It is a super set of ES6 Promises designed to have readable, performant code and to provide just the extensions that are absolutely necessary for using promises today. + +For detailed tutorials on its use, see www.promisejs.org + +**N.B.** This promise exposes internals via underscore (`_`) prefixed properties. If you use these, your code will break with each new release. + +[![travis][travis-image]][travis-url] +[![dep][dep-image]][dep-url] +[![npm][npm-image]][npm-url] +[![downloads][downloads-image]][downloads-url] + +[travis-image]: https://img.shields.io/travis/then/promise.svg?style=flat +[travis-url]: https://travis-ci.org/then/promise +[dep-image]: https://img.shields.io/david/then/promise.svg?style=flat +[dep-url]: https://david-dm.org/then/promise +[npm-image]: https://img.shields.io/npm/v/promise.svg?style=flat +[npm-url]: https://npmjs.org/package/promise +[downloads-image]: https://img.shields.io/npm/dm/promise.svg?style=flat +[downloads-url]: https://npmjs.org/package/promise + +## Installation + +**Server:** + + $ npm install promise + +**Client:** + +You can use browserify on the client, or use the pre-compiled script that acts as a polyfill. + +```html + +``` + +Note that the [es5-shim](https://github.com/es-shims/es5-shim) must be loaded before this library to support browsers pre IE9. + +```html + +``` + +## Usage + +The example below shows how you can load the promise library (in a way that works on both client and server using node or browserify). It then demonstrates creating a promise from scratch. You simply call `new Promise(fn)`. There is a complete specification for what is returned by this method in [Promises/A+](http://promises-aplus.github.com/promises-spec/). + +```javascript +var Promise = require('promise'); + +var promise = new Promise(function (resolve, reject) { + get('http://www.google.com', function (err, res) { + if (err) reject(err); + else resolve(res); + }); +}); +``` + +If you need [domains](https://iojs.org/api/domain.html) support, you should instead use: + +```js +var Promise = require('promise/domains'); +``` + +If you are in an environment that implements `setImmediate` and don't want the optimisations provided by asap, you can use: + +```js +var Promise = require('promise/setimmediate'); +``` + +If you only want part of the features, e.g. just a pure ES6 polyfill: + +```js +var Promise = require('promise/lib/es6-extensions'); +// or require('promise/domains/es6-extensions'); +// or require('promise/setimmediate/es6-extensions'); +``` + +## Unhandled Rejections + +By default, promises silence any unhandled rejections. + +You can enable logging of unhandled ReferenceErrors and TypeErrors via: + +```js +require('promise/lib/rejection-tracking').enable(); +``` + +Due to the performance cost, you should only do this during development. + +You can enable logging of all unhandled rejections if you need to debug an exception you think is being swallowed by promises: + +```js +require('promise/lib/rejection-tracking').enable( + {allRejections: true} +); +``` + +Due to the high probability of false positives, I only recommend using this when debugging specific issues that you think may be being swallowed. For the preferred debugging method, see `Promise#done(onFulfilled, onRejected)`. + +`rejection-tracking.enable(options)` takes the following options: + + - allRejections (`boolean`) - track all exceptions, not just reference errors and type errors. Note that this has a high probability of resulting in false positives if your code loads data optimisticly + - whitelist (`Array`) - this defaults to `[ReferenceError, TypeError]` but you can override it with your own list of error constructors to track. + - `onUnhandled(id, error)` and `onHandled(id, error)` - you can use these to provide your own customised display for errors. Note that if possible you should indicate that the error was a false positive if `onHandled` is called. `onHandled` is only called if `onUnhandled` has already been called. + +To reduce the chance of false-positives there is a delay of up to 2 seconds before errors are logged. This means that if you attach an error handler within 2 seconds, it won't be logged as a false positive. ReferenceErrors and TypeErrors are only subject to a 100ms delay due to the higher likelihood that the error is due to programmer error. + +## API + +Before all examples, you will need: + +```js +var Promise = require('promise'); +``` + +### new Promise(resolver) + +This creates and returns a new promise. `resolver` must be a function. The `resolver` function is passed two arguments: + + 1. `resolve` should be called with a single argument. If it is called with a non-promise value then the promise is fulfilled with that value. If it is called with a promise (A) then the returned promise takes on the state of that new promise (A). + 2. `reject` should be called with a single argument. The returned promise will be rejected with that argument. + +### Static Functions + + These methods are invoked by calling `Promise.methodName`. + +#### Promise.resolve(value) + +(deprecated aliases: `Promise.from(value)`, `Promise.cast(value)`) + +Converts values and foreign promises into Promises/A+ promises. If you pass it a value then it returns a Promise for that value. If you pass it something that is close to a promise (such as a jQuery attempt at a promise) it returns a Promise that takes on the state of `value` (rejected or fulfilled). + +#### Promise.reject(value) + +Returns a rejected promise with the given value. + +#### Promise.all(array) + +Returns a promise for an array. If it is called with a single argument that `Array.isArray` then this returns a promise for a copy of that array with any promises replaced by their fulfilled values. e.g. + +```js +Promise.all([Promise.resolve('a'), 'b', Promise.resolve('c')]) + .then(function (res) { + assert(res[0] === 'a') + assert(res[1] === 'b') + assert(res[2] === 'c') + }) +``` + +#### Promise.denodeify(fn) + +_Non Standard_ + +Takes a function which accepts a node style callback and returns a new function that returns a promise instead. + +e.g. + +```javascript +var fs = require('fs') + +var read = Promise.denodeify(fs.readFile) +var write = Promise.denodeify(fs.writeFile) + +var p = read('foo.json', 'utf8') + .then(function (str) { + return write('foo.json', JSON.stringify(JSON.parse(str), null, ' '), 'utf8') + }) +``` + +#### Promise.nodeify(fn) + +_Non Standard_ + +The twin to `denodeify` is useful when you want to export an API that can be used by people who haven't learnt about the brilliance of promises yet. + +```javascript +module.exports = Promise.nodeify(awesomeAPI) +function awesomeAPI(a, b) { + return download(a, b) +} +``` + +If the last argument passed to `module.exports` is a function, then it will be treated like a node.js callback and not parsed on to the child function, otherwise the API will just return a promise. + +### Prototype Methods + +These methods are invoked on a promise instance by calling `myPromise.methodName` + +### Promise#then(onFulfilled, onRejected) + +This method follows the [Promises/A+ spec](http://promises-aplus.github.io/promises-spec/). It explains things very clearly so I recommend you read it. + +Either `onFulfilled` or `onRejected` will be called and they will not be called more than once. They will be passed a single argument and will always be called asynchronously (in the next turn of the event loop). + +If the promise is fulfilled then `onFulfilled` is called. If the promise is rejected then `onRejected` is called. + +The call to `.then` also returns a promise. If the handler that is called returns a promise, the promise returned by `.then` takes on the state of that returned promise. If the handler that is called returns a value that is not a promise, the promise returned by `.then` will be fulfilled with that value. If the handler that is called throws an exception then the promise returned by `.then` is rejected with that exception. + +#### Promise#catch(onRejected) + +Sugar for `Promise#then(null, onRejected)`, to mirror `catch` in synchronous code. + +#### Promise#done(onFulfilled, onRejected) + +_Non Standard_ + +The same semantics as `.then` except that it does not return a promise and any exceptions are re-thrown so that they can be logged (crashing the application in non-browser environments) + +#### Promise#nodeify(callback) + +_Non Standard_ + +If `callback` is `null` or `undefined` it just returns `this`. If `callback` is a function it is called with rejection reason as the first argument and result as the second argument (as per the node.js convention). + +This lets you write API functions that look like: + +```javascript +function awesomeAPI(foo, bar, callback) { + return internalAPI(foo, bar) + .then(parseResult) + .then(null, retryErrors) + .nodeify(callback) +} +``` + +People who use typical node.js style callbacks will be able to just pass a callback and get the expected behavior. The enlightened people can not pass a callback and will get awesome promises. + +## License + + MIT diff --git a/node_modules/promise/build.js b/node_modules/promise/build.js new file mode 100644 index 0000000..1e028e9 --- /dev/null +++ b/node_modules/promise/build.js @@ -0,0 +1,69 @@ +'use strict'; + +var fs = require('fs'); +var rimraf = require('rimraf'); +var acorn = require('acorn'); +var walk = require('acorn/dist/walk'); + +var ids = []; +var names = {}; + +function getIdFor(name) { + if (name in names) return names[name]; + var id; + do { + id = '_' + Math.floor(Math.random() * 100); + } while (ids.indexOf(id) !== -1) + ids.push(id); + names[name] = id; + return id; +} + +function fixup(src) { + var ast = acorn.parse(src); + src = src.split(''); + walk.simple(ast, { + MemberExpression: function (node) { + if (node.computed) return; + if (node.property.type !== 'Identifier') return; + if (node.property.name[0] !== '_') return; + replace(node.property, getIdFor(node.property.name)); + } + }); + function source(node) { + return src.slice(node.start, node.end).join(''); + } + function replace(node, str) { + for (var i = node.start; i < node.end; i++) { + src[i] = ''; + } + src[node.start] = str; + } + return src.join(''); +} +rimraf.sync(__dirname + '/lib/'); +fs.mkdirSync(__dirname + '/lib/'); +fs.readdirSync(__dirname + '/src').forEach(function (filename) { + var src = fs.readFileSync(__dirname + '/src/' + filename, 'utf8'); + var out = fixup(src); + fs.writeFileSync(__dirname + '/lib/' + filename, out); +}); + +rimraf.sync(__dirname + '/domains/'); +fs.mkdirSync(__dirname + '/domains/'); +fs.readdirSync(__dirname + '/src').forEach(function (filename) { + var src = fs.readFileSync(__dirname + '/src/' + filename, 'utf8'); + var out = fixup(src); + out = out.replace(/require\(\'asap\/raw\'\)/g, "require('asap')"); + fs.writeFileSync(__dirname + '/domains/' + filename, out); +}); + +rimraf.sync(__dirname + '/setimmediate/'); +fs.mkdirSync(__dirname + '/setimmediate/'); +fs.readdirSync(__dirname + '/src').forEach(function (filename) { + var src = fs.readFileSync(__dirname + '/src/' + filename, 'utf8'); + var out = fixup(src); + out = out.replace(/var asap \= require\(\'([a-z\/]+)\'\);/g, ''); + out = out.replace(/asap/g, "setImmediate"); + fs.writeFileSync(__dirname + '/setimmediate/' + filename, out); +}); diff --git a/node_modules/promise/core.js b/node_modules/promise/core.js new file mode 100644 index 0000000..5f332a2 --- /dev/null +++ b/node_modules/promise/core.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = require('./lib/core.js'); + +console.error('require("promise/core") is deprecated, use require("promise/lib/core") instead.'); diff --git a/node_modules/promise/domains/core.js b/node_modules/promise/domains/core.js new file mode 100644 index 0000000..aea4414 --- /dev/null +++ b/node_modules/promise/domains/core.js @@ -0,0 +1,213 @@ +'use strict'; + +var asap = require('asap'); + +function noop() {} + +// States: +// +// 0 - pending +// 1 - fulfilled with _value +// 2 - rejected with _value +// 3 - adopted the state of another promise, _value +// +// once the state is no longer pending (0) it is immutable + +// All `_` prefixed properties will be reduced to `_{random number}` +// at build time to obfuscate them and discourage their use. +// We don't use symbols or Object.defineProperty to fully hide them +// because the performance isn't good enough. + + +// to avoid using try/catch inside critical functions, we +// extract them to here. +var LAST_ERROR = null; +var IS_ERROR = {}; +function getThen(obj) { + try { + return obj.then; + } catch (ex) { + LAST_ERROR = ex; + return IS_ERROR; + } +} + +function tryCallOne(fn, a) { + try { + return fn(a); + } catch (ex) { + LAST_ERROR = ex; + return IS_ERROR; + } +} +function tryCallTwo(fn, a, b) { + try { + fn(a, b); + } catch (ex) { + LAST_ERROR = ex; + return IS_ERROR; + } +} + +module.exports = Promise; + +function Promise(fn) { + if (typeof this !== 'object') { + throw new TypeError('Promises must be constructed via new'); + } + if (typeof fn !== 'function') { + throw new TypeError('Promise constructor\'s argument is not a function'); + } + this._40 = 0; + this._65 = 0; + this._55 = null; + this._72 = null; + if (fn === noop) return; + doResolve(fn, this); +} +Promise._37 = null; +Promise._87 = null; +Promise._61 = noop; + +Promise.prototype.then = function(onFulfilled, onRejected) { + if (this.constructor !== Promise) { + return safeThen(this, onFulfilled, onRejected); + } + var res = new Promise(noop); + handle(this, new Handler(onFulfilled, onRejected, res)); + return res; +}; + +function safeThen(self, onFulfilled, onRejected) { + return new self.constructor(function (resolve, reject) { + var res = new Promise(noop); + res.then(resolve, reject); + handle(self, new Handler(onFulfilled, onRejected, res)); + }); +} +function handle(self, deferred) { + while (self._65 === 3) { + self = self._55; + } + if (Promise._37) { + Promise._37(self); + } + if (self._65 === 0) { + if (self._40 === 0) { + self._40 = 1; + self._72 = deferred; + return; + } + if (self._40 === 1) { + self._40 = 2; + self._72 = [self._72, deferred]; + return; + } + self._72.push(deferred); + return; + } + handleResolved(self, deferred); +} + +function handleResolved(self, deferred) { + asap(function() { + var cb = self._65 === 1 ? deferred.onFulfilled : deferred.onRejected; + if (cb === null) { + if (self._65 === 1) { + resolve(deferred.promise, self._55); + } else { + reject(deferred.promise, self._55); + } + return; + } + var ret = tryCallOne(cb, self._55); + if (ret === IS_ERROR) { + reject(deferred.promise, LAST_ERROR); + } else { + resolve(deferred.promise, ret); + } + }); +} +function resolve(self, newValue) { + // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure + if (newValue === self) { + return reject( + self, + new TypeError('A promise cannot be resolved with itself.') + ); + } + if ( + newValue && + (typeof newValue === 'object' || typeof newValue === 'function') + ) { + var then = getThen(newValue); + if (then === IS_ERROR) { + return reject(self, LAST_ERROR); + } + if ( + then === self.then && + newValue instanceof Promise + ) { + self._65 = 3; + self._55 = newValue; + finale(self); + return; + } else if (typeof then === 'function') { + doResolve(then.bind(newValue), self); + return; + } + } + self._65 = 1; + self._55 = newValue; + finale(self); +} + +function reject(self, newValue) { + self._65 = 2; + self._55 = newValue; + if (Promise._87) { + Promise._87(self, newValue); + } + finale(self); +} +function finale(self) { + if (self._40 === 1) { + handle(self, self._72); + self._72 = null; + } + if (self._40 === 2) { + for (var i = 0; i < self._72.length; i++) { + handle(self, self._72[i]); + } + self._72 = null; + } +} + +function Handler(onFulfilled, onRejected, promise){ + this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; + this.onRejected = typeof onRejected === 'function' ? onRejected : null; + this.promise = promise; +} + +/** + * Take a potentially misbehaving resolver function and make sure + * onFulfilled and onRejected are only called once. + * + * Makes no guarantees about asynchrony. + */ +function doResolve(fn, promise) { + var done = false; + var res = tryCallTwo(fn, function (value) { + if (done) return; + done = true; + resolve(promise, value); + }, function (reason) { + if (done) return; + done = true; + reject(promise, reason); + }); + if (!done && res === IS_ERROR) { + done = true; + reject(promise, LAST_ERROR); + } +} diff --git a/node_modules/promise/domains/done.js b/node_modules/promise/domains/done.js new file mode 100644 index 0000000..f879317 --- /dev/null +++ b/node_modules/promise/domains/done.js @@ -0,0 +1,13 @@ +'use strict'; + +var Promise = require('./core.js'); + +module.exports = Promise; +Promise.prototype.done = function (onFulfilled, onRejected) { + var self = arguments.length ? this.then.apply(this, arguments) : this; + self.then(null, function (err) { + setTimeout(function () { + throw err; + }, 0); + }); +}; diff --git a/node_modules/promise/domains/es6-extensions.js b/node_modules/promise/domains/es6-extensions.js new file mode 100644 index 0000000..8ab2666 --- /dev/null +++ b/node_modules/promise/domains/es6-extensions.js @@ -0,0 +1,107 @@ +'use strict'; + +//This file contains the ES6 extensions to the core Promises/A+ API + +var Promise = require('./core.js'); + +module.exports = Promise; + +/* Static Functions */ + +var TRUE = valuePromise(true); +var FALSE = valuePromise(false); +var NULL = valuePromise(null); +var UNDEFINED = valuePromise(undefined); +var ZERO = valuePromise(0); +var EMPTYSTRING = valuePromise(''); + +function valuePromise(value) { + var p = new Promise(Promise._61); + p._65 = 1; + p._55 = value; + return p; +} +Promise.resolve = function (value) { + if (value instanceof Promise) return value; + + if (value === null) return NULL; + if (value === undefined) return UNDEFINED; + if (value === true) return TRUE; + if (value === false) return FALSE; + if (value === 0) return ZERO; + if (value === '') return EMPTYSTRING; + + if (typeof value === 'object' || typeof value === 'function') { + try { + var then = value.then; + if (typeof then === 'function') { + return new Promise(then.bind(value)); + } + } catch (ex) { + return new Promise(function (resolve, reject) { + reject(ex); + }); + } + } + return valuePromise(value); +}; + +Promise.all = function (arr) { + var args = Array.prototype.slice.call(arr); + + return new Promise(function (resolve, reject) { + if (args.length === 0) return resolve([]); + var remaining = args.length; + function res(i, val) { + if (val && (typeof val === 'object' || typeof val === 'function')) { + if (val instanceof Promise && val.then === Promise.prototype.then) { + while (val._65 === 3) { + val = val._55; + } + if (val._65 === 1) return res(i, val._55); + if (val._65 === 2) reject(val._55); + val.then(function (val) { + res(i, val); + }, reject); + return; + } else { + var then = val.then; + if (typeof then === 'function') { + var p = new Promise(then.bind(val)); + p.then(function (val) { + res(i, val); + }, reject); + return; + } + } + } + args[i] = val; + if (--remaining === 0) { + resolve(args); + } + } + for (var i = 0; i < args.length; i++) { + res(i, args[i]); + } + }); +}; + +Promise.reject = function (value) { + return new Promise(function (resolve, reject) { + reject(value); + }); +}; + +Promise.race = function (values) { + return new Promise(function (resolve, reject) { + values.forEach(function(value){ + Promise.resolve(value).then(resolve, reject); + }); + }); +}; + +/* Prototype Methods */ + +Promise.prototype['catch'] = function (onRejected) { + return this.then(null, onRejected); +}; diff --git a/node_modules/promise/domains/finally.js b/node_modules/promise/domains/finally.js new file mode 100644 index 0000000..f5ee0b9 --- /dev/null +++ b/node_modules/promise/domains/finally.js @@ -0,0 +1,16 @@ +'use strict'; + +var Promise = require('./core.js'); + +module.exports = Promise; +Promise.prototype['finally'] = function (f) { + return this.then(function (value) { + return Promise.resolve(f()).then(function () { + return value; + }); + }, function (err) { + return Promise.resolve(f()).then(function () { + throw err; + }); + }); +}; diff --git a/node_modules/promise/domains/index.js b/node_modules/promise/domains/index.js new file mode 100644 index 0000000..6e674f3 --- /dev/null +++ b/node_modules/promise/domains/index.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = require('./core.js'); +require('./done.js'); +require('./finally.js'); +require('./es6-extensions.js'); +require('./node-extensions.js'); +require('./synchronous.js'); diff --git a/node_modules/promise/domains/node-extensions.js b/node_modules/promise/domains/node-extensions.js new file mode 100644 index 0000000..157cddc --- /dev/null +++ b/node_modules/promise/domains/node-extensions.js @@ -0,0 +1,130 @@ +'use strict'; + +// This file contains then/promise specific extensions that are only useful +// for node.js interop + +var Promise = require('./core.js'); +var asap = require('asap'); + +module.exports = Promise; + +/* Static Functions */ + +Promise.denodeify = function (fn, argumentCount) { + if ( + typeof argumentCount === 'number' && argumentCount !== Infinity + ) { + return denodeifyWithCount(fn, argumentCount); + } else { + return denodeifyWithoutCount(fn); + } +}; + +var callbackFn = ( + 'function (err, res) {' + + 'if (err) { rj(err); } else { rs(res); }' + + '}' +); +function denodeifyWithCount(fn, argumentCount) { + var args = []; + for (var i = 0; i < argumentCount; i++) { + args.push('a' + i); + } + var body = [ + 'return function (' + args.join(',') + ') {', + 'var self = this;', + 'return new Promise(function (rs, rj) {', + 'var res = fn.call(', + ['self'].concat(args).concat([callbackFn]).join(','), + ');', + 'if (res &&', + '(typeof res === "object" || typeof res === "function") &&', + 'typeof res.then === "function"', + ') {rs(res);}', + '});', + '};' + ].join(''); + return Function(['Promise', 'fn'], body)(Promise, fn); +} +function denodeifyWithoutCount(fn) { + var fnLength = Math.max(fn.length - 1, 3); + var args = []; + for (var i = 0; i < fnLength; i++) { + args.push('a' + i); + } + var body = [ + 'return function (' + args.join(',') + ') {', + 'var self = this;', + 'var args;', + 'var argLength = arguments.length;', + 'if (arguments.length > ' + fnLength + ') {', + 'args = new Array(arguments.length + 1);', + 'for (var i = 0; i < arguments.length; i++) {', + 'args[i] = arguments[i];', + '}', + '}', + 'return new Promise(function (rs, rj) {', + 'var cb = ' + callbackFn + ';', + 'var res;', + 'switch (argLength) {', + args.concat(['extra']).map(function (_, index) { + return ( + 'case ' + (index) + ':' + + 'res = fn.call(' + ['self'].concat(args.slice(0, index)).concat('cb').join(',') + ');' + + 'break;' + ); + }).join(''), + 'default:', + 'args[argLength] = cb;', + 'res = fn.apply(self, args);', + '}', + + 'if (res &&', + '(typeof res === "object" || typeof res === "function") &&', + 'typeof res.then === "function"', + ') {rs(res);}', + '});', + '};' + ].join(''); + + return Function( + ['Promise', 'fn'], + body + )(Promise, fn); +} + +Promise.nodeify = function (fn) { + return function () { + var args = Array.prototype.slice.call(arguments); + var callback = + typeof args[args.length - 1] === 'function' ? args.pop() : null; + var ctx = this; + try { + return fn.apply(this, arguments).nodeify(callback, ctx); + } catch (ex) { + if (callback === null || typeof callback == 'undefined') { + return new Promise(function (resolve, reject) { + reject(ex); + }); + } else { + asap(function () { + callback.call(ctx, ex); + }) + } + } + } +}; + +Promise.prototype.nodeify = function (callback, ctx) { + if (typeof callback != 'function') return this; + + this.then(function (value) { + asap(function () { + callback.call(ctx, null, value); + }); + }, function (err) { + asap(function () { + callback.call(ctx, err); + }); + }); +}; diff --git a/node_modules/promise/domains/rejection-tracking.js b/node_modules/promise/domains/rejection-tracking.js new file mode 100644 index 0000000..10ccce3 --- /dev/null +++ b/node_modules/promise/domains/rejection-tracking.js @@ -0,0 +1,113 @@ +'use strict'; + +var Promise = require('./core'); + +var DEFAULT_WHITELIST = [ + ReferenceError, + TypeError, + RangeError +]; + +var enabled = false; +exports.disable = disable; +function disable() { + enabled = false; + Promise._37 = null; + Promise._87 = null; +} + +exports.enable = enable; +function enable(options) { + options = options || {}; + if (enabled) disable(); + enabled = true; + var id = 0; + var displayId = 0; + var rejections = {}; + Promise._37 = function (promise) { + if ( + promise._65 === 2 && // IS REJECTED + rejections[promise._51] + ) { + if (rejections[promise._51].logged) { + onHandled(promise._51); + } else { + clearTimeout(rejections[promise._51].timeout); + } + delete rejections[promise._51]; + } + }; + Promise._87 = function (promise, err) { + if (promise._40 === 0) { // not yet handled + promise._51 = id++; + rejections[promise._51] = { + displayId: null, + error: err, + timeout: setTimeout( + onUnhandled.bind(null, promise._51), + // For reference errors and type errors, this almost always + // means the programmer made a mistake, so log them after just + // 100ms + // otherwise, wait 2 seconds to see if they get handled + matchWhitelist(err, DEFAULT_WHITELIST) + ? 100 + : 2000 + ), + logged: false + }; + } + }; + function onUnhandled(id) { + if ( + options.allRejections || + matchWhitelist( + rejections[id].error, + options.whitelist || DEFAULT_WHITELIST + ) + ) { + rejections[id].displayId = displayId++; + if (options.onUnhandled) { + rejections[id].logged = true; + options.onUnhandled( + rejections[id].displayId, + rejections[id].error + ); + } else { + rejections[id].logged = true; + logError( + rejections[id].displayId, + rejections[id].error + ); + } + } + } + function onHandled(id) { + if (rejections[id].logged) { + if (options.onHandled) { + options.onHandled(rejections[id].displayId, rejections[id].error); + } else if (!rejections[id].onUnhandled) { + console.warn( + 'Promise Rejection Handled (id: ' + rejections[id].displayId + '):' + ); + console.warn( + ' This means you can ignore any previous messages of the form "Possible Unhandled Promise Rejection" with id ' + + rejections[id].displayId + '.' + ); + } + } + } +} + +function logError(id, error) { + console.warn('Possible Unhandled Promise Rejection (id: ' + id + '):'); + var errStr = (error && (error.stack || error)) + ''; + errStr.split('\n').forEach(function (line) { + console.warn(' ' + line); + }); +} + +function matchWhitelist(error, list) { + return list.some(function (cls) { + return error instanceof cls; + }); +} \ No newline at end of file diff --git a/node_modules/promise/domains/synchronous.js b/node_modules/promise/domains/synchronous.js new file mode 100644 index 0000000..4939964 --- /dev/null +++ b/node_modules/promise/domains/synchronous.js @@ -0,0 +1,62 @@ +'use strict'; + +var Promise = require('./core.js'); + +module.exports = Promise; +Promise.enableSynchronous = function () { + Promise.prototype.isPending = function() { + return this.getState() == 0; + }; + + Promise.prototype.isFulfilled = function() { + return this.getState() == 1; + }; + + Promise.prototype.isRejected = function() { + return this.getState() == 2; + }; + + Promise.prototype.getValue = function () { + if (this._65 === 3) { + return this._55.getValue(); + } + + if (!this.isFulfilled()) { + throw new Error('Cannot get a value of an unfulfilled promise.'); + } + + return this._55; + }; + + Promise.prototype.getReason = function () { + if (this._65 === 3) { + return this._55.getReason(); + } + + if (!this.isRejected()) { + throw new Error('Cannot get a rejection reason of a non-rejected promise.'); + } + + return this._55; + }; + + Promise.prototype.getState = function () { + if (this._65 === 3) { + return this._55.getState(); + } + if (this._65 === -1 || this._65 === -2) { + return 0; + } + + return this._65; + }; +}; + +Promise.disableSynchronous = function() { + Promise.prototype.isPending = undefined; + Promise.prototype.isFulfilled = undefined; + Promise.prototype.isRejected = undefined; + Promise.prototype.getValue = undefined; + Promise.prototype.getReason = undefined; + Promise.prototype.getState = undefined; +}; diff --git a/node_modules/promise/index.d.ts b/node_modules/promise/index.d.ts new file mode 100644 index 0000000..a199cbc --- /dev/null +++ b/node_modules/promise/index.d.ts @@ -0,0 +1,256 @@ +interface Thenable { + /** + * Attaches callbacks for the resolution and/or rejection of the ThenPromise. + * @param onfulfilled The callback to execute when the ThenPromise is resolved. + * @param onrejected The callback to execute when the ThenPromise is rejected. + * @returns A ThenPromise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | Thenable) | undefined | null, onrejected?: ((reason: any) => TResult2 | Thenable) | undefined | null): Thenable; +} + +/** + * Represents the completion of an asynchronous operation + */ +interface ThenPromise { + /** + * Attaches callbacks for the resolution and/or rejection of the ThenPromise. + * @param onfulfilled The callback to execute when the ThenPromise is resolved. + * @param onrejected The callback to execute when the ThenPromise is rejected. + * @returns A ThenPromise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | Thenable) | undefined | null, onrejected?: ((reason: any) => TResult2 | Thenable) | undefined | null): ThenPromise; + + /** + * Attaches a callback for only the rejection of the ThenPromise. + * @param onrejected The callback to execute when the ThenPromise is rejected. + * @returns A ThenPromise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | Thenable) | undefined | null): ThenPromise; + + // Extensions specific to then/promise + + /** + * Attaches callbacks for the resolution and/or rejection of the ThenPromise, without returning a new promise. + * @param onfulfilled The callback to execute when the ThenPromise is resolved. + * @param onrejected The callback to execute when the ThenPromise is rejected. + */ + done(onfulfilled?: ((value: T) => any) | undefined | null, onrejected?: ((reason: any) => any) | undefined | null): void; + + + /** + * Calls a node.js style callback. If none is provided, the promise is returned. + */ + nodeify(callback: void | null): ThenPromise; + nodeify(callback: (err: Error, value: T) => void): void; +} + +interface ThenPromiseConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: ThenPromise; + + /** + * Creates a new ThenPromise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | Thenable) => void, reject: (reason?: any) => void) => any): ThenPromise; + + /** + * Creates a ThenPromise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any ThenPromise is rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable, T10 | Thenable]): ThenPromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + + /** + * Creates a ThenPromise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any ThenPromise is rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable]): ThenPromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + + /** + * Creates a ThenPromise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any ThenPromise is rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable]): ThenPromise<[T1, T2, T3, T4, T5, T6, T7, T8]>; + + /** + * Creates a ThenPromise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any ThenPromise is rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable]): ThenPromise<[T1, T2, T3, T4, T5, T6, T7]>; + + /** + * Creates a ThenPromise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any ThenPromise is rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable]): ThenPromise<[T1, T2, T3, T4, T5, T6]>; + + /** + * Creates a ThenPromise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any ThenPromise is rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable]): ThenPromise<[T1, T2, T3, T4, T5]>; + + /** + * Creates a ThenPromise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any ThenPromise is rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable ]): ThenPromise<[T1, T2, T3, T4]>; + + /** + * Creates a ThenPromise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any ThenPromise is rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable]): ThenPromise<[T1, T2, T3]>; + + /** + * Creates a ThenPromise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any ThenPromise is rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + all(values: [T1 | Thenable, T2 | Thenable]): ThenPromise<[T1, T2]>; + + /** + * Creates a ThenPromise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any ThenPromise is rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + all(values: (T | Thenable)[]): ThenPromise; + + /** + * Creates a ThenPromise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + race(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable, T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable, T10 | Thenable]): ThenPromise; + + /** + * Creates a ThenPromise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + race(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable, T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable]): ThenPromise; + + /** + * Creates a ThenPromise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + race(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable, T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable]): ThenPromise; + + /** + * Creates a ThenPromise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + race(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable, T5 | Thenable, T6 | Thenable, T7 | Thenable]): ThenPromise; + + /** + * Creates a ThenPromise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + race(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable, T5 | Thenable, T6 | Thenable]): ThenPromise; + + /** + * Creates a ThenPromise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + race(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable, T5 | Thenable]): ThenPromise; + + /** + * Creates a ThenPromise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + race(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable]): ThenPromise; + + /** + * Creates a ThenPromise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + race(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable]): ThenPromise; + + /** + * Creates a ThenPromise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + race(values: [T1 | Thenable, T2 | Thenable]): ThenPromise; + + /** + * Creates a ThenPromise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new ThenPromise. + */ + race(values: (T | Thenable)[]): ThenPromise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected ThenPromise. + */ + reject(reason: any): ThenPromise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected ThenPromise. + */ + reject(reason: any): ThenPromise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | Thenable): ThenPromise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): ThenPromise; + + // Extensions specific to then/promise + + denodeify: (fn: Function) => (...args: any[]) => ThenPromise; + nodeify: (fn: Function) => Function; +} + +declare var ThenPromise: ThenPromiseConstructor; + +export = ThenPromise; \ No newline at end of file diff --git a/node_modules/promise/index.js b/node_modules/promise/index.js new file mode 100644 index 0000000..1c38e46 --- /dev/null +++ b/node_modules/promise/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib') diff --git a/node_modules/promise/lib/core.js b/node_modules/promise/lib/core.js new file mode 100644 index 0000000..aefc987 --- /dev/null +++ b/node_modules/promise/lib/core.js @@ -0,0 +1,213 @@ +'use strict'; + +var asap = require('asap/raw'); + +function noop() {} + +// States: +// +// 0 - pending +// 1 - fulfilled with _value +// 2 - rejected with _value +// 3 - adopted the state of another promise, _value +// +// once the state is no longer pending (0) it is immutable + +// All `_` prefixed properties will be reduced to `_{random number}` +// at build time to obfuscate them and discourage their use. +// We don't use symbols or Object.defineProperty to fully hide them +// because the performance isn't good enough. + + +// to avoid using try/catch inside critical functions, we +// extract them to here. +var LAST_ERROR = null; +var IS_ERROR = {}; +function getThen(obj) { + try { + return obj.then; + } catch (ex) { + LAST_ERROR = ex; + return IS_ERROR; + } +} + +function tryCallOne(fn, a) { + try { + return fn(a); + } catch (ex) { + LAST_ERROR = ex; + return IS_ERROR; + } +} +function tryCallTwo(fn, a, b) { + try { + fn(a, b); + } catch (ex) { + LAST_ERROR = ex; + return IS_ERROR; + } +} + +module.exports = Promise; + +function Promise(fn) { + if (typeof this !== 'object') { + throw new TypeError('Promises must be constructed via new'); + } + if (typeof fn !== 'function') { + throw new TypeError('Promise constructor\'s argument is not a function'); + } + this._40 = 0; + this._65 = 0; + this._55 = null; + this._72 = null; + if (fn === noop) return; + doResolve(fn, this); +} +Promise._37 = null; +Promise._87 = null; +Promise._61 = noop; + +Promise.prototype.then = function(onFulfilled, onRejected) { + if (this.constructor !== Promise) { + return safeThen(this, onFulfilled, onRejected); + } + var res = new Promise(noop); + handle(this, new Handler(onFulfilled, onRejected, res)); + return res; +}; + +function safeThen(self, onFulfilled, onRejected) { + return new self.constructor(function (resolve, reject) { + var res = new Promise(noop); + res.then(resolve, reject); + handle(self, new Handler(onFulfilled, onRejected, res)); + }); +} +function handle(self, deferred) { + while (self._65 === 3) { + self = self._55; + } + if (Promise._37) { + Promise._37(self); + } + if (self._65 === 0) { + if (self._40 === 0) { + self._40 = 1; + self._72 = deferred; + return; + } + if (self._40 === 1) { + self._40 = 2; + self._72 = [self._72, deferred]; + return; + } + self._72.push(deferred); + return; + } + handleResolved(self, deferred); +} + +function handleResolved(self, deferred) { + asap(function() { + var cb = self._65 === 1 ? deferred.onFulfilled : deferred.onRejected; + if (cb === null) { + if (self._65 === 1) { + resolve(deferred.promise, self._55); + } else { + reject(deferred.promise, self._55); + } + return; + } + var ret = tryCallOne(cb, self._55); + if (ret === IS_ERROR) { + reject(deferred.promise, LAST_ERROR); + } else { + resolve(deferred.promise, ret); + } + }); +} +function resolve(self, newValue) { + // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure + if (newValue === self) { + return reject( + self, + new TypeError('A promise cannot be resolved with itself.') + ); + } + if ( + newValue && + (typeof newValue === 'object' || typeof newValue === 'function') + ) { + var then = getThen(newValue); + if (then === IS_ERROR) { + return reject(self, LAST_ERROR); + } + if ( + then === self.then && + newValue instanceof Promise + ) { + self._65 = 3; + self._55 = newValue; + finale(self); + return; + } else if (typeof then === 'function') { + doResolve(then.bind(newValue), self); + return; + } + } + self._65 = 1; + self._55 = newValue; + finale(self); +} + +function reject(self, newValue) { + self._65 = 2; + self._55 = newValue; + if (Promise._87) { + Promise._87(self, newValue); + } + finale(self); +} +function finale(self) { + if (self._40 === 1) { + handle(self, self._72); + self._72 = null; + } + if (self._40 === 2) { + for (var i = 0; i < self._72.length; i++) { + handle(self, self._72[i]); + } + self._72 = null; + } +} + +function Handler(onFulfilled, onRejected, promise){ + this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; + this.onRejected = typeof onRejected === 'function' ? onRejected : null; + this.promise = promise; +} + +/** + * Take a potentially misbehaving resolver function and make sure + * onFulfilled and onRejected are only called once. + * + * Makes no guarantees about asynchrony. + */ +function doResolve(fn, promise) { + var done = false; + var res = tryCallTwo(fn, function (value) { + if (done) return; + done = true; + resolve(promise, value); + }, function (reason) { + if (done) return; + done = true; + reject(promise, reason); + }); + if (!done && res === IS_ERROR) { + done = true; + reject(promise, LAST_ERROR); + } +} diff --git a/node_modules/promise/lib/done.js b/node_modules/promise/lib/done.js new file mode 100644 index 0000000..f879317 --- /dev/null +++ b/node_modules/promise/lib/done.js @@ -0,0 +1,13 @@ +'use strict'; + +var Promise = require('./core.js'); + +module.exports = Promise; +Promise.prototype.done = function (onFulfilled, onRejected) { + var self = arguments.length ? this.then.apply(this, arguments) : this; + self.then(null, function (err) { + setTimeout(function () { + throw err; + }, 0); + }); +}; diff --git a/node_modules/promise/lib/es6-extensions.js b/node_modules/promise/lib/es6-extensions.js new file mode 100644 index 0000000..8ab2666 --- /dev/null +++ b/node_modules/promise/lib/es6-extensions.js @@ -0,0 +1,107 @@ +'use strict'; + +//This file contains the ES6 extensions to the core Promises/A+ API + +var Promise = require('./core.js'); + +module.exports = Promise; + +/* Static Functions */ + +var TRUE = valuePromise(true); +var FALSE = valuePromise(false); +var NULL = valuePromise(null); +var UNDEFINED = valuePromise(undefined); +var ZERO = valuePromise(0); +var EMPTYSTRING = valuePromise(''); + +function valuePromise(value) { + var p = new Promise(Promise._61); + p._65 = 1; + p._55 = value; + return p; +} +Promise.resolve = function (value) { + if (value instanceof Promise) return value; + + if (value === null) return NULL; + if (value === undefined) return UNDEFINED; + if (value === true) return TRUE; + if (value === false) return FALSE; + if (value === 0) return ZERO; + if (value === '') return EMPTYSTRING; + + if (typeof value === 'object' || typeof value === 'function') { + try { + var then = value.then; + if (typeof then === 'function') { + return new Promise(then.bind(value)); + } + } catch (ex) { + return new Promise(function (resolve, reject) { + reject(ex); + }); + } + } + return valuePromise(value); +}; + +Promise.all = function (arr) { + var args = Array.prototype.slice.call(arr); + + return new Promise(function (resolve, reject) { + if (args.length === 0) return resolve([]); + var remaining = args.length; + function res(i, val) { + if (val && (typeof val === 'object' || typeof val === 'function')) { + if (val instanceof Promise && val.then === Promise.prototype.then) { + while (val._65 === 3) { + val = val._55; + } + if (val._65 === 1) return res(i, val._55); + if (val._65 === 2) reject(val._55); + val.then(function (val) { + res(i, val); + }, reject); + return; + } else { + var then = val.then; + if (typeof then === 'function') { + var p = new Promise(then.bind(val)); + p.then(function (val) { + res(i, val); + }, reject); + return; + } + } + } + args[i] = val; + if (--remaining === 0) { + resolve(args); + } + } + for (var i = 0; i < args.length; i++) { + res(i, args[i]); + } + }); +}; + +Promise.reject = function (value) { + return new Promise(function (resolve, reject) { + reject(value); + }); +}; + +Promise.race = function (values) { + return new Promise(function (resolve, reject) { + values.forEach(function(value){ + Promise.resolve(value).then(resolve, reject); + }); + }); +}; + +/* Prototype Methods */ + +Promise.prototype['catch'] = function (onRejected) { + return this.then(null, onRejected); +}; diff --git a/node_modules/promise/lib/finally.js b/node_modules/promise/lib/finally.js new file mode 100644 index 0000000..f5ee0b9 --- /dev/null +++ b/node_modules/promise/lib/finally.js @@ -0,0 +1,16 @@ +'use strict'; + +var Promise = require('./core.js'); + +module.exports = Promise; +Promise.prototype['finally'] = function (f) { + return this.then(function (value) { + return Promise.resolve(f()).then(function () { + return value; + }); + }, function (err) { + return Promise.resolve(f()).then(function () { + throw err; + }); + }); +}; diff --git a/node_modules/promise/lib/index.js b/node_modules/promise/lib/index.js new file mode 100644 index 0000000..6e674f3 --- /dev/null +++ b/node_modules/promise/lib/index.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = require('./core.js'); +require('./done.js'); +require('./finally.js'); +require('./es6-extensions.js'); +require('./node-extensions.js'); +require('./synchronous.js'); diff --git a/node_modules/promise/lib/node-extensions.js b/node_modules/promise/lib/node-extensions.js new file mode 100644 index 0000000..157cddc --- /dev/null +++ b/node_modules/promise/lib/node-extensions.js @@ -0,0 +1,130 @@ +'use strict'; + +// This file contains then/promise specific extensions that are only useful +// for node.js interop + +var Promise = require('./core.js'); +var asap = require('asap'); + +module.exports = Promise; + +/* Static Functions */ + +Promise.denodeify = function (fn, argumentCount) { + if ( + typeof argumentCount === 'number' && argumentCount !== Infinity + ) { + return denodeifyWithCount(fn, argumentCount); + } else { + return denodeifyWithoutCount(fn); + } +}; + +var callbackFn = ( + 'function (err, res) {' + + 'if (err) { rj(err); } else { rs(res); }' + + '}' +); +function denodeifyWithCount(fn, argumentCount) { + var args = []; + for (var i = 0; i < argumentCount; i++) { + args.push('a' + i); + } + var body = [ + 'return function (' + args.join(',') + ') {', + 'var self = this;', + 'return new Promise(function (rs, rj) {', + 'var res = fn.call(', + ['self'].concat(args).concat([callbackFn]).join(','), + ');', + 'if (res &&', + '(typeof res === "object" || typeof res === "function") &&', + 'typeof res.then === "function"', + ') {rs(res);}', + '});', + '};' + ].join(''); + return Function(['Promise', 'fn'], body)(Promise, fn); +} +function denodeifyWithoutCount(fn) { + var fnLength = Math.max(fn.length - 1, 3); + var args = []; + for (var i = 0; i < fnLength; i++) { + args.push('a' + i); + } + var body = [ + 'return function (' + args.join(',') + ') {', + 'var self = this;', + 'var args;', + 'var argLength = arguments.length;', + 'if (arguments.length > ' + fnLength + ') {', + 'args = new Array(arguments.length + 1);', + 'for (var i = 0; i < arguments.length; i++) {', + 'args[i] = arguments[i];', + '}', + '}', + 'return new Promise(function (rs, rj) {', + 'var cb = ' + callbackFn + ';', + 'var res;', + 'switch (argLength) {', + args.concat(['extra']).map(function (_, index) { + return ( + 'case ' + (index) + ':' + + 'res = fn.call(' + ['self'].concat(args.slice(0, index)).concat('cb').join(',') + ');' + + 'break;' + ); + }).join(''), + 'default:', + 'args[argLength] = cb;', + 'res = fn.apply(self, args);', + '}', + + 'if (res &&', + '(typeof res === "object" || typeof res === "function") &&', + 'typeof res.then === "function"', + ') {rs(res);}', + '});', + '};' + ].join(''); + + return Function( + ['Promise', 'fn'], + body + )(Promise, fn); +} + +Promise.nodeify = function (fn) { + return function () { + var args = Array.prototype.slice.call(arguments); + var callback = + typeof args[args.length - 1] === 'function' ? args.pop() : null; + var ctx = this; + try { + return fn.apply(this, arguments).nodeify(callback, ctx); + } catch (ex) { + if (callback === null || typeof callback == 'undefined') { + return new Promise(function (resolve, reject) { + reject(ex); + }); + } else { + asap(function () { + callback.call(ctx, ex); + }) + } + } + } +}; + +Promise.prototype.nodeify = function (callback, ctx) { + if (typeof callback != 'function') return this; + + this.then(function (value) { + asap(function () { + callback.call(ctx, null, value); + }); + }, function (err) { + asap(function () { + callback.call(ctx, err); + }); + }); +}; diff --git a/node_modules/promise/lib/rejection-tracking.js b/node_modules/promise/lib/rejection-tracking.js new file mode 100644 index 0000000..10ccce3 --- /dev/null +++ b/node_modules/promise/lib/rejection-tracking.js @@ -0,0 +1,113 @@ +'use strict'; + +var Promise = require('./core'); + +var DEFAULT_WHITELIST = [ + ReferenceError, + TypeError, + RangeError +]; + +var enabled = false; +exports.disable = disable; +function disable() { + enabled = false; + Promise._37 = null; + Promise._87 = null; +} + +exports.enable = enable; +function enable(options) { + options = options || {}; + if (enabled) disable(); + enabled = true; + var id = 0; + var displayId = 0; + var rejections = {}; + Promise._37 = function (promise) { + if ( + promise._65 === 2 && // IS REJECTED + rejections[promise._51] + ) { + if (rejections[promise._51].logged) { + onHandled(promise._51); + } else { + clearTimeout(rejections[promise._51].timeout); + } + delete rejections[promise._51]; + } + }; + Promise._87 = function (promise, err) { + if (promise._40 === 0) { // not yet handled + promise._51 = id++; + rejections[promise._51] = { + displayId: null, + error: err, + timeout: setTimeout( + onUnhandled.bind(null, promise._51), + // For reference errors and type errors, this almost always + // means the programmer made a mistake, so log them after just + // 100ms + // otherwise, wait 2 seconds to see if they get handled + matchWhitelist(err, DEFAULT_WHITELIST) + ? 100 + : 2000 + ), + logged: false + }; + } + }; + function onUnhandled(id) { + if ( + options.allRejections || + matchWhitelist( + rejections[id].error, + options.whitelist || DEFAULT_WHITELIST + ) + ) { + rejections[id].displayId = displayId++; + if (options.onUnhandled) { + rejections[id].logged = true; + options.onUnhandled( + rejections[id].displayId, + rejections[id].error + ); + } else { + rejections[id].logged = true; + logError( + rejections[id].displayId, + rejections[id].error + ); + } + } + } + function onHandled(id) { + if (rejections[id].logged) { + if (options.onHandled) { + options.onHandled(rejections[id].displayId, rejections[id].error); + } else if (!rejections[id].onUnhandled) { + console.warn( + 'Promise Rejection Handled (id: ' + rejections[id].displayId + '):' + ); + console.warn( + ' This means you can ignore any previous messages of the form "Possible Unhandled Promise Rejection" with id ' + + rejections[id].displayId + '.' + ); + } + } + } +} + +function logError(id, error) { + console.warn('Possible Unhandled Promise Rejection (id: ' + id + '):'); + var errStr = (error && (error.stack || error)) + ''; + errStr.split('\n').forEach(function (line) { + console.warn(' ' + line); + }); +} + +function matchWhitelist(error, list) { + return list.some(function (cls) { + return error instanceof cls; + }); +} \ No newline at end of file diff --git a/node_modules/promise/lib/synchronous.js b/node_modules/promise/lib/synchronous.js new file mode 100644 index 0000000..4939964 --- /dev/null +++ b/node_modules/promise/lib/synchronous.js @@ -0,0 +1,62 @@ +'use strict'; + +var Promise = require('./core.js'); + +module.exports = Promise; +Promise.enableSynchronous = function () { + Promise.prototype.isPending = function() { + return this.getState() == 0; + }; + + Promise.prototype.isFulfilled = function() { + return this.getState() == 1; + }; + + Promise.prototype.isRejected = function() { + return this.getState() == 2; + }; + + Promise.prototype.getValue = function () { + if (this._65 === 3) { + return this._55.getValue(); + } + + if (!this.isFulfilled()) { + throw new Error('Cannot get a value of an unfulfilled promise.'); + } + + return this._55; + }; + + Promise.prototype.getReason = function () { + if (this._65 === 3) { + return this._55.getReason(); + } + + if (!this.isRejected()) { + throw new Error('Cannot get a rejection reason of a non-rejected promise.'); + } + + return this._55; + }; + + Promise.prototype.getState = function () { + if (this._65 === 3) { + return this._55.getState(); + } + if (this._65 === -1 || this._65 === -2) { + return 0; + } + + return this._65; + }; +}; + +Promise.disableSynchronous = function() { + Promise.prototype.isPending = undefined; + Promise.prototype.isFulfilled = undefined; + Promise.prototype.isRejected = undefined; + Promise.prototype.getValue = undefined; + Promise.prototype.getReason = undefined; + Promise.prototype.getState = undefined; +}; diff --git a/node_modules/promise/package.json b/node_modules/promise/package.json new file mode 100644 index 0000000..0e5b0b8 --- /dev/null +++ b/node_modules/promise/package.json @@ -0,0 +1,66 @@ +{ + "_from": "promise@^7.0.1", + "_id": "promise@7.3.1", + "_inBundle": false, + "_integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "_location": "/promise", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "promise@^7.0.1", + "name": "promise", + "escapedName": "promise", + "rawSpec": "^7.0.1", + "saveSpec": null, + "fetchSpec": "^7.0.1" + }, + "_requiredBy": [ + "/jstransformer" + ], + "_resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", + "_shasum": "064b72602b18f90f29192b8b1bc418ffd1ebd3bf", + "_spec": "promise@^7.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/jstransformer", + "author": { + "name": "ForbesLindesay" + }, + "bugs": { + "url": "https://github.com/then/promise/issues" + }, + "bundleDependencies": false, + "dependencies": { + "asap": "~2.0.3" + }, + "deprecated": false, + "description": "Bare bones Promises/A+ implementation", + "devDependencies": { + "acorn": "^1.0.1", + "better-assert": "*", + "istanbul": "^0.3.13", + "mocha": "*", + "promises-aplus-tests": "*", + "rimraf": "^2.3.2" + }, + "homepage": "https://github.com/then/promise#readme", + "license": "MIT", + "main": "index.js", + "name": "promise", + "repository": { + "type": "git", + "url": "git+https://github.com/then/promise.git" + }, + "scripts": { + "coverage": "istanbul cover node_modules/mocha/bin/_mocha -- --bail --timeout 200 --slow 99999 -R dot", + "prepublish": "node build", + "pretest": "node build", + "pretest-extensions": "node build", + "pretest-memory-leak": "node build", + "pretest-resolve": "node build", + "test": "mocha --bail --timeout 200 --slow 99999 -R dot && npm run test-memory-leak", + "test-extensions": "mocha test/extensions-tests.js --timeout 200 --slow 999999", + "test-memory-leak": "node --expose-gc test/memory-leak.js", + "test-resolve": "mocha test/resolver-tests.js --timeout 200 --slow 999999" + }, + "version": "7.3.1" +} diff --git a/node_modules/promise/polyfill-done.js b/node_modules/promise/polyfill-done.js new file mode 100644 index 0000000..e50b4c0 --- /dev/null +++ b/node_modules/promise/polyfill-done.js @@ -0,0 +1,12 @@ +// should work in any browser without browserify + +if (typeof Promise.prototype.done !== 'function') { + Promise.prototype.done = function (onFulfilled, onRejected) { + var self = arguments.length ? this.then.apply(this, arguments) : this + self.then(null, function (err) { + setTimeout(function () { + throw err + }, 0) + }) + } +} \ No newline at end of file diff --git a/node_modules/promise/polyfill.js b/node_modules/promise/polyfill.js new file mode 100644 index 0000000..db099f8 --- /dev/null +++ b/node_modules/promise/polyfill.js @@ -0,0 +1,10 @@ +// not "use strict" so we can declare global "Promise" + +var asap = require('asap'); + +if (typeof Promise === 'undefined') { + Promise = require('./lib/core.js') + require('./lib/es6-extensions.js') +} + +require('./polyfill-done.js'); diff --git a/node_modules/promise/setimmediate/core.js b/node_modules/promise/setimmediate/core.js new file mode 100644 index 0000000..a84fb3d --- /dev/null +++ b/node_modules/promise/setimmediate/core.js @@ -0,0 +1,213 @@ +'use strict'; + + + +function noop() {} + +// States: +// +// 0 - pending +// 1 - fulfilled with _value +// 2 - rejected with _value +// 3 - adopted the state of another promise, _value +// +// once the state is no longer pending (0) it is immutable + +// All `_` prefixed properties will be reduced to `_{random number}` +// at build time to obfuscate them and discourage their use. +// We don't use symbols or Object.defineProperty to fully hide them +// because the performance isn't good enough. + + +// to avoid using try/catch inside critical functions, we +// extract them to here. +var LAST_ERROR = null; +var IS_ERROR = {}; +function getThen(obj) { + try { + return obj.then; + } catch (ex) { + LAST_ERROR = ex; + return IS_ERROR; + } +} + +function tryCallOne(fn, a) { + try { + return fn(a); + } catch (ex) { + LAST_ERROR = ex; + return IS_ERROR; + } +} +function tryCallTwo(fn, a, b) { + try { + fn(a, b); + } catch (ex) { + LAST_ERROR = ex; + return IS_ERROR; + } +} + +module.exports = Promise; + +function Promise(fn) { + if (typeof this !== 'object') { + throw new TypeError('Promises must be constructed via new'); + } + if (typeof fn !== 'function') { + throw new TypeError('Promise constructor\'s argument is not a function'); + } + this._40 = 0; + this._65 = 0; + this._55 = null; + this._72 = null; + if (fn === noop) return; + doResolve(fn, this); +} +Promise._37 = null; +Promise._87 = null; +Promise._61 = noop; + +Promise.prototype.then = function(onFulfilled, onRejected) { + if (this.constructor !== Promise) { + return safeThen(this, onFulfilled, onRejected); + } + var res = new Promise(noop); + handle(this, new Handler(onFulfilled, onRejected, res)); + return res; +}; + +function safeThen(self, onFulfilled, onRejected) { + return new self.constructor(function (resolve, reject) { + var res = new Promise(noop); + res.then(resolve, reject); + handle(self, new Handler(onFulfilled, onRejected, res)); + }); +} +function handle(self, deferred) { + while (self._65 === 3) { + self = self._55; + } + if (Promise._37) { + Promise._37(self); + } + if (self._65 === 0) { + if (self._40 === 0) { + self._40 = 1; + self._72 = deferred; + return; + } + if (self._40 === 1) { + self._40 = 2; + self._72 = [self._72, deferred]; + return; + } + self._72.push(deferred); + return; + } + handleResolved(self, deferred); +} + +function handleResolved(self, deferred) { + setImmediate(function() { + var cb = self._65 === 1 ? deferred.onFulfilled : deferred.onRejected; + if (cb === null) { + if (self._65 === 1) { + resolve(deferred.promise, self._55); + } else { + reject(deferred.promise, self._55); + } + return; + } + var ret = tryCallOne(cb, self._55); + if (ret === IS_ERROR) { + reject(deferred.promise, LAST_ERROR); + } else { + resolve(deferred.promise, ret); + } + }); +} +function resolve(self, newValue) { + // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure + if (newValue === self) { + return reject( + self, + new TypeError('A promise cannot be resolved with itself.') + ); + } + if ( + newValue && + (typeof newValue === 'object' || typeof newValue === 'function') + ) { + var then = getThen(newValue); + if (then === IS_ERROR) { + return reject(self, LAST_ERROR); + } + if ( + then === self.then && + newValue instanceof Promise + ) { + self._65 = 3; + self._55 = newValue; + finale(self); + return; + } else if (typeof then === 'function') { + doResolve(then.bind(newValue), self); + return; + } + } + self._65 = 1; + self._55 = newValue; + finale(self); +} + +function reject(self, newValue) { + self._65 = 2; + self._55 = newValue; + if (Promise._87) { + Promise._87(self, newValue); + } + finale(self); +} +function finale(self) { + if (self._40 === 1) { + handle(self, self._72); + self._72 = null; + } + if (self._40 === 2) { + for (var i = 0; i < self._72.length; i++) { + handle(self, self._72[i]); + } + self._72 = null; + } +} + +function Handler(onFulfilled, onRejected, promise){ + this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; + this.onRejected = typeof onRejected === 'function' ? onRejected : null; + this.promise = promise; +} + +/** + * Take a potentially misbehaving resolver function and make sure + * onFulfilled and onRejected are only called once. + * + * Makes no guarantees about asynchrony. + */ +function doResolve(fn, promise) { + var done = false; + var res = tryCallTwo(fn, function (value) { + if (done) return; + done = true; + resolve(promise, value); + }, function (reason) { + if (done) return; + done = true; + reject(promise, reason); + }); + if (!done && res === IS_ERROR) { + done = true; + reject(promise, LAST_ERROR); + } +} diff --git a/node_modules/promise/setimmediate/done.js b/node_modules/promise/setimmediate/done.js new file mode 100644 index 0000000..f879317 --- /dev/null +++ b/node_modules/promise/setimmediate/done.js @@ -0,0 +1,13 @@ +'use strict'; + +var Promise = require('./core.js'); + +module.exports = Promise; +Promise.prototype.done = function (onFulfilled, onRejected) { + var self = arguments.length ? this.then.apply(this, arguments) : this; + self.then(null, function (err) { + setTimeout(function () { + throw err; + }, 0); + }); +}; diff --git a/node_modules/promise/setimmediate/es6-extensions.js b/node_modules/promise/setimmediate/es6-extensions.js new file mode 100644 index 0000000..8ab2666 --- /dev/null +++ b/node_modules/promise/setimmediate/es6-extensions.js @@ -0,0 +1,107 @@ +'use strict'; + +//This file contains the ES6 extensions to the core Promises/A+ API + +var Promise = require('./core.js'); + +module.exports = Promise; + +/* Static Functions */ + +var TRUE = valuePromise(true); +var FALSE = valuePromise(false); +var NULL = valuePromise(null); +var UNDEFINED = valuePromise(undefined); +var ZERO = valuePromise(0); +var EMPTYSTRING = valuePromise(''); + +function valuePromise(value) { + var p = new Promise(Promise._61); + p._65 = 1; + p._55 = value; + return p; +} +Promise.resolve = function (value) { + if (value instanceof Promise) return value; + + if (value === null) return NULL; + if (value === undefined) return UNDEFINED; + if (value === true) return TRUE; + if (value === false) return FALSE; + if (value === 0) return ZERO; + if (value === '') return EMPTYSTRING; + + if (typeof value === 'object' || typeof value === 'function') { + try { + var then = value.then; + if (typeof then === 'function') { + return new Promise(then.bind(value)); + } + } catch (ex) { + return new Promise(function (resolve, reject) { + reject(ex); + }); + } + } + return valuePromise(value); +}; + +Promise.all = function (arr) { + var args = Array.prototype.slice.call(arr); + + return new Promise(function (resolve, reject) { + if (args.length === 0) return resolve([]); + var remaining = args.length; + function res(i, val) { + if (val && (typeof val === 'object' || typeof val === 'function')) { + if (val instanceof Promise && val.then === Promise.prototype.then) { + while (val._65 === 3) { + val = val._55; + } + if (val._65 === 1) return res(i, val._55); + if (val._65 === 2) reject(val._55); + val.then(function (val) { + res(i, val); + }, reject); + return; + } else { + var then = val.then; + if (typeof then === 'function') { + var p = new Promise(then.bind(val)); + p.then(function (val) { + res(i, val); + }, reject); + return; + } + } + } + args[i] = val; + if (--remaining === 0) { + resolve(args); + } + } + for (var i = 0; i < args.length; i++) { + res(i, args[i]); + } + }); +}; + +Promise.reject = function (value) { + return new Promise(function (resolve, reject) { + reject(value); + }); +}; + +Promise.race = function (values) { + return new Promise(function (resolve, reject) { + values.forEach(function(value){ + Promise.resolve(value).then(resolve, reject); + }); + }); +}; + +/* Prototype Methods */ + +Promise.prototype['catch'] = function (onRejected) { + return this.then(null, onRejected); +}; diff --git a/node_modules/promise/setimmediate/finally.js b/node_modules/promise/setimmediate/finally.js new file mode 100644 index 0000000..f5ee0b9 --- /dev/null +++ b/node_modules/promise/setimmediate/finally.js @@ -0,0 +1,16 @@ +'use strict'; + +var Promise = require('./core.js'); + +module.exports = Promise; +Promise.prototype['finally'] = function (f) { + return this.then(function (value) { + return Promise.resolve(f()).then(function () { + return value; + }); + }, function (err) { + return Promise.resolve(f()).then(function () { + throw err; + }); + }); +}; diff --git a/node_modules/promise/setimmediate/index.js b/node_modules/promise/setimmediate/index.js new file mode 100644 index 0000000..6e674f3 --- /dev/null +++ b/node_modules/promise/setimmediate/index.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = require('./core.js'); +require('./done.js'); +require('./finally.js'); +require('./es6-extensions.js'); +require('./node-extensions.js'); +require('./synchronous.js'); diff --git a/node_modules/promise/setimmediate/node-extensions.js b/node_modules/promise/setimmediate/node-extensions.js new file mode 100644 index 0000000..f03e861 --- /dev/null +++ b/node_modules/promise/setimmediate/node-extensions.js @@ -0,0 +1,130 @@ +'use strict'; + +// This file contains then/promise specific extensions that are only useful +// for node.js interop + +var Promise = require('./core.js'); + + +module.exports = Promise; + +/* Static Functions */ + +Promise.denodeify = function (fn, argumentCount) { + if ( + typeof argumentCount === 'number' && argumentCount !== Infinity + ) { + return denodeifyWithCount(fn, argumentCount); + } else { + return denodeifyWithoutCount(fn); + } +}; + +var callbackFn = ( + 'function (err, res) {' + + 'if (err) { rj(err); } else { rs(res); }' + + '}' +); +function denodeifyWithCount(fn, argumentCount) { + var args = []; + for (var i = 0; i < argumentCount; i++) { + args.push('a' + i); + } + var body = [ + 'return function (' + args.join(',') + ') {', + 'var self = this;', + 'return new Promise(function (rs, rj) {', + 'var res = fn.call(', + ['self'].concat(args).concat([callbackFn]).join(','), + ');', + 'if (res &&', + '(typeof res === "object" || typeof res === "function") &&', + 'typeof res.then === "function"', + ') {rs(res);}', + '});', + '};' + ].join(''); + return Function(['Promise', 'fn'], body)(Promise, fn); +} +function denodeifyWithoutCount(fn) { + var fnLength = Math.max(fn.length - 1, 3); + var args = []; + for (var i = 0; i < fnLength; i++) { + args.push('a' + i); + } + var body = [ + 'return function (' + args.join(',') + ') {', + 'var self = this;', + 'var args;', + 'var argLength = arguments.length;', + 'if (arguments.length > ' + fnLength + ') {', + 'args = new Array(arguments.length + 1);', + 'for (var i = 0; i < arguments.length; i++) {', + 'args[i] = arguments[i];', + '}', + '}', + 'return new Promise(function (rs, rj) {', + 'var cb = ' + callbackFn + ';', + 'var res;', + 'switch (argLength) {', + args.concat(['extra']).map(function (_, index) { + return ( + 'case ' + (index) + ':' + + 'res = fn.call(' + ['self'].concat(args.slice(0, index)).concat('cb').join(',') + ');' + + 'break;' + ); + }).join(''), + 'default:', + 'args[argLength] = cb;', + 'res = fn.apply(self, args);', + '}', + + 'if (res &&', + '(typeof res === "object" || typeof res === "function") &&', + 'typeof res.then === "function"', + ') {rs(res);}', + '});', + '};' + ].join(''); + + return Function( + ['Promise', 'fn'], + body + )(Promise, fn); +} + +Promise.nodeify = function (fn) { + return function () { + var args = Array.prototype.slice.call(arguments); + var callback = + typeof args[args.length - 1] === 'function' ? args.pop() : null; + var ctx = this; + try { + return fn.apply(this, arguments).nodeify(callback, ctx); + } catch (ex) { + if (callback === null || typeof callback == 'undefined') { + return new Promise(function (resolve, reject) { + reject(ex); + }); + } else { + setImmediate(function () { + callback.call(ctx, ex); + }) + } + } + } +}; + +Promise.prototype.nodeify = function (callback, ctx) { + if (typeof callback != 'function') return this; + + this.then(function (value) { + setImmediate(function () { + callback.call(ctx, null, value); + }); + }, function (err) { + setImmediate(function () { + callback.call(ctx, err); + }); + }); +}; diff --git a/node_modules/promise/setimmediate/rejection-tracking.js b/node_modules/promise/setimmediate/rejection-tracking.js new file mode 100644 index 0000000..10ccce3 --- /dev/null +++ b/node_modules/promise/setimmediate/rejection-tracking.js @@ -0,0 +1,113 @@ +'use strict'; + +var Promise = require('./core'); + +var DEFAULT_WHITELIST = [ + ReferenceError, + TypeError, + RangeError +]; + +var enabled = false; +exports.disable = disable; +function disable() { + enabled = false; + Promise._37 = null; + Promise._87 = null; +} + +exports.enable = enable; +function enable(options) { + options = options || {}; + if (enabled) disable(); + enabled = true; + var id = 0; + var displayId = 0; + var rejections = {}; + Promise._37 = function (promise) { + if ( + promise._65 === 2 && // IS REJECTED + rejections[promise._51] + ) { + if (rejections[promise._51].logged) { + onHandled(promise._51); + } else { + clearTimeout(rejections[promise._51].timeout); + } + delete rejections[promise._51]; + } + }; + Promise._87 = function (promise, err) { + if (promise._40 === 0) { // not yet handled + promise._51 = id++; + rejections[promise._51] = { + displayId: null, + error: err, + timeout: setTimeout( + onUnhandled.bind(null, promise._51), + // For reference errors and type errors, this almost always + // means the programmer made a mistake, so log them after just + // 100ms + // otherwise, wait 2 seconds to see if they get handled + matchWhitelist(err, DEFAULT_WHITELIST) + ? 100 + : 2000 + ), + logged: false + }; + } + }; + function onUnhandled(id) { + if ( + options.allRejections || + matchWhitelist( + rejections[id].error, + options.whitelist || DEFAULT_WHITELIST + ) + ) { + rejections[id].displayId = displayId++; + if (options.onUnhandled) { + rejections[id].logged = true; + options.onUnhandled( + rejections[id].displayId, + rejections[id].error + ); + } else { + rejections[id].logged = true; + logError( + rejections[id].displayId, + rejections[id].error + ); + } + } + } + function onHandled(id) { + if (rejections[id].logged) { + if (options.onHandled) { + options.onHandled(rejections[id].displayId, rejections[id].error); + } else if (!rejections[id].onUnhandled) { + console.warn( + 'Promise Rejection Handled (id: ' + rejections[id].displayId + '):' + ); + console.warn( + ' This means you can ignore any previous messages of the form "Possible Unhandled Promise Rejection" with id ' + + rejections[id].displayId + '.' + ); + } + } + } +} + +function logError(id, error) { + console.warn('Possible Unhandled Promise Rejection (id: ' + id + '):'); + var errStr = (error && (error.stack || error)) + ''; + errStr.split('\n').forEach(function (line) { + console.warn(' ' + line); + }); +} + +function matchWhitelist(error, list) { + return list.some(function (cls) { + return error instanceof cls; + }); +} \ No newline at end of file diff --git a/node_modules/promise/setimmediate/synchronous.js b/node_modules/promise/setimmediate/synchronous.js new file mode 100644 index 0000000..4939964 --- /dev/null +++ b/node_modules/promise/setimmediate/synchronous.js @@ -0,0 +1,62 @@ +'use strict'; + +var Promise = require('./core.js'); + +module.exports = Promise; +Promise.enableSynchronous = function () { + Promise.prototype.isPending = function() { + return this.getState() == 0; + }; + + Promise.prototype.isFulfilled = function() { + return this.getState() == 1; + }; + + Promise.prototype.isRejected = function() { + return this.getState() == 2; + }; + + Promise.prototype.getValue = function () { + if (this._65 === 3) { + return this._55.getValue(); + } + + if (!this.isFulfilled()) { + throw new Error('Cannot get a value of an unfulfilled promise.'); + } + + return this._55; + }; + + Promise.prototype.getReason = function () { + if (this._65 === 3) { + return this._55.getReason(); + } + + if (!this.isRejected()) { + throw new Error('Cannot get a rejection reason of a non-rejected promise.'); + } + + return this._55; + }; + + Promise.prototype.getState = function () { + if (this._65 === 3) { + return this._55.getState(); + } + if (this._65 === -1 || this._65 === -2) { + return 0; + } + + return this._65; + }; +}; + +Promise.disableSynchronous = function() { + Promise.prototype.isPending = undefined; + Promise.prototype.isFulfilled = undefined; + Promise.prototype.isRejected = undefined; + Promise.prototype.getValue = undefined; + Promise.prototype.getReason = undefined; + Promise.prototype.getState = undefined; +}; diff --git a/node_modules/promise/src/core.js b/node_modules/promise/src/core.js new file mode 100644 index 0000000..312010d --- /dev/null +++ b/node_modules/promise/src/core.js @@ -0,0 +1,213 @@ +'use strict'; + +var asap = require('asap/raw'); + +function noop() {} + +// States: +// +// 0 - pending +// 1 - fulfilled with _value +// 2 - rejected with _value +// 3 - adopted the state of another promise, _value +// +// once the state is no longer pending (0) it is immutable + +// All `_` prefixed properties will be reduced to `_{random number}` +// at build time to obfuscate them and discourage their use. +// We don't use symbols or Object.defineProperty to fully hide them +// because the performance isn't good enough. + + +// to avoid using try/catch inside critical functions, we +// extract them to here. +var LAST_ERROR = null; +var IS_ERROR = {}; +function getThen(obj) { + try { + return obj.then; + } catch (ex) { + LAST_ERROR = ex; + return IS_ERROR; + } +} + +function tryCallOne(fn, a) { + try { + return fn(a); + } catch (ex) { + LAST_ERROR = ex; + return IS_ERROR; + } +} +function tryCallTwo(fn, a, b) { + try { + fn(a, b); + } catch (ex) { + LAST_ERROR = ex; + return IS_ERROR; + } +} + +module.exports = Promise; + +function Promise(fn) { + if (typeof this !== 'object') { + throw new TypeError('Promises must be constructed via new'); + } + if (typeof fn !== 'function') { + throw new TypeError('Promise constructor\'s argument is not a function'); + } + this._deferredState = 0; + this._state = 0; + this._value = null; + this._deferreds = null; + if (fn === noop) return; + doResolve(fn, this); +} +Promise._onHandle = null; +Promise._onReject = null; +Promise._noop = noop; + +Promise.prototype.then = function(onFulfilled, onRejected) { + if (this.constructor !== Promise) { + return safeThen(this, onFulfilled, onRejected); + } + var res = new Promise(noop); + handle(this, new Handler(onFulfilled, onRejected, res)); + return res; +}; + +function safeThen(self, onFulfilled, onRejected) { + return new self.constructor(function (resolve, reject) { + var res = new Promise(noop); + res.then(resolve, reject); + handle(self, new Handler(onFulfilled, onRejected, res)); + }); +} +function handle(self, deferred) { + while (self._state === 3) { + self = self._value; + } + if (Promise._onHandle) { + Promise._onHandle(self); + } + if (self._state === 0) { + if (self._deferredState === 0) { + self._deferredState = 1; + self._deferreds = deferred; + return; + } + if (self._deferredState === 1) { + self._deferredState = 2; + self._deferreds = [self._deferreds, deferred]; + return; + } + self._deferreds.push(deferred); + return; + } + handleResolved(self, deferred); +} + +function handleResolved(self, deferred) { + asap(function() { + var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected; + if (cb === null) { + if (self._state === 1) { + resolve(deferred.promise, self._value); + } else { + reject(deferred.promise, self._value); + } + return; + } + var ret = tryCallOne(cb, self._value); + if (ret === IS_ERROR) { + reject(deferred.promise, LAST_ERROR); + } else { + resolve(deferred.promise, ret); + } + }); +} +function resolve(self, newValue) { + // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure + if (newValue === self) { + return reject( + self, + new TypeError('A promise cannot be resolved with itself.') + ); + } + if ( + newValue && + (typeof newValue === 'object' || typeof newValue === 'function') + ) { + var then = getThen(newValue); + if (then === IS_ERROR) { + return reject(self, LAST_ERROR); + } + if ( + then === self.then && + newValue instanceof Promise + ) { + self._state = 3; + self._value = newValue; + finale(self); + return; + } else if (typeof then === 'function') { + doResolve(then.bind(newValue), self); + return; + } + } + self._state = 1; + self._value = newValue; + finale(self); +} + +function reject(self, newValue) { + self._state = 2; + self._value = newValue; + if (Promise._onReject) { + Promise._onReject(self, newValue); + } + finale(self); +} +function finale(self) { + if (self._deferredState === 1) { + handle(self, self._deferreds); + self._deferreds = null; + } + if (self._deferredState === 2) { + for (var i = 0; i < self._deferreds.length; i++) { + handle(self, self._deferreds[i]); + } + self._deferreds = null; + } +} + +function Handler(onFulfilled, onRejected, promise){ + this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; + this.onRejected = typeof onRejected === 'function' ? onRejected : null; + this.promise = promise; +} + +/** + * Take a potentially misbehaving resolver function and make sure + * onFulfilled and onRejected are only called once. + * + * Makes no guarantees about asynchrony. + */ +function doResolve(fn, promise) { + var done = false; + var res = tryCallTwo(fn, function (value) { + if (done) return; + done = true; + resolve(promise, value); + }, function (reason) { + if (done) return; + done = true; + reject(promise, reason); + }); + if (!done && res === IS_ERROR) { + done = true; + reject(promise, LAST_ERROR); + } +} diff --git a/node_modules/promise/src/done.js b/node_modules/promise/src/done.js new file mode 100644 index 0000000..f879317 --- /dev/null +++ b/node_modules/promise/src/done.js @@ -0,0 +1,13 @@ +'use strict'; + +var Promise = require('./core.js'); + +module.exports = Promise; +Promise.prototype.done = function (onFulfilled, onRejected) { + var self = arguments.length ? this.then.apply(this, arguments) : this; + self.then(null, function (err) { + setTimeout(function () { + throw err; + }, 0); + }); +}; diff --git a/node_modules/promise/src/es6-extensions.js b/node_modules/promise/src/es6-extensions.js new file mode 100644 index 0000000..0435813 --- /dev/null +++ b/node_modules/promise/src/es6-extensions.js @@ -0,0 +1,107 @@ +'use strict'; + +//This file contains the ES6 extensions to the core Promises/A+ API + +var Promise = require('./core.js'); + +module.exports = Promise; + +/* Static Functions */ + +var TRUE = valuePromise(true); +var FALSE = valuePromise(false); +var NULL = valuePromise(null); +var UNDEFINED = valuePromise(undefined); +var ZERO = valuePromise(0); +var EMPTYSTRING = valuePromise(''); + +function valuePromise(value) { + var p = new Promise(Promise._noop); + p._state = 1; + p._value = value; + return p; +} +Promise.resolve = function (value) { + if (value instanceof Promise) return value; + + if (value === null) return NULL; + if (value === undefined) return UNDEFINED; + if (value === true) return TRUE; + if (value === false) return FALSE; + if (value === 0) return ZERO; + if (value === '') return EMPTYSTRING; + + if (typeof value === 'object' || typeof value === 'function') { + try { + var then = value.then; + if (typeof then === 'function') { + return new Promise(then.bind(value)); + } + } catch (ex) { + return new Promise(function (resolve, reject) { + reject(ex); + }); + } + } + return valuePromise(value); +}; + +Promise.all = function (arr) { + var args = Array.prototype.slice.call(arr); + + return new Promise(function (resolve, reject) { + if (args.length === 0) return resolve([]); + var remaining = args.length; + function res(i, val) { + if (val && (typeof val === 'object' || typeof val === 'function')) { + if (val instanceof Promise && val.then === Promise.prototype.then) { + while (val._state === 3) { + val = val._value; + } + if (val._state === 1) return res(i, val._value); + if (val._state === 2) reject(val._value); + val.then(function (val) { + res(i, val); + }, reject); + return; + } else { + var then = val.then; + if (typeof then === 'function') { + var p = new Promise(then.bind(val)); + p.then(function (val) { + res(i, val); + }, reject); + return; + } + } + } + args[i] = val; + if (--remaining === 0) { + resolve(args); + } + } + for (var i = 0; i < args.length; i++) { + res(i, args[i]); + } + }); +}; + +Promise.reject = function (value) { + return new Promise(function (resolve, reject) { + reject(value); + }); +}; + +Promise.race = function (values) { + return new Promise(function (resolve, reject) { + values.forEach(function(value){ + Promise.resolve(value).then(resolve, reject); + }); + }); +}; + +/* Prototype Methods */ + +Promise.prototype['catch'] = function (onRejected) { + return this.then(null, onRejected); +}; diff --git a/node_modules/promise/src/finally.js b/node_modules/promise/src/finally.js new file mode 100644 index 0000000..f5ee0b9 --- /dev/null +++ b/node_modules/promise/src/finally.js @@ -0,0 +1,16 @@ +'use strict'; + +var Promise = require('./core.js'); + +module.exports = Promise; +Promise.prototype['finally'] = function (f) { + return this.then(function (value) { + return Promise.resolve(f()).then(function () { + return value; + }); + }, function (err) { + return Promise.resolve(f()).then(function () { + throw err; + }); + }); +}; diff --git a/node_modules/promise/src/index.js b/node_modules/promise/src/index.js new file mode 100644 index 0000000..6e674f3 --- /dev/null +++ b/node_modules/promise/src/index.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = require('./core.js'); +require('./done.js'); +require('./finally.js'); +require('./es6-extensions.js'); +require('./node-extensions.js'); +require('./synchronous.js'); diff --git a/node_modules/promise/src/node-extensions.js b/node_modules/promise/src/node-extensions.js new file mode 100644 index 0000000..157cddc --- /dev/null +++ b/node_modules/promise/src/node-extensions.js @@ -0,0 +1,130 @@ +'use strict'; + +// This file contains then/promise specific extensions that are only useful +// for node.js interop + +var Promise = require('./core.js'); +var asap = require('asap'); + +module.exports = Promise; + +/* Static Functions */ + +Promise.denodeify = function (fn, argumentCount) { + if ( + typeof argumentCount === 'number' && argumentCount !== Infinity + ) { + return denodeifyWithCount(fn, argumentCount); + } else { + return denodeifyWithoutCount(fn); + } +}; + +var callbackFn = ( + 'function (err, res) {' + + 'if (err) { rj(err); } else { rs(res); }' + + '}' +); +function denodeifyWithCount(fn, argumentCount) { + var args = []; + for (var i = 0; i < argumentCount; i++) { + args.push('a' + i); + } + var body = [ + 'return function (' + args.join(',') + ') {', + 'var self = this;', + 'return new Promise(function (rs, rj) {', + 'var res = fn.call(', + ['self'].concat(args).concat([callbackFn]).join(','), + ');', + 'if (res &&', + '(typeof res === "object" || typeof res === "function") &&', + 'typeof res.then === "function"', + ') {rs(res);}', + '});', + '};' + ].join(''); + return Function(['Promise', 'fn'], body)(Promise, fn); +} +function denodeifyWithoutCount(fn) { + var fnLength = Math.max(fn.length - 1, 3); + var args = []; + for (var i = 0; i < fnLength; i++) { + args.push('a' + i); + } + var body = [ + 'return function (' + args.join(',') + ') {', + 'var self = this;', + 'var args;', + 'var argLength = arguments.length;', + 'if (arguments.length > ' + fnLength + ') {', + 'args = new Array(arguments.length + 1);', + 'for (var i = 0; i < arguments.length; i++) {', + 'args[i] = arguments[i];', + '}', + '}', + 'return new Promise(function (rs, rj) {', + 'var cb = ' + callbackFn + ';', + 'var res;', + 'switch (argLength) {', + args.concat(['extra']).map(function (_, index) { + return ( + 'case ' + (index) + ':' + + 'res = fn.call(' + ['self'].concat(args.slice(0, index)).concat('cb').join(',') + ');' + + 'break;' + ); + }).join(''), + 'default:', + 'args[argLength] = cb;', + 'res = fn.apply(self, args);', + '}', + + 'if (res &&', + '(typeof res === "object" || typeof res === "function") &&', + 'typeof res.then === "function"', + ') {rs(res);}', + '});', + '};' + ].join(''); + + return Function( + ['Promise', 'fn'], + body + )(Promise, fn); +} + +Promise.nodeify = function (fn) { + return function () { + var args = Array.prototype.slice.call(arguments); + var callback = + typeof args[args.length - 1] === 'function' ? args.pop() : null; + var ctx = this; + try { + return fn.apply(this, arguments).nodeify(callback, ctx); + } catch (ex) { + if (callback === null || typeof callback == 'undefined') { + return new Promise(function (resolve, reject) { + reject(ex); + }); + } else { + asap(function () { + callback.call(ctx, ex); + }) + } + } + } +}; + +Promise.prototype.nodeify = function (callback, ctx) { + if (typeof callback != 'function') return this; + + this.then(function (value) { + asap(function () { + callback.call(ctx, null, value); + }); + }, function (err) { + asap(function () { + callback.call(ctx, err); + }); + }); +}; diff --git a/node_modules/promise/src/rejection-tracking.js b/node_modules/promise/src/rejection-tracking.js new file mode 100644 index 0000000..33a59a1 --- /dev/null +++ b/node_modules/promise/src/rejection-tracking.js @@ -0,0 +1,113 @@ +'use strict'; + +var Promise = require('./core'); + +var DEFAULT_WHITELIST = [ + ReferenceError, + TypeError, + RangeError +]; + +var enabled = false; +exports.disable = disable; +function disable() { + enabled = false; + Promise._onHandle = null; + Promise._onReject = null; +} + +exports.enable = enable; +function enable(options) { + options = options || {}; + if (enabled) disable(); + enabled = true; + var id = 0; + var displayId = 0; + var rejections = {}; + Promise._onHandle = function (promise) { + if ( + promise._state === 2 && // IS REJECTED + rejections[promise._rejectionId] + ) { + if (rejections[promise._rejectionId].logged) { + onHandled(promise._rejectionId); + } else { + clearTimeout(rejections[promise._rejectionId].timeout); + } + delete rejections[promise._rejectionId]; + } + }; + Promise._onReject = function (promise, err) { + if (promise._deferredState === 0) { // not yet handled + promise._rejectionId = id++; + rejections[promise._rejectionId] = { + displayId: null, + error: err, + timeout: setTimeout( + onUnhandled.bind(null, promise._rejectionId), + // For reference errors and type errors, this almost always + // means the programmer made a mistake, so log them after just + // 100ms + // otherwise, wait 2 seconds to see if they get handled + matchWhitelist(err, DEFAULT_WHITELIST) + ? 100 + : 2000 + ), + logged: false + }; + } + }; + function onUnhandled(id) { + if ( + options.allRejections || + matchWhitelist( + rejections[id].error, + options.whitelist || DEFAULT_WHITELIST + ) + ) { + rejections[id].displayId = displayId++; + if (options.onUnhandled) { + rejections[id].logged = true; + options.onUnhandled( + rejections[id].displayId, + rejections[id].error + ); + } else { + rejections[id].logged = true; + logError( + rejections[id].displayId, + rejections[id].error + ); + } + } + } + function onHandled(id) { + if (rejections[id].logged) { + if (options.onHandled) { + options.onHandled(rejections[id].displayId, rejections[id].error); + } else if (!rejections[id].onUnhandled) { + console.warn( + 'Promise Rejection Handled (id: ' + rejections[id].displayId + '):' + ); + console.warn( + ' This means you can ignore any previous messages of the form "Possible Unhandled Promise Rejection" with id ' + + rejections[id].displayId + '.' + ); + } + } + } +} + +function logError(id, error) { + console.warn('Possible Unhandled Promise Rejection (id: ' + id + '):'); + var errStr = (error && (error.stack || error)) + ''; + errStr.split('\n').forEach(function (line) { + console.warn(' ' + line); + }); +} + +function matchWhitelist(error, list) { + return list.some(function (cls) { + return error instanceof cls; + }); +} \ No newline at end of file diff --git a/node_modules/promise/src/synchronous.js b/node_modules/promise/src/synchronous.js new file mode 100644 index 0000000..38b228f --- /dev/null +++ b/node_modules/promise/src/synchronous.js @@ -0,0 +1,62 @@ +'use strict'; + +var Promise = require('./core.js'); + +module.exports = Promise; +Promise.enableSynchronous = function () { + Promise.prototype.isPending = function() { + return this.getState() == 0; + }; + + Promise.prototype.isFulfilled = function() { + return this.getState() == 1; + }; + + Promise.prototype.isRejected = function() { + return this.getState() == 2; + }; + + Promise.prototype.getValue = function () { + if (this._state === 3) { + return this._value.getValue(); + } + + if (!this.isFulfilled()) { + throw new Error('Cannot get a value of an unfulfilled promise.'); + } + + return this._value; + }; + + Promise.prototype.getReason = function () { + if (this._state === 3) { + return this._value.getReason(); + } + + if (!this.isRejected()) { + throw new Error('Cannot get a rejection reason of a non-rejected promise.'); + } + + return this._value; + }; + + Promise.prototype.getState = function () { + if (this._state === 3) { + return this._value.getState(); + } + if (this._state === -1 || this._state === -2) { + return 0; + } + + return this._state; + }; +}; + +Promise.disableSynchronous = function() { + Promise.prototype.isPending = undefined; + Promise.prototype.isFulfilled = undefined; + Promise.prototype.isRejected = undefined; + Promise.prototype.getValue = undefined; + Promise.prototype.getReason = undefined; + Promise.prototype.getState = undefined; +}; diff --git a/node_modules/proxy-addr/HISTORY.md b/node_modules/proxy-addr/HISTORY.md new file mode 100644 index 0000000..b909ce8 --- /dev/null +++ b/node_modules/proxy-addr/HISTORY.md @@ -0,0 +1,115 @@ +1.1.5 / 2017-07-25 +================== + + * Fix array argument being altered + * deps: ipaddr.js@1.4.0 + +1.1.4 / 2017-03-24 +================== + + * deps: ipaddr.js@1.3.0 + +1.1.3 / 2017-01-14 +================== + + * deps: ipaddr.js@1.2.0 + +1.1.2 / 2016-05-29 +================== + + * deps: ipaddr.js@1.1.1 + - Fix IPv6-mapped IPv4 validation edge cases + +1.1.1 / 2016-05-03 +================== + + * Fix regression matching mixed versions against multiple subnets + +1.1.0 / 2016-05-01 +================== + + * Fix accepting various invalid netmasks + - IPv4 netmasks must be contingous + - IPv6 addresses cannot be used as a netmask + * deps: ipaddr.js@1.1.0 + +1.0.10 / 2015-12-09 +=================== + + * deps: ipaddr.js@1.0.5 + - Fix regression in `isValid` with non-string arguments + +1.0.9 / 2015-12-01 +================== + + * deps: ipaddr.js@1.0.4 + - Fix accepting some invalid IPv6 addresses + - Reject CIDRs with negative or overlong masks + * perf: enable strict mode + +1.0.8 / 2015-05-10 +================== + + * deps: ipaddr.js@1.0.1 + +1.0.7 / 2015-03-16 +================== + + * deps: ipaddr.js@0.1.9 + - Fix OOM on certain inputs to `isValid` + +1.0.6 / 2015-02-01 +================== + + * deps: ipaddr.js@0.1.8 + +1.0.5 / 2015-01-08 +================== + + * deps: ipaddr.js@0.1.6 + +1.0.4 / 2014-11-23 +================== + + * deps: ipaddr.js@0.1.5 + - Fix edge cases with `isValid` + +1.0.3 / 2014-09-21 +================== + + * Use `forwarded` npm module + +1.0.2 / 2014-09-18 +================== + + * Fix a global leak when multiple subnets are trusted + * Support Node.js 0.6 + * deps: ipaddr.js@0.1.3 + +1.0.1 / 2014-06-03 +================== + + * Fix links in npm package + +1.0.0 / 2014-05-08 +================== + + * Add `trust` argument to determine proxy trust on + * Accepts custom function + * Accepts IPv4/IPv6 address(es) + * Accepts subnets + * Accepts pre-defined names + * Add optional `trust` argument to `proxyaddr.all` to + stop at first untrusted + * Add `proxyaddr.compile` to pre-compile `trust` function + to make subsequent calls faster + +0.0.1 / 2014-05-04 +================== + + * Fix bad npm publish + +0.0.0 / 2014-05-04 +================== + + * Initial release diff --git a/node_modules/proxy-addr/LICENSE b/node_modules/proxy-addr/LICENSE new file mode 100644 index 0000000..cab251c --- /dev/null +++ b/node_modules/proxy-addr/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2016 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/proxy-addr/README.md b/node_modules/proxy-addr/README.md new file mode 100644 index 0000000..6b1075a --- /dev/null +++ b/node_modules/proxy-addr/README.md @@ -0,0 +1,140 @@ +# proxy-addr + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Determine address of proxied request + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install proxy-addr +``` + +## API + +```js +var proxyaddr = require('proxy-addr') +``` + +### proxyaddr(req, trust) + +Return the address of the request, using the given `trust` parameter. + +The `trust` argument is a function that returns `true` if you trust +the address, `false` if you don't. The closest untrusted address is +returned. + +```js +proxyaddr(req, function(addr){ return addr === '127.0.0.1' }) +proxyaddr(req, function(addr, i){ return i < 1 }) +``` + +The `trust` arugment may also be a single IP address string or an +array of trusted addresses, as plain IP addresses, CIDR-formatted +strings, or IP/netmask strings. + +```js +proxyaddr(req, '127.0.0.1') +proxyaddr(req, ['127.0.0.0/8', '10.0.0.0/8']) +proxyaddr(req, ['127.0.0.0/255.0.0.0', '192.168.0.0/255.255.0.0']) +``` + +This module also supports IPv6. Your IPv6 addresses will be normalized +automatically (i.e. `fe80::00ed:1` equals `fe80:0:0:0:0:0:ed:1`). + +```js +proxyaddr(req, '::1') +proxyaddr(req, ['::1/128', 'fe80::/10']) +``` + +This module will automatically work with IPv4-mapped IPv6 addresses +as well to support node.js in IPv6-only mode. This means that you do +not have to specify both `::ffff:a00:1` and `10.0.0.1`. + +As a convenience, this module also takes certain pre-defined names +in addition to IP addresses, which expand into IP addresses: + +```js +proxyaddr(req, 'loopback') +proxyaddr(req, ['loopback', 'fc00:ac:1ab5:fff::1/64']) +``` + + * `loopback`: IPv4 and IPv6 loopback addresses (like `::1` and + `127.0.0.1`). + * `linklocal`: IPv4 and IPv6 link-local addresses (like + `fe80::1:1:1:1` and `169.254.0.1`). + * `uniquelocal`: IPv4 private addresses and IPv6 unique-local + addresses (like `fc00:ac:1ab5:fff::1` and `192.168.0.1`). + +When `trust` is specified as a function, it will be called for each +address to determine if it is a trusted address. The function is +given two arguments: `addr` and `i`, where `addr` is a string of +the address to check and `i` is a number that represents the distance +from the socket address. + +### proxyaddr.all(req, [trust]) + +Return all the addresses of the request, optionally stopping at the +first untrusted. This array is ordered from closest to furthest +(i.e. `arr[0] === req.connection.remoteAddress`). + +```js +proxyaddr.all(req) +``` + +The optional `trust` argument takes the same arguments as `trust` +does in `proxyaddr(req, trust)`. + +```js +proxyaddr.all(req, 'loopback') +``` + +### proxyaddr.compile(val) + +Compiles argument `val` into a `trust` function. This function takes +the same arguments as `trust` does in `proxyaddr(req, trust)` and +returns a function suitable for `proxyaddr(req, trust)`. + +```js +var trust = proxyaddr.compile('localhost') +var addr = proxyaddr(req, trust) +``` + +This function is meant to be optimized for use against every request. +It is recommend to compile a trust function up-front for the trusted +configuration and pass that to `proxyaddr(req, trust)` for each request. + +## Testing + +```sh +$ npm test +``` + +## Benchmarks + +```sh +$ npm run-script bench +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/proxy-addr.svg +[npm-url]: https://npmjs.org/package/proxy-addr +[node-version-image]: https://img.shields.io/node/v/proxy-addr.svg +[node-version-url]: https://nodejs.org/en/download/ +[travis-image]: https://img.shields.io/travis/jshttp/proxy-addr/master.svg +[travis-url]: https://travis-ci.org/jshttp/proxy-addr +[coveralls-image]: https://img.shields.io/coveralls/jshttp/proxy-addr/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/proxy-addr?branch=master +[downloads-image]: https://img.shields.io/npm/dm/proxy-addr.svg +[downloads-url]: https://npmjs.org/package/proxy-addr diff --git a/node_modules/proxy-addr/index.js b/node_modules/proxy-addr/index.js new file mode 100644 index 0000000..c5266e0 --- /dev/null +++ b/node_modules/proxy-addr/index.js @@ -0,0 +1,327 @@ +/*! + * proxy-addr + * Copyright(c) 2014-2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = proxyaddr; +module.exports.all = alladdrs; +module.exports.compile = compile; + +/** + * Module dependencies. + * @private + */ + +var forwarded = require('forwarded'); +var ipaddr = require('ipaddr.js'); + +/** + * Variables. + * @private + */ + +var digitre = /^[0-9]+$/; +var isip = ipaddr.isValid; +var parseip = ipaddr.parse; + +/** + * Pre-defined IP ranges. + * @private + */ + +var ipranges = { + linklocal: ['169.254.0.0/16', 'fe80::/10'], + loopback: ['127.0.0.1/8', '::1/128'], + uniquelocal: ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16', 'fc00::/7'] +}; + +/** + * Get all addresses in the request, optionally stopping + * at the first untrusted. + * + * @param {Object} request + * @param {Function|Array|String} [trust] + * @public + */ + +function alladdrs(req, trust) { + // get addresses + var addrs = forwarded(req); + + if (!trust) { + // Return all addresses + return addrs; + } + + if (typeof trust !== 'function') { + trust = compile(trust); + } + + for (var i = 0; i < addrs.length - 1; i++) { + if (trust(addrs[i], i)) continue; + + addrs.length = i + 1; + } + + return addrs; +} + +/** + * Compile argument into trust function. + * + * @param {Array|String} val + * @private + */ + +function compile(val) { + if (!val) { + throw new TypeError('argument is required'); + } + + var trust; + + if (typeof val === 'string') { + trust = [val]; + } else if (Array.isArray(val)) { + trust = val.slice(); + } else { + throw new TypeError('unsupported trust argument'); + } + + for (var i = 0; i < trust.length; i++) { + val = trust[i]; + + if (!ipranges.hasOwnProperty(val)) { + continue; + } + + // Splice in pre-defined range + val = ipranges[val]; + trust.splice.apply(trust, [i, 1].concat(val)); + i += val.length - 1; + } + + return compileTrust(compileRangeSubnets(trust)); +} + +/** + * Compile `arr` elements into range subnets. + * + * @param {Array} arr + * @private + */ + +function compileRangeSubnets(arr) { + var rangeSubnets = new Array(arr.length); + + for (var i = 0; i < arr.length; i++) { + rangeSubnets[i] = parseipNotation(arr[i]); + } + + return rangeSubnets; +} + +/** + * Compile range subnet array into trust function. + * + * @param {Array} rangeSubnets + * @private + */ + +function compileTrust(rangeSubnets) { + // Return optimized function based on length + var len = rangeSubnets.length; + return len === 0 + ? trustNone + : len === 1 + ? trustSingle(rangeSubnets[0]) + : trustMulti(rangeSubnets); +} + +/** + * Parse IP notation string into range subnet. + * + * @param {String} note + * @private + */ + +function parseipNotation(note) { + var pos = note.lastIndexOf('/'); + var str = pos !== -1 + ? note.substring(0, pos) + : note; + + if (!isip(str)) { + throw new TypeError('invalid IP address: ' + str); + } + + var ip = parseip(str); + + if (pos === -1 && ip.kind() === 'ipv6' && ip.isIPv4MappedAddress()) { + // Store as IPv4 + ip = ip.toIPv4Address(); + } + + var max = ip.kind() === 'ipv6' + ? 128 + : 32; + + var range = pos !== -1 + ? note.substring(pos + 1, note.length) + : null; + + if (range === null) { + range = max; + } else if (digitre.test(range)) { + range = parseInt(range, 10); + } else if (ip.kind() === 'ipv4' && isip(range)) { + range = parseNetmask(range); + } else { + range = null; + } + + if (range <= 0 || range > max) { + throw new TypeError('invalid range on address: ' + note); + } + + return [ip, range]; +} + +/** + * Parse netmask string into CIDR range. + * + * @param {String} netmask + * @private + */ + +function parseNetmask(netmask) { + var ip = parseip(netmask); + var kind = ip.kind(); + + return kind === 'ipv4' + ? ip.prefixLengthFromSubnetMask() + : null; +} + +/** + * Determine address of proxied request. + * + * @param {Object} request + * @param {Function|Array|String} trust + * @public + */ + +function proxyaddr(req, trust) { + if (!req) { + throw new TypeError('req argument is required'); + } + + if (!trust) { + throw new TypeError('trust argument is required'); + } + + var addrs = alladdrs(req, trust); + var addr = addrs[addrs.length - 1]; + + return addr; +} + +/** + * Static trust function to trust nothing. + * + * @private + */ + +function trustNone() { + return false; +} + +/** + * Compile trust function for multiple subnets. + * + * @param {Array} subnets + * @private + */ + +function trustMulti(subnets) { + return function trust(addr) { + if (!isip(addr)) return false; + + var ip = parseip(addr); + var ipconv; + var kind = ip.kind(); + + for (var i = 0; i < subnets.length; i++) { + var subnet = subnets[i]; + var subnetip = subnet[0]; + var subnetkind = subnetip.kind(); + var subnetrange = subnet[1]; + var trusted = ip; + + if (kind !== subnetkind) { + if (subnetkind === 'ipv4' && !ip.isIPv4MappedAddress()) { + // Incompatible IP addresses + continue; + } + + if (!ipconv) { + // Convert IP to match subnet IP kind + ipconv = subnetkind === 'ipv4' + ? ip.toIPv4Address() + : ip.toIPv4MappedAddress(); + } + + trusted = ipconv; + } + + if (trusted.match(subnetip, subnetrange)) { + return true; + } + } + + return false; + }; +} + +/** + * Compile trust function for single subnet. + * + * @param {Object} subnet + * @private + */ + +function trustSingle(subnet) { + var subnetip = subnet[0]; + var subnetkind = subnetip.kind(); + var subnetisipv4 = subnetkind === 'ipv4'; + var subnetrange = subnet[1]; + + return function trust(addr) { + if (!isip(addr)) return false; + + var ip = parseip(addr); + var kind = ip.kind(); + + if (kind !== subnetkind) { + if (subnetisipv4 && !ip.isIPv4MappedAddress()) { + // Incompatible IP addresses + return false; + } + + // Convert IP to match subnet IP kind + ip = subnetisipv4 + ? ip.toIPv4Address() + : ip.toIPv4MappedAddress(); + } + + return ip.match(subnetip, subnetrange); + }; +} diff --git a/node_modules/proxy-addr/package.json b/node_modules/proxy-addr/package.json new file mode 100644 index 0000000..f2d92f7 --- /dev/null +++ b/node_modules/proxy-addr/package.json @@ -0,0 +1,73 @@ +{ + "_from": "proxy-addr@~1.1.5", + "_id": "proxy-addr@1.1.5", + "_inBundle": false, + "_integrity": "sha1-ccDuOxAt4/IC87ZPYI0XP8uhqRg=", + "_location": "/proxy-addr", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "proxy-addr@~1.1.5", + "name": "proxy-addr", + "escapedName": "proxy-addr", + "rawSpec": "~1.1.5", + "saveSpec": null, + "fetchSpec": "~1.1.5" + }, + "_requiredBy": [ + "/express" + ], + "_resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-1.1.5.tgz", + "_shasum": "71c0ee3b102de3f202f3b64f608d173fcba1a918", + "_spec": "proxy-addr@~1.1.5", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/express", + "author": { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + "bugs": { + "url": "https://github.com/jshttp/proxy-addr/issues" + }, + "bundleDependencies": false, + "dependencies": { + "forwarded": "~0.1.0", + "ipaddr.js": "1.4.0" + }, + "deprecated": false, + "description": "Determine address of proxied request", + "devDependencies": { + "beautify-benchmark": "0.2.4", + "benchmark": "2.1.4", + "istanbul": "0.4.5", + "mocha": "~1.21.5" + }, + "engines": { + "node": ">= 0.6" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "README.md", + "index.js" + ], + "homepage": "https://github.com/jshttp/proxy-addr#readme", + "keywords": [ + "ip", + "proxy", + "x-forwarded-for" + ], + "license": "MIT", + "name": "proxy-addr", + "repository": { + "type": "git", + "url": "git+https://github.com/jshttp/proxy-addr.git" + }, + "scripts": { + "bench": "node benchmark/index.js", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + }, + "version": "1.1.5" +} diff --git a/node_modules/ps-tree/.appveyor.yml b/node_modules/ps-tree/.appveyor.yml new file mode 100644 index 0000000..da3c83f --- /dev/null +++ b/node_modules/ps-tree/.appveyor.yml @@ -0,0 +1,41 @@ +# http://www.appveyor.com/docs/appveyor-yml + +# Fix line endings in Windows. (runs before repo cloning) +init: + - git config --global core.autocrlf true + +# Test against these versions of Node.js. +environment: + matrix: + - nodejs_version: "0.10" + - nodejs_version: "0.12" + - nodejs_version: "4.2" + - nodejs_version: "6.2" + +matrix: + allow_failures: + - nodejs_version: 0.10 + - nodejs_version: 0.12 + +# Install scripts. (runs after repo cloning) +install: + - git rev-parse HEAD + # Get the latest stable version of Node 0.STABLE.latest + - ps: Install-Product node $env:nodejs_version + # Typical npm stuff. + - md C:\nc + - npm config set cache C:\nc + - npm version + - npm install + +# Post-install test scripts. +test_script: + # Output useful info for debugging. + - npm version + - cmd: npm test + +# Don't actually build. +build: off + +# Set build version format here instead of in the admin panel. +version: "{build}" diff --git a/node_modules/ps-tree/.npmignore b/node_modules/ps-tree/.npmignore new file mode 100644 index 0000000..59d842b --- /dev/null +++ b/node_modules/ps-tree/.npmignore @@ -0,0 +1,28 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Commenting this out is preferred by some people, see +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- +node_modules + +# Users Environment Variables +.lock-wscript diff --git a/node_modules/ps-tree/.travis.yml b/node_modules/ps-tree/.travis.yml new file mode 100644 index 0000000..6e3e2a0 --- /dev/null +++ b/node_modules/ps-tree/.travis.yml @@ -0,0 +1,22 @@ +language: node_js +node_js: + - "0.10" + - "0.12" + - "4.4" + - "6.2" +os: + - linux + - centos + - macosx + +before_install: + - travis_retry npm install -g npm@2.14.2 + - travis_retry npm install + +script: + - npm test + +matrix: + allow_failures: + - node_js: "0.10" + - node_js: "0.12" diff --git a/node_modules/ps-tree/LICENSE b/node_modules/ps-tree/LICENSE new file mode 100644 index 0000000..51b00ef --- /dev/null +++ b/node_modules/ps-tree/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Domenic Tarr, Charlie Robbins & the Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/ps-tree/README.md b/node_modules/ps-tree/README.md new file mode 100644 index 0000000..a3f9e8d --- /dev/null +++ b/node_modules/ps-tree/README.md @@ -0,0 +1,83 @@ +# ps-tree + +[![Build Status](https://travis-ci.org/indexzero/ps-tree.svg)](https://travis-ci.org/indexzero/ps-tree) +[![Code Climate](https://codeclimate.com/github/indexzero/ps-tree/badges/gpa.svg)](https://codeclimate.com/github/indexzero/ps-tree) +[![Test Coverage](https://codeclimate.com/github/indexzero/ps-tree/badges/coverage.svg)](https://codeclimate.com/github/indexzero/ps-tree) +[![npm version](https://badge.fury.io/js/ps-tree.svg)](http://badge.fury.io/js/ps-tree) +[![Node.js Version][node-version-image]][node-version-url] +[![Dependency Status](https://david-dm.org/indexzero/ps-tree.svg)](https://david-dm.org/indexzero/ps-tree) +[node-version-image]: https://img.shields.io/node/v/listdirs.svg?style=flat +[node-version-url]: http://nodejs.org/download/ + +Sometimes you cannot kill child processes like you would expect, this a feature of UNIX. + +>in UNIX, a process may terminate by using the exit call, and it's parent process may wait for that event by using the wait system call. the wait system call returns the process identifier of a terminated child, so that the parent tell which of the possibly many children has terminated. If the parent terminates, however, all it's children have assigned as their new parent the init process. Thus, the children still have a parent to collect their status and execution statistics. +> (from "operating system concepts") + +Solution: use `ps-tree` to get all processes that a `child_process` may have started, so that they may all be terminated. + +``` js +var cp = require('child_process'), + psTree = require('ps-tree'); + +var child = cp.exec("node -e 'while (true);'", function () {...}); + +// This will not actually kill the child it will kill the `sh` process. +child.kill(); +``` + +wtf? it's because exec actually works like this: + +``` js +function exec (cmd, cb) { + spawn('sh', ['-c', cmd]); + ... +} +``` + +`sh` starts parses the command string and starts processes, and waits for them to terminate, but `exec` returns a process object with the pid of the `sh` process. +However, since it is in `wait` mode killing it does not kill the children. + +Use `ps-tree` like this: + +``` js +var cp = require('child_process'), + psTree = require('ps-tree'); + +var child = cp.exec("node -e 'while (true);'", function () { /*...*/ }); + +psTree(child.pid, function (err, children) { + cp.spawn('kill', ['-9'].concat(children.map(function (p) { return p.PID }))); +}); +``` + +If you prefer to run **psTree** from the command line, use: `node ./bin/ps-tree.js` + +## Cross Platform support + + +The `ps-tree` module behaves differently on *nix vs. Windows by spawning different programs and parsing their output. This is based on `process.platform` and not on checking to see if a `ps` compatible program exists on the system. + +#### *nix + +1. " " need to be striped +```bash +$ ps -A -o comm,ppid,pid,stat +COMMAND PPID PID STAT +bbsd 2899 16958 Ss +watch 1914 16964 Z +ps 20688 16965 R+ +``` + +### Windows +1. `wmic PROCESS WHERE ParentProcessId=4604 GET Name,ParentProcessId,ProcessId,Status)` +2. The order of head columns is fixed +```shell +> wmic PROCESS GET Name,ProcessId,ParentProcessId,Status +Name ParentProcessId ProcessId Status +System Idle Process 0 0 +System 0 4 +smss.exe 4 228 +``` + +### LICENSE: MIT diff --git a/node_modules/ps-tree/bin/ps-tree.js b/node_modules/ps-tree/bin/ps-tree.js new file mode 100644 index 0000000..2bc9866 --- /dev/null +++ b/node_modules/ps-tree/bin/ps-tree.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node + +'use strict'; + +// +// Change the default parent PID if running +// under Windows. +// +var ppid = 1; +if (process.platform === 'win32') { + ppid = 0; +} + +require('../')(process.argv[2] || ppid, function (err, data) { + console.log(data); +}); diff --git a/node_modules/ps-tree/index.js b/node_modules/ps-tree/index.js new file mode 100755 index 0000000..24e3284 --- /dev/null +++ b/node_modules/ps-tree/index.js @@ -0,0 +1,118 @@ +'use strict'; + +var spawn = require('child_process').spawn, + es = require('event-stream'); + +module.exports = function childrenOfPid(pid, callback) { + var headers = null; + + if (typeof callback !== 'function') { + throw new Error('childrenOfPid(pid, callback) expects callback'); + } + + if (typeof pid === 'number') { + pid = pid.toString(); + } + + // + // The `ps-tree` module behaves differently on *nix vs. Windows + // by spawning different programs and parsing their output. + // + // Linux: + // 1. " " need to be striped + // ```bash + // $ ps -A -o comm,ppid,pid,stat + // COMMAND PPID PID STAT + // bbsd 2899 16958 Ss + // watch 1914 16964 Z + // ps 20688 16965 R+ + // ``` + // + // Win32: + // 1. wmic PROCESS WHERE ParentProcessId=4604 GET Name,ParentProcessId,ProcessId,Status) + // 2. The order of head columns is fixed + // ```shell + // > wmic PROCESS GET Name,ProcessId,ParentProcessId,Status + // Name ParentProcessId ProcessId Status + // System Idle Process 0 0 + // System 0 4 + // smss.exe 4 228 + // ``` + + var processLister; + if (process.platform === 'win32') { + // See also: https://github.com/nodejs/node-v0.x-archive/issues/2318 + processLister = spawn('wmic.exe', ['PROCESS', 'GET', 'Name,ProcessId,ParentProcessId,Status']); + } else { + processLister = spawn('ps', ['-A', '-o', 'ppid,pid,stat,comm']); + } + + es.connect( + // spawn('ps', ['-A', '-o', 'ppid,pid,stat,comm']).stdout, + processLister.stdout, + es.split(), + es.map(function (line, cb) { //this could parse alot of unix command output + var columns = line.trim().split(/\s+/); + if (!headers) { + headers = columns; + + // + // Rename Win32 header name, to as same as the linux, for compatible. + // + headers = headers.map(normalizeHeader); + return cb(); + } + + var row = {}; + // For each header + var h = headers.slice(); + while (h.length) { + row[h.shift()] = h.length ? columns.shift() : columns.join(' '); + } + + return cb(null, row); + }), + es.writeArray(function (err, ps) { + var parents = [pid], + children = []; + + ps.forEach(function (proc) { + if (parents.indexOf(proc.PPID) !== -1) { + parents.push(proc.PID) + children.push(proc) + } + }); + + callback(null, children); + }) + ).on('error', callback) +} + +/** + * Normalizes the given header `str` from the Windows + * title to the *nix title. + * + * @param {string} str Header string to normalize + */ +function normalizeHeader(str) { + if (process.platform !== 'win32') { + return str; + } + + switch (str) { + case 'Name': + return 'COMMAND'; + break; + case 'ParentProcessId': + return 'PPID'; + break; + case 'ProcessId': + return 'PID'; + break; + case 'Status': + return 'STAT'; + break; + default: + throw new Error('Unknown process listing header: ' + str); + } +} diff --git a/node_modules/ps-tree/package.json b/node_modules/ps-tree/package.json new file mode 100644 index 0000000..8ad1356 --- /dev/null +++ b/node_modules/ps-tree/package.json @@ -0,0 +1,79 @@ +{ + "_from": "ps-tree@^1.1.0", + "_id": "ps-tree@1.1.0", + "_inBundle": false, + "_integrity": "sha1-tCGyQUDWID8e08dplrRCewjowBQ=", + "_location": "/ps-tree", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ps-tree@^1.1.0", + "name": "ps-tree", + "escapedName": "ps-tree", + "rawSpec": "^1.1.0", + "saveSpec": null, + "fetchSpec": "^1.1.0" + }, + "_requiredBy": [ + "/pstree.remy" + ], + "_resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.1.0.tgz", + "_shasum": "b421b24140d6203f1ed3c76996b4427b08e8c014", + "_spec": "ps-tree@^1.1.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/pstree.remy", + "author": { + "name": "Charlie Robbins", + "email": "charlie.robbins@gmail.com" + }, + "bugs": { + "url": "https://github.com/indexzero/ps-tree/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Zhuohuan LI", + "email": "zixia@zixia.net", + "url": "https://github.com/zixia" + } + ], + "dependencies": { + "event-stream": "~3.3.0" + }, + "deprecated": false, + "description": "Get all children of a pid", + "devDependencies": { + "chalk": "^1.0.0", + "codeclimate-test-reporter": "0.0.4", + "cross-env": "^1.0.8", + "istanbul": "^0.3.20", + "pre-commit": "0.0.9", + "precommit": "^1.1.5", + "tape": "^3.0.3", + "tree-kill": "^1.1.0" + }, + "directories": { + "test": "test" + }, + "engines": { + "node": ">= 0.10" + }, + "homepage": "http://github.com/indexzero/ps-tree", + "license": "MIT", + "name": "ps-tree", + "pre-commit": [ + "coverage", + "codeclimate" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/indexzero/ps-tree.git" + }, + "scripts": { + "_comment": "https://github.com/gotwarlost/istanbul#usage-on-windows", + "codeclimate": "cross-env CODECLIMATE_REPO_TOKEN=84436b4f13c70ace9c62e7f04928bf23c234eb212c0232d39d7fb1535beb2da5 codeclimate < coverage/lcov.info", + "coverage": "npm test && istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100", + "test": "istanbul cover node_modules/tape/bin/tape test/test.js test/direct.js" + }, + "version": "1.1.0" +} diff --git a/node_modules/ps-tree/test/direct.js b/node_modules/ps-tree/test/direct.js new file mode 100644 index 0000000..5bb040e --- /dev/null +++ b/node_modules/ps-tree/test/direct.js @@ -0,0 +1,20 @@ +var test = require('tape'); +var chalk = require('chalk'); +var cp = require('child_process'); + +var red = chalk.red, + green = chalk.green, + cyan = chalk.cyan; + +test(cyan('Directly Execute bin/ps-tree.js'), function (t) { + var first = cp.exec('node -v', function (error, stdout, stderr) {}); + var child = cp.exec('node ./bin/ps-tree.js', function (error, data) { + // console.log('data: ' + data.length); + if (error !== null) { + console.log(red('exec error: ' + error)); + } + }); + + t.true(child.pid, green('✓ Called ./bin/ps-tree.js directly. worked as expected')); + t.end(); +}); diff --git a/node_modules/ps-tree/test/exec/child.js b/node_modules/ps-tree/test/exec/child.js new file mode 100644 index 0000000..7fa13c9 --- /dev/null +++ b/node_modules/ps-tree/test/exec/child.js @@ -0,0 +1,7 @@ +// does nothing child process +console.log("Child process.id: " + process.pid); +console.log(" - - - - - - - - - - - - - - - - - - - - - - - "); + +setTimeout(function () { + /* Does nothing, but prevents exit */ +}, 1000); diff --git a/node_modules/ps-tree/test/exec/parent.js b/node_modules/ps-tree/test/exec/parent.js new file mode 100644 index 0000000..7b98d1f --- /dev/null +++ b/node_modules/ps-tree/test/exec/parent.js @@ -0,0 +1,18 @@ +var cp = require('child_process'); +var chalk = require('chalk'); +var red = chalk.red +var green = chalk.green +var cyan = chalk.cyan; +var count = 0; + +while(count < 10) { + var child = cp.exec("node ./test/exec/child.js", function(error, stdout, stderr) { + console.log('stdout: ' + stdout); + console.log(red('stderr: ' + stderr)); + if (error !== null) { + console.log(red('exec error: ' + error)); + } + }) + + console.log("child pid: %s | count: %s", child.pid, ++count); +} diff --git a/node_modules/ps-tree/test/test.js b/node_modules/ps-tree/test/test.js new file mode 100644 index 0000000..9e655f2 --- /dev/null +++ b/node_modules/ps-tree/test/test.js @@ -0,0 +1,70 @@ +var path = require('path'); +var test = require('tape'); +var chalk = require('chalk'); +var cp = require('child_process'); +var treeKill = require('tree-kill'); +var psTree = require('../'); + +var red = chalk.red, + green = chalk.green, + cyan = chalk.cyan; + +var scripts = { + parent: path.join(__dirname, 'exec', 'parent.js'), + child: path.join(__dirname, 'exec', 'child.js') +}; + +test(cyan('Spawn a Parent process which has a Two Child Processes'), function (t) { + var parent = cp.exec('node ' + scripts.parent, function (error, stdout, stderr) {}); + + setTimeout(function () { + psTree(parent.pid, function (err, children) { + if (err) { console.log(err); } + console.log(red('Children: '), children, '\n'); + t.true(children.length > 0, green('✓ There are ' + children.length + ' active child processes')); + treeKill(parent.pid); + }); + + setTimeout(function () { + psTree(parent.pid, function (err, children) { + if (err) { console.log(err); } + // console.log('Children: ', children, '\n'); + // console.log(' ') + t.equal(children.length, 0, green('✓ No more active child processes (we killed them)')); + t.end(); + }); + }, 2000); // give psTree time to kill the processes + }, 500); // give the child process time to spawn + // need more time on a slow(or heavy load server). maybe promise.then is better instead of the timeout +}); + +test(cyan('FORCE ERROR by calling psTree without supplying a Callback'), function (t) { + var errmsg = 'Error: childrenOfPid(pid, callback) expects callback' + // Attempt to call psTree without a callback + try { psTree(1234); } + catch (e) { + t.equal(e.toString(), errmsg, green('✓ Fails when no callback supplied (as expected)')) + } + + t.end(); +}); + + +test(cyan('Spawn a Child Process and psTree with a String as pid'), function (t) { + var child = cp.exec('node ' + scripts.child, function(error, stdout, stderr) {}); + setTimeout(function(){ + psTree(child.pid.toString(), function (err, children) { + if (err) { console.log(err); } + // cp.spawn('kill', ['-9'].concat(children.map(function (p) { return p.PID }))) + treeKill(child.pid); + }); + + setTimeout(function() { + psTree(child.pid.toString(), function (err, children) { + if (err) { console.log(err); } + t.equal(children.length, 0, green('✓ No more active child processes')); + t.end(); + }); + }, 1000); // give psTree time to kill the processes + }, 200); // give the child process time to spawn +}); diff --git a/node_modules/pseudomap/LICENSE b/node_modules/pseudomap/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/pseudomap/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/node_modules/pseudomap/README.md b/node_modules/pseudomap/README.md new file mode 100644 index 0000000..778bf01 --- /dev/null +++ b/node_modules/pseudomap/README.md @@ -0,0 +1,60 @@ +# pseudomap + +A thing that is a lot like ES6 `Map`, but without iterators, for use +in environments where `for..of` syntax and `Map` are not available. + +If you need iterators, or just in general a more faithful polyfill to +ES6 Maps, check out [es6-map](http://npm.im/es6-map). + +If you are in an environment where `Map` is supported, then that will +be returned instead, unless `process.env.TEST_PSEUDOMAP` is set. + +You can use any value as keys, and any value as data. Setting again +with the identical key will overwrite the previous value. + +Internally, data is stored on an `Object.create(null)` style object. +The key is coerced to a string to generate the key on the internal +data-bag object. The original key used is stored along with the data. + +In the event of a stringified-key collision, a new key is generated by +appending an increasing number to the stringified-key until finding +either the intended key or an empty spot. + +Note that because object traversal order of plain objects is not +guaranteed to be identical to insertion order, the insertion order +guarantee of `Map.prototype.forEach` is not guaranteed in this +implementation. However, in all versions of Node.js and V8 where this +module works, `forEach` does traverse data in insertion order. + +## API + +Most of the [Map +API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map), +with the following exceptions: + +1. A `Map` object is not an iterator. +2. `values`, `keys`, and `entries` methods are not implemented, + because they return iterators. +3. The argument to the constructor can be an Array of `[key, value]` + pairs, or a `Map` or `PseudoMap` object. But, since iterators + aren't used, passing any plain-old iterator won't initialize the + map properly. + +## USAGE + +Use just like a regular ES6 Map. + +```javascript +var PseudoMap = require('pseudomap') + +// optionally provide a pseudomap, or an array of [key,value] pairs +// as the argument to initialize the map with +var myMap = new PseudoMap() + +myMap.set(1, 'number 1') +myMap.set('1', 'string 1') +var akey = {} +var bkey = {} +myMap.set(akey, { some: 'data' }) +myMap.set(bkey, { some: 'other data' }) +``` diff --git a/node_modules/pseudomap/map.js b/node_modules/pseudomap/map.js new file mode 100644 index 0000000..7db1599 --- /dev/null +++ b/node_modules/pseudomap/map.js @@ -0,0 +1,9 @@ +if (process.env.npm_package_name === 'pseudomap' && + process.env.npm_lifecycle_script === 'test') + process.env.TEST_PSEUDOMAP = 'true' + +if (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) { + module.exports = Map +} else { + module.exports = require('./pseudomap') +} diff --git a/node_modules/pseudomap/package.json b/node_modules/pseudomap/package.json new file mode 100644 index 0000000..951dd6c --- /dev/null +++ b/node_modules/pseudomap/package.json @@ -0,0 +1,54 @@ +{ + "_from": "pseudomap@^1.0.2", + "_id": "pseudomap@1.0.2", + "_inBundle": false, + "_integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "_location": "/pseudomap", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "pseudomap@^1.0.2", + "name": "pseudomap", + "escapedName": "pseudomap", + "rawSpec": "^1.0.2", + "saveSpec": null, + "fetchSpec": "^1.0.2" + }, + "_requiredBy": [ + "/lru-cache" + ], + "_resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "_shasum": "f052a28da70e618917ef0a8ac34c1ae5a68286b3", + "_spec": "pseudomap@^1.0.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/lru-cache", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/pseudomap/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "A thing that is a lot like ES6 `Map`, but without iterators, for use in environments where `for..of` syntax and `Map` are not available.", + "devDependencies": { + "tap": "^2.3.1" + }, + "directories": { + "test": "test" + }, + "homepage": "https://github.com/isaacs/pseudomap#readme", + "license": "ISC", + "main": "map.js", + "name": "pseudomap", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/pseudomap.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "version": "1.0.2" +} diff --git a/node_modules/pseudomap/pseudomap.js b/node_modules/pseudomap/pseudomap.js new file mode 100644 index 0000000..25a21d8 --- /dev/null +++ b/node_modules/pseudomap/pseudomap.js @@ -0,0 +1,113 @@ +var hasOwnProperty = Object.prototype.hasOwnProperty + +module.exports = PseudoMap + +function PseudoMap (set) { + if (!(this instanceof PseudoMap)) // whyyyyyyy + throw new TypeError("Constructor PseudoMap requires 'new'") + + this.clear() + + if (set) { + if ((set instanceof PseudoMap) || + (typeof Map === 'function' && set instanceof Map)) + set.forEach(function (value, key) { + this.set(key, value) + }, this) + else if (Array.isArray(set)) + set.forEach(function (kv) { + this.set(kv[0], kv[1]) + }, this) + else + throw new TypeError('invalid argument') + } +} + +PseudoMap.prototype.forEach = function (fn, thisp) { + thisp = thisp || this + Object.keys(this._data).forEach(function (k) { + if (k !== 'size') + fn.call(thisp, this._data[k].value, this._data[k].key) + }, this) +} + +PseudoMap.prototype.has = function (k) { + return !!find(this._data, k) +} + +PseudoMap.prototype.get = function (k) { + var res = find(this._data, k) + return res && res.value +} + +PseudoMap.prototype.set = function (k, v) { + set(this._data, k, v) +} + +PseudoMap.prototype.delete = function (k) { + var res = find(this._data, k) + if (res) { + delete this._data[res._index] + this._data.size-- + } +} + +PseudoMap.prototype.clear = function () { + var data = Object.create(null) + data.size = 0 + + Object.defineProperty(this, '_data', { + value: data, + enumerable: false, + configurable: true, + writable: false + }) +} + +Object.defineProperty(PseudoMap.prototype, 'size', { + get: function () { + return this._data.size + }, + set: function (n) {}, + enumerable: true, + configurable: true +}) + +PseudoMap.prototype.values = +PseudoMap.prototype.keys = +PseudoMap.prototype.entries = function () { + throw new Error('iterators are not implemented in this version') +} + +// Either identical, or both NaN +function same (a, b) { + return a === b || a !== a && b !== b +} + +function Entry (k, v, i) { + this.key = k + this.value = v + this._index = i +} + +function find (data, k) { + for (var i = 0, s = '_' + k, key = s; + hasOwnProperty.call(data, key); + key = s + i++) { + if (same(data[key].key, k)) + return data[key] + } +} + +function set (data, k, v) { + for (var i = 0, s = '_' + k, key = s; + hasOwnProperty.call(data, key); + key = s + i++) { + if (same(data[key].key, k)) { + data[key].value = v + return + } + } + data.size++ + data[key] = new Entry(k, v, key) +} diff --git a/node_modules/pseudomap/test/basic.js b/node_modules/pseudomap/test/basic.js new file mode 100644 index 0000000..4378e45 --- /dev/null +++ b/node_modules/pseudomap/test/basic.js @@ -0,0 +1,86 @@ +var t = require('tap') + +process.env.TEST_PSEUDOMAP = 'true' + +var PM = require('../') +runTests(PM) + +// if possible, verify that Map also behaves the same way +if (typeof Map === 'function') + runTests(Map) + + +function runTests (Map) { + t.throws(Map) + + var m = new Map() + + t.equal(m.size, 0) + + m.set(1, '1 string') + t.equal(m.get(1), '1 string') + t.equal(m.size, 1) + m.size = 1000 + t.equal(m.size, 1) + m.size = 0 + t.equal(m.size, 1) + + m = new Map([[1, 'number 1'], ['1', 'string 1']]) + t.equal(m.get(1), 'number 1') + t.equal(m.get('1'), 'string 1') + t.equal(m.size, 2) + + m = new Map(m) + t.equal(m.get(1), 'number 1') + t.equal(m.get('1'), 'string 1') + t.equal(m.size, 2) + + var akey = {} + var bkey = {} + m.set(akey, { some: 'data' }) + m.set(bkey, { some: 'other data' }) + t.same(m.get(akey), { some: 'data' }) + t.same(m.get(bkey), { some: 'other data' }) + t.equal(m.size, 4) + + var x = /x/ + var y = /x/ + m.set(x, 'x regex') + m.set(y, 'y regex') + t.equal(m.get(x), 'x regex') + m.set(x, 'x again') + t.equal(m.get(x), 'x again') + t.equal(m.size, 6) + + m.set(NaN, 'not a number') + t.equal(m.get(NaN), 'not a number') + m.set(NaN, 'it is a ' + typeof NaN) + t.equal(m.get(NaN), 'it is a number') + m.set('NaN', 'stringie nan') + t.equal(m.get(NaN), 'it is a number') + t.equal(m.get('NaN'), 'stringie nan') + t.equal(m.size, 8) + + m.delete(NaN) + t.equal(m.get(NaN), undefined) + t.equal(m.size, 7) + + var expect = [ + { value: 'number 1', key: 1 }, + { value: 'string 1', key: '1' }, + { value: { some: 'data' }, key: {} }, + { value: { some: 'other data' }, key: {} }, + { value: 'x again', key: /x/ }, + { value: 'y regex', key: /x/ }, + { value: 'stringie nan', key: 'NaN' } + ] + var actual = [] + + m.forEach(function (value, key) { + actual.push({ value: value, key: key }) + }) + t.same(actual, expect) + + m.clear() + t.equal(m.size, 0) +} diff --git a/node_modules/pstree.remy/.travis.yml b/node_modules/pstree.remy/.travis.yml new file mode 100644 index 0000000..5bf093e --- /dev/null +++ b/node_modules/pstree.remy/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +cache: + directories: + - ~/.npm +notifications: + email: false +node_js: + - '8' diff --git a/node_modules/pstree.remy/lib/index.js b/node_modules/pstree.remy/lib/index.js new file mode 100644 index 0000000..e371222 --- /dev/null +++ b/node_modules/pstree.remy/lib/index.js @@ -0,0 +1,28 @@ +const exec = require('child_process').exec; +const psTree = require('ps-tree'); +const utils = require('./utils'); +var hasPS = true; + +// discover if the OS has `ps`, and therefore can use psTree +exec('ps', error => { + module.exports.hasPS = hasPS = !error; +}); + +module.exports = function main(pid, callback) { + if (typeof pid === 'number') { + pid = pid.toString(); + } + + if (hasPS && !process.env.NO_PS) { + return psTree(pid, callback); + } + + utils + .getStat() + .then(utils.tree) + .then(tree => utils.pidsForTree(tree, pid)) + .then(res => callback(null, res)) + .catch(error => callback(error)); +}; + +module.exports.hasPS = hasPS; diff --git a/node_modules/pstree.remy/lib/utils.js b/node_modules/pstree.remy/lib/utils.js new file mode 100644 index 0000000..e438af9 --- /dev/null +++ b/node_modules/pstree.remy/lib/utils.js @@ -0,0 +1,56 @@ +const spawn = require('child_process').spawn; + +module.exports = { tree, pidsForTree, getStat }; + +function getStat() { + return new Promise(resolve => { + const command = `ls /proc | grep -E '^[0-9]+$' | xargs -I{} cat /proc/{}/stat`; + const child = spawn('sh', ['-c', command], { + stdio: ['pipe', 'pipe', 'pipe'], + }); + + var res = ''; + child.stdout.on('data', data => (res += data)); + child.on('close', () => resolve(res)); + }); +} + +function template(s) { + var stat = null; + // 'pid', 'comm', 'state', 'ppid', 'pgrp' + // %d (%s) %c %d %d + s.replace( + /(\d+) \((.*?)\)\s(.+?)\s(\d+)\s/g, + (all, PID, COMMAND, STAT, PPID) => { + stat = { PID, COMMAND, PPID, STAT }; + } + ); + + return stat; +} + +function tree(stats) { + const processes = stats + .split('\n') + .map(template) + .filter(Boolean); + + return processes; +} + +function pidsForTree(tree, pid) { + if (typeof pid === 'number') { + pid = pid.toString(); + } + const parents = [pid]; + const children = []; + + tree.forEach(proc => { + if (parents.indexOf(proc.PPID) !== -1) { + parents.push(proc.PID); + children.push(proc); + } + }); + + return children; +} diff --git a/node_modules/pstree.remy/package.json b/node_modules/pstree.remy/package.json new file mode 100644 index 0000000..231cf28 --- /dev/null +++ b/node_modules/pstree.remy/package.json @@ -0,0 +1,52 @@ +{ + "_from": "pstree.remy@^1.1.0", + "_id": "pstree.remy@1.1.0", + "_inBundle": false, + "_integrity": "sha512-q5I5vLRMVtdWa8n/3UEzZX7Lfghzrg9eG2IKk2ENLSofKRCXVqMvMUHxCKgXNaqH/8ebhBxrqftHWnyTFweJ5Q==", + "_location": "/pstree.remy", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "pstree.remy@^1.1.0", + "name": "pstree.remy", + "escapedName": "pstree.remy", + "rawSpec": "^1.1.0", + "saveSpec": null, + "fetchSpec": "^1.1.0" + }, + "_requiredBy": [ + "/nodemon" + ], + "_resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.0.tgz", + "_shasum": "f2af27265bd3e5b32bbfcc10e80bac55ba78688b", + "_spec": "pstree.remy@^1.1.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/nodemon", + "author": { + "name": "Remy Sharp" + }, + "bundleDependencies": false, + "dependencies": { + "ps-tree": "^1.1.0" + }, + "deprecated": false, + "description": "Collects the full tree of processes from /proc", + "devDependencies": { + "tap": "^11.0.0" + }, + "directories": { + "test": "tests" + }, + "keywords": [ + "ps", + "pstree", + "ps tree" + ], + "license": "MIT", + "main": "lib/index.js", + "name": "pstree.remy", + "scripts": { + "test": "NO_PS=1 tap tests/*.test.js" + }, + "version": "1.1.0" +} diff --git a/node_modules/pstree.remy/tests/fixtures/out1 b/node_modules/pstree.remy/tests/fixtures/out1 new file mode 100644 index 0000000..abfe581 --- /dev/null +++ b/node_modules/pstree.remy/tests/fixtures/out1 @@ -0,0 +1,10 @@ +1 (npm) S 0 1 1 34816 1 4210944 11112 0 0 0 45 8 0 0 20 0 10 0 330296 1089871872 11809 18446744073709551615 4194304 29343848 140726436642896 0 0 0 0 4096 2072112895 0 0 0 17 0 0 0 0 0 0 31441000 31537208 37314560 140726436650815 140726436650847 140726436650847 140726436650986 0 +15 (sh) S 1 1 1 34816 1 4210688 115 0 0 0 0 0 0 0 20 0 1 0 330372 4399104 187 18446744073709551615 94374393548800 94374393655428 140722913272992 0 0 0 0 0 65538 0 0 0 17 0 0 0 0 0 0 94374395756424 94374395761184 94374404673536 140722913278928 140722913278959 140722913278959 140722913284080 0 +16 (node) S 15 1 1 34816 1 4210688 6930 103 0 0 32 2 0 0 20 0 10 0 330373 1068478464 8412 18446744073709551615 4194304 29343848 140727228046064 0 0 0 0 4096 134300162 0 0 0 17 1 0 0 1 0 0 31441000 31537208 52584448 140727228050313 140727228050383 140727228050383 140727228055530 0 +27 (sh) S 16 1 1 34816 1 4210688 111 0 0 0 0 0 0 0 20 0 1 0 330410 4399104 193 18446744073709551615 94848235986944 94848236093572 140727019991184 0 0 0 0 0 65538 0 0 0 17 1 0 0 0 0 0 94848238194568 94848238199328 94848261660672 140727019998122 140727019998165 140727019998165 140727020003312 0 +28 (node) S 27 1 1 34816 1 4210688 3576 268 0 0 12 2 0 0 20 0 10 0 330411 930213888 6760 18446744073709551615 4194304 29343848 140726559664992 0 0 0 0 4096 134300162 0 0 0 17 1 0 0 0 0 0 31441000 31537208 32591872 140726559669117 140726559669199 140726559669199 140726559674346 0 +39 (node) S 28 1 1 34816 1 4210688 47517 0 0 0 151 9 0 0 20 0 6 0 330427 985739264 31859 18446744073709551615 4194304 29343848 140737324503920 0 0 0 0 4096 134234626 0 0 0 17 0 0 0 0 0 0 31441000 31537208 51585024 140737324510060 140737324510159 140737324510159 140737324515306 0 +45 (bash) S 0 45 45 34817 50 4210944 752 256 0 0 2 0 0 0 20 0 1 0 331039 18628608 789 18446744073709551615 4194304 5242124 140724425887696 0 0 0 65536 3670020 1266777851 0 0 0 17 1 0 0 0 0 0 7341384 7388228 30310400 140724425891678 140724425891683 140724425891683 140724425891822 0 +cat: /proc/50/stat: No such file or directory +cat: /proc/51/stat: No such file or directory +52 (xargs) S 45 50 45 34817 50 4210688 179 661 0 0 0 0 0 0 20 0 1 0 331544 4608000 346 18446744073709551615 94587588550656 94587588614028 140735223856048 0 0 0 0 0 2560 0 0 0 17 1 0 0 0 0 0 94587590711464 94587590713504 94587603169280 140735223861006 140735223861035 140735223861035 140735223861225 0 diff --git a/node_modules/pstree.remy/tests/fixtures/out2 b/node_modules/pstree.remy/tests/fixtures/out2 new file mode 100644 index 0000000..3b31137 --- /dev/null +++ b/node_modules/pstree.remy/tests/fixtures/out2 @@ -0,0 +1,29 @@ +cat: /proc/4087/stat: No such file or directory +cat: /proc/4088/stat: No such file or directory +1 (init) S 0 1 1 0 -1 4210944 9227 55994 29 319 7 5 68 16 20 0 1 0 1286281 33660928 855 18446744073709551615 1 1 0 0 0 0 0 4096 536962595 0 0 0 17 4 0 0 3 0 0 0 0 0 0 0 0 0 0 +1032 (ntpd) S 1 1032 1032 0 -1 4211008 178 0 1 0 0 0 0 0 20 0 1 0 1287033 25743360 1058 18446744073709551615 1 1 0 0 0 0 0 4096 27207 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +126 (irqbalance) S 1 126 126 0 -1 1077952832 1217 0 0 0 1 6 0 0 20 0 1 0 1286749 20189184 647 18446744073709551615 1 1 0 0 0 0 0 0 3 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +181 (mysqld) S 1 181 181 0 -1 4210944 6399 0 46 0 8 6 0 0 20 0 22 0 1286761 748453888 14476 18446744073709551615 1 1 0 0 0 0 552967 4096 26345 0 0 0 17 4 0 0 10 0 0 0 0 0 0 0 0 0 0 +194 (memcached) S 1 187 187 0 -1 4210944 252 0 4 0 0 0 0 0 20 0 6 0 1286766 333221888 648 18446744073709551615 1 1 0 0 0 0 0 4096 2 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +243 (dbus-daemon) S 1 243 243 0 -1 4211008 67 0 0 0 0 0 0 0 20 0 1 0 1286779 40087552 598 18446744073709551615 1 1 0 0 0 0 0 0 16385 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +254 (rsyslogd) S 1 254 254 0 -1 4211008 107 0 0 0 2 2 0 0 20 0 3 0 1286782 186601472 696 18446744073709551615 1 1 0 0 0 0 0 16781830 1133601 0 0 0 17 5 0 0 0 0 0 0 0 0 0 0 0 0 0 +265 (systemd-logind) S 1 265 265 0 -1 4210944 276 0 2 0 0 0 0 0 20 0 1 0 1286786 35880960 720 18446744073709551615 1 1 0 0 0 0 0 0 0 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +333 (postgres) S 1 303 303 0 -1 4210688 3169 3466 15 18 0 1 1 1 20 0 1 0 1286817 156073984 5002 18446744073709551615 1 1 0 0 0 0 0 19935232 84487 0 0 0 17 5 0 0 1 0 0 0 0 0 0 0 0 0 0 +359 (postgres) S 333 359 359 0 -1 4210752 90 0 0 0 0 0 0 0 20 0 1 0 1286822 156073984 827 18446744073709551615 1 1 0 0 0 0 0 16805888 2567 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +360 (postgres) S 333 360 360 0 -1 4210752 119 0 0 0 0 0 0 0 20 0 1 0 1286822 156073984 827 18446744073709551615 1 1 0 0 0 0 0 16791554 16901 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +361 (postgres) S 333 361 361 0 -1 4210752 87 0 0 0 0 0 0 0 20 0 1 0 1286822 156073984 827 18446744073709551615 1 1 0 0 0 0 0 16791552 16903 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +362 (postgres) S 333 362 362 0 -1 4210752 292 0 3 0 0 0 0 0 20 0 1 0 1286822 156930048 1373 18446744073709551615 1 1 0 0 0 0 0 19927040 27271 0 0 0 17 5 0 0 0 0 0 0 0 0 0 0 0 0 0 +363 (postgres) S 333 363 363 0 -1 4210752 82 0 0 0 0 0 0 0 20 0 1 0 1286822 115924992 887 18446744073709551615 1 1 0 0 0 0 0 16808450 5 0 0 0 17 5 0 0 0 0 0 0 0 0 0 0 0 0 0 +4050 (npm) S 50 50 50 34817 50 4210688 5109 0 0 0 36 3 0 0 20 0 10 0 1292968 738025472 10051 18446744073709551615 4194304 33165900 140723623956256 0 0 0 0 4096 134300162 0 0 0 17 4 0 0 0 0 0 35263056 35370992 48369664 140723623964237 140723623964294 140723623964294 140723623968712 0 +4060 (sh) S 4050 50 50 34817 50 4210688 121 0 0 0 0 0 0 0 20 0 1 0 1293007 4579328 174 18446744073709551615 94347643936768 94347644049516 140735136055088 0 0 0 0 0 65538 1 0 0 17 5 0 0 0 0 0 94347646148008 94347646153216 94347660038144 140735136063095 140735136063129 140735136063129 140735136071664 0 +4061 (node) S 4060 50 50 34817 50 4210688 6501 0 0 0 42 2 0 0 20 0 6 0 1293008 705769472 10211 18446744073709551615 4194304 33165900 140730532686288 0 0 0 0 4096 2072111671 0 0 0 17 5 0 0 0 0 0 35263056 35370992 45867008 140730532695579 140730532695657 140730532695657 140730532704200 0 +4067 (node) S 4061 50 50 34817 50 4210688 6746 221 0 0 38 3 0 0 20 0 10 0 1293051 738910208 10527 18446744073709551615 4194304 33165900 140724824971632 0 0 0 0 4096 2072111671 0 0 0 17 4 0 0 0 0 0 35263056 35370992 68595712 140724824980995 140724824981063 140724824981063 140724824989640 0 +4079 (sh) S 4067 50 50 34817 50 4210688 118 0 0 0 0 0 0 0 20 0 1 0 1293092 4579328 194 18446744073709551615 94573702131712 94573702244460 140724712357120 0 0 0 0 0 65538 1 0 0 17 4 0 0 0 0 0 94573704342952 94573704348160 94573718511616 140724712361487 140724712361583 140724712361583 140724712370160 0 +4080 (node) S 4079 50 50 34817 50 4210688 2428 0 0 0 8 1 0 0 20 0 6 0 1293093 693059584 7251 18446744073709551615 4194304 33165900 140726023392816 0 0 0 0 4096 134234626 0 0 0 17 5 0 0 0 0 0 35263056 35370992 55226368 140726023396847 140726023396935 140726023396935 140726023405512 0 +4086 (sh) S 4067 50 50 34817 50 4210688 131 244 0 0 0 0 0 0 20 0 1 0 1293143 4579328 200 18446744073709551615 94347550273536 94347550386284 140737219399136 0 0 0 0 0 65538 1 0 0 17 5 0 0 0 0 0 94347552484776 94347552489984 94347554299904 140737219403308 140737219403375 140737219403375 140737219411952 0 +4089 (xargs) S 4086 50 50 34817 50 4210688 333 1924 0 0 0 0 0 0 20 0 1 0 1293143 17600512 477 18446744073709551615 4194304 4232732 140721633759248 0 0 0 0 0 0 1 0 0 17 5 0 0 0 0 0 6331920 6332980 32182272 140721633762891 140721633762920 140721633762920 140721633771497 0 +50 (bash) S 0 50 50 34817 50 4210944 43914 1032463 9 705 44 21 4213 818 20 0 1 0 1286336 42266624 3599 18446744073709551615 4194304 5173404 140732749083280 0 0 0 65536 4 1132560123 1 0 0 17 4 0 0 410 0 0 7273968 7310504 21196800 140732749086490 140732749086517 140732749086517 140732749086702 0 +79 (acpid) S 1 79 79 0 -1 4210752 46 0 0 0 0 0 0 0 20 0 1 0 1286717 4493312 407 18446744073709551615 1 1 0 0 0 0 0 4096 16391 0 0 0 17 5 0 0 0 0 0 0 0 0 0 0 0 0 0 +83 (sshd) S 1 83 83 0 -1 4210944 354 0 27 0 0 0 0 0 20 0 1 0 1286718 62873600 1290 18446744073709551615 1 1 0 0 0 0 0 4096 81925 0 0 0 17 4 0 0 30 0 0 0 0 0 0 0 0 0 0 +94 (cron) S 1 94 94 0 -1 1077952576 103 449 0 1 0 0 0 0 20 0 1 0 1286743 24240128 559 18446744073709551615 1 1 0 0 0 0 0 0 65537 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +95 (atd) S 1 95 95 0 -1 1077952576 28 0 0 0 0 0 0 0 20 0 1 0 1286743 19615744 41 18446744073709551615 1 1 0 0 0 0 0 0 81923 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/node_modules/pstree.remy/tests/index.test.js b/node_modules/pstree.remy/tests/index.test.js new file mode 100644 index 0000000..4875b62 --- /dev/null +++ b/node_modules/pstree.remy/tests/index.test.js @@ -0,0 +1,46 @@ +const tap = require('tap'); +const test = tap.test; +const readFile = require('fs').readFileSync; +const spawn = require('child_process').spawn; +const pstree = require('../'); +const { tree, pidsForTree, getStat } = require('../lib/utils'); + +tap.test('reads from /proc', async t => { + const ps = await getStat(); + t.ok(ps.split('\n').length > 1); +}); + +test('tree for live env', async t => { + const pid = 4079; + const fixture = readFile(__dirname + '/fixtures/out2', 'utf8'); + const ps = await tree(fixture); + t.deepEqual(pidsForTree(ps, pid).map(_ => _.PID), ['4080']); +}); + +test('can read full child process tree', t => { + const sub = spawn( + 'sh', + [ + '-c', + `node -e "setInterval(() => { + console.log(process.pid, 'is alive') + }, 200);"`, + ], + { + stdio: 'pipe', + } + ); + + console.log('parent at %s', sub.pid); + + setTimeout(() => { + const pid = sub.pid; + pstree(pid, (error, children) => { + children.concat({ PID: pid }).forEach(p => { + spawn('kill', ['-s', 'SIGTERM', p.PID]); + }); + t.equal(children.length, 1); + t.end(); + }); + }, 500); +}); diff --git a/node_modules/pug-attrs/LICENSE b/node_modules/pug-attrs/LICENSE new file mode 100644 index 0000000..a1421ff --- /dev/null +++ b/node_modules/pug-attrs/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Forbes Lindesay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/pug-attrs/README.md b/node_modules/pug-attrs/README.md new file mode 100644 index 0000000..a119eb7 --- /dev/null +++ b/node_modules/pug-attrs/README.md @@ -0,0 +1,75 @@ +# pug-attrs + +Generate code for Pug attributes + +[![Build Status](https://img.shields.io/travis/pugjs/pug-attrs/master.svg)](https://travis-ci.org/pugjs/pug-attrs) +[![Dependency Status](https://img.shields.io/david/pugjs/pug-attrs.svg)](https://david-dm.org/pugjs/pug-attrs) +[![NPM version](https://img.shields.io/npm/v/pug-attrs.svg)](https://www.npmjs.org/package/pug-attrs) + +## Installation + + npm install pug-attrs + +## Usage + +```js +var compileAttrs = require('pug-attrs'); +``` + +### `compileAttrs(attrs, options)` + +Compile `attrs` to a JavaScript string that evaluates to the attributes in the desired format. + +`options` MUST include the following properties: + +- `terse`: whether or not to use HTML5-style terse boolean attributes +- `runtime`: callback that takes a runtime function name and returns the source code that will evaluate to that function at runtime +- `format`: output format; must be `html` or `object` + +`attrs` is an array of attributes, with each attribute having the form of `{ name, val, mustEscape }`. `val` represents a JavaScript string that evaluates to the value of the attribute, either statically or dynamically. + +```js +var compileAttrs = require('pug-attrs'); +var pugRuntime = require('pug-runtime'); + +function getBaz () { return 'baz<>'; } + +var attrs = [ + {name: 'foo', val: '"bar"', mustEscape: true }, + {name: 'baz', val: 'getBaz()', mustEscape: true }, + {name: 'quux', val: true, mustEscape: false} +]; +var result, finalResult; + +// HTML MODE +result = compileAttrs(attrs, { + terse: true, + format: 'html', + runtime: function (name) { return 'pugRuntime.' + name; } +}); +//=> '" foo=\\"bar\\"" + pugRuntime.attr("baz", getBaz(), true, true) + " quux"' + +finalResult = Function('pugRuntime, getBaz', + 'return (' + result + ');' +); +finalResult(pugRuntime, getBaz); +// => ' foo="bar" baz="baz<>" quux' + +// OBJECT MODE +result = compileAttrs(attrs, { + terse: true, + format: 'object', + runtime: function (name) { return 'pugRuntime.' + name; } +}); +//=> '{"foo": "bar","baz": pugRuntime.escape(getBaz()),"quux": true}' + +finalResult = Function('pugRuntime, getBaz', + 'return (' + result + ');' +); +finalResult(pugRuntime, getBaz); +//=> { foo: 'bar', baz: 'baz<>', quux: true } +``` + +## License + + MIT diff --git a/node_modules/pug-attrs/index.js b/node_modules/pug-attrs/index.js new file mode 100644 index 0000000..50d7321 --- /dev/null +++ b/node_modules/pug-attrs/index.js @@ -0,0 +1,122 @@ +'use strict'; + +var assert = require('assert'); +var constantinople = require('constantinople'); +var runtime = require('pug-runtime'); +var stringify = require('js-stringify'); + +function isConstant(src) { + return constantinople(src, {pug: runtime, 'pug_interp': undefined}); +} +function toConstant(src) { + return constantinople.toConstant(src, {pug: runtime, 'pug_interp': undefined}); +} + +module.exports = compileAttrs; +/** + * options: + * - terse + * - runtime + * - format ('html' || 'object') + */ +function compileAttrs(attrs, options) { + assert(Array.isArray(attrs), 'Attrs should be an array'); + assert(attrs.every(function (attr) { + return attr && + typeof attr === 'object' && + typeof attr.name === 'string' && + (typeof attr.val === 'string' || typeof attr.val === 'boolean') && + typeof attr.mustEscape === 'boolean'; + }), 'All attributes should be supplied as an object of the form {name, val, mustEscape}'); + assert(options && typeof options === 'object', 'Options should be an object'); + assert(typeof options.terse === 'boolean', 'Options.terse should be a boolean'); + assert( + typeof options.runtime === 'function', + 'Options.runtime should be a function that takes a runtime function name and returns the source code that will evaluate to that function at runtime' + ); + assert( + options.format === 'html' || options.format === 'object', + 'Options.format should be "html" or "object"' + ); + + var buf = []; + var classes = []; + var classEscaping = []; + + function addAttribute(key, val, mustEscape, buf) { + if (isConstant(val)) { + if (options.format === 'html') { + var str = stringify(runtime.attr(key, toConstant(val), mustEscape, options.terse)); + var last = buf[buf.length - 1]; + if (last && last[last.length - 1] === str[0]) { + buf[buf.length - 1] = last.substr(0, last.length - 1) + str.substr(1); + } else { + buf.push(str); + } + } else { + val = toConstant(val); + if (mustEscape) { + val = runtime.escape(val); + } + buf.push(stringify(key) + ': ' + stringify(val)); + } + } else { + if (options.format === 'html') { + buf.push(options.runtime('attr') + '("' + key + '", ' + val + ', ' + stringify(mustEscape) + ', ' + stringify(options.terse) + ')'); + } else { + if (mustEscape) { + val = options.runtime('escape') + '(' + val + ')'; + } + buf.push(stringify(key) + ': ' + val); + } + } + } + + attrs.forEach(function(attr){ + var key = attr.name; + var val = attr.val; + var mustEscape = attr.mustEscape; + + if (key === 'class') { + classes.push(val); + classEscaping.push(mustEscape); + } else { + if (key === 'style') { + if (isConstant(val)) { + val = stringify(runtime.style(toConstant(val))); + } else { + val = options.runtime('style') + '(' + val + ')'; + } + } + addAttribute(key, val, mustEscape, buf); + } + }); + var classesBuf = []; + if (classes.length) { + if (classes.every(isConstant)) { + addAttribute( + 'class', + stringify(runtime.classes(classes.map(toConstant), classEscaping)), + false, + classesBuf + ); + } else { + classes = classes.map(function (cls, i) { + if (isConstant(cls)) { + cls = stringify(classEscaping[i] ? runtime.escape(toConstant(cls)) : toConstant(cls)); + classEscaping[i] = false; + } + return cls; + }); + addAttribute( + 'class', + options.runtime('classes') + '([' + classes.join(',') + '], ' + stringify(classEscaping) + ')', + false, + classesBuf + ); + } + } + buf = classesBuf.concat(buf); + if (options.format === 'html') return buf.length ? buf.join('+') : '""'; + else return '{' + buf.join(',') + '}'; +} diff --git a/node_modules/pug-attrs/package.json b/node_modules/pug-attrs/package.json new file mode 100644 index 0000000..c5b8ddf --- /dev/null +++ b/node_modules/pug-attrs/package.json @@ -0,0 +1,50 @@ +{ + "_from": "pug-attrs@^2.0.2", + "_id": "pug-attrs@2.0.3", + "_inBundle": false, + "_integrity": "sha1-owlflw5kFR972tlX7vVftdeQXRU=", + "_location": "/pug-attrs", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "pug-attrs@^2.0.2", + "name": "pug-attrs", + "escapedName": "pug-attrs", + "rawSpec": "^2.0.2", + "saveSpec": null, + "fetchSpec": "^2.0.2" + }, + "_requiredBy": [ + "/pug-code-gen" + ], + "_resolved": "https://registry.npmjs.org/pug-attrs/-/pug-attrs-2.0.3.tgz", + "_shasum": "a3095f970e64151f7bdad957eef55fb5d7905d15", + "_spec": "pug-attrs@^2.0.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/pug-code-gen", + "author": { + "name": "Forbes Lindesay" + }, + "bugs": { + "url": "https://github.com/pugjs/pug-attrs/issues" + }, + "bundleDependencies": false, + "dependencies": { + "constantinople": "^3.0.1", + "js-stringify": "^1.0.1", + "pug-runtime": "^2.0.4" + }, + "deprecated": false, + "description": "Generate code for Pug attributes", + "homepage": "https://github.com/pugjs/pug-attrs#readme", + "keywords": [ + "pug" + ], + "license": "MIT", + "name": "pug-attrs", + "repository": { + "type": "git", + "url": "git+https://github.com/pugjs/pug-attrs.git" + }, + "version": "2.0.3" +} diff --git a/node_modules/pug-attrs/test/index.test.js b/node_modules/pug-attrs/test/index.test.js new file mode 100644 index 0000000..1fb0d56 --- /dev/null +++ b/node_modules/pug-attrs/test/index.test.js @@ -0,0 +1,96 @@ +'use strict'; + +var assert = require('assert'); +var utils = require('util'); +var attrs = require('../'); + +var options; +function test(input, expected, locals) { + var opts = options; + locals = locals || {}; + locals.pug = locals.pug || require('pug-runtime'); + it(utils.inspect(input).replace(/\n/g, '') + ' => ' + utils.inspect(expected), function () { + var src = attrs(input, opts); + var localKeys = Object.keys(locals).sort(); + var output = Function(localKeys.join(', '), 'return (' + src + ');').apply(null, localKeys.map(function (key) { return locals[key]; })); + if (opts.format === 'html') { + expect(output).toBe(expected); + } else { + expect(output).toEqual(expected); + } + }); +} +function withOptions(opts, fn) { + describe('options: ' + utils.inspect(opts), function () { + options = opts; + fn(); + }); +} + +withOptions({terse: true, format: 'html', runtime: function (name) { return 'pug.' + name; }}, function () { + test([], ''); + test([{name: 'foo', val: 'false', mustEscape: true}], ''); + test([{name: 'foo', val: 'true', mustEscape: true}], ' foo'); + test([{name: 'foo', val: false, mustEscape: true}], ''); + test([{name: 'foo', val: true, mustEscape: true}], ' foo'); + test([{name: 'foo', val: 'foo', mustEscape: true}], '', {foo: false}); + test([{name: 'foo', val: 'foo', mustEscape: true}], ' foo', {foo: true}); + test([{name: 'foo', val: '"foo"', mustEscape: true}], ' foo="foo"'); + test([{name: 'foo', val: '"foo"', mustEscape: true}, {name: 'bar', val: '"bar"', mustEscape: true}], ' foo="foo" bar="bar"'); + test([{name: 'foo', val: 'foo', mustEscape: true}], ' foo="fooo"', {foo: 'fooo'}); + test([{name: 'foo', val: 'foo', mustEscape: true}, {name: 'bar', val: 'bar', mustEscape: true}], ' foo="fooo" bar="baro"', {foo: 'fooo', bar: 'baro'}); + test([{name: 'style', val: '{color: "red"}', mustEscape: true}], ' style="color:red;"'); + test([{name: 'style', val: '{color: color}', mustEscape: true}], ' style="color:red;"', {color: 'red'}); + test([{name: 'class', val: '"foo"', mustEscape: true}, {name: 'class', val: '["bar", "baz"]', mustEscape: true}], ' class="foo bar baz"'); + test([{name: 'class', val: '{foo: foo}', mustEscape: true}, {name: 'class', val: '["bar", "baz"]', mustEscape: true}], ' class="foo bar baz"', {foo: true}); + test([{name: 'class', val: '{foo: foo}', mustEscape: true}, {name: 'class', val: '["bar", "baz"]', mustEscape: true}], ' class="bar baz"', {foo: false}); + test([{name: 'class', val: 'foo', mustEscape: true}, {name: 'class', val: '""', mustEscape: true}], ' class="<foo> <str>"', {foo: ''}); + test([{name: 'foo', val: '"foo"', mustEscape: true}, {name: 'class', val: '["bar", "baz"]', mustEscape: true}], ' class="bar baz" foo="foo"'); + test([{name: 'class', val: '["bar", "baz"]', mustEscape: true}, {name: 'foo', val: '"foo"', mustEscape: true}], ' class="bar baz" foo="foo"'); + test([{name: 'foo', val: '""', mustEscape: false}], ' foo=""'); + test([{name: 'foo', val: '""', mustEscape: true}], ' foo="<foo>"'); + test([{name: 'foo', val: 'foo', mustEscape: false}], ' foo=""', {foo: ''}); + test([{name: 'foo', val: 'foo', mustEscape: true}], ' foo="<foo>"', {foo: ''}); +}); +withOptions({terse: false, format: 'html', runtime: function (name) { return 'pug.' + name; }}, function () { + test([{name: 'foo', val: 'false', mustEscape: true}], ''); + test([{name: 'foo', val: 'true', mustEscape: true}], ' foo="foo"'); + test([{name: 'foo', val: false, mustEscape: true}], ''); + test([{name: 'foo', val: true, mustEscape: true}], ' foo="foo"'); + test([{name: 'foo', val: 'foo', mustEscape: true}], '', {foo: false}); + test([{name: 'foo', val: 'foo', mustEscape: true}], ' foo="foo"', {foo: true}); +}); + +withOptions({terse: true, format: 'object', runtime: function (name) { return 'pug.' + name; }}, function () { + test([], {}); + test([{name: 'foo', val: 'false', mustEscape: true}], {foo: false}); + test([{name: 'foo', val: 'true', mustEscape: true}], {foo: true}); + test([{name: 'foo', val: false, mustEscape: true}], {foo: false}); + test([{name: 'foo', val: true, mustEscape: true}], {foo: true}); + test([{name: 'foo', val: 'foo', mustEscape: true}], {foo: false}, {foo: false}); + test([{name: 'foo', val: 'foo', mustEscape: true}], {foo: true}, {foo: true}); + test([{name: 'foo', val: '"foo"', mustEscape: true}], {foo: 'foo'}); + test([{name: 'foo', val: '"foo"', mustEscape: true}, {name: 'bar', val: '"bar"', mustEscape: true}], {foo: 'foo', bar: 'bar'}); + test([{name: 'foo', val: 'foo', mustEscape: true}], {foo: 'fooo'}, {foo: 'fooo'}); + test([{name: 'foo', val: 'foo', mustEscape: true}, {name: 'bar', val: 'bar', mustEscape: true}], {foo: 'fooo', bar: 'baro'}, {foo: 'fooo', bar: 'baro'}); + test([{name: 'style', val: '{color: "red"}', mustEscape: true}], {style: 'color:red;'}); + test([{name: 'style', val: '{color: color}', mustEscape: true}], {style: 'color:red;'}, {color: 'red'}); + test([{name: 'class', val: '"foo"', mustEscape: true}, {name: 'class', val: '["bar", "baz"]', mustEscape: true}], {'class': 'foo bar baz'}); + test([{name: 'class', val: '{foo: foo}', mustEscape: true}, {name: 'class', val: '["bar", "baz"]', mustEscape: true}], {'class': 'foo bar baz'}, {foo: true}); + test([{name: 'class', val: '{foo: foo}', mustEscape: true}, {name: 'class', val: '["bar", "baz"]', mustEscape: true}], {'class': 'bar baz'}, {foo: false}); + test([{name: 'class', val: 'foo', mustEscape: true}, {name: 'class', val: '""', mustEscape: true}], {'class': '<foo> <str>'}, {foo: ''}); + test([{name: 'foo', val: '"foo"', mustEscape: true}, {name: 'class', val: '["bar", "baz"]', mustEscape: true}], {'class': 'bar baz', foo: 'foo'}); + test([{name: 'class', val: '["bar", "baz"]', mustEscape: true}, {name: 'foo', val: '"foo"', mustEscape: true}], {'class': 'bar baz', foo: 'foo'}); + test([{name: 'foo', val: '""', mustEscape: false}], {foo: ""}); + test([{name: 'foo', val: '""', mustEscape: true}], {foo: "<foo>"}); + test([{name: 'foo', val: 'foo', mustEscape: false}], {foo: ""}, {foo: ''}); + test([{name: 'foo', val: 'foo', mustEscape: true}], {foo: "<foo>"}, {foo: ''}); +}); +withOptions({terse: false, format: 'object', runtime: function (name) { return 'pug.' + name; }}, function () { + test([{name: 'foo', val: 'false', mustEscape: true}], {foo: false}); + test([{name: 'foo', val: 'true', mustEscape: true}], {foo: true}); + test([{name: 'foo', val: false, mustEscape: true}], {foo: false}); + test([{name: 'foo', val: true, mustEscape: true}], {foo: true}); + test([{name: 'foo', val: 'foo', mustEscape: true}], {foo: false}, {foo: false}); + test([{name: 'foo', val: 'foo', mustEscape: true}], {foo: true}, {foo: true}); +}); diff --git a/node_modules/pug-code-gen/HISTORY.md b/node_modules/pug-code-gen/HISTORY.md new file mode 100644 index 0000000..5024e50 --- /dev/null +++ b/node_modules/pug-code-gen/HISTORY.md @@ -0,0 +1,13 @@ +# Change log + +## 1.1.0 / 2016-08-23 + +- Wrap `each` and `for` in IIFE to prevent variable from leaking + +## 1.0.1 / 2016-08-10 + +- Update doctypes to 1.1.0 + +## 1.0.0 / 2016-08-10 + +- First stable release diff --git a/node_modules/pug-code-gen/LICENSE b/node_modules/pug-code-gen/LICENSE new file mode 100644 index 0000000..a1421ff --- /dev/null +++ b/node_modules/pug-code-gen/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Forbes Lindesay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/pug-code-gen/README.md b/node_modules/pug-code-gen/README.md new file mode 100644 index 0000000..d180a0e --- /dev/null +++ b/node_modules/pug-code-gen/README.md @@ -0,0 +1,64 @@ +# pug-code-gen + +Default code-generator for pug. It generates HTML via a JavaScript template function. + + +[![Dependency Status](https://img.shields.io/david/pugjs/pug-code-gen.svg)](https://david-dm.org/pugjs/pug-code-gen) +[![npm version](https://img.shields.io/npm/v/pug-code-gen.svg)](https://www.npmjs.org/package/pug-code-gen) + +## Installation + + npm install pug-code-gen + +## Usage + +```js +var generateCode = require('pug-code-gen'); +``` + +### `generateCode(ast, options)` + +Generate a JavaScript function string for the given AST. + +`ast` is a fully expanded AST for Pug, with all inclusion, extends, and filters resolved. + +`options` may contain the following properties that have the same meaning as the options with the same names in `pug`: + + - pretty (boolean): default is `false` + - compileDebug (boolean): default is `true` + - doctype (string): default is `undefined` + - inlineRuntimeFunctions (boolean): default is `false` + - globals (array of strings): default is `[]` + - self (boolean): default is `false` + +In addition to above, `pug-code-gen` has the following unique options: + + - includeSources (object): map of filename to source string; used if `compileDebug` is `true`; default is `undefined` + - templateName (string): the name of the generated function; default is `'template'` + +```js +var lex = require('pug-lexer'); +var parse = require('pug-parser'); +var wrap = require('pug-runtime/wrap'); +var generateCode = require('pug-code-gen'); + +var funcStr = generateCode(parse(lex('p Hello world!')), { + compileDebug: false, + pretty: true, + inlineRuntimeFunctions: false, + templateName: 'helloWorld' +}); +//=> 'function helloWorld(locals) { ... }' + +var func = wrap(funcStr, 'helloWorld'); +func(); +//=> '\n

Hello world!

' +``` + +### `new generateCode.CodeGenerator(ast, options)` + +The constructor for the internal class of the code generator. You shouldn't need to use this for most purposes. + +## License + + MIT diff --git a/node_modules/pug-code-gen/index.js b/node_modules/pug-code-gen/index.js new file mode 100644 index 0000000..74dfcd0 --- /dev/null +++ b/node_modules/pug-code-gen/index.js @@ -0,0 +1,821 @@ +'use strict'; + +var doctypes = require('doctypes'); +var makeError = require('pug-error'); +var buildRuntime = require('pug-runtime/build'); +var runtime = require('pug-runtime'); +var compileAttrs = require('pug-attrs'); +var selfClosing = require('void-elements'); +var constantinople = require('constantinople'); +var stringify = require('js-stringify'); +var addWith = require('with'); + +// This is used to prevent pretty printing inside certain tags +var WHITE_SPACE_SENSITIVE_TAGS = { + pre: true, + textarea: true +}; + +var INTERNAL_VARIABLES = [ + 'pug', + 'pug_mixins', + 'pug_interp', + 'pug_debug_filename', + 'pug_debug_line', + 'pug_debug_sources', + 'pug_html' +]; + +module.exports = generateCode; +module.exports.CodeGenerator = Compiler; +function generateCode(ast, options) { + return (new Compiler(ast, options)).compile(); +} + + +function isConstant(src) { + return constantinople(src, {pug: runtime, 'pug_interp': undefined}); +} +function toConstant(src) { + return constantinople.toConstant(src, {pug: runtime, 'pug_interp': undefined}); +} + +/** + * Initialize `Compiler` with the given `node`. + * + * @param {Node} node + * @param {Object} options + * @api public + */ + +function Compiler(node, options) { + this.options = options = options || {}; + this.node = node; + this.bufferedConcatenationCount = 0; + this.hasCompiledDoctype = false; + this.hasCompiledTag = false; + this.pp = options.pretty || false; + if (this.pp && typeof this.pp !== 'string') { + this.pp = ' '; + } + this.debug = false !== options.compileDebug; + this.indents = 0; + this.parentIndents = 0; + this.terse = false; + this.mixins = {}; + this.dynamicMixins = false; + this.eachCount = 0; + if (options.doctype) this.setDoctype(options.doctype); + this.runtimeFunctionsUsed = []; + this.inlineRuntimeFunctions = options.inlineRuntimeFunctions || false; + if (this.debug && this.inlineRuntimeFunctions) { + this.runtimeFunctionsUsed.push('rethrow'); + } +}; + +/** + * Compiler prototype. + */ + +Compiler.prototype = { + + runtime: function (name) { + if (this.inlineRuntimeFunctions) { + this.runtimeFunctionsUsed.push(name); + return 'pug_' + name; + } else { + return 'pug.' + name; + } + }, + + error: function (message, code, node) { + var err = makeError(code, message, { + line: node.line, + filename: node.filename, + }); + throw err; + }, + + /** + * Compile parse tree to JavaScript. + * + * @api public + */ + + compile: function(){ + this.buf = []; + if (this.pp) this.buf.push("var pug_indent = [];"); + this.lastBufferedIdx = -1; + this.visit(this.node); + if (!this.dynamicMixins) { + // if there are no dynamic mixins we can remove any un-used mixins + var mixinNames = Object.keys(this.mixins); + for (var i = 0; i < mixinNames.length; i++) { + var mixin = this.mixins[mixinNames[i]]; + if (!mixin.used) { + for (var x = 0; x < mixin.instances.length; x++) { + for (var y = mixin.instances[x].start; y < mixin.instances[x].end; y++) { + this.buf[y] = ''; + } + } + } + } + } + var js = this.buf.join('\n'); + var globals = this.options.globals ? this.options.globals.concat(INTERNAL_VARIABLES) : INTERNAL_VARIABLES; + if (this.options.self) { + js = 'var self = locals || {};' + js; + } else { + js = addWith('locals || {}', js, globals.concat(this.runtimeFunctionsUsed.map(function (name) { return 'pug_' + name; }))); + } + if (this.debug) { + if (this.options.includeSources) { + js = 'var pug_debug_sources = ' + stringify(this.options.includeSources) + ';\n' + js; + } + js = 'var pug_debug_filename, pug_debug_line;' + + 'try {' + + js + + '} catch (err) {' + + (this.inlineRuntimeFunctions ? 'pug_rethrow' : 'pug.rethrow') + + '(err, pug_debug_filename, pug_debug_line' + + ( + this.options.includeSources + ? ', pug_debug_sources[pug_debug_filename]' + : '' + ) + + ');' + + '}'; + } + return buildRuntime(this.runtimeFunctionsUsed) + 'function ' + (this.options.templateName || 'template') + '(locals) {var pug_html = "", pug_mixins = {}, pug_interp;' + js + ';return pug_html;}'; + }, + + /** + * Sets the default doctype `name`. Sets terse mode to `true` when + * html 5 is used, causing self-closing tags to end with ">" vs "/>", + * and boolean attributes are not mirrored. + * + * @param {string} name + * @api public + */ + + setDoctype: function(name){ + this.doctype = doctypes[name.toLowerCase()] || ''; + this.terse = this.doctype.toLowerCase() == ''; + this.xml = 0 == this.doctype.indexOf(' 1 && !escapePrettyMode && + block.nodes[0].type === 'Text' && block.nodes[1].type === 'Text' ) { + this.prettyIndent(1, true); + } + for (var i = 0; i < block.nodes.length; ++i) { + // Pretty print text + if (pp && i > 0 && !escapePrettyMode && + block.nodes[i].type === 'Text' && block.nodes[i-1].type === 'Text' && + /\n$/.test(block.nodes[i - 1].val)) { + this.prettyIndent(1, false); + } + this.visit(block.nodes[i], block); + } + }, + + /** + * Visit a mixin's `block` keyword. + * + * @param {MixinBlock} block + * @api public + */ + + visitMixinBlock: function(block){ + if (this.pp) this.buf.push("pug_indent.push('" + Array(this.indents + 1).join(this.pp) + "');"); + this.buf.push('block && block();'); + if (this.pp) this.buf.push("pug_indent.pop();"); + }, + + /** + * Visit `doctype`. Sets terse mode to `true` when html 5 + * is used, causing self-closing tags to end with ">" vs "/>", + * and boolean attributes are not mirrored. + * + * @param {Doctype} doctype + * @api public + */ + + visitDoctype: function(doctype){ + if (doctype && (doctype.val || !this.doctype)) { + this.setDoctype(doctype.val || 'html'); + } + + if (this.doctype) this.buffer(this.doctype); + this.hasCompiledDoctype = true; + }, + + /** + * Visit `mixin`, generating a function that + * may be called within the template. + * + * @param {Mixin} mixin + * @api public + */ + + visitMixin: function(mixin){ + var name = 'pug_mixins['; + var args = mixin.args || ''; + var block = mixin.block; + var attrs = mixin.attrs; + var attrsBlocks = mixin.attributeBlocks && mixin.attributeBlocks.slice(); + var pp = this.pp; + var dynamic = mixin.name[0]==='#'; + var key = mixin.name; + if (dynamic) this.dynamicMixins = true; + name += (dynamic ? mixin.name.substr(2,mixin.name.length-3):'"'+mixin.name+'"')+']'; + + this.mixins[key] = this.mixins[key] || {used: false, instances: []}; + if (mixin.call) { + this.mixins[key].used = true; + if (pp) this.buf.push("pug_indent.push('" + Array(this.indents + 1).join(pp) + "');") + if (block || attrs.length || attrsBlocks.length) { + + this.buf.push(name + '.call({'); + + if (block) { + this.buf.push('block: function(){'); + + // Render block with no indents, dynamically added when rendered + this.parentIndents++; + var _indents = this.indents; + this.indents = 0; + this.visit(mixin.block, mixin); + this.indents = _indents; + this.parentIndents--; + + if (attrs.length || attrsBlocks.length) { + this.buf.push('},'); + } else { + this.buf.push('}'); + } + } + + if (attrsBlocks.length) { + if (attrs.length) { + var val = this.attrs(attrs); + attrsBlocks.unshift(val); + } + if (attrsBlocks.length > 1) { + this.buf.push('attributes: ' + this.runtime('merge') + '([' + attrsBlocks.join(',') + '])'); + } else { + this.buf.push('attributes: ' + attrsBlocks[0]); + } + } else if (attrs.length) { + var val = this.attrs(attrs); + this.buf.push('attributes: ' + val); + } + + if (args) { + this.buf.push('}, ' + args + ');'); + } else { + this.buf.push('});'); + } + + } else { + this.buf.push(name + '(' + args + ');'); + } + if (pp) this.buf.push("pug_indent.pop();") + } else { + var mixin_start = this.buf.length; + args = args ? args.split(',') : []; + var rest; + if (args.length && /^\.\.\./.test(args[args.length - 1].trim())) { + rest = args.pop().trim().replace(/^\.\.\./, ''); + } + // we need use pug_interp here for v8: https://code.google.com/p/v8/issues/detail?id=4165 + // once fixed, use this: this.buf.push(name + ' = function(' + args.join(',') + '){'); + this.buf.push(name + ' = pug_interp = function(' + args.join(',') + '){'); + this.buf.push('var block = (this && this.block), attributes = (this && this.attributes) || {};'); + if (rest) { + this.buf.push('var ' + rest + ' = [];'); + this.buf.push('for (pug_interp = ' + args.length + '; pug_interp < arguments.length; pug_interp++) {'); + this.buf.push(' ' + rest + '.push(arguments[pug_interp]);'); + this.buf.push('}'); + } + this.parentIndents++; + this.visit(block, mixin); + this.parentIndents--; + this.buf.push('};'); + var mixin_end = this.buf.length; + this.mixins[key].instances.push({start: mixin_start, end: mixin_end}); + } + }, + + /** + * Visit `tag` buffering tag markup, generating + * attributes, visiting the `tag`'s code and block. + * + * @param {Tag} tag + * @param {boolean} interpolated + * @api public + */ + + visitTag: function(tag, interpolated){ + this.indents++; + var name = tag.name + , pp = this.pp + , self = this; + + function bufferName() { + if (interpolated) self.bufferExpression(tag.expr); + else self.buffer(name); + } + + if (WHITE_SPACE_SENSITIVE_TAGS[tag.name] === true) this.escapePrettyMode = true; + + if (!this.hasCompiledTag) { + if (!this.hasCompiledDoctype && 'html' == name) { + this.visitDoctype(); + } + this.hasCompiledTag = true; + } + + // pretty print + if (pp && !tag.isInline) + this.prettyIndent(0, true); + if (tag.selfClosing || (!this.xml && selfClosing[tag.name])) { + this.buffer('<'); + bufferName(); + this.visitAttributes(tag.attrs, tag.attributeBlocks.slice()); + if (this.terse && !tag.selfClosing) { + this.buffer('>'); + } else { + this.buffer('/>'); + } + // if it is non-empty throw an error + if (tag.code || + tag.block && + !(tag.block.type === 'Block' && tag.block.nodes.length === 0) && + tag.block.nodes.some(function (tag) { + return tag.type !== 'Text' || !/^\s*$/.test(tag.val) + })) { + this.error(name + ' is a self closing element: <'+name+'/> but contains nested content.', 'SELF_CLOSING_CONTENT', tag); + } + } else { + // Optimize attributes buffering + this.buffer('<'); + bufferName(); + this.visitAttributes(tag.attrs, tag.attributeBlocks.slice()); + this.buffer('>'); + if (tag.code) this.visitCode(tag.code); + this.visit(tag.block, tag); + + // pretty print + if (pp && !tag.isInline && WHITE_SPACE_SENSITIVE_TAGS[tag.name] !== true && !tagCanInline(tag)) + this.prettyIndent(0, true); + + this.buffer(''); + } + + if (WHITE_SPACE_SENSITIVE_TAGS[tag.name] === true) this.escapePrettyMode = false; + + this.indents--; + }, + + /** + * Visit InterpolatedTag. + * + * @param {InterpolatedTag} tag + * @api public + */ + + visitInterpolatedTag: function(tag) { + return this.visitTag(tag, true); + }, + + /** + * Visit `text` node. + * + * @param {Text} text + * @api public + */ + + visitText: function(text){ + this.buffer(text.val); + }, + + /** + * Visit a `comment`, only buffering when the buffer flag is set. + * + * @param {Comment} comment + * @api public + */ + + visitComment: function(comment){ + if (!comment.buffer) return; + if (this.pp) this.prettyIndent(1, true); + this.buffer(''); + }, + + /** + * Visit a `YieldBlock`. + * + * This is necessary since we allow compiling a file with `yield`. + * + * @param {YieldBlock} block + * @api public + */ + + visitYieldBlock: function(block) {}, + + /** + * Visit a `BlockComment`. + * + * @param {Comment} comment + * @api public + */ + + visitBlockComment: function(comment){ + if (!comment.buffer) return; + if (this.pp) this.prettyIndent(1, true); + this.buffer(''); + }, + + /** + * Visit `code`, respecting buffer / escape flags. + * If the code is followed by a block, wrap it in + * a self-calling function. + * + * @param {Code} code + * @api public + */ + + visitCode: function(code){ + // Wrap code blocks with {}. + // we only wrap unbuffered code blocks ATM + // since they are usually flow control + + // Buffer code + if (code.buffer) { + var val = code.val.trim(); + val = 'null == (pug_interp = '+val+') ? "" : pug_interp'; + if (code.mustEscape !== false) val = this.runtime('escape') + '(' + val + ')'; + this.bufferExpression(val); + } else { + this.buf.push(code.val); + } + + // Block support + if (code.block) { + if (!code.buffer) this.buf.push('{'); + this.visit(code.block, code); + if (!code.buffer) this.buf.push('}'); + } + }, + + /** + * Visit `Conditional`. + * + * @param {Conditional} cond + * @api public + */ + + visitConditional: function(cond){ + var test = cond.test; + this.buf.push('if (' + test + ') {'); + this.visit(cond.consequent, cond); + this.buf.push('}') + if (cond.alternate) { + if (cond.alternate.type === 'Conditional') { + this.buf.push('else') + this.visitConditional(cond.alternate); + } else { + this.buf.push('else {'); + this.visit(cond.alternate, cond); + this.buf.push('}'); + } + } + }, + + /** + * Visit `While`. + * + * @param {While} loop + * @api public + */ + + visitWhile: function(loop){ + var test = loop.test; + this.buf.push('while (' + test + ') {'); + this.visit(loop.block, loop); + this.buf.push('}'); + }, + + /** + * Visit `each` block. + * + * @param {Each} each + * @api public + */ + + visitEach: function(each){ + var indexVarName = each.key || 'pug_index' + this.eachCount; + this.eachCount++; + + this.buf.push('' + + '// iterate ' + each.obj + '\n' + + ';(function(){\n' + + ' var $$obj = ' + each.obj + ';\n' + + ' if (\'number\' == typeof $$obj.length) {'); + + if (each.alternate) { + this.buf.push(' if ($$obj.length) {'); + } + + this.buf.push('' + + ' for (var ' + indexVarName + ' = 0, $$l = $$obj.length; ' + indexVarName + ' < $$l; ' + indexVarName + '++) {\n' + + ' var ' + each.val + ' = $$obj[' + indexVarName + '];'); + + this.visit(each.block, each); + + this.buf.push(' }'); + + if (each.alternate) { + this.buf.push(' } else {'); + this.visit(each.alternate, each); + this.buf.push(' }'); + } + + this.buf.push('' + + ' } else {\n' + + ' var $$l = 0;\n' + + ' for (var ' + indexVarName + ' in $$obj) {\n' + + ' $$l++;\n' + + ' var ' + each.val + ' = $$obj[' + indexVarName + '];'); + + this.visit(each.block, each); + + this.buf.push(' }'); + if (each.alternate) { + this.buf.push(' if ($$l === 0) {'); + this.visit(each.alternate, each); + this.buf.push(' }'); + } + this.buf.push(' }\n}).call(this);\n'); + }, + + /** + * Visit `attrs`. + * + * @param {Array} attrs + * @api public + */ + + visitAttributes: function(attrs, attributeBlocks){ + if (attributeBlocks.length) { + if (attrs.length) { + var val = this.attrs(attrs); + attributeBlocks.unshift(val); + } + if (attributeBlocks.length > 1) { + this.bufferExpression(this.runtime('attrs') + '(' + this.runtime('merge') + '([' + attributeBlocks.join(',') + ']), ' + stringify(this.terse) + ')'); + } else { + this.bufferExpression(this.runtime('attrs') + '(' + attributeBlocks[0] + ', ' + stringify(this.terse) + ')'); + } + } else if (attrs.length) { + this.attrs(attrs, true); + } + }, + + /** + * Compile attributes. + */ + + attrs: function(attrs, buffer){ + var res = compileAttrs(attrs, { + terse: this.terse, + format: buffer ? 'html' : 'object', + runtime: this.runtime.bind(this) + }); + if (buffer) { + this.bufferExpression(res); + } + return res; + } +}; + +function tagCanInline(tag) { + function isInline(node){ + // Recurse if the node is a block + if (node.type === 'Block') return node.nodes.every(isInline); + // When there is a YieldBlock here, it is an indication that the file is + // expected to be included but is not. If this is the case, the block + // must be empty. + if (node.type === 'YieldBlock') return true; + return (node.type === 'Text' && !/\n/.test(node.val)) || node.isInline; + } + + return tag.block.nodes.every(isInline); +} diff --git a/node_modules/pug-code-gen/package.json b/node_modules/pug-code-gen/package.json new file mode 100644 index 0000000..1d69588 --- /dev/null +++ b/node_modules/pug-code-gen/package.json @@ -0,0 +1,55 @@ +{ + "_from": "pug-code-gen@^1.1.1", + "_id": "pug-code-gen@1.1.1", + "_inBundle": false, + "_integrity": "sha1-HPcnRO8qA56uajNAyqoRBYcSWOg=", + "_location": "/pug-code-gen", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "pug-code-gen@^1.1.1", + "name": "pug-code-gen", + "escapedName": "pug-code-gen", + "rawSpec": "^1.1.1", + "saveSpec": null, + "fetchSpec": "^1.1.1" + }, + "_requiredBy": [ + "/pug" + ], + "_resolved": "https://registry.npmjs.org/pug-code-gen/-/pug-code-gen-1.1.1.tgz", + "_shasum": "1cf72744ef2a039eae6a3340caaa1105871258e8", + "_spec": "pug-code-gen@^1.1.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/pug", + "author": { + "name": "Forbes Lindesay" + }, + "bugs": { + "url": "https://github.com/pugjs/pug-code-gen/issues" + }, + "bundleDependencies": false, + "dependencies": { + "constantinople": "^3.0.1", + "doctypes": "^1.1.0", + "js-stringify": "^1.0.1", + "pug-attrs": "^2.0.2", + "pug-error": "^1.3.2", + "pug-runtime": "^2.0.3", + "void-elements": "^2.0.1", + "with": "^5.0.0" + }, + "deprecated": false, + "description": "Default code-generator for pug. It generates HTML via a JavaScript template function.", + "homepage": "https://github.com/pugjs/pug-code-gen#readme", + "keywords": [ + "pug" + ], + "license": "MIT", + "name": "pug-code-gen", + "repository": { + "type": "git", + "url": "git+https://github.com/pugjs/pug-code-gen.git" + }, + "version": "1.1.1" +} diff --git a/node_modules/pug-error/LICENSE b/node_modules/pug-error/LICENSE new file mode 100644 index 0000000..a1421ff --- /dev/null +++ b/node_modules/pug-error/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Forbes Lindesay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/pug-error/README.md b/node_modules/pug-error/README.md new file mode 100644 index 0000000..0cbeec0 --- /dev/null +++ b/node_modules/pug-error/README.md @@ -0,0 +1,55 @@ +# pug-error + +Standard error objects for pug. This module is intended for use by the lexer, parser, loader, linker, code-generator and any plugins. + +[![Build Status](https://img.shields.io/travis/pugjs/pug-error/master.svg)](https://travis-ci.org/pugjs/pug-error) +[![Dependency Status](https://img.shields.io/david/pugjs/pug-error.svg)](https://david-dm.org/pugjs/pug-error) +[![NPM version](https://img.shields.io/npm/v/pug-error.svg)](https://www.npmjs.org/package/pug-error) + +## Installation + + npm install pug-error + +## Usage + +```js +var error = require('pug-error'); +``` + +### `error(code, message, options)` + +Create a Pug error object. + +`code` is a required unique code for the error type that can be used to pinpoint a certain error. + +`message` is a human-readable explanation of the error. + +`options` can contain any of the following properties: + +- `filename`: the name of the file causing the error +- `line`: the offending line +- `column`: the offending column +- `src`: the Pug source, if available, for pretty-printing the error context + +The resulting error object is a simple Error object with additional properties given in the arguments. + +**Caveat:** the `message` argument is stored in `err.msg`, not `err.message`, which is occupied with a better-formatted message. + +```js +var error = require('pug-error'); + +var err = error('MY_CODE', 'My message', {line: 3, filename: 'myfile', src: 'foo\nbar\nbaz\nbash\nbing'}); +// { code: 'PUG:MY_CODE', +// msg: 'My message', +// line: 3, +// column: undefined, +// filename: 'myfile', +// src: 'foo\nbar\nbaz\nbash\nbing', +// message: 'myfile:3\n 1| foo\n 2| bar\n > 3| baz\n 4| bash\n 5| bing\n\nMy message' } + +throw err; +``` + +## License + + MIT diff --git a/node_modules/pug-error/index.js b/node_modules/pug-error/index.js new file mode 100644 index 0000000..2ec94c5 --- /dev/null +++ b/node_modules/pug-error/index.js @@ -0,0 +1,49 @@ +'use strict'; + +module.exports = makeError; +function makeError(code, message, options) { + var line = options.line; + var column = options.column; + var filename = options.filename; + var src = options.src; + var fullMessage; + var location = line + (column ? ':' + column : ''); + if (src && line >= 1 && line <= src.split('\n').length) { + var lines = src.split('\n'); + var start = Math.max(line - 3, 0); + var end = Math.min(lines.length, line + 3); + // Error context + var context = lines.slice(start, end).map(function(text, i){ + var curr = i + start + 1; + var preamble = (curr == line ? ' > ' : ' ') + + curr + + '| '; + var out = preamble + text; + if (curr === line && column > 0) { + out += '\n'; + out += Array(preamble.length + column).join('-') + '^'; + } + return out; + }).join('\n'); + fullMessage = (filename || 'Pug') + ':' + location + '\n' + context + '\n\n' + message; + } else { + fullMessage = (filename || 'Pug') + ':' + location + '\n\n' + message; + } + var err = new Error(fullMessage); + err.code = 'PUG:' + code; + err.msg = message; + err.line = line; + err.column = column; + err.filename = filename; + err.src = src; + err.toJSON = function () { + return { + code: this.code, + msg: this.msg, + line: this.line, + column: this.column, + filename: this.filename + }; + }; + return err; +} diff --git a/node_modules/pug-error/package.json b/node_modules/pug-error/package.json new file mode 100644 index 0000000..f4a90ab --- /dev/null +++ b/node_modules/pug-error/package.json @@ -0,0 +1,53 @@ +{ + "_from": "pug-error@^1.3.2", + "_id": "pug-error@1.3.2", + "_inBundle": false, + "_integrity": "sha1-U659nSm7A89WRJOgJhCfVMR/XyY=", + "_location": "/pug-error", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "pug-error@^1.3.2", + "name": "pug-error", + "escapedName": "pug-error", + "rawSpec": "^1.3.2", + "saveSpec": null, + "fetchSpec": "^1.3.2" + }, + "_requiredBy": [ + "/pug-code-gen", + "/pug-filters", + "/pug-lexer", + "/pug-linker", + "/pug-parser", + "/pug-strip-comments" + ], + "_resolved": "https://registry.npmjs.org/pug-error/-/pug-error-1.3.2.tgz", + "_shasum": "53ae7d9d29bb03cf564493a026109f54c47f5f26", + "_spec": "pug-error@^1.3.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/pug-code-gen", + "author": { + "name": "Forbes Lindesay" + }, + "bugs": { + "url": "https://github.com/pugjs/pug-error/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Standard error objects for pug", + "files": [ + "index.js" + ], + "homepage": "https://github.com/pugjs/pug-error#readme", + "keywords": [ + "pug" + ], + "license": "MIT", + "name": "pug-error", + "repository": { + "type": "git", + "url": "git+https://github.com/pugjs/pug-error.git" + }, + "version": "1.3.2" +} diff --git a/node_modules/pug-filters/CHANGELOG.md b/node_modules/pug-filters/CHANGELOG.md new file mode 100644 index 0000000..ca011f6 --- /dev/null +++ b/node_modules/pug-filters/CHANGELOG.md @@ -0,0 +1,34 @@ +# Change log + +## 1.2.4 / 2016-08-23 + +- Update to `pug-walk@1.0.0` + +## 1.2.3 / 2016-07-18 + +- Fix includes using custom filters + +## 1.2.2 / 2016-06-06 + +- Update to `jstransformer@1.0.0` + +## 1.2.1 / 2016-04-27 + +- Apply filters to included files as well + +## 1.2.0 / 2016-04-01 + +- Add support for specifying per-filter options + +## 1.1.1 / 2015-12-23 + +- Update UglifyJS to 2.6.2 +- Rename to Pug + +## 1.1.0 / 2015-11-14 + +- Add support for filtered includes + +## 1.0.0 / 2015-10-08 + +- Initial stable release diff --git a/node_modules/pug-filters/LICENSE b/node_modules/pug-filters/LICENSE new file mode 100644 index 0000000..a1421ff --- /dev/null +++ b/node_modules/pug-filters/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Forbes Lindesay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/pug-filters/README.md b/node_modules/pug-filters/README.md new file mode 100644 index 0000000..baad8ac --- /dev/null +++ b/node_modules/pug-filters/README.md @@ -0,0 +1,41 @@ +# pug-filters + +Code for processing filters in pug templates + +[![Build Status](https://img.shields.io/travis/pugjs/pug-filters/master.svg)](https://travis-ci.org/pugjs/pug-filters) +[![Dependency Status](https://img.shields.io/david/pugjs/pug-filters.svg)](https://david-dm.org/pugjs/pug-filters) +[![NPM version](https://img.shields.io/npm/v/pug-filters.svg)](https://www.npmjs.org/package/pug-filters) + +## Installation + + npm install pug-filters + +## Usage + +``` +var filters = require('pug-filters'); +``` + +### `filters.handleFilters(ast, filters)` + +Renders all `Filter` nodes in a Pug AST (`ast`), using user-specified filters (`filters`) or a JSTransformer. + +### `filters.runFilter(name, str[, options[, currentDirectory]])` + +Invokes filter through `jstransformer`. + +This is internally used in `filters.handleFilters`, and is a lower-level interface exclusively for invoking JSTransformer-based filters. + +`name` represents the name of the JSTransformer. + +`str` represents the string to render. + +`currentDirectory` is used when attempting to `require` the transformer module. + +`options` may contain the following properties: + +- `minify` (boolean): whether or not to attempt minifying the result from the transformer. If minification fails, the original result is returned. + +## License + + MIT diff --git a/node_modules/pug-filters/index.js b/node_modules/pug-filters/index.js new file mode 100644 index 0000000..7a68795 --- /dev/null +++ b/node_modules/pug-filters/index.js @@ -0,0 +1,4 @@ +'use strict'; + +exports.runFilter = require('./lib/run-filter'); +exports.handleFilters = require('./lib/handle-filters'); \ No newline at end of file diff --git a/node_modules/pug-filters/lib/handle-filters.js b/node_modules/pug-filters/lib/handle-filters.js new file mode 100644 index 0000000..ce763f1 --- /dev/null +++ b/node_modules/pug-filters/lib/handle-filters.js @@ -0,0 +1,112 @@ +'use strict'; + +var dirname = require('path').dirname; +var constantinople = require('constantinople'); +var walk = require('pug-walk'); +var error = require('pug-error'); +var runFilter = require('./run-filter'); + +module.exports = handleFilters; +function handleFilters(ast, filters, options, filterAliases) { + options = options || {}; + walk(ast, function (node) { + var dir = node.filename ? dirname(node.filename) : null; + if (node.type === 'Filter') { + handleNestedFilters(node, filters, options, filterAliases); + var text = getBodyAsText(node); + var attrs = getAttributes(node, options); + attrs.filename = node.filename; + node.type = 'Text'; + node.val = filterWithFallback(node, text, attrs); + } else if (node.type === 'RawInclude' && node.filters.length) { + var firstFilter = node.filters.shift(); + var attrs = getAttributes(firstFilter, options); + var filename = attrs.filename = node.file.fullPath; + var str = node.file.str; + node.type = 'Text'; + node.val = filterFileWithFallback(firstFilter, filename, str, attrs); + node.filters.forEach(function (filter) { + var attrs = getAttributes(filter, options); + attrs.filename = filename; + node.val = filterWithFallback(filter, node.val, attrs); + }); + node.filters = undefined; + node.file = undefined; + } + + function filterWithFallback(filter, text, attrs, funcName) { + try { + var filterName = getFilterName(filter); + if (filters && filters[filterName]) { + return filters[filterName](text, attrs); + } else { + return runFilter(filterName, text, attrs, dir, funcName); + } + } catch (ex) { + if (ex.code === 'UNKNOWN_FILTER') { + throw error(ex.code, ex.message, filter); + } + throw ex; + } + } + + function filterFileWithFallback(filter, filename, text, attrs) { + var filterName = getFilterName(filter); + if (filters && filters[filterName]) { + return filters[filterName](text, attrs); + } else { + return filterWithFallback(filter, filename, attrs, 'renderFile'); + } + } + }, {includeDependencies: true}); + function getFilterName(filter) { + var filterName = filter.name; + if (filterAliases && filterAliases[filterName]) { + filterName = filterAliases[filterName]; + if (filterAliases[filterName]) { + throw error( + 'FILTER_ALISE_CHAIN', + 'The filter "' + filter.name + '" is an alias for "' + filterName + + '", which is an alias for "' + filterAliases[filterName] + + '". Pug does not support chains of filter aliases.', + filter + ); + } + } + return filterName; + } + return ast; +}; + +function handleNestedFilters(node, filters, options, filterAliases) { + if (node.block.nodes[0] && node.block.nodes[0].type === 'Filter') { + node.block.nodes[0] = handleFilters(node.block, filters, options, filterAliases).nodes[0]; + } +} + +function getBodyAsText(node) { + return node.block.nodes.map( + function(node){ return node.val; } + ).join(''); +} + +function getAttributes(node, options) { + var attrs = {}; + node.attrs.forEach(function (attr) { + try { + attrs[attr.name] = constantinople.toConstant(attr.val); + } catch (ex) { + if (/not constant/.test(ex.message)) { + throw error('FILTER_OPTION_NOT_CONSTANT', ex.message + ' All filters are rendered compile-time so filter options must be constants.', node); + } + throw ex; + } + }); + var opts = options[node.name] || {}; + Object.keys(opts).forEach(function (opt) { + if (!attrs.hasOwnProperty(opt)) { + attrs[opt] = opts[opt]; + } + }); + return attrs; +} diff --git a/node_modules/pug-filters/lib/run-filter.js b/node_modules/pug-filters/lib/run-filter.js new file mode 100644 index 0000000..fdffad3 --- /dev/null +++ b/node_modules/pug-filters/lib/run-filter.js @@ -0,0 +1,43 @@ +'use strict'; + +var jstransformer = require('jstransformer'); +var uglify = require('uglify-js'); +var CleanCSS = require('clean-css'); +var resolve = require('resolve'); + +module.exports = filter; +function filter(name, str, options, currentDirectory, funcName) { + funcName = funcName || 'render'; + var tr; + try { + try { + tr = require(resolve.sync('jstransformer-' + name, {basedir: currentDirectory || process.cwd()})); + } catch (ex) { + tr = require('jstransformer-' + name); + } + tr = jstransformer(tr); + } catch (ex) {} + if (tr) { + // TODO: we may want to add a way for people to separately specify "locals" + var result = tr[funcName](str, options, options).body; + if (options && options.minify) { + try { + switch (tr.outputFormat) { + case 'js': + result = uglify.minify(result, {fromString: true}).code; + break; + case 'css': + result = new CleanCSS().minify(result).styles; + break; + } + } catch (ex) { + // better to fail to minify than output nothing + } + } + return result; + } else { + var err = new Error('unknown filter ":' + name + '"'); + err.code = 'UNKNOWN_FILTER'; + throw err; + } +} diff --git a/node_modules/pug-filters/package.json b/node_modules/pug-filters/package.json new file mode 100644 index 0000000..c577ce3 --- /dev/null +++ b/node_modules/pug-filters/package.json @@ -0,0 +1,66 @@ +{ + "_from": "pug-filters@^2.1.1", + "_id": "pug-filters@2.1.5", + "_inBundle": false, + "_integrity": "sha512-xkw71KtrC4sxleKiq+cUlQzsiLn8pM5+vCgkChW2E6oNOzaqTSIBKIQ5cl4oheuDzvJYCTSYzRaVinMUrV4YLQ==", + "_location": "/pug-filters", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "pug-filters@^2.1.1", + "name": "pug-filters", + "escapedName": "pug-filters", + "rawSpec": "^2.1.1", + "saveSpec": null, + "fetchSpec": "^2.1.1" + }, + "_requiredBy": [ + "/pug" + ], + "_resolved": "https://registry.npmjs.org/pug-filters/-/pug-filters-2.1.5.tgz", + "_shasum": "66bf6e80d97fbef829bab0aa35eddff33fc964f3", + "_spec": "pug-filters@^2.1.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/pug", + "author": { + "name": "Forbes Lindesay" + }, + "bugs": { + "url": "https://github.com/pugjs/pug-filters/issues" + }, + "bundleDependencies": false, + "dependencies": { + "clean-css": "^3.3.0", + "constantinople": "^3.0.1", + "jstransformer": "1.0.0", + "pug-error": "^1.3.2", + "pug-walk": "^1.1.5", + "resolve": "^1.1.6", + "uglify-js": "^2.6.1" + }, + "deprecated": false, + "description": "Code for processing filters in pug templates", + "devDependencies": { + "get-repo": "^1.0.0", + "jstransformer-cdata": "^1.0.0", + "jstransformer-coffee-script": "^1.0.0", + "jstransformer-less": "^2.1.0", + "jstransformer-markdown-it": "^1.0.0", + "jstransformer-stylus": "^1.0.0", + "jstransformer-uglify-js": "^1.1.1", + "pug-lexer": "^3.1.0", + "pug-load": "^2.0.9", + "pug-parser": "^4.0.0" + }, + "homepage": "https://github.com/pugjs/pug-filters#readme", + "keywords": [ + "pug" + ], + "license": "MIT", + "name": "pug-filters", + "repository": { + "type": "git", + "url": "git+https://github.com/pugjs/pug-filters.git" + }, + "version": "2.1.5" +} diff --git a/node_modules/pug-filters/test/__snapshots__/filter-aliases.test.js.snap b/node_modules/pug-filters/test/__snapshots__/filter-aliases.test.js.snap new file mode 100644 index 0000000..2130c65 --- /dev/null +++ b/node_modules/pug-filters/test/__snapshots__/filter-aliases.test.js.snap @@ -0,0 +1,275 @@ +exports[`test filters can be aliased 1`] = ` +Object { + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 2, + "nodes": Array [ + Object { + "attrs": Array [], + "block": Object { + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 3, + "nodes": Array [ + Object { + "attrs": Array [], + "block": Object { + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 3, + "nodes": Array [ + Object { + "column": 5, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 4, + "type": "Text", + "val": "function myFunc(foo) {", + }, + Object { + "column": 1, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 5, + "type": "Text", + "val": " +", + }, + Object { + "column": 5, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 5, + "type": "Text", + "val": " return foo;", + }, + Object { + "column": 1, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 6, + "type": "Text", + "val": " +", + }, + Object { + "column": 5, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 6, + "type": "Text", + "val": "}", + }, + ], + "type": "Block", + }, + "column": 9, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 3, + "name": "minify", + "type": "Text", + "val": "function myFunc(n){return n}", + }, + ], + "type": "Block", + }, + "column": 3, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 3, + "name": "cdata", + "type": "Text", + "val": "", + }, + ], + "type": "Block", + }, + "column": 1, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "isInline": false, + "line": 2, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test options are applied before aliases 1`] = ` +Object { + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 2, + "nodes": Array [ + Object { + "attrs": Array [], + "block": Object { + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 3, + "nodes": Array [ + Object { + "attrs": Array [], + "block": Object { + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 3, + "nodes": Array [ + Object { + "column": 5, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 4, + "type": "Text", + "val": "function myFunc(foo) {", + }, + Object { + "column": 1, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 5, + "type": "Text", + "val": " +", + }, + Object { + "column": 5, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 5, + "type": "Text", + "val": " return foo;", + }, + Object { + "column": 1, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 6, + "type": "Text", + "val": " +", + }, + Object { + "column": 5, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 6, + "type": "Text", + "val": "}", + }, + ], + "type": "Block", + }, + "column": 9, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 3, + "name": "minify", + "type": "Text", + "val": "function myFunc(n) { + return n; +}", + }, + ], + "type": "Block", + }, + "column": 3, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 3, + "name": "cdata", + "type": "Text", + "val": "", + }, + Object { + "attrs": Array [], + "block": Object { + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 7, + "nodes": Array [ + Object { + "attrs": Array [], + "block": Object { + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 7, + "nodes": Array [ + Object { + "column": 5, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 8, + "type": "Text", + "val": "function myFunc(foo) {", + }, + Object { + "column": 1, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 9, + "type": "Text", + "val": " +", + }, + Object { + "column": 5, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 9, + "type": "Text", + "val": " return foo;", + }, + Object { + "column": 1, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 10, + "type": "Text", + "val": " +", + }, + Object { + "column": 5, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 10, + "type": "Text", + "val": "}", + }, + ], + "type": "Block", + }, + "column": 9, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 7, + "name": "uglify-js", + "type": "Text", + "val": "function myFunc(n){return n}", + }, + ], + "type": "Block", + }, + "column": 3, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "line": 7, + "name": "cdata", + "type": "Text", + "val": "", + }, + ], + "type": "Block", + }, + "column": 1, + "filename": "/packages/pug-filters/test/filter-aliases.test.js", + "isInline": false, + "line": 2, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test we do not support chains of aliases 1`] = ` +Object { + "code": "PUG:FILTER_ALISE_CHAIN", + "message": "/packages/pug-filters/test/filter-aliases.test.js:3:9 + +The filter \"minify-js\" is an alias for \"minify\", which is an alias for \"uglify-js\". Pug does not support chains of filter aliases.", +} +`; diff --git a/node_modules/pug-filters/test/__snapshots__/index.test.js.snap b/node_modules/pug-filters/test/__snapshots__/index.test.js.snap new file mode 100644 index 0000000..b304bd5 --- /dev/null +++ b/node_modules/pug-filters/test/__snapshots__/index.test.js.snap @@ -0,0 +1,1072 @@ +exports[`test cases/filters.cdata.input.json 1`] = ` +"{ + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Code\", + \"val\": \"users = [{ name: \'tobi\', age: 2 }]\", + \"buffer\": false, + \"mustEscape\": false, + \"isInline\": false, + \"line\": 2, + \"filename\": \"filters.cdata.tokens.json\" + }, + { + \"type\": \"Tag\", + \"name\": \"fb:users\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Each\", + \"obj\": \"users\", + \"val\": \"user\", + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"fb:user\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"name\": \"cdata\", + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"val\": \"#{user.name}\", + \"line\": 8 + } + ] + }, + \"attrs\": [], + \"line\": 7, + \"filename\": \"filters.cdata.tokens.json\", + \"val\": \"\" + } + ] + }, + \"attrs\": [ + { + \"name\": \"age\", + \"val\": \"user.age\", + \"mustEscape\": true + } + ], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 6, + \"filename\": \"filters.cdata.tokens.json\" + } + ], + \"line\": 6, + \"filename\": \"filters.cdata.tokens.json\" + }, + \"line\": 5, + \"filename\": \"filters.cdata.tokens.json\" + } + ] + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 4, + \"filename\": \"filters.cdata.tokens.json\" + } + ], + \"line\": 0, + \"filename\": \"filters.cdata.tokens.json\" +}" +`; + +exports[`test cases/filters.coffeescript.input.json 1`] = ` +"{ + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"script\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"name\": \"coffee-script\", + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"val\": \"regexp = /\\\\n/\", + \"line\": 3 + } + ], + \"line\": 2, + \"filename\": \"filters.coffeescript.tokens.json\" + }, + \"attrs\": [], + \"line\": 2, + \"filename\": \"filters.coffeescript.tokens.json\", + \"val\": \"(function() {\\n var regexp;\\n\\n regexp = /\\\\n/;\\n\\n}).call(this);\\n\" + }, + { + \"type\": \"Text\", + \"name\": \"coffee-script\", + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"val\": \"math =\", + \"line\": 5 + }, + { + \"type\": \"Text\", + \"val\": \"\\n\", + \"line\": 6 + }, + { + \"type\": \"Text\", + \"val\": \" square: (value) -> value * value\", + \"line\": 6 + } + ], + \"line\": 4, + \"filename\": \"filters.coffeescript.tokens.json\" + }, + \"attrs\": [ + { + \"name\": \"minify\", + \"val\": \"true\", + \"mustEscape\": true + } + ], + \"line\": 4, + \"filename\": \"filters.coffeescript.tokens.json\", + \"val\": \"(function(){}).call(this);\" + } + ], + \"line\": 1, + \"filename\": \"filters.coffeescript.tokens.json\" + }, + \"attrs\": [ + { + \"name\": \"type\", + \"val\": \"\'text/javascript\'\", + \"mustEscape\": true + } + ], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 1, + \"filename\": \"filters.coffeescript.tokens.json\" + } + ], + \"line\": 0, + \"filename\": \"filters.coffeescript.tokens.json\" +}" +`; + +exports[`test cases/filters.custom.input.json 1`] = ` +"{ + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"html\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"body\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"name\": \"custom\", + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"val\": \"Line 1\", + \"line\": 4 + }, + { + \"type\": \"Text\", + \"val\": \"\\n\", + \"line\": 5 + }, + { + \"type\": \"Text\", + \"val\": \"Line 2\", + \"line\": 5 + }, + { + \"type\": \"Text\", + \"val\": \"\\n\", + \"line\": 6 + }, + { + \"type\": \"Text\", + \"val\": \"\", + \"line\": 6 + }, + { + \"type\": \"Text\", + \"val\": \"\\n\", + \"line\": 7 + }, + { + \"type\": \"Text\", + \"val\": \"Line 4\", + \"line\": 7 + } + ], + \"line\": 3, + \"filename\": \"filters.custom.tokens.json\" + }, + \"attrs\": [ + { + \"name\": \"opt\", + \"val\": \"\'val\'\", + \"mustEscape\": true + }, + { + \"name\": \"num\", + \"val\": \"2\", + \"mustEscape\": true + } + ], + \"line\": 3, + \"filename\": \"filters.custom.tokens.json\", + \"val\": \"BEGINLine 1\\nLine 2\\n\\nLine 4END\" + } + ], + \"line\": 2, + \"filename\": \"filters.custom.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 2, + \"filename\": \"filters.custom.tokens.json\" + } + ], + \"line\": 1, + \"filename\": \"filters.custom.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 1, + \"filename\": \"filters.custom.tokens.json\" + } + ], + \"line\": 0, + \"filename\": \"filters.custom.tokens.json\" +}" +`; + +exports[`test cases/filters.include.custom.input.json 1`] = ` +"{ + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"html\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"body\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"pre\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"line\": 4, + \"filename\": \"filters.include.custom.tokens.json\", + \"val\": \"BEGINhtml\\n body\\n pre\\n include:custom(opt=\'val\' num=2) filters.include.custom.pug\\nEND\" + } + ], + \"line\": 3, + \"filename\": \"filters.include.custom.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 3, + \"filename\": \"filters.include.custom.tokens.json\" + } + ], + \"line\": 2, + \"filename\": \"filters.include.custom.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 2, + \"filename\": \"filters.include.custom.tokens.json\" + } + ], + \"line\": 1, + \"filename\": \"filters.include.custom.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 1, + \"filename\": \"filters.include.custom.tokens.json\" + } + ], + \"line\": 0, + \"filename\": \"filters.include.custom.tokens.json\" +}" +`; + +exports[`test cases/filters.include.input.json 1`] = ` +"{ + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"html\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"body\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"line\": 3, + \"filename\": \"filters.include.tokens.json\", + \"val\": \"

Just some markdown tests.

\\n

With new line.

\\n\" + }, + { + \"type\": \"Tag\", + \"name\": \"script\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"line\": 5, + \"filename\": \"filters.include.tokens.json\", + \"val\": \"(function(){}).call(this);\" + } + ], + \"line\": 4, + \"filename\": \"filters.include.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 4, + \"filename\": \"filters.include.tokens.json\" + }, + { + \"type\": \"Tag\", + \"name\": \"script\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"line\": 7, + \"filename\": \"filters.include.tokens.json\", + \"val\": \"(function() {\\n var math;\\n\\n math = {\\n square: function(value) {\\n return value * value;\\n }\\n };\\n\\n}).call(this);\\n\" + } + ], + \"line\": 6, + \"filename\": \"filters.include.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 6, + \"filename\": \"filters.include.tokens.json\" + } + ], + \"line\": 2, + \"filename\": \"filters.include.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 2, + \"filename\": \"filters.include.tokens.json\" + } + ], + \"line\": 1, + \"filename\": \"filters.include.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 1, + \"filename\": \"filters.include.tokens.json\" + } + ], + \"line\": 0, + \"filename\": \"filters.include.tokens.json\" +}" +`; + +exports[`test cases/filters.inline.input.json 1`] = ` +"{ + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"p\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"val\": \"before \", + \"line\": 1, + \"filename\": \"filters.inline.tokens.json\" + }, + { + \"type\": \"Text\", + \"name\": \"cdata\", + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"val\": \"inside\", + \"line\": 1, + \"filename\": \"filters.inline.tokens.json\" + } + ], + \"line\": 1, + \"filename\": \"filters.inline.tokens.json\" + }, + \"attrs\": [], + \"line\": 1, + \"filename\": \"filters.inline.tokens.json\", + \"val\": \"\" + }, + { + \"type\": \"Text\", + \"val\": \" after\", + \"line\": 1, + \"filename\": \"filters.inline.tokens.json\" + } + ], + \"line\": 1, + \"filename\": \"filters.inline.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 1, + \"filename\": \"filters.inline.tokens.json\" + } + ], + \"line\": 0, + \"filename\": \"filters.inline.tokens.json\" +}" +`; + +exports[`test cases/filters.less.input.json 1`] = ` +"{ + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"html\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"head\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"style\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"name\": \"less\", + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"val\": \"@pad: 15px;\", + \"line\": 5 + }, + { + \"type\": \"Text\", + \"val\": \"\\n\", + \"line\": 6 + }, + { + \"type\": \"Text\", + \"val\": \"body {\", + \"line\": 6 + }, + { + \"type\": \"Text\", + \"val\": \"\\n\", + \"line\": 7 + }, + { + \"type\": \"Text\", + \"val\": \" padding: @pad;\", + \"line\": 7 + }, + { + \"type\": \"Text\", + \"val\": \"\\n\", + \"line\": 8 + }, + { + \"type\": \"Text\", + \"val\": \"}\", + \"line\": 8 + } + ], + \"line\": 4, + \"filename\": \"filters.less.tokens.json\" + }, + \"attrs\": [], + \"line\": 4, + \"filename\": \"filters.less.tokens.json\", + \"val\": \"body {\\n padding: 15px;\\n}\\n\" + } + ], + \"line\": 3, + \"filename\": \"filters.less.tokens.json\" + }, + \"attrs\": [ + { + \"name\": \"type\", + \"val\": \"\\\"text/css\\\"\", + \"mustEscape\": true + } + ], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 3, + \"filename\": \"filters.less.tokens.json\" + } + ], + \"line\": 2, + \"filename\": \"filters.less.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 2, + \"filename\": \"filters.less.tokens.json\" + } + ], + \"line\": 1, + \"filename\": \"filters.less.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 1, + \"filename\": \"filters.less.tokens.json\" + } + ], + \"line\": 0, + \"filename\": \"filters.less.tokens.json\" +}" +`; + +exports[`test cases/filters.markdown.input.json 1`] = ` +"{ + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"html\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"body\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"name\": \"markdown-it\", + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"val\": \"This is _some_ awesome **markdown**\", + \"line\": 4 + }, + { + \"type\": \"Text\", + \"val\": \"\\n\", + \"line\": 5 + }, + { + \"type\": \"Text\", + \"val\": \"whoop.\", + \"line\": 5 + } + ], + \"line\": 3, + \"filename\": \"filters.markdown.tokens.json\" + }, + \"attrs\": [], + \"line\": 3, + \"filename\": \"filters.markdown.tokens.json\", + \"val\": \"

This is some awesome markdown\\nwhoop.

\\n\" + } + ], + \"line\": 2, + \"filename\": \"filters.markdown.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 2, + \"filename\": \"filters.markdown.tokens.json\" + } + ], + \"line\": 1, + \"filename\": \"filters.markdown.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 1, + \"filename\": \"filters.markdown.tokens.json\" + } + ], + \"line\": 0, + \"filename\": \"filters.markdown.tokens.json\" +}" +`; + +exports[`test cases/filters.nested.input.json 1`] = ` +"{ + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"script\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"name\": \"cdata\", + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"name\": \"uglify-js\", + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"val\": \"(function() {\", + \"line\": 3 + }, + { + \"type\": \"Text\", + \"val\": \"\\n\", + \"line\": 4 + }, + { + \"type\": \"Text\", + \"val\": \" console.log(\'test\')\", + \"line\": 4 + }, + { + \"type\": \"Text\", + \"val\": \"\\n\", + \"line\": 5 + }, + { + \"type\": \"Text\", + \"val\": \"})()\", + \"line\": 5 + } + ], + \"line\": 2, + \"filename\": \"filters.nested.tokens.json\" + }, + \"attrs\": [], + \"line\": 2, + \"filename\": \"filters.nested.tokens.json\", + \"val\": \"!function(){console.log(\\\"test\\\")}();\" + } + ], + \"line\": 2, + \"filename\": \"filters.nested.tokens.json\" + }, + \"attrs\": [], + \"line\": 2, + \"filename\": \"filters.nested.tokens.json\", + \"val\": \"\" + } + ], + \"line\": 1, + \"filename\": \"filters.nested.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 1, + \"filename\": \"filters.nested.tokens.json\" + }, + { + \"type\": \"Tag\", + \"name\": \"script\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"name\": \"cdata\", + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"name\": \"uglify-js\", + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"name\": \"coffee-script\", + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"val\": \"(->\", + \"line\": 8 + }, + { + \"type\": \"Text\", + \"val\": \"\\n\", + \"line\": 9 + }, + { + \"type\": \"Text\", + \"val\": \" console.log \'test\'\", + \"line\": 9 + }, + { + \"type\": \"Text\", + \"val\": \"\\n\", + \"line\": 10 + }, + { + \"type\": \"Text\", + \"val\": \")()\", + \"line\": 10 + } + ], + \"line\": 7, + \"filename\": \"filters.nested.tokens.json\" + }, + \"attrs\": [], + \"line\": 7, + \"filename\": \"filters.nested.tokens.json\", + \"val\": \"(function() {\\n (function() {\\n return console.log(\'test\');\\n })();\\n\\n}).call(this);\\n\" + } + ], + \"line\": 7, + \"filename\": \"filters.nested.tokens.json\" + }, + \"attrs\": [], + \"line\": 7, + \"filename\": \"filters.nested.tokens.json\", + \"val\": \"(function(){!function(){console.log(\\\"test\\\")}()}).call(this);\" + } + ], + \"line\": 7, + \"filename\": \"filters.nested.tokens.json\" + }, + \"attrs\": [], + \"line\": 7, + \"filename\": \"filters.nested.tokens.json\", + \"val\": \"\" + } + ], + \"line\": 6, + \"filename\": \"filters.nested.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 6, + \"filename\": \"filters.nested.tokens.json\" + } + ], + \"line\": 0, + \"filename\": \"filters.nested.tokens.json\" +}" +`; + +exports[`test cases/filters.stylus.input.json 1`] = ` +"{ + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"html\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"head\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"style\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"name\": \"stylus\", + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"val\": \"body\", + \"line\": 5 + }, + { + \"type\": \"Text\", + \"val\": \"\\n\", + \"line\": 6 + }, + { + \"type\": \"Text\", + \"val\": \" padding: 50px\", + \"line\": 6 + } + ], + \"line\": 4, + \"filename\": \"filters.stylus.tokens.json\" + }, + \"attrs\": [], + \"line\": 4, + \"filename\": \"filters.stylus.tokens.json\", + \"val\": \"body {\\n padding: 50px;\\n}\\n\" + } + ], + \"line\": 3, + \"filename\": \"filters.stylus.tokens.json\" + }, + \"attrs\": [ + { + \"name\": \"type\", + \"val\": \"\\\"text/css\\\"\", + \"mustEscape\": true + } + ], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 3, + \"filename\": \"filters.stylus.tokens.json\" + } + ], + \"line\": 2, + \"filename\": \"filters.stylus.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 2, + \"filename\": \"filters.stylus.tokens.json\" + }, + { + \"type\": \"Tag\", + \"name\": \"body\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [], + \"line\": 7, + \"filename\": \"filters.stylus.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 7, + \"filename\": \"filters.stylus.tokens.json\" + } + ], + \"line\": 1, + \"filename\": \"filters.stylus.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 1, + \"filename\": \"filters.stylus.tokens.json\" + } + ], + \"line\": 0, + \"filename\": \"filters.stylus.tokens.json\" +}" +`; + +exports[`test cases/filters-empty.input.json 1`] = ` +"{ + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Code\", + \"val\": \"var users = [{ name: \'tobi\', age: 2 }]\", + \"buffer\": false, + \"mustEscape\": false, + \"isInline\": false, + \"line\": 1, + \"filename\": \"filters-empty.tokens.json\" + }, + { + \"type\": \"Tag\", + \"name\": \"fb:users\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Each\", + \"obj\": \"users\", + \"val\": \"user\", + \"key\": null, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Tag\", + \"name\": \"fb:user\", + \"selfClosing\": false, + \"block\": { + \"type\": \"Block\", + \"nodes\": [ + { + \"type\": \"Text\", + \"name\": \"cdata\", + \"block\": { + \"type\": \"Block\", + \"nodes\": [], + \"line\": 6, + \"filename\": \"filters-empty.tokens.json\" + }, + \"attrs\": [], + \"line\": 6, + \"filename\": \"filters-empty.tokens.json\", + \"val\": \"\" + } + ], + \"line\": 5, + \"filename\": \"filters-empty.tokens.json\" + }, + \"attrs\": [ + { + \"name\": \"age\", + \"val\": \"user.age\", + \"mustEscape\": true + } + ], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 5, + \"filename\": \"filters-empty.tokens.json\" + } + ], + \"line\": 5, + \"filename\": \"filters-empty.tokens.json\" + }, + \"line\": 4, + \"filename\": \"filters-empty.tokens.json\" + } + ], + \"line\": 3, + \"filename\": \"filters-empty.tokens.json\" + }, + \"attrs\": [], + \"attributeBlocks\": [], + \"isInline\": false, + \"line\": 3, + \"filename\": \"filters-empty.tokens.json\" + } + ], + \"line\": 0, + \"filename\": \"filters-empty.tokens.json\" +}" +`; + +exports[`test errors/dynamic-option.input.json 1`] = ` +Object { + "code": "PUG:FILTER_OPTION_NOT_CONSTANT", + "line": 2, + "msg": "\"opt\" is not constant. All filters are rendered compile-time so filter options must be constants.", +} +`; diff --git a/node_modules/pug-filters/test/__snapshots__/per-filter-options-applied-to-nested-filters.test.js.snap b/node_modules/pug-filters/test/__snapshots__/per-filter-options-applied-to-nested-filters.test.js.snap new file mode 100644 index 0000000..c64988c --- /dev/null +++ b/node_modules/pug-filters/test/__snapshots__/per-filter-options-applied-to-nested-filters.test.js.snap @@ -0,0 +1,100 @@ +exports[`test per filter options are applied, even to nested filters 1`] = ` +Object { + "filename": "/packages/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "/packages/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js", + "line": 2, + "nodes": Array [ + Object { + "attrs": Array [], + "block": Object { + "filename": "/packages/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js", + "line": 3, + "nodes": Array [ + Object { + "attrs": Array [], + "block": Object { + "filename": "/packages/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js", + "line": 3, + "nodes": Array [ + Object { + "column": 5, + "filename": "/packages/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js", + "line": 4, + "type": "Text", + "val": "function myFunc(foo) {", + }, + Object { + "column": 1, + "filename": "/packages/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js", + "line": 5, + "type": "Text", + "val": " +", + }, + Object { + "column": 5, + "filename": "/packages/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js", + "line": 5, + "type": "Text", + "val": " return foo;", + }, + Object { + "column": 1, + "filename": "/packages/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js", + "line": 6, + "type": "Text", + "val": " +", + }, + Object { + "column": 5, + "filename": "/packages/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js", + "line": 6, + "type": "Text", + "val": "}", + }, + ], + "type": "Block", + }, + "column": 9, + "filename": "/packages/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js", + "line": 3, + "name": "uglify-js", + "type": "Text", + "val": "function myFunc(n) { + return n; +}", + }, + ], + "type": "Block", + }, + "column": 3, + "filename": "/packages/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js", + "line": 3, + "name": "cdata", + "type": "Text", + "val": "", + }, + ], + "type": "Block", + }, + "column": 1, + "filename": "/packages/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js", + "isInline": false, + "line": 2, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; diff --git a/node_modules/pug-filters/test/cases/filters-empty.input.json b/node_modules/pug-filters/test/cases/filters-empty.input.json new file mode 100644 index 0000000..e360d5d --- /dev/null +++ b/node_modules/pug-filters/test/cases/filters-empty.input.json @@ -0,0 +1,84 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Code", + "val": "var users = [{ name: 'tobi', age: 2 }]", + "buffer": false, + "mustEscape": false, + "isInline": false, + "line": 1, + "filename": "filters-empty.tokens.json" + }, + { + "type": "Tag", + "name": "fb:users", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Each", + "obj": "users", + "val": "user", + "key": null, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "fb:user", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Filter", + "name": "cdata", + "block": { + "type": "Block", + "nodes": [], + "line": 6, + "filename": "filters-empty.tokens.json" + }, + "attrs": [], + "line": 6, + "filename": "filters-empty.tokens.json" + } + ], + "line": 5, + "filename": "filters-empty.tokens.json" + }, + "attrs": [ + { + "name": "age", + "val": "user.age", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "filters-empty.tokens.json" + } + ], + "line": 5, + "filename": "filters-empty.tokens.json" + }, + "line": 4, + "filename": "filters-empty.tokens.json" + } + ], + "line": 3, + "filename": "filters-empty.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "filters-empty.tokens.json" + } + ], + "line": 0, + "filename": "filters-empty.tokens.json" +} \ No newline at end of file diff --git a/node_modules/pug-filters/test/cases/filters.cdata.input.json b/node_modules/pug-filters/test/cases/filters.cdata.input.json new file mode 100644 index 0000000..0b6034f --- /dev/null +++ b/node_modules/pug-filters/test/cases/filters.cdata.input.json @@ -0,0 +1,83 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Code", + "val": "users = [{ name: 'tobi', age: 2 }]", + "buffer": false, + "mustEscape": false, + "isInline": false, + "line": 2, + "filename": "filters.cdata.tokens.json" + }, + { + "type": "Tag", + "name": "fb:users", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Each", + "obj": "users", + "val": "user", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "fb:user", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Filter", + "name": "cdata", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "#{user.name}", + "line": 8 + } + ] + }, + "attrs": [], + "line": 7, + "filename": "filters.cdata.tokens.json" + } + ] + }, + "attrs": [ + { + "name": "age", + "val": "user.age", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 6, + "filename": "filters.cdata.tokens.json" + } + ], + "line": 6, + "filename": "filters.cdata.tokens.json" + }, + "line": 5, + "filename": "filters.cdata.tokens.json" + } + ] + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "filters.cdata.tokens.json" + } + ], + "line": 0, + "filename": "filters.cdata.tokens.json" +} \ No newline at end of file diff --git a/node_modules/pug-filters/test/cases/filters.coffeescript.input.json b/node_modules/pug-filters/test/cases/filters.coffeescript.input.json new file mode 100644 index 0000000..106339c --- /dev/null +++ b/node_modules/pug-filters/test/cases/filters.coffeescript.input.json @@ -0,0 +1,84 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Filter", + "name": "coffee-script", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "regexp = /\\n/", + "line": 3 + } + ], + "line": 2, + "filename": "filters.coffeescript.tokens.json" + }, + "attrs": [], + "line": 2, + "filename": "filters.coffeescript.tokens.json" + }, + { + "type": "Filter", + "name": "coffee-script", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "math =", + "line": 5 + }, + { + "type": "Text", + "val": "\n", + "line": 6 + }, + { + "type": "Text", + "val": " square: (value) -> value * value", + "line": 6 + } + ], + "line": 4, + "filename": "filters.coffeescript.tokens.json" + }, + "attrs": [ + { + "name": "minify", + "val": "true", + "mustEscape": true + } + ], + "line": 4, + "filename": "filters.coffeescript.tokens.json" + } + ], + "line": 1, + "filename": "filters.coffeescript.tokens.json" + }, + "attrs": [ + { + "name": "type", + "val": "'text/javascript'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "filters.coffeescript.tokens.json" + } + ], + "line": 0, + "filename": "filters.coffeescript.tokens.json" +} \ No newline at end of file diff --git a/node_modules/pug-filters/test/cases/filters.custom.input.json b/node_modules/pug-filters/test/cases/filters.custom.input.json new file mode 100644 index 0000000..ae046d6 --- /dev/null +++ b/node_modules/pug-filters/test/cases/filters.custom.input.json @@ -0,0 +1,101 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Filter", + "name": "custom", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "Line 1", + "line": 4 + }, + { + "type": "Text", + "val": "\n", + "line": 5 + }, + { + "type": "Text", + "val": "Line 2", + "line": 5 + }, + { + "type": "Text", + "val": "\n", + "line": 6 + }, + { + "type": "Text", + "val": "", + "line": 6 + }, + { + "type": "Text", + "val": "\n", + "line": 7 + }, + { + "type": "Text", + "val": "Line 4", + "line": 7 + } + ], + "line": 3, + "filename": "filters.custom.tokens.json" + }, + "attrs": [ + { + "name": "opt", + "val": "'val'", + "mustEscape": true + }, + { + "name": "num", + "val": "2", + "mustEscape": true + } + ], + "line": 3, + "filename": "filters.custom.tokens.json" + } + ], + "line": 2, + "filename": "filters.custom.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "filters.custom.tokens.json" + } + ], + "line": 1, + "filename": "filters.custom.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "filters.custom.tokens.json" + } + ], + "line": 0, + "filename": "filters.custom.tokens.json" +} \ No newline at end of file diff --git a/node_modules/pug-filters/test/cases/filters.include.custom.input.json b/node_modules/pug-filters/test/cases/filters.include.custom.input.json new file mode 100644 index 0000000..cc99b5a --- /dev/null +++ b/node_modules/pug-filters/test/cases/filters.include.custom.input.json @@ -0,0 +1,91 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "pre", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "RawInclude", + "file": { + "type": "FileReference", + "line": 4, + "filename": "filters.include.custom.tokens.json", + "path": "filters.include.custom.pug", + "fullPath": "test/cases/filters.include.custom.pug", + "str": "html\n body\n pre\n include:custom(opt='val' num=2) filters.include.custom.pug\n" + }, + "line": 4, + "filename": "filters.include.custom.tokens.json", + "filters": [ + { + "type": "IncludeFilter", + "name": "custom", + "attrs": [ + { + "name": "opt", + "val": "'val'", + "mustEscape": true + }, + { + "name": "num", + "val": "2", + "mustEscape": true + } + ], + "line": 4, + "filename": "filters.include.custom.tokens.json" + } + ] + } + ], + "line": 3, + "filename": "filters.include.custom.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "filters.include.custom.tokens.json" + } + ], + "line": 2, + "filename": "filters.include.custom.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "filters.include.custom.tokens.json" + } + ], + "line": 1, + "filename": "filters.include.custom.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "filters.include.custom.tokens.json" + } + ], + "line": 0, + "filename": "filters.include.custom.tokens.json" +} \ No newline at end of file diff --git a/node_modules/pug-filters/test/cases/filters.include.custom.pug b/node_modules/pug-filters/test/cases/filters.include.custom.pug new file mode 100644 index 0000000..5811147 --- /dev/null +++ b/node_modules/pug-filters/test/cases/filters.include.custom.pug @@ -0,0 +1,4 @@ +html + body + pre + include:custom(opt='val' num=2) filters.include.custom.pug diff --git a/node_modules/pug-filters/test/cases/filters.include.input.json b/node_modules/pug-filters/test/cases/filters.include.input.json new file mode 100644 index 0000000..4238561 --- /dev/null +++ b/node_modules/pug-filters/test/cases/filters.include.input.json @@ -0,0 +1,153 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "RawInclude", + "file": { + "type": "FileReference", + "line": 3, + "filename": "filters.include.tokens.json", + "path": "some.md", + "fullPath": "test/cases/some.md", + "str": "Just _some_ markdown **tests**.\n\nWith new line.\n" + }, + "line": 3, + "filename": "filters.include.tokens.json", + "filters": [ + { + "type": "IncludeFilter", + "name": "markdown-it", + "attrs": [], + "line": 3, + "filename": "filters.include.tokens.json" + } + ] + }, + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "RawInclude", + "file": { + "type": "FileReference", + "line": 5, + "filename": "filters.include.tokens.json", + "path": "include-filter-coffee.coffee", + "fullPath": "test/cases/include-filter-coffee.coffee", + "str": "math =\n square: (value) -> value * value\n" + }, + "line": 5, + "filename": "filters.include.tokens.json", + "filters": [ + { + "type": "IncludeFilter", + "name": "coffee-script", + "attrs": [ + { + "name": "minify", + "val": "true", + "mustEscape": true + } + ], + "line": 5, + "filename": "filters.include.tokens.json" + } + ] + } + ], + "line": 4, + "filename": "filters.include.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "filters.include.tokens.json" + }, + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "RawInclude", + "file": { + "type": "FileReference", + "line": 7, + "filename": "filters.include.tokens.json", + "path": "include-filter-coffee.coffee", + "fullPath": "test/cases/include-filter-coffee.coffee", + "str": "math =\n square: (value) -> value * value\n" + }, + "line": 7, + "filename": "filters.include.tokens.json", + "filters": [ + { + "type": "IncludeFilter", + "name": "coffee-script", + "attrs": [ + { + "name": "minify", + "val": "false", + "mustEscape": true + } + ], + "line": 7, + "filename": "filters.include.tokens.json" + } + ] + } + ], + "line": 6, + "filename": "filters.include.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 6, + "filename": "filters.include.tokens.json" + } + ], + "line": 2, + "filename": "filters.include.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "filters.include.tokens.json" + } + ], + "line": 1, + "filename": "filters.include.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "filters.include.tokens.json" + } + ], + "line": 0, + "filename": "filters.include.tokens.json" +} \ No newline at end of file diff --git a/node_modules/pug-filters/test/cases/filters.inline.input.json b/node_modules/pug-filters/test/cases/filters.inline.input.json new file mode 100644 index 0000000..5899faa --- /dev/null +++ b/node_modules/pug-filters/test/cases/filters.inline.input.json @@ -0,0 +1,56 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "before ", + "line": 1, + "filename": "filters.inline.tokens.json" + }, + { + "type": "Filter", + "name": "cdata", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "inside", + "line": 1, + "filename": "filters.inline.tokens.json" + } + ], + "line": 1, + "filename": "filters.inline.tokens.json" + }, + "attrs": [], + "line": 1, + "filename": "filters.inline.tokens.json" + }, + { + "type": "Text", + "val": " after", + "line": 1, + "filename": "filters.inline.tokens.json" + } + ], + "line": 1, + "filename": "filters.inline.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "filters.inline.tokens.json" + } + ], + "line": 0, + "filename": "filters.inline.tokens.json" +} \ No newline at end of file diff --git a/node_modules/pug-filters/test/cases/filters.less.input.json b/node_modules/pug-filters/test/cases/filters.less.input.json new file mode 100644 index 0000000..f13a33a --- /dev/null +++ b/node_modules/pug-filters/test/cases/filters.less.input.json @@ -0,0 +1,113 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "head", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "style", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Filter", + "name": "less", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "@pad: 15px;", + "line": 5 + }, + { + "type": "Text", + "val": "\n", + "line": 6 + }, + { + "type": "Text", + "val": "body {", + "line": 6 + }, + { + "type": "Text", + "val": "\n", + "line": 7 + }, + { + "type": "Text", + "val": " padding: @pad;", + "line": 7 + }, + { + "type": "Text", + "val": "\n", + "line": 8 + }, + { + "type": "Text", + "val": "}", + "line": 8 + } + ], + "line": 4, + "filename": "filters.less.tokens.json" + }, + "attrs": [], + "line": 4, + "filename": "filters.less.tokens.json" + } + ], + "line": 3, + "filename": "filters.less.tokens.json" + }, + "attrs": [ + { + "name": "type", + "val": "\"text/css\"", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "filters.less.tokens.json" + } + ], + "line": 2, + "filename": "filters.less.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "filters.less.tokens.json" + } + ], + "line": 1, + "filename": "filters.less.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "filters.less.tokens.json" + } + ], + "line": 0, + "filename": "filters.less.tokens.json" +} \ No newline at end of file diff --git a/node_modules/pug-filters/test/cases/filters.markdown.input.json b/node_modules/pug-filters/test/cases/filters.markdown.input.json new file mode 100644 index 0000000..4dbf95e --- /dev/null +++ b/node_modules/pug-filters/test/cases/filters.markdown.input.json @@ -0,0 +1,70 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Filter", + "name": "markdown-it", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "This is _some_ awesome **markdown**", + "line": 4 + }, + { + "type": "Text", + "val": "\n", + "line": 5 + }, + { + "type": "Text", + "val": "whoop.", + "line": 5 + } + ], + "line": 3, + "filename": "filters.markdown.tokens.json" + }, + "attrs": [], + "line": 3, + "filename": "filters.markdown.tokens.json" + } + ], + "line": 2, + "filename": "filters.markdown.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "filters.markdown.tokens.json" + } + ], + "line": 1, + "filename": "filters.markdown.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "filters.markdown.tokens.json" + } + ], + "line": 0, + "filename": "filters.markdown.tokens.json" +} \ No newline at end of file diff --git a/node_modules/pug-filters/test/cases/filters.nested.input.json b/node_modules/pug-filters/test/cases/filters.nested.input.json new file mode 100644 index 0000000..8b0354a --- /dev/null +++ b/node_modules/pug-filters/test/cases/filters.nested.input.json @@ -0,0 +1,161 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Filter", + "name": "cdata", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Filter", + "name": "uglify-js", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "(function() {", + "line": 3 + }, + { + "type": "Text", + "val": "\n", + "line": 4 + }, + { + "type": "Text", + "val": " console.log('test')", + "line": 4 + }, + { + "type": "Text", + "val": "\n", + "line": 5 + }, + { + "type": "Text", + "val": "})()", + "line": 5 + } + ], + "line": 2, + "filename": "filters.nested.tokens.json" + }, + "attrs": [], + "line": 2, + "filename": "filters.nested.tokens.json" + } + ], + "line": 2, + "filename": "filters.nested.tokens.json" + }, + "attrs": [], + "line": 2, + "filename": "filters.nested.tokens.json" + } + ], + "line": 1, + "filename": "filters.nested.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "filters.nested.tokens.json" + }, + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Filter", + "name": "cdata", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Filter", + "name": "uglify-js", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Filter", + "name": "coffee-script", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "(->", + "line": 8 + }, + { + "type": "Text", + "val": "\n", + "line": 9 + }, + { + "type": "Text", + "val": " console.log 'test'", + "line": 9 + }, + { + "type": "Text", + "val": "\n", + "line": 10 + }, + { + "type": "Text", + "val": ")()", + "line": 10 + } + ], + "line": 7, + "filename": "filters.nested.tokens.json" + }, + "attrs": [], + "line": 7, + "filename": "filters.nested.tokens.json" + } + ], + "line": 7, + "filename": "filters.nested.tokens.json" + }, + "attrs": [], + "line": 7, + "filename": "filters.nested.tokens.json" + } + ], + "line": 7, + "filename": "filters.nested.tokens.json" + }, + "attrs": [], + "line": 7, + "filename": "filters.nested.tokens.json" + } + ], + "line": 6, + "filename": "filters.nested.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 6, + "filename": "filters.nested.tokens.json" + } + ], + "line": 0, + "filename": "filters.nested.tokens.json" +} \ No newline at end of file diff --git a/node_modules/pug-filters/test/cases/filters.stylus.input.json b/node_modules/pug-filters/test/cases/filters.stylus.input.json new file mode 100644 index 0000000..8fec328 --- /dev/null +++ b/node_modules/pug-filters/test/cases/filters.stylus.input.json @@ -0,0 +1,109 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "head", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "style", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Filter", + "name": "stylus", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "body", + "line": 5 + }, + { + "type": "Text", + "val": "\n", + "line": 6 + }, + { + "type": "Text", + "val": " padding: 50px", + "line": 6 + } + ], + "line": 4, + "filename": "filters.stylus.tokens.json" + }, + "attrs": [], + "line": 4, + "filename": "filters.stylus.tokens.json" + } + ], + "line": 3, + "filename": "filters.stylus.tokens.json" + }, + "attrs": [ + { + "name": "type", + "val": "\"text/css\"", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "filters.stylus.tokens.json" + } + ], + "line": 2, + "filename": "filters.stylus.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "filters.stylus.tokens.json" + }, + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 7, + "filename": "filters.stylus.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 7, + "filename": "filters.stylus.tokens.json" + } + ], + "line": 1, + "filename": "filters.stylus.tokens.json" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "filters.stylus.tokens.json" + } + ], + "line": 0, + "filename": "filters.stylus.tokens.json" +} \ No newline at end of file diff --git a/node_modules/pug-filters/test/cases/include-filter-coffee.coffee b/node_modules/pug-filters/test/cases/include-filter-coffee.coffee new file mode 100644 index 0000000..9723cd7 --- /dev/null +++ b/node_modules/pug-filters/test/cases/include-filter-coffee.coffee @@ -0,0 +1,2 @@ +math = + square: (value) -> value * value diff --git a/node_modules/pug-filters/test/cases/some.md b/node_modules/pug-filters/test/cases/some.md new file mode 100644 index 0000000..8ea3e54 --- /dev/null +++ b/node_modules/pug-filters/test/cases/some.md @@ -0,0 +1,3 @@ +Just _some_ markdown **tests**. + +With new line. diff --git a/node_modules/pug-filters/test/custom-filters.js b/node_modules/pug-filters/test/custom-filters.js new file mode 100644 index 0000000..80da750 --- /dev/null +++ b/node_modules/pug-filters/test/custom-filters.js @@ -0,0 +1,9 @@ +var assert = require('assert'); + +module.exports = { + custom: function (str, options) { + expect(options.opt).toBe('val'); + expect(options.num).toBe(2); + return 'BEGIN' + str + 'END'; + } +}; diff --git a/node_modules/pug-filters/test/errors-src/dynamic-option.jade b/node_modules/pug-filters/test/errors-src/dynamic-option.jade new file mode 100644 index 0000000..f79dd94 --- /dev/null +++ b/node_modules/pug-filters/test/errors-src/dynamic-option.jade @@ -0,0 +1,3 @@ +- var opt = 'a' +:cdata(option=opt) + hey diff --git a/node_modules/pug-filters/test/errors/dynamic-option.input.json b/node_modules/pug-filters/test/errors/dynamic-option.input.json new file mode 100644 index 0000000..3728761 --- /dev/null +++ b/node_modules/pug-filters/test/errors/dynamic-option.input.json @@ -0,0 +1,37 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Code", + "val": "var opt = 'a'", + "buffer": false, + "escape": false, + "isInline": false, + "line": 1 + }, + { + "type": "Filter", + "name": "cdata", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "hey", + "line": 3 + } + ], + "line": 2 + }, + "attrs": [ + { + "name": "option", + "val": "opt", + "escaped": true + } + ], + "line": 2 + } + ], + "line": 0 +} \ No newline at end of file diff --git a/node_modules/pug-filters/test/filter-aliases.test.js b/node_modules/pug-filters/test/filter-aliases.test.js new file mode 100644 index 0000000..14caa00 --- /dev/null +++ b/node_modules/pug-filters/test/filter-aliases.test.js @@ -0,0 +1,89 @@ +const lex = require('pug-lexer'); +const parse = require('pug-parser'); +const handleFilters = require('../').handleFilters; + +const customFilters = {}; +test('filters can be aliased', () => { + const source = ` +script + :cdata:minify + function myFunc(foo) { + return foo; + } + `; + + const ast = parse( + lex(source, {filename: __filename}), + {filename: __filename, src: source} + ); + + const options = {}; + const aliases = { + 'minify': 'uglify-js', + }; + + const output = handleFilters(ast, customFilters, options, aliases); + expect(output).toMatchSnapshot(); +}); + +test('we do not support chains of aliases', () => { + const source = ` +script + :cdata:minify-js + function myFunc(foo) { + return foo; + } + `; + + const ast = parse( + lex(source, {filename: __filename}), + {filename: __filename, src: source} + ); + + const options = {}; + const aliases = { + 'minify-js': 'minify', + 'minify': 'uglify-js', + }; + + try { + const output = handleFilters(ast, customFilters, options, aliases); + } catch (ex) { + expect({ + code: ex.code, + message: ex.message, + }).toMatchSnapshot(); + return; + } + throw new Error('Expected an exception'); +}); + +test('options are applied before aliases', () => { + const source = ` +script + :cdata:minify + function myFunc(foo) { + return foo; + } + :cdata:uglify-js + function myFunc(foo) { + return foo; + } + `; + + const ast = parse( + lex(source, {filename: __filename}), + {filename: __filename, src: source} + ); + + + const options = { + 'minify': {output: {beautify: true}}, + }; + const aliases = { + 'minify': 'uglify-js', + }; + + const output = handleFilters(ast, customFilters, options, aliases); + expect(output).toMatchSnapshot(); +}); diff --git a/node_modules/pug-filters/test/index.test.js b/node_modules/pug-filters/test/index.test.js new file mode 100644 index 0000000..60e4f8e --- /dev/null +++ b/node_modules/pug-filters/test/index.test.js @@ -0,0 +1,51 @@ +'use strict'; + +var fs = require('fs'); +var assert = require('assert'); +var handleFilters = require('../').handleFilters; +var customFilters = require('./custom-filters.js'); + +process.chdir(__dirname + '/../'); + +var testCases; + +testCases = fs.readdirSync(__dirname + '/cases').filter(function (name) { + return /\.input\.json$/.test(name); +}); +// +testCases.forEach(function (filename) { + function read (path) { + return fs.readFileSync(__dirname + '/cases/' + path, 'utf8'); + } + + test('cases/' + filename, function () { + var actualAst = JSON.stringify(handleFilters(JSON.parse(read(filename)), customFilters), null, ' '); + expect(actualAst).toMatchSnapshot(); + }) +}); + +testCases = fs.readdirSync(__dirname + '/errors').filter(function (name) { + return /\.input\.json$/.test(name); +}); + +testCases.forEach(function (filename) { + function read (path) { + return fs.readFileSync(__dirname + '/errors/' + path, 'utf8'); + } + + test('errors/' + filename, function () { + var actual; + try { + handleFilters(JSON.parse(read(filename)), customFilters); + throw new Error('Expected ' + filename + ' to throw an exception.'); + } catch (ex) { + if (!ex || !ex.code || !ex.code.indexOf('PUG:') === 0) throw ex; + actual = { + msg: ex.msg, + code: ex.code, + line: ex.line + }; + } + expect(actual).toMatchSnapshot(); + }) +}); diff --git a/node_modules/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js b/node_modules/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js new file mode 100644 index 0000000..8c615c0 --- /dev/null +++ b/node_modules/pug-filters/test/per-filter-options-applied-to-nested-filters.test.js @@ -0,0 +1,28 @@ +const lex = require('pug-lexer'); +const parse = require('pug-parser'); +const handleFilters = require('../').handleFilters; + +const customFilters = {}; +test('per filter options are applied, even to nested filters', () => { + const source = ` +script + :cdata:uglify-js + function myFunc(foo) { + return foo; + } + `; + + const ast = parse( + lex(source, {filename: __filename}), + {filename: __filename, src: source} + ); + + const options = { + 'uglify-js': {output: {beautify: true}}, + }; + + const output = handleFilters(ast, customFilters, options); + expect(output).toMatchSnapshot(); + + // TODO: render with `options.filterOptions['uglify-js']` +}); diff --git a/node_modules/pug-filters/test/update-test-cases.js b/node_modules/pug-filters/test/update-test-cases.js new file mode 100644 index 0000000..dfbb56b --- /dev/null +++ b/node_modules/pug-filters/test/update-test-cases.js @@ -0,0 +1,131 @@ +'use strict'; + +var fs = require('fs'); +var assert = require('assert'); +var getRepo = require('get-repo'); +var lex = require('pug-lexer'); +var load = require('pug-load'); +var parse = require('pug-parser'); +var handleFilters = require('../').handleFilters; +var customFilters = require('./custom-filters.js'); + +var existing = fs.readdirSync(__dirname + '/cases').filter(function (name) { + return /\.input\.json$/.test(name); +}); + +function getError (input, filename) { + try { + handleFilters(input, customFilters); + throw new Error('Expected ' + filename + ' to throw an exception.'); + } catch (ex) { + if (!ex || !ex.code || !ex.code.indexOf('PUG:') === 0) throw ex; + return { + msg: ex.msg, + code: ex.code, + line: ex.line + }; + } +} + +getRepo('pugjs', 'pug-parser').on('data', function (entry) { + var match; + if (entry.type === 'File' && (match = /^\/test\/cases\/(filters.*)\.expected\.json$/.exec(entry.path))) { + var name = match[1]; + var filename = name + '.input.json'; + var alreadyExists = false; + existing = existing.filter(function (existingName) { + if (existingName === filename) { + alreadyExists = true; + return false; + } + return true; + }); + if (alreadyExists) { + var actualInputAst = getLoadedAst(entry.body.toString('utf8')); + try { + var expectedInputAst = JSON.parse(fs.readFileSync(__dirname + '/cases/' + filename, 'utf8')); + assert.deepEqual(expectedInputAst, actualInputAst); + } catch (ex) { + console.log('update: ' + filename); + fs.writeFileSync(__dirname + '/cases/' + filename, JSON.stringify(actualInputAst, null, ' ')); + } + + var actualAstStr = JSON.stringify(handleFilters(actualInputAst, customFilters), null, ' '); + try { + var expectedAstStr = fs.readFileSync(__dirname + '/cases/' + name + '.expected.json', 'utf8'); + assert.equal(actualAstStr, expectedAstStr); + } catch (ex) { + console.log('update: ' + name + '.expected.json'); + fs.writeFileSync(__dirname + '/cases/' + name + '.expected.json', actualAstStr); + } + } else { + console.log('create: ' + filename); + var inputAst = getLoadedAst(entry.body.toString('utf8')); + fs.writeFileSync(__dirname + '/cases/' + filename, JSON.stringify(inputAst, null, ' ')); + console.log('create: ' + name + '.expected.json'); + var ast = handleFilters(inputAst, customFilters); + fs.writeFileSync(__dirname + '/cases/' + name + '.expected.json', JSON.stringify(ast, null, ' ')); + } + } +}).on('end', function () { + existing.forEach(function (file) { + fs.unlinkSync(__dirname + '/cases/' + file); + }); + var existingErrors = fs.readdirSync(__dirname + '/errors').filter(function (name) { + return /\.input\.json$/.test(name); + }); + var pugRe = /\.pug$/; + fs.readdirSync(__dirname + '/errors-src').forEach(function (name) { + if (!pugRe.test(name)) return; + name = name.replace(pugRe, ''); + var filename = name + '.input.json'; + var alreadyExists = false; + existingErrors = existingErrors.filter(function (existingName) { + if (existingName === filename) { + alreadyExists = true; + return false; + } + return true; + }); + if (alreadyExists) { + var actualTokens = parse(lex(fs.readFileSync(__dirname + '/errors-src/' + name + '.pug', 'utf8'))); + try { + var expectedTokens = JSON.parse(fs.readFileSync(__dirname + '/errors/' + filename, 'utf8')); + assert.deepEqual(actualTokens, expectedTokens); + } catch (ex) { + console.log('update: ' + filename); + fs.writeFileSync(__dirname + '/errors/' + filename, JSON.stringify(actualTokens, null, ' ')); + } + var actual = getError(actualTokens, filename); + try { + var expected = JSON.parse(fs.readFileSync(__dirname + '/errors/' + name + '.expected.json', 'utf8')); + assert.deepEqual(actual, expected); + } catch (ex) { + console.log('update: ' + name + '.expected.json'); + fs.writeFileSync(__dirname + '/errors/' + name + '.expected.json', JSON.stringify(actual, null, ' ')); + } + } else { + console.log('create: ' + filename); + var ast = parse(lex(fs.readFileSync(__dirname + '/errors-src/' + name + '.pug', 'utf8'))); + fs.writeFileSync(__dirname + '/errors/' + filename, JSON.stringify(ast, null, 2)); + console.log('create: ' + name + '.expected.json'); + var actual = getError(ast, filename); + fs.writeFileSync(__dirname + '/errors/' + name + '.expected.json', JSON.stringify(actual, null, ' ')); + } + }); + console.log('test cases updated'); +}); + +function getLoadedAst(str) { + return load(JSON.parse(str), { + lex: function () { + throw new Error('The lexer should not be used'); + }, + parse: function () { + throw new Error('The parser should not be used'); + }, + resolve: function (filename, source, options) { + return 'test/cases/' + filename.trim(); + } + }); +} diff --git a/node_modules/pug-lexer/History.md b/node_modules/pug-lexer/History.md new file mode 100644 index 0000000..f27a44a --- /dev/null +++ b/node_modules/pug-lexer/History.md @@ -0,0 +1,66 @@ +2.3.0 / 2016-09-11 +================== + + * Update is-expression to 3.0.0 + +2.2.2 / 2016-09-07 +================== + + * Support non-standard class names that start with two hyphens in class + literals, most notably used in Bemto + +2.2.1 / 2016-08-29 +================== + + * Fix semantics of `isExpression` plugin + +2.2.0 / 2016-08-26 +================== + + * Allow customizing `isExpression` + +2.1.0 / 2016-08-22 +================== + + * Allow attributes that start with a colon + +2.0.3 / 2016-08-07 +================== + + * Allow `when` expressions with colons + * Fix incorrect location of some errors + +2.0.2 / 2016-06-02 +================== + + * Fix incorrect location of some invalid expressions in an attribute. + +2.0.1 / 2016-05-31 +================== + + * Update README for `filename` option + +2.0.0 / 2016-05-14 +================== + + * Take the `filename` as an option rather than special casing it. This means that lex only takes 2 arguments rather than 3 + * Add support for an inline comment after a block. This means block names can no longer contain `//` + * Add type checking on arguments + +1.2.0 / 2016-05-14 +================== + + * Throw a more helpful error if someone attempts to use the old `- each foo in bar` syntax (it should not have the `- ` prefix) + * Add Error reporting for invalid case expressions + +1.0.1 / 2016-04-18 +================== + + * Update dependencies + - Update to `is-expression@2` which allows ES2015-style template strings + by default. + +1.0.0 / 2015-12-23 +================== + + * First stable release diff --git a/node_modules/pug-lexer/LICENSE b/node_modules/pug-lexer/LICENSE new file mode 100644 index 0000000..27cc9f3 --- /dev/null +++ b/node_modules/pug-lexer/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 Forbes Lindesay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/pug-lexer/README.md b/node_modules/pug-lexer/README.md new file mode 100644 index 0000000..4363fa0 --- /dev/null +++ b/node_modules/pug-lexer/README.md @@ -0,0 +1,72 @@ +# pug-lexer + +The pug lexer. This module is responsible for taking a string and converting it into an array of tokens. + +[![Build Status](https://img.shields.io/travis/pugjs/pug-lexer/master.svg)](https://travis-ci.org/pugjs/pug-lexer) +[![Dependency Status](https://img.shields.io/david/pugjs/pug-lexer.svg)](https://david-dm.org/pugjs/pug-lexer) +[![NPM version](https://img.shields.io/npm/v/pug-lexer.svg)](https://www.npmjs.org/package/pug-lexer) +[![Coverage Status](https://img.shields.io/codecov/c/github/pugjs/pug-lexer.svg)](https://codecov.io/gh/pugjs/pug-lexer) + +## Installation + + npm install pug-lexer + +## Usage + +```js +var lex = require('pug-lexer'); +``` + +### `lex(str, options)` + +Convert Pug string to an array of tokens. + +`options` can contain the following properties: + +- `filename` (string): The name of the Pug file; it is used in error handling if provided. +- `plugins` (array): An array of plugins, in the order they should be applied. + +```js +console.log(JSON.stringify(lex('div(data-foo="bar")', {filename: 'my-file.pug'}), null, ' ')) +``` + +```json +[ + { + "type": "tag", + "line": 1, + "val": "div", + "selfClosing": false + }, + { + "type": "attrs", + "line": 1, + "attrs": [ + { + "name": "data-foo", + "val": "\"bar\"", + "escaped": true + } + ] + }, + { + "type": "eos", + "line": 1 + } +] +``` + +### `new lex.Lexer(str, options)` + +Constructor for a Lexer class. This is not meant to be used directly unless you know what you are doing. + +`options` may contain the following properties: + +- `filename` (string): The name of the Pug file; it is used in error handling if provided. +- `interpolated` (boolean): if the Lexer is created as a child lexer for inline tag interpolation (e.g. `#[p Hello]`). Defaults to `false`. +- `startingLine` (integer): the real line number of the first line in the input. It is also used for inline tag interpolation. Defaults to `1`. +- `plugins` (array): An array of plugins, in the order they should be applied. + +## License + + MIT diff --git a/node_modules/pug-lexer/index.js b/node_modules/pug-lexer/index.js new file mode 100644 index 0000000..f901332 --- /dev/null +++ b/node_modules/pug-lexer/index.js @@ -0,0 +1,1379 @@ +'use strict'; + +var assert = require('assert'); +var isExpression = require('is-expression'); +var characterParser = require('character-parser'); +var error = require('pug-error'); + +module.exports = lex; +module.exports.Lexer = Lexer; +function lex(str, options) { + var lexer = new Lexer(str, options); + return JSON.parse(JSON.stringify(lexer.getTokens())); +} + +/** + * Initialize `Lexer` with the given `str`. + * + * @param {String} str + * @param {String} filename + * @api private + */ + +function Lexer(str, options) { + options = options || {}; + if (typeof str !== 'string') { + throw new Error('Expected source code to be a string but got "' + (typeof str) + '"') + } + if (typeof options !== 'object') { + throw new Error('Expected "options" to be an object but got "' + (typeof options) + '"') + } + //Strip any UTF-8 BOM off of the start of `str`, if it exists. + str = str.replace(/^\uFEFF/, ''); + this.input = str.replace(/\r\n|\r/g, '\n'); + this.originalInput = this.input; + this.filename = options.filename; + this.interpolated = options.interpolated || false; + this.lineno = options.startingLine || 1; + this.colno = options.startingColumn || 1; + this.plugins = options.plugins || []; + this.indentStack = [0]; + this.indentRe = null; + // If #{}, !{} or #[] syntax is allowed when adding text + this.interpolationAllowed = true; + + this.tokens = []; + this.ended = false; +}; + +/** + * Lexer prototype. + */ + +Lexer.prototype = { + + constructor: Lexer, + + error: function (code, message) { + var err = error(code, message, {line: this.lineno, column: this.colno, filename: this.filename, src: this.originalInput}); + throw err; + }, + + assert: function (value, message) { + if (!value) this.error('ASSERT_FAILED', message); + }, + + isExpression: function (exp) { + return isExpression(exp, { + throw: true + }); + }, + + assertExpression: function (exp, noThrow) { + //this verifies that a JavaScript expression is valid + try { + this.callLexerFunction('isExpression', exp); + return true; + } catch (ex) { + if (noThrow) return false; + + // not coming from acorn + if (!ex.loc) throw ex; + + this.incrementLine(ex.loc.line - 1); + this.incrementColumn(ex.loc.column); + var msg = 'Syntax Error: ' + ex.message.replace(/ \([0-9]+:[0-9]+\)$/, ''); + this.error('SYNTAX_ERROR', msg); + } + }, + + assertNestingCorrect: function (exp) { + //this verifies that code is properly nested, but allows + //invalid JavaScript such as the contents of `attributes` + var res = characterParser(exp) + if (res.isNesting()) { + this.error('INCORRECT_NESTING', 'Nesting must match on expression `' + exp + '`') + } + }, + + /** + * Construct a token with the given `type` and `val`. + * + * @param {String} type + * @param {String} val + * @return {Object} + * @api private + */ + + tok: function(type, val){ + var res = {type: type, line: this.lineno, col: this.colno}; + + if (val !== undefined) res.val = val; + + return res; + }, + + /** + * Increment `this.lineno` and reset `this.colno`. + * + * @param {Number} increment + * @api private + */ + + incrementLine: function(increment){ + this.lineno += increment; + if (increment) this.colno = 1; + }, + + /** + * Increment `this.colno`. + * + * @param {Number} increment + * @api private + */ + + incrementColumn: function(increment){ + this.colno += increment + }, + + /** + * Consume the given `len` of input. + * + * @param {Number} len + * @api private + */ + + consume: function(len){ + this.input = this.input.substr(len); + }, + + /** + * Scan for `type` with the given `regexp`. + * + * @param {String} type + * @param {RegExp} regexp + * @return {Object} + * @api private + */ + + scan: function(regexp, type){ + var captures; + if (captures = regexp.exec(this.input)) { + var len = captures[0].length; + var val = captures[1]; + var diff = len - (val ? val.length : 0); + var tok = this.tok(type, val); + this.consume(len); + this.incrementColumn(diff); + return tok; + } + }, + scanEndOfLine: function (regexp, type) { + var captures; + if (captures = regexp.exec(this.input)) { + var whitespaceLength = 0; + var whitespace; + var tok; + if (whitespace = /^([ ]+)([^ ]*)/.exec(captures[0])) { + whitespaceLength = whitespace[1].length; + this.incrementColumn(whitespaceLength); + } + var newInput = this.input.substr(captures[0].length); + if (newInput[0] === ':') { + this.input = newInput; + tok = this.tok(type, captures[1]); + this.incrementColumn(captures[0].length - whitespaceLength); + return tok; + } + if (/^[ \t]*(\n|$)/.test(newInput)) { + this.input = newInput.substr(/^[ \t]*/.exec(newInput)[0].length); + tok = this.tok(type, captures[1]); + this.incrementColumn(captures[0].length - whitespaceLength); + return tok; + } + } + }, + + /** + * Return the indexOf `(` or `{` or `[` / `)` or `}` or `]` delimiters. + * + * Make sure that when calling this function, colno is at the character + * immediately before the beginning. + * + * @return {Number} + * @api private + */ + + bracketExpression: function(skip){ + skip = skip || 0; + var start = this.input[skip]; + assert(start === '(' || start === '{' || start === '[', + 'The start character should be "(", "{" or "["'); + var end = characterParser.BRACKETS[start]; + var range; + try { + range = characterParser.parseUntil(this.input, end, {start: skip + 1}); + } catch (ex) { + if (ex.index !== undefined) { + var idx = ex.index; + // starting from this.input[skip] + var tmp = this.input.substr(skip).indexOf('\n'); + // starting from this.input[0] + var nextNewline = tmp + skip; + var ptr = 0; + while (idx > nextNewline && tmp !== -1) { + this.incrementLine(1); + idx -= nextNewline + 1; + ptr += nextNewline + 1; + tmp = nextNewline = this.input.substr(ptr).indexOf('\n'); + }; + + this.incrementColumn(idx); + } + if (ex.code === 'CHARACTER_PARSER:END_OF_STRING_REACHED') { + this.error('NO_END_BRACKET', 'The end of the string reached with no closing bracket ' + end + ' found.'); + } else if (ex.code === 'CHARACTER_PARSER:MISMATCHED_BRACKET') { + this.error('BRACKET_MISMATCH', ex.message); + } + throw ex; + } + return range; + }, + + scanIndentation: function() { + var captures, re; + + // established regexp + if (this.indentRe) { + captures = this.indentRe.exec(this.input); + // determine regexp + } else { + // tabs + re = /^\n(\t*) */; + captures = re.exec(this.input); + + // spaces + if (captures && !captures[1].length) { + re = /^\n( *)/; + captures = re.exec(this.input); + } + + // established + if (captures && captures[1].length) this.indentRe = re; + } + + return captures; + }, + + /** + * end-of-source. + */ + + eos: function() { + if (this.input.length) return; + if (this.interpolated) { + this.error('NO_END_BRACKET', 'End of line was reached with no closing bracket for interpolation.'); + } + for (var i = 0; this.indentStack[i]; i++) { + this.tokens.push(this.tok('outdent')); + } + this.tokens.push(this.tok('eos')); + this.ended = true; + return true; + }, + + /** + * Blank line. + */ + + blank: function() { + var captures; + if (captures = /^\n[ \t]*\n/.exec(this.input)) { + this.consume(captures[0].length - 1); + this.incrementLine(1); + return true; + } + }, + + /** + * Comment. + */ + + comment: function() { + var captures; + if (captures = /^\/\/(-)?([^\n]*)/.exec(this.input)) { + this.consume(captures[0].length); + var tok = this.tok('comment', captures[2]); + tok.buffer = '-' != captures[1]; + this.interpolationAllowed = tok.buffer; + this.tokens.push(tok); + this.incrementColumn(captures[0].length); + this.callLexerFunction('pipelessText'); + return true; + } + }, + + /** + * Interpolated tag. + */ + + interpolation: function() { + if (/^#\{/.test(this.input)) { + var match = this.bracketExpression(1); + this.consume(match.end + 1); + var tok = this.tok('interpolation', match.src); + this.tokens.push(tok); + this.incrementColumn(2); // '#{' + this.assertExpression(match.src); + + var splitted = match.src.split('\n'); + var lines = splitted.length - 1; + this.incrementLine(lines); + this.incrementColumn(splitted[lines].length + 1); // + 1 → '}' + return true; + } + }, + + /** + * Tag. + */ + + tag: function() { + var captures; + + if (captures = /^(\w(?:[-:\w]*\w)?)/.exec(this.input)) { + var tok, name = captures[1], len = captures[0].length; + this.consume(len); + tok = this.tok('tag', name); + this.tokens.push(tok); + this.incrementColumn(len); + return true; + } + }, + + /** + * Filter. + */ + + filter: function(opts) { + var tok = this.scan(/^:([\w\-]+)/, 'filter'); + var inInclude = opts && opts.inInclude; + if (tok) { + this.tokens.push(tok); + this.incrementColumn(tok.val.length); + this.callLexerFunction('attrs'); + if (!inInclude) { + this.interpolationAllowed = false; + this.callLexerFunction('pipelessText'); + } + return true; + } + }, + + /** + * Doctype. + */ + + doctype: function() { + var node = this.scanEndOfLine(/^doctype *([^\n]*)/, 'doctype'); + if (node) { + this.tokens.push(node); + return true; + } + }, + + /** + * Id. + */ + + id: function() { + var tok = this.scan(/^#([\w-]+)/, 'id'); + if (tok) { + this.tokens.push(tok); + this.incrementColumn(tok.val.length); + return true; + } + if (/^#/.test(this.input)) { + this.error('INVALID_ID', '"' + /.[^ \t\(\#\.\:]*/.exec(this.input.substr(1))[0] + '" is not a valid ID.'); + } + }, + + /** + * Class. + */ + + className: function() { + var tok = this.scan(/^\.(-?-?[_a-z][_a-z0-9\-]*)/i, 'class'); + if (tok) { + this.tokens.push(tok); + this.incrementColumn(tok.val.length); + return true; + } + if (/^\.\-/i.test(this.input)) { + this.error('INVALID_CLASS_NAME', 'If a class name begins with a "-" or "--", it must be followed by a letter or underscore.'); + } + if (/^\.[0-9]/i.test(this.input)) { + this.error('INVALID_CLASS_NAME', 'Class names must begin with "-", "_" or a letter.'); + } + if (/^\./.test(this.input)) { + this.error('INVALID_CLASS_NAME', '"' + /.[^ \t\(\#\.\:]*/.exec(this.input.substr(1))[0] + '" is not a valid class name. Class names must begin with "-", "_" or a letter and can only contain "_", "-", a-z and 0-9.'); + } + }, + + /** + * Text. + */ + endInterpolation: function () { + if (this.interpolated && this.input[0] === ']') { + this.input = this.input.substr(1); + this.ended = true; + return true; + } + }, + addText: function (type, value, prefix, escaped) { + if (value + prefix === '') return; + prefix = prefix || ''; + var indexOfEnd = this.interpolated ? value.indexOf(']') : -1; + var indexOfStart = this.interpolationAllowed ? value.indexOf('#[') : -1; + var indexOfEscaped = this.interpolationAllowed ? value.indexOf('\\#[') : -1; + var matchOfStringInterp = /(\\)?([#!]){((?:.|\n)*)$/.exec(value); + var indexOfStringInterp = this.interpolationAllowed && matchOfStringInterp ? matchOfStringInterp.index : Infinity; + + if (indexOfEnd === -1) indexOfEnd = Infinity; + if (indexOfStart === -1) indexOfStart = Infinity; + if (indexOfEscaped === -1) indexOfEscaped = Infinity; + + if (indexOfEscaped !== Infinity && indexOfEscaped < indexOfEnd && indexOfEscaped < indexOfStart && indexOfEscaped < indexOfStringInterp) { + prefix = prefix + value.substring(0, indexOfEscaped) + '#['; + return this.addText(type, value.substring(indexOfEscaped + 3), prefix, true); + } + if (indexOfStart !== Infinity && indexOfStart < indexOfEnd && indexOfStart < indexOfEscaped && indexOfStart < indexOfStringInterp) { + this.tokens.push(this.tok(type, prefix + value.substring(0, indexOfStart))); + this.incrementColumn(prefix.length + indexOfStart); + if (escaped) this.incrementColumn(1); + this.tokens.push(this.tok('start-pug-interpolation')); + this.incrementColumn(2); + var child = new this.constructor(value.substr(indexOfStart + 2), { + filename: this.filename, + interpolated: true, + startingLine: this.lineno, + startingColumn: this.colno + }); + var interpolated; + try { + interpolated = child.getTokens(); + } catch (ex) { + if (ex.code && /^PUG:/.test(ex.code)) { + this.colno = ex.column; + this.error(ex.code.substr(4), ex.msg); + } + throw ex; + } + this.colno = child.colno; + this.tokens = this.tokens.concat(interpolated); + this.tokens.push(this.tok('end-pug-interpolation')); + this.incrementColumn(1); + this.addText(type, child.input); + return; + } + if (indexOfEnd !== Infinity && indexOfEnd < indexOfStart && indexOfEnd < indexOfEscaped && indexOfEnd < indexOfStringInterp) { + if (prefix + value.substring(0, indexOfEnd)) { + this.addText(type, value.substring(0, indexOfEnd), prefix); + } + this.ended = true; + this.input = value.substr(value.indexOf(']') + 1) + this.input; + return; + } + if (indexOfStringInterp !== Infinity) { + if (matchOfStringInterp[1]) { + prefix = prefix + value.substring(0, indexOfStringInterp) + '#{'; + return this.addText(type, value.substring(indexOfStringInterp + 3), prefix); + } + var before = value.substr(0, indexOfStringInterp); + if (prefix || before) { + before = prefix + before; + this.tokens.push(this.tok(type, before)); + this.incrementColumn(before.length); + } + + var rest = matchOfStringInterp[3]; + var range; + var tok = this.tok('interpolated-code'); + this.incrementColumn(2); + try { + range = characterParser.parseUntil(rest, '}'); + } catch (ex) { + if (ex.index !== undefined) { + this.incrementColumn(ex.index); + } + if (ex.code === 'CHARACTER_PARSER:END_OF_STRING_REACHED') { + this.error('NO_END_BRACKET', 'End of line was reached with no closing bracket for interpolation.'); + } else if (ex.code === 'CHARACTER_PARSER:MISMATCHED_BRACKET') { + this.error('BRACKET_MISMATCH', ex.message); + } else { + throw ex; + } + } + tok.mustEscape = matchOfStringInterp[2] === '#'; + tok.buffer = true; + tok.val = range.src; + this.assertExpression(range.src); + this.tokens.push(tok); + + if (range.end + 1 < rest.length) { + rest = rest.substr(range.end + 1); + this.incrementColumn(range.end + 1); + this.addText(type, rest); + } else { + this.incrementColumn(rest.length); + } + return; + } + + value = prefix + value; + this.tokens.push(this.tok(type, value)); + this.incrementColumn(value.length); + }, + + text: function() { + var tok = this.scan(/^(?:\| ?| )([^\n]+)/, 'text') || + this.scan(/^( )/, 'text') || + this.scan(/^\|( ?)/, 'text'); + if (tok) { + this.addText('text', tok.val); + return true; + } + }, + + textHtml: function () { + var tok = this.scan(/^(<[^\n]*)/, 'text-html'); + if (tok) { + this.addText('text-html', tok.val); + return true; + } + }, + + /** + * Dot. + */ + + dot: function() { + var tok; + if (tok = this.scanEndOfLine(/^\./, 'dot')) { + this.tokens.push(tok); + this.callLexerFunction('pipelessText'); + return true; + } + }, + + /** + * Extends. + */ + + "extends": function() { + var tok = this.scan(/^extends?(?= |$|\n)/, 'extends'); + if (tok) { + this.tokens.push(tok); + if (!this.callLexerFunction('path')) { + this.error('NO_EXTENDS_PATH', 'missing path for extends'); + } + return true; + } + if (this.scan(/^extends?\b/)) { + this.error('MALFORMED_EXTENDS', 'malformed extends'); + } + }, + + /** + * Block prepend. + */ + + prepend: function() { + var captures; + if (captures = /^(?:block +)?prepend +([^\n]+)/.exec(this.input)) { + var name = captures[1].trim(); + var comment = ''; + if (name.indexOf('//') !== -1) { + comment = '//' + name.split('//').slice(1).join('//'); + name = name.split('//')[0].trim(); + } + if (!name) return; + this.consume(captures[0].length - comment.length); + var tok = this.tok('block', name); + tok.mode = 'prepend'; + this.tokens.push(tok); + return true; + } + }, + + /** + * Block append. + */ + + append: function() { + var captures; + if (captures = /^(?:block +)?append +([^\n]+)/.exec(this.input)) { + var name = captures[1].trim(); + var comment = ''; + if (name.indexOf('//') !== -1) { + comment = '//' + name.split('//').slice(1).join('//'); + name = name.split('//')[0].trim(); + } + if (!name) return; + this.consume(captures[0].length - comment.length); + var tok = this.tok('block', name); + tok.mode = 'append'; + this.tokens.push(tok); + return true; + } + }, + + /** + * Block. + */ + + block: function() { + var captures; + if (captures = /^block +([^\n]+)/.exec(this.input)) { + var name = captures[1].trim(); + var comment = ''; + if (name.indexOf('//') !== -1) { + comment = '//' + name.split('//').slice(1).join('//'); + name = name.split('//')[0].trim(); + } + if (!name) return; + this.consume(captures[0].length - comment.length); + var tok = this.tok('block', name); + tok.mode = 'replace'; + this.tokens.push(tok); + return true; + } + }, + + /** + * Mixin Block. + */ + + mixinBlock: function() { + var tok; + if (tok = this.scanEndOfLine(/^block/, 'mixin-block')) { + this.tokens.push(tok); + return true; + } + }, + + /** + * Yield. + */ + + 'yield': function() { + var tok = this.scanEndOfLine(/^yield/, 'yield'); + if (tok) { + this.tokens.push(tok); + return true; + } + }, + + /** + * Include. + */ + + include: function() { + var tok = this.scan(/^include(?=:| |$|\n)/, 'include'); + if (tok) { + this.tokens.push(tok); + while (this.callLexerFunction('filter', { inInclude: true })); + if (!this.callLexerFunction('path')) { + if (/^[^ \n]+/.test(this.input)) { + // if there is more text + this.fail(); + } else { + // if not + this.error('NO_INCLUDE_PATH', 'missing path for include'); + } + } + return true; + } + if (this.scan(/^include\b/)) { + this.error('MALFORMED_INCLUDE', 'malformed include'); + } + }, + + /** + * Path + */ + + path: function() { + var tok = this.scanEndOfLine(/^ ([^\n]+)/, 'path'); + if (tok && (tok.val = tok.val.trim())) { + this.tokens.push(tok); + return true; + } + }, + + /** + * Case. + */ + + "case": function() { + var tok = this.scanEndOfLine(/^case +([^\n]+)/, 'case'); + if (tok) { + this.incrementColumn(-tok.val.length); + this.assertExpression(tok.val); + this.incrementColumn(tok.val.length); + this.tokens.push(tok); + return true; + } + if (this.scan(/^case\b/)) { + this.error('NO_CASE_EXPRESSION', 'missing expression for case'); + } + }, + + /** + * When. + */ + + when: function() { + var tok = this.scanEndOfLine(/^when +([^:\n]+)/, 'when'); + if (tok) { + var parser = characterParser(tok.val); + while (parser.isNesting() || parser.isString()) { + var rest = /:([^:\n]+)/.exec(this.input); + if (!rest) break; + + tok.val += rest[0]; + this.consume(rest[0].length); + this.incrementColumn(rest[0].length); + parser = characterParser(tok.val); + } + + this.incrementColumn(-tok.val.length); + this.assertExpression(tok.val); + this.incrementColumn(tok.val.length); + this.tokens.push(tok); + return true; + } + if (this.scan(/^when\b/)) { + this.error('NO_WHEN_EXPRESSION', 'missing expression for when'); + } + }, + + /** + * Default. + */ + + "default": function() { + var tok = this.scanEndOfLine(/^default/, 'default'); + if (tok) { + this.tokens.push(tok); + return true; + } + if (this.scan(/^default\b/)) { + this.error('DEFAULT_WITH_EXPRESSION', 'default should not have an expression'); + } + }, + + /** + * Call mixin. + */ + + call: function(){ + + var tok, captures, increment; + if (captures = /^\+(\s*)(([-\w]+)|(#\{))/.exec(this.input)) { + // try to consume simple or interpolated call + if (captures[3]) { + // simple call + increment = captures[0].length; + this.consume(increment); + tok = this.tok('call', captures[3]); + } else { + // interpolated call + var match = this.bracketExpression(2 + captures[1].length); + increment = match.end + 1; + this.consume(increment); + this.assertExpression(match.src); + tok = this.tok('call', '#{'+match.src+'}'); + } + + this.incrementColumn(increment); + + tok.args = null; + // Check for args (not attributes) + if (captures = /^ *\(/.exec(this.input)) { + var range = this.bracketExpression(captures[0].length - 1); + if (!/^\s*[-\w]+ *=/.test(range.src)) { // not attributes + this.incrementColumn(1); + this.consume(range.end + 1); + tok.args = range.src; + this.assertExpression('[' + tok.args + ']'); + for (var i = 0; i <= tok.args.length; i++) { + if (tok.args[i] === '\n') { + this.incrementLine(1); + } else { + this.incrementColumn(1); + } + } + } + } + this.tokens.push(tok); + return true; + } + }, + + /** + * Mixin. + */ + + mixin: function(){ + var captures; + if (captures = /^mixin +([-\w]+)(?: *\((.*)\))? */.exec(this.input)) { + this.consume(captures[0].length); + var tok = this.tok('mixin', captures[1]); + tok.args = captures[2] || null; + this.tokens.push(tok); + return true; + } + }, + + /** + * Conditional. + */ + + conditional: function() { + var captures; + if (captures = /^(if|unless|else if|else)\b([^\n]*)/.exec(this.input)) { + this.consume(captures[0].length); + var type = captures[1].replace(/ /g, '-'); + var js = captures[2] && captures[2].trim(); + // type can be "if", "else-if" and "else" + var tok = this.tok(type, js); + this.incrementColumn(captures[0].length - js.length); + + switch (type) { + case 'if': + case 'else-if': + this.assertExpression(js); + break; + case 'unless': + this.assertExpression(js); + tok.val = '!(' + js + ')'; + tok.type = 'if'; + break; + case 'else': + if (js) { + this.error( + 'ELSE_CONDITION', + '`else` cannot have a condition, perhaps you meant `else if`' + ); + } + break; + } + this.tokens.push(tok); + return true; + } + }, + + /** + * While. + */ + + "while": function() { + var captures; + if (captures = /^while +([^\n]+)/.exec(this.input)) { + this.consume(captures[0].length); + this.assertExpression(captures[1]) + this.tokens.push(this.tok('while', captures[1])); + return true; + } + if (this.scan(/^while\b/)) { + this.error('NO_WHILE_EXPRESSION', 'missing expression for while'); + } + }, + + /** + * Each. + */ + + each: function() { + var captures; + if (captures = /^(?:each|for) +([a-zA-Z_$][\w$]*)(?: *, *([a-zA-Z_$][\w$]*))? * in *([^\n]+)/.exec(this.input)) { + this.consume(captures[0].length); + var tok = this.tok('each', captures[1]); + tok.key = captures[2] || null; + this.incrementColumn(captures[0].length - captures[3].length); + this.assertExpression(captures[3]) + tok.code = captures[3]; + this.incrementColumn(captures[3].length); + this.tokens.push(tok); + return true; + } + if (this.scan(/^(?:each|for)\b/)) { + this.error('MALFORMED_EACH', 'malformed each'); + } + if (captures = /^- *(?:each|for) +([a-zA-Z_$][\w$]*)(?: *, *([a-zA-Z_$][\w$]*))? +in +([^\n]+)/.exec(this.input)) { + this.error( + 'MALFORMED_EACH', + 'Pug each and for should no longer be prefixed with a dash ("-"). They are pug keywords and not part of JavaScript.' + ); + } + }, + + /** + * Code. + */ + + code: function() { + var captures; + if (captures = /^(!?=|-)[ \t]*([^\n]+)/.exec(this.input)) { + var flags = captures[1]; + var code = captures[2]; + var shortened = 0; + if (this.interpolated) { + var parsed; + try { + parsed = characterParser.parseUntil(code, ']'); + } catch (err) { + if (err.index !== undefined) { + this.incrementColumn(captures[0].length - code.length + err.index); + } + if (err.code === 'CHARACTER_PARSER:END_OF_STRING_REACHED') { + this.error('NO_END_BRACKET', 'End of line was reached with no closing bracket for interpolation.'); + } else if (err.code === 'CHARACTER_PARSER:MISMATCHED_BRACKET') { + this.error('BRACKET_MISMATCH', err.message); + } else { + throw err; + } + } + shortened = code.length - parsed.end; + code = parsed.src; + } + var consumed = captures[0].length - shortened; + this.consume(consumed); + var tok = this.tok('code', code); + tok.mustEscape = flags.charAt(0) === '='; + tok.buffer = flags.charAt(0) === '=' || flags.charAt(1) === '='; + + // p #[!= abc] hey + // ^ original colno + // -------------- captures[0] + // -------- captures[2] + // ------ captures[0] - captures[2] + // ^ after colno + + // = abc + // ^ original colno + // ------- captures[0] + // --- captures[2] + // ---- captures[0] - captures[2] + // ^ after colno + this.incrementColumn(captures[0].length - captures[2].length); + if (tok.buffer) this.assertExpression(code); + this.tokens.push(tok); + + // p #[!= abc] hey + // ^ original colno + // ----- shortened + // --- code + // ^ after colno + + // = abc + // ^ original colno + // shortened + // --- code + // ^ after colno + this.incrementColumn(code.length); + return true; + } + }, + + /** + * Block code. + */ + blockCode: function() { + var tok + if (tok = this.scanEndOfLine(/^-/, 'blockcode')) { + this.tokens.push(tok); + this.interpolationAllowed = false; + this.callLexerFunction('pipelessText'); + return true; + } + }, + + /** + * Attributes. + */ + + attrs: function() { + if ('(' == this.input.charAt(0)) { + var startingLine = this.lineno; + this.tokens.push(this.tok('start-attributes')); + var index = this.bracketExpression().end + , str = this.input.substr(1, index-1); + + this.incrementColumn(1); + this.assertNestingCorrect(str); + + var quote = ''; + var self = this; + + this.consume(index + 1); + + var whitespaceRe = /[ \n\t]/; + var quoteRe = /['"]/; + + var escapedAttr = true + var key = ''; + var val = ''; + var state = characterParser.defaultState(); + var lineno = startingLine; + var colnoBeginAttr = this.colno; + var colnoBeginVal; + var loc = 'key'; + var isEndOfAttribute = function (i) { + // if the key is not started, then the attribute cannot be ended + if (key.trim() === '') { + colnoBeginAttr = this.colno; + return false; + } + // if there's nothing more then the attribute must be ended + if (i === str.length) return true; + + if (loc === 'key') { + if (whitespaceRe.test(str[i])) { + // find the first non-whitespace character + for (var x = i; x < str.length; x++) { + if (!whitespaceRe.test(str[x])) { + // starts a `value` + if (str[x] === '=' || str[x] === '!') return false; + // will be handled when x === i + else if (str[x] === ',') return false; + // attribute ended + else return true; + } + } + } + // if there's no whitespace and the character is not ',', the + // attribute did not end. + return str[i] === ','; + } else if (loc === 'value') { + // if the character is in a string or in parentheses/brackets/braces + if (state.isNesting() || state.isString()) return false; + + // if the current value expression is not valid JavaScript, then + // assume that the user did not end the value. To enforce this, + // we call `self.assertExpression(val, true)`, but since the other + // tests are much faster, we run the other tests first. + + if (whitespaceRe.test(str[i])) { + // find the first non-whitespace character + for (var x = i; x < str.length; x++) { + if (!whitespaceRe.test(str[x])) { + // if it is a JavaScript punctuator, then assume that it is + // a part of the value + return (!characterParser.isPunctuator(str[x]) || quoteRe.test(str[x]) || str[x] === ':') && self.assertExpression(val, true); + } + } + } + // if there's no whitespace and the character is not ',', the + // attribute did not end. + return str[i] === ',' && self.assertExpression(val, true); + } + } + + for (var i = 0; i <= str.length; i++) { + if (isEndOfAttribute.call(this, i)) { + if (val.trim()) { + var saved = this.colno; + this.colno = colnoBeginVal; + this.assertExpression(val); + this.colno = saved; + } + + val = val.trim(); + + key = key.trim(); + key = key.replace(/^['"]|['"]$/g, ''); + + var tok = this.tok('attribute'); + tok.name = key; + tok.val = '' == val ? true : val; + tok.col = colnoBeginAttr; + tok.mustEscape = escapedAttr; + this.tokens.push(tok); + + key = val = ''; + loc = 'key'; + escapedAttr = false; + this.lineno = lineno; + } else { + switch (loc) { + case 'key-char': + if (str[i] === quote) { + loc = 'key'; + if (i + 1 < str.length && !/[ ,!=\n\t]/.test(str[i + 1])) + this.error('INVALID_KEY_CHARACTER', 'Unexpected character "' + str[i + 1] + '" expected ` `, `\\n`, `\t`, `,`, `!` or `=`'); + } else { + key += str[i]; + } + break; + case 'key': + if (key === '' && quoteRe.test(str[i])) { + loc = 'key-char'; + quote = str[i]; + } else if (str[i] === '!' || str[i] === '=') { + escapedAttr = str[i] !== '!'; + if (str[i] === '!') { + this.incrementColumn(1); + i++; + } + if (str[i] !== '=') this.error('INVALID_KEY_CHARACTER', 'Unexpected character ' + str[i] + ' expected `=`'); + loc = 'value'; + colnoBeginVal = this.colno + 1; + state = characterParser.defaultState(); + } else { + key += str[i] + } + break; + case 'value': + state = characterParser.parseChar(str[i], state); + val += str[i]; + break; + } + } + if (str[i] === '\n') { + // Save the line number locally to keep this.lineno at the start of + // the attribute. + lineno++; + this.colno = 1; + // If the key has not been started, update this.lineno immediately. + if (!key.trim()) this.lineno = lineno; + } else if (str[i] !== undefined) { + this.incrementColumn(1); + } + } + + // Reset the line numbers based on the line started on + // plus the number of newline characters encountered + this.lineno = startingLine + (str.match(/\n/g) || []).length; + + this.tokens.push(this.tok('end-attributes')); + this.incrementColumn(1); + return true; + } + }, + + /** + * &attributes block + */ + attributesBlock: function () { + if (/^&attributes\b/.test(this.input)) { + var consumed = 11; + this.consume(consumed); + var tok = this.tok('&attributes'); + this.incrementColumn(consumed); + var args = this.bracketExpression(); + consumed = args.end + 1; + this.consume(consumed); + tok.val = args.src; + this.tokens.push(tok); + this.incrementColumn(consumed); + return true; + } + }, + + /** + * Indent | Outdent | Newline. + */ + + indent: function() { + var captures = this.scanIndentation(); + + if (captures) { + var indents = captures[1].length; + + this.incrementLine(1); + this.consume(indents + 1); + + if (' ' == this.input[0] || '\t' == this.input[0]) { + this.error('INVALID_INDENTATION', 'Invalid indentation, you can use tabs or spaces but not both'); + } + + // blank line + if ('\n' == this.input[0]) { + this.interpolationAllowed = true; + return this.tok('newline'); + } + + // outdent + if (indents < this.indentStack[0]) { + while (this.indentStack[0] > indents) { + if (this.indentStack[1] < indents) { + this.error('INCONSISTENT_INDENTATION', 'Inconsistent indentation. Expecting either ' + this.indentStack[1] + ' or ' + this.indentStack[0] + ' spaces/tabs.'); + } + this.colno = this.indentStack[1] + 1; + this.tokens.push(this.tok('outdent')); + this.indentStack.shift(); + } + // indent + } else if (indents && indents != this.indentStack[0]) { + this.tokens.push(this.tok('indent', indents)); + this.colno = 1 + indents; + this.indentStack.unshift(indents); + // newline + } else { + this.tokens.push(this.tok('newline')); + this.colno = 1 + (this.indentStack[0] || 0); + } + + this.interpolationAllowed = true; + return true; + } + }, + + pipelessText: function pipelessText(indents) { + while (this.callLexerFunction('blank')); + + var captures = this.scanIndentation(); + + indents = indents || captures && captures[1].length; + if (indents > this.indentStack[0]) { + this.tokens.push(this.tok('start-pipeless-text')); + var tokens = []; + var isMatch; + // Index in this.input. Can't use this.consume because we might need to + // retry lexing the block. + var stringPtr = 0; + do { + // text has `\n` as a prefix + var i = this.input.substr(stringPtr + 1).indexOf('\n'); + if (-1 == i) i = this.input.length - stringPtr - 1; + var str = this.input.substr(stringPtr + 1, i); + var lineCaptures = this.indentRe.exec('\n' + str); + var lineIndents = lineCaptures && lineCaptures[1].length; + isMatch = lineIndents >= indents || !str.trim(); + if (isMatch) { + // consume test along with `\n` prefix if match + stringPtr += str.length + 1; + tokens.push(str.substr(indents)); + } else if (lineIndents > this.indentStack[0]) { + // line is indented less than the first line but is still indented + // need to retry lexing the text block + this.tokens.pop(); + return pipelessText.call(this, lineCaptures[1].length); + } + } while((this.input.length - stringPtr) && isMatch); + this.consume(stringPtr); + while (this.input.length === 0 && tokens[tokens.length - 1] === '') tokens.pop(); + tokens.forEach(function (token, i) { + this.incrementLine(1); + if (i !== 0) this.tokens.push(this.tok('newline')); + this.incrementColumn(indents); + this.addText('text', token); + }.bind(this)); + this.tokens.push(this.tok('end-pipeless-text')); + return true; + } + }, + + /** + * Slash. + */ + + slash: function() { + var tok = this.scan(/^\//, 'slash'); + if (tok) { + this.tokens.push(tok); + return true; + } + }, + + /** + * ':' + */ + + colon: function() { + var tok = this.scan(/^: +/, ':'); + if (tok) { + this.tokens.push(tok); + return true; + } + }, + + fail: function () { + this.error('UNEXPECTED_TEXT', 'unexpected text "' + this.input.substr(0, 5) + '"'); + }, + + callLexerFunction: function (func) { + var rest = []; + for (var i = 1; i < arguments.length; i++) { + rest.push(arguments[i]); + } + var pluginArgs = [this].concat(rest); + for (var i = 0; i < this.plugins.length; i++) { + var plugin = this.plugins[i]; + if (plugin[func] && plugin[func].apply(plugin, pluginArgs)) { + return true; + } + } + return this[func].apply(this, rest); + }, + + /** + * Move to the next token + * + * @api private + */ + + advance: function() { + return this.callLexerFunction('blank') + || this.callLexerFunction('eos') + || this.callLexerFunction('endInterpolation') + || this.callLexerFunction('yield') + || this.callLexerFunction('doctype') + || this.callLexerFunction('interpolation') + || this.callLexerFunction('case') + || this.callLexerFunction('when') + || this.callLexerFunction('default') + || this.callLexerFunction('extends') + || this.callLexerFunction('append') + || this.callLexerFunction('prepend') + || this.callLexerFunction('block') + || this.callLexerFunction('mixinBlock') + || this.callLexerFunction('include') + || this.callLexerFunction('mixin') + || this.callLexerFunction('call') + || this.callLexerFunction('conditional') + || this.callLexerFunction('each') + || this.callLexerFunction('while') + || this.callLexerFunction('tag') + || this.callLexerFunction('filter') + || this.callLexerFunction('blockCode') + || this.callLexerFunction('code') + || this.callLexerFunction('id') + || this.callLexerFunction('dot') + || this.callLexerFunction('className') + || this.callLexerFunction('attrs') + || this.callLexerFunction('attributesBlock') + || this.callLexerFunction('indent') + || this.callLexerFunction('text') + || this.callLexerFunction('textHtml') + || this.callLexerFunction('comment') + || this.callLexerFunction('slash') + || this.callLexerFunction('colon') + || this.fail(); + }, + + /** + * Return an array of tokens for the current file + * + * @returns {Array.} + * @api public + */ + getTokens: function () { + while (!this.ended) { + this.callLexerFunction('advance'); + } + return this.tokens; + } +}; diff --git a/node_modules/pug-lexer/package.json b/node_modules/pug-lexer/package.json new file mode 100644 index 0000000..7e03008 --- /dev/null +++ b/node_modules/pug-lexer/package.json @@ -0,0 +1,53 @@ +{ + "_from": "pug-lexer@^3.0.0", + "_id": "pug-lexer@3.1.0", + "_inBundle": false, + "_integrity": "sha1-/QhzdtSmdbT1n4/vQiiDQ06VgaI=", + "_location": "/pug-lexer", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "pug-lexer@^3.0.0", + "name": "pug-lexer", + "escapedName": "pug-lexer", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/pug" + ], + "_resolved": "https://registry.npmjs.org/pug-lexer/-/pug-lexer-3.1.0.tgz", + "_shasum": "fd087376d4a675b4f59f8fef422883434e9581a2", + "_spec": "pug-lexer@^3.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/pug", + "author": { + "name": "ForbesLindesay" + }, + "bugs": { + "url": "https://github.com/pugjs/pug-lexer/issues" + }, + "bundleDependencies": false, + "dependencies": { + "character-parser": "^2.1.1", + "is-expression": "^3.0.0", + "pug-error": "^1.3.2" + }, + "deprecated": false, + "description": "The pug lexer (takes a string and converts it to an array of tokens)", + "devDependencies": { + "acorn": "^3.0.4" + }, + "homepage": "https://github.com/pugjs/pug-lexer#readme", + "keywords": [ + "pug" + ], + "license": "MIT", + "name": "pug-lexer", + "repository": { + "type": "git", + "url": "git+https://github.com/pugjs/pug-lexer.git" + }, + "version": "3.1.0" +} diff --git a/node_modules/pug-lexer/test/__snapshots__/index.test.js.snap b/node_modules/pug-lexer/test/__snapshots__/index.test.js.snap new file mode 100644 index 0000000..3c77b05 --- /dev/null +++ b/node_modules/pug-lexer/test/__snapshots__/index.test.js.snap @@ -0,0 +1,18710 @@ +exports[`test attr-es2015.pug 1`] = ` +Array [ + Object { + "buffer": false, + "col": 1, + "line": 1, + "mustEscape": false, + "type": "code", + "val": "var avatar = \'219b77f9d21de75e81851b6b886057c7\'", + }, + Object { + "col": 1, + "line": 3, + "type": "newline", + }, + Object { + "col": 1, + "line": 3, + "type": "tag", + "val": "div", + }, + Object { + "col": 4, + "line": 3, + "type": "class", + "val": "avatar-div", + }, + Object { + "col": 15, + "line": 3, + "type": "start-attributes", + }, + Object { + "col": 16, + "line": 3, + "mustEscape": true, + "name": "style", + "type": "attribute", + "val": "\`background-image: url(https://www.gravatar.com/avatar/\${avatar})\`", + }, + Object { + "col": 88, + "line": 3, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 4, + "type": "newline", + }, + Object { + "col": 1, + "line": 4, + "type": "eos", + }, +] +`; + +exports[`test attribute-invalid-expression.pug 1`] = ` +Object { + "code": "PUG:SYNTAX_ERROR", + "column": 5, + "line": 2, + "msg": "Syntax Error: Unterminated string constant", +} +`; + +exports[`test attrs.js.pug 1`] = ` +Array [ + Object { + "buffer": false, + "col": 1, + "line": 1, + "mustEscape": false, + "type": "code", + "val": "var id = 5", + }, + Object { + "col": 1, + "line": 2, + "type": "newline", + }, + Object { + "buffer": false, + "col": 1, + "line": 2, + "mustEscape": false, + "type": "code", + "val": "function answer() { return 42; }", + }, + Object { + "col": 1, + "line": 3, + "type": "newline", + }, + Object { + "col": 1, + "line": 3, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 3, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 3, + "mustEscape": true, + "name": "href", + "type": "attribute", + "val": "\'/user/\' + id", + }, + Object { + "col": 23, + "line": 3, + "mustEscape": true, + "name": "class", + "type": "attribute", + "val": "\'button\'", + }, + Object { + "col": 37, + "line": 3, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 4, + "type": "newline", + }, + Object { + "col": 1, + "line": 4, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 4, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 4, + "mustEscape": true, + "name": "href", + "type": "attribute", + "val": "\'/user/\' + id", + }, + Object { + "col": 27, + "line": 4, + "mustEscape": true, + "name": "class", + "type": "attribute", + "val": "\'button\'", + }, + Object { + "col": 45, + "line": 4, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 5, + "type": "newline", + }, + Object { + "col": 1, + "line": 5, + "type": "tag", + "val": "meta", + }, + Object { + "col": 5, + "line": 5, + "type": "start-attributes", + }, + Object { + "col": 6, + "line": 5, + "mustEscape": true, + "name": "key", + "type": "attribute", + "val": "\'answer\'", + }, + Object { + "col": 20, + "line": 5, + "mustEscape": true, + "name": "value", + "type": "attribute", + "val": "answer()", + }, + Object { + "col": 34, + "line": 5, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 6, + "type": "newline", + }, + Object { + "col": 1, + "line": 6, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 6, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 6, + "mustEscape": true, + "name": "class", + "type": "attribute", + "val": "[\'class1\', \'class2\']", + }, + Object { + "col": 31, + "line": 6, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 7, + "type": "newline", + }, + Object { + "col": 1, + "line": 7, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 7, + "type": "class", + "val": "tag-class", + }, + Object { + "col": 12, + "line": 7, + "type": "start-attributes", + }, + Object { + "col": 13, + "line": 7, + "mustEscape": true, + "name": "class", + "type": "attribute", + "val": "[\'class1\', \'class2\']", + }, + Object { + "col": 41, + "line": 7, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 9, + "type": "newline", + }, + Object { + "col": 1, + "line": 9, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 9, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 9, + "mustEscape": true, + "name": "href", + "type": "attribute", + "val": "\'/user/\' + id", + }, + Object { + "col": 22, + "line": 9, + "mustEscape": true, + "name": "class", + "type": "attribute", + "val": "\'button\'", + }, + Object { + "col": 36, + "line": 9, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 10, + "type": "newline", + }, + Object { + "col": 1, + "line": 10, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 10, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 10, + "mustEscape": true, + "name": "href", + "type": "attribute", + "val": "\'/user/\' + id", + }, + Object { + "col": 26, + "line": 10, + "mustEscape": true, + "name": "class", + "type": "attribute", + "val": "\'button\'", + }, + Object { + "col": 44, + "line": 10, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 11, + "type": "newline", + }, + Object { + "col": 1, + "line": 11, + "type": "tag", + "val": "meta", + }, + Object { + "col": 5, + "line": 11, + "type": "start-attributes", + }, + Object { + "col": 6, + "line": 11, + "mustEscape": true, + "name": "key", + "type": "attribute", + "val": "\'answer\'", + }, + Object { + "col": 19, + "line": 11, + "mustEscape": true, + "name": "value", + "type": "attribute", + "val": "answer()", + }, + Object { + "col": 33, + "line": 11, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 12, + "type": "newline", + }, + Object { + "col": 1, + "line": 12, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 12, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 12, + "mustEscape": true, + "name": "class", + "type": "attribute", + "val": "[\'class1\', \'class2\']", + }, + Object { + "col": 31, + "line": 12, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 13, + "type": "newline", + }, + Object { + "col": 1, + "line": 13, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 13, + "type": "class", + "val": "tag-class", + }, + Object { + "col": 12, + "line": 13, + "type": "start-attributes", + }, + Object { + "col": 13, + "line": 13, + "mustEscape": true, + "name": "class", + "type": "attribute", + "val": "[\'class1\', \'class2\']", + }, + Object { + "col": 41, + "line": 13, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 15, + "type": "newline", + }, + Object { + "col": 1, + "line": 15, + "type": "tag", + "val": "div", + }, + Object { + "col": 4, + "line": 15, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 15, + "mustEscape": true, + "name": "id", + "type": "attribute", + "val": "id", + }, + Object { + "col": 10, + "line": 15, + "type": "end-attributes", + }, + Object { + "col": 11, + "line": 15, + "type": "&attributes", + "val": "{foo: \'bar\'}", + }, + Object { + "col": 1, + "line": 16, + "type": "newline", + }, + Object { + "buffer": false, + "col": 1, + "line": 16, + "mustEscape": false, + "type": "code", + "val": "var bar = null", + }, + Object { + "col": 1, + "line": 17, + "type": "newline", + }, + Object { + "col": 1, + "line": 17, + "type": "tag", + "val": "div", + }, + Object { + "col": 4, + "line": 17, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 17, + "mustEscape": true, + "name": "foo", + "type": "attribute", + "val": "null", + }, + Object { + "col": 14, + "line": 17, + "mustEscape": true, + "name": "bar", + "type": "attribute", + "val": "bar", + }, + Object { + "col": 21, + "line": 17, + "type": "end-attributes", + }, + Object { + "col": 22, + "line": 17, + "type": "&attributes", + "val": "{baz: \'baz\'}", + }, + Object { + "col": 1, + "line": 18, + "type": "newline", + }, + Object { + "col": 1, + "line": 18, + "type": "eos", + }, +] +`; + +exports[`test attrs.pug 1`] = ` +Array [ + Object { + "col": 1, + "line": 1, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 1, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 1, + "mustEscape": true, + "name": "href", + "type": "attribute", + "val": "\'/contact\'", + }, + Object { + "col": 18, + "line": 1, + "type": "end-attributes", + }, + Object { + "col": 20, + "line": 1, + "type": "text", + "val": "contact", + }, + Object { + "col": 1, + "line": 2, + "type": "newline", + }, + Object { + "col": 1, + "line": 2, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 2, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 2, + "mustEscape": true, + "name": "href", + "type": "attribute", + "val": "\'/save\'", + }, + Object { + "col": 15, + "line": 2, + "type": "end-attributes", + }, + Object { + "col": 16, + "line": 2, + "type": "class", + "val": "button", + }, + Object { + "col": 24, + "line": 2, + "type": "text", + "val": "save", + }, + Object { + "col": 1, + "line": 3, + "type": "newline", + }, + Object { + "col": 1, + "line": 3, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 3, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 3, + "mustEscape": true, + "name": "foo", + "type": "attribute", + "val": true, + }, + Object { + "col": 8, + "line": 3, + "mustEscape": false, + "name": "bar", + "type": "attribute", + "val": true, + }, + Object { + "col": 13, + "line": 3, + "mustEscape": false, + "name": "baz", + "type": "attribute", + "val": true, + }, + Object { + "col": 16, + "line": 3, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 4, + "type": "newline", + }, + Object { + "col": 1, + "line": 4, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 4, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 4, + "mustEscape": true, + "name": "foo", + "type": "attribute", + "val": "\'foo, bar, baz\'", + }, + Object { + "col": 24, + "line": 4, + "mustEscape": true, + "name": "bar", + "type": "attribute", + "val": "1", + }, + Object { + "col": 29, + "line": 4, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 5, + "type": "newline", + }, + Object { + "col": 1, + "line": 5, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 5, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 5, + "mustEscape": true, + "name": "foo", + "type": "attribute", + "val": "\'((foo))\'", + }, + Object { + "col": 18, + "line": 5, + "mustEscape": true, + "name": "bar", + "type": "attribute", + "val": "(1) ? 1 : 0", + }, + Object { + "col": 35, + "line": 5, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 6, + "type": "newline", + }, + Object { + "col": 1, + "line": 6, + "type": "tag", + "val": "select", + }, + Object { + "col": 1, + "line": 7, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 7, + "type": "tag", + "val": "option", + }, + Object { + "col": 9, + "line": 7, + "type": "start-attributes", + }, + Object { + "col": 10, + "line": 7, + "mustEscape": true, + "name": "value", + "type": "attribute", + "val": "\'foo\'", + }, + Object { + "col": 23, + "line": 7, + "mustEscape": false, + "name": "selected", + "type": "attribute", + "val": true, + }, + Object { + "col": 31, + "line": 7, + "type": "end-attributes", + }, + Object { + "col": 33, + "line": 7, + "type": "text", + "val": "Foo", + }, + Object { + "col": 1, + "line": 8, + "type": "newline", + }, + Object { + "col": 3, + "line": 8, + "type": "tag", + "val": "option", + }, + Object { + "col": 9, + "line": 8, + "type": "start-attributes", + }, + Object { + "col": 10, + "line": 8, + "mustEscape": true, + "name": "selected", + "type": "attribute", + "val": true, + }, + Object { + "col": 20, + "line": 8, + "mustEscape": true, + "name": "value", + "type": "attribute", + "val": "\'bar\'", + }, + Object { + "col": 31, + "line": 8, + "type": "end-attributes", + }, + Object { + "col": 33, + "line": 8, + "type": "text", + "val": "Bar", + }, + Object { + "col": 1, + "line": 9, + "type": "outdent", + }, + Object { + "col": 1, + "line": 9, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 9, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 9, + "mustEscape": true, + "name": "foo", + "type": "attribute", + "val": "\"class:\"", + }, + Object { + "col": 15, + "line": 9, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 10, + "type": "newline", + }, + Object { + "col": 1, + "line": 10, + "type": "tag", + "val": "input", + }, + Object { + "col": 6, + "line": 10, + "type": "start-attributes", + }, + Object { + "col": 7, + "line": 10, + "mustEscape": true, + "name": "pattern", + "type": "attribute", + "val": "\'\\\\S+\'", + }, + Object { + "col": 21, + "line": 10, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 12, + "type": "newline", + }, + Object { + "col": 1, + "line": 12, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 12, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 12, + "mustEscape": true, + "name": "href", + "type": "attribute", + "val": "\'/contact\'", + }, + Object { + "col": 18, + "line": 12, + "type": "end-attributes", + }, + Object { + "col": 20, + "line": 12, + "type": "text", + "val": "contact", + }, + Object { + "col": 1, + "line": 13, + "type": "newline", + }, + Object { + "col": 1, + "line": 13, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 13, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 13, + "mustEscape": true, + "name": "href", + "type": "attribute", + "val": "\'/save\'", + }, + Object { + "col": 15, + "line": 13, + "type": "end-attributes", + }, + Object { + "col": 16, + "line": 13, + "type": "class", + "val": "button", + }, + Object { + "col": 24, + "line": 13, + "type": "text", + "val": "save", + }, + Object { + "col": 1, + "line": 14, + "type": "newline", + }, + Object { + "col": 1, + "line": 14, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 14, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 14, + "mustEscape": true, + "name": "foo", + "type": "attribute", + "val": true, + }, + Object { + "col": 7, + "line": 14, + "mustEscape": false, + "name": "bar", + "type": "attribute", + "val": true, + }, + Object { + "col": 11, + "line": 14, + "mustEscape": false, + "name": "baz", + "type": "attribute", + "val": true, + }, + Object { + "col": 14, + "line": 14, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 15, + "type": "newline", + }, + Object { + "col": 1, + "line": 15, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 15, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 15, + "mustEscape": true, + "name": "foo", + "type": "attribute", + "val": "\'foo, bar, baz\'", + }, + Object { + "col": 23, + "line": 15, + "mustEscape": true, + "name": "bar", + "type": "attribute", + "val": "1", + }, + Object { + "col": 28, + "line": 15, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 16, + "type": "newline", + }, + Object { + "col": 1, + "line": 16, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 16, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 16, + "mustEscape": true, + "name": "foo", + "type": "attribute", + "val": "\'((foo))\'", + }, + Object { + "col": 17, + "line": 16, + "mustEscape": true, + "name": "bar", + "type": "attribute", + "val": "(1) ? 1 : 0", + }, + Object { + "col": 34, + "line": 16, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 17, + "type": "newline", + }, + Object { + "col": 1, + "line": 17, + "type": "tag", + "val": "select", + }, + Object { + "col": 1, + "line": 18, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 18, + "type": "tag", + "val": "option", + }, + Object { + "col": 9, + "line": 18, + "type": "start-attributes", + }, + Object { + "col": 10, + "line": 18, + "mustEscape": true, + "name": "value", + "type": "attribute", + "val": "\'foo\'", + }, + Object { + "col": 22, + "line": 18, + "mustEscape": false, + "name": "selected", + "type": "attribute", + "val": true, + }, + Object { + "col": 30, + "line": 18, + "type": "end-attributes", + }, + Object { + "col": 32, + "line": 18, + "type": "text", + "val": "Foo", + }, + Object { + "col": 1, + "line": 19, + "type": "newline", + }, + Object { + "col": 3, + "line": 19, + "type": "tag", + "val": "option", + }, + Object { + "col": 9, + "line": 19, + "type": "start-attributes", + }, + Object { + "col": 10, + "line": 19, + "mustEscape": true, + "name": "selected", + "type": "attribute", + "val": true, + }, + Object { + "col": 19, + "line": 19, + "mustEscape": true, + "name": "value", + "type": "attribute", + "val": "\'bar\'", + }, + Object { + "col": 30, + "line": 19, + "type": "end-attributes", + }, + Object { + "col": 32, + "line": 19, + "type": "text", + "val": "Bar", + }, + Object { + "col": 1, + "line": 20, + "type": "outdent", + }, + Object { + "col": 1, + "line": 20, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 20, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 20, + "mustEscape": true, + "name": "foo", + "type": "attribute", + "val": "\"class:\"", + }, + Object { + "col": 15, + "line": 20, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 21, + "type": "newline", + }, + Object { + "col": 1, + "line": 21, + "type": "tag", + "val": "input", + }, + Object { + "col": 6, + "line": 21, + "type": "start-attributes", + }, + Object { + "col": 7, + "line": 21, + "mustEscape": true, + "name": "pattern", + "type": "attribute", + "val": "\'\\\\S+\'", + }, + Object { + "col": 21, + "line": 21, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 22, + "type": "newline", + }, + Object { + "col": 1, + "line": 22, + "type": "tag", + "val": "foo", + }, + Object { + "col": 4, + "line": 22, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 22, + "mustEscape": true, + "name": "terse", + "type": "attribute", + "val": "\"true\"", + }, + Object { + "col": 17, + "line": 22, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 23, + "type": "newline", + }, + Object { + "col": 1, + "line": 23, + "type": "tag", + "val": "foo", + }, + Object { + "col": 4, + "line": 23, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 23, + "mustEscape": true, + "name": "date", + "type": "attribute", + "val": "new Date(0)", + }, + Object { + "col": 21, + "line": 23, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 25, + "type": "newline", + }, + Object { + "col": 1, + "line": 25, + "type": "tag", + "val": "foo", + }, + Object { + "col": 4, + "line": 25, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 25, + "mustEscape": true, + "name": "abc", + "type": "attribute", + "val": true, + }, + Object { + "col": 5, + "line": 26, + "mustEscape": false, + "name": "def", + "type": "attribute", + "val": true, + }, + Object { + "col": 8, + "line": 26, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 27, + "type": "newline", + }, + Object { + "col": 1, + "line": 27, + "type": "tag", + "val": "foo", + }, + Object { + "col": 4, + "line": 27, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 27, + "mustEscape": true, + "name": "abc", + "type": "attribute", + "val": true, + }, + Object { + "col": 5, + "line": 28, + "mustEscape": false, + "name": "def", + "type": "attribute", + "val": true, + }, + Object { + "col": 8, + "line": 28, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 29, + "type": "newline", + }, + Object { + "col": 1, + "line": 29, + "type": "tag", + "val": "foo", + }, + Object { + "col": 4, + "line": 29, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 29, + "mustEscape": true, + "name": "abc", + "type": "attribute", + "val": true, + }, + Object { + "col": 3, + "line": 30, + "mustEscape": false, + "name": "def", + "type": "attribute", + "val": true, + }, + Object { + "col": 6, + "line": 30, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 31, + "type": "newline", + }, + Object { + "col": 1, + "line": 31, + "type": "tag", + "val": "foo", + }, + Object { + "col": 4, + "line": 31, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 31, + "mustEscape": true, + "name": "abc", + "type": "attribute", + "val": true, + }, + Object { + "col": 4, + "line": 32, + "mustEscape": false, + "name": "def", + "type": "attribute", + "val": true, + }, + Object { + "col": 7, + "line": 32, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 33, + "type": "newline", + }, + Object { + "col": 1, + "line": 33, + "type": "tag", + "val": "foo", + }, + Object { + "col": 4, + "line": 33, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 33, + "mustEscape": true, + "name": "abc", + "type": "attribute", + "val": true, + }, + Object { + "col": 3, + "line": 34, + "mustEscape": false, + "name": "def", + "type": "attribute", + "val": true, + }, + Object { + "col": 6, + "line": 34, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 35, + "type": "newline", + }, + Object { + "col": 1, + "line": 35, + "type": "tag", + "val": "foo", + }, + Object { + "col": 4, + "line": 35, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 35, + "mustEscape": true, + "name": "abc", + "type": "attribute", + "val": true, + }, + Object { + "col": 5, + "line": 36, + "mustEscape": false, + "name": "def", + "type": "attribute", + "val": true, + }, + Object { + "col": 8, + "line": 36, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 38, + "type": "newline", + }, + Object { + "buffer": false, + "col": 1, + "line": 38, + "mustEscape": false, + "type": "code", + "val": "var attrs = {foo: \'bar\', bar: \'\'}", + }, + Object { + "col": 1, + "line": 40, + "type": "newline", + }, + Object { + "col": 1, + "line": 40, + "type": "tag", + "val": "div", + }, + Object { + "col": 4, + "line": 40, + "type": "&attributes", + "val": "attrs", + }, + Object { + "col": 1, + "line": 42, + "type": "newline", + }, + Object { + "col": 1, + "line": 42, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 42, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 42, + "mustEscape": true, + "name": "foo", + "type": "attribute", + "val": "\'foo\'", + }, + Object { + "col": 14, + "line": 42, + "mustEscape": true, + "name": "bar", + "type": "attribute", + "val": "\"bar\"", + }, + Object { + "col": 24, + "line": 42, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 43, + "type": "newline", + }, + Object { + "col": 1, + "line": 43, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 43, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 43, + "mustEscape": true, + "name": "foo", + "type": "attribute", + "val": "\'foo\'", + }, + Object { + "col": 14, + "line": 43, + "mustEscape": true, + "name": "bar", + "type": "attribute", + "val": "\'bar\'", + }, + Object { + "col": 24, + "line": 43, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 44, + "type": "newline", + }, + Object { + "col": 1, + "line": 44, + "type": "eos", + }, +] +`; + +exports[`test attrs.unescaped.pug 1`] = ` +Array [ + Object { + "col": 1, + "line": 1, + "type": "tag", + "val": "script", + }, + Object { + "col": 7, + "line": 1, + "type": "start-attributes", + }, + Object { + "col": 8, + "line": 1, + "mustEscape": true, + "name": "type", + "type": "attribute", + "val": "\'text/x-template\'", + }, + Object { + "col": 30, + "line": 1, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 2, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 2, + "type": "tag", + "val": "div", + }, + Object { + "col": 6, + "line": 2, + "type": "start-attributes", + }, + Object { + "col": 7, + "line": 2, + "mustEscape": false, + "name": "id", + "type": "attribute", + "val": "\'user-<%= user.id %>\'", + }, + Object { + "col": 32, + "line": 2, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 3, + "type": "indent", + "val": 4, + }, + Object { + "col": 5, + "line": 3, + "type": "tag", + "val": "h1", + }, + Object { + "col": 8, + "line": 3, + "type": "text", + "val": "<%= user.title %>", + }, + Object { + "col": 25, + "line": 3, + "type": "outdent", + }, + Object { + "col": 25, + "line": 3, + "type": "outdent", + }, + Object { + "col": 25, + "line": 3, + "type": "eos", + }, +] +`; + +exports[`test attrs-data.pug 1`] = ` +Array [ + Object { + "buffer": false, + "col": 1, + "line": 1, + "mustEscape": false, + "type": "code", + "val": "var user = { name: \'tobi\' }", + }, + Object { + "col": 1, + "line": 2, + "type": "newline", + }, + Object { + "col": 1, + "line": 2, + "type": "tag", + "val": "foo", + }, + Object { + "col": 4, + "line": 2, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 2, + "mustEscape": true, + "name": "data-user", + "type": "attribute", + "val": "user", + }, + Object { + "col": 19, + "line": 2, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 3, + "type": "newline", + }, + Object { + "col": 1, + "line": 3, + "type": "tag", + "val": "foo", + }, + Object { + "col": 4, + "line": 3, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 3, + "mustEscape": true, + "name": "data-items", + "type": "attribute", + "val": "[1,2,3]", + }, + Object { + "col": 23, + "line": 3, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 4, + "type": "newline", + }, + Object { + "col": 1, + "line": 4, + "type": "tag", + "val": "foo", + }, + Object { + "col": 4, + "line": 4, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 4, + "mustEscape": true, + "name": "data-username", + "type": "attribute", + "val": "\'tobi\'", + }, + Object { + "col": 25, + "line": 4, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 5, + "type": "newline", + }, + Object { + "col": 1, + "line": 5, + "type": "tag", + "val": "foo", + }, + Object { + "col": 4, + "line": 5, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 5, + "mustEscape": true, + "name": "data-escaped", + "type": "attribute", + "val": "{message: \"Let\'s rock!\"}", + }, + Object { + "col": 42, + "line": 5, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 6, + "type": "newline", + }, + Object { + "col": 1, + "line": 6, + "type": "tag", + "val": "foo", + }, + Object { + "col": 4, + "line": 6, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 6, + "mustEscape": true, + "name": "data-ampersand", + "type": "attribute", + "val": "{message: \"a quote: " this & that\"}", + }, + Object { + "col": 60, + "line": 6, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 7, + "type": "newline", + }, + Object { + "col": 1, + "line": 7, + "type": "tag", + "val": "foo", + }, + Object { + "col": 4, + "line": 7, + "type": "start-attributes", + }, + Object { + "col": 5, + "line": 7, + "mustEscape": true, + "name": "data-epoc", + "type": "attribute", + "val": "new Date(0)", + }, + Object { + "col": 26, + "line": 7, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 8, + "type": "newline", + }, + Object { + "col": 1, + "line": 8, + "type": "eos", + }, +] +`; + +exports[`test basic.pug 1`] = ` +Array [ + Object { + "col": 1, + "line": 1, + "type": "tag", + "val": "html", + }, + Object { + "col": 1, + "line": 2, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 2, + "type": "tag", + "val": "body", + }, + Object { + "col": 1, + "line": 3, + "type": "indent", + "val": 4, + }, + Object { + "col": 5, + "line": 3, + "type": "tag", + "val": "h1", + }, + Object { + "col": 8, + "line": 3, + "type": "text", + "val": "Title", + }, + Object { + "col": 13, + "line": 3, + "type": "outdent", + }, + Object { + "col": 13, + "line": 3, + "type": "outdent", + }, + Object { + "col": 13, + "line": 3, + "type": "eos", + }, +] +`; + +exports[`test blanks.pug 1`] = ` +Array [ + Object { + "col": 1, + "line": 3, + "type": "newline", + }, + Object { + "col": 1, + "line": 3, + "type": "tag", + "val": "ul", + }, + Object { + "col": 1, + "line": 4, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 4, + "type": "tag", + "val": "li", + }, + Object { + "col": 6, + "line": 4, + "type": "text", + "val": "foo", + }, + Object { + "col": 1, + "line": 6, + "type": "newline", + }, + Object { + "col": 3, + "line": 6, + "type": "tag", + "val": "li", + }, + Object { + "col": 6, + "line": 6, + "type": "text", + "val": "bar", + }, + Object { + "col": 1, + "line": 8, + "type": "newline", + }, + Object { + "col": 3, + "line": 8, + "type": "tag", + "val": "li", + }, + Object { + "col": 6, + "line": 8, + "type": "text", + "val": "baz", + }, + Object { + "col": 1, + "line": 9, + "type": "outdent", + }, + Object { + "col": 1, + "line": 9, + "type": "eos", + }, +] +`; + +exports[`test block-code.pug 1`] = ` +Array [ + Object { + "col": 1, + "line": 1, + "type": "blockcode", + }, + Object { + "col": 2, + "line": 1, + "type": "start-pipeless-text", + }, + Object { + "col": 3, + "line": 2, + "type": "text", + "val": "list = [\"uno\", \"dos\", \"tres\",", + }, + Object { + "col": 1, + "line": 3, + "type": "newline", + }, + Object { + "col": 3, + "line": 3, + "type": "text", + "val": " \"cuatro\", \"cinco\", \"seis\"];", + }, + Object { + "col": 38, + "line": 3, + "type": "end-pipeless-text", + }, + Object { + "col": 1, + "line": 4, + "type": "newline", + }, + Object { + "buffer": false, + "col": 1, + "line": 4, + "type": "comment", + "val": " Without a block, the element is accepted and no code is generated", + }, + Object { + "col": 1, + "line": 5, + "type": "newline", + }, + Object { + "col": 1, + "line": 5, + "type": "blockcode", + }, + Object { + "col": 1, + "line": 6, + "type": "newline", + }, + Object { + "code": "list", + "col": 1, + "key": null, + "line": 6, + "type": "each", + "val": "item", + }, + Object { + "col": 1, + "line": 7, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 7, + "type": "blockcode", + }, + Object { + "col": 4, + "line": 7, + "type": "start-pipeless-text", + }, + Object { + "col": 5, + "line": 8, + "type": "text", + "val": "string = item.charAt(0)", + }, + Object { + "col": 1, + "line": 9, + "type": "newline", + }, + Object { + "col": 5, + "line": 9, + "type": "text", + "val": "", + }, + Object { + "col": 1, + "line": 10, + "type": "newline", + }, + Object { + "col": 5, + "line": 10, + "type": "text", + "val": " .toUpperCase() +", + }, + Object { + "col": 1, + "line": 11, + "type": "newline", + }, + Object { + "col": 5, + "line": 11, + "type": "text", + "val": "item.slice(1);", + }, + Object { + "col": 19, + "line": 11, + "type": "end-pipeless-text", + }, + Object { + "col": 1, + "line": 12, + "type": "newline", + }, + Object { + "col": 3, + "line": 12, + "type": "tag", + "val": "li", + }, + Object { + "buffer": true, + "col": 5, + "line": 12, + "mustEscape": true, + "type": "code", + "val": "string", + }, + Object { + "col": 1, + "line": 13, + "type": "outdent", + }, + Object { + "col": 1, + "line": 13, + "type": "eos", + }, +] +`; + +exports[`test block-expansion.pug 1`] = ` +Array [ + Object { + "col": 1, + "line": 1, + "type": "tag", + "val": "ul", + }, + Object { + "col": 1, + "line": 2, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 2, + "type": "tag", + "val": "li", + }, + Object { + "col": 5, + "line": 2, + "type": ":", + }, + Object { + "col": 7, + "line": 2, + "type": "tag", + "val": "a", + }, + Object { + "col": 8, + "line": 2, + "type": "start-attributes", + }, + Object { + "col": 9, + "line": 2, + "mustEscape": true, + "name": "href", + "type": "attribute", + "val": "\'#\'", + }, + Object { + "col": 17, + "line": 2, + "type": "end-attributes", + }, + Object { + "col": 19, + "line": 2, + "type": "text", + "val": "foo", + }, + Object { + "col": 1, + "line": 3, + "type": "newline", + }, + Object { + "col": 3, + "line": 3, + "type": "tag", + "val": "li", + }, + Object { + "col": 5, + "line": 3, + "type": ":", + }, + Object { + "col": 7, + "line": 3, + "type": "tag", + "val": "a", + }, + Object { + "col": 8, + "line": 3, + "type": "start-attributes", + }, + Object { + "col": 9, + "line": 3, + "mustEscape": true, + "name": "href", + "type": "attribute", + "val": "\'#\'", + }, + Object { + "col": 17, + "line": 3, + "type": "end-attributes", + }, + Object { + "col": 19, + "line": 3, + "type": "text", + "val": "bar", + }, + Object { + "col": 1, + "line": 5, + "type": "outdent", + }, + Object { + "col": 1, + "line": 5, + "type": "tag", + "val": "p", + }, + Object { + "col": 3, + "line": 5, + "type": "text", + "val": "baz", + }, + Object { + "col": 6, + "line": 5, + "type": "eos", + }, +] +`; + +exports[`test block-expansion.shorthands.pug 1`] = ` +Array [ + Object { + "col": 1, + "line": 1, + "type": "tag", + "val": "ul", + }, + Object { + "col": 1, + "line": 2, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 2, + "type": "tag", + "val": "li", + }, + Object { + "col": 5, + "line": 2, + "type": "class", + "val": "list-item", + }, + Object { + "col": 15, + "line": 2, + "type": ":", + }, + Object { + "col": 17, + "line": 2, + "type": "class", + "val": "foo", + }, + Object { + "col": 21, + "line": 2, + "type": ":", + }, + Object { + "col": 23, + "line": 2, + "type": "id", + "val": "bar", + }, + Object { + "col": 28, + "line": 2, + "type": "text", + "val": "baz", + }, + Object { + "col": 31, + "line": 2, + "type": "outdent", + }, + Object { + "col": 31, + "line": 2, + "type": "eos", + }, +] +`; + +exports[`test blockquote.pug 1`] = ` +Array [ + Object { + "col": 1, + "line": 1, + "type": "tag", + "val": "figure", + }, + Object { + "col": 1, + "line": 2, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 2, + "type": "tag", + "val": "blockquote", + }, + Object { + "col": 1, + "line": 3, + "type": "indent", + "val": 4, + }, + Object { + "col": 7, + "line": 3, + "type": "text", + "val": "Try to define yourself by what you do, and you’ll burnout every time. You are. That is enough. I rest in that.", + }, + Object { + "col": 3, + "line": 4, + "type": "outdent", + }, + Object { + "col": 3, + "line": 4, + "type": "tag", + "val": "figcaption", + }, + Object { + "col": 14, + "line": 4, + "type": "text", + "val": "from @thefray at 1:43pm on May 10", + }, + Object { + "col": 47, + "line": 4, + "type": "outdent", + }, + Object { + "col": 47, + "line": 4, + "type": "eos", + }, +] +`; + +exports[`test blocks-in-blocks.pug 1`] = ` +Array [ + Object { + "col": 1, + "line": 1, + "type": "extends", + }, + Object { + "col": 9, + "line": 1, + "type": "path", + "val": "./auxiliary/blocks-in-blocks-layout.pug", + }, + Object { + "col": 1, + "line": 3, + "type": "newline", + }, + Object { + "col": 1, + "line": 3, + "mode": "replace", + "type": "block", + "val": "body", + }, + Object { + "col": 1, + "line": 4, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 4, + "type": "tag", + "val": "h1", + }, + Object { + "col": 6, + "line": 4, + "type": "text", + "val": "Page 2", + }, + Object { + "col": 1, + "line": 5, + "type": "outdent", + }, + Object { + "col": 1, + "line": 5, + "type": "eos", + }, +] +`; + +exports[`test blocks-in-if.pug 1`] = ` +Array [ + Object { + "buffer": false, + "col": 1, + "line": 1, + "type": "comment", + "val": " see https://github.com/pugjs/pug/issues/1589", + }, + Object { + "col": 1, + "line": 3, + "type": "newline", + }, + Object { + "buffer": false, + "col": 1, + "line": 3, + "mustEscape": false, + "type": "code", + "val": "var ajax = true", + }, + Object { + "col": 1, + "line": 5, + "type": "newline", + }, + Object { + "buffer": false, + "col": 1, + "line": 5, + "mustEscape": false, + "type": "code", + "val": "if( ajax )", + }, + Object { + "col": 1, + "line": 6, + "type": "indent", + "val": 4, + }, + Object { + "buffer": false, + "col": 5, + "line": 6, + "type": "comment", + "val": " return only contents if ajax requests", + }, + Object { + "col": 1, + "line": 7, + "type": "newline", + }, + Object { + "col": 5, + "line": 7, + "mode": "replace", + "type": "block", + "val": "contents", + }, + Object { + "col": 1, + "line": 8, + "type": "indent", + "val": 8, + }, + Object { + "col": 9, + "line": 8, + "type": "tag", + "val": "p", + }, + Object { + "col": 11, + "line": 8, + "type": "text", + "val": "ajax contents", + }, + Object { + "col": 5, + "line": 10, + "type": "outdent", + }, + Object { + "col": 1, + "line": 10, + "type": "outdent", + }, + Object { + "buffer": false, + "col": 1, + "line": 10, + "mustEscape": false, + "type": "code", + "val": "else", + }, + Object { + "col": 1, + "line": 11, + "type": "indent", + "val": 4, + }, + Object { + "buffer": false, + "col": 5, + "line": 11, + "type": "comment", + "val": " return all html", + }, + Object { + "col": 1, + "line": 12, + "type": "newline", + }, + Object { + "col": 5, + "line": 12, + "type": "doctype", + "val": "html", + }, + Object { + "col": 1, + "line": 13, + "type": "newline", + }, + Object { + "col": 5, + "line": 13, + "type": "tag", + "val": "html", + }, + Object { + "col": 1, + "line": 14, + "type": "indent", + "val": 8, + }, + Object { + "col": 9, + "line": 14, + "type": "tag", + "val": "head", + }, + Object { + "col": 1, + "line": 15, + "type": "indent", + "val": 12, + }, + Object { + "col": 13, + "line": 15, + "type": "tag", + "val": "meta", + }, + Object { + "col": 17, + "line": 15, + "type": "start-attributes", + }, + Object { + "col": 19, + "line": 15, + "mustEscape": true, + "name": "charset", + "type": "attribute", + "val": "\'utf8\'", + }, + Object { + "col": 34, + "line": 15, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 16, + "type": "newline", + }, + Object { + "col": 13, + "line": 16, + "type": "tag", + "val": "title", + }, + Object { + "col": 19, + "line": 16, + "type": "text", + "val": "sample", + }, + Object { + "col": 1, + "line": 17, + "type": "newline", + }, + Object { + "col": 13, + "line": 17, + "type": "tag", + "val": "body", + }, + Object { + "col": 1, + "line": 18, + "type": "indent", + "val": 16, + }, + Object { + "col": 17, + "line": 18, + "mode": "replace", + "type": "block", + "val": "contents", + }, + Object { + "col": 1, + "line": 19, + "type": "indent", + "val": 20, + }, + Object { + "col": 21, + "line": 19, + "type": "tag", + "val": "p", + }, + Object { + "col": 23, + "line": 19, + "type": "text", + "val": "all contetns", + }, + Object { + "col": 17, + "line": 20, + "type": "outdent", + }, + Object { + "col": 13, + "line": 20, + "type": "outdent", + }, + Object { + "col": 9, + "line": 20, + "type": "outdent", + }, + Object { + "col": 5, + "line": 20, + "type": "outdent", + }, + Object { + "col": 1, + "line": 20, + "type": "outdent", + }, + Object { + "col": 1, + "line": 20, + "type": "eos", + }, +] +`; + +exports[`test case.pug 1`] = ` +Array [ + Object { + "col": 1, + "line": 1, + "type": "tag", + "val": "html", + }, + Object { + "col": 1, + "line": 2, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 2, + "type": "tag", + "val": "body", + }, + Object { + "col": 1, + "line": 3, + "type": "indent", + "val": 4, + }, + Object { + "buffer": false, + "col": 5, + "line": 3, + "mustEscape": false, + "type": "code", + "val": "var friends = 1", + }, + Object { + "col": 1, + "line": 4, + "type": "newline", + }, + Object { + "col": 5, + "line": 4, + "type": "case", + "val": "friends", + }, + Object { + "col": 1, + "line": 5, + "type": "indent", + "val": 6, + }, + Object { + "col": 7, + "line": 5, + "type": "when", + "val": "0", + }, + Object { + "col": 13, + "line": 5, + "type": ":", + }, + Object { + "col": 15, + "line": 5, + "type": "tag", + "val": "p", + }, + Object { + "col": 17, + "line": 5, + "type": "text", + "val": "you have no friends", + }, + Object { + "col": 1, + "line": 6, + "type": "newline", + }, + Object { + "col": 7, + "line": 6, + "type": "when", + "val": "1", + }, + Object { + "col": 13, + "line": 6, + "type": ":", + }, + Object { + "col": 15, + "line": 6, + "type": "tag", + "val": "p", + }, + Object { + "col": 17, + "line": 6, + "type": "text", + "val": "you have a friend", + }, + Object { + "col": 1, + "line": 7, + "type": "newline", + }, + Object { + "col": 7, + "line": 7, + "type": "default", + }, + Object { + "col": 14, + "line": 7, + "type": ":", + }, + Object { + "col": 16, + "line": 7, + "type": "tag", + "val": "p", + }, + Object { + "col": 18, + "line": 7, + "type": "text", + "val": "you have ", + }, + Object { + "buffer": true, + "col": 27, + "line": 7, + "mustEscape": true, + "type": "interpolated-code", + "val": "friends", + }, + Object { + "col": 37, + "line": 7, + "type": "text", + "val": " friends", + }, + Object { + "col": 5, + "line": 8, + "type": "outdent", + }, + Object { + "buffer": false, + "col": 5, + "line": 8, + "mustEscape": false, + "type": "code", + "val": "var friends = 0", + }, + Object { + "col": 1, + "line": 9, + "type": "newline", + }, + Object { + "col": 5, + "line": 9, + "type": "case", + "val": "friends", + }, + Object { + "col": 1, + "line": 10, + "type": "indent", + "val": 6, + }, + Object { + "col": 7, + "line": 10, + "type": "when", + "val": "0", + }, + Object { + "col": 1, + "line": 11, + "type": "newline", + }, + Object { + "col": 7, + "line": 11, + "type": "when", + "val": "1", + }, + Object { + "col": 1, + "line": 12, + "type": "indent", + "val": 8, + }, + Object { + "col": 9, + "line": 12, + "type": "tag", + "val": "p", + }, + Object { + "col": 11, + "line": 12, + "type": "text", + "val": "you have very few friends", + }, + Object { + "col": 7, + "line": 13, + "type": "outdent", + }, + Object { + "col": 7, + "line": 13, + "type": "default", + }, + Object { + "col": 1, + "line": 14, + "type": "indent", + "val": 8, + }, + Object { + "col": 9, + "line": 14, + "type": "tag", + "val": "p", + }, + Object { + "col": 11, + "line": 14, + "type": "text", + "val": "you have ", + }, + Object { + "buffer": true, + "col": 20, + "line": 14, + "mustEscape": true, + "type": "interpolated-code", + "val": "friends", + }, + Object { + "col": 30, + "line": 14, + "type": "text", + "val": " friends", + }, + Object { + "col": 7, + "line": 16, + "type": "outdent", + }, + Object { + "col": 5, + "line": 16, + "type": "outdent", + }, + Object { + "buffer": false, + "col": 5, + "line": 16, + "mustEscape": false, + "type": "code", + "val": "var friend = \'Tim:G\'", + }, + Object { + "col": 1, + "line": 17, + "type": "newline", + }, + Object { + "col": 5, + "line": 17, + "type": "case", + "val": "friend", + }, + Object { + "col": 1, + "line": 18, + "type": "indent", + "val": 6, + }, + Object { + "col": 7, + "line": 18, + "type": "when", + "val": "\'Tim:G\'", + }, + Object { + "col": 19, + "line": 18, + "type": ":", + }, + Object { + "col": 24, + "line": 18, + "type": "tag", + "val": "p", + }, + Object { + "col": 26, + "line": 18, + "type": "text", + "val": "Friend is a string", + }, + Object { + "col": 1, + "line": 19, + "type": "newline", + }, + Object { + "col": 7, + "line": 19, + "type": "when", + "val": "{tim: \'g\'}", + }, + Object { + "col": 22, + "line": 19, + "type": ":", + }, + Object { + "col": 24, + "line": 19, + "type": "tag", + "val": "p", + }, + Object { + "col": 26, + "line": 19, + "type": "text", + "val": "Friend is an object", + }, + Object { + "col": 5, + "line": 20, + "type": "outdent", + }, + Object { + "col": 3, + "line": 20, + "type": "outdent", + }, + Object { + "col": 1, + "line": 20, + "type": "outdent", + }, + Object { + "col": 1, + "line": 20, + "type": "eos", + }, +] +`; + +exports[`test case-blocks.pug 1`] = ` +Array [ + Object { + "col": 1, + "line": 1, + "type": "tag", + "val": "html", + }, + Object { + "col": 1, + "line": 2, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 2, + "type": "tag", + "val": "body", + }, + Object { + "col": 1, + "line": 3, + "type": "indent", + "val": 4, + }, + Object { + "buffer": false, + "col": 5, + "line": 3, + "mustEscape": false, + "type": "code", + "val": "var friends = 1", + }, + Object { + "col": 1, + "line": 4, + "type": "newline", + }, + Object { + "col": 5, + "line": 4, + "type": "case", + "val": "friends", + }, + Object { + "col": 1, + "line": 5, + "type": "indent", + "val": 6, + }, + Object { + "col": 7, + "line": 5, + "type": "when", + "val": "0", + }, + Object { + "col": 1, + "line": 6, + "type": "indent", + "val": 8, + }, + Object { + "col": 9, + "line": 6, + "type": "tag", + "val": "p", + }, + Object { + "col": 11, + "line": 6, + "type": "text", + "val": "you have no friends", + }, + Object { + "col": 7, + "line": 7, + "type": "outdent", + }, + Object { + "col": 7, + "line": 7, + "type": "when", + "val": "1", + }, + Object { + "col": 1, + "line": 8, + "type": "indent", + "val": 8, + }, + Object { + "col": 9, + "line": 8, + "type": "tag", + "val": "p", + }, + Object { + "col": 11, + "line": 8, + "type": "text", + "val": "you have a friend", + }, + Object { + "col": 7, + "line": 9, + "type": "outdent", + }, + Object { + "col": 7, + "line": 9, + "type": "default", + }, + Object { + "col": 1, + "line": 10, + "type": "indent", + "val": 8, + }, + Object { + "col": 9, + "line": 10, + "type": "tag", + "val": "p", + }, + Object { + "col": 11, + "line": 10, + "type": "text", + "val": "you have ", + }, + Object { + "buffer": true, + "col": 20, + "line": 10, + "mustEscape": true, + "type": "interpolated-code", + "val": "friends", + }, + Object { + "col": 30, + "line": 10, + "type": "text", + "val": " friends", + }, + Object { + "col": 38, + "line": 10, + "type": "outdent", + }, + Object { + "col": 38, + "line": 10, + "type": "outdent", + }, + Object { + "col": 38, + "line": 10, + "type": "outdent", + }, + Object { + "col": 38, + "line": 10, + "type": "outdent", + }, + Object { + "col": 38, + "line": 10, + "type": "eos", + }, +] +`; + +exports[`test case-with-invalid-expression.pug 1`] = ` +Object { + "code": "PUG:SYNTAX_ERROR", + "column": 22, + "line": 1, + "msg": "Syntax Error: Unexpected token", +} +`; + +exports[`test case-with-no-expression.pug 1`] = ` +Object { + "code": "PUG:NO_CASE_EXPRESSION", + "column": 5, + "line": 1, + "msg": "missing expression for case", +} +`; + +exports[`test classes.pug 1`] = ` +Array [ + Object { + "col": 1, + "line": 1, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 1, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 1, + "mustEscape": true, + "name": "class", + "type": "attribute", + "val": "[\'foo\', \'bar\', \'baz\']", + }, + Object { + "col": 30, + "line": 1, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 5, + "type": "newline", + }, + Object { + "col": 1, + "line": 5, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 5, + "type": "class", + "val": "foo", + }, + Object { + "col": 6, + "line": 5, + "type": "start-attributes", + }, + Object { + "col": 7, + "line": 5, + "mustEscape": true, + "name": "class", + "type": "attribute", + "val": "\'bar\'", + }, + Object { + "col": 18, + "line": 5, + "type": "end-attributes", + }, + Object { + "col": 19, + "line": 5, + "type": "class", + "val": "baz", + }, + Object { + "col": 1, + "line": 9, + "type": "newline", + }, + Object { + "col": 1, + "line": 9, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 9, + "type": "class", + "val": "foo-bar_baz", + }, + Object { + "col": 1, + "line": 11, + "type": "newline", + }, + Object { + "col": 1, + "line": 11, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 11, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 11, + "mustEscape": true, + "name": "class", + "type": "attribute", + "val": "{foo: true, bar: false, baz: true}", + }, + Object { + "col": 43, + "line": 11, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 12, + "type": "newline", + }, + Object { + "col": 1, + "line": 12, + "type": "eos", + }, +] +`; + +exports[`test classes-empty.pug 1`] = ` +Array [ + Object { + "col": 1, + "line": 1, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 1, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 1, + "mustEscape": true, + "name": "class", + "type": "attribute", + "val": "\'\'", + }, + Object { + "col": 11, + "line": 1, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 2, + "type": "newline", + }, + Object { + "col": 1, + "line": 2, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 2, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 2, + "mustEscape": true, + "name": "class", + "type": "attribute", + "val": "null", + }, + Object { + "col": 13, + "line": 2, + "type": "end-attributes", + }, + Object { + "col": 1, + "line": 3, + "type": "newline", + }, + Object { + "col": 1, + "line": 3, + "type": "tag", + "val": "a", + }, + Object { + "col": 2, + "line": 3, + "type": "start-attributes", + }, + Object { + "col": 3, + "line": 3, + "mustEscape": true, + "name": "class", + "type": "attribute", + "val": "undefined", + }, + Object { + "col": 18, + "line": 3, + "type": "end-attributes", + }, + Object { + "col": 19, + "line": 3, + "type": "eos", + }, +] +`; + +exports[`test code.conditionals.pug 1`] = ` +Array [ + Object { + "col": 1, + "line": 2, + "type": "newline", + }, + Object { + "buffer": false, + "col": 1, + "line": 2, + "mustEscape": false, + "type": "code", + "val": "if (true)", + }, + Object { + "col": 1, + "line": 3, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 3, + "type": "tag", + "val": "p", + }, + Object { + "col": 5, + "line": 3, + "type": "text", + "val": "foo", + }, + Object { + "col": 1, + "line": 4, + "type": "outdent", + }, + Object { + "buffer": false, + "col": 1, + "line": 4, + "mustEscape": false, + "type": "code", + "val": "else", + }, + Object { + "col": 1, + "line": 5, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 5, + "type": "tag", + "val": "p", + }, + Object { + "col": 5, + "line": 5, + "type": "text", + "val": "bar", + }, + Object { + "col": 1, + "line": 7, + "type": "outdent", + }, + Object { + "buffer": false, + "col": 1, + "line": 7, + "mustEscape": false, + "type": "code", + "val": "if (true) {", + }, + Object { + "col": 1, + "line": 8, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 8, + "type": "tag", + "val": "p", + }, + Object { + "col": 5, + "line": 8, + "type": "text", + "val": "foo", + }, + Object { + "col": 1, + "line": 9, + "type": "outdent", + }, + Object { + "buffer": false, + "col": 1, + "line": 9, + "mustEscape": false, + "type": "code", + "val": "} else {", + }, + Object { + "col": 1, + "line": 10, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 10, + "type": "tag", + "val": "p", + }, + Object { + "col": 5, + "line": 10, + "type": "text", + "val": "bar", + }, + Object { + "col": 1, + "line": 11, + "type": "outdent", + }, + Object { + "buffer": false, + "col": 1, + "line": 11, + "mustEscape": false, + "type": "code", + "val": "}", + }, + Object { + "col": 1, + "line": 13, + "type": "newline", + }, + Object { + "col": 1, + "line": 13, + "type": "if", + "val": "true", + }, + Object { + "col": 1, + "line": 14, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 14, + "type": "tag", + "val": "p", + }, + Object { + "col": 5, + "line": 14, + "type": "text", + "val": "foo", + }, + Object { + "col": 1, + "line": 15, + "type": "newline", + }, + Object { + "col": 3, + "line": 15, + "type": "tag", + "val": "p", + }, + Object { + "col": 5, + "line": 15, + "type": "text", + "val": "bar", + }, + Object { + "col": 1, + "line": 16, + "type": "newline", + }, + Object { + "col": 3, + "line": 16, + "type": "tag", + "val": "p", + }, + Object { + "col": 5, + "line": 16, + "type": "text", + "val": "baz", + }, + Object { + "col": 1, + "line": 17, + "type": "outdent", + }, + Object { + "col": 1, + "line": 17, + "type": "else", + "val": "", + }, + Object { + "col": 1, + "line": 18, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 18, + "type": "tag", + "val": "p", + }, + Object { + "col": 5, + "line": 18, + "type": "text", + "val": "bar", + }, + Object { + "col": 1, + "line": 20, + "type": "outdent", + }, + Object { + "col": 1, + "line": 20, + "type": "if", + "val": "!(true)", + }, + Object { + "col": 1, + "line": 21, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 21, + "type": "tag", + "val": "p", + }, + Object { + "col": 5, + "line": 21, + "type": "text", + "val": "foo", + }, + Object { + "col": 1, + "line": 22, + "type": "outdent", + }, + Object { + "col": 1, + "line": 22, + "type": "else", + "val": "", + }, + Object { + "col": 1, + "line": 23, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 23, + "type": "tag", + "val": "p", + }, + Object { + "col": 5, + "line": 23, + "type": "text", + "val": "bar", + }, + Object { + "col": 1, + "line": 25, + "type": "outdent", + }, + Object { + "col": 1, + "line": 25, + "type": "if", + "val": "\'nested\'", + }, + Object { + "col": 1, + "line": 26, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 26, + "type": "if", + "val": "\'works\'", + }, + Object { + "col": 1, + "line": 27, + "type": "indent", + "val": 4, + }, + Object { + "col": 5, + "line": 27, + "type": "tag", + "val": "p", + }, + Object { + "col": 7, + "line": 27, + "type": "text", + "val": "yay", + }, + Object { + "col": 3, + "line": 29, + "type": "outdent", + }, + Object { + "col": 1, + "line": 29, + "type": "outdent", + }, + Object { + "buffer": false, + "col": 1, + "line": 29, + "type": "comment", + "val": " allow empty blocks", + }, + Object { + "col": 1, + "line": 30, + "type": "newline", + }, + Object { + "col": 1, + "line": 30, + "type": "if", + "val": "false", + }, + Object { + "col": 1, + "line": 31, + "type": "newline", + }, + Object { + "col": 1, + "line": 31, + "type": "else", + "val": "", + }, + Object { + "col": 1, + "line": 32, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 32, + "type": "class", + "val": "bar", + }, + Object { + "col": 1, + "line": 33, + "type": "outdent", + }, + Object { + "col": 1, + "line": 33, + "type": "if", + "val": "true", + }, + Object { + "col": 1, + "line": 34, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 34, + "type": "class", + "val": "bar", + }, + Object { + "col": 1, + "line": 35, + "type": "outdent", + }, + Object { + "col": 1, + "line": 35, + "type": "else", + "val": "", + }, + Object { + "col": 1, + "line": 36, + "type": "newline", + }, + Object { + "col": 1, + "line": 36, + "type": "class", + "val": "bing", + }, + Object { + "col": 1, + "line": 38, + "type": "newline", + }, + Object { + "col": 1, + "line": 38, + "type": "if", + "val": "false", + }, + Object { + "col": 1, + "line": 39, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 39, + "type": "class", + "val": "bing", + }, + Object { + "col": 1, + "line": 40, + "type": "outdent", + }, + Object { + "col": 1, + "line": 40, + "type": "else-if", + "val": "false", + }, + Object { + "col": 1, + "line": 41, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 41, + "type": "class", + "val": "bar", + }, + Object { + "col": 1, + "line": 42, + "type": "outdent", + }, + Object { + "col": 1, + "line": 42, + "type": "else", + "val": "", + }, + Object { + "col": 1, + "line": 43, + "type": "indent", + "val": 2, + }, + Object { + "col": 3, + "line": 43, + "type": "class", + "val": "foo", + }, + Object { + "col": 7, + "line": 43, + "type": "outdent", + }, + Object { + "col": 7, + "line": 43, + "type": "eos", + }, +] +`; + +exports[`test code.escape.pug 1`] = ` +Array [ + Object { + "col": 1, + "line": 1, + "type": "tag", + "val": "p", + }, + Object { + "buffer": true, + "col": 2, + "line": 1, + "mustEscape": true, + "type": "code", + "val": "\' +", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "type", + "val": "\"text/javascript\"", + }, + ], + "block": Object { + "filename": "includes.pug", + "line": 9, + "nodes": Array [ + Object { + "type": "Text", + "val": "var STRING_SUBSTITUTIONS = { // table of character substitutions + \'\\t\': \'\\\\t\', + \'\\r\': \'\\\\r\', + \'\\n\': \'\\\\n\', + \'\"\' : \'\\\\\"\', + \'\\\\\': \'\\\\\\\\\' +};", + }, + ], + "type": "Block", + }, + "filename": "includes.pug", + "isInline": false, + "line": 9, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "includes.pug", + "isInline": false, + "line": 6, + "name": "body", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`cases from pug includes-with-ext-js.input.json 1`] = ` +Object { + "declaredBlocks": Object {}, + "filename": "includes-with-ext-js.pug", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "includes-with-ext-js.pug", + "line": 1, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "includes-with-ext-js.pug", + "line": 2, + "nodes": Array [ + Object { + "type": "Text", + "val": "var x = \"\\n here is some \\n new lined text\"; +", + }, + ], + "type": "Block", + }, + "filename": "includes-with-ext-js.pug", + "isInline": true, + "line": 2, + "name": "code", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "includes-with-ext-js.pug", + "isInline": false, + "line": 1, + "name": "pre", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`cases from pug layout.append.input.json 1`] = ` +Object { + "declaredBlocks": Object { + "body": Array [ + Object { + "filename": "../fixtures/append/layout.pug", + "line": 7, + "mode": "replace", + "name": "body", + "nodes": Array [], + "type": "NamedBlock", + }, + ], + "head": Array [ + Object { + "filename": "../fixtures/append/layout.pug", + "line": 3, + "mode": "replace", + "name": "head", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/jquery.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/append/layout.pug", + "line": 4, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/append/layout.pug", + "isInline": false, + "line": 4, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/caustic.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/append/layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/append/layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'app.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/append/app-layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/append/app-layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'foo.js\'", + }, + ], + "block": Object { + "filename": "layout.append.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.append.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'bar.js\'", + }, + ], + "block": Object { + "filename": "layout.append.pug", + "line": 6, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.append.pug", + "isInline": false, + "line": 6, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + ], + }, + "filename": "../fixtures/append/layout.pug", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "../fixtures/append/layout.pug", + "line": 2, + "nodes": Array [ + Object { + "filename": "../fixtures/append/layout.pug", + "line": 3, + "mode": "replace", + "name": "head", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/jquery.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/append/layout.pug", + "line": 4, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/append/layout.pug", + "isInline": false, + "line": 4, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/caustic.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/append/layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/append/layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'app.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/append/app-layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/append/app-layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'foo.js\'", + }, + ], + "block": Object { + "filename": "layout.append.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.append.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'bar.js\'", + }, + ], + "block": Object { + "filename": "layout.append.pug", + "line": 6, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.append.pug", + "isInline": false, + "line": 6, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "../fixtures/append/layout.pug", + "line": 6, + "nodes": Array [ + Object { + "filename": "../fixtures/append/layout.pug", + "line": 7, + "mode": "replace", + "name": "body", + "nodes": Array [], + "type": "NamedBlock", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/append/layout.pug", + "isInline": false, + "line": 6, + "name": "body", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/append/layout.pug", + "isInline": false, + "line": 2, + "name": "html", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`cases from pug layout.append.without-block.input.json 1`] = ` +Object { + "declaredBlocks": Object { + "body": Array [ + Object { + "filename": "../fixtures/append-without-block/layout.pug", + "line": 7, + "mode": "replace", + "name": "body", + "nodes": Array [], + "type": "NamedBlock", + }, + ], + "head": Array [ + Object { + "filename": "../fixtures/append-without-block/layout.pug", + "line": 3, + "mode": "replace", + "name": "head", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/jquery.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/append-without-block/layout.pug", + "line": 4, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/append-without-block/layout.pug", + "isInline": false, + "line": 4, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/caustic.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/append-without-block/layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/append-without-block/layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'app.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/append-without-block/app-layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/append-without-block/app-layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'foo.js\'", + }, + ], + "block": Object { + "filename": "layout.append.without-block.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.append.without-block.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'bar.js\'", + }, + ], + "block": Object { + "filename": "layout.append.without-block.pug", + "line": 6, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.append.without-block.pug", + "isInline": false, + "line": 6, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + ], + }, + "filename": "../fixtures/append-without-block/layout.pug", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "../fixtures/append-without-block/layout.pug", + "line": 2, + "nodes": Array [ + Object { + "filename": "../fixtures/append-without-block/layout.pug", + "line": 3, + "mode": "replace", + "name": "head", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/jquery.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/append-without-block/layout.pug", + "line": 4, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/append-without-block/layout.pug", + "isInline": false, + "line": 4, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/caustic.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/append-without-block/layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/append-without-block/layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'app.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/append-without-block/app-layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/append-without-block/app-layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'foo.js\'", + }, + ], + "block": Object { + "filename": "layout.append.without-block.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.append.without-block.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'bar.js\'", + }, + ], + "block": Object { + "filename": "layout.append.without-block.pug", + "line": 6, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.append.without-block.pug", + "isInline": false, + "line": 6, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "../fixtures/append-without-block/layout.pug", + "line": 6, + "nodes": Array [ + Object { + "filename": "../fixtures/append-without-block/layout.pug", + "line": 7, + "mode": "replace", + "name": "body", + "nodes": Array [], + "type": "NamedBlock", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/append-without-block/layout.pug", + "isInline": false, + "line": 6, + "name": "body", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/append-without-block/layout.pug", + "isInline": false, + "line": 2, + "name": "html", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`cases from pug layout.multi.append.prepend.block.input.json 1`] = ` +Object { + "declaredBlocks": Object { + "content": Array [ + Object { + "filename": "../fixtures/multi-append-prepend-block/redefine.pug", + "line": 3, + "mode": "replace", + "name": "content", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'content\'", + }, + ], + "block": Object { + "filename": "../fixtures/multi-append-prepend-block/redefine.pug", + "line": 4, + "nodes": Array [ + Object { + "filename": "../fixtures/multi-append-prepend-block/redefine.pug", + "line": 5, + "type": "Text", + "val": "Defined content", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/multi-append-prepend-block/redefine.pug", + "isInline": false, + "line": 4, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + ], + "parents": Array [ + Object { + "filename": "../fixtures/multi-append-prepend-block/root.pug", + "line": 1, + "mode": "replace", + "name": "content", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'last\'", + }, + Object { + "mustEscape": false, + "name": "class", + "val": "\'prepend\'", + }, + ], + "block": Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 13, + "nodes": Array [ + Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 13, + "type": "Text", + "val": "Last prepend must appear at top", + }, + ], + "type": "Block", + }, + "filename": "layout.multi.append.prepend.block.pug", + "isInline": false, + "line": 13, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'first\'", + }, + Object { + "mustEscape": false, + "name": "class", + "val": "\'prepend\'", + }, + ], + "block": Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 7, + "nodes": Array [ + Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 7, + "type": "Text", + "val": "Something prepended to content", + }, + ], + "type": "Block", + }, + "filename": "layout.multi.append.prepend.block.pug", + "isInline": false, + "line": 7, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'content\'", + }, + ], + "block": Object { + "filename": "../fixtures/multi-append-prepend-block/redefine.pug", + "line": 4, + "nodes": Array [ + Object { + "filename": "../fixtures/multi-append-prepend-block/redefine.pug", + "line": 5, + "type": "Text", + "val": "Defined content", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/multi-append-prepend-block/redefine.pug", + "isInline": false, + "line": 4, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'first\'", + }, + Object { + "mustEscape": false, + "name": "class", + "val": "\'append\'", + }, + ], + "block": Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 4, + "nodes": Array [ + Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 4, + "type": "Text", + "val": "Something appended to content", + }, + ], + "type": "Block", + }, + "filename": "layout.multi.append.prepend.block.pug", + "isInline": false, + "line": 4, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'last\'", + }, + Object { + "mustEscape": false, + "name": "class", + "val": "\'append\'", + }, + ], + "block": Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 10, + "nodes": Array [ + Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 10, + "type": "Text", + "val": "Last append must be most last", + }, + ], + "type": "Block", + }, + "filename": "layout.multi.append.prepend.block.pug", + "isInline": false, + "line": 10, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + ], + "type": "NamedBlock", + }, + ], + "head": Array [ + Object { + "filename": "../fixtures/multi-append-prepend-block/root.pug", + "line": 4, + "mode": "replace", + "name": "head", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'foo.js\'", + }, + ], + "block": Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 19, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.multi.append.prepend.block.pug", + "isInline": false, + "line": 19, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'/app.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/multi-append-prepend-block/root.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/multi-append-prepend-block/root.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'jquery.js\'", + }, + ], + "block": Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 16, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.multi.append.prepend.block.pug", + "isInline": false, + "line": 16, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + ], + }, + "filename": "../fixtures/multi-append-prepend-block/root.pug", + "line": 0, + "nodes": Array [ + Object { + "filename": "../fixtures/multi-append-prepend-block/root.pug", + "line": 1, + "mode": "replace", + "name": "content", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'last\'", + }, + Object { + "mustEscape": false, + "name": "class", + "val": "\'prepend\'", + }, + ], + "block": Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 13, + "nodes": Array [ + Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 13, + "type": "Text", + "val": "Last prepend must appear at top", + }, + ], + "type": "Block", + }, + "filename": "layout.multi.append.prepend.block.pug", + "isInline": false, + "line": 13, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'first\'", + }, + Object { + "mustEscape": false, + "name": "class", + "val": "\'prepend\'", + }, + ], + "block": Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 7, + "nodes": Array [ + Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 7, + "type": "Text", + "val": "Something prepended to content", + }, + ], + "type": "Block", + }, + "filename": "layout.multi.append.prepend.block.pug", + "isInline": false, + "line": 7, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'content\'", + }, + ], + "block": Object { + "filename": "../fixtures/multi-append-prepend-block/redefine.pug", + "line": 4, + "nodes": Array [ + Object { + "filename": "../fixtures/multi-append-prepend-block/redefine.pug", + "line": 5, + "type": "Text", + "val": "Defined content", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/multi-append-prepend-block/redefine.pug", + "isInline": false, + "line": 4, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'first\'", + }, + Object { + "mustEscape": false, + "name": "class", + "val": "\'append\'", + }, + ], + "block": Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 4, + "nodes": Array [ + Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 4, + "type": "Text", + "val": "Something appended to content", + }, + ], + "type": "Block", + }, + "filename": "layout.multi.append.prepend.block.pug", + "isInline": false, + "line": 4, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'last\'", + }, + Object { + "mustEscape": false, + "name": "class", + "val": "\'append\'", + }, + ], + "block": Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 10, + "nodes": Array [ + Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 10, + "type": "Text", + "val": "Last append must be most last", + }, + ], + "type": "Block", + }, + "filename": "layout.multi.append.prepend.block.pug", + "isInline": false, + "line": 10, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + Object { + "filename": "../fixtures/multi-append-prepend-block/root.pug", + "line": 4, + "mode": "replace", + "name": "head", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'foo.js\'", + }, + ], + "block": Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 19, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.multi.append.prepend.block.pug", + "isInline": false, + "line": 19, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'/app.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/multi-append-prepend-block/root.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/multi-append-prepend-block/root.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'jquery.js\'", + }, + ], + "block": Object { + "filename": "layout.multi.append.prepend.block.pug", + "line": 16, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.multi.append.prepend.block.pug", + "isInline": false, + "line": 16, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + ], + "type": "Block", +} +`; + +exports[`cases from pug layout.prepend.input.json 1`] = ` +Object { + "declaredBlocks": Object { + "body": Array [ + Object { + "filename": "../fixtures/prepend/layout.pug", + "line": 7, + "mode": "replace", + "name": "body", + "nodes": Array [], + "type": "NamedBlock", + }, + ], + "head": Array [ + Object { + "filename": "../fixtures/prepend/layout.pug", + "line": 3, + "mode": "replace", + "name": "head", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'foo.js\'", + }, + ], + "block": Object { + "filename": "layout.prepend.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.prepend.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'bar.js\'", + }, + ], + "block": Object { + "filename": "layout.prepend.pug", + "line": 6, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.prepend.pug", + "isInline": false, + "line": 6, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'app.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/prepend/app-layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/prepend/app-layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/jquery.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/prepend/layout.pug", + "line": 4, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/prepend/layout.pug", + "isInline": false, + "line": 4, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/caustic.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/prepend/layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/prepend/layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + ], + }, + "filename": "../fixtures/prepend/layout.pug", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "../fixtures/prepend/layout.pug", + "line": 2, + "nodes": Array [ + Object { + "filename": "../fixtures/prepend/layout.pug", + "line": 3, + "mode": "replace", + "name": "head", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'foo.js\'", + }, + ], + "block": Object { + "filename": "layout.prepend.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.prepend.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'bar.js\'", + }, + ], + "block": Object { + "filename": "layout.prepend.pug", + "line": 6, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.prepend.pug", + "isInline": false, + "line": 6, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'app.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/prepend/app-layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/prepend/app-layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/jquery.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/prepend/layout.pug", + "line": 4, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/prepend/layout.pug", + "isInline": false, + "line": 4, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/caustic.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/prepend/layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/prepend/layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "../fixtures/prepend/layout.pug", + "line": 6, + "nodes": Array [ + Object { + "filename": "../fixtures/prepend/layout.pug", + "line": 7, + "mode": "replace", + "name": "body", + "nodes": Array [], + "type": "NamedBlock", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/prepend/layout.pug", + "isInline": false, + "line": 6, + "name": "body", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/prepend/layout.pug", + "isInline": false, + "line": 2, + "name": "html", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`cases from pug layout.prepend.without-block.input.json 1`] = ` +Object { + "declaredBlocks": Object { + "body": Array [ + Object { + "filename": "../fixtures/prepend-without-block/layout.pug", + "line": 7, + "mode": "replace", + "name": "body", + "nodes": Array [], + "type": "NamedBlock", + }, + ], + "head": Array [ + Object { + "filename": "../fixtures/prepend-without-block/layout.pug", + "line": 3, + "mode": "replace", + "name": "head", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'foo.js\'", + }, + ], + "block": Object { + "filename": "layout.prepend.without-block.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.prepend.without-block.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'bar.js\'", + }, + ], + "block": Object { + "filename": "layout.prepend.without-block.pug", + "line": 6, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.prepend.without-block.pug", + "isInline": false, + "line": 6, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'app.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/prepend-without-block/app-layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/prepend-without-block/app-layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/jquery.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/prepend-without-block/layout.pug", + "line": 4, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/prepend-without-block/layout.pug", + "isInline": false, + "line": 4, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/caustic.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/prepend-without-block/layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/prepend-without-block/layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + ], + }, + "filename": "../fixtures/prepend-without-block/layout.pug", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "../fixtures/prepend-without-block/layout.pug", + "line": 2, + "nodes": Array [ + Object { + "filename": "../fixtures/prepend-without-block/layout.pug", + "line": 3, + "mode": "replace", + "name": "head", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'foo.js\'", + }, + ], + "block": Object { + "filename": "layout.prepend.without-block.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.prepend.without-block.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'bar.js\'", + }, + ], + "block": Object { + "filename": "layout.prepend.without-block.pug", + "line": 6, + "nodes": Array [], + "type": "Block", + }, + "filename": "layout.prepend.without-block.pug", + "isInline": false, + "line": 6, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'app.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/prepend-without-block/app-layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/prepend-without-block/app-layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/jquery.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/prepend-without-block/layout.pug", + "line": 4, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/prepend-without-block/layout.pug", + "isInline": false, + "line": 4, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "src", + "val": "\'vendor/caustic.js\'", + }, + ], + "block": Object { + "filename": "../fixtures/prepend-without-block/layout.pug", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/prepend-without-block/layout.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "../fixtures/prepend-without-block/layout.pug", + "line": 6, + "nodes": Array [ + Object { + "filename": "../fixtures/prepend-without-block/layout.pug", + "line": 7, + "mode": "replace", + "name": "body", + "nodes": Array [], + "type": "NamedBlock", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/prepend-without-block/layout.pug", + "isInline": false, + "line": 6, + "name": "body", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/prepend-without-block/layout.pug", + "isInline": false, + "line": 2, + "name": "html", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`error handling child-with-tags.input.json 1`] = ` +Object { + "code": "PUG:UNEXPECTED_NODES_IN_EXTENDING_ROOT", + "line": 6, + "msg": "Only named blocks and mixins can appear at the top level of an extending template", +} +`; + +exports[`error handling extends-not-first.input.json 1`] = ` +Object { + "code": "PUG:EXTENDS_NOT_FIRST", + "line": 4, + "msg": "Declaration of template inheritance (\"extends\") should be the first thing in the file.", +} +`; + +exports[`error handling unexpected-block.input.json 1`] = ` +Object { + "code": "PUG:UNEXPECTED_BLOCK", + "line": 3, + "msg": "Unexpected block foo", +} +`; + +exports[`special cases extending-empty.input.json 1`] = ` +Object { + "declaredBlocks": Object {}, + "filename": "../fixtures/empty.pug", + "line": 0, + "nodes": Array [], + "type": "Block", +} +`; + +exports[`special cases extending-include.input.json 1`] = ` +Object { + "declaredBlocks": Object { + "body": Array [ + Object { + "filename": "extending-include.pug", + "line": 4, + "mode": "replace", + "name": "body", + "nodes": Array [ + Object { + "args": "\'myimg.png\'", + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'with-border\'", + }, + Object { + "mustEscape": true, + "name": "alt", + "val": "\"My image\"", + }, + ], + "block": null, + "call": true, + "filename": "extending-include.pug", + "line": 5, + "name": "image", + "type": "Mixin", + }, + ], + "parents": Array [ + Object { + "filename": "../fixtures/layout.pug", + "line": 8, + "mode": "replace", + "name": "body", + "nodes": Array [ + Object { + "args": "\'myimg.png\'", + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'with-border\'", + }, + Object { + "mustEscape": true, + "name": "alt", + "val": "\"My image\"", + }, + ], + "block": null, + "call": true, + "filename": "extending-include.pug", + "line": 5, + "name": "image", + "type": "Mixin", + }, + ], + "type": "NamedBlock", + }, + ], + "type": "NamedBlock", + }, + ], + "head": Array [ + Object { + "filename": "../fixtures/layout.pug", + "line": 5, + "mode": "replace", + "name": "head", + "nodes": Array [ + Object { + "filename": "../fixtures/layout.pug", + "isHtml": true, + "line": 6, + "type": "Text", + "val": "Hello world!", + }, + ], + "type": "NamedBlock", + }, + ], + }, + "filename": "../fixtures/layout.pug", + "line": 0, + "nodes": Array [ + Object { + "args": "src", + "block": Object { + "filename": "../fixtures/mixins.pug", + "line": 2, + "nodes": Array [ + Object { + "attributeBlocks": Array [ + "attributes", + ], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "cl-src", + "val": "src", + }, + ], + "block": Object { + "filename": "../fixtures/mixins.pug", + "line": 2, + "nodes": Array [], + "type": "Block", + }, + "filename": "../fixtures/mixins.pug", + "isInline": true, + "line": 2, + "name": "img", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "call": false, + "filename": "../fixtures/mixins.pug", + "line": 1, + "name": "image", + "type": "Mixin", + }, + Object { + "filename": "../fixtures/layout.pug", + "line": 1, + "type": "Doctype", + "val": "", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "../fixtures/layout.pug", + "line": 3, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "../fixtures/layout.pug", + "line": 4, + "nodes": Array [ + Object { + "filename": "../fixtures/layout.pug", + "line": 5, + "mode": "replace", + "name": "head", + "nodes": Array [ + Object { + "filename": "../fixtures/layout.pug", + "isHtml": true, + "line": 6, + "type": "Text", + "val": "Hello world!", + }, + ], + "type": "NamedBlock", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/layout.pug", + "isInline": false, + "line": 4, + "name": "head", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "../fixtures/layout.pug", + "line": 7, + "nodes": Array [ + Object { + "filename": "../fixtures/layout.pug", + "line": 8, + "mode": "replace", + "name": "body", + "nodes": Array [ + Object { + "args": "\'myimg.png\'", + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'with-border\'", + }, + Object { + "mustEscape": true, + "name": "alt", + "val": "\"My image\"", + }, + ], + "block": null, + "call": true, + "filename": "extending-include.pug", + "line": 5, + "name": "image", + "type": "Mixin", + }, + ], + "type": "NamedBlock", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/layout.pug", + "isInline": false, + "line": 7, + "name": "body", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/layout.pug", + "isInline": false, + "line": 3, + "name": "html", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`special cases root-mixin.input.json 1`] = ` +Object { + "declaredBlocks": Object { + "body": Array [ + Object { + "filename": "root-mixin.pug", + "line": 6, + "mode": "replace", + "name": "body", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "root-mixin.pug", + "line": 7, + "nodes": Array [ + Object { + "filename": "root-mixin.pug", + "line": 7, + "type": "Text", + "val": "Before", + }, + ], + "type": "Block", + }, + "filename": "root-mixin.pug", + "isInline": false, + "line": 7, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + Object { + "args": null, + "attributeBlocks": Array [], + "attrs": Array [], + "block": null, + "call": true, + "filename": "root-mixin.pug", + "line": 8, + "name": "myMixin", + "type": "Mixin", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "root-mixin.pug", + "line": 9, + "nodes": Array [ + Object { + "filename": "root-mixin.pug", + "line": 9, + "type": "Text", + "val": "After", + }, + ], + "type": "Block", + }, + "filename": "root-mixin.pug", + "isInline": false, + "line": 9, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "parents": Array [ + Object { + "filename": "../fixtures/layout.pug", + "line": 8, + "mode": "replace", + "name": "body", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "root-mixin.pug", + "line": 7, + "nodes": Array [ + Object { + "filename": "root-mixin.pug", + "line": 7, + "type": "Text", + "val": "Before", + }, + ], + "type": "Block", + }, + "filename": "root-mixin.pug", + "isInline": false, + "line": 7, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + Object { + "args": null, + "attributeBlocks": Array [], + "attrs": Array [], + "block": null, + "call": true, + "filename": "root-mixin.pug", + "line": 8, + "name": "myMixin", + "type": "Mixin", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "root-mixin.pug", + "line": 9, + "nodes": Array [ + Object { + "filename": "root-mixin.pug", + "line": 9, + "type": "Text", + "val": "After", + }, + ], + "type": "Block", + }, + "filename": "root-mixin.pug", + "isInline": false, + "line": 9, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + ], + "type": "NamedBlock", + }, + ], + "head": Array [ + Object { + "filename": "../fixtures/layout.pug", + "line": 5, + "mode": "replace", + "name": "head", + "nodes": Array [ + Object { + "filename": "../fixtures/layout.pug", + "isHtml": true, + "line": 6, + "type": "Text", + "val": "Hello world!", + }, + ], + "type": "NamedBlock", + }, + ], + }, + "filename": "../fixtures/layout.pug", + "line": 0, + "nodes": Array [ + Object { + "args": null, + "block": Object { + "filename": "root-mixin.pug", + "line": 4, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "root-mixin.pug", + "line": 4, + "nodes": Array [ + Object { + "filename": "root-mixin.pug", + "line": 4, + "type": "Text", + "val": "Hello world", + }, + ], + "type": "Block", + }, + "filename": "root-mixin.pug", + "isInline": false, + "line": 4, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "call": false, + "filename": "root-mixin.pug", + "line": 3, + "name": "myMixin", + "type": "Mixin", + }, + Object { + "filename": "../fixtures/layout.pug", + "line": 1, + "type": "Doctype", + "val": "", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "../fixtures/layout.pug", + "line": 3, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "../fixtures/layout.pug", + "line": 4, + "nodes": Array [ + Object { + "filename": "../fixtures/layout.pug", + "line": 5, + "mode": "replace", + "name": "head", + "nodes": Array [ + Object { + "filename": "../fixtures/layout.pug", + "isHtml": true, + "line": 6, + "type": "Text", + "val": "Hello world!", + }, + ], + "type": "NamedBlock", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/layout.pug", + "isInline": false, + "line": 4, + "name": "head", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "../fixtures/layout.pug", + "line": 7, + "nodes": Array [ + Object { + "filename": "../fixtures/layout.pug", + "line": 8, + "mode": "replace", + "name": "body", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "root-mixin.pug", + "line": 7, + "nodes": Array [ + Object { + "filename": "root-mixin.pug", + "line": 7, + "type": "Text", + "val": "Before", + }, + ], + "type": "Block", + }, + "filename": "root-mixin.pug", + "isInline": false, + "line": 7, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + Object { + "args": null, + "attributeBlocks": Array [], + "attrs": Array [], + "block": null, + "call": true, + "filename": "root-mixin.pug", + "line": 8, + "name": "myMixin", + "type": "Mixin", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "root-mixin.pug", + "line": 9, + "nodes": Array [ + Object { + "filename": "root-mixin.pug", + "line": 9, + "type": "Text", + "val": "After", + }, + ], + "type": "Block", + }, + "filename": "root-mixin.pug", + "isInline": false, + "line": 9, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/layout.pug", + "isInline": false, + "line": 7, + "name": "body", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "../fixtures/layout.pug", + "isInline": false, + "line": 3, + "name": "html", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/1794-extends.pug b/node_modules/pug-linker/test/cases-src/auxiliary/1794-extends.pug new file mode 100644 index 0000000..99649d6 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/1794-extends.pug @@ -0,0 +1 @@ +block content \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/1794-include.pug b/node_modules/pug-linker/test/cases-src/auxiliary/1794-include.pug new file mode 100644 index 0000000..b9c03b4 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/1794-include.pug @@ -0,0 +1,4 @@ +mixin test() + .test&attributes(attributes) + ++test() \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/blocks-in-blocks-layout.pug b/node_modules/pug-linker/test/cases-src/auxiliary/blocks-in-blocks-layout.pug new file mode 100644 index 0000000..17ca8a0 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/blocks-in-blocks-layout.pug @@ -0,0 +1,8 @@ +doctype html +html + head + title Default title + body + block body + .container + block content diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/dialog.pug b/node_modules/pug-linker/test/cases-src/auxiliary/dialog.pug new file mode 100644 index 0000000..607bdec --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/dialog.pug @@ -0,0 +1,6 @@ + +extends window.pug + +block window-content + .dialog + block content diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/empty-block.pug b/node_modules/pug-linker/test/cases-src/auxiliary/empty-block.pug new file mode 100644 index 0000000..776e5fe --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/empty-block.pug @@ -0,0 +1,2 @@ +block test + diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/escapes.html b/node_modules/pug-linker/test/cases-src/auxiliary/escapes.html new file mode 100644 index 0000000..69e3701 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/escapes.html @@ -0,0 +1,3 @@ + diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/extends-empty-block-1.pug b/node_modules/pug-linker/test/cases-src/auxiliary/extends-empty-block-1.pug new file mode 100644 index 0000000..2729803 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/extends-empty-block-1.pug @@ -0,0 +1,5 @@ +extends empty-block.pug + +block test + div test1 + diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/extends-empty-block-2.pug b/node_modules/pug-linker/test/cases-src/auxiliary/extends-empty-block-2.pug new file mode 100644 index 0000000..beb2e83 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/extends-empty-block-2.pug @@ -0,0 +1,5 @@ +extends empty-block.pug + +block test + div test2 + diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/extends-from-root.pug b/node_modules/pug-linker/test/cases-src/auxiliary/extends-from-root.pug new file mode 100644 index 0000000..da52beb --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/extends-from-root.pug @@ -0,0 +1,4 @@ +extends /auxiliary/layout.pug + +block content + include /auxiliary/include-from-root.pug diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/extends-relative.pug b/node_modules/pug-linker/test/cases-src/auxiliary/extends-relative.pug new file mode 100644 index 0000000..7a2ecc4 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/extends-relative.pug @@ -0,0 +1,4 @@ +extends ../../cases-src/auxiliary/layout + +block content + include ../../cases-src/auxiliary/include-from-root diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/filter-in-include.pug b/node_modules/pug-linker/test/cases-src/auxiliary/filter-in-include.pug new file mode 100644 index 0000000..a3df945 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/filter-in-include.pug @@ -0,0 +1,8 @@ +html + head + style(type="text/css") + :less + @pad: 15px; + body { + padding: @pad; + } diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/includable.js b/node_modules/pug-linker/test/cases-src/auxiliary/includable.js new file mode 100644 index 0000000..f3efe1e --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/includable.js @@ -0,0 +1,7 @@ +var STRING_SUBSTITUTIONS = { // table of character substitutions + '\t': '\\t', + '\r': '\\r', + '\n': '\\n', + '"' : '\\"', + '\\': '\\\\' +}; \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/include-from-root.pug b/node_modules/pug-linker/test/cases-src/auxiliary/include-from-root.pug new file mode 100644 index 0000000..93c364b --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/include-from-root.pug @@ -0,0 +1 @@ +h1 hello \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.mixin.block.pug b/node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.mixin.block.pug new file mode 100644 index 0000000..890febc --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.mixin.block.pug @@ -0,0 +1,11 @@ +mixin article() + article + block + +html + head + title My Application + block head + body + +article + block content diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.recursive-grand-grandparent.pug b/node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.recursive-grand-grandparent.pug new file mode 100644 index 0000000..61033fa --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.recursive-grand-grandparent.pug @@ -0,0 +1,2 @@ +h1 grand-grandparent +block grand-grandparent \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.recursive-grandparent.pug b/node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.recursive-grandparent.pug new file mode 100644 index 0000000..f8ad4b8 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.recursive-grandparent.pug @@ -0,0 +1,6 @@ +extends inheritance.extend.recursive-grand-grandparent.pug + +block grand-grandparent + h2 grandparent + block grandparent + diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.recursive-parent.pug b/node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.recursive-parent.pug new file mode 100644 index 0000000..72d7230 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/inheritance.extend.recursive-parent.pug @@ -0,0 +1,5 @@ +extends inheritance.extend.recursive-grandparent.pug + +block grandparent + h3 parent + block parent \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/layout.include.pug b/node_modules/pug-linker/test/cases-src/auxiliary/layout.include.pug new file mode 100644 index 0000000..96734bf --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/layout.include.pug @@ -0,0 +1,7 @@ +html + head + title My Application + block head + body + block content + include window.pug diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/layout.pug b/node_modules/pug-linker/test/cases-src/auxiliary/layout.pug new file mode 100644 index 0000000..7d183b3 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/layout.pug @@ -0,0 +1,6 @@ +html + head + title My Application + block head + body + block content \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/mixin-at-end-of-file.pug b/node_modules/pug-linker/test/cases-src/auxiliary/mixin-at-end-of-file.pug new file mode 100644 index 0000000..e51eb01 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/mixin-at-end-of-file.pug @@ -0,0 +1,3 @@ +mixin slide + section.slide + block \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/mixins.pug b/node_modules/pug-linker/test/cases-src/auxiliary/mixins.pug new file mode 100644 index 0000000..0c14c1d --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/mixins.pug @@ -0,0 +1,3 @@ + +mixin foo() + p bar \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/pet.pug b/node_modules/pug-linker/test/cases-src/auxiliary/pet.pug new file mode 100644 index 0000000..ebee3a8 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/pet.pug @@ -0,0 +1,3 @@ +.pet + h1 {{name}} + p {{name}} is a {{species}} that is {{age}} old \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/smile.html b/node_modules/pug-linker/test/cases-src/auxiliary/smile.html new file mode 100644 index 0000000..3eadc80 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/smile.html @@ -0,0 +1 @@ +

:)

diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/window.pug b/node_modules/pug-linker/test/cases-src/auxiliary/window.pug new file mode 100644 index 0000000..7ab7132 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/window.pug @@ -0,0 +1,4 @@ + +.window + a(href='#').close Close + block window-content \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases-src/auxiliary/yield-nested.pug b/node_modules/pug-linker/test/cases-src/auxiliary/yield-nested.pug new file mode 100644 index 0000000..0771c0a --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/auxiliary/yield-nested.pug @@ -0,0 +1,10 @@ +html + head + title + body + h1 Page + #content + #content-wrapper + yield + #footer + stuff \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases-src/include-extends-from-root.pug b/node_modules/pug-linker/test/cases-src/include-extends-from-root.pug new file mode 100644 index 0000000..a79a57d --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/include-extends-from-root.pug @@ -0,0 +1 @@ +include /auxiliary/extends-from-root.pug diff --git a/node_modules/pug-linker/test/cases-src/include-extends-of-common-template.pug b/node_modules/pug-linker/test/cases-src/include-extends-of-common-template.pug new file mode 100644 index 0000000..2511f52 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/include-extends-of-common-template.pug @@ -0,0 +1,2 @@ +include auxiliary/extends-empty-block-1.pug +include auxiliary/extends-empty-block-2.pug diff --git a/node_modules/pug-linker/test/cases-src/include-extends-relative.pug b/node_modules/pug-linker/test/cases-src/include-extends-relative.pug new file mode 100644 index 0000000..f1648ff --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/include-extends-relative.pug @@ -0,0 +1 @@ +include ../cases-src/auxiliary/extends-relative.pug diff --git a/node_modules/pug-linker/test/cases-src/include-filter-coffee.coffee b/node_modules/pug-linker/test/cases-src/include-filter-coffee.coffee new file mode 100644 index 0000000..9723cd7 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/include-filter-coffee.coffee @@ -0,0 +1,2 @@ +math = + square: (value) -> value * value diff --git a/node_modules/pug-linker/test/cases-src/include-filter-stylus.pug b/node_modules/pug-linker/test/cases-src/include-filter-stylus.pug new file mode 100644 index 0000000..eefd3c1 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/include-filter-stylus.pug @@ -0,0 +1,2 @@ +style(type="text/css") + include:stylus some.styl diff --git a/node_modules/pug-linker/test/cases-src/include-filter.pug b/node_modules/pug-linker/test/cases-src/include-filter.pug new file mode 100644 index 0000000..e7ea3db --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/include-filter.pug @@ -0,0 +1,7 @@ +html + body + include:markdown-it some.md + script + include:coffee-script(minify=true) include-filter-coffee.coffee + script + include:coffee-script(minify=false) include-filter-coffee.coffee diff --git a/node_modules/pug-linker/test/cases-src/include-only-text-body.pug b/node_modules/pug-linker/test/cases-src/include-only-text-body.pug new file mode 100644 index 0000000..fdb080c --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/include-only-text-body.pug @@ -0,0 +1,3 @@ +| The message is " +yield +| " diff --git a/node_modules/pug-linker/test/cases-src/include-only-text.pug b/node_modules/pug-linker/test/cases-src/include-only-text.pug new file mode 100644 index 0000000..ede4f0f --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/include-only-text.pug @@ -0,0 +1,5 @@ +html + body + p + include include-only-text-body.pug + em hello world diff --git a/node_modules/pug-linker/test/cases-src/include-with-text-head.pug b/node_modules/pug-linker/test/cases-src/include-with-text-head.pug new file mode 100644 index 0000000..4e670c0 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/include-with-text-head.pug @@ -0,0 +1,3 @@ +head + script(type='text/javascript'). + alert('hello world'); diff --git a/node_modules/pug-linker/test/cases-src/include-with-text.pug b/node_modules/pug-linker/test/cases-src/include-with-text.pug new file mode 100644 index 0000000..bc83ea5 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/include-with-text.pug @@ -0,0 +1,4 @@ +html + include include-with-text-head.pug + script(src='/caustic.js') + script(src='/app.js') diff --git a/node_modules/pug-linker/test/cases-src/include.script.pug b/node_modules/pug-linker/test/cases-src/include.script.pug new file mode 100644 index 0000000..f449144 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/include.script.pug @@ -0,0 +1,2 @@ +script#pet-template(type='text/x-template') + include auxiliary/pet.pug diff --git a/node_modules/pug-linker/test/cases-src/include.yield.nested.pug b/node_modules/pug-linker/test/cases-src/include.yield.nested.pug new file mode 100644 index 0000000..f4a7d69 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/include.yield.nested.pug @@ -0,0 +1,4 @@ + +include auxiliary/yield-nested.pug + p some content + p and some more diff --git a/node_modules/pug-linker/test/cases-src/includes-with-ext-js.pug b/node_modules/pug-linker/test/cases-src/includes-with-ext-js.pug new file mode 100644 index 0000000..65bfa8a --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/includes-with-ext-js.pug @@ -0,0 +1,3 @@ +pre + code + include javascript-new-lines.js diff --git a/node_modules/pug-linker/test/cases-src/includes.pug b/node_modules/pug-linker/test/cases-src/includes.pug new file mode 100644 index 0000000..7761ce2 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/includes.pug @@ -0,0 +1,10 @@ + +include auxiliary/mixins.pug + ++foo + +body + include auxiliary/smile.html + include auxiliary/escapes.html + script(type="text/javascript") + include:verbatim auxiliary/includable.js diff --git a/node_modules/pug-linker/test/cases-src/javascript-new-lines.js b/node_modules/pug-linker/test/cases-src/javascript-new-lines.js new file mode 100644 index 0000000..6893341 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/javascript-new-lines.js @@ -0,0 +1 @@ +var x = "\n here is some \n new lined text"; diff --git a/node_modules/pug-linker/test/cases-src/layout.append.pug b/node_modules/pug-linker/test/cases-src/layout.append.pug new file mode 100644 index 0000000..d771bc9 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/layout.append.pug @@ -0,0 +1,6 @@ + +extends ../fixtures/append/app-layout.pug + +block append head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug-linker/test/cases-src/layout.append.without-block.pug b/node_modules/pug-linker/test/cases-src/layout.append.without-block.pug new file mode 100644 index 0000000..19842fc --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/layout.append.without-block.pug @@ -0,0 +1,6 @@ + +extends ../fixtures/append-without-block/app-layout.pug + +append head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug-linker/test/cases-src/layout.multi.append.prepend.block.pug b/node_modules/pug-linker/test/cases-src/layout.multi.append.prepend.block.pug new file mode 100644 index 0000000..79d15b1 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/layout.multi.append.prepend.block.pug @@ -0,0 +1,19 @@ +extends ../fixtures/multi-append-prepend-block/redefine.pug + +append content + p.first.append Something appended to content + +prepend content + p.first.prepend Something prepended to content + +append content + p.last.append Last append must be most last + +prepend content + p.last.prepend Last prepend must appear at top + +append head + script(src='jquery.js') + +prepend head + script(src='foo.js') diff --git a/node_modules/pug-linker/test/cases-src/layout.prepend.pug b/node_modules/pug-linker/test/cases-src/layout.prepend.pug new file mode 100644 index 0000000..4659a11 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/layout.prepend.pug @@ -0,0 +1,6 @@ + +extends ../fixtures/prepend/app-layout.pug + +block prepend head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug-linker/test/cases-src/layout.prepend.without-block.pug b/node_modules/pug-linker/test/cases-src/layout.prepend.without-block.pug new file mode 100644 index 0000000..516d01b --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/layout.prepend.without-block.pug @@ -0,0 +1,6 @@ + +extends ../fixtures/prepend-without-block/app-layout.pug + +prepend head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug-linker/test/cases-src/some-included.styl b/node_modules/pug-linker/test/cases-src/some-included.styl new file mode 100644 index 0000000..7458543 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/some-included.styl @@ -0,0 +1,2 @@ +body + padding 10px diff --git a/node_modules/pug-linker/test/cases-src/some.md b/node_modules/pug-linker/test/cases-src/some.md new file mode 100644 index 0000000..8ea3e54 --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/some.md @@ -0,0 +1,3 @@ +Just _some_ markdown **tests**. + +With new line. diff --git a/node_modules/pug-linker/test/cases-src/some.styl b/node_modules/pug-linker/test/cases-src/some.styl new file mode 100644 index 0000000..f77222d --- /dev/null +++ b/node_modules/pug-linker/test/cases-src/some.styl @@ -0,0 +1 @@ +@import "some-included" diff --git a/node_modules/pug-linker/test/cases/include-extends-from-root.input.json b/node_modules/pug-linker/test/cases/include-extends-from-root.input.json new file mode 100644 index 0000000..dc58773 --- /dev/null +++ b/node_modules/pug-linker/test/cases/include-extends-from-root.input.json @@ -0,0 +1,201 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Include", + "file": { + "type": "FileReference", + "line": 1, + "filename": "include-extends-from-root.pug", + "path": "/auxiliary/extends-from-root.pug", + "fullPath": "auxiliary/extends-from-root.pug", + "str": "extends /auxiliary/layout.pug\n\nblock content\n include /auxiliary/include-from-root.pug\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "/auxiliary/layout.pug", + "line": 1, + "filename": "auxiliary/extends-from-root.pug", + "fullPath": "auxiliary/layout.pug", + "str": "html\n head\n title My Application\n block head\n body\n block content", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "head", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "title", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "My Application", + "line": 3, + "filename": "auxiliary/layout.pug" + } + ], + "line": 3, + "filename": "auxiliary/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "auxiliary/layout.pug" + }, + { + "type": "NamedBlock", + "nodes": [], + "line": 4, + "filename": "auxiliary/layout.pug", + "name": "head", + "mode": "replace" + } + ], + "line": 2, + "filename": "auxiliary/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "auxiliary/layout.pug" + }, + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [], + "line": 6, + "filename": "auxiliary/layout.pug", + "name": "content", + "mode": "replace" + } + ], + "line": 5, + "filename": "auxiliary/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "auxiliary/layout.pug" + } + ], + "line": 1, + "filename": "auxiliary/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "auxiliary/layout.pug" + } + ], + "line": 0, + "filename": "auxiliary/layout.pug" + } + }, + "line": 1, + "filename": "auxiliary/extends-from-root.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Include", + "file": { + "type": "FileReference", + "line": 4, + "filename": "auxiliary/extends-from-root.pug", + "path": "/auxiliary/include-from-root.pug", + "fullPath": "auxiliary/include-from-root.pug", + "str": "h1 hello", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "h1", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "hello", + "line": 1, + "filename": "auxiliary/include-from-root.pug" + } + ], + "line": 1, + "filename": "auxiliary/include-from-root.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "auxiliary/include-from-root.pug" + } + ], + "line": 0, + "filename": "auxiliary/include-from-root.pug" + } + }, + "line": 4, + "filename": "auxiliary/extends-from-root.pug", + "block": { + "type": "Block", + "nodes": [], + "line": 4, + "filename": "auxiliary/extends-from-root.pug" + } + } + ], + "line": 3, + "filename": "auxiliary/extends-from-root.pug", + "name": "content", + "mode": "replace" + } + ], + "line": 0, + "filename": "auxiliary/extends-from-root.pug" + } + }, + "line": 1, + "filename": "include-extends-from-root.pug", + "block": { + "type": "Block", + "nodes": [], + "line": 1, + "filename": "include-extends-from-root.pug" + } + } + ], + "line": 0, + "filename": "include-extends-from-root.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/include-extends-of-common-template.input.json b/node_modules/pug-linker/test/cases/include-extends-of-common-template.input.json new file mode 100644 index 0000000..a20f7f2 --- /dev/null +++ b/node_modules/pug-linker/test/cases/include-extends-of-common-template.input.json @@ -0,0 +1,179 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Include", + "file": { + "type": "FileReference", + "line": 1, + "filename": "include-extends-of-common-template.pug", + "path": "auxiliary/extends-empty-block-1.pug", + "fullPath": "auxiliary/extends-empty-block-1.pug", + "str": "extends empty-block.pug\n\nblock test\n div test1\n\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "empty-block.pug", + "line": 1, + "filename": "auxiliary/extends-empty-block-1.pug", + "fullPath": "auxiliary/empty-block.pug", + "str": "block test\n\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [], + "line": 1, + "filename": "auxiliary/empty-block.pug", + "name": "test", + "mode": "replace" + } + ], + "line": 0, + "filename": "auxiliary/empty-block.pug" + } + }, + "line": 1, + "filename": "auxiliary/extends-empty-block-1.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "div", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "test1", + "line": 4, + "filename": "auxiliary/extends-empty-block-1.pug" + } + ], + "line": 4, + "filename": "auxiliary/extends-empty-block-1.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "auxiliary/extends-empty-block-1.pug" + } + ], + "line": 3, + "filename": "auxiliary/extends-empty-block-1.pug", + "name": "test", + "mode": "replace" + } + ], + "line": 0, + "filename": "auxiliary/extends-empty-block-1.pug" + } + }, + "line": 1, + "filename": "include-extends-of-common-template.pug", + "block": { + "type": "Block", + "nodes": [], + "line": 1, + "filename": "include-extends-of-common-template.pug" + } + }, + { + "type": "Include", + "file": { + "type": "FileReference", + "line": 2, + "filename": "include-extends-of-common-template.pug", + "path": "auxiliary/extends-empty-block-2.pug", + "fullPath": "auxiliary/extends-empty-block-2.pug", + "str": "extends empty-block.pug\n\nblock test\n div test2\n\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "empty-block.pug", + "line": 1, + "filename": "auxiliary/extends-empty-block-2.pug", + "fullPath": "auxiliary/empty-block.pug", + "str": "block test\n\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [], + "line": 1, + "filename": "auxiliary/empty-block.pug", + "name": "test", + "mode": "replace" + } + ], + "line": 0, + "filename": "auxiliary/empty-block.pug" + } + }, + "line": 1, + "filename": "auxiliary/extends-empty-block-2.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "div", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "test2", + "line": 4, + "filename": "auxiliary/extends-empty-block-2.pug" + } + ], + "line": 4, + "filename": "auxiliary/extends-empty-block-2.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "auxiliary/extends-empty-block-2.pug" + } + ], + "line": 3, + "filename": "auxiliary/extends-empty-block-2.pug", + "name": "test", + "mode": "replace" + } + ], + "line": 0, + "filename": "auxiliary/extends-empty-block-2.pug" + } + }, + "line": 2, + "filename": "include-extends-of-common-template.pug", + "block": { + "type": "Block", + "nodes": [], + "line": 2, + "filename": "include-extends-of-common-template.pug" + } + } + ], + "line": 0, + "filename": "include-extends-of-common-template.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/include-extends-relative.input.json b/node_modules/pug-linker/test/cases/include-extends-relative.input.json new file mode 100644 index 0000000..7f3d560 --- /dev/null +++ b/node_modules/pug-linker/test/cases/include-extends-relative.input.json @@ -0,0 +1,166 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Include", + "file": { + "type": "FileReference", + "line": 1, + "filename": "include-extends-relative.pug", + "path": "../cases-src/auxiliary/extends-relative.pug", + "fullPath": "../cases-src/auxiliary/extends-relative.pug", + "str": "extends ../../cases-src/auxiliary/layout\n\nblock content\n include ../../cases-src/auxiliary/include-from-root\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "../../cases-src/auxiliary/layout", + "line": 1, + "filename": "../cases-src/auxiliary/extends-relative.pug", + "fullPath": "../cases-src/auxiliary/layout.pug", + "str": "html\n head\n title My Application\n block head\n body\n block content", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "head", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "title", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "My Application", + "line": 3, + "filename": "../cases-src/auxiliary/layout.pug" + } + ], + "line": 3, + "filename": "../cases-src/auxiliary/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "../cases-src/auxiliary/layout.pug" + }, + { + "type": "NamedBlock", + "nodes": [], + "line": 4, + "filename": "../cases-src/auxiliary/layout.pug", + "name": "head", + "mode": "replace" + } + ], + "line": 2, + "filename": "../cases-src/auxiliary/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "../cases-src/auxiliary/layout.pug" + }, + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [], + "line": 6, + "filename": "../cases-src/auxiliary/layout.pug", + "name": "content", + "mode": "replace" + } + ], + "line": 5, + "filename": "../cases-src/auxiliary/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "../cases-src/auxiliary/layout.pug" + } + ], + "line": 1, + "filename": "../cases-src/auxiliary/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "../cases-src/auxiliary/layout.pug" + } + ], + "line": 0, + "filename": "../cases-src/auxiliary/layout.pug" + } + }, + "line": 1, + "filename": "../cases-src/auxiliary/extends-relative.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "RawInclude", + "file": { + "type": "FileReference", + "line": 4, + "filename": "../cases-src/auxiliary/extends-relative.pug", + "path": "../../cases-src/auxiliary/include-from-root", + "fullPath": "../cases-src/auxiliary/include-from-root.pug", + "str": "h1 hello" + }, + "line": 4, + "filename": "../cases-src/auxiliary/extends-relative.pug", + "filters": [] + } + ], + "line": 3, + "filename": "../cases-src/auxiliary/extends-relative.pug", + "name": "content", + "mode": "replace" + } + ], + "line": 0, + "filename": "../cases-src/auxiliary/extends-relative.pug" + } + }, + "line": 1, + "filename": "include-extends-relative.pug", + "block": { + "type": "Block", + "nodes": [], + "line": 1, + "filename": "include-extends-relative.pug" + } + } + ], + "line": 0, + "filename": "include-extends-relative.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/include-filter-stylus.input.json b/node_modules/pug-linker/test/cases/include-filter-stylus.input.json new file mode 100644 index 0000000..3145a07 --- /dev/null +++ b/node_modules/pug-linker/test/cases/include-filter-stylus.input.json @@ -0,0 +1,52 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "style", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "RawInclude", + "file": { + "type": "FileReference", + "line": 2, + "filename": "include-filter-stylus.pug", + "path": "some.styl", + "fullPath": "some.styl", + "str": "@import \"some-included\"\n" + }, + "line": 2, + "filename": "include-filter-stylus.pug", + "filters": [ + { + "type": "IncludeFilter", + "name": "stylus", + "attrs": [], + "line": 2, + "filename": "include-filter-stylus.pug" + } + ] + } + ], + "line": 1, + "filename": "include-filter-stylus.pug" + }, + "attrs": [ + { + "name": "type", + "val": "\"text/css\"", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "include-filter-stylus.pug" + } + ], + "line": 0, + "filename": "include-filter-stylus.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/include-filter.input.json b/node_modules/pug-linker/test/cases/include-filter.input.json new file mode 100644 index 0000000..1f5d0c4 --- /dev/null +++ b/node_modules/pug-linker/test/cases/include-filter.input.json @@ -0,0 +1,153 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "RawInclude", + "file": { + "type": "FileReference", + "line": 3, + "filename": "include-filter.pug", + "path": "some.md", + "fullPath": "some.md", + "str": "Just _some_ markdown **tests**.\n\nWith new line.\n" + }, + "line": 3, + "filename": "include-filter.pug", + "filters": [ + { + "type": "IncludeFilter", + "name": "markdown-it", + "attrs": [], + "line": 3, + "filename": "include-filter.pug" + } + ] + }, + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "RawInclude", + "file": { + "type": "FileReference", + "line": 5, + "filename": "include-filter.pug", + "path": "include-filter-coffee.coffee", + "fullPath": "include-filter-coffee.coffee", + "str": "math =\n square: (value) -> value * value\n" + }, + "line": 5, + "filename": "include-filter.pug", + "filters": [ + { + "type": "IncludeFilter", + "name": "coffee-script", + "attrs": [ + { + "name": "minify", + "val": "true", + "mustEscape": true + } + ], + "line": 5, + "filename": "include-filter.pug" + } + ] + } + ], + "line": 4, + "filename": "include-filter.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "include-filter.pug" + }, + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "RawInclude", + "file": { + "type": "FileReference", + "line": 7, + "filename": "include-filter.pug", + "path": "include-filter-coffee.coffee", + "fullPath": "include-filter-coffee.coffee", + "str": "math =\n square: (value) -> value * value\n" + }, + "line": 7, + "filename": "include-filter.pug", + "filters": [ + { + "type": "IncludeFilter", + "name": "coffee-script", + "attrs": [ + { + "name": "minify", + "val": "false", + "mustEscape": true + } + ], + "line": 7, + "filename": "include-filter.pug" + } + ] + } + ], + "line": 6, + "filename": "include-filter.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 6, + "filename": "include-filter.pug" + } + ], + "line": 2, + "filename": "include-filter.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "include-filter.pug" + } + ], + "line": 1, + "filename": "include-filter.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "include-filter.pug" + } + ], + "line": 0, + "filename": "include-filter.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/include-only-text-body.input.json b/node_modules/pug-linker/test/cases/include-only-text-body.input.json new file mode 100644 index 0000000..82d7656 --- /dev/null +++ b/node_modules/pug-linker/test/cases/include-only-text-body.input.json @@ -0,0 +1,24 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "The message is \"", + "line": 1, + "filename": "include-only-text-body.pug" + }, + { + "type": "YieldBlock", + "line": 2, + "filename": "include-only-text-body.pug" + }, + { + "type": "Text", + "val": "\"", + "line": 3, + "filename": "include-only-text-body.pug" + } + ], + "line": 0, + "filename": "include-only-text-body.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/include-only-text.input.json b/node_modules/pug-linker/test/cases/include-only-text.input.json new file mode 100644 index 0000000..84d010a --- /dev/null +++ b/node_modules/pug-linker/test/cases/include-only-text.input.json @@ -0,0 +1,125 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Include", + "file": { + "type": "FileReference", + "line": 4, + "filename": "include-only-text.pug", + "path": "include-only-text-body.pug", + "fullPath": "include-only-text-body.pug", + "str": "| The message is \"\nyield\n| \"\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "The message is \"", + "line": 1, + "filename": "include-only-text-body.pug" + }, + { + "type": "YieldBlock", + "line": 2, + "filename": "include-only-text-body.pug" + }, + { + "type": "Text", + "val": "\"", + "line": 3, + "filename": "include-only-text-body.pug" + } + ], + "line": 0, + "filename": "include-only-text-body.pug" + } + }, + "line": 4, + "filename": "include-only-text.pug", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "em", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "hello world", + "line": 5, + "filename": "include-only-text.pug" + } + ], + "line": 5, + "filename": "include-only-text.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": true, + "line": 5, + "filename": "include-only-text.pug" + } + ], + "line": 5, + "filename": "include-only-text.pug" + } + } + ], + "line": 3, + "filename": "include-only-text.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "include-only-text.pug" + } + ], + "line": 2, + "filename": "include-only-text.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "include-only-text.pug" + } + ], + "line": 1, + "filename": "include-only-text.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "include-only-text.pug" + } + ], + "line": 0, + "filename": "include-only-text.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/include-with-text-head.input.json b/node_modules/pug-linker/test/cases/include-with-text-head.input.json new file mode 100644 index 0000000..03d7151 --- /dev/null +++ b/node_modules/pug-linker/test/cases/include-with-text-head.input.json @@ -0,0 +1,53 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "head", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "alert('hello world');", + "line": 3 + } + ], + "line": 2, + "filename": "include-with-text-head.pug" + }, + "attrs": [ + { + "name": "type", + "val": "'text/javascript'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "include-with-text-head.pug", + "textOnly": true + } + ], + "line": 1, + "filename": "include-with-text-head.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "include-with-text-head.pug" + } + ], + "line": 0, + "filename": "include-with-text-head.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/include-with-text.input.json b/node_modules/pug-linker/test/cases/include-with-text.input.json new file mode 100644 index 0000000..128c078 --- /dev/null +++ b/node_modules/pug-linker/test/cases/include-with-text.input.json @@ -0,0 +1,141 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Include", + "file": { + "type": "FileReference", + "line": 2, + "filename": "include-with-text.pug", + "path": "include-with-text-head.pug", + "fullPath": "include-with-text-head.pug", + "str": "head\n script(type='text/javascript').\n alert('hello world');\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "head", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "alert('hello world');", + "line": 3 + } + ], + "line": 2, + "filename": "include-with-text-head.pug" + }, + "attrs": [ + { + "name": "type", + "val": "'text/javascript'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "include-with-text-head.pug", + "textOnly": true + } + ], + "line": 1, + "filename": "include-with-text-head.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "include-with-text-head.pug" + } + ], + "line": 0, + "filename": "include-with-text-head.pug" + } + }, + "line": 2, + "filename": "include-with-text.pug", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 3, + "filename": "include-with-text.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'/caustic.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "include-with-text.pug" + }, + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 4, + "filename": "include-with-text.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'/app.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "include-with-text.pug" + } + ], + "line": 3, + "filename": "include-with-text.pug" + } + } + ], + "line": 1, + "filename": "include-with-text.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "include-with-text.pug" + } + ], + "line": 0, + "filename": "include-with-text.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/include.script.input.json b/node_modules/pug-linker/test/cases/include.script.input.json new file mode 100644 index 0000000..315b120 --- /dev/null +++ b/node_modules/pug-linker/test/cases/include.script.input.json @@ -0,0 +1,130 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Include", + "file": { + "type": "FileReference", + "line": 2, + "filename": "include.script.pug", + "path": "auxiliary/pet.pug", + "fullPath": "auxiliary/pet.pug", + "str": ".pet\n h1 {{name}}\n p {{name}} is a {{species}} that is {{age}} old", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "div", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "h1", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "{{name}}", + "line": 2, + "filename": "auxiliary/pet.pug" + } + ], + "line": 2, + "filename": "auxiliary/pet.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "auxiliary/pet.pug" + }, + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "{{name}} is a {{species}} that is {{age}} old", + "line": 3, + "filename": "auxiliary/pet.pug" + } + ], + "line": 3, + "filename": "auxiliary/pet.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "auxiliary/pet.pug" + } + ], + "line": 1, + "filename": "auxiliary/pet.pug" + }, + "attrs": [ + { + "name": "class", + "val": "'pet'", + "mustEscape": false + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "auxiliary/pet.pug" + } + ], + "line": 0, + "filename": "auxiliary/pet.pug" + } + }, + "line": 2, + "filename": "include.script.pug", + "block": { + "type": "Block", + "nodes": [], + "line": 2, + "filename": "include.script.pug" + } + } + ], + "line": 1, + "filename": "include.script.pug" + }, + "attrs": [ + { + "name": "id", + "val": "'pet-template'", + "mustEscape": false + }, + { + "name": "type", + "val": "'text/x-template'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "include.script.pug" + } + ], + "line": 0, + "filename": "include.script.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/include.yield.nested.input.json b/node_modules/pug-linker/test/cases/include.yield.nested.input.json new file mode 100644 index 0000000..3c69e4c --- /dev/null +++ b/node_modules/pug-linker/test/cases/include.yield.nested.input.json @@ -0,0 +1,260 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Include", + "file": { + "type": "FileReference", + "line": 2, + "filename": "include.yield.nested.pug", + "path": "auxiliary/yield-nested.pug", + "fullPath": "auxiliary/yield-nested.pug", + "str": "html\n head\n title\n body\n h1 Page\n #content\n #content-wrapper\n yield\n #footer\n stuff", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "head", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "title", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 3, + "filename": "auxiliary/yield-nested.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "auxiliary/yield-nested.pug" + } + ], + "line": 2, + "filename": "auxiliary/yield-nested.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "auxiliary/yield-nested.pug" + }, + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "h1", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "Page", + "line": 5, + "filename": "auxiliary/yield-nested.pug" + } + ], + "line": 5, + "filename": "auxiliary/yield-nested.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "auxiliary/yield-nested.pug" + }, + { + "type": "Tag", + "name": "div", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "div", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "YieldBlock", + "line": 8, + "filename": "auxiliary/yield-nested.pug" + } + ], + "line": 7, + "filename": "auxiliary/yield-nested.pug" + }, + "attrs": [ + { + "name": "id", + "val": "'content-wrapper'", + "mustEscape": false + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 7, + "filename": "auxiliary/yield-nested.pug" + } + ], + "line": 6, + "filename": "auxiliary/yield-nested.pug" + }, + "attrs": [ + { + "name": "id", + "val": "'content'", + "mustEscape": false + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 6, + "filename": "auxiliary/yield-nested.pug" + }, + { + "type": "Tag", + "name": "div", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "stuff", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 10, + "filename": "auxiliary/yield-nested.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 10, + "filename": "auxiliary/yield-nested.pug" + } + ], + "line": 9, + "filename": "auxiliary/yield-nested.pug" + }, + "attrs": [ + { + "name": "id", + "val": "'footer'", + "mustEscape": false + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 9, + "filename": "auxiliary/yield-nested.pug" + } + ], + "line": 4, + "filename": "auxiliary/yield-nested.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "auxiliary/yield-nested.pug" + } + ], + "line": 1, + "filename": "auxiliary/yield-nested.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "auxiliary/yield-nested.pug" + } + ], + "line": 0, + "filename": "auxiliary/yield-nested.pug" + } + }, + "line": 2, + "filename": "include.yield.nested.pug", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "some content", + "line": 3, + "filename": "include.yield.nested.pug" + } + ], + "line": 3, + "filename": "include.yield.nested.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "include.yield.nested.pug" + }, + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "and some more", + "line": 4, + "filename": "include.yield.nested.pug" + } + ], + "line": 4, + "filename": "include.yield.nested.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "include.yield.nested.pug" + } + ], + "line": 3, + "filename": "include.yield.nested.pug" + } + } + ], + "line": 0, + "filename": "include.yield.nested.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/includes-with-ext-js.input.json b/node_modules/pug-linker/test/cases/includes-with-ext-js.input.json new file mode 100644 index 0000000..cd88d12 --- /dev/null +++ b/node_modules/pug-linker/test/cases/includes-with-ext-js.input.json @@ -0,0 +1,55 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "pre", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "code", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "RawInclude", + "file": { + "type": "FileReference", + "line": 3, + "filename": "includes-with-ext-js.pug", + "path": "javascript-new-lines.js", + "fullPath": "javascript-new-lines.js", + "str": "var x = \"\\n here is some \\n new lined text\";\n" + }, + "line": 3, + "filename": "includes-with-ext-js.pug", + "filters": [] + } + ], + "line": 2, + "filename": "includes-with-ext-js.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": true, + "line": 2, + "filename": "includes-with-ext-js.pug" + } + ], + "line": 1, + "filename": "includes-with-ext-js.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "includes-with-ext-js.pug" + } + ], + "line": 0, + "filename": "includes-with-ext-js.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/includes.input.json b/node_modules/pug-linker/test/cases/includes.input.json new file mode 100644 index 0000000..79d5f89 --- /dev/null +++ b/node_modules/pug-linker/test/cases/includes.input.json @@ -0,0 +1,172 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Include", + "file": { + "type": "FileReference", + "line": 2, + "filename": "includes.pug", + "path": "auxiliary/mixins.pug", + "fullPath": "auxiliary/mixins.pug", + "str": "\nmixin foo()\n p bar", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Mixin", + "name": "foo", + "args": null, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "bar", + "line": 3, + "filename": "auxiliary/mixins.pug" + } + ], + "line": 3, + "filename": "auxiliary/mixins.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "auxiliary/mixins.pug" + } + ], + "line": 3, + "filename": "auxiliary/mixins.pug" + }, + "call": false, + "line": 2, + "filename": "auxiliary/mixins.pug" + } + ], + "line": 0, + "filename": "auxiliary/mixins.pug" + } + }, + "line": 2, + "filename": "includes.pug", + "block": { + "type": "Block", + "nodes": [], + "line": 2, + "filename": "includes.pug" + } + }, + { + "type": "Mixin", + "name": "foo", + "args": null, + "block": null, + "call": true, + "attrs": [], + "attributeBlocks": [], + "line": 4, + "filename": "includes.pug" + }, + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "RawInclude", + "file": { + "type": "FileReference", + "line": 7, + "filename": "includes.pug", + "path": "auxiliary/smile.html", + "fullPath": "auxiliary/smile.html", + "str": "

:)

\n" + }, + "line": 7, + "filename": "includes.pug", + "filters": [] + }, + { + "type": "RawInclude", + "file": { + "type": "FileReference", + "line": 8, + "filename": "includes.pug", + "path": "auxiliary/escapes.html", + "fullPath": "auxiliary/escapes.html", + "str": "\n" + }, + "line": 8, + "filename": "includes.pug", + "filters": [] + }, + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "RawInclude", + "file": { + "type": "FileReference", + "line": 10, + "filename": "includes.pug", + "path": "auxiliary/includable.js", + "fullPath": "auxiliary/includable.js", + "str": "var STRING_SUBSTITUTIONS = { // table of character substitutions\n '\\t': '\\\\t',\n '\\r': '\\\\r',\n '\\n': '\\\\n',\n '\"' : '\\\\\"',\n '\\\\': '\\\\\\\\'\n};" + }, + "line": 10, + "filename": "includes.pug", + "filters": [ + { + "type": "IncludeFilter", + "name": "verbatim", + "attrs": [], + "line": 10, + "filename": "includes.pug" + } + ] + } + ], + "line": 9, + "filename": "includes.pug" + }, + "attrs": [ + { + "name": "type", + "val": "\"text/javascript\"", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 9, + "filename": "includes.pug" + } + ], + "line": 6, + "filename": "includes.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 6, + "filename": "includes.pug" + } + ], + "line": 0, + "filename": "includes.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/layout.append.input.json b/node_modules/pug-linker/test/cases/layout.append.input.json new file mode 100644 index 0000000..2b8879a --- /dev/null +++ b/node_modules/pug-linker/test/cases/layout.append.input.json @@ -0,0 +1,226 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "../fixtures/append/app-layout.pug", + "line": 2, + "filename": "layout.append.pug", + "fullPath": "../fixtures/append/app-layout.pug", + "str": "\nextends layout\n\nblock append head\n script(src='app.js')", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "layout", + "line": 2, + "filename": "../fixtures/append/app-layout.pug", + "fullPath": "../fixtures/append/layout.pug", + "str": "\nhtml\n block head\n script(src='vendor/jquery.js')\n script(src='vendor/caustic.js')\n body\n block body", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 4, + "filename": "../fixtures/append/layout.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'vendor/jquery.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "../fixtures/append/layout.pug" + }, + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 5, + "filename": "../fixtures/append/layout.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'vendor/caustic.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "../fixtures/append/layout.pug" + } + ], + "line": 3, + "filename": "../fixtures/append/layout.pug", + "name": "head", + "mode": "replace" + }, + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [], + "line": 7, + "filename": "../fixtures/append/layout.pug", + "name": "body", + "mode": "replace" + } + ], + "line": 6, + "filename": "../fixtures/append/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 6, + "filename": "../fixtures/append/layout.pug" + } + ], + "line": 2, + "filename": "../fixtures/append/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "../fixtures/append/layout.pug" + } + ], + "line": 0, + "filename": "../fixtures/append/layout.pug" + } + }, + "line": 2, + "filename": "../fixtures/append/app-layout.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 5, + "filename": "../fixtures/append/app-layout.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'app.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "../fixtures/append/app-layout.pug" + } + ], + "line": 4, + "filename": "../fixtures/append/app-layout.pug", + "name": "head", + "mode": "append" + } + ], + "line": 0, + "filename": "../fixtures/append/app-layout.pug" + } + }, + "line": 2, + "filename": "layout.append.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 5, + "filename": "layout.append.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'foo.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "layout.append.pug" + }, + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 6, + "filename": "layout.append.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'bar.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 6, + "filename": "layout.append.pug" + } + ], + "line": 4, + "filename": "layout.append.pug", + "name": "head", + "mode": "append" + } + ], + "line": 0, + "filename": "layout.append.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/layout.append.without-block.input.json b/node_modules/pug-linker/test/cases/layout.append.without-block.input.json new file mode 100644 index 0000000..4fc3d87 --- /dev/null +++ b/node_modules/pug-linker/test/cases/layout.append.without-block.input.json @@ -0,0 +1,226 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "../fixtures/append-without-block/app-layout.pug", + "line": 2, + "filename": "layout.append.without-block.pug", + "fullPath": "../fixtures/append-without-block/app-layout.pug", + "str": "\nextends layout.pug\n\nappend head\n script(src='app.js')\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "layout.pug", + "line": 2, + "filename": "../fixtures/append-without-block/app-layout.pug", + "fullPath": "../fixtures/append-without-block/layout.pug", + "str": "\nhtml\n block head\n script(src='vendor/jquery.js')\n script(src='vendor/caustic.js')\n body\n block body", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 4, + "filename": "../fixtures/append-without-block/layout.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'vendor/jquery.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "../fixtures/append-without-block/layout.pug" + }, + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 5, + "filename": "../fixtures/append-without-block/layout.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'vendor/caustic.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "../fixtures/append-without-block/layout.pug" + } + ], + "line": 3, + "filename": "../fixtures/append-without-block/layout.pug", + "name": "head", + "mode": "replace" + }, + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [], + "line": 7, + "filename": "../fixtures/append-without-block/layout.pug", + "name": "body", + "mode": "replace" + } + ], + "line": 6, + "filename": "../fixtures/append-without-block/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 6, + "filename": "../fixtures/append-without-block/layout.pug" + } + ], + "line": 2, + "filename": "../fixtures/append-without-block/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "../fixtures/append-without-block/layout.pug" + } + ], + "line": 0, + "filename": "../fixtures/append-without-block/layout.pug" + } + }, + "line": 2, + "filename": "../fixtures/append-without-block/app-layout.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 5, + "filename": "../fixtures/append-without-block/app-layout.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'app.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "../fixtures/append-without-block/app-layout.pug" + } + ], + "line": 4, + "filename": "../fixtures/append-without-block/app-layout.pug", + "name": "head", + "mode": "append" + } + ], + "line": 0, + "filename": "../fixtures/append-without-block/app-layout.pug" + } + }, + "line": 2, + "filename": "layout.append.without-block.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 5, + "filename": "layout.append.without-block.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'foo.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "layout.append.without-block.pug" + }, + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 6, + "filename": "layout.append.without-block.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'bar.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 6, + "filename": "layout.append.without-block.pug" + } + ], + "line": 4, + "filename": "layout.append.without-block.pug", + "name": "head", + "mode": "append" + } + ], + "line": 0, + "filename": "layout.append.without-block.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/layout.multi.append.prepend.block.input.json b/node_modules/pug-linker/test/cases/layout.multi.append.prepend.block.input.json new file mode 100644 index 0000000..cdd8d01 --- /dev/null +++ b/node_modules/pug-linker/test/cases/layout.multi.append.prepend.block.input.json @@ -0,0 +1,365 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "../fixtures/multi-append-prepend-block/redefine.pug", + "line": 1, + "filename": "layout.multi.append.prepend.block.pug", + "fullPath": "../fixtures/multi-append-prepend-block/redefine.pug", + "str": "extends root.pug\n\nblock content\n\t.content\n\t\t| Defined content\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "root.pug", + "line": 1, + "filename": "../fixtures/multi-append-prepend-block/redefine.pug", + "fullPath": "../fixtures/multi-append-prepend-block/root.pug", + "str": "block content\n\t| default content\n\nblock head\n\tscript(src='/app.js')", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Text", + "val": "default content", + "line": 2, + "filename": "../fixtures/multi-append-prepend-block/root.pug" + } + ], + "line": 1, + "filename": "../fixtures/multi-append-prepend-block/root.pug", + "name": "content", + "mode": "replace" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 5, + "filename": "../fixtures/multi-append-prepend-block/root.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'/app.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "../fixtures/multi-append-prepend-block/root.pug" + } + ], + "line": 4, + "filename": "../fixtures/multi-append-prepend-block/root.pug", + "name": "head", + "mode": "replace" + } + ], + "line": 0, + "filename": "../fixtures/multi-append-prepend-block/root.pug" + } + }, + "line": 1, + "filename": "../fixtures/multi-append-prepend-block/redefine.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "div", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "Defined content", + "line": 5, + "filename": "../fixtures/multi-append-prepend-block/redefine.pug" + } + ], + "line": 4, + "filename": "../fixtures/multi-append-prepend-block/redefine.pug" + }, + "attrs": [ + { + "name": "class", + "val": "'content'", + "mustEscape": false + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "../fixtures/multi-append-prepend-block/redefine.pug" + } + ], + "line": 3, + "filename": "../fixtures/multi-append-prepend-block/redefine.pug", + "name": "content", + "mode": "replace" + } + ], + "line": 0, + "filename": "../fixtures/multi-append-prepend-block/redefine.pug" + } + }, + "line": 1, + "filename": "layout.multi.append.prepend.block.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "Something appended to content", + "line": 4, + "filename": "layout.multi.append.prepend.block.pug" + } + ], + "line": 4, + "filename": "layout.multi.append.prepend.block.pug" + }, + "attrs": [ + { + "name": "class", + "val": "'first'", + "mustEscape": false + }, + { + "name": "class", + "val": "'append'", + "mustEscape": false + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "layout.multi.append.prepend.block.pug" + } + ], + "line": 3, + "filename": "layout.multi.append.prepend.block.pug", + "name": "content", + "mode": "append" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "Something prepended to content", + "line": 7, + "filename": "layout.multi.append.prepend.block.pug" + } + ], + "line": 7, + "filename": "layout.multi.append.prepend.block.pug" + }, + "attrs": [ + { + "name": "class", + "val": "'first'", + "mustEscape": false + }, + { + "name": "class", + "val": "'prepend'", + "mustEscape": false + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 7, + "filename": "layout.multi.append.prepend.block.pug" + } + ], + "line": 6, + "filename": "layout.multi.append.prepend.block.pug", + "name": "content", + "mode": "prepend" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "Last append must be most last", + "line": 10, + "filename": "layout.multi.append.prepend.block.pug" + } + ], + "line": 10, + "filename": "layout.multi.append.prepend.block.pug" + }, + "attrs": [ + { + "name": "class", + "val": "'last'", + "mustEscape": false + }, + { + "name": "class", + "val": "'append'", + "mustEscape": false + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 10, + "filename": "layout.multi.append.prepend.block.pug" + } + ], + "line": 9, + "filename": "layout.multi.append.prepend.block.pug", + "name": "content", + "mode": "append" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "Last prepend must appear at top", + "line": 13, + "filename": "layout.multi.append.prepend.block.pug" + } + ], + "line": 13, + "filename": "layout.multi.append.prepend.block.pug" + }, + "attrs": [ + { + "name": "class", + "val": "'last'", + "mustEscape": false + }, + { + "name": "class", + "val": "'prepend'", + "mustEscape": false + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 13, + "filename": "layout.multi.append.prepend.block.pug" + } + ], + "line": 12, + "filename": "layout.multi.append.prepend.block.pug", + "name": "content", + "mode": "prepend" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 16, + "filename": "layout.multi.append.prepend.block.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'jquery.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 16, + "filename": "layout.multi.append.prepend.block.pug" + } + ], + "line": 15, + "filename": "layout.multi.append.prepend.block.pug", + "name": "head", + "mode": "append" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 19, + "filename": "layout.multi.append.prepend.block.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'foo.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 19, + "filename": "layout.multi.append.prepend.block.pug" + } + ], + "line": 18, + "filename": "layout.multi.append.prepend.block.pug", + "name": "head", + "mode": "prepend" + } + ], + "line": 0, + "filename": "layout.multi.append.prepend.block.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/layout.prepend.input.json b/node_modules/pug-linker/test/cases/layout.prepend.input.json new file mode 100644 index 0000000..44a5cc0 --- /dev/null +++ b/node_modules/pug-linker/test/cases/layout.prepend.input.json @@ -0,0 +1,226 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "../fixtures/prepend/app-layout.pug", + "line": 2, + "filename": "layout.prepend.pug", + "fullPath": "../fixtures/prepend/app-layout.pug", + "str": "\nextends layout.pug\n\nblock prepend head\n script(src='app.js')\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "layout.pug", + "line": 2, + "filename": "../fixtures/prepend/app-layout.pug", + "fullPath": "../fixtures/prepend/layout.pug", + "str": "\nhtml\n block head\n script(src='vendor/jquery.js')\n script(src='vendor/caustic.js')\n body\n block body", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 4, + "filename": "../fixtures/prepend/layout.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'vendor/jquery.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "../fixtures/prepend/layout.pug" + }, + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 5, + "filename": "../fixtures/prepend/layout.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'vendor/caustic.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "../fixtures/prepend/layout.pug" + } + ], + "line": 3, + "filename": "../fixtures/prepend/layout.pug", + "name": "head", + "mode": "replace" + }, + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [], + "line": 7, + "filename": "../fixtures/prepend/layout.pug", + "name": "body", + "mode": "replace" + } + ], + "line": 6, + "filename": "../fixtures/prepend/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 6, + "filename": "../fixtures/prepend/layout.pug" + } + ], + "line": 2, + "filename": "../fixtures/prepend/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "../fixtures/prepend/layout.pug" + } + ], + "line": 0, + "filename": "../fixtures/prepend/layout.pug" + } + }, + "line": 2, + "filename": "../fixtures/prepend/app-layout.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 5, + "filename": "../fixtures/prepend/app-layout.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'app.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "../fixtures/prepend/app-layout.pug" + } + ], + "line": 4, + "filename": "../fixtures/prepend/app-layout.pug", + "name": "head", + "mode": "prepend" + } + ], + "line": 0, + "filename": "../fixtures/prepend/app-layout.pug" + } + }, + "line": 2, + "filename": "layout.prepend.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 5, + "filename": "layout.prepend.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'foo.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "layout.prepend.pug" + }, + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 6, + "filename": "layout.prepend.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'bar.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 6, + "filename": "layout.prepend.pug" + } + ], + "line": 4, + "filename": "layout.prepend.pug", + "name": "head", + "mode": "prepend" + } + ], + "line": 0, + "filename": "layout.prepend.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/cases/layout.prepend.without-block.input.json b/node_modules/pug-linker/test/cases/layout.prepend.without-block.input.json new file mode 100644 index 0000000..d94e193 --- /dev/null +++ b/node_modules/pug-linker/test/cases/layout.prepend.without-block.input.json @@ -0,0 +1,226 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "../fixtures/prepend-without-block/app-layout.pug", + "line": 2, + "filename": "layout.prepend.without-block.pug", + "fullPath": "../fixtures/prepend-without-block/app-layout.pug", + "str": "\nextends layout.pug\n\nprepend head\n script(src='app.js')\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "layout.pug", + "line": 2, + "filename": "../fixtures/prepend-without-block/app-layout.pug", + "fullPath": "../fixtures/prepend-without-block/layout.pug", + "str": "\nhtml\n block head\n script(src='vendor/jquery.js')\n script(src='vendor/caustic.js')\n body\n block body", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 4, + "filename": "../fixtures/prepend-without-block/layout.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'vendor/jquery.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "../fixtures/prepend-without-block/layout.pug" + }, + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 5, + "filename": "../fixtures/prepend-without-block/layout.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'vendor/caustic.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "../fixtures/prepend-without-block/layout.pug" + } + ], + "line": 3, + "filename": "../fixtures/prepend-without-block/layout.pug", + "name": "head", + "mode": "replace" + }, + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [], + "line": 7, + "filename": "../fixtures/prepend-without-block/layout.pug", + "name": "body", + "mode": "replace" + } + ], + "line": 6, + "filename": "../fixtures/prepend-without-block/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 6, + "filename": "../fixtures/prepend-without-block/layout.pug" + } + ], + "line": 2, + "filename": "../fixtures/prepend-without-block/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "../fixtures/prepend-without-block/layout.pug" + } + ], + "line": 0, + "filename": "../fixtures/prepend-without-block/layout.pug" + } + }, + "line": 2, + "filename": "../fixtures/prepend-without-block/app-layout.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 5, + "filename": "../fixtures/prepend-without-block/app-layout.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'app.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "../fixtures/prepend-without-block/app-layout.pug" + } + ], + "line": 4, + "filename": "../fixtures/prepend-without-block/app-layout.pug", + "name": "head", + "mode": "prepend" + } + ], + "line": 0, + "filename": "../fixtures/prepend-without-block/app-layout.pug" + } + }, + "line": 2, + "filename": "layout.prepend.without-block.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 5, + "filename": "layout.prepend.without-block.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'foo.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 5, + "filename": "layout.prepend.without-block.pug" + }, + { + "type": "Tag", + "name": "script", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 6, + "filename": "layout.prepend.without-block.pug" + }, + "attrs": [ + { + "name": "src", + "val": "'bar.js'", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 6, + "filename": "layout.prepend.without-block.pug" + } + ], + "line": 4, + "filename": "layout.prepend.without-block.pug", + "name": "head", + "mode": "prepend" + } + ], + "line": 0, + "filename": "layout.prepend.without-block.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/errors-src/child-with-tags.pug b/node_modules/pug-linker/test/errors-src/child-with-tags.pug new file mode 100644 index 0000000..fb439dd --- /dev/null +++ b/node_modules/pug-linker/test/errors-src/child-with-tags.pug @@ -0,0 +1,6 @@ +extend ../fixtures/layout + +block body + p Hello world! + +p BAD!!! diff --git a/node_modules/pug-linker/test/errors-src/extends-not-first.pug b/node_modules/pug-linker/test/errors-src/extends-not-first.pug new file mode 100644 index 0000000..47249bc --- /dev/null +++ b/node_modules/pug-linker/test/errors-src/extends-not-first.pug @@ -0,0 +1,4 @@ +block body + p Hey + +extends ../fixtures/layout diff --git a/node_modules/pug-linker/test/errors-src/unexpected-block.pug b/node_modules/pug-linker/test/errors-src/unexpected-block.pug new file mode 100644 index 0000000..5d56192 --- /dev/null +++ b/node_modules/pug-linker/test/errors-src/unexpected-block.pug @@ -0,0 +1,4 @@ +extends ../fixtures/empty.pug + +block foo + div Hello World diff --git a/node_modules/pug-linker/test/errors/child-with-tags.input.json b/node_modules/pug-linker/test/errors/child-with-tags.input.json new file mode 100644 index 0000000..8875e2e --- /dev/null +++ b/node_modules/pug-linker/test/errors/child-with-tags.input.json @@ -0,0 +1,163 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "../fixtures/layout", + "line": 1, + "filename": "child-with-tags.pug", + "fullPath": "../fixtures/layout.pug", + "str": "doctype\n\nhtml\n head\n block head\n Hello world!\n body\n block body\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Doctype", + "val": "", + "line": 1, + "filename": "../fixtures/layout.pug" + }, + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "head", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Text", + "val": "Hello world!", + "filename": "../fixtures/layout.pug", + "line": 6, + "isHtml": true + } + ], + "line": 5, + "filename": "../fixtures/layout.pug", + "name": "head", + "mode": "replace" + } + ], + "line": 4, + "filename": "../fixtures/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "../fixtures/layout.pug" + }, + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [], + "line": 8, + "filename": "../fixtures/layout.pug", + "name": "body", + "mode": "replace" + } + ], + "line": 7, + "filename": "../fixtures/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 7, + "filename": "../fixtures/layout.pug" + } + ], + "line": 3, + "filename": "../fixtures/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "../fixtures/layout.pug" + } + ], + "line": 0, + "filename": "../fixtures/layout.pug" + } + }, + "line": 1, + "filename": "child-with-tags.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "Hello world!", + "line": 4, + "filename": "child-with-tags.pug" + } + ], + "line": 4, + "filename": "child-with-tags.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "child-with-tags.pug" + } + ], + "line": 3, + "filename": "child-with-tags.pug", + "name": "body", + "mode": "replace" + }, + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "BAD!!!", + "line": 6, + "filename": "child-with-tags.pug" + } + ], + "line": 6, + "filename": "child-with-tags.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 6, + "filename": "child-with-tags.pug" + } + ], + "line": 0, + "filename": "child-with-tags.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/errors/extends-not-first.input.json b/node_modules/pug-linker/test/errors/extends-not-first.input.json new file mode 100644 index 0000000..44f8b47 --- /dev/null +++ b/node_modules/pug-linker/test/errors/extends-not-first.input.json @@ -0,0 +1,140 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "Hey", + "line": 2, + "filename": "extends-not-first.pug" + } + ], + "line": 2, + "filename": "extends-not-first.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 2, + "filename": "extends-not-first.pug" + } + ], + "line": 1, + "filename": "extends-not-first.pug", + "name": "body", + "mode": "replace" + }, + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "../fixtures/layout", + "line": 4, + "filename": "extends-not-first.pug", + "fullPath": "../fixtures/layout.pug", + "str": "doctype\n\nhtml\n head\n block head\n Hello world!\n body\n block body\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Doctype", + "val": "", + "line": 1, + "filename": "../fixtures/layout.pug" + }, + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "head", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Text", + "val": "Hello world!", + "filename": "../fixtures/layout.pug", + "line": 6, + "isHtml": true + } + ], + "line": 5, + "filename": "../fixtures/layout.pug", + "name": "head", + "mode": "replace" + } + ], + "line": 4, + "filename": "../fixtures/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "../fixtures/layout.pug" + }, + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [], + "line": 8, + "filename": "../fixtures/layout.pug", + "name": "body", + "mode": "replace" + } + ], + "line": 7, + "filename": "../fixtures/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 7, + "filename": "../fixtures/layout.pug" + } + ], + "line": 3, + "filename": "../fixtures/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "../fixtures/layout.pug" + } + ], + "line": 0, + "filename": "../fixtures/layout.pug" + } + }, + "line": 4, + "filename": "extends-not-first.pug" + } + ], + "line": 0, + "filename": "extends-not-first.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/errors/unexpected-block.input.json b/node_modules/pug-linker/test/errors/unexpected-block.input.json new file mode 100644 index 0000000..4433046 --- /dev/null +++ b/node_modules/pug-linker/test/errors/unexpected-block.input.json @@ -0,0 +1,58 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "../fixtures/empty.pug", + "line": 1, + "filename": "unexpected-block.pug", + "fullPath": "../fixtures/empty.pug", + "str": "", + "ast": { + "type": "Block", + "nodes": [], + "line": 0, + "filename": "../fixtures/empty.pug" + } + }, + "line": 1, + "filename": "unexpected-block.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "div", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "Hello World", + "line": 4, + "filename": "unexpected-block.pug" + } + ], + "line": 4, + "filename": "unexpected-block.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "unexpected-block.pug" + } + ], + "line": 3, + "filename": "unexpected-block.pug", + "name": "foo", + "mode": "replace" + } + ], + "line": 0, + "filename": "unexpected-block.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/fixtures/append-without-block/app-layout.pug b/node_modules/pug-linker/test/fixtures/append-without-block/app-layout.pug new file mode 100644 index 0000000..1b55872 --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/append-without-block/app-layout.pug @@ -0,0 +1,5 @@ + +extends layout.pug + +append head + script(src='app.js') diff --git a/node_modules/pug-linker/test/fixtures/append-without-block/layout.pug b/node_modules/pug-linker/test/fixtures/append-without-block/layout.pug new file mode 100644 index 0000000..671b3c9 --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/append-without-block/layout.pug @@ -0,0 +1,7 @@ + +html + block head + script(src='vendor/jquery.js') + script(src='vendor/caustic.js') + body + block body \ No newline at end of file diff --git a/node_modules/pug-linker/test/fixtures/append-without-block/page.pug b/node_modules/pug-linker/test/fixtures/append-without-block/page.pug new file mode 100644 index 0000000..e607ae7 --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/append-without-block/page.pug @@ -0,0 +1,6 @@ + +extends app-layout.pug + +append head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug-linker/test/fixtures/append/app-layout.pug b/node_modules/pug-linker/test/fixtures/append/app-layout.pug new file mode 100644 index 0000000..48bf886 --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/append/app-layout.pug @@ -0,0 +1,5 @@ + +extends layout + +block append head + script(src='app.js') \ No newline at end of file diff --git a/node_modules/pug-linker/test/fixtures/append/layout.pug b/node_modules/pug-linker/test/fixtures/append/layout.pug new file mode 100644 index 0000000..671b3c9 --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/append/layout.pug @@ -0,0 +1,7 @@ + +html + block head + script(src='vendor/jquery.js') + script(src='vendor/caustic.js') + body + block body \ No newline at end of file diff --git a/node_modules/pug-linker/test/fixtures/append/page.html b/node_modules/pug-linker/test/fixtures/append/page.html new file mode 100644 index 0000000..bc5e126 --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/append/page.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/node_modules/pug-linker/test/fixtures/append/page.pug b/node_modules/pug-linker/test/fixtures/append/page.pug new file mode 100644 index 0000000..1ae9909 --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/append/page.pug @@ -0,0 +1,6 @@ + +extends app-layout + +block append head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug-linker/test/fixtures/empty.pug b/node_modules/pug-linker/test/fixtures/empty.pug new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/pug-linker/test/fixtures/layout.pug b/node_modules/pug-linker/test/fixtures/layout.pug new file mode 100644 index 0000000..aaa3c63 --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/layout.pug @@ -0,0 +1,8 @@ +doctype + +html + head + block head + Hello world! + body + block body diff --git a/node_modules/pug-linker/test/fixtures/mixins.pug b/node_modules/pug-linker/test/fixtures/mixins.pug new file mode 100644 index 0000000..e20550a --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/mixins.pug @@ -0,0 +1,2 @@ +mixin image(src) + img(cl-src=src)&attributes(attributes) diff --git a/node_modules/pug-linker/test/fixtures/multi-append-prepend-block/redefine.pug b/node_modules/pug-linker/test/fixtures/multi-append-prepend-block/redefine.pug new file mode 100644 index 0000000..abc178e --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/multi-append-prepend-block/redefine.pug @@ -0,0 +1,5 @@ +extends root.pug + +block content + .content + | Defined content diff --git a/node_modules/pug-linker/test/fixtures/multi-append-prepend-block/root.pug b/node_modules/pug-linker/test/fixtures/multi-append-prepend-block/root.pug new file mode 100644 index 0000000..8e3334a --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/multi-append-prepend-block/root.pug @@ -0,0 +1,5 @@ +block content + | default content + +block head + script(src='/app.js') \ No newline at end of file diff --git a/node_modules/pug-linker/test/fixtures/prepend-without-block/app-layout.pug b/node_modules/pug-linker/test/fixtures/prepend-without-block/app-layout.pug new file mode 100644 index 0000000..53f89ba --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/prepend-without-block/app-layout.pug @@ -0,0 +1,5 @@ + +extends layout.pug + +prepend head + script(src='app.js') diff --git a/node_modules/pug-linker/test/fixtures/prepend-without-block/layout.pug b/node_modules/pug-linker/test/fixtures/prepend-without-block/layout.pug new file mode 100644 index 0000000..671b3c9 --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/prepend-without-block/layout.pug @@ -0,0 +1,7 @@ + +html + block head + script(src='vendor/jquery.js') + script(src='vendor/caustic.js') + body + block body \ No newline at end of file diff --git a/node_modules/pug-linker/test/fixtures/prepend-without-block/page.html b/node_modules/pug-linker/test/fixtures/prepend-without-block/page.html new file mode 100644 index 0000000..8753a42 --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/prepend-without-block/page.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/node_modules/pug-linker/test/fixtures/prepend-without-block/page.pug b/node_modules/pug-linker/test/fixtures/prepend-without-block/page.pug new file mode 100644 index 0000000..6b9bb01 --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/prepend-without-block/page.pug @@ -0,0 +1,6 @@ + +extends app-layout.pug + +prepend head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug-linker/test/fixtures/prepend/app-layout.pug b/node_modules/pug-linker/test/fixtures/prepend/app-layout.pug new file mode 100644 index 0000000..7040eec --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/prepend/app-layout.pug @@ -0,0 +1,5 @@ + +extends layout.pug + +block prepend head + script(src='app.js') diff --git a/node_modules/pug-linker/test/fixtures/prepend/layout.pug b/node_modules/pug-linker/test/fixtures/prepend/layout.pug new file mode 100644 index 0000000..671b3c9 --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/prepend/layout.pug @@ -0,0 +1,7 @@ + +html + block head + script(src='vendor/jquery.js') + script(src='vendor/caustic.js') + body + block body \ No newline at end of file diff --git a/node_modules/pug-linker/test/fixtures/prepend/page.html b/node_modules/pug-linker/test/fixtures/prepend/page.html new file mode 100644 index 0000000..8753a42 --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/prepend/page.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/node_modules/pug-linker/test/fixtures/prepend/page.pug b/node_modules/pug-linker/test/fixtures/prepend/page.pug new file mode 100644 index 0000000..c2a91c9 --- /dev/null +++ b/node_modules/pug-linker/test/fixtures/prepend/page.pug @@ -0,0 +1,6 @@ + +extends app-layout.pug + +block prepend head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug-linker/test/index.test.js b/node_modules/pug-linker/test/index.test.js new file mode 100644 index 0000000..193d8c7 --- /dev/null +++ b/node_modules/pug-linker/test/index.test.js @@ -0,0 +1,46 @@ +var assert = require('assert'); +var fs = require('fs'); +var link = require('../'); + +function testDir (dir) { + fs.readdirSync(dir).forEach(function (name) { + if (!/\.input\.json$/.test(name)) return; + test(name, function () { + var actual = link(JSON.parse(fs.readFileSync(dir + '/' + name, 'utf8'))); + expect(actual).toMatchSnapshot(); + }); + }); +} + +function testDirError (dir) { + fs.readdirSync(dir).forEach(function (name) { + if (!/\.input\.json$/.test(name)) return; + test(name, function () { + var input = JSON.parse(fs.readFileSync(dir + '/' + name, 'utf8')); + var err; + try { + link(input); + } catch (ex) { + err = { + msg: ex.msg, + code: ex.code, + line: ex.line + }; + } + if (!err) throw new Error('Expected error') + expect(err).toMatchSnapshot(); + }); + }); +} + +describe('cases from pug', function () { + testDir(__dirname + '/cases'); +}); + +describe('special cases', function () { + testDir(__dirname + '/special-cases'); +}); + +describe('error handling', function () { + testDirError(__dirname + '/errors'); +}); diff --git a/node_modules/pug-linker/test/special-cases-src/extending-empty.pug b/node_modules/pug-linker/test/special-cases-src/extending-empty.pug new file mode 100644 index 0000000..0b87566 --- /dev/null +++ b/node_modules/pug-linker/test/special-cases-src/extending-empty.pug @@ -0,0 +1 @@ +extend ../fixtures/empty.pug diff --git a/node_modules/pug-linker/test/special-cases-src/extending-include.pug b/node_modules/pug-linker/test/special-cases-src/extending-include.pug new file mode 100644 index 0000000..5dd10ec --- /dev/null +++ b/node_modules/pug-linker/test/special-cases-src/extending-include.pug @@ -0,0 +1,5 @@ +extend ../fixtures/layout.pug +include ../fixtures/mixins.pug + +block body + +image('myimg.png').with-border(alt="My image") diff --git a/node_modules/pug-linker/test/special-cases-src/root-mixin.pug b/node_modules/pug-linker/test/special-cases-src/root-mixin.pug new file mode 100644 index 0000000..c81b2b5 --- /dev/null +++ b/node_modules/pug-linker/test/special-cases-src/root-mixin.pug @@ -0,0 +1,9 @@ +extend ../fixtures/layout.pug + +mixin myMixin + p Hello world + +block body + p Before + +myMixin + p After diff --git a/node_modules/pug-linker/test/special-cases/extending-empty.input.json b/node_modules/pug-linker/test/special-cases/extending-empty.input.json new file mode 100644 index 0000000..532adb5 --- /dev/null +++ b/node_modules/pug-linker/test/special-cases/extending-empty.input.json @@ -0,0 +1,26 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "../fixtures/empty.pug", + "line": 1, + "filename": "extending-empty.pug", + "fullPath": "../fixtures/empty.pug", + "str": "", + "ast": { + "type": "Block", + "nodes": [], + "line": 0, + "filename": "../fixtures/empty.pug" + } + }, + "line": 1, + "filename": "extending-empty.pug" + } + ], + "line": 0, + "filename": "extending-empty.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/special-cases/extending-include.input.json b/node_modules/pug-linker/test/special-cases/extending-include.input.json new file mode 100644 index 0000000..495311e --- /dev/null +++ b/node_modules/pug-linker/test/special-cases/extending-include.input.json @@ -0,0 +1,204 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "../fixtures/layout.pug", + "line": 1, + "filename": "extending-include.pug", + "fullPath": "../fixtures/layout.pug", + "str": "doctype\n\nhtml\n head\n block head\n Hello world!\n body\n block body\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Doctype", + "val": "", + "line": 1, + "filename": "../fixtures/layout.pug" + }, + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "head", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Text", + "val": "Hello world!", + "filename": "../fixtures/layout.pug", + "line": 6, + "isHtml": true + } + ], + "line": 5, + "filename": "../fixtures/layout.pug", + "name": "head", + "mode": "replace" + } + ], + "line": 4, + "filename": "../fixtures/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "../fixtures/layout.pug" + }, + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [], + "line": 8, + "filename": "../fixtures/layout.pug", + "name": "body", + "mode": "replace" + } + ], + "line": 7, + "filename": "../fixtures/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 7, + "filename": "../fixtures/layout.pug" + } + ], + "line": 3, + "filename": "../fixtures/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "../fixtures/layout.pug" + } + ], + "line": 0, + "filename": "../fixtures/layout.pug" + } + }, + "line": 1, + "filename": "extending-include.pug" + }, + { + "type": "Include", + "file": { + "type": "FileReference", + "line": 2, + "filename": "extending-include.pug", + "path": "../fixtures/mixins.pug", + "fullPath": "../fixtures/mixins.pug", + "str": "mixin image(src)\n img(cl-src=src)&attributes(attributes)\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Mixin", + "name": "image", + "args": "src", + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "img", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 2, + "filename": "../fixtures/mixins.pug" + }, + "attrs": [ + { + "name": "cl-src", + "val": "src", + "mustEscape": true + } + ], + "attributeBlocks": [ + "attributes" + ], + "isInline": true, + "line": 2, + "filename": "../fixtures/mixins.pug" + } + ], + "line": 2, + "filename": "../fixtures/mixins.pug" + }, + "call": false, + "line": 1, + "filename": "../fixtures/mixins.pug" + } + ], + "line": 0, + "filename": "../fixtures/mixins.pug" + } + }, + "line": 2, + "filename": "extending-include.pug", + "block": { + "type": "Block", + "nodes": [], + "line": 2, + "filename": "extending-include.pug" + } + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Mixin", + "name": "image", + "args": "'myimg.png'", + "block": null, + "call": true, + "attrs": [ + { + "name": "class", + "val": "'with-border'", + "mustEscape": false + }, + { + "name": "alt", + "val": "\"My image\"", + "mustEscape": true + } + ], + "attributeBlocks": [], + "line": 5, + "filename": "extending-include.pug" + } + ], + "line": 4, + "filename": "extending-include.pug", + "name": "body", + "mode": "replace" + } + ], + "line": 0, + "filename": "extending-include.pug" +} \ No newline at end of file diff --git a/node_modules/pug-linker/test/special-cases/root-mixin.input.json b/node_modules/pug-linker/test/special-cases/root-mixin.input.json new file mode 100644 index 0000000..743250e --- /dev/null +++ b/node_modules/pug-linker/test/special-cases/root-mixin.input.json @@ -0,0 +1,212 @@ +{ + "type": "Block", + "nodes": [ + { + "type": "Extends", + "file": { + "type": "FileReference", + "path": "../fixtures/layout.pug", + "line": 1, + "filename": "root-mixin.pug", + "fullPath": "../fixtures/layout.pug", + "str": "doctype\n\nhtml\n head\n block head\n Hello world!\n body\n block body\n", + "ast": { + "type": "Block", + "nodes": [ + { + "type": "Doctype", + "val": "", + "line": 1, + "filename": "../fixtures/layout.pug" + }, + { + "type": "Tag", + "name": "html", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "head", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Text", + "val": "Hello world!", + "filename": "../fixtures/layout.pug", + "line": 6, + "isHtml": true + } + ], + "line": 5, + "filename": "../fixtures/layout.pug", + "name": "head", + "mode": "replace" + } + ], + "line": 4, + "filename": "../fixtures/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "../fixtures/layout.pug" + }, + { + "type": "Tag", + "name": "body", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "NamedBlock", + "nodes": [], + "line": 8, + "filename": "../fixtures/layout.pug", + "name": "body", + "mode": "replace" + } + ], + "line": 7, + "filename": "../fixtures/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 7, + "filename": "../fixtures/layout.pug" + } + ], + "line": 3, + "filename": "../fixtures/layout.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 3, + "filename": "../fixtures/layout.pug" + } + ], + "line": 0, + "filename": "../fixtures/layout.pug" + } + }, + "line": 1, + "filename": "root-mixin.pug" + }, + { + "type": "Mixin", + "name": "myMixin", + "args": null, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "Hello world", + "line": 4, + "filename": "root-mixin.pug" + } + ], + "line": 4, + "filename": "root-mixin.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 4, + "filename": "root-mixin.pug" + } + ], + "line": 4, + "filename": "root-mixin.pug" + }, + "call": false, + "line": 3, + "filename": "root-mixin.pug" + }, + { + "type": "NamedBlock", + "nodes": [ + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "Before", + "line": 7, + "filename": "root-mixin.pug" + } + ], + "line": 7, + "filename": "root-mixin.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 7, + "filename": "root-mixin.pug" + }, + { + "type": "Mixin", + "name": "myMixin", + "args": null, + "block": null, + "call": true, + "attrs": [], + "attributeBlocks": [], + "line": 8, + "filename": "root-mixin.pug" + }, + { + "type": "Tag", + "name": "p", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [ + { + "type": "Text", + "val": "After", + "line": 9, + "filename": "root-mixin.pug" + } + ], + "line": 9, + "filename": "root-mixin.pug" + }, + "attrs": [], + "attributeBlocks": [], + "isInline": false, + "line": 9, + "filename": "root-mixin.pug" + } + ], + "line": 6, + "filename": "root-mixin.pug", + "name": "body", + "mode": "replace" + } + ], + "line": 0, + "filename": "root-mixin.pug" +} \ No newline at end of file diff --git a/node_modules/pug-load/HISTORY.md b/node_modules/pug-load/HISTORY.md new file mode 100644 index 0000000..0e74ca4 --- /dev/null +++ b/node_modules/pug-load/HISTORY.md @@ -0,0 +1,19 @@ +2.0.3 / 2016-08-24 +================== + + * Do not pollute the user's `options` object + +2.0.2 / 2016-08-23 +================== + + * Only publish the module itself + +2.0.1 / 2016-08-23 +================== + + * Update to pug-walk@^1.0.0 + +2.0.0 / 2016-05-14 +================== + + * Make filename part of the options - updates to the 2.x.y APIs for lexer and parser diff --git a/node_modules/pug-load/LICENSE b/node_modules/pug-load/LICENSE new file mode 100644 index 0000000..a1421ff --- /dev/null +++ b/node_modules/pug-load/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Forbes Lindesay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/pug-load/README.md b/node_modules/pug-load/README.md new file mode 100644 index 0000000..abbc968 --- /dev/null +++ b/node_modules/pug-load/README.md @@ -0,0 +1,104 @@ +# pug-load + +The pug loader is responsible for loading the depenendencies of a given pug file. It adds `fullPath` and `str` properties to every `Include` and `Extends` node. It also adds an `ast` property to any `Include` nodes that are loading pug and any `Extends` nodes. It then recursively loads the dependencies of any of those included files. + +[![Build Status](https://img.shields.io/travis/pugjs/pug-load/master.svg)](https://travis-ci.org/pugjs/pug-load) +[![Dependency Status](https://img.shields.io/david/pugjs/pug-load.svg)](https://david-dm.org/pugjs/pug-load) +[![NPM version](https://img.shields.io/npm/v/pug-load.svg)](https://www.npmjs.org/package/pug-load) +[![Coverage Status](https://img.shields.io/codecov/c/github/pugjs/pug-load.svg)](https://codecov.io/gh/pugjs/pug-load) + +## Installation + + npm install pug-load + +## Usage + +```js +var load = require('pug-load'); +``` + +### `load(ast, options)` +### `load.string(str, filename, options)` +### `load.file(filename, options)` + +Loads all dependencies of the Pug AST. `load.string` and `load.file` are syntactic sugar that parses the string or file instead of you doing it yourself. + +`options` may contain the following properties: + +- `lex` (function): **(required)** the lexer used +- `parse` (function): **(required)** the parser used +- `resolve` (function): a function used to override `load.resolve`. Defaults to `load.resolve`. +- `read` (function): a function used to override `load.read`. Defaults to `load.read`. +- `basedir` (string): the base directory of absolute inclusion. This is **required** when absolute inclusion (file name starts with `'/'`) is used. Defaults to undefined. + +The `options` object is passed to `load.resolve` and `load.read`, or equivalently `options.resolve` and `options.read`. + +### `load.resolve(filename, source, options)` + +Callback used by `pug-load` to resolve the full path of an included or extended file given the path of the source file. + +`filename` is the included file. `source` is the name of the parent file that includes `filename`. + +This function is not meant to be called from outside of `pug-load`, but rather for you to override. + +### `load.read(filename, options)` + +Callback used by `pug-load` to return the contents of a file. + +`filename` is the file to read. + +This function is not meant to be called from outside of `pug-load`, but rather for you to override. + +### `load.validateOptions(options)` + +Callback used `pug-load` to ensure the options object is valid. If your overriden `load.resolve` or `load.read` uses a different `options` scheme, you will need to override this function as well. + +This function is not meant to be called from outside of `pug-load`, but rather for you to override. + +### Example + +```js +var fs = require('fs'); +var lex = require('pug-lexer'); +var parse = require('pug-parser'); +var load = require('pug-load'); + +// you can do everything very manually + +var str = fs.readFileSync('bar.pug', 'utf8'); +var ast = load(parse(lex(str, 'bar.pug'), 'bar.pug'), { + lex: lex, + parse: parse, + resolve: function (filename, source, options) { + console.log('"' + filename + '" file requested from "' + source + '".'); + return load.resolve(filename, source, options); + } +}); + +// or you can do all that in just two steps + +var str = fs.readFileSync('bar.pug', 'utf8'); +var ast = load.string(str, 'bar.pug', { + lex: lex, + parse: parse, + resolve: function (filename, source, options) { + console.log('"' + filename + '" file requested from "' + source + '".'); + return load.resolve(filename, source, options); + } +}); + +// or you can do all that in only one step + +var ast = load.file('bar.pug', { + lex: lex, + parse: parse, + resolve: function (filename, source, options) { + console.log('"' + filename + '" file requested from "' + source + '".'); + return load.resolve(filename, source, options); + } +}); +``` + +## License + + MIT diff --git a/node_modules/pug-load/index.js b/node_modules/pug-load/index.js new file mode 100644 index 0000000..9cc5f0c --- /dev/null +++ b/node_modules/pug-load/index.js @@ -0,0 +1,101 @@ +'use strict'; + +var fs = require('fs'); +var path = require('path'); +var walk = require('pug-walk'); +var assign = require('object-assign'); + +module.exports = load; +function load(ast, options) { + options = getOptions(options); + // clone the ast + ast = JSON.parse(JSON.stringify(ast)); + return walk(ast, function (node) { + if (node.str === undefined) { + if (node.type === 'Include' || node.type === 'RawInclude' || node.type === 'Extends') { + var file = node.file; + if (file.type !== 'FileReference') { + throw new Error('Expected file.type to be "FileReference"'); + } + var path, str; + try { + path = options.resolve(file.path, file.filename, options); + file.fullPath = path; + str = options.read(path, options); + } catch (ex) { + ex.message += '\n at ' + node.filename + ' line ' + node.line; + throw ex; + } + file.str = str; + if (node.type === 'Extends' || node.type === 'Include') { + file.ast = load.string(str, assign({}, options, { + filename: path + })); + } + } + } + }); +} + +load.string = function loadString(src, options) { + options = assign(getOptions(options), { + src: src + }); + var tokens = options.lex(src, options); + var ast = options.parse(tokens, options); + return load(ast, options); +}; +load.file = function loadFile(filename, options) { + options = assign(getOptions(options), { + filename: filename + }); + var str = options.read(filename); + return load.string(str, options); +} + +load.resolve = function resolve(filename, source, options) { + filename = filename.trim(); + if (filename[0] !== '/' && !source) + throw new Error('the "filename" option is required to use includes and extends with "relative" paths'); + + if (filename[0] === '/' && !options.basedir) + throw new Error('the "basedir" option is required to use includes and extends with "absolute" paths'); + + filename = path.join(filename[0] === '/' ? options.basedir : path.dirname(source.trim()), filename); + + return filename; +}; +load.read = function read(filename, options) { + return fs.readFileSync(filename, 'utf8'); +}; + +load.validateOptions = function validateOptions(options) { + /* istanbul ignore if */ + if (typeof options !== 'object') { + throw new TypeError('options must be an object'); + } + /* istanbul ignore if */ + if (typeof options.lex !== 'function') { + throw new TypeError('options.lex must be a function'); + } + /* istanbul ignore if */ + if (typeof options.parse !== 'function') { + throw new TypeError('options.parse must be a function'); + } + /* istanbul ignore if */ + if (options.resolve && typeof options.resolve !== 'function') { + throw new TypeError('options.resolve must be a function'); + } + /* istanbul ignore if */ + if (options.read && typeof options.read !== 'function') { + throw new TypeError('options.read must be a function'); + } +}; + +function getOptions(options) { + load.validateOptions(options); + return assign({ + resolve: load.resolve, + read: load.read + }, options); +} diff --git a/node_modules/pug-load/package.json b/node_modules/pug-load/package.json new file mode 100644 index 0000000..f31c56b --- /dev/null +++ b/node_modules/pug-load/package.json @@ -0,0 +1,53 @@ +{ + "_from": "pug-load@^2.0.5", + "_id": "pug-load@2.0.11", + "_inBundle": false, + "_integrity": "sha1-5kjlftET/iwfRdV4WOorrWvAFSc=", + "_location": "/pug-load", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "pug-load@^2.0.5", + "name": "pug-load", + "escapedName": "pug-load", + "rawSpec": "^2.0.5", + "saveSpec": null, + "fetchSpec": "^2.0.5" + }, + "_requiredBy": [ + "/pug" + ], + "_resolved": "https://registry.npmjs.org/pug-load/-/pug-load-2.0.11.tgz", + "_shasum": "e648e57ed113fe2c1f45d57858ea2bad6bc01527", + "_spec": "pug-load@^2.0.5", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/pug", + "author": { + "name": "ForbesLindesay" + }, + "bugs": { + "url": "https://github.com/pugjs/pug-load/issues" + }, + "bundleDependencies": false, + "dependencies": { + "object-assign": "^4.1.0", + "pug-walk": "^1.1.7" + }, + "deprecated": false, + "description": "The Pug loader is responsible for loading the depenendencies of a given Pug file.", + "devDependencies": { + "pug-lexer": "^4.0.0", + "pug-parser": "^5.0.0" + }, + "homepage": "https://github.com/pugjs/pug-load#readme", + "keywords": [ + "pug" + ], + "license": "MIT", + "name": "pug-load", + "repository": { + "type": "git", + "url": "git+https://github.com/pugjs/pug-load.git" + }, + "version": "2.0.11" +} diff --git a/node_modules/pug-load/test/__snapshots__/index.test.js.snap b/node_modules/pug-load/test/__snapshots__/index.test.js.snap new file mode 100644 index 0000000..f7168dc --- /dev/null +++ b/node_modules/pug-load/test/__snapshots__/index.test.js.snap @@ -0,0 +1,149 @@ +exports[`test pug-load 1`] = ` +Object { + "filename": "/foo.pug", + "line": 0, + "nodes": Array [ + Object { + "column": 1, + "file": Object { + "ast": Object { + "filename": "/bar.pug", + "line": 0, + "nodes": Array [ + Object { + "column": 1, + "filename": "/bar.pug", + "line": 1, + "mode": "replace", + "name": "bing", + "nodes": Array [], + "type": "NamedBlock", + }, + ], + "type": "Block", + }, + "column": 9, + "filename": "/foo.pug", + "fullPath": "/bar.pug", + "line": 1, + "path": "bar.pug", + "str": "block bing +", + "type": "FileReference", + }, + "filename": "/foo.pug", + "line": 1, + "type": "Extends", + }, + Object { + "column": 1, + "filename": "/foo.pug", + "line": 3, + "mode": "replace", + "name": "bing", + "nodes": Array [ + Object { + "block": Object { + "filename": "/foo.pug", + "line": 4, + "nodes": Array [], + "type": "Block", + }, + "column": 3, + "file": Object { + "ast": Object { + "filename": "/bing.pug", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "column": 1, + "filename": "/packages/pug-load/test/bing.pug", + "line": 1, + "mustEscape": false, + "name": "class", + "val": "\'bing\'", + }, + ], + "block": Object { + "filename": "/bing.pug", + "line": 1, + "nodes": Array [ + Object { + "column": 7, + "filename": "/bing.pug", + "line": 1, + "type": "Text", + "val": "bong", + }, + ], + "type": "Block", + }, + "column": 1, + "filename": "/bing.pug", + "isInline": false, + "line": 1, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "column": 11, + "filename": "/foo.pug", + "fullPath": "/bing.pug", + "line": 4, + "path": "bing.pug", + "str": ".bing bong +", + "type": "FileReference", + }, + "filename": "/foo.pug", + "line": 4, + "type": "Include", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "/foo.pug", + "line": 5, + "nodes": Array [ + Object { + "column": 5, + "file": Object { + "column": 13, + "filename": "/foo.pug", + "fullPath": "/script.js", + "line": 6, + "path": "script.js", + "str": "document.write(\'hello world!\'); +", + "type": "FileReference", + }, + "filename": "/foo.pug", + "filters": Array [], + "line": 6, + "type": "RawInclude", + }, + ], + "type": "Block", + }, + "column": 3, + "filename": "/foo.pug", + "isInline": false, + "line": 5, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + ], + "type": "Block", +} +`; diff --git a/node_modules/pug-load/test/bar.pug b/node_modules/pug-load/test/bar.pug new file mode 100644 index 0000000..24e3cee --- /dev/null +++ b/node_modules/pug-load/test/bar.pug @@ -0,0 +1 @@ +block bing diff --git a/node_modules/pug-load/test/bing.pug b/node_modules/pug-load/test/bing.pug new file mode 100644 index 0000000..9013b36 --- /dev/null +++ b/node_modules/pug-load/test/bing.pug @@ -0,0 +1 @@ +.bing bong diff --git a/node_modules/pug-load/test/foo.pug b/node_modules/pug-load/test/foo.pug new file mode 100644 index 0000000..d30a98f --- /dev/null +++ b/node_modules/pug-load/test/foo.pug @@ -0,0 +1,6 @@ +extends bar.pug + +block bing + include bing.pug + script + include script.js diff --git a/node_modules/pug-load/test/index.test.js b/node_modules/pug-load/test/index.test.js new file mode 100644 index 0000000..1ad7f60 --- /dev/null +++ b/node_modules/pug-load/test/index.test.js @@ -0,0 +1,24 @@ +'use strict'; + +var fs = require('fs'); +var path = require('path'); +var assert = require('assert'); +var walk = require('pug-walk'); +var lex = require('pug-lexer'); +var parse = require('pug-parser'); +var load = require('../'); + +test('pug-load', () => { + var filename = __dirname + '/foo.pug'; + var ast = load.file(filename, { + lex: lex, + parse: parse + }); + + ast = walk(ast, function (node) { + if (node.filename) node.filename = '/' + path.basename(node.filename); + if (node.fullPath) node.fullPath = '/' + path.basename(node.fullPath); + }, {includeDependencies: true}); + + expect(ast).toMatchSnapshot(); +}); diff --git a/node_modules/pug-load/test/script.js b/node_modules/pug-load/test/script.js new file mode 100644 index 0000000..1e07719 --- /dev/null +++ b/node_modules/pug-load/test/script.js @@ -0,0 +1 @@ +document.write('hello world!'); diff --git a/node_modules/pug-parser/HISTORY.md b/node_modules/pug-parser/HISTORY.md new file mode 100644 index 0000000..472a9c0 --- /dev/null +++ b/node_modules/pug-parser/HISTORY.md @@ -0,0 +1,11 @@ +2.0.1 / 2016-06-01 +================== + + * Add a brief API introduction to README + +2.0.0 / 2016-05-14 +================== + + * Take the `filename` as an option rather than special casing it. This means that parse only takes 2 arguments rather than 3 + * Add type checking on arguments + * Treat the legacy `.jade` extension as `.pug` rather than a raw include diff --git a/node_modules/pug-parser/LICENSE b/node_modules/pug-parser/LICENSE new file mode 100644 index 0000000..27cc9f3 --- /dev/null +++ b/node_modules/pug-parser/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 Forbes Lindesay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/pug-parser/README.md b/node_modules/pug-parser/README.md new file mode 100644 index 0000000..33b8a2b --- /dev/null +++ b/node_modules/pug-parser/README.md @@ -0,0 +1,86 @@ +# pug-parser + +The pug parser (takes an array of tokens and converts it to an abstract syntax tree) + +[![Build Status](https://img.shields.io/travis/pugjs/pug-parser/master.svg)](https://travis-ci.org/pugjs/pug-parser) +[![Dependency Status](https://img.shields.io/david/pugjs/pug-parser.svg)](https://david-dm.org/pugjs/pug-parser) +[![NPM version](https://img.shields.io/npm/v/pug-parser.svg)](https://www.npmjs.org/package/pug-parser) + +## Installation + + npm install pug-parser + +## Usage + +```js +var parse = require('pug-parser'); +``` + +### `parse(tokens, options)` + +Convert Pug tokens to an abstract syntax tree (AST). + +`options` can contain the following properties: + +- `filename` (string): The name of the Pug file; it is included in the produced AST nodes and error handling, if provided. +- `plugins` (array): An array of plugins, in the order they should be applied. +- `src` (string): The source of the Pug file; it is used in error handling if provided. + +```js +var lex = require('pug-lexer'); + +var filename = 'my-file.pug'; +var src = 'div(data-foo="bar")'; +var tokens = lex(src, {filename}); + +var ast = parse(tokens, {filename, src}); + +console.log(JSON.stringify(ast, null, ' ')) +``` + +```json +{ + "type": "Block", + "nodes": [ + { + "type": "Tag", + "name": "div", + "selfClosing": false, + "block": { + "type": "Block", + "nodes": [], + "line": 1, + "filename": "my-file.pug" + }, + "attrs": [ + { + "name": "data-foo", + "val": "\"bar\"", + "mustEscape": true + } + ], + "attributeBlocks": [], + "isInline": false, + "line": 1, + "filename": "my-file.pug" + } + ], + "line": 0, + "filename": "my-file.pug" +} +``` + +### `new parse.Parser(tokens, options)` + +Constructor for a Parser class. This is not meant to be used directly unless you know what you are doing. + +`options` may contain the following properties: + +- `filename` (string): The name of the Pug file; it is included in the produced AST nodes and error handling, if provided. +- `plugins` (array): An array of plugins, in the order they should be applied. +- `src` (string): The source of the Pug file; it is used in error handling if provided. + +## License + + MIT + kkk diff --git a/node_modules/pug-parser/index.js b/node_modules/pug-parser/index.js new file mode 100644 index 0000000..818ee7f --- /dev/null +++ b/node_modules/pug-parser/index.js @@ -0,0 +1,1107 @@ +'use strict'; + +var assert = require('assert'); +var TokenStream = require('token-stream'); +var error = require('pug-error'); +var inlineTags = require('./lib/inline-tags'); + +module.exports = parse; +module.exports.Parser = Parser; +function parse(tokens, options) { + var parser = new Parser(tokens, options); + var ast = parser.parse(); + return JSON.parse(JSON.stringify(ast)); +}; + +/** + * Initialize `Parser` with the given input `str` and `filename`. + * + * @param {String} str + * @param {String} filename + * @param {Object} options + * @api public + */ + +function Parser(tokens, options) { + options = options || {}; + if (!Array.isArray(tokens)) { + throw new Error('Expected tokens to be an Array but got "' + (typeof tokens) + '"'); + } + if (typeof options !== 'object') { + throw new Error('Expected "options" to be an object but got "' + (typeof options) + '"'); + } + this.tokens = new TokenStream(tokens); + this.filename = options.filename; + this.src = options.src; + this.inMixin = 0; + this.plugins = options.plugins || []; +}; + +/** + * Parser prototype. + */ + +Parser.prototype = { + + /** + * Save original constructor + */ + + constructor: Parser, + + error: function (code, message, token) { + var err = error(code, message, { + line: token.line, + column: token.col, + filename: this.filename, + src: this.src + }); + throw err; + }, + + /** + * Return the next token object. + * + * @return {Object} + * @api private + */ + + advance: function(){ + return this.tokens.advance(); + }, + + /** + * Single token lookahead. + * + * @return {Object} + * @api private + */ + + peek: function() { + return this.tokens.peek(); + }, + + /** + * `n` token lookahead. + * + * @param {Number} n + * @return {Object} + * @api private + */ + + lookahead: function(n){ + return this.tokens.lookahead(n); + }, + + /** + * Parse input returning a string of js for evaluation. + * + * @return {String} + * @api public + */ + + parse: function(){ + var block = this.emptyBlock(0); + + while ('eos' != this.peek().type) { + if ('newline' == this.peek().type) { + this.advance(); + } else if ('text-html' == this.peek().type) { + block.nodes = block.nodes.concat(this.parseTextHtml()); + } else { + var expr = this.parseExpr(); + if (expr) block.nodes.push(expr); + } + } + + return block; + }, + + /** + * Expect the given type, or throw an exception. + * + * @param {String} type + * @api private + */ + + expect: function(type){ + if (this.peek().type === type) { + return this.advance(); + } else { + this.error('INVALID_TOKEN', 'expected "' + type + '", but got "' + this.peek().type + '"', this.peek()); + } + }, + + /** + * Accept the given `type`. + * + * @param {String} type + * @api private + */ + + accept: function(type){ + if (this.peek().type === type) { + return this.advance(); + } + }, + + initBlock: function(line, nodes) { + /* istanbul ignore if */ + if ((line | 0) !== line) throw new Error('`line` is not an integer'); + /* istanbul ignore if */ + if (!Array.isArray(nodes)) throw new Error('`nodes` is not an array'); + return { + type: 'Block', + nodes: nodes, + line: line, + filename: this.filename + }; + }, + + emptyBlock: function(line) { + return this.initBlock(line, []); + }, + + runPlugin: function(context, tok) { + var rest = [this]; + for (var i = 2; i < arguments.length; i++) { + rest.push(arguments[i]); + } + var pluginContext; + for (var i = 0; i < this.plugins.length; i++) { + var plugin = this.plugins[i]; + if (plugin[context] && plugin[context][tok.type]) { + if (pluginContext) throw new Error('Multiple plugin handlers found for context ' + JSON.stringify(context) + ', token type ' + JSON.stringify(tok.type)); + pluginContext = plugin[context]; + } + } + if (pluginContext) return pluginContext[tok.type].apply(pluginContext, rest); + }, + + /** + * tag + * | doctype + * | mixin + * | include + * | filter + * | comment + * | text + * | text-html + * | dot + * | each + * | code + * | yield + * | id + * | class + * | interpolation + */ + + parseExpr: function(){ + switch (this.peek().type) { + case 'tag': + return this.parseTag(); + case 'mixin': + return this.parseMixin(); + case 'block': + return this.parseBlock(); + case 'mixin-block': + return this.parseMixinBlock(); + case 'case': + return this.parseCase(); + case 'extends': + return this.parseExtends(); + case 'include': + return this.parseInclude(); + case 'doctype': + return this.parseDoctype(); + case 'filter': + return this.parseFilter(); + case 'comment': + return this.parseComment(); + case 'text': + case 'interpolated-code': + case 'start-pug-interpolation': + return this.parseText({block: true}); + case 'text-html': + return this.initBlock(this.peek().line, this.parseTextHtml()); + case 'dot': + return this.parseDot(); + case 'each': + return this.parseEach(); + case 'code': + return this.parseCode(); + case 'blockcode': + return this.parseBlockCode(); + case 'if': + return this.parseConditional(); + case 'while': + return this.parseWhile(); + case 'call': + return this.parseCall(); + case 'interpolation': + return this.parseInterpolation(); + case 'yield': + return this.parseYield(); + case 'id': + case 'class': + this.tokens.defer({ + type: 'tag', + val: 'div', + line: this.peek().line, + filename: this.filename + }); + return this.parseExpr(); + default: + var pluginResult = this.runPlugin('expressionTokens', this.peek()); + if (pluginResult) return pluginResult; + this.error('INVALID_TOKEN', 'unexpected token "' + this.peek().type + '"', this.peek()); + } + }, + + parseDot: function() { + this.advance(); + return this.parseTextBlock(); + }, + + /** + * Text + */ + + parseText: function(options){ + var tags = []; + var lineno = this.peek().line; + var nextTok = this.peek(); + loop: + while (true) { + switch (nextTok.type) { + case 'text': + var tok = this.advance(); + tags.push({ + type: 'Text', + val: tok.val, + line: tok.line, + filename: this.filename + }); + break; + case 'interpolated-code': + var tok = this.advance(); + tags.push({ + type: 'Code', + val: tok.val, + buffer: tok.buffer, + mustEscape: tok.mustEscape !== false, + isInline: true, + line: tok.line, + filename: this.filename + }); + break; + case 'newline': + if (!options || !options.block) break loop; + var tok = this.advance(); + if (this.peek().type === 'text') { + tags.push({ + type: 'Text', + val: '\n', + line: tok.line, + filename: this.filename + }); + } + break; + case 'start-pug-interpolation': + this.advance(); + tags.push(this.parseExpr()); + this.expect('end-pug-interpolation'); + break; + default: + var pluginResult = this.runPlugin('textTokens', nextTok, tags); + if (pluginResult) break; + break loop; + } + nextTok = this.peek(); + } + if (tags.length === 1) return tags[0]; + else return this.initBlock(lineno, tags); + }, + + parseTextHtml: function () { + var nodes = []; + var currentNode = null; +loop: + while (true) { + switch (this.peek().type) { + case 'text-html': + var text = this.advance(); + if (!currentNode) { + currentNode = { + type: 'Text', + val: text.val, + filename: this.filename, + line: text.line, + isHtml: true + }; + nodes.push(currentNode); + } else { + currentNode.val += '\n' + text.val; + } + break; + case 'indent': + var block = this.block(); + block.nodes.forEach(function (node) { + if (node.isHtml) { + if (!currentNode) { + currentNode = node; + nodes.push(currentNode); + } else { + currentNode.val += '\n' + node.val; + } + } else { + currentNode = null; + nodes.push(node); + } + }); + break; + case 'code': + currentNode = null; + nodes.push(this.parseCode(true)); + break; + case 'newline': + this.advance(); + break; + default: + break loop; + } + } + return nodes; + }, + + /** + * ':' expr + * | block + */ + + parseBlockExpansion: function(){ + var tok = this.accept(':'); + if (tok) { + return this.initBlock(tok.line, [this.parseExpr()]); + } else { + return this.block(); + } + }, + + /** + * case + */ + + parseCase: function(){ + var tok = this.expect('case'); + var node = {type: 'Case', expr: tok.val, line: tok.line, filename: this.filename}; + + var block = this.emptyBlock(tok.line + 1); + this.expect('indent'); + while ('outdent' != this.peek().type) { + switch (this.peek().type) { + case 'comment': + case 'newline': + this.advance(); + break; + case 'when': + block.nodes.push(this.parseWhen()); + break; + case 'default': + block.nodes.push(this.parseDefault()); + break; + default: + var pluginResult = this.runPlugin('caseTokens', this.peek(), block); + if (pluginResult) break; + this.error('INVALID_TOKEN', 'Unexpected token "' + this.peek().type + + '", expected "when", "default" or "newline"', this.peek()); + } + } + this.expect('outdent'); + + node.block = block; + + return node; + }, + + /** + * when + */ + + parseWhen: function(){ + var tok = this.expect('when'); + if (this.peek().type !== 'newline') { + return { + type: 'When', + expr: tok.val, + block: this.parseBlockExpansion(), + debug: false, + line: tok.line, + filename: this.filename + }; + } else { + return { + type: 'When', + expr: tok.val, + debug: false, + line: tok.line, + filename: this.filename + }; + } + }, + + /** + * default + */ + + parseDefault: function(){ + var tok = this.expect('default'); + return { + type: 'When', + expr: 'default', + block: this.parseBlockExpansion(), + debug: false, + line: tok.line, + filename: this.filename + }; + }, + + /** + * code + */ + + parseCode: function(noBlock){ + var tok = this.expect('code'); + assert(typeof tok.mustEscape === 'boolean', 'Please update to the newest version of pug-lexer.'); + var node = { + type: 'Code', + val: tok.val, + buffer: tok.buffer, + mustEscape: tok.mustEscape !== false, + isInline: !!noBlock, + line: tok.line, + filename: this.filename + }; + // todo: why is this here? It seems like a hacky workaround + if (node.val.match(/^ *else/)) node.debug = false; + + if (noBlock) return node; + + var block; + + // handle block + block = 'indent' == this.peek().type; + if (block) { + if (tok.buffer) { + this.error('BLOCK_IN_BUFFERED_CODE', 'Buffered code cannot have a block attached to it', this.peek()); + } + node.block = this.block(); + } + + return node; + }, + parseConditional: function(){ + var tok = this.expect('if'); + var node = { + type: 'Conditional', + test: tok.val, + consequent: this.emptyBlock(tok.line), + alternate: null, + line: tok.line, + filename: this.filename + }; + + // handle block + if ('indent' == this.peek().type) { + node.consequent = this.block(); + } + + var currentNode = node; + while (true) { + if (this.peek().type === 'newline') { + this.expect('newline'); + } else if (this.peek().type === 'else-if') { + tok = this.expect('else-if'); + currentNode = ( + currentNode.alternate = { + type: 'Conditional', + test: tok.val, + consequent: this.emptyBlock(tok.line), + alternate: null, + line: tok.line, + filename: this.filename + } + ); + if ('indent' == this.peek().type) { + currentNode.consequent = this.block(); + } + } else if (this.peek().type === 'else') { + this.expect('else'); + if (this.peek().type === 'indent') { + currentNode.alternate = this.block(); + } + break; + } else { + break; + } + } + + return node; + }, + parseWhile: function(){ + var tok = this.expect('while'); + var node = { + type: 'While', + test: tok.val, + line: tok.line, + filename: this.filename + }; + + // handle block + if ('indent' == this.peek().type) { + node.block = this.block(); + } else { + node.block = this.emptyBlock(tok.line); + } + + return node; + }, + + /** + * block code + */ + + parseBlockCode: function(){ + var line = this.expect('blockcode').line; + var body = this.peek(); + var text = ''; + if (body.type === 'start-pipeless-text') { + this.advance(); + while (this.peek().type !== 'end-pipeless-text') { + var tok = this.advance(); + switch (tok.type) { + case 'text': + text += tok.val; + break; + case 'newline': + text += '\n'; + break; + default: + var pluginResult = this.runPlugin('blockCodeTokens', tok, tok); + if (pluginResult) { + text += pluginResult; + break; + } + this.error('INVALID_TOKEN', 'Unexpected token type: ' + tok.type, tok); + } + } + this.advance(); + } + return { + type: 'Code', + val: text, + buffer: false, + mustEscape: false, + isInline: false, + line: line, + filename: this.filename + }; + }, + /** + * comment + */ + + parseComment: function(){ + var tok = this.expect('comment'); + var block; + if (block = this.parseTextBlock()) { + return { + type: 'BlockComment', + val: tok.val, + block: block, + buffer: tok.buffer, + line: tok.line, + filename: this.filename + }; + } else { + return { + type: 'Comment', + val: tok.val, + buffer: tok.buffer, + line: tok.line, + filename: this.filename + }; + } + }, + + /** + * doctype + */ + + parseDoctype: function(){ + var tok = this.expect('doctype'); + return { + type: 'Doctype', + val: tok.val, + line: tok.line, + filename: this.filename + }; + }, + + parseIncludeFilter: function() { + var tok = this.expect('filter'); + var attrs = []; + + if (this.peek().type === 'start-attributes') { + attrs = this.attrs(); + } + + return { + type: 'IncludeFilter', + name: tok.val, + attrs: attrs, + line: tok.line, + filename: this.filename + }; + }, + + /** + * filter attrs? text-block + */ + + parseFilter: function(){ + var tok = this.expect('filter'); + var block, attrs = []; + + if (this.peek().type === 'start-attributes') { + attrs = this.attrs(); + } + + if (this.peek().type === 'text') { + var textToken = this.advance(); + block = this.initBlock(textToken.line, [ + { + type: 'Text', + val: textToken.val, + line: textToken.line, + filename: this.filename + } + ]); + } else if (this.peek().type === 'filter') { + block = this.initBlock(tok.line, [this.parseFilter()]); + } else { + block = this.parseTextBlock() || this.emptyBlock(tok.line); + } + + return { + type: 'Filter', + name: tok.val, + block: block, + attrs: attrs, + line: tok.line, + filename: this.filename + }; + }, + + /** + * each block + */ + + parseEach: function(){ + var tok = this.expect('each'); + var node = { + type: 'Each', + obj: tok.code, + val: tok.val, + key: tok.key, + block: this.block(), + line: tok.line, + filename: this.filename + }; + if (this.peek().type == 'else') { + this.advance(); + node.alternate = this.block(); + } + return node; + }, + + /** + * 'extends' name + */ + + parseExtends: function(){ + var tok = this.expect('extends'); + var path = this.expect('path'); + return { + type: 'Extends', + file: { + type: 'FileReference', + path: path.val.trim(), + line: tok.line, + filename: this.filename + }, + line: tok.line, + filename: this.filename + }; + }, + + /** + * 'block' name block + */ + + parseBlock: function(){ + var tok = this.expect('block'); + + var node = 'indent' == this.peek().type ? this.block() : this.emptyBlock(tok.line); + node.type = 'NamedBlock'; + node.name = tok.val.trim(); + node.mode = tok.mode; + node.line = tok.line; + + return node; + }, + + parseMixinBlock: function () { + var tok = this.expect('mixin-block'); + if (!this.inMixin) { + this.error('BLOCK_OUTISDE_MIXIN', 'Anonymous blocks are not allowed unless they are part of a mixin.', tok); + } + return {type: 'MixinBlock', line: tok.line, filename: this.filename}; + }, + + parseYield: function() { + var tok = this.expect('yield'); + return {type: 'YieldBlock', line: tok.line, filename: this.filename}; + }, + + /** + * include block? + */ + + parseInclude: function(){ + var tok = this.expect('include'); + var node = { + type: 'Include', + file: { + type: 'FileReference', + line: tok.line, + filename: this.filename + }, + line: tok.line, + filename: this.filename + }; + var filters = []; + while (this.peek().type === 'filter') { + filters.push(this.parseIncludeFilter()); + } + var path = this.expect('path'); + + node.file.path = path.val.trim(); + + if ((/\.jade$/.test(node.file.path) || /\.pug$/.test(node.file.path)) && !filters.length) { + node.block = 'indent' == this.peek().type ? this.block() : this.emptyBlock(tok.line); + if (/\.jade$/.test(node.file.path)) { + console.warn( + this.filename + ', line ' + tok.line + + ':\nThe .jade extension is deprecated, use .pug for "' + node.file.path +'".' + ); + } + } else { + node.type = 'RawInclude'; + node.filters = filters; + if (this.peek().type === 'indent') { + this.error('RAW_INCLUDE_BLOCK', 'Raw inclusion cannot contain a block', this.peek()); + } + } + return node; + }, + + /** + * call ident block + */ + + parseCall: function(){ + var tok = this.expect('call'); + var name = tok.val; + var args = tok.args; + var mixin = { + type: 'Mixin', + name: name, + args: args, + block: this.emptyBlock(tok.line), + call: true, + attrs: [], + attributeBlocks: [], + line: tok.line, + filename: this.filename + }; + + this.tag(mixin); + if (mixin.code) { + mixin.block.nodes.push(mixin.code); + delete mixin.code; + } + if (mixin.block.nodes.length === 0) mixin.block = null; + return mixin; + }, + + /** + * mixin block + */ + + parseMixin: function(){ + var tok = this.expect('mixin'); + var name = tok.val; + var args = tok.args; + + if ('indent' == this.peek().type) { + this.inMixin++; + var mixin = { + type: 'Mixin', + name: name, + args: args, + block: this.block(), + call: false, + line: tok.line, + filename: this.filename + }; + this.inMixin--; + return mixin; + } else { + this.error('MIXIN_WITHOUT_BODY', 'Mixin ' + name + ' declared without body', tok); + } + }, + + /** + * indent (text | newline)* outdent + */ + + parseTextBlock: function(){ + var tok = this.accept('start-pipeless-text'); + if (!tok) return; + var block = this.emptyBlock(tok.line); + while (this.peek().type !== 'end-pipeless-text') { + var tok = this.advance(); + switch (tok.type) { + case 'text': + block.nodes.push({type: 'Text', val: tok.val, line: tok.line}); + break; + case 'newline': + block.nodes.push({type: 'Text', val: '\n', line: tok.line}); + break; + case 'start-pug-interpolation': + block.nodes.push(this.parseExpr()); + this.expect('end-pug-interpolation'); + break; + case 'interpolated-code': + block.nodes.push({ + type: 'Code', + val: tok.val, + buffer: tok.buffer, + mustEscape: tok.mustEscape !== false, + isInline: true, + line: tok.line, + filename: this.filename + }); + break; + default: + var pluginResult = this.runPlugin('textBlockTokens', tok, block, tok); + if (pluginResult) break; + this.error('INVALID_TOKEN', 'Unexpected token type: ' + tok.type, tok); + } + } + this.advance(); + return block; + }, + + /** + * indent expr* outdent + */ + + block: function(){ + var tok = this.expect('indent'); + var block = this.emptyBlock(tok.line); + while ('outdent' != this.peek().type) { + if ('newline' == this.peek().type) { + this.advance(); + } else if ('text-html' == this.peek().type) { + block.nodes = block.nodes.concat(this.parseTextHtml()); + } else { + var expr = this.parseExpr(); + block.nodes.push(expr); + } + } + this.expect('outdent'); + return block; + }, + + /** + * interpolation (attrs | class | id)* (text | code | ':')? newline* block? + */ + + parseInterpolation: function(){ + var tok = this.advance(); + var tag = { + type: 'InterpolatedTag', + expr: tok.val, + selfClosing: false, + block: this.emptyBlock(tok.line), + attrs: [], + attributeBlocks: [], + isInline: false, + line: tok.line, + filename: this.filename + }; + + return this.tag(tag, {selfClosingAllowed: true}); + }, + + /** + * tag (attrs | class | id)* (text | code | ':')? newline* block? + */ + + parseTag: function(){ + var tok = this.advance(); + var tag = { + type: 'Tag', + name: tok.val, + selfClosing: false, + block: this.emptyBlock(tok.line), + attrs: [], + attributeBlocks: [], + isInline: inlineTags.indexOf(tok.val) !== -1, + line: tok.line, + filename: this.filename + }; + + return this.tag(tag, {selfClosingAllowed: true}); + }, + + /** + * Parse tag. + */ + + tag: function(tag, options) { + var seenAttrs = false; + var attributeNames = []; + var selfClosingAllowed = options && options.selfClosingAllowed; + // (attrs | class | id)* + out: + while (true) { + switch (this.peek().type) { + case 'id': + case 'class': + var tok = this.advance(); + if (tok.type === 'id') { + if (attributeNames.indexOf('id') !== -1) { + this.error('DUPLICATE_ID', 'Duplicate attribute "id" is not allowed.', tok); + } + attributeNames.push('id'); + } + tag.attrs.push({ + name: tok.type, + val: "'" + tok.val + "'", + mustEscape: false + }); + continue; + case 'start-attributes': + if (seenAttrs) { + console.warn(this.filename + ', line ' + this.peek().line + ':\nYou should not have pug tags with multiple attributes.'); + } + seenAttrs = true; + tag.attrs = tag.attrs.concat(this.attrs(attributeNames)); + continue; + case '&attributes': + var tok = this.advance(); + tag.attributeBlocks.push(tok.val); + break; + default: + var pluginResult = this.runPlugin('tagAttributeTokens', this.peek(), tag, attributeNames); + if (pluginResult) break; + break out; + } + } + + // check immediate '.' + if ('dot' == this.peek().type) { + tag.textOnly = true; + this.advance(); + } + + // (text | code | ':')? + switch (this.peek().type) { + case 'text': + case 'interpolated-code': + var text = this.parseText(); + if (text.type === 'Block') { + tag.block.nodes.push.apply(tag.block.nodes, text.nodes); + } else { + tag.block.nodes.push(text); + } + break; + case 'code': + tag.block.nodes.push(this.parseCode(true)); + break; + case ':': + this.advance(); + tag.block = this.initBlock(tag.line, [this.parseExpr()]); + break; + case 'newline': + case 'indent': + case 'outdent': + case 'eos': + case 'start-pipeless-text': + case 'end-pug-interpolation': + break; + case 'slash': + if (selfClosingAllowed) { + this.advance(); + tag.selfClosing = true; + break; + } + default: + var pluginResult = this.runPlugin('tagTokens', this.peek(), tag, options); + if (pluginResult) break; + this.error('INVALID_TOKEN', 'Unexpected token `' + this.peek().type + '` expected `text`, `interpolated-code`, `code`, `:`' + (selfClosingAllowed ? ', `slash`' : '') + ', `newline` or `eos`', this.peek()) + } + + // newline* + while ('newline' == this.peek().type) this.advance(); + + // block? + if (tag.textOnly) { + tag.block = this.parseTextBlock() || this.emptyBlock(tag.line); + } else if ('indent' == this.peek().type) { + var block = this.block(); + for (var i = 0, len = block.nodes.length; i < len; ++i) { + tag.block.nodes.push(block.nodes[i]); + } + } + + return tag; + }, + + attrs: function(attributeNames) { + this.expect('start-attributes'); + + var attrs = []; + var tok = this.advance(); + while (tok.type === 'attribute') { + if (tok.name !== 'class' && attributeNames) { + if (attributeNames.indexOf(tok.name) !== -1) { + this.error('DUPLICATE_ATTRIBUTE', 'Duplicate attribute "' + tok.name + '" is not allowed.', tok); + } + attributeNames.push(tok.name); + } + attrs.push({ + name: tok.name, + val: tok.val, + mustEscape: tok.mustEscape !== false + }); + tok = this.advance(); + } + this.tokens.defer(tok); + this.expect('end-attributes'); + return attrs; + } +}; diff --git a/node_modules/pug-parser/lib/inline-tags.js b/node_modules/pug-parser/lib/inline-tags.js new file mode 100644 index 0000000..a2345b1 --- /dev/null +++ b/node_modules/pug-parser/lib/inline-tags.js @@ -0,0 +1,23 @@ +'use strict'; + +module.exports = [ + 'a' + , 'abbr' + , 'acronym' + , 'b' + , 'br' + , 'code' + , 'em' + , 'font' + , 'i' + , 'img' + , 'ins' + , 'kbd' + , 'map' + , 'samp' + , 'small' + , 'span' + , 'strong' + , 'sub' + , 'sup' +]; \ No newline at end of file diff --git a/node_modules/pug-parser/package.json b/node_modules/pug-parser/package.json new file mode 100644 index 0000000..6d03db8 --- /dev/null +++ b/node_modules/pug-parser/package.json @@ -0,0 +1,52 @@ +{ + "_from": "pug-parser@^2.0.2", + "_id": "pug-parser@2.0.2", + "_inBundle": false, + "_integrity": "sha1-U6aAz9BQOdywwn0CkJS8SnkmibA=", + "_location": "/pug-parser", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "pug-parser@^2.0.2", + "name": "pug-parser", + "escapedName": "pug-parser", + "rawSpec": "^2.0.2", + "saveSpec": null, + "fetchSpec": "^2.0.2" + }, + "_requiredBy": [ + "/pug" + ], + "_resolved": "https://registry.npmjs.org/pug-parser/-/pug-parser-2.0.2.tgz", + "_shasum": "53a680cfd05039dcb0c27d029094bc4a792689b0", + "_spec": "pug-parser@^2.0.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/pug", + "author": { + "name": "ForbesLindesay" + }, + "bugs": { + "url": "https://github.com/pugjs/pug-parser/issues" + }, + "bundleDependencies": false, + "dependencies": { + "pug-error": "^1.3.2", + "token-stream": "0.0.1" + }, + "deprecated": false, + "description": "The pug parser (takes an array of tokens and converts it to an abstract syntax tree)", + "devDependencies": { + "get-repo": "^1.0.0" + }, + "homepage": "https://github.com/pugjs/pug-parser#readme", + "keywords": [ + "pug" + ], + "license": "MIT", + "name": "pug-parser", + "repository": { + "type": "git", + "url": "git+https://github.com/pugjs/pug-parser.git" + }, + "version": "2.0.2" +} diff --git a/node_modules/pug-parser/test/__snapshots__/index.test.js.snap b/node_modules/pug-parser/test/__snapshots__/index.test.js.snap new file mode 100644 index 0000000..80d3610 --- /dev/null +++ b/node_modules/pug-parser/test/__snapshots__/index.test.js.snap @@ -0,0 +1,17179 @@ +exports[`test attr-es2015.tokens.json 1`] = ` +Object { + "filename": "attr-es2015.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "buffer": false, + "filename": "attr-es2015.tokens.json", + "isInline": false, + "line": 1, + "mustEscape": false, + "type": "Code", + "val": "var avatar = \'219b77f9d21de75e81851b6b886057c7\'", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'avatar-div\'", + }, + Object { + "mustEscape": true, + "name": "style", + "val": "\`background-image: url(https://www.gravatar.com/avatar/\${avatar})\`", + }, + ], + "block": Object { + "filename": "attr-es2015.tokens.json", + "line": 3, + "nodes": Array [], + "type": "Block", + }, + "filename": "attr-es2015.tokens.json", + "isInline": false, + "line": 3, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test attrs.js.tokens.json 1`] = ` +Object { + "filename": "attrs.js.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "buffer": false, + "filename": "attrs.js.tokens.json", + "isInline": false, + "line": 1, + "mustEscape": false, + "type": "Code", + "val": "var id = 5", + }, + Object { + "buffer": false, + "filename": "attrs.js.tokens.json", + "isInline": false, + "line": 2, + "mustEscape": false, + "type": "Code", + "val": "function answer() { return 42; }", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "href", + "val": "\'/user/\' + id", + }, + Object { + "mustEscape": true, + "name": "class", + "val": "\'button\'", + }, + ], + "block": Object { + "filename": "attrs.js.tokens.json", + "line": 3, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.js.tokens.json", + "isInline": true, + "line": 3, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "href", + "val": "\'/user/\' + id", + }, + Object { + "mustEscape": true, + "name": "class", + "val": "\'button\'", + }, + ], + "block": Object { + "filename": "attrs.js.tokens.json", + "line": 4, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.js.tokens.json", + "isInline": true, + "line": 4, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "key", + "val": "\'answer\'", + }, + Object { + "mustEscape": true, + "name": "value", + "val": "answer()", + }, + ], + "block": Object { + "filename": "attrs.js.tokens.json", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.js.tokens.json", + "isInline": false, + "line": 5, + "name": "meta", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "class", + "val": "[\'class1\', \'class2\']", + }, + ], + "block": Object { + "filename": "attrs.js.tokens.json", + "line": 6, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.js.tokens.json", + "isInline": true, + "line": 6, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'tag-class\'", + }, + Object { + "mustEscape": true, + "name": "class", + "val": "[\'class1\', \'class2\']", + }, + ], + "block": Object { + "filename": "attrs.js.tokens.json", + "line": 7, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.js.tokens.json", + "isInline": true, + "line": 7, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "href", + "val": "\'/user/\' + id", + }, + Object { + "mustEscape": true, + "name": "class", + "val": "\'button\'", + }, + ], + "block": Object { + "filename": "attrs.js.tokens.json", + "line": 9, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.js.tokens.json", + "isInline": true, + "line": 9, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "href", + "val": "\'/user/\' + id", + }, + Object { + "mustEscape": true, + "name": "class", + "val": "\'button\'", + }, + ], + "block": Object { + "filename": "attrs.js.tokens.json", + "line": 10, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.js.tokens.json", + "isInline": true, + "line": 10, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "key", + "val": "\'answer\'", + }, + Object { + "mustEscape": true, + "name": "value", + "val": "answer()", + }, + ], + "block": Object { + "filename": "attrs.js.tokens.json", + "line": 11, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.js.tokens.json", + "isInline": false, + "line": 11, + "name": "meta", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "class", + "val": "[\'class1\', \'class2\']", + }, + ], + "block": Object { + "filename": "attrs.js.tokens.json", + "line": 12, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.js.tokens.json", + "isInline": true, + "line": 12, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'tag-class\'", + }, + Object { + "mustEscape": true, + "name": "class", + "val": "[\'class1\', \'class2\']", + }, + ], + "block": Object { + "filename": "attrs.js.tokens.json", + "line": 13, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.js.tokens.json", + "isInline": true, + "line": 13, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [ + "{foo: \'bar\'}", + ], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "id", + "val": "id", + }, + ], + "block": Object { + "filename": "attrs.js.tokens.json", + "line": 15, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.js.tokens.json", + "isInline": false, + "line": 15, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + Object { + "buffer": false, + "filename": "attrs.js.tokens.json", + "isInline": false, + "line": 16, + "mustEscape": false, + "type": "Code", + "val": "var bar = null", + }, + Object { + "attributeBlocks": Array [ + "{baz: \'baz\'}", + ], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "foo", + "val": "null", + }, + Object { + "mustEscape": true, + "name": "bar", + "val": "bar", + }, + ], + "block": Object { + "filename": "attrs.js.tokens.json", + "line": 17, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.js.tokens.json", + "isInline": false, + "line": 17, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test attrs.tokens.json 1`] = ` +Object { + "filename": "attrs.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "href", + "val": "\'/contact\'", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 1, + "nodes": Array [ + Object { + "filename": "attrs.tokens.json", + "line": 1, + "type": "Text", + "val": "contact", + }, + ], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": true, + "line": 1, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "href", + "val": "\'/save\'", + }, + Object { + "mustEscape": false, + "name": "class", + "val": "\'button\'", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 2, + "nodes": Array [ + Object { + "filename": "attrs.tokens.json", + "line": 2, + "type": "Text", + "val": "save", + }, + ], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": true, + "line": 2, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "foo", + "val": true, + }, + Object { + "mustEscape": false, + "name": "bar", + "val": true, + }, + Object { + "mustEscape": false, + "name": "baz", + "val": true, + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 3, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": true, + "line": 3, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "foo", + "val": "\'foo, bar, baz\'", + }, + Object { + "mustEscape": true, + "name": "bar", + "val": "1", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 4, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": true, + "line": 4, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "foo", + "val": "\'((foo))\'", + }, + Object { + "mustEscape": true, + "name": "bar", + "val": "(1) ? 1 : 0", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": true, + "line": 5, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "attrs.tokens.json", + "line": 6, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "value", + "val": "\'foo\'", + }, + Object { + "mustEscape": false, + "name": "selected", + "val": true, + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 7, + "nodes": Array [ + Object { + "filename": "attrs.tokens.json", + "line": 7, + "type": "Text", + "val": "Foo", + }, + ], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 7, + "name": "option", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "selected", + "val": true, + }, + Object { + "mustEscape": true, + "name": "value", + "val": "\'bar\'", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 8, + "nodes": Array [ + Object { + "filename": "attrs.tokens.json", + "line": 8, + "type": "Text", + "val": "Bar", + }, + ], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 8, + "name": "option", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 6, + "name": "select", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "foo", + "val": "\"class:\"", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 9, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": true, + "line": 9, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "pattern", + "val": "\'\\\\S+\'", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 10, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 10, + "name": "input", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "href", + "val": "\'/contact\'", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 12, + "nodes": Array [ + Object { + "filename": "attrs.tokens.json", + "line": 12, + "type": "Text", + "val": "contact", + }, + ], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": true, + "line": 12, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "href", + "val": "\'/save\'", + }, + Object { + "mustEscape": false, + "name": "class", + "val": "\'button\'", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 13, + "nodes": Array [ + Object { + "filename": "attrs.tokens.json", + "line": 13, + "type": "Text", + "val": "save", + }, + ], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": true, + "line": 13, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "foo", + "val": true, + }, + Object { + "mustEscape": false, + "name": "bar", + "val": true, + }, + Object { + "mustEscape": false, + "name": "baz", + "val": true, + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 14, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": true, + "line": 14, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "foo", + "val": "\'foo, bar, baz\'", + }, + Object { + "mustEscape": true, + "name": "bar", + "val": "1", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 15, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": true, + "line": 15, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "foo", + "val": "\'((foo))\'", + }, + Object { + "mustEscape": true, + "name": "bar", + "val": "(1) ? 1 : 0", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 16, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": true, + "line": 16, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "attrs.tokens.json", + "line": 17, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "value", + "val": "\'foo\'", + }, + Object { + "mustEscape": false, + "name": "selected", + "val": true, + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 18, + "nodes": Array [ + Object { + "filename": "attrs.tokens.json", + "line": 18, + "type": "Text", + "val": "Foo", + }, + ], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 18, + "name": "option", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "selected", + "val": true, + }, + Object { + "mustEscape": true, + "name": "value", + "val": "\'bar\'", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 19, + "nodes": Array [ + Object { + "filename": "attrs.tokens.json", + "line": 19, + "type": "Text", + "val": "Bar", + }, + ], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 19, + "name": "option", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 17, + "name": "select", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "foo", + "val": "\"class:\"", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 20, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": true, + "line": 20, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "pattern", + "val": "\'\\\\S+\'", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 21, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 21, + "name": "input", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "terse", + "val": "\"true\"", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 22, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 22, + "name": "foo", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "date", + "val": "new Date(0)", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 23, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 23, + "name": "foo", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "abc", + "val": true, + }, + Object { + "mustEscape": false, + "name": "def", + "val": true, + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 25, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 25, + "name": "foo", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "abc", + "val": true, + }, + Object { + "mustEscape": false, + "name": "def", + "val": true, + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 27, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 27, + "name": "foo", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "abc", + "val": true, + }, + Object { + "mustEscape": false, + "name": "def", + "val": true, + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 29, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 29, + "name": "foo", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "abc", + "val": true, + }, + Object { + "mustEscape": false, + "name": "def", + "val": true, + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 31, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 31, + "name": "foo", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "abc", + "val": true, + }, + Object { + "mustEscape": false, + "name": "def", + "val": true, + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 33, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 33, + "name": "foo", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "abc", + "val": true, + }, + Object { + "mustEscape": false, + "name": "def", + "val": true, + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 35, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 35, + "name": "foo", + "selfClosing": false, + "type": "Tag", + }, + Object { + "buffer": false, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 38, + "mustEscape": false, + "type": "Code", + "val": "var attrs = {foo: \'bar\', bar: \'\'}", + }, + Object { + "attributeBlocks": Array [ + "attrs", + ], + "attrs": Array [], + "block": Object { + "filename": "attrs.tokens.json", + "line": 40, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": false, + "line": 40, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "foo", + "val": "\'foo\'", + }, + Object { + "mustEscape": true, + "name": "bar", + "val": "\"bar\"", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 42, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": true, + "line": 42, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "foo", + "val": "\'foo\'", + }, + Object { + "mustEscape": true, + "name": "bar", + "val": "\'bar\'", + }, + ], + "block": Object { + "filename": "attrs.tokens.json", + "line": 43, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs.tokens.json", + "isInline": true, + "line": 43, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test attrs.unescaped.tokens.json 1`] = ` +Object { + "filename": "attrs.unescaped.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "type", + "val": "\'text/x-template\'", + }, + ], + "block": Object { + "filename": "attrs.unescaped.tokens.json", + "line": 1, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "id", + "val": "\'user-<%= user.id %>\'", + }, + ], + "block": Object { + "filename": "attrs.unescaped.tokens.json", + "line": 2, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "attrs.unescaped.tokens.json", + "line": 3, + "nodes": Array [ + Object { + "filename": "attrs.unescaped.tokens.json", + "line": 3, + "type": "Text", + "val": "<%= user.title %>", + }, + ], + "type": "Block", + }, + "filename": "attrs.unescaped.tokens.json", + "isInline": false, + "line": 3, + "name": "h1", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "attrs.unescaped.tokens.json", + "isInline": false, + "line": 2, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "attrs.unescaped.tokens.json", + "isInline": false, + "line": 1, + "name": "script", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test attrs-data.tokens.json 1`] = ` +Object { + "filename": "attrs-data.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "buffer": false, + "filename": "attrs-data.tokens.json", + "isInline": false, + "line": 1, + "mustEscape": false, + "type": "Code", + "val": "var user = { name: \'tobi\' }", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "data-user", + "val": "user", + }, + ], + "block": Object { + "filename": "attrs-data.tokens.json", + "line": 2, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs-data.tokens.json", + "isInline": false, + "line": 2, + "name": "foo", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "data-items", + "val": "[1,2,3]", + }, + ], + "block": Object { + "filename": "attrs-data.tokens.json", + "line": 3, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs-data.tokens.json", + "isInline": false, + "line": 3, + "name": "foo", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "data-username", + "val": "\'tobi\'", + }, + ], + "block": Object { + "filename": "attrs-data.tokens.json", + "line": 4, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs-data.tokens.json", + "isInline": false, + "line": 4, + "name": "foo", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "data-escaped", + "val": "{message: \"Let\'s rock!\"}", + }, + ], + "block": Object { + "filename": "attrs-data.tokens.json", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs-data.tokens.json", + "isInline": false, + "line": 5, + "name": "foo", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "data-ampersand", + "val": "{message: \"a quote: " this & that\"}", + }, + ], + "block": Object { + "filename": "attrs-data.tokens.json", + "line": 6, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs-data.tokens.json", + "isInline": false, + "line": 6, + "name": "foo", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "data-epoc", + "val": "new Date(0)", + }, + ], + "block": Object { + "filename": "attrs-data.tokens.json", + "line": 7, + "nodes": Array [], + "type": "Block", + }, + "filename": "attrs-data.tokens.json", + "isInline": false, + "line": 7, + "name": "foo", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test basic.tokens.json 1`] = ` +Object { + "filename": "basic.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "basic.tokens.json", + "line": 1, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "basic.tokens.json", + "line": 2, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "basic.tokens.json", + "line": 3, + "nodes": Array [ + Object { + "filename": "basic.tokens.json", + "line": 3, + "type": "Text", + "val": "Title", + }, + ], + "type": "Block", + }, + "filename": "basic.tokens.json", + "isInline": false, + "line": 3, + "name": "h1", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "basic.tokens.json", + "isInline": false, + "line": 2, + "name": "body", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "basic.tokens.json", + "isInline": false, + "line": 1, + "name": "html", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test blanks.tokens.json 1`] = ` +Object { + "filename": "blanks.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "blanks.tokens.json", + "line": 3, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "blanks.tokens.json", + "line": 4, + "nodes": Array [ + Object { + "filename": "blanks.tokens.json", + "line": 4, + "type": "Text", + "val": "foo", + }, + ], + "type": "Block", + }, + "filename": "blanks.tokens.json", + "isInline": false, + "line": 4, + "name": "li", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "blanks.tokens.json", + "line": 6, + "nodes": Array [ + Object { + "filename": "blanks.tokens.json", + "line": 6, + "type": "Text", + "val": "bar", + }, + ], + "type": "Block", + }, + "filename": "blanks.tokens.json", + "isInline": false, + "line": 6, + "name": "li", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "blanks.tokens.json", + "line": 8, + "nodes": Array [ + Object { + "filename": "blanks.tokens.json", + "line": 8, + "type": "Text", + "val": "baz", + }, + ], + "type": "Block", + }, + "filename": "blanks.tokens.json", + "isInline": false, + "line": 8, + "name": "li", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "blanks.tokens.json", + "isInline": false, + "line": 3, + "name": "ul", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test block-code.tokens.json 1`] = ` +Object { + "filename": "block-code.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "buffer": false, + "filename": "block-code.tokens.json", + "isInline": false, + "line": 1, + "mustEscape": false, + "type": "Code", + "val": "list = [\"uno\", \"dos\", \"tres\", + \"cuatro\", \"cinco\", \"seis\"];", + }, + Object { + "buffer": false, + "filename": "block-code.tokens.json", + "line": 4, + "type": "Comment", + "val": " Without a block, the element is accepted and no code is generated", + }, + Object { + "buffer": false, + "filename": "block-code.tokens.json", + "isInline": false, + "line": 5, + "mustEscape": false, + "type": "Code", + "val": "", + }, + Object { + "block": Object { + "filename": "block-code.tokens.json", + "line": 7, + "nodes": Array [ + Object { + "buffer": false, + "filename": "block-code.tokens.json", + "isInline": false, + "line": 7, + "mustEscape": false, + "type": "Code", + "val": "string = item.charAt(0) + + .toUpperCase() + +item.slice(1);", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "block-code.tokens.json", + "line": 12, + "nodes": Array [ + Object { + "buffer": true, + "filename": "block-code.tokens.json", + "isInline": true, + "line": 12, + "mustEscape": true, + "type": "Code", + "val": "string", + }, + ], + "type": "Block", + }, + "filename": "block-code.tokens.json", + "isInline": false, + "line": 12, + "name": "li", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "block-code.tokens.json", + "key": null, + "line": 6, + "obj": "list", + "type": "Each", + "val": "item", + }, + ], + "type": "Block", +} +`; + +exports[`test block-expansion.shorthands.tokens.json 1`] = ` +Object { + "filename": "block-expansion.shorthands.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "block-expansion.shorthands.tokens.json", + "line": 1, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'list-item\'", + }, + ], + "block": Object { + "filename": "block-expansion.shorthands.tokens.json", + "line": 2, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'foo\'", + }, + ], + "block": Object { + "filename": "block-expansion.shorthands.tokens.json", + "line": 2, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "id", + "val": "\'bar\'", + }, + ], + "block": Object { + "filename": "block-expansion.shorthands.tokens.json", + "line": 2, + "nodes": Array [ + Object { + "filename": "block-expansion.shorthands.tokens.json", + "line": 2, + "type": "Text", + "val": "baz", + }, + ], + "type": "Block", + }, + "filename": "block-expansion.shorthands.tokens.json", + "isInline": false, + "line": 2, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "block-expansion.shorthands.tokens.json", + "isInline": false, + "line": 2, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "block-expansion.shorthands.tokens.json", + "isInline": false, + "line": 2, + "name": "li", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "block-expansion.shorthands.tokens.json", + "isInline": false, + "line": 1, + "name": "ul", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test block-expansion.tokens.json 1`] = ` +Object { + "filename": "block-expansion.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "block-expansion.tokens.json", + "line": 1, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "block-expansion.tokens.json", + "line": 2, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "href", + "val": "\'#\'", + }, + ], + "block": Object { + "filename": "block-expansion.tokens.json", + "line": 2, + "nodes": Array [ + Object { + "filename": "block-expansion.tokens.json", + "line": 2, + "type": "Text", + "val": "foo", + }, + ], + "type": "Block", + }, + "filename": "block-expansion.tokens.json", + "isInline": true, + "line": 2, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "block-expansion.tokens.json", + "isInline": false, + "line": 2, + "name": "li", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "block-expansion.tokens.json", + "line": 3, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "href", + "val": "\'#\'", + }, + ], + "block": Object { + "filename": "block-expansion.tokens.json", + "line": 3, + "nodes": Array [ + Object { + "filename": "block-expansion.tokens.json", + "line": 3, + "type": "Text", + "val": "bar", + }, + ], + "type": "Block", + }, + "filename": "block-expansion.tokens.json", + "isInline": true, + "line": 3, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "block-expansion.tokens.json", + "isInline": false, + "line": 3, + "name": "li", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "block-expansion.tokens.json", + "isInline": false, + "line": 1, + "name": "ul", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "block-expansion.tokens.json", + "line": 5, + "nodes": Array [ + Object { + "filename": "block-expansion.tokens.json", + "line": 5, + "type": "Text", + "val": "baz", + }, + ], + "type": "Block", + }, + "filename": "block-expansion.tokens.json", + "isInline": false, + "line": 5, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test blockquote.tokens.json 1`] = ` +Object { + "filename": "blockquote.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "blockquote.tokens.json", + "line": 1, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "blockquote.tokens.json", + "line": 2, + "nodes": Array [ + Object { + "filename": "blockquote.tokens.json", + "line": 3, + "type": "Text", + "val": "Try to define yourself by what you do, and you’ll burnout every time. You are. That is enough. I rest in that.", + }, + ], + "type": "Block", + }, + "filename": "blockquote.tokens.json", + "isInline": false, + "line": 2, + "name": "blockquote", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "blockquote.tokens.json", + "line": 4, + "nodes": Array [ + Object { + "filename": "blockquote.tokens.json", + "line": 4, + "type": "Text", + "val": "from @thefray at 1:43pm on May 10", + }, + ], + "type": "Block", + }, + "filename": "blockquote.tokens.json", + "isInline": false, + "line": 4, + "name": "figcaption", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "blockquote.tokens.json", + "isInline": false, + "line": 1, + "name": "figure", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test blocks-in-blocks.tokens.json 1`] = ` +Object { + "filename": "blocks-in-blocks.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "file": Object { + "filename": "blocks-in-blocks.tokens.json", + "line": 1, + "path": "./auxiliary/blocks-in-blocks-layout.pug", + "type": "FileReference", + }, + "filename": "blocks-in-blocks.tokens.json", + "line": 1, + "type": "Extends", + }, + Object { + "filename": "blocks-in-blocks.tokens.json", + "line": 3, + "mode": "replace", + "name": "body", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "blocks-in-blocks.tokens.json", + "line": 4, + "nodes": Array [ + Object { + "filename": "blocks-in-blocks.tokens.json", + "line": 4, + "type": "Text", + "val": "Page 2", + }, + ], + "type": "Block", + }, + "filename": "blocks-in-blocks.tokens.json", + "isInline": false, + "line": 4, + "name": "h1", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + ], + "type": "Block", +} +`; + +exports[`test blocks-in-if.tokens.json 1`] = ` +Object { + "filename": "blocks-in-if.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "buffer": false, + "filename": "blocks-in-if.tokens.json", + "line": 1, + "type": "Comment", + "val": " see https://github.com/pugjs/pug/issues/1589", + }, + Object { + "buffer": false, + "filename": "blocks-in-if.tokens.json", + "isInline": false, + "line": 3, + "mustEscape": false, + "type": "Code", + "val": "var ajax = true", + }, + Object { + "block": Object { + "filename": "blocks-in-if.tokens.json", + "line": 6, + "nodes": Array [ + Object { + "buffer": false, + "filename": "blocks-in-if.tokens.json", + "line": 6, + "type": "Comment", + "val": " return only contents if ajax requests", + }, + Object { + "filename": "blocks-in-if.tokens.json", + "line": 7, + "mode": "replace", + "name": "contents", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "blocks-in-if.tokens.json", + "line": 8, + "nodes": Array [ + Object { + "filename": "blocks-in-if.tokens.json", + "line": 8, + "type": "Text", + "val": "ajax contents", + }, + ], + "type": "Block", + }, + "filename": "blocks-in-if.tokens.json", + "isInline": false, + "line": 8, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + ], + "type": "Block", + }, + "buffer": false, + "filename": "blocks-in-if.tokens.json", + "isInline": false, + "line": 5, + "mustEscape": false, + "type": "Code", + "val": "if( ajax )", + }, + Object { + "block": Object { + "filename": "blocks-in-if.tokens.json", + "line": 11, + "nodes": Array [ + Object { + "buffer": false, + "filename": "blocks-in-if.tokens.json", + "line": 11, + "type": "Comment", + "val": " return all html", + }, + Object { + "filename": "blocks-in-if.tokens.json", + "line": 12, + "type": "Doctype", + "val": "html", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "blocks-in-if.tokens.json", + "line": 13, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "blocks-in-if.tokens.json", + "line": 14, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "charset", + "val": "\'utf8\'", + }, + ], + "block": Object { + "filename": "blocks-in-if.tokens.json", + "line": 15, + "nodes": Array [], + "type": "Block", + }, + "filename": "blocks-in-if.tokens.json", + "isInline": false, + "line": 15, + "name": "meta", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "blocks-in-if.tokens.json", + "line": 16, + "nodes": Array [ + Object { + "filename": "blocks-in-if.tokens.json", + "line": 16, + "type": "Text", + "val": "sample", + }, + ], + "type": "Block", + }, + "filename": "blocks-in-if.tokens.json", + "isInline": false, + "line": 16, + "name": "title", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "blocks-in-if.tokens.json", + "line": 17, + "nodes": Array [ + Object { + "filename": "blocks-in-if.tokens.json", + "line": 18, + "mode": "replace", + "name": "contents", + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "blocks-in-if.tokens.json", + "line": 19, + "nodes": Array [ + Object { + "filename": "blocks-in-if.tokens.json", + "line": 19, + "type": "Text", + "val": "all contetns", + }, + ], + "type": "Block", + }, + "filename": "blocks-in-if.tokens.json", + "isInline": false, + "line": 19, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "NamedBlock", + }, + ], + "type": "Block", + }, + "filename": "blocks-in-if.tokens.json", + "isInline": false, + "line": 17, + "name": "body", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "blocks-in-if.tokens.json", + "isInline": false, + "line": 14, + "name": "head", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "blocks-in-if.tokens.json", + "isInline": false, + "line": 13, + "name": "html", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "buffer": false, + "debug": false, + "filename": "blocks-in-if.tokens.json", + "isInline": false, + "line": 10, + "mustEscape": false, + "type": "Code", + "val": "else", + }, + ], + "type": "Block", +} +`; + +exports[`test case.tokens.json 1`] = ` +Object { + "filename": "case.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "case.tokens.json", + "line": 1, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "case.tokens.json", + "line": 2, + "nodes": Array [ + Object { + "buffer": false, + "filename": "case.tokens.json", + "isInline": false, + "line": 3, + "mustEscape": false, + "type": "Code", + "val": "var friends = 1", + }, + Object { + "block": Object { + "filename": "case.tokens.json", + "line": 5, + "nodes": Array [ + Object { + "block": Object { + "filename": "case.tokens.json", + "line": 5, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "case.tokens.json", + "line": 5, + "nodes": Array [ + Object { + "filename": "case.tokens.json", + "line": 5, + "type": "Text", + "val": "you have no friends", + }, + ], + "type": "Block", + }, + "filename": "case.tokens.json", + "isInline": false, + "line": 5, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "debug": false, + "expr": "0", + "filename": "case.tokens.json", + "line": 5, + "type": "When", + }, + Object { + "block": Object { + "filename": "case.tokens.json", + "line": 6, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "case.tokens.json", + "line": 6, + "nodes": Array [ + Object { + "filename": "case.tokens.json", + "line": 6, + "type": "Text", + "val": "you have a friend", + }, + ], + "type": "Block", + }, + "filename": "case.tokens.json", + "isInline": false, + "line": 6, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "debug": false, + "expr": "1", + "filename": "case.tokens.json", + "line": 6, + "type": "When", + }, + Object { + "block": Object { + "filename": "case.tokens.json", + "line": 7, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "case.tokens.json", + "line": 7, + "nodes": Array [ + Object { + "filename": "case.tokens.json", + "line": 7, + "type": "Text", + "val": "you have ", + }, + Object { + "buffer": true, + "filename": "case.tokens.json", + "isInline": true, + "line": 7, + "mustEscape": true, + "type": "Code", + "val": "friends", + }, + Object { + "filename": "case.tokens.json", + "line": 7, + "type": "Text", + "val": " friends", + }, + ], + "type": "Block", + }, + "filename": "case.tokens.json", + "isInline": false, + "line": 7, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "debug": false, + "expr": "default", + "filename": "case.tokens.json", + "line": 7, + "type": "When", + }, + ], + "type": "Block", + }, + "expr": "friends", + "filename": "case.tokens.json", + "line": 4, + "type": "Case", + }, + Object { + "buffer": false, + "filename": "case.tokens.json", + "isInline": false, + "line": 8, + "mustEscape": false, + "type": "Code", + "val": "var friends = 0", + }, + Object { + "block": Object { + "filename": "case.tokens.json", + "line": 10, + "nodes": Array [ + Object { + "debug": false, + "expr": "0", + "filename": "case.tokens.json", + "line": 10, + "type": "When", + }, + Object { + "block": Object { + "filename": "case.tokens.json", + "line": 12, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "case.tokens.json", + "line": 12, + "nodes": Array [ + Object { + "filename": "case.tokens.json", + "line": 12, + "type": "Text", + "val": "you have very few friends", + }, + ], + "type": "Block", + }, + "filename": "case.tokens.json", + "isInline": false, + "line": 12, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "debug": false, + "expr": "1", + "filename": "case.tokens.json", + "line": 11, + "type": "When", + }, + Object { + "block": Object { + "filename": "case.tokens.json", + "line": 14, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "case.tokens.json", + "line": 14, + "nodes": Array [ + Object { + "filename": "case.tokens.json", + "line": 14, + "type": "Text", + "val": "you have ", + }, + Object { + "buffer": true, + "filename": "case.tokens.json", + "isInline": true, + "line": 14, + "mustEscape": true, + "type": "Code", + "val": "friends", + }, + Object { + "filename": "case.tokens.json", + "line": 14, + "type": "Text", + "val": " friends", + }, + ], + "type": "Block", + }, + "filename": "case.tokens.json", + "isInline": false, + "line": 14, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "debug": false, + "expr": "default", + "filename": "case.tokens.json", + "line": 13, + "type": "When", + }, + ], + "type": "Block", + }, + "expr": "friends", + "filename": "case.tokens.json", + "line": 9, + "type": "Case", + }, + ], + "type": "Block", + }, + "filename": "case.tokens.json", + "isInline": false, + "line": 2, + "name": "body", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "case.tokens.json", + "isInline": false, + "line": 1, + "name": "html", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test case-blocks.tokens.json 1`] = ` +Object { + "filename": "case-blocks.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "case-blocks.tokens.json", + "line": 1, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "case-blocks.tokens.json", + "line": 2, + "nodes": Array [ + Object { + "buffer": false, + "filename": "case-blocks.tokens.json", + "isInline": false, + "line": 3, + "mustEscape": false, + "type": "Code", + "val": "var friends = 1", + }, + Object { + "block": Object { + "filename": "case-blocks.tokens.json", + "line": 5, + "nodes": Array [ + Object { + "block": Object { + "filename": "case-blocks.tokens.json", + "line": 6, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "case-blocks.tokens.json", + "line": 6, + "nodes": Array [ + Object { + "filename": "case-blocks.tokens.json", + "line": 6, + "type": "Text", + "val": "you have no friends", + }, + ], + "type": "Block", + }, + "filename": "case-blocks.tokens.json", + "isInline": false, + "line": 6, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "debug": false, + "expr": "0", + "filename": "case-blocks.tokens.json", + "line": 5, + "type": "When", + }, + Object { + "block": Object { + "filename": "case-blocks.tokens.json", + "line": 8, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "case-blocks.tokens.json", + "line": 8, + "nodes": Array [ + Object { + "filename": "case-blocks.tokens.json", + "line": 8, + "type": "Text", + "val": "you have a friend", + }, + ], + "type": "Block", + }, + "filename": "case-blocks.tokens.json", + "isInline": false, + "line": 8, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "debug": false, + "expr": "1", + "filename": "case-blocks.tokens.json", + "line": 7, + "type": "When", + }, + Object { + "block": Object { + "filename": "case-blocks.tokens.json", + "line": 10, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "case-blocks.tokens.json", + "line": 10, + "nodes": Array [ + Object { + "filename": "case-blocks.tokens.json", + "line": 10, + "type": "Text", + "val": "you have ", + }, + Object { + "buffer": true, + "filename": "case-blocks.tokens.json", + "isInline": true, + "line": 10, + "mustEscape": true, + "type": "Code", + "val": "friends", + }, + Object { + "filename": "case-blocks.tokens.json", + "line": 10, + "type": "Text", + "val": " friends", + }, + ], + "type": "Block", + }, + "filename": "case-blocks.tokens.json", + "isInline": false, + "line": 10, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "debug": false, + "expr": "default", + "filename": "case-blocks.tokens.json", + "line": 9, + "type": "When", + }, + ], + "type": "Block", + }, + "expr": "friends", + "filename": "case-blocks.tokens.json", + "line": 4, + "type": "Case", + }, + ], + "type": "Block", + }, + "filename": "case-blocks.tokens.json", + "isInline": false, + "line": 2, + "name": "body", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "case-blocks.tokens.json", + "isInline": false, + "line": 1, + "name": "html", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test classes.tokens.json 1`] = ` +Object { + "filename": "classes.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "class", + "val": "[\'foo\', \'bar\', \'baz\']", + }, + ], + "block": Object { + "filename": "classes.tokens.json", + "line": 1, + "nodes": Array [], + "type": "Block", + }, + "filename": "classes.tokens.json", + "isInline": true, + "line": 1, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'foo\'", + }, + Object { + "mustEscape": true, + "name": "class", + "val": "\'bar\'", + }, + Object { + "mustEscape": false, + "name": "class", + "val": "\'baz\'", + }, + ], + "block": Object { + "filename": "classes.tokens.json", + "line": 5, + "nodes": Array [], + "type": "Block", + }, + "filename": "classes.tokens.json", + "isInline": true, + "line": 5, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'foo-bar_baz\'", + }, + ], + "block": Object { + "filename": "classes.tokens.json", + "line": 9, + "nodes": Array [], + "type": "Block", + }, + "filename": "classes.tokens.json", + "isInline": true, + "line": 9, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "class", + "val": "{foo: true, bar: false, baz: true}", + }, + ], + "block": Object { + "filename": "classes.tokens.json", + "line": 11, + "nodes": Array [], + "type": "Block", + }, + "filename": "classes.tokens.json", + "isInline": true, + "line": 11, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test classes-empty.tokens.json 1`] = ` +Object { + "filename": "classes-empty.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "class", + "val": "\'\'", + }, + ], + "block": Object { + "filename": "classes-empty.tokens.json", + "line": 1, + "nodes": Array [], + "type": "Block", + }, + "filename": "classes-empty.tokens.json", + "isInline": true, + "line": 1, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "class", + "val": "null", + }, + ], + "block": Object { + "filename": "classes-empty.tokens.json", + "line": 2, + "nodes": Array [], + "type": "Block", + }, + "filename": "classes-empty.tokens.json", + "isInline": true, + "line": 2, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": true, + "name": "class", + "val": "undefined", + }, + ], + "block": Object { + "filename": "classes-empty.tokens.json", + "line": 3, + "nodes": Array [], + "type": "Block", + }, + "filename": "classes-empty.tokens.json", + "isInline": true, + "line": 3, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + +exports[`test code.conditionals.tokens.json 1`] = ` +Object { + "filename": "code.conditionals.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 3, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 3, + "nodes": Array [ + Object { + "filename": "code.conditionals.tokens.json", + "line": 3, + "type": "Text", + "val": "foo", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 3, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "buffer": false, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 2, + "mustEscape": false, + "type": "Code", + "val": "if (true)", + }, + Object { + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 5, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 5, + "nodes": Array [ + Object { + "filename": "code.conditionals.tokens.json", + "line": 5, + "type": "Text", + "val": "bar", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 5, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "buffer": false, + "debug": false, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 4, + "mustEscape": false, + "type": "Code", + "val": "else", + }, + Object { + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 8, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 8, + "nodes": Array [ + Object { + "filename": "code.conditionals.tokens.json", + "line": 8, + "type": "Text", + "val": "foo", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 8, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "buffer": false, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 7, + "mustEscape": false, + "type": "Code", + "val": "if (true) {", + }, + Object { + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 10, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 10, + "nodes": Array [ + Object { + "filename": "code.conditionals.tokens.json", + "line": 10, + "type": "Text", + "val": "bar", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 10, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "buffer": false, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 9, + "mustEscape": false, + "type": "Code", + "val": "} else {", + }, + Object { + "buffer": false, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 11, + "mustEscape": false, + "type": "Code", + "val": "}", + }, + Object { + "alternate": Object { + "filename": "code.conditionals.tokens.json", + "line": 18, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 18, + "nodes": Array [ + Object { + "filename": "code.conditionals.tokens.json", + "line": 18, + "type": "Text", + "val": "bar", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 18, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "consequent": Object { + "filename": "code.conditionals.tokens.json", + "line": 14, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 14, + "nodes": Array [ + Object { + "filename": "code.conditionals.tokens.json", + "line": 14, + "type": "Text", + "val": "foo", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 14, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 15, + "nodes": Array [ + Object { + "filename": "code.conditionals.tokens.json", + "line": 15, + "type": "Text", + "val": "bar", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 15, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 16, + "nodes": Array [ + Object { + "filename": "code.conditionals.tokens.json", + "line": 16, + "type": "Text", + "val": "baz", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 16, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "line": 13, + "test": "true", + "type": "Conditional", + }, + Object { + "alternate": Object { + "filename": "code.conditionals.tokens.json", + "line": 23, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 23, + "nodes": Array [ + Object { + "filename": "code.conditionals.tokens.json", + "line": 23, + "type": "Text", + "val": "bar", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 23, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "consequent": Object { + "filename": "code.conditionals.tokens.json", + "line": 21, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 21, + "nodes": Array [ + Object { + "filename": "code.conditionals.tokens.json", + "line": 21, + "type": "Text", + "val": "foo", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 21, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "line": 20, + "test": "!(true)", + "type": "Conditional", + }, + Object { + "alternate": null, + "consequent": Object { + "filename": "code.conditionals.tokens.json", + "line": 26, + "nodes": Array [ + Object { + "alternate": null, + "consequent": Object { + "filename": "code.conditionals.tokens.json", + "line": 27, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 27, + "nodes": Array [ + Object { + "filename": "code.conditionals.tokens.json", + "line": 27, + "type": "Text", + "val": "yay", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 27, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "line": 26, + "test": "\'works\'", + "type": "Conditional", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "line": 25, + "test": "\'nested\'", + "type": "Conditional", + }, + Object { + "buffer": false, + "filename": "code.conditionals.tokens.json", + "line": 29, + "type": "Comment", + "val": " allow empty blocks", + }, + Object { + "alternate": Object { + "filename": "code.conditionals.tokens.json", + "line": 32, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'bar\'", + }, + ], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 32, + "nodes": Array [], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 32, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "consequent": Object { + "filename": "code.conditionals.tokens.json", + "line": 30, + "nodes": Array [], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "line": 30, + "test": "false", + "type": "Conditional", + }, + Object { + "alternate": null, + "consequent": Object { + "filename": "code.conditionals.tokens.json", + "line": 34, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'bar\'", + }, + ], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 34, + "nodes": Array [], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 34, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "line": 33, + "test": "true", + "type": "Conditional", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'bing\'", + }, + ], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 36, + "nodes": Array [], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 36, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + Object { + "alternate": Object { + "alternate": Object { + "filename": "code.conditionals.tokens.json", + "line": 43, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'foo\'", + }, + ], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 43, + "nodes": Array [], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 43, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "consequent": Object { + "filename": "code.conditionals.tokens.json", + "line": 41, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'bar\'", + }, + ], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 41, + "nodes": Array [], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 41, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "line": 40, + "test": "false", + "type": "Conditional", + }, + "consequent": Object { + "filename": "code.conditionals.tokens.json", + "line": 39, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "mustEscape": false, + "name": "class", + "val": "\'bing\'", + }, + ], + "block": Object { + "filename": "code.conditionals.tokens.json", + "line": 39, + "nodes": Array [], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "isInline": false, + "line": 39, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "filename": "code.conditionals.tokens.json", + "line": 38, + "test": "false", + "type": "Conditional", + }, + ], + "type": "Block", +} +`; + +exports[`test code.escape.tokens.json 1`] = ` +Object { + "filename": "code.escape.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "code.escape.tokens.json", + "line": 1, + "nodes": Array [ + Object { + "buffer": true, + "filename": "code.escape.tokens.json", + "isInline": true, + "line": 1, + "mustEscape": true, + "type": "Code", + "val": "\' + + +

Pug - node template engine

+
+

You are amazing

+

Pug is a terse and simple templating language with a strong focus on performance and powerful features.

+
+ + +``` + +## API + +For full API, see [pugjs.org/api/reference.html](https://pugjs.org/api/reference.html) + +```js +var pug = require('pug'); + +// compile +var fn = pug.compile('string of pug', options); +var html = fn(locals); + +// render +var html = pug.render('string of pug', merge(options, locals)); + +// renderFile +var html = pug.renderFile('filename.pug', merge(options, locals)); +``` + +### Options + + - `filename` Used in exceptions, and required when using includes + - `compileDebug` When `false` no debug instrumentation is compiled + - `pretty` Add pretty-indentation whitespace to output _(false by default)_ + +## Browser Support + + The latest version of pug can be download for the browser in standalone form from [here](https://pugjs.org/js/pug.js). It only supports the very latest browsers though, and is a large file. It is recommended that you pre-compile your pug templates to JavaScript. + + To compile a template for use on the client using the command line, do: + +```bash +$ pug --client --no-debug filename.pug +``` + +which will produce `filename.js` containing the compiled template. + +## Additional Resources + +Tutorials: + + - cssdeck interactive [Pug syntax tutorial](http://cssdeck.com/labs/learning-the-jade-templating-engine-syntax) + - cssdeck interactive [Pug logic tutorial](http://cssdeck.com/labs/jade-templating-tutorial-codecast-part-2) + - [Pug について。](https://gist.github.com/japboy/5402844) (A Japanese Tutorial) + +Implementations in other languages: + + - [Larpug - Pug for Laravel](https://github.com/acidjazz/larpug) + - [php](https://github.com/pug-php/pug) + - [scala](https://scalate.github.io/scalate/documentation/scaml-reference.html) + - [ruby](https://github.com/slim-template/slim) + - [python](https://github.com/SyrusAkbary/pyjade) + - [java](https://github.com/neuland/jade4j) + +Other: + + - [Emacs Mode](https://github.com/brianc/jade-mode) + - [Vim Syntax](https://github.com/digitaltoad/vim-pug) + - [TextMate Bundle](http://github.com/miksago/jade-tmbundle) + - [Coda/SubEtha syntax Mode](https://github.com/aaronmccall/jade.mode) + - [html2pug](https://github.com/donpark/html2jade) converter + - [pug2php](https://github.com/SE7ENSKY/jade2php) converter + - [Pug Server](https://github.com/ded/jade-server) Ideal for building local prototypes apart from any application + - [pug-ruby](https://github.com/yivo/pug-ruby) gem: Allows to invoke Pug and Jade from Ruby + - [pug-rails](https://github.com/yivo/pug-rails) gem: Integrates Pug and Jade into your Rails application + +## License + +MIT diff --git a/node_modules/pug/examples/README.md b/node_modules/pug/examples/README.md new file mode 100644 index 0000000..265bce2 --- /dev/null +++ b/node_modules/pug/examples/README.md @@ -0,0 +1,5 @@ +The examples in this directory can be run simply by something like. + + node attributes.js + +You can also open `browser.html` in a browser. diff --git a/node_modules/pug/examples/attributes.js b/node_modules/pug/examples/attributes.js new file mode 100644 index 0000000..ba5cc99 --- /dev/null +++ b/node_modules/pug/examples/attributes.js @@ -0,0 +1,11 @@ + +/** + * Module dependencies. + */ + +var pug = require('../') + , path = __dirname + '/attributes.pug' + , str = require('fs').readFileSync(path, 'utf8') + , fn = pug.compile(str, { filename: path, pretty: true }); + +console.log(fn({ name: 'tj' })); \ No newline at end of file diff --git a/node_modules/pug/examples/attributes.pug b/node_modules/pug/examples/attributes.pug new file mode 100644 index 0000000..b8baa5f --- /dev/null +++ b/node_modules/pug/examples/attributes.pug @@ -0,0 +1,8 @@ +div#id.left.container(class='user user-' + name) + h1.title= name + form + //- unbuffered comment :) + // An example of attributes. + input(type='text' name='user[name]' value=name) + input(checked, type='checkbox', name='user[blocked]') + input(type='submit', value='Update') \ No newline at end of file diff --git a/node_modules/pug/examples/code.js b/node_modules/pug/examples/code.js new file mode 100644 index 0000000..d797ce5 --- /dev/null +++ b/node_modules/pug/examples/code.js @@ -0,0 +1,16 @@ + +/** + * Module dependencies. + */ + +var pug = require('../') + , path = __dirname + '/code.pug' + , str = require('fs').readFileSync(path, 'utf8') + , fn = pug.compile(str, { filename: path, pretty: true }); + +var users = { + tj: { age: 23, email: 'tj@vision-media.ca', isA: 'human' }, + tobi: { age: 1, email: 'tobi@is-amazing.com', isA: 'ferret' } +}; + +console.log(fn({ users: users })); \ No newline at end of file diff --git a/node_modules/pug/examples/code.pug b/node_modules/pug/examples/code.pug new file mode 100644 index 0000000..d0cab66 --- /dev/null +++ b/node_modules/pug/examples/code.pug @@ -0,0 +1,17 @@ + +- var title = "Things" + +- + var subtitle = ["Really", "long", + "list", "of", + "words"] +h1= title +h2= subtitle.join(" ") + +ul#users + each user, name in users + // expands to if (user.isA == 'ferret') + if user.isA == 'ferret' + li(class='user-' + name) #{name} is just a ferret + else + li(class='user-' + name) #{name} #{user.email} \ No newline at end of file diff --git a/node_modules/pug/examples/dynamicscript.js b/node_modules/pug/examples/dynamicscript.js new file mode 100644 index 0000000..21958a8 --- /dev/null +++ b/node_modules/pug/examples/dynamicscript.js @@ -0,0 +1,16 @@ + +/** + * Module dependencies. + */ + +var pug = require('../'); + +var locals = { + users: { + tj: { age: 23, email: 'tj@vision-media.ca', isA: 'human' }, + tobi: { age: 1, email: 'tobi@is-amazing.com', isA: 'ferret' } + } +}; + +var fn = pug.compileFile(__dirname + '/dynamicscript.pug'); +console.log(fn(locals)); diff --git a/node_modules/pug/examples/dynamicscript.pug b/node_modules/pug/examples/dynamicscript.pug new file mode 100644 index 0000000..4e1c895 --- /dev/null +++ b/node_modules/pug/examples/dynamicscript.pug @@ -0,0 +1,5 @@ +html + head + title Dynamic Inline JavaScript + script. + var users = !{JSON.stringify(users).replace(/<\//g, "<\\/")} diff --git a/node_modules/pug/examples/each.js b/node_modules/pug/examples/each.js new file mode 100644 index 0000000..53bac82 --- /dev/null +++ b/node_modules/pug/examples/each.js @@ -0,0 +1,16 @@ + +/** + * Module dependencies. + */ + +var pug = require('../') + , path = __dirname + '/each.pug' + , str = require('fs').readFileSync(path, 'utf8') + , fn = pug.compile(str, { filename: path, pretty: true }); + +var users = { + tj: { age: 23, email: 'tj@vision-media.ca', isA: 'human' }, + tobi: { age: 1, email: 'tobi@is-amazing.com', isA: 'ferret' } +}; + +console.log(fn({ users: users })); \ No newline at end of file diff --git a/node_modules/pug/examples/each.pug b/node_modules/pug/examples/each.pug new file mode 100644 index 0000000..206c740 --- /dev/null +++ b/node_modules/pug/examples/each.pug @@ -0,0 +1,3 @@ +ul#users + each user, name in users + li(class='user-' + name) #{name} #{user.email} \ No newline at end of file diff --git a/node_modules/pug/examples/extend-layout.pug b/node_modules/pug/examples/extend-layout.pug new file mode 100644 index 0000000..0767f5f --- /dev/null +++ b/node_modules/pug/examples/extend-layout.pug @@ -0,0 +1,10 @@ +html + head + h1 My Site - #{title} + block scripts + script(src='/jquery.js') + body + block content + block foot + #footer + p some footer content \ No newline at end of file diff --git a/node_modules/pug/examples/extend.js b/node_modules/pug/examples/extend.js new file mode 100644 index 0000000..6adc86f --- /dev/null +++ b/node_modules/pug/examples/extend.js @@ -0,0 +1,18 @@ + +/** + * Module dependencies. + */ + +var pug = require('../') + , path = __dirname + '/extend.pug' + , str = require('fs').readFileSync(path, 'utf8') + , fn = pug.compile(str, { filename: path, pretty: true }); + +var tobi = { name: 'tobi', age: 2 }; +var loki = { name: 'loki', age: 1 }; +var jane = { name: 'jane', age: 5 }; + +console.log(fn({ + title: 'pets' + , pets: [tobi, loki, jane] +})); \ No newline at end of file diff --git a/node_modules/pug/examples/extend.pug b/node_modules/pug/examples/extend.pug new file mode 100644 index 0000000..0de55bd --- /dev/null +++ b/node_modules/pug/examples/extend.pug @@ -0,0 +1,11 @@ + +extends extend-layout.pug + +block scripts + script(src='/jquery.js') + script(src='/pets.js') + +block content + h1= title + each pet in pets + include pet.pug diff --git a/node_modules/pug/examples/form.js b/node_modules/pug/examples/form.js new file mode 100644 index 0000000..e706c47 --- /dev/null +++ b/node_modules/pug/examples/form.js @@ -0,0 +1,18 @@ + +/** + * Module dependencies. + */ + +var pug = require('../') + , path = __dirname + '/form.pug' + , str = require('fs').readFileSync(path, 'utf8') + , fn = pug.compile(str, { filename: path, pretty: true }); + +var user = { + name: 'TJ', + email: 'tj@vision-media.ca', + city: 'Victoria', + province: 'BC' +}; + +console.log(fn({ user: user })); \ No newline at end of file diff --git a/node_modules/pug/examples/form.pug b/node_modules/pug/examples/form.pug new file mode 100644 index 0000000..afe3249 --- /dev/null +++ b/node_modules/pug/examples/form.pug @@ -0,0 +1,29 @@ +form(method="post") + fieldset + legend General + p + label(for="user[name]") Username: + input(type="text", name="user[name]", value=user.name) + p + label(for="user[email]") Email: + input(type="text", name="user[email]", value=user.email) + .tip. + Enter a valid + email address + such as tj@vision-media.ca. + fieldset + legend Location + p + label(for="user[city]") City: + input(type="text", name="user[city]", value=user.city) + p + select(name="user[province]") + option(value="") -- Select Province -- + option(value="AB") Alberta + option(value="BC") British Columbia + option(value="SK") Saskatchewan + option(value="MB") Manitoba + option(value="ON") Ontario + option(value="QC") Quebec + p.buttons + input(type="submit", value="Save") \ No newline at end of file diff --git a/node_modules/pug/examples/includes.js b/node_modules/pug/examples/includes.js new file mode 100644 index 0000000..e2dfe0e --- /dev/null +++ b/node_modules/pug/examples/includes.js @@ -0,0 +1,11 @@ + +/** + * Module dependencies. + */ + +var pug = require('../') + , path = __dirname + '/includes.pug' + , str = require('fs').readFileSync(path, 'utf8') + , fn = pug.compile(str, { filename: path, pretty: true }); + +console.log(fn()); \ No newline at end of file diff --git a/node_modules/pug/examples/includes.pug b/node_modules/pug/examples/includes.pug new file mode 100644 index 0000000..470c476 --- /dev/null +++ b/node_modules/pug/examples/includes.pug @@ -0,0 +1,7 @@ + +html + include includes/head.pug + body + h1 My Site + p Welcome to my super lame site. + include includes/foot.pug diff --git a/node_modules/pug/examples/includes/foot.pug b/node_modules/pug/examples/includes/foot.pug new file mode 100644 index 0000000..b7f5889 --- /dev/null +++ b/node_modules/pug/examples/includes/foot.pug @@ -0,0 +1,2 @@ +#footer + p Copyright (c) foobar \ No newline at end of file diff --git a/node_modules/pug/examples/includes/head.pug b/node_modules/pug/examples/includes/head.pug new file mode 100644 index 0000000..fab2d56 --- /dev/null +++ b/node_modules/pug/examples/includes/head.pug @@ -0,0 +1,6 @@ +head + title My Site + // including other pug works + include scripts.pug + // including .html, .css, etc works + include style.css diff --git a/node_modules/pug/examples/includes/scripts.pug b/node_modules/pug/examples/includes/scripts.pug new file mode 100644 index 0000000..2f478fc --- /dev/null +++ b/node_modules/pug/examples/includes/scripts.pug @@ -0,0 +1,2 @@ +script(src='/javascripts/jquery.js') +script(src='/javascripts/app.js') diff --git a/node_modules/pug/examples/includes/style.css b/node_modules/pug/examples/includes/style.css new file mode 100644 index 0000000..950708e --- /dev/null +++ b/node_modules/pug/examples/includes/style.css @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/node_modules/pug/examples/layout-debug.js b/node_modules/pug/examples/layout-debug.js new file mode 100644 index 0000000..1a3d619 --- /dev/null +++ b/node_modules/pug/examples/layout-debug.js @@ -0,0 +1,11 @@ + +/** + * Module dependencies. + */ + +var pug = require('../'); + +pug.renderFile(__dirname + '/layout.pug', { debug: true }, function(err, html){ + if (err) throw err; + console.log(html); +}); diff --git a/node_modules/pug/examples/layout.js b/node_modules/pug/examples/layout.js new file mode 100644 index 0000000..347b4c8 --- /dev/null +++ b/node_modules/pug/examples/layout.js @@ -0,0 +1,11 @@ + +/** + * Module dependencies. + */ + +var pug = require('../') + , path = __dirname + '/layout.pug' + , str = require('fs').readFileSync(path, 'utf8') + , fn = pug.compile(str, { filename: path, pretty: true }); + +console.log(fn()); \ No newline at end of file diff --git a/node_modules/pug/examples/layout.pug b/node_modules/pug/examples/layout.pug new file mode 100644 index 0000000..767f99a --- /dev/null +++ b/node_modules/pug/examples/layout.pug @@ -0,0 +1,14 @@ +doctype html +html(lang="en") + head + title Example + script. + if (foo) { + bar(); + } + body + h1 Pug - node template engine + #container + :markdown-it + Pug is a _high performance_ template engine for [node](http://nodejs.org), + inspired by [haml](http://haml-lang.com/), and written by [TJ Holowaychuk](http://github.com/visionmedia). diff --git a/node_modules/pug/examples/mixins.js b/node_modules/pug/examples/mixins.js new file mode 100644 index 0000000..e6f2904 --- /dev/null +++ b/node_modules/pug/examples/mixins.js @@ -0,0 +1,16 @@ + +/** + * Module dependencies. + */ + +var pug = require('../') + , path = __dirname + '/mixins.pug' + , str = require('fs').readFileSync(path, 'utf8') + , fn = pug.compile(str, { filename: path, pretty: true }); + +var user = { + name: 'tj' + , pets: ['tobi', 'loki', 'jane', 'manny'] +}; + +console.log(fn({ user: user })); \ No newline at end of file diff --git a/node_modules/pug/examples/mixins.pug b/node_modules/pug/examples/mixins.pug new file mode 100644 index 0000000..09f00fd --- /dev/null +++ b/node_modules/pug/examples/mixins.pug @@ -0,0 +1,14 @@ +include mixins/dialog.pug +include mixins/profile.pug + +.one + +dialog + +.two + +dialog-title('Whoop') + +.three + +dialog-title-desc('Whoop', 'Just a mixin') + +#profile + +profile(user) diff --git a/node_modules/pug/examples/mixins/dialog.pug b/node_modules/pug/examples/mixins/dialog.pug new file mode 100644 index 0000000..ba2ec93 --- /dev/null +++ b/node_modules/pug/examples/mixins/dialog.pug @@ -0,0 +1,15 @@ + +mixin dialog + .dialog + h1 Whoop + p stuff + +mixin dialog-title(title) + .dialog + h1= title + p stuff + +mixin dialog-title-desc(title, desc) + .dialog + h1= title + p= desc diff --git a/node_modules/pug/examples/mixins/profile.pug b/node_modules/pug/examples/mixins/profile.pug new file mode 100644 index 0000000..bbac037 --- /dev/null +++ b/node_modules/pug/examples/mixins/profile.pug @@ -0,0 +1,10 @@ + +mixin pets(pets) + ul.pets + each pet in pets + li= pet + +mixin profile(user) + .user + h2= user.name + +pets(user.pets) diff --git a/node_modules/pug/examples/pet.pug b/node_modules/pug/examples/pet.pug new file mode 100644 index 0000000..e5dbab9 --- /dev/null +++ b/node_modules/pug/examples/pet.pug @@ -0,0 +1,3 @@ +.pet + h2= pet.name + p #{pet.name} is #{pet.age} year(s) old. \ No newline at end of file diff --git a/node_modules/pug/examples/rss.js b/node_modules/pug/examples/rss.js new file mode 100644 index 0000000..6b34fc8 --- /dev/null +++ b/node_modules/pug/examples/rss.js @@ -0,0 +1,17 @@ + +/** + * Module dependencies. + */ + +var pug = require('../') + , path = __dirname + '/rss.pug' + , str = require('fs').readFileSync(path, 'utf8') + , fn = pug.compile(str, { filename: path, pretty: true }); + +var items = []; + +items.push({ title: 'Example', description: 'Something', link: 'http://google.com' }); +items.push({ title: 'LearnBoost', description: 'Cool', link: 'http://learnboost.com' }); +items.push({ title: 'Express', description: 'Cool', link: 'http://expressjs.com' }); + +console.log(fn({ items: items })); \ No newline at end of file diff --git a/node_modules/pug/examples/rss.pug b/node_modules/pug/examples/rss.pug new file mode 100644 index 0000000..165dffb --- /dev/null +++ b/node_modules/pug/examples/rss.pug @@ -0,0 +1,14 @@ +doctype xml +rss(version='2.0') +channel + title RSS Title + description Some description here + link http://google.com + lastBuildDate Mon, 06 Sep 2010 00:01:00 +0000 + pubDate Mon, 06 Sep 2009 16:45:00 +0000 + + each item in items + item + title= item.title + description= item.description + link= item.link diff --git a/node_modules/pug/examples/text.js b/node_modules/pug/examples/text.js new file mode 100644 index 0000000..5634861 --- /dev/null +++ b/node_modules/pug/examples/text.js @@ -0,0 +1,11 @@ + +/** + * Module dependencies. + */ + +var pug = require('../') + , path = __dirname + '/text.pug' + , str = require('fs').readFileSync(path, 'utf8') + , fn = pug.compile(str, { filename: path, pretty: true }); + +console.log(fn({ name: 'tj', email: 'tj@vision-media.ca' })); \ No newline at end of file diff --git a/node_modules/pug/examples/text.pug b/node_modules/pug/examples/text.pug new file mode 100644 index 0000000..6e99a89 --- /dev/null +++ b/node_modules/pug/examples/text.pug @@ -0,0 +1,36 @@ +| An example of an +a(href='#') inline +| link. + +form + label Username: + input(type='text', name='user[name]') + p + | Just an example of some text usage. + | You can have inline html, + | as well as + strong tags + | . + + | Interpolation is also supported. The + | username is currently "#{name}". + + label Email: + input(type='text', name='user[email]') + p + | Email is currently + em= email + | . + + // alternatively, if we plan on having only + // text or inline-html, we can use a trailing + // "." to let pug know we want to omit pipes + + label Username: + input(type='text') + p. + Just an example, like before + however now we can omit those + annoying pipes!. + + Wahoo. \ No newline at end of file diff --git a/node_modules/pug/examples/whitespace.js b/node_modules/pug/examples/whitespace.js new file mode 100644 index 0000000..54a2ea2 --- /dev/null +++ b/node_modules/pug/examples/whitespace.js @@ -0,0 +1,11 @@ + +/** + * Module dependencies. + */ + +var pug = require('../') + , path = __dirname + '/whitespace.pug' + , str = require('fs').readFileSync(path, 'utf8') + , fn = pug.compile(str, { filename: path, pretty: true }); + +console.log(fn()); \ No newline at end of file diff --git a/node_modules/pug/examples/whitespace.pug b/node_modules/pug/examples/whitespace.pug new file mode 100644 index 0000000..ae7ebd9 --- /dev/null +++ b/node_modules/pug/examples/whitespace.pug @@ -0,0 +1,11 @@ +- var js = '' +doctype html +html + + head + title= "Some " + "JavaScript" + != js + + + + body \ No newline at end of file diff --git a/node_modules/pug/lib/index.js b/node_modules/pug/lib/index.js new file mode 100644 index 0000000..e8f0b48 --- /dev/null +++ b/node_modules/pug/lib/index.js @@ -0,0 +1,456 @@ +'use strict'; + +/*! + * Pug + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var fs = require('fs'); +var path = require('path'); +var lex = require('pug-lexer'); +var stripComments = require('pug-strip-comments'); +var parse = require('pug-parser'); +var load = require('pug-load'); +var filters = require('pug-filters'); +var link = require('pug-linker'); +var generateCode = require('pug-code-gen'); +var runtime = require('pug-runtime'); +var runtimeWrap = require('pug-runtime/wrap'); + +/** + * Name for detection + */ + +exports.name = 'Pug'; + +/** + * Pug runtime helpers. + */ + +exports.runtime = runtime; + +/** + * Template function cache. + */ + +exports.cache = {}; + +function applyPlugins(value, options, plugins, name) { + return plugins.reduce(function (value, plugin) { + return ( + plugin[name] + ? plugin[name](value, options) + : value + ); + }, value); +} + +function findReplacementFunc(plugins, name) { + var eligiblePlugins = plugins.filter(function (plugin) { + return plugin[name]; + }); + + if (eligiblePlugins.length > 1) { + throw new Error('Two or more plugins all implement ' + name + ' method.'); + } else if (eligiblePlugins.length) { + return eligiblePlugins[0][name].bind(eligiblePlugins[0]); + } + return null; +} + +/** + * Object for global custom filters. Note that you can also just pass a `filters` + * option to any other method. + */ +exports.filters = {}; + +/** + * Compile the given `str` of pug and return a function body. + * + * @param {String} str + * @param {Object} options + * @return {Object} + * @api private + */ + +function compileBody(str, options){ + var debug_sources = {}; + debug_sources[options.filename] = str; + var dependencies = []; + var plugins = options.plugins || []; + var ast = load.string(str, { + filename: options.filename, + basedir: options.basedir, + lex: function (str, options) { + var lexOptions = {}; + Object.keys(options).forEach(function (key) { + lexOptions[key] = options[key]; + }); + lexOptions.plugins = plugins.filter(function (plugin) { + return !!plugin.lex; + }).map(function (plugin) { + return plugin.lex; + }); + return applyPlugins(lex(str, lexOptions), options, plugins, 'postLex'); + }, + parse: function (tokens, options) { + tokens = tokens.map(function (token) { + if (token.type === 'path' && path.extname(token.val) === '') { + return { + type: 'path', + line: token.line, + col: token.col, + val: token.val + '.pug' + }; + } + return token; + }); + tokens = stripComments(tokens, options); + tokens = applyPlugins(tokens, options, plugins, 'preParse'); + var parseOptions = {}; + Object.keys(options).forEach(function (key) { + parseOptions[key] = options[key]; + }); + parseOptions.plugins = plugins.filter(function (plugin) { + return !!plugin.parse; + }).map(function (plugin) { + return plugin.parse; + }); + + return applyPlugins( + applyPlugins(parse(tokens, parseOptions), options, plugins, 'postParse'), + options, plugins, 'preLoad' + ); + }, + resolve: function (filename, source, loadOptions) { + var replacementFunc = findReplacementFunc(plugins, 'resolve'); + if (replacementFunc) { + return replacementFunc(filename, source, options); + } + + return load.resolve(filename, source, loadOptions); + }, + read: function (filename, loadOptions) { + dependencies.push(filename); + + var contents; + + var replacementFunc = findReplacementFunc(plugins, 'read'); + if (replacementFunc) { + contents = replacementFunc(filename, options); + } else { + contents = load.read(filename, loadOptions); + } + + var str = applyPlugins(contents, {filename: filename}, plugins, 'preLex'); + debug_sources[filename] = str; + return str; + } + }); + ast = applyPlugins(ast, options, plugins, 'postLoad'); + ast = applyPlugins(ast, options, plugins, 'preFilters'); + + var filtersSet = {}; + Object.keys(exports.filters).forEach(function (key) { + filtersSet[key] = exports.filters[key]; + }); + if (options.filters) { + Object.keys(options.filters).forEach(function (key) { + filtersSet[key] = options.filters[key]; + }); + } + ast = filters.handleFilters(ast, filtersSet, options.filterOptions, options.filterAliases); + + ast = applyPlugins(ast, options, plugins, 'postFilters'); + ast = applyPlugins(ast, options, plugins, 'preLink'); + ast = link(ast); + ast = applyPlugins(ast, options, plugins, 'postLink'); + + // Compile + ast = applyPlugins(ast, options, plugins, 'preCodeGen'); + var js = generateCode(ast, { + pretty: options.pretty, + compileDebug: options.compileDebug, + doctype: options.doctype, + inlineRuntimeFunctions: options.inlineRuntimeFunctions, + globals: options.globals, + self: options.self, + includeSources: options.includeSources ? debug_sources : false, + templateName: options.templateName + }); + js = applyPlugins(js, options, plugins, 'postCodeGen'); + + // Debug compiler + if (options.debug) { + console.error('\nCompiled Function:\n\n\u001b[90m%s\u001b[0m', js.replace(/^/gm, ' ')); + } + + return {body: js, dependencies: dependencies}; +} + +/** + * Get the template from a string or a file, either compiled on-the-fly or + * read from cache (if enabled), and cache the template if needed. + * + * If `str` is not set, the file specified in `options.filename` will be read. + * + * If `options.cache` is true, this function reads the file from + * `options.filename` so it must be set prior to calling this function. + * + * @param {Object} options + * @param {String=} str + * @return {Function} + * @api private + */ +function handleTemplateCache (options, str) { + var key = options.filename; + if (options.cache && exports.cache[key]) { + return exports.cache[key]; + } else { + if (str === undefined) str = fs.readFileSync(options.filename, 'utf8'); + var templ = exports.compile(str, options); + if (options.cache) exports.cache[key] = templ; + return templ; + } +} + +/** + * Compile a `Function` representation of the given pug `str`. + * + * Options: + * + * - `compileDebug` when `false` debugging code is stripped from the compiled + template, when it is explicitly `true`, the source code is included in + the compiled template for better accuracy. + * - `filename` used to improve errors when `compileDebug` is not `false` and to resolve imports/extends + * + * @param {String} str + * @param {Options} options + * @return {Function} + * @api public + */ + +exports.compile = function(str, options){ + var options = options || {} + + str = String(str); + + var parsed = compileBody(str, { + compileDebug: options.compileDebug !== false, + filename: options.filename, + basedir: options.basedir, + pretty: options.pretty, + doctype: options.doctype, + inlineRuntimeFunctions: options.inlineRuntimeFunctions, + globals: options.globals, + self: options.self, + includeSources: options.compileDebug === true, + debug: options.debug, + templateName: 'template', + filters: options.filters, + filterOptions: options.filterOptions, + filterAliases: options.filterAliases, + plugins: options.plugins, + }); + + var res = options.inlineRuntimeFunctions + ? new Function('', parsed.body + ';return template;')() + : runtimeWrap(parsed.body); + + res.dependencies = parsed.dependencies; + + return res; +}; + +/** + * Compile a JavaScript source representation of the given pug `str`. + * + * Options: + * + * - `compileDebug` When it is `true`, the source code is included in + * the compiled template for better error messages. + * - `filename` used to improve errors when `compileDebug` is not `true` and to resolve imports/extends + * - `name` the name of the resulting function (defaults to "template") + * + * @param {String} str + * @param {Options} options + * @return {Object} + * @api public + */ + +exports.compileClientWithDependenciesTracked = function(str, options){ + var options = options || {}; + + str = String(str); + var parsed = compileBody(str, { + compileDebug: options.compileDebug, + filename: options.filename, + basedir: options.basedir, + pretty: options.pretty, + doctype: options.doctype, + inlineRuntimeFunctions: options.inlineRuntimeFunctions !== false, + globals: options.globals, + self: options.self, + includeSources: options.compileDebug, + debug: options.debug, + templateName: options.name || 'template', + filters: options.filters, + filterOptions: options.filterOptions, + filterAliases: options.filterAliases, + plugins: options.plugins, + }); + + return {body: parsed.body, dependencies: parsed.dependencies}; +}; + +/** + * Compile a JavaScript source representation of the given pug `str`. + * + * Options: + * + * - `compileDebug` When it is `true`, the source code is included in + * the compiled template for better error messages. + * - `filename` used to improve errors when `compileDebug` is not `true` and to resolve imports/extends + * - `name` the name of the resulting function (defaults to "template") + * + * @param {String} str + * @param {Options} options + * @return {String} + * @api public + */ +exports.compileClient = function (str, options) { + return exports.compileClientWithDependenciesTracked(str, options).body; +}; + +/** + * Compile a `Function` representation of the given pug file. + * + * Options: + * + * - `compileDebug` when `false` debugging code is stripped from the compiled + template, when it is explicitly `true`, the source code is included in + the compiled template for better accuracy. + * + * @param {String} path + * @param {Options} options + * @return {Function} + * @api public + */ +exports.compileFile = function (path, options) { + options = options || {}; + options.filename = path; + return handleTemplateCache(options); +}; + +/** + * Render the given `str` of pug. + * + * Options: + * + * - `cache` enable template caching + * - `filename` filename required for `include` / `extends` and caching + * + * @param {String} str + * @param {Object|Function} options or fn + * @param {Function|undefined} fn + * @returns {String} + * @api public + */ + +exports.render = function(str, options, fn){ + // support callback API + if ('function' == typeof options) { + fn = options, options = undefined; + } + if (typeof fn === 'function') { + var res; + try { + res = exports.render(str, options); + } catch (ex) { + return fn(ex); + } + return fn(null, res); + } + + options = options || {}; + + // cache requires .filename + if (options.cache && !options.filename) { + throw new Error('the "filename" option is required for caching'); + } + + return handleTemplateCache(options, str)(options); +}; + +/** + * Render a Pug file at the given `path`. + * + * @param {String} path + * @param {Object|Function} options or callback + * @param {Function|undefined} fn + * @returns {String} + * @api public + */ + +exports.renderFile = function(path, options, fn){ + // support callback API + if ('function' == typeof options) { + fn = options, options = undefined; + } + if (typeof fn === 'function') { + var res; + try { + res = exports.renderFile(path, options); + } catch (ex) { + return fn(ex); + } + return fn(null, res); + } + + options = options || {}; + + options.filename = path; + return handleTemplateCache(options)(options); +}; + + +/** + * Compile a Pug file at the given `path` for use on the client. + * + * @param {String} path + * @param {Object} options + * @returns {String} + * @api public + */ + +exports.compileFileClient = function(path, options){ + var key = path + ':client'; + options = options || {}; + + options.filename = path; + + if (options.cache && exports.cache[key]) { + return exports.cache[key]; + } + + var str = fs.readFileSync(options.filename, 'utf8'); + var out = exports.compileClient(str, options); + if (options.cache) exports.cache[key] = out; + return out; +}; + +/** + * Express support. + */ + +exports.__express = function(path, options, fn) { + if(options.compileDebug == undefined && process.env.NODE_ENV === 'production') { + options.compileDebug = false; + } + exports.renderFile(path, options, fn); +} diff --git a/node_modules/pug/package.json b/node_modules/pug/package.json new file mode 100644 index 0000000..92a5870 --- /dev/null +++ b/node_modules/pug/package.json @@ -0,0 +1,103 @@ +{ + "_from": "pug@2.0.0-beta11", + "_id": "pug@2.0.0-beta11", + "_inBundle": false, + "_integrity": "sha1-Favmr1AEx+LPRhPksnRlyVRrXwE=", + "_location": "/pug", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "pug@2.0.0-beta11", + "name": "pug", + "escapedName": "pug", + "rawSpec": "2.0.0-beta11", + "saveSpec": null, + "fetchSpec": "2.0.0-beta11" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/pug/-/pug-2.0.0-beta11.tgz", + "_shasum": "15abe6af5004c7e2cf4613e4b27465c9546b5f01", + "_spec": "pug@2.0.0-beta11", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "browser": { + "fs": false + }, + "bugs": { + "url": "https://github.com/pugjs/pug/issues" + }, + "bundleDependencies": false, + "dependencies": { + "pug-code-gen": "^1.1.1", + "pug-filters": "^2.1.1", + "pug-lexer": "^3.0.0", + "pug-linker": "^2.0.2", + "pug-load": "^2.0.5", + "pug-parser": "^2.0.2", + "pug-runtime": "^2.0.3", + "pug-strip-comments": "^1.0.2" + }, + "deprecated": false, + "description": "A clean, whitespace-sensitive template language for writing HTML", + "devDependencies": { + "jstransformer-cdata": "^1.0.0", + "jstransformer-coffee-script": "^1.0.0", + "jstransformer-less": "^2.1.0", + "jstransformer-markdown-it": "^1.0.0", + "jstransformer-stylus": "^1.0.0", + "jstransformer-uglify-js": "^1.1.1", + "jstransformer-verbatim": "^1.0.0", + "mkdirp": "^0.5.1", + "rimraf": "^2.2.8", + "uglify-js": "github:mishoo/UglifyJS2#1c15d0db456ce32f1b9b507aad97e5ee5c8285f7" + }, + "homepage": "https://pugjs.org", + "license": "MIT", + "main": "lib", + "maintainers": [ + { + "name": "Forbes Lindesay", + "email": "forbes@lindesay.co.uk" + }, + { + "name": "Matthias Le Brun", + "email": "mlbli@me.com" + }, + { + "name": "Joshua Appelman", + "email": "joshua@jbna.nl" + }, + { + "name": "Jonathan Ong", + "email": "jonathanrichardong@gmail.com" + }, + { + "name": "Alex Kocharin", + "email": "alex@kocharin.ru" + }, + { + "name": "Hemanth", + "email": "hemanth.hm@gmail.com" + }, + { + "name": "Timothy Gu", + "email": "timothygu99@gmail.com" + }, + { + "name": "Andreas Lubbe", + "email": "git@lubbe.org" + } + ], + "name": "pug", + "repository": { + "type": "git", + "url": "git://github.com/pugjs/pug.git" + }, + "version": "2.0.0-beta11" +} diff --git a/node_modules/pug/register.js b/node_modules/pug/register.js new file mode 100644 index 0000000..02f218d --- /dev/null +++ b/node_modules/pug/register.js @@ -0,0 +1,13 @@ +var pug = require('./'); +var resolvedPug = JSON.stringify(require.resolve('./')); + +function compileTemplate(module, filename) { + var template = pug.compileFileClient(filename, {inlineRuntimeFunctions: false}); + var body = "var pug = require(" + resolvedPug + ").runtime;\n\n" + + "module.exports = " + template + ";"; + module._compile(body, filename); +} + +if (require.extensions) { + require.extensions['.pug'] = compileTemplate +}; diff --git a/node_modules/pug/support/benchmark.js b/node_modules/pug/support/benchmark.js new file mode 100644 index 0000000..4782f43 --- /dev/null +++ b/node_modules/pug/support/benchmark.js @@ -0,0 +1,121 @@ + +/** + * Module dependencies. + */ + +var uubench = require('uubench') + , pug = require('../'); + + +var suite = new uubench.Suite({ + min: 200, + result: function(name, stats){ + var persec = 1000 / stats.elapsed + , ops = stats.iterations * persec; + console.log('%s: %d', name, ops | 0); + } +}); + +function setup(self) { + var suffix = self ? ' (self)' : '' + , options = { self: self }; + + var str = 'html\n body\n h1 Title' + , fn = pug.compile(str, options); + + suite.bench('tiny' + suffix, function(next){ + fn(); + next(); + }); + +str = '\ +html\n\ + body\n\ + h1 Title\n\ + ul#menu\n\ + li: a(href="#") Home\n\ + li: a(href="#") About Us\n\ + li: a(href="#") Store\n\ + li: a(href="#") FAQ\n\ + li: a(href="#") Contact\n\ +'; + + var fn2 = pug.compile(str, options); + + suite.bench('small' + suffix, function(next){ + fn2(); + next(); + }); + +str = '\ +html\n\ + body\n\ + h1 #{title}\n\ + ul#menu\n\ + - each link in links\r\n\ + li: a(href="#")= link\r\n\ +'; + + if (self) { +str = '\ +html\n\ + body\n\ + h1 #{self.title}\n\ + ul#menu\n\ + - each link in self.links\r\n\ + li: a(href="#")= link\r\n\ +'; + } + + var fn3 = pug.compile(str, options); + + suite.bench('small locals' + suffix, function(next){ + fn3({ title: 'Title', links: ['Home', 'About Us', 'Store', 'FAQ', 'Contact'] }); + next(); + }); + +str = '\ +html\n\ + body\n\ + h1 Title\n\ + ul#menu\n\ + li: a(href="#") Home\n\ + li: a(href="#") About Us\n\ + li: a(href="#") Store\n\ + li: a(href="#") FAQ\n\ + li: a(href="#") Contact\n\ +'; + + str = Array(30).join(str); + var fn4 = pug.compile(str, options); + + suite.bench('medium' + suffix, function(next){ + fn4(); + next(); + }); + +str = '\ +html\n\ + body\n\ + h1 Title\n\ + ul#menu\n\ + li: a(href="#") Home\n\ + li: a(href="#") About Us\n\ + li: a(href="#") Store\n\ + li: a(href="#") FAQ\n\ + li: a(href="#") Contact\n\ +'; + + str = Array(100).join(str); + var fn5 = pug.compile(str, options); + + suite.bench('large' + suffix, function(next){ + fn5(); + next(); + }); +} + +setup(); +setup(true); + +suite.run(); \ No newline at end of file diff --git a/node_modules/pug/test/README.md b/node_modules/pug/test/README.md new file mode 100644 index 0000000..0989992 --- /dev/null +++ b/node_modules/pug/test/README.md @@ -0,0 +1,15 @@ +# Running Tests + +To run tests (with node.js installed) you must complete 2 steps. + +## 1 Install dependencies + +``` +npm install +``` + +## 2 Run tests + +``` +npm test +``` diff --git a/node_modules/pug/test/anti-cases/attrs.unescaped.pug b/node_modules/pug/test/anti-cases/attrs.unescaped.pug new file mode 100644 index 0000000..ab47e09 --- /dev/null +++ b/node_modules/pug/test/anti-cases/attrs.unescaped.pug @@ -0,0 +1,3 @@ +script(type='text/x-template') + #user(id!='user-<%= user.id %>') + h1 <%= user.title %> \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/case-when.pug b/node_modules/pug/test/anti-cases/case-when.pug new file mode 100644 index 0000000..74977d1 --- /dev/null +++ b/node_modules/pug/test/anti-cases/case-when.pug @@ -0,0 +1,4 @@ +when 5 + .foo +when 6 + .bar \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/case-without-with.pug b/node_modules/pug/test/anti-cases/case-without-with.pug new file mode 100644 index 0000000..3cbf016 --- /dev/null +++ b/node_modules/pug/test/anti-cases/case-without-with.pug @@ -0,0 +1,2 @@ +case foo + .div \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/else-condition.pug b/node_modules/pug/test/anti-cases/else-condition.pug new file mode 100644 index 0000000..93ff87e --- /dev/null +++ b/node_modules/pug/test/anti-cases/else-condition.pug @@ -0,0 +1,4 @@ +if foo + div +else bar + article \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/else-without-if.pug b/node_modules/pug/test/anti-cases/else-without-if.pug new file mode 100644 index 0000000..3062364 --- /dev/null +++ b/node_modules/pug/test/anti-cases/else-without-if.pug @@ -0,0 +1,2 @@ +else + .foo \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/inlining-a-mixin-after-a-tag.pug b/node_modules/pug/test/anti-cases/inlining-a-mixin-after-a-tag.pug new file mode 100644 index 0000000..3d01493 --- /dev/null +++ b/node_modules/pug/test/anti-cases/inlining-a-mixin-after-a-tag.pug @@ -0,0 +1 @@ +foo()+bar() \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/key-char-ending-badly.pug b/node_modules/pug/test/anti-cases/key-char-ending-badly.pug new file mode 100644 index 0000000..45ca24a --- /dev/null +++ b/node_modules/pug/test/anti-cases/key-char-ending-badly.pug @@ -0,0 +1 @@ +div("foo"abc) diff --git a/node_modules/pug/test/anti-cases/key-ending-badly.pug b/node_modules/pug/test/anti-cases/key-ending-badly.pug new file mode 100644 index 0000000..8e3c305 --- /dev/null +++ b/node_modules/pug/test/anti-cases/key-ending-badly.pug @@ -0,0 +1 @@ +div(foo!~abc) diff --git a/node_modules/pug/test/anti-cases/mismatched-inline-tag.pug b/node_modules/pug/test/anti-cases/mismatched-inline-tag.pug new file mode 100644 index 0000000..35fa2aa --- /dev/null +++ b/node_modules/pug/test/anti-cases/mismatched-inline-tag.pug @@ -0,0 +1,2 @@ +//- #1871 +p #[strong a} diff --git a/node_modules/pug/test/anti-cases/mixin-args-syntax-error.pug b/node_modules/pug/test/anti-cases/mixin-args-syntax-error.pug new file mode 100644 index 0000000..d0b725b --- /dev/null +++ b/node_modules/pug/test/anti-cases/mixin-args-syntax-error.pug @@ -0,0 +1,2 @@ +mixin foo(a, b) ++foo('a'b'b') diff --git a/node_modules/pug/test/anti-cases/mixins-blocks-with-bodies.pug b/node_modules/pug/test/anti-cases/mixins-blocks-with-bodies.pug new file mode 100644 index 0000000..e7e6281 --- /dev/null +++ b/node_modules/pug/test/anti-cases/mixins-blocks-with-bodies.pug @@ -0,0 +1,3 @@ +mixin foo + block + bar \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/multiple-non-nested-tags-on-a-line.pug b/node_modules/pug/test/anti-cases/multiple-non-nested-tags-on-a-line.pug new file mode 100644 index 0000000..fc9c884 --- /dev/null +++ b/node_modules/pug/test/anti-cases/multiple-non-nested-tags-on-a-line.pug @@ -0,0 +1 @@ +foo()bar \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/non-existant-filter.pug b/node_modules/pug/test/anti-cases/non-existant-filter.pug new file mode 100644 index 0000000..8caa922 --- /dev/null +++ b/node_modules/pug/test/anti-cases/non-existant-filter.pug @@ -0,0 +1,2 @@ +:not-a-valid-filter + foo bar \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/non-mixin-block.pug b/node_modules/pug/test/anti-cases/non-mixin-block.pug new file mode 100644 index 0000000..11ff9bc --- /dev/null +++ b/node_modules/pug/test/anti-cases/non-mixin-block.pug @@ -0,0 +1,2 @@ +div + block \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/open-brace-in-attributes.pug b/node_modules/pug/test/anti-cases/open-brace-in-attributes.pug new file mode 100644 index 0000000..7b5f21d --- /dev/null +++ b/node_modules/pug/test/anti-cases/open-brace-in-attributes.pug @@ -0,0 +1 @@ +div(title=[) \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/readme.md b/node_modules/pug/test/anti-cases/readme.md new file mode 100644 index 0000000..6dae996 --- /dev/null +++ b/node_modules/pug/test/anti-cases/readme.md @@ -0,0 +1 @@ +This folder collects examples of files that are not valid `pug`, but were at some point accepted by the parser without throwing an error. The tests ensure that all these cases now throw some form of error message (hopefully a helpful one). \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/self-closing-tag-with-block.pug b/node_modules/pug/test/anti-cases/self-closing-tag-with-block.pug new file mode 100644 index 0000000..b1b0c1d --- /dev/null +++ b/node_modules/pug/test/anti-cases/self-closing-tag-with-block.pug @@ -0,0 +1,2 @@ +input + | Inputs cannot have content diff --git a/node_modules/pug/test/anti-cases/self-closing-tag-with-body.pug b/node_modules/pug/test/anti-cases/self-closing-tag-with-body.pug new file mode 100644 index 0000000..55fbed1 --- /dev/null +++ b/node_modules/pug/test/anti-cases/self-closing-tag-with-body.pug @@ -0,0 +1 @@ +input Input's can't have content \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/self-closing-tag-with-code.pug b/node_modules/pug/test/anti-cases/self-closing-tag-with-code.pug new file mode 100644 index 0000000..e836232 --- /dev/null +++ b/node_modules/pug/test/anti-cases/self-closing-tag-with-code.pug @@ -0,0 +1 @@ +input= 'Inputs cannot have code' diff --git a/node_modules/pug/test/anti-cases/tabs-and-spaces.pug b/node_modules/pug/test/anti-cases/tabs-and-spaces.pug new file mode 100644 index 0000000..07868c2 --- /dev/null +++ b/node_modules/pug/test/anti-cases/tabs-and-spaces.pug @@ -0,0 +1,3 @@ +div + div + article \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/unclosed-interpolated-call.pug b/node_modules/pug/test/anti-cases/unclosed-interpolated-call.pug new file mode 100644 index 0000000..63d02db --- /dev/null +++ b/node_modules/pug/test/anti-cases/unclosed-interpolated-call.pug @@ -0,0 +1 @@ ++#{myMixin \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/unclosed-interpolated-tag.pug b/node_modules/pug/test/anti-cases/unclosed-interpolated-tag.pug new file mode 100644 index 0000000..be66079 --- /dev/null +++ b/node_modules/pug/test/anti-cases/unclosed-interpolated-tag.pug @@ -0,0 +1,4 @@ +mixin item + block + ++item( Contact \ No newline at end of file diff --git a/node_modules/pug/test/anti-cases/unclosed-interpolation.pug b/node_modules/pug/test/anti-cases/unclosed-interpolation.pug new file mode 100644 index 0000000..4698dd9 --- /dev/null +++ b/node_modules/pug/test/anti-cases/unclosed-interpolation.pug @@ -0,0 +1 @@ +#{myMixin \ No newline at end of file diff --git a/node_modules/pug/test/browser/index.html b/node_modules/pug/test/browser/index.html new file mode 100644 index 0000000..d88e5f6 --- /dev/null +++ b/node_modules/pug/test/browser/index.html @@ -0,0 +1,10 @@ +
\ No newline at end of file diff --git a/node_modules/pug/test/browser/index.pug b/node_modules/pug/test/browser/index.pug new file mode 100644 index 0000000..17e7759 --- /dev/null +++ b/node_modules/pug/test/browser/index.pug @@ -0,0 +1,20 @@ +!!! 5 +html + head + body + textarea#input(placeholder='write pug here', style='width: 100%; min-height: 400px;'). + p + author + != myName + pre(style='background: #ECECEC;width: 100%; min-height: 400px;') + code#output + script(src='../../pug.js') + script. + var input = document.getElementById('input'); + var output = document.getElementById('output'); + setInterval(function () { + pug.render(input.value, {myName: 'Forbes Lindesay', pretty: true}, function (err, res) { + if (err) throw err; + output.textContent = res; + }) + }, 500) \ No newline at end of file diff --git a/node_modules/pug/test/cases-es2015/attr.html b/node_modules/pug/test/cases-es2015/attr.html new file mode 100644 index 0000000..5b9fbfb --- /dev/null +++ b/node_modules/pug/test/cases-es2015/attr.html @@ -0,0 +1 @@ +
diff --git a/node_modules/pug/test/cases-es2015/attr.pug b/node_modules/pug/test/cases-es2015/attr.pug new file mode 100644 index 0000000..d19080f --- /dev/null +++ b/node_modules/pug/test/cases-es2015/attr.pug @@ -0,0 +1,3 @@ +- var avatar = '219b77f9d21de75e81851b6b886057c7' + +div.avatar-div(style=`background-image: url(https://www.gravatar.com/avatar/${avatar})`) diff --git a/node_modules/pug/test/cases/attrs-data.html b/node_modules/pug/test/cases/attrs-data.html new file mode 100644 index 0000000..71116d3 --- /dev/null +++ b/node_modules/pug/test/cases/attrs-data.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/node_modules/pug/test/cases/attrs-data.pug b/node_modules/pug/test/cases/attrs-data.pug new file mode 100644 index 0000000..9e5b4b6 --- /dev/null +++ b/node_modules/pug/test/cases/attrs-data.pug @@ -0,0 +1,7 @@ +- var user = { name: 'tobi' } +foo(data-user=user) +foo(data-items=[1,2,3]) +foo(data-username='tobi') +foo(data-escaped={message: "Let's rock!"}) +foo(data-ampersand={message: "a quote: " this & that"}) +foo(data-epoc=new Date(0)) diff --git a/node_modules/pug/test/cases/attrs.html b/node_modules/pug/test/cases/attrs.html new file mode 100644 index 0000000..9dcaee5 --- /dev/null +++ b/node_modules/pug/test/cases/attrs.html @@ -0,0 +1,20 @@ +contactsave + +contactsave + + + + + + + + + + +
diff --git a/node_modules/pug/test/cases/attrs.js.html b/node_modules/pug/test/cases/attrs.js.html new file mode 100644 index 0000000..edd3813 --- /dev/null +++ b/node_modules/pug/test/cases/attrs.js.html @@ -0,0 +1,5 @@ + + + +
+
\ No newline at end of file diff --git a/node_modules/pug/test/cases/attrs.js.pug b/node_modules/pug/test/cases/attrs.js.pug new file mode 100644 index 0000000..910c13a --- /dev/null +++ b/node_modules/pug/test/cases/attrs.js.pug @@ -0,0 +1,17 @@ +- var id = 5 +- function answer() { return 42; } +a(href='/user/' + id, class='button') +a(href = '/user/' + id, class = 'button') +meta(key='answer', value=answer()) +a(class = ['class1', 'class2']) +a.tag-class(class = ['class1', 'class2']) + +a(href='/user/' + id class='button') +a(href = '/user/' + id class = 'button') +meta(key='answer' value=answer()) +a(class = ['class1', 'class2']) +a.tag-class(class = ['class1', 'class2']) + +div(id=id)&attributes({foo: 'bar'}) +- var bar = null +div(foo=null bar=bar)&attributes({baz: 'baz'}) diff --git a/node_modules/pug/test/cases/attrs.pug b/node_modules/pug/test/cases/attrs.pug new file mode 100644 index 0000000..d4420e3 --- /dev/null +++ b/node_modules/pug/test/cases/attrs.pug @@ -0,0 +1,43 @@ +a(href='/contact') contact +a(href='/save').button save +a(foo, bar, baz) +a(foo='foo, bar, baz', bar=1) +a(foo='((foo))', bar= (1) ? 1 : 0 ) +select + option(value='foo', selected) Foo + option(selected, value='bar') Bar +a(foo="class:") +input(pattern='\\S+') + +a(href='/contact') contact +a(href='/save').button save +a(foo bar baz) +a(foo='foo, bar, baz' bar=1) +a(foo='((foo))' bar= (1) ? 1 : 0 ) +select + option(value='foo' selected) Foo + option(selected value='bar') Bar +a(foo="class:") +input(pattern='\\S+') +foo(terse="true") +foo(date=new Date(0)) + +foo(abc + ,def) +foo(abc, + def) +foo(abc, + def) +foo(abc + ,def) +foo(abc + def) +foo(abc + def) + +- var attrs = {foo: 'bar', bar: ''} + +div&attributes(attrs) + +a(foo='foo' "bar"="bar") +a(foo='foo' 'bar'='bar') diff --git a/node_modules/pug/test/cases/attrs.unescaped.html b/node_modules/pug/test/cases/attrs.unescaped.html new file mode 100644 index 0000000..2c2f3f1 --- /dev/null +++ b/node_modules/pug/test/cases/attrs.unescaped.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/node_modules/pug/test/cases/attrs.unescaped.pug b/node_modules/pug/test/cases/attrs.unescaped.pug new file mode 100644 index 0000000..36a4e10 --- /dev/null +++ b/node_modules/pug/test/cases/attrs.unescaped.pug @@ -0,0 +1,3 @@ +script(type='text/x-template') + div(id!='user-<%= user.id %>') + h1 <%= user.title %> \ No newline at end of file diff --git a/node_modules/pug/test/cases/auxiliary/1794-extends.pug b/node_modules/pug/test/cases/auxiliary/1794-extends.pug new file mode 100644 index 0000000..99649d6 --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/1794-extends.pug @@ -0,0 +1 @@ +block content \ No newline at end of file diff --git a/node_modules/pug/test/cases/auxiliary/1794-include.pug b/node_modules/pug/test/cases/auxiliary/1794-include.pug new file mode 100644 index 0000000..b9c03b4 --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/1794-include.pug @@ -0,0 +1,4 @@ +mixin test() + .test&attributes(attributes) + ++test() \ No newline at end of file diff --git a/node_modules/pug/test/cases/auxiliary/blocks-in-blocks-layout.pug b/node_modules/pug/test/cases/auxiliary/blocks-in-blocks-layout.pug new file mode 100644 index 0000000..17ca8a0 --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/blocks-in-blocks-layout.pug @@ -0,0 +1,8 @@ +doctype html +html + head + title Default title + body + block body + .container + block content diff --git a/node_modules/pug/test/cases/auxiliary/dialog.pug b/node_modules/pug/test/cases/auxiliary/dialog.pug new file mode 100644 index 0000000..607bdec --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/dialog.pug @@ -0,0 +1,6 @@ + +extends window.pug + +block window-content + .dialog + block content diff --git a/node_modules/pug/test/cases/auxiliary/empty-block.pug b/node_modules/pug/test/cases/auxiliary/empty-block.pug new file mode 100644 index 0000000..776e5fe --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/empty-block.pug @@ -0,0 +1,2 @@ +block test + diff --git a/node_modules/pug/test/cases/auxiliary/escapes.html b/node_modules/pug/test/cases/auxiliary/escapes.html new file mode 100644 index 0000000..3b414f2 --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/escapes.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/node_modules/pug/test/cases/auxiliary/extends-empty-block-1.pug b/node_modules/pug/test/cases/auxiliary/extends-empty-block-1.pug new file mode 100644 index 0000000..2729803 --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/extends-empty-block-1.pug @@ -0,0 +1,5 @@ +extends empty-block.pug + +block test + div test1 + diff --git a/node_modules/pug/test/cases/auxiliary/extends-empty-block-2.pug b/node_modules/pug/test/cases/auxiliary/extends-empty-block-2.pug new file mode 100644 index 0000000..beb2e83 --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/extends-empty-block-2.pug @@ -0,0 +1,5 @@ +extends empty-block.pug + +block test + div test2 + diff --git a/node_modules/pug/test/cases/auxiliary/extends-from-root.pug b/node_modules/pug/test/cases/auxiliary/extends-from-root.pug new file mode 100644 index 0000000..da52beb --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/extends-from-root.pug @@ -0,0 +1,4 @@ +extends /auxiliary/layout.pug + +block content + include /auxiliary/include-from-root.pug diff --git a/node_modules/pug/test/cases/auxiliary/extends-relative.pug b/node_modules/pug/test/cases/auxiliary/extends-relative.pug new file mode 100644 index 0000000..612879a --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/extends-relative.pug @@ -0,0 +1,4 @@ +extends ../../cases/auxiliary/layout + +block content + include ../../cases/auxiliary/include-from-root diff --git a/node_modules/pug/test/cases/auxiliary/filter-in-include.pug b/node_modules/pug/test/cases/auxiliary/filter-in-include.pug new file mode 100644 index 0000000..a3df945 --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/filter-in-include.pug @@ -0,0 +1,8 @@ +html + head + style(type="text/css") + :less + @pad: 15px; + body { + padding: @pad; + } diff --git a/node_modules/pug/test/cases/auxiliary/includable.js b/node_modules/pug/test/cases/auxiliary/includable.js new file mode 100644 index 0000000..f3efe1e --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/includable.js @@ -0,0 +1,7 @@ +var STRING_SUBSTITUTIONS = { // table of character substitutions + '\t': '\\t', + '\r': '\\r', + '\n': '\\n', + '"' : '\\"', + '\\': '\\\\' +}; \ No newline at end of file diff --git a/node_modules/pug/test/cases/auxiliary/include-from-root.pug b/node_modules/pug/test/cases/auxiliary/include-from-root.pug new file mode 100644 index 0000000..93c364b --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/include-from-root.pug @@ -0,0 +1 @@ +h1 hello \ No newline at end of file diff --git a/node_modules/pug/test/cases/auxiliary/inheritance.extend.mixin.block.pug b/node_modules/pug/test/cases/auxiliary/inheritance.extend.mixin.block.pug new file mode 100644 index 0000000..890febc --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/inheritance.extend.mixin.block.pug @@ -0,0 +1,11 @@ +mixin article() + article + block + +html + head + title My Application + block head + body + +article + block content diff --git a/node_modules/pug/test/cases/auxiliary/inheritance.extend.recursive-grand-grandparent.pug b/node_modules/pug/test/cases/auxiliary/inheritance.extend.recursive-grand-grandparent.pug new file mode 100644 index 0000000..61033fa --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/inheritance.extend.recursive-grand-grandparent.pug @@ -0,0 +1,2 @@ +h1 grand-grandparent +block grand-grandparent \ No newline at end of file diff --git a/node_modules/pug/test/cases/auxiliary/inheritance.extend.recursive-grandparent.pug b/node_modules/pug/test/cases/auxiliary/inheritance.extend.recursive-grandparent.pug new file mode 100644 index 0000000..f8ad4b8 --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/inheritance.extend.recursive-grandparent.pug @@ -0,0 +1,6 @@ +extends inheritance.extend.recursive-grand-grandparent.pug + +block grand-grandparent + h2 grandparent + block grandparent + diff --git a/node_modules/pug/test/cases/auxiliary/inheritance.extend.recursive-parent.pug b/node_modules/pug/test/cases/auxiliary/inheritance.extend.recursive-parent.pug new file mode 100644 index 0000000..72d7230 --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/inheritance.extend.recursive-parent.pug @@ -0,0 +1,5 @@ +extends inheritance.extend.recursive-grandparent.pug + +block grandparent + h3 parent + block parent \ No newline at end of file diff --git a/node_modules/pug/test/cases/auxiliary/layout.include.pug b/node_modules/pug/test/cases/auxiliary/layout.include.pug new file mode 100644 index 0000000..96734bf --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/layout.include.pug @@ -0,0 +1,7 @@ +html + head + title My Application + block head + body + block content + include window.pug diff --git a/node_modules/pug/test/cases/auxiliary/layout.pug b/node_modules/pug/test/cases/auxiliary/layout.pug new file mode 100644 index 0000000..7d183b3 --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/layout.pug @@ -0,0 +1,6 @@ +html + head + title My Application + block head + body + block content \ No newline at end of file diff --git a/node_modules/pug/test/cases/auxiliary/mixin-at-end-of-file.pug b/node_modules/pug/test/cases/auxiliary/mixin-at-end-of-file.pug new file mode 100644 index 0000000..e51eb01 --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/mixin-at-end-of-file.pug @@ -0,0 +1,3 @@ +mixin slide + section.slide + block \ No newline at end of file diff --git a/node_modules/pug/test/cases/auxiliary/mixins.pug b/node_modules/pug/test/cases/auxiliary/mixins.pug new file mode 100644 index 0000000..0c14c1d --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/mixins.pug @@ -0,0 +1,3 @@ + +mixin foo() + p bar \ No newline at end of file diff --git a/node_modules/pug/test/cases/auxiliary/pet.pug b/node_modules/pug/test/cases/auxiliary/pet.pug new file mode 100644 index 0000000..ebee3a8 --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/pet.pug @@ -0,0 +1,3 @@ +.pet + h1 {{name}} + p {{name}} is a {{species}} that is {{age}} old \ No newline at end of file diff --git a/node_modules/pug/test/cases/auxiliary/smile.html b/node_modules/pug/test/cases/auxiliary/smile.html new file mode 100644 index 0000000..05a0c49 --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/smile.html @@ -0,0 +1 @@ +

:)

\ No newline at end of file diff --git a/node_modules/pug/test/cases/auxiliary/window.pug b/node_modules/pug/test/cases/auxiliary/window.pug new file mode 100644 index 0000000..7ab7132 --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/window.pug @@ -0,0 +1,4 @@ + +.window + a(href='#').close Close + block window-content \ No newline at end of file diff --git a/node_modules/pug/test/cases/auxiliary/yield-nested.pug b/node_modules/pug/test/cases/auxiliary/yield-nested.pug new file mode 100644 index 0000000..0771c0a --- /dev/null +++ b/node_modules/pug/test/cases/auxiliary/yield-nested.pug @@ -0,0 +1,10 @@ +html + head + title + body + h1 Page + #content + #content-wrapper + yield + #footer + stuff \ No newline at end of file diff --git a/node_modules/pug/test/cases/basic.html b/node_modules/pug/test/cases/basic.html new file mode 100644 index 0000000..a01532a --- /dev/null +++ b/node_modules/pug/test/cases/basic.html @@ -0,0 +1,5 @@ + + +

Title

+ + \ No newline at end of file diff --git a/node_modules/pug/test/cases/basic.pug b/node_modules/pug/test/cases/basic.pug new file mode 100644 index 0000000..77066d1 --- /dev/null +++ b/node_modules/pug/test/cases/basic.pug @@ -0,0 +1,3 @@ +html + body + h1 Title \ No newline at end of file diff --git a/node_modules/pug/test/cases/blanks.html b/node_modules/pug/test/cases/blanks.html new file mode 100644 index 0000000..d58268c --- /dev/null +++ b/node_modules/pug/test/cases/blanks.html @@ -0,0 +1,5 @@ +
    +
  • foo
  • +
  • bar
  • +
  • baz
  • +
\ No newline at end of file diff --git a/node_modules/pug/test/cases/blanks.pug b/node_modules/pug/test/cases/blanks.pug new file mode 100644 index 0000000..67b0697 --- /dev/null +++ b/node_modules/pug/test/cases/blanks.pug @@ -0,0 +1,8 @@ + + +ul + li foo + + li bar + + li baz diff --git a/node_modules/pug/test/cases/block-code.html b/node_modules/pug/test/cases/block-code.html new file mode 100644 index 0000000..489fe5d --- /dev/null +++ b/node_modules/pug/test/cases/block-code.html @@ -0,0 +1,7 @@ + +
  • Uno
  • +
  • Dos
  • +
  • Tres
  • +
  • Cuatro
  • +
  • Cinco
  • +
  • Seis
  • diff --git a/node_modules/pug/test/cases/block-code.pug b/node_modules/pug/test/cases/block-code.pug new file mode 100644 index 0000000..9ab6854 --- /dev/null +++ b/node_modules/pug/test/cases/block-code.pug @@ -0,0 +1,12 @@ +- + list = ["uno", "dos", "tres", + "cuatro", "cinco", "seis"]; +//- Without a block, the element is accepted and no code is generated +- +each item in list + - + string = item.charAt(0) + + .toUpperCase() + + item.slice(1); + li= string diff --git a/node_modules/pug/test/cases/block-expansion.html b/node_modules/pug/test/cases/block-expansion.html new file mode 100644 index 0000000..3c24259 --- /dev/null +++ b/node_modules/pug/test/cases/block-expansion.html @@ -0,0 +1,5 @@ + +

    baz

    \ No newline at end of file diff --git a/node_modules/pug/test/cases/block-expansion.pug b/node_modules/pug/test/cases/block-expansion.pug new file mode 100644 index 0000000..fb40f9a --- /dev/null +++ b/node_modules/pug/test/cases/block-expansion.pug @@ -0,0 +1,5 @@ +ul + li: a(href='#') foo + li: a(href='#') bar + +p baz \ No newline at end of file diff --git a/node_modules/pug/test/cases/block-expansion.shorthands.html b/node_modules/pug/test/cases/block-expansion.shorthands.html new file mode 100644 index 0000000..96cf0e7 --- /dev/null +++ b/node_modules/pug/test/cases/block-expansion.shorthands.html @@ -0,0 +1,7 @@ +
      +
    • +
      +
      baz
      +
      +
    • +
    \ No newline at end of file diff --git a/node_modules/pug/test/cases/block-expansion.shorthands.pug b/node_modules/pug/test/cases/block-expansion.shorthands.pug new file mode 100644 index 0000000..c52a126 --- /dev/null +++ b/node_modules/pug/test/cases/block-expansion.shorthands.pug @@ -0,0 +1,2 @@ +ul + li.list-item: .foo: #bar baz \ No newline at end of file diff --git a/node_modules/pug/test/cases/blockquote.html b/node_modules/pug/test/cases/blockquote.html new file mode 100644 index 0000000..92b64de --- /dev/null +++ b/node_modules/pug/test/cases/blockquote.html @@ -0,0 +1,4 @@ +
    +
    Try to define yourself by what you do, and you’ll burnout every time. You are. That is enough. I rest in that.
    +
    from @thefray at 1:43pm on May 10
    +
    \ No newline at end of file diff --git a/node_modules/pug/test/cases/blockquote.pug b/node_modules/pug/test/cases/blockquote.pug new file mode 100644 index 0000000..a23b70f --- /dev/null +++ b/node_modules/pug/test/cases/blockquote.pug @@ -0,0 +1,4 @@ +figure + blockquote + | Try to define yourself by what you do, and you’ll burnout every time. You are. That is enough. I rest in that. + figcaption from @thefray at 1:43pm on May 10 \ No newline at end of file diff --git a/node_modules/pug/test/cases/blocks-in-blocks.html b/node_modules/pug/test/cases/blocks-in-blocks.html new file mode 100644 index 0000000..d7955ab --- /dev/null +++ b/node_modules/pug/test/cases/blocks-in-blocks.html @@ -0,0 +1,9 @@ + + + + Default title + + +

    Page 2

    + + diff --git a/node_modules/pug/test/cases/blocks-in-blocks.pug b/node_modules/pug/test/cases/blocks-in-blocks.pug new file mode 100644 index 0000000..13077d9 --- /dev/null +++ b/node_modules/pug/test/cases/blocks-in-blocks.pug @@ -0,0 +1,4 @@ +extends ./auxiliary/blocks-in-blocks-layout.pug + +block body + h1 Page 2 diff --git a/node_modules/pug/test/cases/blocks-in-if.html b/node_modules/pug/test/cases/blocks-in-if.html new file mode 100644 index 0000000..c3b9107 --- /dev/null +++ b/node_modules/pug/test/cases/blocks-in-if.html @@ -0,0 +1 @@ +

    ajax contents

    diff --git a/node_modules/pug/test/cases/blocks-in-if.pug b/node_modules/pug/test/cases/blocks-in-if.pug new file mode 100644 index 0000000..e0c6361 --- /dev/null +++ b/node_modules/pug/test/cases/blocks-in-if.pug @@ -0,0 +1,19 @@ +//- see https://github.com/pugjs/pug/issues/1589 + +-var ajax = true + +-if( ajax ) + //- return only contents if ajax requests + block contents + p ajax contents + +-else + //- return all html + doctype html + html + head + meta( charset='utf8' ) + title sample + body + block contents + p all contetns diff --git a/node_modules/pug/test/cases/case-blocks.html b/node_modules/pug/test/cases/case-blocks.html new file mode 100644 index 0000000..893b07d --- /dev/null +++ b/node_modules/pug/test/cases/case-blocks.html @@ -0,0 +1,5 @@ + + +

    you have a friend

    + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/case-blocks.pug b/node_modules/pug/test/cases/case-blocks.pug new file mode 100644 index 0000000..345cd41 --- /dev/null +++ b/node_modules/pug/test/cases/case-blocks.pug @@ -0,0 +1,10 @@ +html + body + - var friends = 1 + case friends + when 0 + p you have no friends + when 1 + p you have a friend + default + p you have #{friends} friends \ No newline at end of file diff --git a/node_modules/pug/test/cases/case.html b/node_modules/pug/test/cases/case.html new file mode 100644 index 0000000..f264fb7 --- /dev/null +++ b/node_modules/pug/test/cases/case.html @@ -0,0 +1,8 @@ + + + +

    you have a friend

    +

    you have very few friends

    +

    Friend is a string

    + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/case.pug b/node_modules/pug/test/cases/case.pug new file mode 100644 index 0000000..0fbe2ef --- /dev/null +++ b/node_modules/pug/test/cases/case.pug @@ -0,0 +1,19 @@ +html + body + - var friends = 1 + case friends + when 0: p you have no friends + when 1: p you have a friend + default: p you have #{friends} friends + - var friends = 0 + case friends + when 0 + when 1 + p you have very few friends + default + p you have #{friends} friends + + - var friend = 'Tim:G' + case friend + when 'Tim:G': p Friend is a string + when {tim: 'g'}: p Friend is an object diff --git a/node_modules/pug/test/cases/classes-empty.html b/node_modules/pug/test/cases/classes-empty.html new file mode 100644 index 0000000..bcc28a9 --- /dev/null +++ b/node_modules/pug/test/cases/classes-empty.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/node_modules/pug/test/cases/classes-empty.pug b/node_modules/pug/test/cases/classes-empty.pug new file mode 100644 index 0000000..5e66d84 --- /dev/null +++ b/node_modules/pug/test/cases/classes-empty.pug @@ -0,0 +1,3 @@ +a(class='') +a(class=null) +a(class=undefined) \ No newline at end of file diff --git a/node_modules/pug/test/cases/classes.html b/node_modules/pug/test/cases/classes.html new file mode 100644 index 0000000..07da8c5 --- /dev/null +++ b/node_modules/pug/test/cases/classes.html @@ -0,0 +1 @@ + diff --git a/node_modules/pug/test/cases/classes.pug b/node_modules/pug/test/cases/classes.pug new file mode 100644 index 0000000..67e1a1b --- /dev/null +++ b/node_modules/pug/test/cases/classes.pug @@ -0,0 +1,11 @@ +a(class=['foo', 'bar', 'baz']) + + + +a.foo(class='bar').baz + + + +a.foo-bar_baz + +a(class={foo: true, bar: false, baz: true}) diff --git a/node_modules/pug/test/cases/code.conditionals.html b/node_modules/pug/test/cases/code.conditionals.html new file mode 100644 index 0000000..1370312 --- /dev/null +++ b/node_modules/pug/test/cases/code.conditionals.html @@ -0,0 +1,11 @@ +

    foo

    +

    foo

    +

    foo

    +

    bar

    +

    baz

    +

    bar

    +

    yay

    +
    +
    +
    +
    diff --git a/node_modules/pug/test/cases/code.conditionals.pug b/node_modules/pug/test/cases/code.conditionals.pug new file mode 100644 index 0000000..aa4c715 --- /dev/null +++ b/node_modules/pug/test/cases/code.conditionals.pug @@ -0,0 +1,43 @@ + +- if (true) + p foo +- else + p bar + +- if (true) { + p foo +- } else { + p bar +- } + +if true + p foo + p bar + p baz +else + p bar + +unless true + p foo +else + p bar + +if 'nested' + if 'works' + p yay + +//- allow empty blocks +if false +else + .bar +if true + .bar +else +.bing + +if false + .bing +else if false + .bar +else + .foo \ No newline at end of file diff --git a/node_modules/pug/test/cases/code.escape.html b/node_modules/pug/test/cases/code.escape.html new file mode 100644 index 0000000..c0e1758 --- /dev/null +++ b/node_modules/pug/test/cases/code.escape.html @@ -0,0 +1,2 @@ +

    <script>

    +

    \ No newline at end of file diff --git a/node_modules/pug/test/cases/escape-chars.pug b/node_modules/pug/test/cases/escape-chars.pug new file mode 100644 index 0000000..f7978d6 --- /dev/null +++ b/node_modules/pug/test/cases/escape-chars.pug @@ -0,0 +1,2 @@ +script. + var re = /\d+/; \ No newline at end of file diff --git a/node_modules/pug/test/cases/escape-test.html b/node_modules/pug/test/cases/escape-test.html new file mode 100644 index 0000000..15e72d9 --- /dev/null +++ b/node_modules/pug/test/cases/escape-test.html @@ -0,0 +1,9 @@ + + + + escape-test + + + + + diff --git a/node_modules/pug/test/cases/escape-test.pug b/node_modules/pug/test/cases/escape-test.pug new file mode 100644 index 0000000..168c549 --- /dev/null +++ b/node_modules/pug/test/cases/escape-test.pug @@ -0,0 +1,8 @@ +doctype html +html + head + title escape-test + body + textarea + - var txt = '' + | #{txt} diff --git a/node_modules/pug/test/cases/escaping-class-attribute.html b/node_modules/pug/test/cases/escaping-class-attribute.html new file mode 100644 index 0000000..9563642 --- /dev/null +++ b/node_modules/pug/test/cases/escaping-class-attribute.html @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/escaping-class-attribute.pug b/node_modules/pug/test/cases/escaping-class-attribute.pug new file mode 100644 index 0000000..dffbb8b --- /dev/null +++ b/node_modules/pug/test/cases/escaping-class-attribute.pug @@ -0,0 +1,6 @@ +foo(attr="<%= bar %>") +foo(class="<%= bar %>") +foo(attr!="<%= bar %>") +foo(class!="<%= bar %>") +foo(class!="<%= bar %> lol rofl") +foo(class!="<%= bar %> lol rofl <%= lmao %>") diff --git a/node_modules/pug/test/cases/filter-in-include.html b/node_modules/pug/test/cases/filter-in-include.html new file mode 100644 index 0000000..b6b5636 --- /dev/null +++ b/node_modules/pug/test/cases/filter-in-include.html @@ -0,0 +1,7 @@ + + + + diff --git a/node_modules/pug/test/cases/filter-in-include.pug b/node_modules/pug/test/cases/filter-in-include.pug new file mode 100644 index 0000000..dce48fa --- /dev/null +++ b/node_modules/pug/test/cases/filter-in-include.pug @@ -0,0 +1 @@ +include ./auxiliary/filter-in-include.pug diff --git a/node_modules/pug/test/cases/filters-empty.html b/node_modules/pug/test/cases/filters-empty.html new file mode 100644 index 0000000..9ad128f --- /dev/null +++ b/node_modules/pug/test/cases/filters-empty.html @@ -0,0 +1,4 @@ + + + + diff --git a/node_modules/pug/test/cases/filters-empty.pug b/node_modules/pug/test/cases/filters-empty.pug new file mode 100644 index 0000000..7aa64de --- /dev/null +++ b/node_modules/pug/test/cases/filters-empty.pug @@ -0,0 +1,6 @@ +- var users = [{ name: 'tobi', age: 2 }] + +fb:users + for user in users + fb:user(age=user.age) + :cdata diff --git a/node_modules/pug/test/cases/filters.coffeescript.html b/node_modules/pug/test/cases/filters.coffeescript.html new file mode 100644 index 0000000..ceddb0c --- /dev/null +++ b/node_modules/pug/test/cases/filters.coffeescript.html @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/node_modules/pug/test/cases/filters.coffeescript.pug b/node_modules/pug/test/cases/filters.coffeescript.pug new file mode 100644 index 0000000..f2be6f8 --- /dev/null +++ b/node_modules/pug/test/cases/filters.coffeescript.pug @@ -0,0 +1,6 @@ +script(type='text/javascript') + :coffee-script + regexp = /\n/ + :coffee-script(minify=true) + math = + square: (value) -> value * value diff --git a/node_modules/pug/test/cases/filters.custom.html b/node_modules/pug/test/cases/filters.custom.html new file mode 100644 index 0000000..811701c --- /dev/null +++ b/node_modules/pug/test/cases/filters.custom.html @@ -0,0 +1,8 @@ + + + BEGINLine 1 +Line 2 + +Line 4END + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/filters.custom.pug b/node_modules/pug/test/cases/filters.custom.pug new file mode 100644 index 0000000..16808f6 --- /dev/null +++ b/node_modules/pug/test/cases/filters.custom.pug @@ -0,0 +1,7 @@ +html + body + :custom(opt='val' num=2) + Line 1 + Line 2 + + Line 4 diff --git a/node_modules/pug/test/cases/filters.include.custom.html b/node_modules/pug/test/cases/filters.include.custom.html new file mode 100644 index 0000000..05169e5 --- /dev/null +++ b/node_modules/pug/test/cases/filters.include.custom.html @@ -0,0 +1,10 @@ + + + +

    BEGINhtml
    +  body
    +    pre
    +      include:custom(opt='val' num=2) filters.include.custom.pug
    +END
    + + diff --git a/node_modules/pug/test/cases/filters.include.custom.pug b/node_modules/pug/test/cases/filters.include.custom.pug new file mode 100644 index 0000000..5811147 --- /dev/null +++ b/node_modules/pug/test/cases/filters.include.custom.pug @@ -0,0 +1,4 @@ +html + body + pre + include:custom(opt='val' num=2) filters.include.custom.pug diff --git a/node_modules/pug/test/cases/filters.include.html b/node_modules/pug/test/cases/filters.include.html new file mode 100644 index 0000000..cc74456 --- /dev/null +++ b/node_modules/pug/test/cases/filters.include.html @@ -0,0 +1,20 @@ + +

    Just some markdown tests.

    + +

    With new line.

    + + + + diff --git a/node_modules/pug/test/cases/filters.include.pug b/node_modules/pug/test/cases/filters.include.pug new file mode 100644 index 0000000..e7ea3db --- /dev/null +++ b/node_modules/pug/test/cases/filters.include.pug @@ -0,0 +1,7 @@ +html + body + include:markdown-it some.md + script + include:coffee-script(minify=true) include-filter-coffee.coffee + script + include:coffee-script(minify=false) include-filter-coffee.coffee diff --git a/node_modules/pug/test/cases/filters.inline.html b/node_modules/pug/test/cases/filters.inline.html new file mode 100644 index 0000000..e602ebd --- /dev/null +++ b/node_modules/pug/test/cases/filters.inline.html @@ -0,0 +1,3 @@ + +

    + before after

    \ No newline at end of file diff --git a/node_modules/pug/test/cases/filters.inline.pug b/node_modules/pug/test/cases/filters.inline.pug new file mode 100644 index 0000000..7b57985 --- /dev/null +++ b/node_modules/pug/test/cases/filters.inline.pug @@ -0,0 +1 @@ +p before #[:cdata inside] after \ No newline at end of file diff --git a/node_modules/pug/test/cases/filters.less.html b/node_modules/pug/test/cases/filters.less.html new file mode 100644 index 0000000..5cdb913 --- /dev/null +++ b/node_modules/pug/test/cases/filters.less.html @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/filters.less.pug b/node_modules/pug/test/cases/filters.less.pug new file mode 100644 index 0000000..a3df945 --- /dev/null +++ b/node_modules/pug/test/cases/filters.less.pug @@ -0,0 +1,8 @@ +html + head + style(type="text/css") + :less + @pad: 15px; + body { + padding: @pad; + } diff --git a/node_modules/pug/test/cases/filters.markdown.html b/node_modules/pug/test/cases/filters.markdown.html new file mode 100644 index 0000000..aa3d975 --- /dev/null +++ b/node_modules/pug/test/cases/filters.markdown.html @@ -0,0 +1,5 @@ + +

    This is some awesome markdown +whoop.

    + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/filters.markdown.pug b/node_modules/pug/test/cases/filters.markdown.pug new file mode 100644 index 0000000..30b1e4f --- /dev/null +++ b/node_modules/pug/test/cases/filters.markdown.pug @@ -0,0 +1,5 @@ +html + body + :markdown + This is _some_ awesome **markdown** + whoop. diff --git a/node_modules/pug/test/cases/filters.nested.html b/node_modules/pug/test/cases/filters.nested.html new file mode 100644 index 0000000..67f31e3 --- /dev/null +++ b/node_modules/pug/test/cases/filters.nested.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/filters.nested.pug b/node_modules/pug/test/cases/filters.nested.pug new file mode 100644 index 0000000..c79ccdd --- /dev/null +++ b/node_modules/pug/test/cases/filters.nested.pug @@ -0,0 +1,10 @@ +script + :cdata:uglify-js + (function() { + console.log('test') + })() +script + :cdata:uglify-js:coffee-script + (-> + console.log 'test' + )() diff --git a/node_modules/pug/test/cases/filters.stylus.html b/node_modules/pug/test/cases/filters.stylus.html new file mode 100644 index 0000000..d131a14 --- /dev/null +++ b/node_modules/pug/test/cases/filters.stylus.html @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/filters.stylus.pug b/node_modules/pug/test/cases/filters.stylus.pug new file mode 100644 index 0000000..323d29c --- /dev/null +++ b/node_modules/pug/test/cases/filters.stylus.pug @@ -0,0 +1,7 @@ +html + head + style(type="text/css") + :stylus + body + padding: 50px + body diff --git a/node_modules/pug/test/cases/html.html b/node_modules/pug/test/cases/html.html new file mode 100644 index 0000000..a038efd --- /dev/null +++ b/node_modules/pug/test/cases/html.html @@ -0,0 +1,9 @@ +
      +
    • foo
    • +
    • bar
    • +
    • baz
    • +
    + + +

    You can embed html as well.

    +

    Even as the body of a block expansion.

    \ No newline at end of file diff --git a/node_modules/pug/test/cases/html.pug b/node_modules/pug/test/cases/html.pug new file mode 100644 index 0000000..0e5422d --- /dev/null +++ b/node_modules/pug/test/cases/html.pug @@ -0,0 +1,13 @@ +- var version = 1449104952939 + +
      +
    • foo
    • +
    • bar
    • +
    • baz
    • +
    + + + + +p You can embed html as well. +p: Even as the body of a block expansion. diff --git a/node_modules/pug/test/cases/html5.html b/node_modules/pug/test/cases/html5.html new file mode 100644 index 0000000..83a553a --- /dev/null +++ b/node_modules/pug/test/cases/html5.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/html5.pug b/node_modules/pug/test/cases/html5.pug new file mode 100644 index 0000000..8dc68e2 --- /dev/null +++ b/node_modules/pug/test/cases/html5.pug @@ -0,0 +1,4 @@ +doctype html +input(type='checkbox', checked) +input(type='checkbox', checked=true) +input(type='checkbox', checked=false) \ No newline at end of file diff --git a/node_modules/pug/test/cases/include-extends-from-root.html b/node_modules/pug/test/cases/include-extends-from-root.html new file mode 100644 index 0000000..3916f5d --- /dev/null +++ b/node_modules/pug/test/cases/include-extends-from-root.html @@ -0,0 +1,8 @@ + + + My Application + + +

    hello

    + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/include-extends-from-root.pug b/node_modules/pug/test/cases/include-extends-from-root.pug new file mode 100644 index 0000000..a79a57d --- /dev/null +++ b/node_modules/pug/test/cases/include-extends-from-root.pug @@ -0,0 +1 @@ +include /auxiliary/extends-from-root.pug diff --git a/node_modules/pug/test/cases/include-extends-of-common-template.html b/node_modules/pug/test/cases/include-extends-of-common-template.html new file mode 100644 index 0000000..dd04738 --- /dev/null +++ b/node_modules/pug/test/cases/include-extends-of-common-template.html @@ -0,0 +1,2 @@ +
    test1
    +
    test2
    diff --git a/node_modules/pug/test/cases/include-extends-of-common-template.pug b/node_modules/pug/test/cases/include-extends-of-common-template.pug new file mode 100644 index 0000000..2511f52 --- /dev/null +++ b/node_modules/pug/test/cases/include-extends-of-common-template.pug @@ -0,0 +1,2 @@ +include auxiliary/extends-empty-block-1.pug +include auxiliary/extends-empty-block-2.pug diff --git a/node_modules/pug/test/cases/include-extends-relative.html b/node_modules/pug/test/cases/include-extends-relative.html new file mode 100644 index 0000000..3916f5d --- /dev/null +++ b/node_modules/pug/test/cases/include-extends-relative.html @@ -0,0 +1,8 @@ + + + My Application + + +

    hello

    + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/include-extends-relative.pug b/node_modules/pug/test/cases/include-extends-relative.pug new file mode 100644 index 0000000..1b5238c --- /dev/null +++ b/node_modules/pug/test/cases/include-extends-relative.pug @@ -0,0 +1 @@ +include ../cases/auxiliary/extends-relative.pug diff --git a/node_modules/pug/test/cases/include-filter-coffee.coffee b/node_modules/pug/test/cases/include-filter-coffee.coffee new file mode 100644 index 0000000..9723cd7 --- /dev/null +++ b/node_modules/pug/test/cases/include-filter-coffee.coffee @@ -0,0 +1,2 @@ +math = + square: (value) -> value * value diff --git a/node_modules/pug/test/cases/include-only-text-body.html b/node_modules/pug/test/cases/include-only-text-body.html new file mode 100644 index 0000000..f86b593 --- /dev/null +++ b/node_modules/pug/test/cases/include-only-text-body.html @@ -0,0 +1 @@ +The message is "" \ No newline at end of file diff --git a/node_modules/pug/test/cases/include-only-text-body.pug b/node_modules/pug/test/cases/include-only-text-body.pug new file mode 100644 index 0000000..fdb080c --- /dev/null +++ b/node_modules/pug/test/cases/include-only-text-body.pug @@ -0,0 +1,3 @@ +| The message is " +yield +| " diff --git a/node_modules/pug/test/cases/include-only-text.html b/node_modules/pug/test/cases/include-only-text.html new file mode 100644 index 0000000..6936ae4 --- /dev/null +++ b/node_modules/pug/test/cases/include-only-text.html @@ -0,0 +1,5 @@ + + +

    The message is "hello world"

    + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/include-only-text.pug b/node_modules/pug/test/cases/include-only-text.pug new file mode 100644 index 0000000..ede4f0f --- /dev/null +++ b/node_modules/pug/test/cases/include-only-text.pug @@ -0,0 +1,5 @@ +html + body + p + include include-only-text-body.pug + em hello world diff --git a/node_modules/pug/test/cases/include-with-text-head.html b/node_modules/pug/test/cases/include-with-text-head.html new file mode 100644 index 0000000..716f359 --- /dev/null +++ b/node_modules/pug/test/cases/include-with-text-head.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/include-with-text-head.pug b/node_modules/pug/test/cases/include-with-text-head.pug new file mode 100644 index 0000000..4e670c0 --- /dev/null +++ b/node_modules/pug/test/cases/include-with-text-head.pug @@ -0,0 +1,3 @@ +head + script(type='text/javascript'). + alert('hello world'); diff --git a/node_modules/pug/test/cases/include-with-text.html b/node_modules/pug/test/cases/include-with-text.html new file mode 100644 index 0000000..78386f7 --- /dev/null +++ b/node_modules/pug/test/cases/include-with-text.html @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/include-with-text.pug b/node_modules/pug/test/cases/include-with-text.pug new file mode 100644 index 0000000..bc83ea5 --- /dev/null +++ b/node_modules/pug/test/cases/include-with-text.pug @@ -0,0 +1,4 @@ +html + include include-with-text-head.pug + script(src='/caustic.js') + script(src='/app.js') diff --git a/node_modules/pug/test/cases/include.script.html b/node_modules/pug/test/cases/include.script.html new file mode 100644 index 0000000..cdd37c2 --- /dev/null +++ b/node_modules/pug/test/cases/include.script.html @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/node_modules/pug/test/cases/include.script.pug b/node_modules/pug/test/cases/include.script.pug new file mode 100644 index 0000000..f449144 --- /dev/null +++ b/node_modules/pug/test/cases/include.script.pug @@ -0,0 +1,2 @@ +script#pet-template(type='text/x-template') + include auxiliary/pet.pug diff --git a/node_modules/pug/test/cases/include.yield.nested.html b/node_modules/pug/test/cases/include.yield.nested.html new file mode 100644 index 0000000..947b615 --- /dev/null +++ b/node_modules/pug/test/cases/include.yield.nested.html @@ -0,0 +1,17 @@ + + + + + +

    Page

    +
    +
    +

    some content

    +

    and some more

    +
    +
    + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/include.yield.nested.pug b/node_modules/pug/test/cases/include.yield.nested.pug new file mode 100644 index 0000000..f4a7d69 --- /dev/null +++ b/node_modules/pug/test/cases/include.yield.nested.pug @@ -0,0 +1,4 @@ + +include auxiliary/yield-nested.pug + p some content + p and some more diff --git a/node_modules/pug/test/cases/includes-with-ext-js.html b/node_modules/pug/test/cases/includes-with-ext-js.html new file mode 100644 index 0000000..c36c363 --- /dev/null +++ b/node_modules/pug/test/cases/includes-with-ext-js.html @@ -0,0 +1,2 @@ +
    var x = "\n here is some \n new lined text";
    +
    diff --git a/node_modules/pug/test/cases/includes-with-ext-js.pug b/node_modules/pug/test/cases/includes-with-ext-js.pug new file mode 100644 index 0000000..65bfa8a --- /dev/null +++ b/node_modules/pug/test/cases/includes-with-ext-js.pug @@ -0,0 +1,3 @@ +pre + code + include javascript-new-lines.js diff --git a/node_modules/pug/test/cases/includes.html b/node_modules/pug/test/cases/includes.html new file mode 100644 index 0000000..2c00430 --- /dev/null +++ b/node_modules/pug/test/cases/includes.html @@ -0,0 +1,16 @@ +

    bar

    + +

    :)

    + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/includes.pug b/node_modules/pug/test/cases/includes.pug new file mode 100644 index 0000000..7761ce2 --- /dev/null +++ b/node_modules/pug/test/cases/includes.pug @@ -0,0 +1,10 @@ + +include auxiliary/mixins.pug + ++foo + +body + include auxiliary/smile.html + include auxiliary/escapes.html + script(type="text/javascript") + include:verbatim auxiliary/includable.js diff --git a/node_modules/pug/test/cases/inheritance.alert-dialog.html b/node_modules/pug/test/cases/inheritance.alert-dialog.html new file mode 100644 index 0000000..88a5dc6 --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.alert-dialog.html @@ -0,0 +1,6 @@ +
    Close +
    +

    Alert!

    +

    I'm an alert!

    +
    +
    diff --git a/node_modules/pug/test/cases/inheritance.alert-dialog.pug b/node_modules/pug/test/cases/inheritance.alert-dialog.pug new file mode 100644 index 0000000..7afcaf0 --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.alert-dialog.pug @@ -0,0 +1,6 @@ + +extends auxiliary/dialog.pug + +block content + h1 Alert! + p I'm an alert! diff --git a/node_modules/pug/test/cases/inheritance.defaults.html b/node_modules/pug/test/cases/inheritance.defaults.html new file mode 100644 index 0000000..e6878d1 --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.defaults.html @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/inheritance.defaults.pug b/node_modules/pug/test/cases/inheritance.defaults.pug new file mode 100644 index 0000000..aaead83 --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.defaults.pug @@ -0,0 +1,6 @@ +html + head + block head + script(src='jquery.js') + script(src='keymaster.js') + script(src='caustic.js') \ No newline at end of file diff --git a/node_modules/pug/test/cases/inheritance.extend.html b/node_modules/pug/test/cases/inheritance.extend.html new file mode 100644 index 0000000..1f4eae4 --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.extend.html @@ -0,0 +1,10 @@ + + + My Application + + + +

    Page

    +

    Some content

    + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/inheritance.extend.include.html b/node_modules/pug/test/cases/inheritance.extend.include.html new file mode 100644 index 0000000..66da1cc --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.extend.include.html @@ -0,0 +1,14 @@ + + + My Application + + + +

    Page

    +

    Some content

    +
    Close +

    Awesome

    +

    Now we can extend included blocks!

    +
    + + diff --git a/node_modules/pug/test/cases/inheritance.extend.include.pug b/node_modules/pug/test/cases/inheritance.extend.include.pug new file mode 100644 index 0000000..b67dfc3 --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.extend.include.pug @@ -0,0 +1,13 @@ + +extend auxiliary/layout.include.pug + +block head + script(src='jquery.js') + +block content + h2 Page + p Some content + +block window-content + h2 Awesome + p Now we can extend included blocks! diff --git a/node_modules/pug/test/cases/inheritance.extend.mixins.block.html b/node_modules/pug/test/cases/inheritance.extend.mixins.block.html new file mode 100644 index 0000000..0ea5d94 --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.extend.mixins.block.html @@ -0,0 +1,10 @@ + + + My Application + + +
    +

    Hello World!

    +
    + + diff --git a/node_modules/pug/test/cases/inheritance.extend.mixins.block.pug b/node_modules/pug/test/cases/inheritance.extend.mixins.block.pug new file mode 100644 index 0000000..775a5dc --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.extend.mixins.block.pug @@ -0,0 +1,4 @@ +extend auxiliary/inheritance.extend.mixin.block.pug + +block content + p Hello World! diff --git a/node_modules/pug/test/cases/inheritance.extend.mixins.html b/node_modules/pug/test/cases/inheritance.extend.mixins.html new file mode 100644 index 0000000..618e2b1 --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.extend.mixins.html @@ -0,0 +1,9 @@ + + + My Application + + +

    The meaning of life

    +

    Foo bar baz!

    + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/inheritance.extend.mixins.pug b/node_modules/pug/test/cases/inheritance.extend.mixins.pug new file mode 100644 index 0000000..ceaa412 --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.extend.mixins.pug @@ -0,0 +1,11 @@ + +extend auxiliary/layout.pug + +mixin article(title) + if title + h1= title + block + +block content + +article("The meaning of life") + p Foo bar baz! diff --git a/node_modules/pug/test/cases/inheritance.extend.pug b/node_modules/pug/test/cases/inheritance.extend.pug new file mode 100644 index 0000000..4ce3a6f --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.extend.pug @@ -0,0 +1,9 @@ + +extend auxiliary/layout.pug + +block head + script(src='jquery.js') + +block content + h2 Page + p Some content diff --git a/node_modules/pug/test/cases/inheritance.extend.recursive.html b/node_modules/pug/test/cases/inheritance.extend.recursive.html new file mode 100644 index 0000000..d5d0522 --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.extend.recursive.html @@ -0,0 +1,4 @@ +

    grand-grandparent

    +

    grandparent

    +

    parent

    +

    child

    \ No newline at end of file diff --git a/node_modules/pug/test/cases/inheritance.extend.recursive.pug b/node_modules/pug/test/cases/inheritance.extend.recursive.pug new file mode 100644 index 0000000..5842523 --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.extend.recursive.pug @@ -0,0 +1,4 @@ +extends /auxiliary/inheritance.extend.recursive-parent.pug + +block parent + h4 child \ No newline at end of file diff --git a/node_modules/pug/test/cases/inheritance.extend.whitespace.html b/node_modules/pug/test/cases/inheritance.extend.whitespace.html new file mode 100644 index 0000000..1f4eae4 --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.extend.whitespace.html @@ -0,0 +1,10 @@ + + + My Application + + + +

    Page

    +

    Some content

    + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/inheritance.extend.whitespace.pug b/node_modules/pug/test/cases/inheritance.extend.whitespace.pug new file mode 100644 index 0000000..25ee9e0 --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.extend.whitespace.pug @@ -0,0 +1,13 @@ + +extend auxiliary/layout.pug + +block head + + script(src='jquery.js') + +block content + + + + h2 Page + p Some content diff --git a/node_modules/pug/test/cases/inheritance.html b/node_modules/pug/test/cases/inheritance.html new file mode 100644 index 0000000..1f4eae4 --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.html @@ -0,0 +1,10 @@ + + + My Application + + + +

    Page

    +

    Some content

    + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/inheritance.pug b/node_modules/pug/test/cases/inheritance.pug new file mode 100644 index 0000000..dd5415d --- /dev/null +++ b/node_modules/pug/test/cases/inheritance.pug @@ -0,0 +1,9 @@ + +extends auxiliary/layout.pug + +block head + script(src='jquery.js') + +block content + h2 Page + p Some content diff --git a/node_modules/pug/test/cases/inline-tag.html b/node_modules/pug/test/cases/inline-tag.html new file mode 100644 index 0000000..7ea3af7 --- /dev/null +++ b/node_modules/pug/test/cases/inline-tag.html @@ -0,0 +1,21 @@ + +

    bing foo bong

    +

    + bing + foo + [foo] + + bong + +

    +

    + bing + foo + [foo] + + bong +

    +

    + #[strong escaped] + #[escaped +

    \ No newline at end of file diff --git a/node_modules/pug/test/cases/inline-tag.pug b/node_modules/pug/test/cases/inline-tag.pug new file mode 100644 index 0000000..df7b549 --- /dev/null +++ b/node_modules/pug/test/cases/inline-tag.pug @@ -0,0 +1,19 @@ +p bing #[strong foo] bong + +p. + bing + #[strong foo] + #[strong= '[foo]'] + #[- var foo = 'foo]'] + bong + +p + | bing + | #[strong foo] + | #[strong= '[foo]'] + | #[- var foo = 'foo]'] + | bong + +p. + \#[strong escaped] + \#[#[strong escaped] diff --git a/node_modules/pug/test/cases/intepolated-elements.html b/node_modules/pug/test/cases/intepolated-elements.html new file mode 100644 index 0000000..721fa02 --- /dev/null +++ b/node_modules/pug/test/cases/intepolated-elements.html @@ -0,0 +1,4 @@ + +

    with inline link

    +

    Some text

    +

    Some text with inline link

    \ No newline at end of file diff --git a/node_modules/pug/test/cases/intepolated-elements.pug b/node_modules/pug/test/cases/intepolated-elements.pug new file mode 100644 index 0000000..5fe8bcf --- /dev/null +++ b/node_modules/pug/test/cases/intepolated-elements.pug @@ -0,0 +1,3 @@ +p #[a.rho(href='#', class='rho--modifier') with inline link] +p Some text #[a.rho(href='#', class='rho--modifier')] +p Some text #[a.rho(href='#', class='rho--modifier') with inline link] \ No newline at end of file diff --git a/node_modules/pug/test/cases/interpolated-mixin.html b/node_modules/pug/test/cases/interpolated-mixin.html new file mode 100644 index 0000000..101aa95 --- /dev/null +++ b/node_modules/pug/test/cases/interpolated-mixin.html @@ -0,0 +1,3 @@ + +

    This also works http://www.bing.com so hurrah for Pug +

    \ No newline at end of file diff --git a/node_modules/pug/test/cases/interpolated-mixin.pug b/node_modules/pug/test/cases/interpolated-mixin.pug new file mode 100644 index 0000000..ae8fc74 --- /dev/null +++ b/node_modules/pug/test/cases/interpolated-mixin.pug @@ -0,0 +1,4 @@ +mixin linkit(url) + a(href=url)= url + +p This also works #[+linkit('http://www.bing.com')] so hurrah for Pug \ No newline at end of file diff --git a/node_modules/pug/test/cases/interpolation.escape.html b/node_modules/pug/test/cases/interpolation.escape.html new file mode 100644 index 0000000..8dd546b --- /dev/null +++ b/node_modules/pug/test/cases/interpolation.escape.html @@ -0,0 +1,6 @@ + + some + #{text} + here + My ID is {42} + \ No newline at end of file diff --git a/node_modules/pug/test/cases/interpolation.escape.pug b/node_modules/pug/test/cases/interpolation.escape.pug new file mode 100644 index 0000000..cff251b --- /dev/null +++ b/node_modules/pug/test/cases/interpolation.escape.pug @@ -0,0 +1,7 @@ + +- var id = 42; +foo + | some + | \#{text} + | here + | My ID #{"is {" + id + "}"} \ No newline at end of file diff --git a/node_modules/pug/test/cases/javascript-new-lines.js b/node_modules/pug/test/cases/javascript-new-lines.js new file mode 100644 index 0000000..6893341 --- /dev/null +++ b/node_modules/pug/test/cases/javascript-new-lines.js @@ -0,0 +1 @@ +var x = "\n here is some \n new lined text"; diff --git a/node_modules/pug/test/cases/layout.append.html b/node_modules/pug/test/cases/layout.append.html new file mode 100644 index 0000000..bc5e126 --- /dev/null +++ b/node_modules/pug/test/cases/layout.append.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/node_modules/pug/test/cases/layout.append.pug b/node_modules/pug/test/cases/layout.append.pug new file mode 100644 index 0000000..d771bc9 --- /dev/null +++ b/node_modules/pug/test/cases/layout.append.pug @@ -0,0 +1,6 @@ + +extends ../fixtures/append/app-layout.pug + +block append head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug/test/cases/layout.append.without-block.html b/node_modules/pug/test/cases/layout.append.without-block.html new file mode 100644 index 0000000..bc5e126 --- /dev/null +++ b/node_modules/pug/test/cases/layout.append.without-block.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/node_modules/pug/test/cases/layout.append.without-block.pug b/node_modules/pug/test/cases/layout.append.without-block.pug new file mode 100644 index 0000000..19842fc --- /dev/null +++ b/node_modules/pug/test/cases/layout.append.without-block.pug @@ -0,0 +1,6 @@ + +extends ../fixtures/append-without-block/app-layout.pug + +append head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug/test/cases/layout.multi.append.prepend.block.html b/node_modules/pug/test/cases/layout.multi.append.prepend.block.html new file mode 100644 index 0000000..314c2b3 --- /dev/null +++ b/node_modules/pug/test/cases/layout.multi.append.prepend.block.html @@ -0,0 +1,8 @@ +

    Last prepend must appear at top

    +

    Something prepended to content

    +
    Defined content
    +

    Something appended to content

    +

    Last append must be most last

    + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/layout.multi.append.prepend.block.pug b/node_modules/pug/test/cases/layout.multi.append.prepend.block.pug new file mode 100644 index 0000000..79d15b1 --- /dev/null +++ b/node_modules/pug/test/cases/layout.multi.append.prepend.block.pug @@ -0,0 +1,19 @@ +extends ../fixtures/multi-append-prepend-block/redefine.pug + +append content + p.first.append Something appended to content + +prepend content + p.first.prepend Something prepended to content + +append content + p.last.append Last append must be most last + +prepend content + p.last.prepend Last prepend must appear at top + +append head + script(src='jquery.js') + +prepend head + script(src='foo.js') diff --git a/node_modules/pug/test/cases/layout.prepend.html b/node_modules/pug/test/cases/layout.prepend.html new file mode 100644 index 0000000..8753a42 --- /dev/null +++ b/node_modules/pug/test/cases/layout.prepend.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/node_modules/pug/test/cases/layout.prepend.pug b/node_modules/pug/test/cases/layout.prepend.pug new file mode 100644 index 0000000..4659a11 --- /dev/null +++ b/node_modules/pug/test/cases/layout.prepend.pug @@ -0,0 +1,6 @@ + +extends ../fixtures/prepend/app-layout.pug + +block prepend head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug/test/cases/layout.prepend.without-block.html b/node_modules/pug/test/cases/layout.prepend.without-block.html new file mode 100644 index 0000000..8753a42 --- /dev/null +++ b/node_modules/pug/test/cases/layout.prepend.without-block.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/node_modules/pug/test/cases/layout.prepend.without-block.pug b/node_modules/pug/test/cases/layout.prepend.without-block.pug new file mode 100644 index 0000000..516d01b --- /dev/null +++ b/node_modules/pug/test/cases/layout.prepend.without-block.pug @@ -0,0 +1,6 @@ + +extends ../fixtures/prepend-without-block/app-layout.pug + +prepend head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug/test/cases/mixin-at-end-of-file.html b/node_modules/pug/test/cases/mixin-at-end-of-file.html new file mode 100644 index 0000000..495ca32 --- /dev/null +++ b/node_modules/pug/test/cases/mixin-at-end-of-file.html @@ -0,0 +1,3 @@ +
    +

    some awesome content

    +
    diff --git a/node_modules/pug/test/cases/mixin-at-end-of-file.pug b/node_modules/pug/test/cases/mixin-at-end-of-file.pug new file mode 100644 index 0000000..3d2faa1 --- /dev/null +++ b/node_modules/pug/test/cases/mixin-at-end-of-file.pug @@ -0,0 +1,4 @@ +include ./auxiliary/mixin-at-end-of-file.pug + ++slide() + p some awesome content diff --git a/node_modules/pug/test/cases/mixin-block-with-space.html b/node_modules/pug/test/cases/mixin-block-with-space.html new file mode 100644 index 0000000..5f1fc02 --- /dev/null +++ b/node_modules/pug/test/cases/mixin-block-with-space.html @@ -0,0 +1,3 @@ + +
    This text should appear +
    \ No newline at end of file diff --git a/node_modules/pug/test/cases/mixin-block-with-space.pug b/node_modules/pug/test/cases/mixin-block-with-space.pug new file mode 100644 index 0000000..471aac8 --- /dev/null +++ b/node_modules/pug/test/cases/mixin-block-with-space.pug @@ -0,0 +1,6 @@ +mixin m(id) + div + block + ++m() + | This text should appear \ No newline at end of file diff --git a/node_modules/pug/test/cases/mixin-hoist.html b/node_modules/pug/test/cases/mixin-hoist.html new file mode 100644 index 0000000..1755a30 --- /dev/null +++ b/node_modules/pug/test/cases/mixin-hoist.html @@ -0,0 +1,5 @@ + + +

    Pug

    + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/mixin-hoist.pug b/node_modules/pug/test/cases/mixin-hoist.pug new file mode 100644 index 0000000..eb2c423 --- /dev/null +++ b/node_modules/pug/test/cases/mixin-hoist.pug @@ -0,0 +1,7 @@ + +mixin foo() + h1= title + +html + body + +foo diff --git a/node_modules/pug/test/cases/mixin-via-include.html b/node_modules/pug/test/cases/mixin-via-include.html new file mode 100644 index 0000000..8124337 --- /dev/null +++ b/node_modules/pug/test/cases/mixin-via-include.html @@ -0,0 +1 @@ +

    bar

    \ No newline at end of file diff --git a/node_modules/pug/test/cases/mixin-via-include.pug b/node_modules/pug/test/cases/mixin-via-include.pug new file mode 100644 index 0000000..bb7b6d2 --- /dev/null +++ b/node_modules/pug/test/cases/mixin-via-include.pug @@ -0,0 +1,5 @@ +//- regression test for https://github.com/pugjs/pug/issues/1435 + +include ../fixtures/mixin-include.pug + ++bang \ No newline at end of file diff --git a/node_modules/pug/test/cases/mixin.attrs.html b/node_modules/pug/test/cases/mixin.attrs.html new file mode 100644 index 0000000..2f2e0ef --- /dev/null +++ b/node_modules/pug/test/cases/mixin.attrs.html @@ -0,0 +1,32 @@ + +
    Hello World +
    +
    +

    Section 1

    +

    Some important content.

    +
    +
    +

    Section 2

    +

    Even more important content.

    + +
    +
    +
    +

    Section 3

    +

    Last content.

    + +
    +
    +
    +

    Some final words.

    +
    +
    +
    + +
    +
    work
    +
    +

    1

    +

    2

    +

    3

    +

    4

    \ No newline at end of file diff --git a/node_modules/pug/test/cases/mixin.attrs.pug b/node_modules/pug/test/cases/mixin.attrs.pug new file mode 100644 index 0000000..82a46ff --- /dev/null +++ b/node_modules/pug/test/cases/mixin.attrs.pug @@ -0,0 +1,59 @@ +mixin centered(title) + div.centered(id=attributes.id) + - if (title) + h1(class=attributes.class)= title + block + - if (attributes.href) + .footer + a(href=attributes.href) Back + +mixin main(title) + div.stretch + +centered(title).highlight&attributes(attributes) + block + +mixin bottom + div.bottom&attributes(attributes) + block + +body + +centered#First Hello World + +centered('Section 1')#Second + p Some important content. + +centered('Section 2')#Third.foo(href='menu.html', class='bar') + p Even more important content. + +main('Section 3')(href='#') + p Last content. + +bottom.foo(class='bar', name='end', id='Last', data-attr='baz') + p Some final words. + +bottom(class=['class1', 'class2']) + +mixin foo + div.thing(attr1='foo', attr2='bar')&attributes(attributes) + +- var val = '' +- var classes = ['foo', 'bar'] ++foo(attr3='baz' data-foo=val data-bar!=val class=classes).thunk + +//- Regression test for #1424 +mixin work_filmstrip_item(work) + div&attributes(attributes)= work ++work_filmstrip_item('work')("data-profile"='profile', "data-creator-name"='name') + +mixin my-mixin(arg1, arg2, arg3, arg4) + p= arg1 + p= arg2 + p= arg3 + p= arg4 + ++foo( + attr3="qux" + class="baz" +) + ++my-mixin( +'1', + '2', + '3', + '4' +) diff --git a/node_modules/pug/test/cases/mixin.block-tag-behaviour.html b/node_modules/pug/test/cases/mixin.block-tag-behaviour.html new file mode 100644 index 0000000..580dbe0 --- /dev/null +++ b/node_modules/pug/test/cases/mixin.block-tag-behaviour.html @@ -0,0 +1,22 @@ + + +
    +

    Foo

    +

    I'm article foo

    +
    + + + + +
    +

    Something

    +

    + I'm a much longer + text-only article, + but you can still + inline html tags + in me if you want. +

    +
    + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/mixin.block-tag-behaviour.pug b/node_modules/pug/test/cases/mixin.block-tag-behaviour.pug new file mode 100644 index 0000000..1d2d2d3 --- /dev/null +++ b/node_modules/pug/test/cases/mixin.block-tag-behaviour.pug @@ -0,0 +1,24 @@ + +mixin article(name) + section.article + h1= name + block + +html + body + +article('Foo'): p I'm article foo + +mixin article(name) + section.article + h1= name + p + block + +html + body + +article('Something'). + I'm a much longer + text-only article, + but you can still + inline html tags + in me if you want. \ No newline at end of file diff --git a/node_modules/pug/test/cases/mixin.blocks.html b/node_modules/pug/test/cases/mixin.blocks.html new file mode 100644 index 0000000..def5c6f --- /dev/null +++ b/node_modules/pug/test/cases/mixin.blocks.html @@ -0,0 +1,34 @@ + + +
    + + + +
    + + + + +
    + + + +
    + + + + +
    + +
    + + +
    +
    +

    one

    +

    two

    +

    three

    +
    +
    +
    123 +
    \ No newline at end of file diff --git a/node_modules/pug/test/cases/mixin.blocks.pug b/node_modules/pug/test/cases/mixin.blocks.pug new file mode 100644 index 0000000..30c9990 --- /dev/null +++ b/node_modules/pug/test/cases/mixin.blocks.pug @@ -0,0 +1,44 @@ + + +mixin form(method, action) + form(method=method, action=action) + - var csrf_token_from_somewhere = 'hey' + input(type='hidden', name='_csrf', value=csrf_token_from_somewhere) + block + +html + body + +form('GET', '/search') + input(type='text', name='query', placeholder='Search') + input(type='submit', value='Search') + +html + body + +form('POST', '/search') + input(type='text', name='query', placeholder='Search') + input(type='submit', value='Search') + +html + body + +form('POST', '/search') + +mixin bar() + #bar + block + +mixin foo() + #foo + +bar + block + ++foo + p one + p two + p three + + +mixin baz + #baz + block + ++baz()= '123' \ No newline at end of file diff --git a/node_modules/pug/test/cases/mixin.merge.html b/node_modules/pug/test/cases/mixin.merge.html new file mode 100644 index 0000000..e513d35 --- /dev/null +++ b/node_modules/pug/test/cases/mixin.merge.html @@ -0,0 +1,34 @@ + +

    One

    +

    Two

    +

    Three

    +

    Four

    +

    One

    +

    Two

    +

    Three

    +

    Four

    +

    One

    +

    Two

    +

    Three

    +

    Four

    +

    One

    +

    Two

    +

    Three

    +

    Four

    +

    One

    +

    Two

    +

    Three

    +

    Four

    +

    One

    +

    Two

    +

    Three

    +

    Four

    +

    One

    +

    Two

    +

    Three

    +

    Four

    +

    One

    +

    Two

    +

    Three

    +

    Four

    + diff --git a/node_modules/pug/test/cases/mixin.merge.pug b/node_modules/pug/test/cases/mixin.merge.pug new file mode 100644 index 0000000..f0d217d --- /dev/null +++ b/node_modules/pug/test/cases/mixin.merge.pug @@ -0,0 +1,15 @@ +mixin foo + p.bar&attributes(attributes) One + p.baz.quux&attributes(attributes) Two + p&attributes(attributes) Three + p.bar&attributes(attributes)(class="baz") Four + +body + +foo.hello + +foo#world + +foo.hello#world + +foo.hello.world + +foo(class="hello") + +foo.hello(class="world") + +foo + +foo&attributes({class: "hello"}) \ No newline at end of file diff --git a/node_modules/pug/test/cases/mixins-unused.html b/node_modules/pug/test/cases/mixins-unused.html new file mode 100644 index 0000000..5db7bc1 --- /dev/null +++ b/node_modules/pug/test/cases/mixins-unused.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/node_modules/pug/test/cases/mixins-unused.pug b/node_modules/pug/test/cases/mixins-unused.pug new file mode 100644 index 0000000..b0af6cc --- /dev/null +++ b/node_modules/pug/test/cases/mixins-unused.pug @@ -0,0 +1,3 @@ +mixin never-called + .wtf This isn't something we ever want to output +body \ No newline at end of file diff --git a/node_modules/pug/test/cases/mixins.html b/node_modules/pug/test/cases/mixins.html new file mode 100644 index 0000000..a75b175 --- /dev/null +++ b/node_modules/pug/test/cases/mixins.html @@ -0,0 +1,23 @@ + +
    +

    Tobi

    +
    +
    +

    This

    +

    is regular, javascript

    +
    +
    +
    + +
      +
    • foo
    • +
    • bar
    • +
    • baz
    • +
    +
      +
    • foo
    • +
    • bar
    • +
    • baz
    • +
    + +
    This is interpolated
    \ No newline at end of file diff --git a/node_modules/pug/test/cases/mixins.pug b/node_modules/pug/test/cases/mixins.pug new file mode 100644 index 0000000..4e45671 --- /dev/null +++ b/node_modules/pug/test/cases/mixins.pug @@ -0,0 +1,32 @@ +mixin comment(title, str) + .comment + h2= title + p.body= str + + +mixin comment (title, str) + .comment + h2= title + p.body= str + +#user + h1 Tobi + .comments + +comment('This', + (('is regular, javascript'))) + +mixin list + ul + li foo + li bar + li baz + +body + +list() + + list() + +mixin foobar(str) + div#interpolation= str + 'interpolated' + +- var suffix = "bar" ++#{'foo' + suffix}('This is ') diff --git a/node_modules/pug/test/cases/mixins.rest-args.html b/node_modules/pug/test/cases/mixins.rest-args.html new file mode 100644 index 0000000..5b37365 --- /dev/null +++ b/node_modules/pug/test/cases/mixins.rest-args.html @@ -0,0 +1,6 @@ +
      +
    • 1
    • +
    • 2
    • +
    • 3
    • +
    • 4
    • +
    diff --git a/node_modules/pug/test/cases/mixins.rest-args.pug b/node_modules/pug/test/cases/mixins.rest-args.pug new file mode 100644 index 0000000..929a927 --- /dev/null +++ b/node_modules/pug/test/cases/mixins.rest-args.pug @@ -0,0 +1,6 @@ +mixin list(tag, ...items) + #{tag} + each item in items + li= item + ++list('ul', 1, 2, 3, 4) diff --git a/node_modules/pug/test/cases/namespaces.html b/node_modules/pug/test/cases/namespaces.html new file mode 100644 index 0000000..90522ac --- /dev/null +++ b/node_modules/pug/test/cases/namespaces.html @@ -0,0 +1,2 @@ +Something + \ No newline at end of file diff --git a/node_modules/pug/test/cases/namespaces.pug b/node_modules/pug/test/cases/namespaces.pug new file mode 100644 index 0000000..0694677 --- /dev/null +++ b/node_modules/pug/test/cases/namespaces.pug @@ -0,0 +1,2 @@ +fb:user:role Something +foo(fb:foo='bar') \ No newline at end of file diff --git a/node_modules/pug/test/cases/nesting.html b/node_modules/pug/test/cases/nesting.html new file mode 100644 index 0000000..56c15cb --- /dev/null +++ b/node_modules/pug/test/cases/nesting.html @@ -0,0 +1,11 @@ +
      +
    • a
    • +
    • b
    • +
    • +
        +
      • c
      • +
      • d
      • +
      +
    • +
    • e
    • +
    \ No newline at end of file diff --git a/node_modules/pug/test/cases/nesting.pug b/node_modules/pug/test/cases/nesting.pug new file mode 100644 index 0000000..f8cab4d --- /dev/null +++ b/node_modules/pug/test/cases/nesting.pug @@ -0,0 +1,8 @@ +ul + li a + li b + li + ul + li c + li d + li e \ No newline at end of file diff --git a/node_modules/pug/test/cases/pipeless-comments.html b/node_modules/pug/test/cases/pipeless-comments.html new file mode 100644 index 0000000..5f9af83 --- /dev/null +++ b/node_modules/pug/test/cases/pipeless-comments.html @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/pipeless-comments.pug b/node_modules/pug/test/cases/pipeless-comments.pug new file mode 100644 index 0000000..426e459 --- /dev/null +++ b/node_modules/pug/test/cases/pipeless-comments.pug @@ -0,0 +1,4 @@ +// + .foo + .bar + .hey diff --git a/node_modules/pug/test/cases/pipeless-filters.html b/node_modules/pug/test/cases/pipeless-filters.html new file mode 100644 index 0000000..64e4cb7 --- /dev/null +++ b/node_modules/pug/test/cases/pipeless-filters.html @@ -0,0 +1,2 @@ +
    code sample
    +

    Heading

    diff --git a/node_modules/pug/test/cases/pipeless-filters.pug b/node_modules/pug/test/cases/pipeless-filters.pug new file mode 100644 index 0000000..b24c25a --- /dev/null +++ b/node_modules/pug/test/cases/pipeless-filters.pug @@ -0,0 +1,4 @@ +:markdown-it + code sample + + # Heading diff --git a/node_modules/pug/test/cases/pipeless-tag.html b/node_modules/pug/test/cases/pipeless-tag.html new file mode 100644 index 0000000..f6f8935 --- /dev/null +++ b/node_modules/pug/test/cases/pipeless-tag.html @@ -0,0 +1,3 @@ + +
      what
    +is going on
    \ No newline at end of file diff --git a/node_modules/pug/test/cases/pipeless-tag.pug b/node_modules/pug/test/cases/pipeless-tag.pug new file mode 100644 index 0000000..d521da4 --- /dev/null +++ b/node_modules/pug/test/cases/pipeless-tag.pug @@ -0,0 +1,3 @@ +pre. + what + is #{'going'} #[| #{'on'}] diff --git a/node_modules/pug/test/cases/pre.html b/node_modules/pug/test/cases/pre.html new file mode 100644 index 0000000..33bab4e --- /dev/null +++ b/node_modules/pug/test/cases/pre.html @@ -0,0 +1,7 @@ +
    foo
    +bar
    +baz
    +
    +
    foo
    +bar
    +baz
    \ No newline at end of file diff --git a/node_modules/pug/test/cases/pre.pug b/node_modules/pug/test/cases/pre.pug new file mode 100644 index 0000000..75673c5 --- /dev/null +++ b/node_modules/pug/test/cases/pre.pug @@ -0,0 +1,10 @@ +pre. + foo + bar + baz + +pre + code. + foo + bar + baz \ No newline at end of file diff --git a/node_modules/pug/test/cases/quotes.html b/node_modules/pug/test/cases/quotes.html new file mode 100644 index 0000000..592b136 --- /dev/null +++ b/node_modules/pug/test/cases/quotes.html @@ -0,0 +1,2 @@ +

    "foo"

    +

    'foo'

    \ No newline at end of file diff --git a/node_modules/pug/test/cases/quotes.pug b/node_modules/pug/test/cases/quotes.pug new file mode 100644 index 0000000..499c835 --- /dev/null +++ b/node_modules/pug/test/cases/quotes.pug @@ -0,0 +1,2 @@ +p "foo" +p 'foo' \ No newline at end of file diff --git a/node_modules/pug/test/cases/regression.1794.html b/node_modules/pug/test/cases/regression.1794.html new file mode 100644 index 0000000..b322cca --- /dev/null +++ b/node_modules/pug/test/cases/regression.1794.html @@ -0,0 +1 @@ +
    \ No newline at end of file diff --git a/node_modules/pug/test/cases/regression.1794.pug b/node_modules/pug/test/cases/regression.1794.pug new file mode 100644 index 0000000..fb33c31 --- /dev/null +++ b/node_modules/pug/test/cases/regression.1794.pug @@ -0,0 +1,4 @@ +extends ./auxiliary/1794-extends.pug + +block content + include ./auxiliary/1794-include.pug \ No newline at end of file diff --git a/node_modules/pug/test/cases/regression.784.html b/node_modules/pug/test/cases/regression.784.html new file mode 100644 index 0000000..933e986 --- /dev/null +++ b/node_modules/pug/test/cases/regression.784.html @@ -0,0 +1 @@ +
    google.com
    \ No newline at end of file diff --git a/node_modules/pug/test/cases/regression.784.pug b/node_modules/pug/test/cases/regression.784.pug new file mode 100644 index 0000000..bab7540 --- /dev/null +++ b/node_modules/pug/test/cases/regression.784.pug @@ -0,0 +1,2 @@ +- var url = 'http://www.google.com' +.url #{url.replace('http://', '').replace(/^www\./, '')} \ No newline at end of file diff --git a/node_modules/pug/test/cases/script.whitespace.html b/node_modules/pug/test/cases/script.whitespace.html new file mode 100644 index 0000000..45b7ced --- /dev/null +++ b/node_modules/pug/test/cases/script.whitespace.html @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/node_modules/pug/test/cases/script.whitespace.pug b/node_modules/pug/test/cases/script.whitespace.pug new file mode 100644 index 0000000..e0afc3a --- /dev/null +++ b/node_modules/pug/test/cases/script.whitespace.pug @@ -0,0 +1,6 @@ +script. + if (foo) { + + bar(); + + } \ No newline at end of file diff --git a/node_modules/pug/test/cases/scripts.html b/node_modules/pug/test/cases/scripts.html new file mode 100644 index 0000000..e3dc48b --- /dev/null +++ b/node_modules/pug/test/cases/scripts.html @@ -0,0 +1,9 @@ + + + + +
    \ No newline at end of file diff --git a/node_modules/pug/test/cases/scripts.non-js.html b/node_modules/pug/test/cases/scripts.non-js.html new file mode 100644 index 0000000..9daff38 --- /dev/null +++ b/node_modules/pug/test/cases/scripts.non-js.html @@ -0,0 +1,11 @@ + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/scripts.non-js.pug b/node_modules/pug/test/cases/scripts.non-js.pug new file mode 100644 index 0000000..9f9a408 --- /dev/null +++ b/node_modules/pug/test/cases/scripts.non-js.pug @@ -0,0 +1,9 @@ +script#user-template(type='text/template') + #user + h1 <%= user.name %> + p <%= user.description %> + +script#user-template(type='text/template'). + if (foo) { + bar(); + } \ No newline at end of file diff --git a/node_modules/pug/test/cases/scripts.pug b/node_modules/pug/test/cases/scripts.pug new file mode 100644 index 0000000..d28887f --- /dev/null +++ b/node_modules/pug/test/cases/scripts.pug @@ -0,0 +1,8 @@ +script. + if (foo) { + bar(); + } +script!= 'foo()' +script foo() +script +div \ No newline at end of file diff --git a/node_modules/pug/test/cases/self-closing-html.html b/node_modules/pug/test/cases/self-closing-html.html new file mode 100644 index 0000000..02a38d0 --- /dev/null +++ b/node_modules/pug/test/cases/self-closing-html.html @@ -0,0 +1,4 @@ + + +
    + diff --git a/node_modules/pug/test/cases/self-closing-html.pug b/node_modules/pug/test/cases/self-closing-html.pug new file mode 100644 index 0000000..094e42a --- /dev/null +++ b/node_modules/pug/test/cases/self-closing-html.pug @@ -0,0 +1,4 @@ +doctype html +html + body + br/ diff --git a/node_modules/pug/test/cases/single-period.html b/node_modules/pug/test/cases/single-period.html new file mode 100644 index 0000000..430944c --- /dev/null +++ b/node_modules/pug/test/cases/single-period.html @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/node_modules/pug/test/cases/single-period.pug b/node_modules/pug/test/cases/single-period.pug new file mode 100644 index 0000000..f3d734c --- /dev/null +++ b/node_modules/pug/test/cases/single-period.pug @@ -0,0 +1 @@ +span . \ No newline at end of file diff --git a/node_modules/pug/test/cases/some-included.styl b/node_modules/pug/test/cases/some-included.styl new file mode 100644 index 0000000..7458543 --- /dev/null +++ b/node_modules/pug/test/cases/some-included.styl @@ -0,0 +1,2 @@ +body + padding 10px diff --git a/node_modules/pug/test/cases/some.md b/node_modules/pug/test/cases/some.md new file mode 100644 index 0000000..8ea3e54 --- /dev/null +++ b/node_modules/pug/test/cases/some.md @@ -0,0 +1,3 @@ +Just _some_ markdown **tests**. + +With new line. diff --git a/node_modules/pug/test/cases/some.styl b/node_modules/pug/test/cases/some.styl new file mode 100644 index 0000000..f77222d --- /dev/null +++ b/node_modules/pug/test/cases/some.styl @@ -0,0 +1 @@ +@import "some-included" diff --git a/node_modules/pug/test/cases/source.html b/node_modules/pug/test/cases/source.html new file mode 100644 index 0000000..1881c0f --- /dev/null +++ b/node_modules/pug/test/cases/source.html @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/source.pug b/node_modules/pug/test/cases/source.pug new file mode 100644 index 0000000..db22b80 --- /dev/null +++ b/node_modules/pug/test/cases/source.pug @@ -0,0 +1,4 @@ +html + audio(preload='auto', autobuffer, controls) + source(src='foo') + source(src='bar') \ No newline at end of file diff --git a/node_modules/pug/test/cases/styles.html b/node_modules/pug/test/cases/styles.html new file mode 100644 index 0000000..394953e --- /dev/null +++ b/node_modules/pug/test/cases/styles.html @@ -0,0 +1,20 @@ + + + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + diff --git a/node_modules/pug/test/cases/styles.pug b/node_modules/pug/test/cases/styles.pug new file mode 100644 index 0000000..9618353 --- /dev/null +++ b/node_modules/pug/test/cases/styles.pug @@ -0,0 +1,19 @@ +html + head + style. + body { + padding: 50px; + } + body + div(style='color:red;background:green') + div(style={color: 'red', background: 'green'}) + div&attributes({style: 'color:red;background:green'}) + div&attributes({style: {color: 'red', background: 'green'}}) + mixin div() + div&attributes(attributes) + +div(style='color:red;background:green') + +div(style={color: 'red', background: 'green'}) + - var bg = 'green'; + div(style={color: 'red', background: bg}) + div&attributes({style: {color: 'red', background: bg}}) + +div(style={color: 'red', background: bg}) diff --git a/node_modules/pug/test/cases/tag.interpolation.html b/node_modules/pug/test/cases/tag.interpolation.html new file mode 100644 index 0000000..9f2816c --- /dev/null +++ b/node_modules/pug/test/cases/tag.interpolation.html @@ -0,0 +1,9 @@ +

    value

    +

    value

    +here + diff --git a/node_modules/pug/test/cases/tag.interpolation.pug b/node_modules/pug/test/cases/tag.interpolation.pug new file mode 100644 index 0000000..d923ddb --- /dev/null +++ b/node_modules/pug/test/cases/tag.interpolation.pug @@ -0,0 +1,22 @@ + +- var tag = 'p' +- var foo = 'bar' + +#{tag} value +#{tag}(foo='bar') value +#{foo ? 'a' : 'li'}(something) here + +mixin item(icon) + li + if attributes.href + a&attributes(attributes) + img.icon(src=icon) + block + else + span&attributes(attributes) + img.icon(src=icon) + block + +ul + +item('contact') Contact + +item(href='/contact') Contact diff --git a/node_modules/pug/test/cases/tags.self-closing.html b/node_modules/pug/test/cases/tags.self-closing.html new file mode 100644 index 0000000..4f0bc7b --- /dev/null +++ b/node_modules/pug/test/cases/tags.self-closing.html @@ -0,0 +1,14 @@ + + + + + + + / + / + + + / + / + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/tags.self-closing.pug b/node_modules/pug/test/cases/tags.self-closing.pug new file mode 100644 index 0000000..9207c32 --- /dev/null +++ b/node_modules/pug/test/cases/tags.self-closing.pug @@ -0,0 +1,19 @@ + +body + foo + foo(bar='baz') + foo/ + foo(bar='baz')/ + foo / + foo(bar='baz') / + #{'foo'}/ + #{'foo'}(bar='baz')/ + #{'foo'} / + #{'foo'}(bar='baz') / + //- can have a single space after them + img + //- can have lots of white space after them + img + #{ + 'foo' + }/ diff --git a/node_modules/pug/test/cases/template.html b/node_modules/pug/test/cases/template.html new file mode 100644 index 0000000..2054e05 --- /dev/null +++ b/node_modules/pug/test/cases/template.html @@ -0,0 +1,11 @@ + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/template.pug b/node_modules/pug/test/cases/template.pug new file mode 100644 index 0000000..20e086b --- /dev/null +++ b/node_modules/pug/test/cases/template.pug @@ -0,0 +1,9 @@ +script(type='text/x-template') + article + h2 {{title}} + p {{description}} + +script(type='text/x-template'). + article + h2 {{title}} + p {{description}} diff --git a/node_modules/pug/test/cases/text-block.html b/node_modules/pug/test/cases/text-block.html new file mode 100644 index 0000000..fae8caa --- /dev/null +++ b/node_modules/pug/test/cases/text-block.html @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/text-block.pug b/node_modules/pug/test/cases/text-block.pug new file mode 100644 index 0000000..a032fa7 --- /dev/null +++ b/node_modules/pug/test/cases/text-block.pug @@ -0,0 +1,6 @@ + +label Username: + input(type='text', name='user[name]') + +label Password: + input(type='text', name='user[pass]') \ No newline at end of file diff --git a/node_modules/pug/test/cases/text.html b/node_modules/pug/test/cases/text.html new file mode 100644 index 0000000..6f01615 --- /dev/null +++ b/node_modules/pug/test/cases/text.html @@ -0,0 +1,38 @@ + + +

    +

    +

    + foo + bar + + + baz +

    +

    + foo + + + bar + baz + +

    +foo + + +bar +baz + +
    foo
    +  bar
    +    baz
    +.
    +
    foo
    +  bar
    +    baz
    +.
    +
    +foo + bar + baz +. diff --git a/node_modules/pug/test/cases/text.pug b/node_modules/pug/test/cases/text.pug new file mode 100644 index 0000000..abb0e0b --- /dev/null +++ b/node_modules/pug/test/cases/text.pug @@ -0,0 +1,46 @@ +option(value='') -- (selected) -- + +p + +p. + +p + | foo + | bar + | + | + | baz + +p. + foo + + + bar + baz + +. + +. + foo + + + bar + baz + +pre + | foo + | bar + | baz + | . + +pre. + foo + bar + baz + . + +. + foo + bar + baz + . diff --git a/node_modules/pug/test/cases/utf8bom.html b/node_modules/pug/test/cases/utf8bom.html new file mode 100644 index 0000000..e3e18f0 --- /dev/null +++ b/node_modules/pug/test/cases/utf8bom.html @@ -0,0 +1 @@ +

    "foo"

    diff --git a/node_modules/pug/test/cases/utf8bom.pug b/node_modules/pug/test/cases/utf8bom.pug new file mode 100644 index 0000000..9a32814 --- /dev/null +++ b/node_modules/pug/test/cases/utf8bom.pug @@ -0,0 +1 @@ +p "foo" diff --git a/node_modules/pug/test/cases/vars.html b/node_modules/pug/test/cases/vars.html new file mode 100644 index 0000000..e9b7590 --- /dev/null +++ b/node_modules/pug/test/cases/vars.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/node_modules/pug/test/cases/vars.pug b/node_modules/pug/test/cases/vars.pug new file mode 100644 index 0000000..46451a9 --- /dev/null +++ b/node_modules/pug/test/cases/vars.pug @@ -0,0 +1,3 @@ +- var foo = 'bar' +- var list = [1,2,3] +a(class=list, id=foo) \ No newline at end of file diff --git a/node_modules/pug/test/cases/while.html b/node_modules/pug/test/cases/while.html new file mode 100644 index 0000000..dff7ff6 --- /dev/null +++ b/node_modules/pug/test/cases/while.html @@ -0,0 +1,11 @@ +
      +
    • 2
    • +
    • 3
    • +
    • 4
    • +
    • 5
    • +
    • 6
    • +
    • 7
    • +
    • 8
    • +
    • 9
    • +
    • 10
    • +
    diff --git a/node_modules/pug/test/cases/while.pug b/node_modules/pug/test/cases/while.pug new file mode 100644 index 0000000..059b54b --- /dev/null +++ b/node_modules/pug/test/cases/while.pug @@ -0,0 +1,5 @@ +- var x = 1; +ul + while x < 10 + - x++; + li= x diff --git a/node_modules/pug/test/cases/xml.html b/node_modules/pug/test/cases/xml.html new file mode 100644 index 0000000..5fd9f1a --- /dev/null +++ b/node_modules/pug/test/cases/xml.html @@ -0,0 +1,3 @@ + + +http://google.com \ No newline at end of file diff --git a/node_modules/pug/test/cases/xml.pug b/node_modules/pug/test/cases/xml.pug new file mode 100644 index 0000000..2b21fa4 --- /dev/null +++ b/node_modules/pug/test/cases/xml.pug @@ -0,0 +1,3 @@ +doctype xml +category(term='some term')/ +link http://google.com \ No newline at end of file diff --git a/node_modules/pug/test/cases/yield-before-conditional-head.html b/node_modules/pug/test/cases/yield-before-conditional-head.html new file mode 100644 index 0000000..35ace64 --- /dev/null +++ b/node_modules/pug/test/cases/yield-before-conditional-head.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/yield-before-conditional-head.pug b/node_modules/pug/test/cases/yield-before-conditional-head.pug new file mode 100644 index 0000000..8515406 --- /dev/null +++ b/node_modules/pug/test/cases/yield-before-conditional-head.pug @@ -0,0 +1,5 @@ +head + script(src='/jquery.js') + yield + if false + script(src='/jquery.ui.js') diff --git a/node_modules/pug/test/cases/yield-before-conditional.html b/node_modules/pug/test/cases/yield-before-conditional.html new file mode 100644 index 0000000..7a3f184 --- /dev/null +++ b/node_modules/pug/test/cases/yield-before-conditional.html @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/yield-before-conditional.pug b/node_modules/pug/test/cases/yield-before-conditional.pug new file mode 100644 index 0000000..56b3385 --- /dev/null +++ b/node_modules/pug/test/cases/yield-before-conditional.pug @@ -0,0 +1,5 @@ +html + body + include yield-before-conditional-head.pug + script(src='/caustic.js') + script(src='/app.js') diff --git a/node_modules/pug/test/cases/yield-head.html b/node_modules/pug/test/cases/yield-head.html new file mode 100644 index 0000000..83f92b5 --- /dev/null +++ b/node_modules/pug/test/cases/yield-head.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/yield-head.pug b/node_modules/pug/test/cases/yield-head.pug new file mode 100644 index 0000000..1428be6 --- /dev/null +++ b/node_modules/pug/test/cases/yield-head.pug @@ -0,0 +1,4 @@ +head + script(src='/jquery.js') + yield + script(src='/jquery.ui.js') diff --git a/node_modules/pug/test/cases/yield-title-head.html b/node_modules/pug/test/cases/yield-title-head.html new file mode 100644 index 0000000..ae62c27 --- /dev/null +++ b/node_modules/pug/test/cases/yield-title-head.html @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/yield-title-head.pug b/node_modules/pug/test/cases/yield-title-head.pug new file mode 100644 index 0000000..5ec7d32 --- /dev/null +++ b/node_modules/pug/test/cases/yield-title-head.pug @@ -0,0 +1,5 @@ +head + title + yield + script(src='/jquery.js') + script(src='/jquery.ui.js') diff --git a/node_modules/pug/test/cases/yield-title.html b/node_modules/pug/test/cases/yield-title.html new file mode 100644 index 0000000..83ef1fb --- /dev/null +++ b/node_modules/pug/test/cases/yield-title.html @@ -0,0 +1,9 @@ + + + + My Title + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/yield-title.pug b/node_modules/pug/test/cases/yield-title.pug new file mode 100644 index 0000000..54b5f4d --- /dev/null +++ b/node_modules/pug/test/cases/yield-title.pug @@ -0,0 +1,4 @@ +html + body + include yield-title-head.pug + | My Title diff --git a/node_modules/pug/test/cases/yield.html b/node_modules/pug/test/cases/yield.html new file mode 100644 index 0000000..b16459d --- /dev/null +++ b/node_modules/pug/test/cases/yield.html @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/cases/yield.pug b/node_modules/pug/test/cases/yield.pug new file mode 100644 index 0000000..7579241 --- /dev/null +++ b/node_modules/pug/test/cases/yield.pug @@ -0,0 +1,5 @@ +html + body + include yield-head.pug + script(src='/caustic.js') + script(src='/app.js') diff --git a/node_modules/pug/test/dependencies/dependency1.pug b/node_modules/pug/test/dependencies/dependency1.pug new file mode 100644 index 0000000..5c24ab5 --- /dev/null +++ b/node_modules/pug/test/dependencies/dependency1.pug @@ -0,0 +1 @@ +strong dependency1 diff --git a/node_modules/pug/test/dependencies/dependency2.pug b/node_modules/pug/test/dependencies/dependency2.pug new file mode 100644 index 0000000..76c1170 --- /dev/null +++ b/node_modules/pug/test/dependencies/dependency2.pug @@ -0,0 +1 @@ +include dependency3.pug diff --git a/node_modules/pug/test/dependencies/dependency3.pug b/node_modules/pug/test/dependencies/dependency3.pug new file mode 100644 index 0000000..8cb467c --- /dev/null +++ b/node_modules/pug/test/dependencies/dependency3.pug @@ -0,0 +1 @@ +strong dependency3 diff --git a/node_modules/pug/test/dependencies/extends1.pug b/node_modules/pug/test/dependencies/extends1.pug new file mode 100644 index 0000000..9fe5a9e --- /dev/null +++ b/node_modules/pug/test/dependencies/extends1.pug @@ -0,0 +1 @@ +extends dependency1.pug diff --git a/node_modules/pug/test/dependencies/extends2.pug b/node_modules/pug/test/dependencies/extends2.pug new file mode 100644 index 0000000..802810c --- /dev/null +++ b/node_modules/pug/test/dependencies/extends2.pug @@ -0,0 +1 @@ +extends dependency2.pug diff --git a/node_modules/pug/test/dependencies/include1.pug b/node_modules/pug/test/dependencies/include1.pug new file mode 100644 index 0000000..923e9ea --- /dev/null +++ b/node_modules/pug/test/dependencies/include1.pug @@ -0,0 +1 @@ +include dependency1.pug diff --git a/node_modules/pug/test/dependencies/include2.pug b/node_modules/pug/test/dependencies/include2.pug new file mode 100644 index 0000000..0f93cec --- /dev/null +++ b/node_modules/pug/test/dependencies/include2.pug @@ -0,0 +1 @@ +include dependency2.pug diff --git a/node_modules/pug/test/duplicate-block/__snapshots__/index.test.js.snap b/node_modules/pug/test/duplicate-block/__snapshots__/index.test.js.snap new file mode 100644 index 0000000..3939e1e --- /dev/null +++ b/node_modules/pug/test/duplicate-block/__snapshots__/index.test.js.snap @@ -0,0 +1,3 @@ +exports[`test layout with duplicate block 1`] = `"
    Hello World
    "`; + +exports[`test layout with duplicate block 2`] = `"
    Hello World
    "`; diff --git a/node_modules/pug/test/duplicate-block/index.pug b/node_modules/pug/test/duplicate-block/index.pug new file mode 100644 index 0000000..87a454b --- /dev/null +++ b/node_modules/pug/test/duplicate-block/index.pug @@ -0,0 +1,4 @@ +extends ./layout-with-duplicate-block.pug + +block content + div Hello World diff --git a/node_modules/pug/test/duplicate-block/index.test.js b/node_modules/pug/test/duplicate-block/index.test.js new file mode 100644 index 0000000..9916134 --- /dev/null +++ b/node_modules/pug/test/duplicate-block/index.test.js @@ -0,0 +1,14 @@ +const pug = require('../../'); + +test('layout with duplicate block', () => { + const outputWithAjax = pug.renderFile( + __dirname + '/index.pug', + {ajax: true} + ); + const outputWithoutAjax = pug.renderFile( + __dirname + '/index.pug', + {ajax: false} + ); + expect(outputWithAjax).toMatchSnapshot(); + expect(outputWithoutAjax).toMatchSnapshot(); +}); diff --git a/node_modules/pug/test/duplicate-block/layout-with-duplicate-block.pug b/node_modules/pug/test/duplicate-block/layout-with-duplicate-block.pug new file mode 100644 index 0000000..41f1160 --- /dev/null +++ b/node_modules/pug/test/duplicate-block/layout-with-duplicate-block.pug @@ -0,0 +1,8 @@ +if ajax + block content +else + doctype html + html + head + body + block content diff --git a/node_modules/pug/test/error.reporting.test.js b/node_modules/pug/test/error.reporting.test.js new file mode 100644 index 0000000..dc6dc45 --- /dev/null +++ b/node_modules/pug/test/error.reporting.test.js @@ -0,0 +1,193 @@ + +/** + * Module dependencies. + */ + +var pug = require('../'); +var assert = require('assert'); +var fs = require('fs'); + +// Shortcut + +function getError(str, options){ + try { + pug.render(str, options); + } catch (ex) { + return ex; + } + throw new Error('Input was supposed to result in an error.'); +} +function getFileError(name, options){ + try { + pug.renderFile(name, options); + } catch (ex) { + return ex; + } + throw new Error('Input was supposed to result in an error.'); +} + + +describe('error reporting', function () { + describe('compile time errors', function () { + describe('with no filename', function () { + it('includes detail of where the error was thrown', function () { + var err = getError('foo(') + expect(err.message).toMatch(/Pug:1/); + expect(err.message).toMatch(/foo\(/); + }); + }); + describe('with a filename', function () { + it('includes detail of where the error was thrown including the filename', function () { + var err = getError('foo(', {filename: 'test.pug'}) + expect(err.message).toMatch(/test\.pug:1/); + expect(err.message).toMatch(/foo\(/); + }); + }); + describe('with a layout without block declaration (syntax)', function () { + it('includes detail of where the error was thrown including the filename', function () { + var err = getFileError(__dirname + '/fixtures/compile.with.layout.syntax.error.pug', {}) + expect(err.message).toMatch(/[\\\/]layout.syntax.error.pug:2/); + expect(err.message).toMatch(/foo\(/); + }); + }); + describe('with a layout without block declaration (locals)', function () { + it('includes detail of where the error was thrown including the filename', function () { + var err = getFileError(__dirname + '/fixtures/compile.with.layout.locals.error.pug', {}) + expect(err.message).toMatch(/[\\\/]layout.locals.error.pug:2/); + expect(err.message).toMatch(/is not a function/); + }); + }); + describe('with a include (syntax)', function () { + it('includes detail of where the error was thrown including the filename', function () { + var err = getFileError(__dirname + '/fixtures/compile.with.include.syntax.error.pug', {}) + expect(err.message).toMatch(/[\\\/]include.syntax.error.pug:2/); + expect(err.message).toMatch(/foo\(/); + }); + }); + describe('with a include (locals)', function () { + it('includes detail of where the error was thrown including the filename', function () { + var err = getFileError(__dirname + '/fixtures/compile.with.include.locals.error.pug', {}) + expect(err.message).toMatch(/[\\\/]include.locals.error.pug:2/); + expect(err.message).toMatch(/foo\(/); + }); + }); + describe('with a layout (without block) with an include (syntax)', function () { + it('includes detail of where the error was thrown including the filename', function () { + var err = getFileError(__dirname + '/fixtures/compile.with.layout.with.include.syntax.error.pug', {}) + expect(err.message).toMatch(/[\\\/]include.syntax.error.pug:2/); + expect(err.message).toMatch(/foo\(/); + }); + }); + describe('with a layout (without block) with an include (locals)', function () { + it('includes detail of where the error was thrown including the filename', function () { + var err = getFileError(__dirname + '/fixtures/compile.with.layout.with.include.locals.error.pug', {}) + expect(err.message).toMatch(/[\\\/]include.locals.error.pug:2/); + expect(err.message).toMatch(/foo\(/); + }); + }); + describe('block that is never actually used', function () { + it('includes detail of where the error was thrown including the filename', function () { + var err = getFileError(__dirname + '/fixtures/invalid-block-in-extends.pug', {}); + expect(err.message).toMatch(/invalid-block-in-extends.pug:6/);; + expect(err.message).toMatch(/content/);; + }); + }); + describe('Unexpected character', function () { + it('includes details of where the error was thrown', function () { + var err = getError('ul?', {}); + expect(err.message).toMatch(/unexpected text \"\?\"/); + }); + }); + describe('Include filtered', function () { + it('includes details of where the error was thrown', function () { + var err = getError('include:verbatim()!', {}); + assert(err.message.indexOf('unexpected text "!"') !== -1); + var err = getError('include:verbatim ', {}); + assert(err.message.indexOf('missing path for include') !== -1); + }); + }); + describe('mixin block followed by a lot of blank lines', function () { + it('reports the correct line number', function () { + var err = getError('mixin test\n block\n\ndiv()Test'); + var line = /Pug\:(\d+)/.exec(err.message); + assert(line, 'Line number must be included in error message'); + assert(line[1] === '4', 'The error should be reported on line 4, not line ' + line[1]); + }); + }); + }); + describe('runtime errors', function () { + describe('with no filename and `compileDebug` left undefined', function () { + it('just reports the line number', function () { + var sentinel = new Error('sentinel'); + var err = getError('-foo()', {foo: function () { throw sentinel; }}) + expect(err.message).toMatch(/on line 1/); + }); + }); + describe('with no filename and `compileDebug` set to `true`', function () { + it('includes detail of where the error was thrown', function () { + var sentinel = new Error('sentinel'); + var err = getError('-foo()', {foo: function () { throw sentinel; }, compileDebug: true}) + expect(err.message).toMatch(/Pug:1/); + expect(err.message).toMatch(/-foo\(\)/); + }); + }); + describe('with a filename that does not correspond to a real file and `compileDebug` left undefined', function () { + it('just reports the line number', function () { + var sentinel = new Error('sentinel'); + var err = getError('-foo()', {foo: function () { throw sentinel; }, filename: 'fake.pug'}) + expect(err.message).toMatch(/on line 1/); + }); + }); + describe('with a filename that corresponds to a real file and `compileDebug` left undefined', function () { + it('includes detail of where the error was thrown including the filename', function () { + var sentinel = new Error('sentinel'); + var path = __dirname + '/fixtures/runtime.error.pug' + var err = getError(fs.readFileSync(path, 'utf8'), {foo: function () { throw sentinel; }, filename: path}) + expect(err.message).toMatch(/fixtures[\\\/]runtime\.error\.pug:1/); + expect(err.message).toMatch(/-foo\(\)/); + }); + }); + describe('in a mixin', function () { + it('includes detail of where the error was thrown including the filename', function () { + var err = getFileError(__dirname + '/fixtures/runtime.with.mixin.error.pug', {}) + expect(err.message).toMatch(/mixin.error.pug:2/); + expect(err.message).toMatch(/Cannot read property 'length' of null/); + }); + }); + describe('in a layout', function () { + it('includes detail of where the error was thrown including the filename', function () { + var err = getFileError(__dirname + '/fixtures/runtime.layout.error.pug', {}) + expect(err.message).toMatch(/layout.with.runtime.error.pug:3/); + expect(err.message).toMatch(/Cannot read property 'length' of undefined/); + }); + }); + }); + describe('deprecated features', function () { + it('warns about element-with-multiple-attributes', function () { + var consoleWarn = console.warn; + var log = ''; + console.warn = function (str) { + log += str; + }; + var res = pug.renderFile(__dirname + '/fixtures/element-with-multiple-attributes.pug'); + console.warn = consoleWarn; + expect(log).toMatch(/element-with-multiple-attributes.pug, line 1:/);; + expect(log).toMatch(/You should not have pug tags with multiple attributes/);; + expect(res).toBe('
    '); + }); + }); + describe('if you throw something that isn\'t an error', function () { + it('just rethrows without modification', function () { + var err = getError('- throw "foo"'); + expect(err).toBe('foo'); + }); + }); + describe('import without a filename for a basedir', function () { + it('throws an error', function () { + var err = getError('include foo.pug'); + expect(err.message).toMatch(/the "filename" option is required to use/);; + var err = getError('include /foo.pug'); + expect(err.message).toMatch(/the "basedir" option is required to use/);; + }) + }); +}); diff --git a/node_modules/pug/test/examples.test.js b/node_modules/pug/test/examples.test.js new file mode 100644 index 0000000..0537f8d --- /dev/null +++ b/node_modules/pug/test/examples.test.js @@ -0,0 +1,23 @@ +'use strict'; + +var fs = require('fs'); +var pug = require('../'); + +describe('examples', function () { + fs.readdirSync(__dirname + '/../examples').forEach(function (example) { + if (/\.js$/.test(example)) { + it(example + ' does not throw any error', function () { + var log = console.log; + var err = console.error; + console.log = function () {}; + console.error = function () {}; + try { + require('../examples/' + example); + } finally { + console.log = log; + console.error = err; + } + }); + } + }); +}); diff --git a/node_modules/pug/test/fixtures/append-without-block/app-layout.pug b/node_modules/pug/test/fixtures/append-without-block/app-layout.pug new file mode 100644 index 0000000..1b55872 --- /dev/null +++ b/node_modules/pug/test/fixtures/append-without-block/app-layout.pug @@ -0,0 +1,5 @@ + +extends layout.pug + +append head + script(src='app.js') diff --git a/node_modules/pug/test/fixtures/append-without-block/layout.pug b/node_modules/pug/test/fixtures/append-without-block/layout.pug new file mode 100644 index 0000000..671b3c9 --- /dev/null +++ b/node_modules/pug/test/fixtures/append-without-block/layout.pug @@ -0,0 +1,7 @@ + +html + block head + script(src='vendor/jquery.js') + script(src='vendor/caustic.js') + body + block body \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/append-without-block/page.pug b/node_modules/pug/test/fixtures/append-without-block/page.pug new file mode 100644 index 0000000..e607ae7 --- /dev/null +++ b/node_modules/pug/test/fixtures/append-without-block/page.pug @@ -0,0 +1,6 @@ + +extends app-layout.pug + +append head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug/test/fixtures/append/app-layout.pug b/node_modules/pug/test/fixtures/append/app-layout.pug new file mode 100644 index 0000000..48bf886 --- /dev/null +++ b/node_modules/pug/test/fixtures/append/app-layout.pug @@ -0,0 +1,5 @@ + +extends layout + +block append head + script(src='app.js') \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/append/layout.pug b/node_modules/pug/test/fixtures/append/layout.pug new file mode 100644 index 0000000..671b3c9 --- /dev/null +++ b/node_modules/pug/test/fixtures/append/layout.pug @@ -0,0 +1,7 @@ + +html + block head + script(src='vendor/jquery.js') + script(src='vendor/caustic.js') + body + block body \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/append/page.html b/node_modules/pug/test/fixtures/append/page.html new file mode 100644 index 0000000..bc5e126 --- /dev/null +++ b/node_modules/pug/test/fixtures/append/page.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/node_modules/pug/test/fixtures/append/page.pug b/node_modules/pug/test/fixtures/append/page.pug new file mode 100644 index 0000000..1ae9909 --- /dev/null +++ b/node_modules/pug/test/fixtures/append/page.pug @@ -0,0 +1,6 @@ + +extends app-layout + +block append head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug/test/fixtures/compile.with.include.locals.error.pug b/node_modules/pug/test/fixtures/compile.with.include.locals.error.pug new file mode 100644 index 0000000..0cabc64 --- /dev/null +++ b/node_modules/pug/test/fixtures/compile.with.include.locals.error.pug @@ -0,0 +1 @@ +include include.locals.error.pug \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/compile.with.include.syntax.error.pug b/node_modules/pug/test/fixtures/compile.with.include.syntax.error.pug new file mode 100644 index 0000000..3ab355a --- /dev/null +++ b/node_modules/pug/test/fixtures/compile.with.include.syntax.error.pug @@ -0,0 +1 @@ +include include.syntax.error.pug \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/compile.with.layout.locals.error.pug b/node_modules/pug/test/fixtures/compile.with.layout.locals.error.pug new file mode 100644 index 0000000..d6df843 --- /dev/null +++ b/node_modules/pug/test/fixtures/compile.with.layout.locals.error.pug @@ -0,0 +1 @@ +extends layout.locals.error.pug \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/compile.with.layout.syntax.error.pug b/node_modules/pug/test/fixtures/compile.with.layout.syntax.error.pug new file mode 100644 index 0000000..616d7e8 --- /dev/null +++ b/node_modules/pug/test/fixtures/compile.with.layout.syntax.error.pug @@ -0,0 +1 @@ +extends layout.syntax.error.pug \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/compile.with.layout.with.include.locals.error.pug b/node_modules/pug/test/fixtures/compile.with.layout.with.include.locals.error.pug new file mode 100644 index 0000000..cd5ebb1 --- /dev/null +++ b/node_modules/pug/test/fixtures/compile.with.layout.with.include.locals.error.pug @@ -0,0 +1 @@ +extends compile.with.include.locals.error.pug \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/compile.with.layout.with.include.syntax.error.pug b/node_modules/pug/test/fixtures/compile.with.layout.with.include.syntax.error.pug new file mode 100644 index 0000000..a6221b3 --- /dev/null +++ b/node_modules/pug/test/fixtures/compile.with.layout.with.include.syntax.error.pug @@ -0,0 +1 @@ +extends compile.with.include.syntax.error.pug \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/element-with-multiple-attributes.pug b/node_modules/pug/test/fixtures/element-with-multiple-attributes.pug new file mode 100644 index 0000000..e76f560 --- /dev/null +++ b/node_modules/pug/test/fixtures/element-with-multiple-attributes.pug @@ -0,0 +1 @@ +div(attr='val')(foo='bar') \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/include.locals.error.pug b/node_modules/pug/test/fixtures/include.locals.error.pug new file mode 100644 index 0000000..bd604a9 --- /dev/null +++ b/node_modules/pug/test/fixtures/include.locals.error.pug @@ -0,0 +1,2 @@ + += foo() \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/include.syntax.error.pug b/node_modules/pug/test/fixtures/include.syntax.error.pug new file mode 100644 index 0000000..8b0542a --- /dev/null +++ b/node_modules/pug/test/fixtures/include.syntax.error.pug @@ -0,0 +1,2 @@ + += foo( \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/invalid-block-in-extends.pug b/node_modules/pug/test/fixtures/invalid-block-in-extends.pug new file mode 100644 index 0000000..981321a --- /dev/null +++ b/node_modules/pug/test/fixtures/invalid-block-in-extends.pug @@ -0,0 +1,7 @@ +extends ./layout.pug + +block title + title My Article + +block contents + // oops, that's not a block \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/issue-1593/include-layout.pug b/node_modules/pug/test/fixtures/issue-1593/include-layout.pug new file mode 100644 index 0000000..224225f --- /dev/null +++ b/node_modules/pug/test/fixtures/issue-1593/include-layout.pug @@ -0,0 +1,2 @@ +.included-layout + block include-body diff --git a/node_modules/pug/test/fixtures/issue-1593/include.pug b/node_modules/pug/test/fixtures/issue-1593/include.pug new file mode 100644 index 0000000..2e33e5b --- /dev/null +++ b/node_modules/pug/test/fixtures/issue-1593/include.pug @@ -0,0 +1,4 @@ +extends ./include-layout.pug + +block include-body + .include-body diff --git a/node_modules/pug/test/fixtures/issue-1593/index.pug b/node_modules/pug/test/fixtures/issue-1593/index.pug new file mode 100644 index 0000000..5346ac9 --- /dev/null +++ b/node_modules/pug/test/fixtures/issue-1593/index.pug @@ -0,0 +1,7 @@ +extends ./layout.pug + +block body-a + .body-a +block body-b + .body-b + include ./include.pug diff --git a/node_modules/pug/test/fixtures/issue-1593/layout.pug b/node_modules/pug/test/fixtures/issue-1593/layout.pug new file mode 100644 index 0000000..a235db7 --- /dev/null +++ b/node_modules/pug/test/fixtures/issue-1593/layout.pug @@ -0,0 +1,3 @@ +.layout-body + block body-a + block body-b diff --git a/node_modules/pug/test/fixtures/layout.locals.error.pug b/node_modules/pug/test/fixtures/layout.locals.error.pug new file mode 100644 index 0000000..bd604a9 --- /dev/null +++ b/node_modules/pug/test/fixtures/layout.locals.error.pug @@ -0,0 +1,2 @@ + += foo() \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/layout.pug b/node_modules/pug/test/fixtures/layout.pug new file mode 100644 index 0000000..87518e5 --- /dev/null +++ b/node_modules/pug/test/fixtures/layout.pug @@ -0,0 +1,6 @@ +doctype html +html + head + block title + body + block body \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/layout.syntax.error.pug b/node_modules/pug/test/fixtures/layout.syntax.error.pug new file mode 100644 index 0000000..8b0542a --- /dev/null +++ b/node_modules/pug/test/fixtures/layout.syntax.error.pug @@ -0,0 +1,2 @@ + += foo( \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/layout.with.runtime.error.pug b/node_modules/pug/test/fixtures/layout.with.runtime.error.pug new file mode 100644 index 0000000..73d3a0d --- /dev/null +++ b/node_modules/pug/test/fixtures/layout.with.runtime.error.pug @@ -0,0 +1,5 @@ +html + body + = foo.length + block content + diff --git a/node_modules/pug/test/fixtures/mixin-include.pug b/node_modules/pug/test/fixtures/mixin-include.pug new file mode 100644 index 0000000..491fc70 --- /dev/null +++ b/node_modules/pug/test/fixtures/mixin-include.pug @@ -0,0 +1,5 @@ +mixin bang + +foo + +mixin foo + p bar \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/mixin.error.pug b/node_modules/pug/test/fixtures/mixin.error.pug new file mode 100644 index 0000000..5a4fdf4 --- /dev/null +++ b/node_modules/pug/test/fixtures/mixin.error.pug @@ -0,0 +1,2 @@ +mixin mixin-with-error(foo) + - foo.length diff --git a/node_modules/pug/test/fixtures/multi-append-prepend-block/redefine.pug b/node_modules/pug/test/fixtures/multi-append-prepend-block/redefine.pug new file mode 100644 index 0000000..abc178e --- /dev/null +++ b/node_modules/pug/test/fixtures/multi-append-prepend-block/redefine.pug @@ -0,0 +1,5 @@ +extends root.pug + +block content + .content + | Defined content diff --git a/node_modules/pug/test/fixtures/multi-append-prepend-block/root.pug b/node_modules/pug/test/fixtures/multi-append-prepend-block/root.pug new file mode 100644 index 0000000..8e3334a --- /dev/null +++ b/node_modules/pug/test/fixtures/multi-append-prepend-block/root.pug @@ -0,0 +1,5 @@ +block content + | default content + +block head + script(src='/app.js') \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/perf.pug b/node_modules/pug/test/fixtures/perf.pug new file mode 100644 index 0000000..9aa454b --- /dev/null +++ b/node_modules/pug/test/fixtures/perf.pug @@ -0,0 +1,32 @@ +.data + ol.sortable#contents + each item in report + if (!item.parent) + div + li.chapter(data-ref= item.id) + a(href='/admin/report/detail/' + item.id) + = item.name + - var chp = item.id + ol.sortable + each item in report + if (item.parent === chp && item.type === 'section') + div + li.section(data-ref= item.id) + a(href='/admin/report/detail/' + item.id) + = item.name + - var sec = item.id + ol.sortable + each item in report + if (item.parent === sec && item.type === 'page') + div + li.page(data-ref= item.id) + a(href='/admin/report/detail/' + item.id) + = item.name + - var page = item.id + ol.sortable + each item in report + if (item.parent === page && item.type === 'subpage') + div + li.subpage(data-ref= item.id) + a(href='/admin/report/detail/' + item.id) + = item.name \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/prepend-without-block/app-layout.pug b/node_modules/pug/test/fixtures/prepend-without-block/app-layout.pug new file mode 100644 index 0000000..53f89ba --- /dev/null +++ b/node_modules/pug/test/fixtures/prepend-without-block/app-layout.pug @@ -0,0 +1,5 @@ + +extends layout.pug + +prepend head + script(src='app.js') diff --git a/node_modules/pug/test/fixtures/prepend-without-block/layout.pug b/node_modules/pug/test/fixtures/prepend-without-block/layout.pug new file mode 100644 index 0000000..671b3c9 --- /dev/null +++ b/node_modules/pug/test/fixtures/prepend-without-block/layout.pug @@ -0,0 +1,7 @@ + +html + block head + script(src='vendor/jquery.js') + script(src='vendor/caustic.js') + body + block body \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/prepend-without-block/page.html b/node_modules/pug/test/fixtures/prepend-without-block/page.html new file mode 100644 index 0000000..8753a42 --- /dev/null +++ b/node_modules/pug/test/fixtures/prepend-without-block/page.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/node_modules/pug/test/fixtures/prepend-without-block/page.pug b/node_modules/pug/test/fixtures/prepend-without-block/page.pug new file mode 100644 index 0000000..6b9bb01 --- /dev/null +++ b/node_modules/pug/test/fixtures/prepend-without-block/page.pug @@ -0,0 +1,6 @@ + +extends app-layout.pug + +prepend head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug/test/fixtures/prepend/app-layout.pug b/node_modules/pug/test/fixtures/prepend/app-layout.pug new file mode 100644 index 0000000..7040eec --- /dev/null +++ b/node_modules/pug/test/fixtures/prepend/app-layout.pug @@ -0,0 +1,5 @@ + +extends layout.pug + +block prepend head + script(src='app.js') diff --git a/node_modules/pug/test/fixtures/prepend/layout.pug b/node_modules/pug/test/fixtures/prepend/layout.pug new file mode 100644 index 0000000..671b3c9 --- /dev/null +++ b/node_modules/pug/test/fixtures/prepend/layout.pug @@ -0,0 +1,7 @@ + +html + block head + script(src='vendor/jquery.js') + script(src='vendor/caustic.js') + body + block body \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/prepend/page.html b/node_modules/pug/test/fixtures/prepend/page.html new file mode 100644 index 0000000..8753a42 --- /dev/null +++ b/node_modules/pug/test/fixtures/prepend/page.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/node_modules/pug/test/fixtures/prepend/page.pug b/node_modules/pug/test/fixtures/prepend/page.pug new file mode 100644 index 0000000..c2a91c9 --- /dev/null +++ b/node_modules/pug/test/fixtures/prepend/page.pug @@ -0,0 +1,6 @@ + +extends app-layout.pug + +block prepend head + script(src='foo.js') + script(src='bar.js') diff --git a/node_modules/pug/test/fixtures/runtime.error.pug b/node_modules/pug/test/fixtures/runtime.error.pug new file mode 100644 index 0000000..27794a4 --- /dev/null +++ b/node_modules/pug/test/fixtures/runtime.error.pug @@ -0,0 +1 @@ +-foo() \ No newline at end of file diff --git a/node_modules/pug/test/fixtures/runtime.layout.error.pug b/node_modules/pug/test/fixtures/runtime.layout.error.pug new file mode 100644 index 0000000..fc66a78 --- /dev/null +++ b/node_modules/pug/test/fixtures/runtime.layout.error.pug @@ -0,0 +1,3 @@ +extends layout.with.runtime.error.pug +block content + | some content diff --git a/node_modules/pug/test/fixtures/runtime.with.mixin.error.pug b/node_modules/pug/test/fixtures/runtime.with.mixin.error.pug new file mode 100644 index 0000000..4226433 --- /dev/null +++ b/node_modules/pug/test/fixtures/runtime.with.mixin.error.pug @@ -0,0 +1,3 @@ +include mixin.error.pug + ++mixin-with-error(null) diff --git a/node_modules/pug/test/fixtures/scripts.pug b/node_modules/pug/test/fixtures/scripts.pug new file mode 100644 index 0000000..30fabcf --- /dev/null +++ b/node_modules/pug/test/fixtures/scripts.pug @@ -0,0 +1,2 @@ +script(src='/jquery.js') +script(src='/caustic.js') \ No newline at end of file diff --git a/node_modules/pug/test/output-es2015/attr.html b/node_modules/pug/test/output-es2015/attr.html new file mode 100644 index 0000000..25c479a --- /dev/null +++ b/node_modules/pug/test/output-es2015/attr.html @@ -0,0 +1,2 @@ + +
    \ No newline at end of file diff --git a/node_modules/pug/test/output-es2015/attr.js b/node_modules/pug/test/output-es2015/attr.js new file mode 100644 index 0000000..01fd10c --- /dev/null +++ b/node_modules/pug/test/output-es2015/attr.js @@ -0,0 +1,56 @@ +function pug_attr(t, e, n, f) { + return e !== !1 && null != e && (e || "class" !== t && "style" !== t) ? e === !0 ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()), + "string" == typeof e || (e = JSON.stringify(e), n || e.indexOf('"') === -1) ? (n && (e = pug_escape(e)), + " " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "'") + "'") : ""; +} + +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_has_own_property = Object.prototype.hasOwnProperty; + +var pug_match_html = /["&<>]/; + +function pug_style(r) { + if (!r) return ""; + if ("object" == typeof r) { + var t = ""; + for (var e in r) pug_has_own_property.call(r, e) && (t = t + e + ":" + r[e] + ";"); + return t; + } + return r += "", ";" !== r[r.length - 1] ? r + ";" : r; +} + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + var avatar = "219b77f9d21de75e81851b6b886057c7"; + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/attrs-data.html b/node_modules/pug/test/output/attrs-data.html new file mode 100644 index 0000000..58f1406 --- /dev/null +++ b/node_modules/pug/test/output/attrs-data.html @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/attrs-data.js b/node_modules/pug/test/output/attrs-data.js new file mode 100644 index 0000000..53d10c8 --- /dev/null +++ b/node_modules/pug/test/output/attrs-data.js @@ -0,0 +1,49 @@ +function pug_attr(t, e, n, f) { + return e !== !1 && null != e && (e || "class" !== t && "style" !== t) ? e === !0 ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()), + "string" == typeof e || (e = JSON.stringify(e), n || e.indexOf('"') === -1) ? (n && (e = pug_escape(e)), + " " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "'") + "'") : ""; +} + +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + var locals_for_with = locals || {}; + (function(Date) { + var user = { + name: "tobi" + }; + pug_html = pug_html + "
    "; + }).call(this, "Date" in locals_for_with ? locals_for_with.Date : typeof Date !== "undefined" ? Date : undefined); + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/attrs.html b/node_modules/pug/test/output/attrs.html new file mode 100644 index 0000000..132626c --- /dev/null +++ b/node_modules/pug/test/output/attrs.html @@ -0,0 +1,20 @@ +contactsave + +contactsave + + + + + + + + + + +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/attrs.js b/node_modules/pug/test/output/attrs.js new file mode 100644 index 0000000..297be28 --- /dev/null +++ b/node_modules/pug/test/output/attrs.js @@ -0,0 +1,93 @@ +function pug_attr(t, e, n, f) { + return e !== !1 && null != e && (e || "class" !== t && "style" !== t) ? e === !0 ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()), + "string" == typeof e || (e = JSON.stringify(e), n || e.indexOf('"') === -1) ? (n && (e = pug_escape(e)), + " " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "'") + "'") : ""; +} + +function pug_attrs(t, r) { + var a = ""; + for (var s in t) if (pug_has_own_property.call(t, s)) { + var u = t[s]; + if ("class" === s) { + u = pug_classes(u), a = pug_attr(s, u, !1, r) + a; + continue; + } + "style" === s && (u = pug_style(u)), a += pug_attr(s, u, !1, r); + } + return a; +} + +function pug_classes(s, r) { + return Array.isArray(s) ? pug_classes_array(s, r) : s && "object" == typeof s ? pug_classes_object(s) : s || ""; +} + +function pug_classes_array(r, a) { + for (var s, e = "", u = "", c = Array.isArray(a), g = 0; g < r.length; g++) s = pug_classes(r[g]), + s && (c && a[g] && (s = pug_escape(s)), e = e + u + s, u = " "); + return e; +} + +function pug_classes_object(r) { + var a = "", n = ""; + for (var o in r) o && r[o] && pug_has_own_property.call(r, o) && (a = a + n + o, + n = " "); + return a; +} + +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_has_own_property = Object.prototype.hasOwnProperty; + +var pug_match_html = /["&<>]/; + +function pug_style(r) { + if (!r) return ""; + if ("object" == typeof r) { + var t = ""; + for (var e in r) pug_has_own_property.call(r, e) && (t = t + e + ":" + r[e] + ";"); + return t; + } + return r += "", ";" !== r[r.length - 1] ? r + ";" : r; +} + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + var locals_for_with = locals || {}; + (function(Date) { + pug_html = pug_html + 'contactsavecontactsave
    '; + var attrs = { + foo: "bar", + bar: "" + }; + pug_html = pug_html + "'; + }).call(this, "Date" in locals_for_with ? locals_for_with.Date : typeof Date !== "undefined" ? Date : undefined); + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/attrs.js.html b/node_modules/pug/test/output/attrs.js.html new file mode 100644 index 0000000..edd3813 --- /dev/null +++ b/node_modules/pug/test/output/attrs.js.html @@ -0,0 +1,5 @@ + + + +
    +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/attrs.js.js b/node_modules/pug/test/output/attrs.js.js new file mode 100644 index 0000000..11901f2 --- /dev/null +++ b/node_modules/pug/test/output/attrs.js.js @@ -0,0 +1,115 @@ +function pug_attr(t, e, n, f) { + return e !== !1 && null != e && (e || "class" !== t && "style" !== t) ? e === !0 ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()), + "string" == typeof e || (e = JSON.stringify(e), n || e.indexOf('"') === -1) ? (n && (e = pug_escape(e)), + " " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "'") + "'") : ""; +} + +function pug_attrs(t, r) { + var a = ""; + for (var s in t) if (pug_has_own_property.call(t, s)) { + var u = t[s]; + if ("class" === s) { + u = pug_classes(u), a = pug_attr(s, u, !1, r) + a; + continue; + } + "style" === s && (u = pug_style(u)), a += pug_attr(s, u, !1, r); + } + return a; +} + +function pug_classes(s, r) { + return Array.isArray(s) ? pug_classes_array(s, r) : s && "object" == typeof s ? pug_classes_object(s) : s || ""; +} + +function pug_classes_array(r, a) { + for (var s, e = "", u = "", c = Array.isArray(a), g = 0; g < r.length; g++) s = pug_classes(r[g]), + s && (c && a[g] && (s = pug_escape(s)), e = e + u + s, u = " "); + return e; +} + +function pug_classes_object(r) { + var a = "", n = ""; + for (var o in r) o && r[o] && pug_has_own_property.call(r, o) && (a = a + n + o, + n = " "); + return a; +} + +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_has_own_property = Object.prototype.hasOwnProperty; + +var pug_match_html = /["&<>]/; + +function pug_merge(r, e) { + if (1 === arguments.length) { + for (var t = r[0], a = 1; a < r.length; a++) t = pug_merge(t, r[a]); + return t; + } + for (var g in e) if ("class" === g) { + var l = r[g] || []; + r[g] = (Array.isArray(l) ? l : [ l ]).concat(e[g] || []); + } else if ("style" === g) { + var l = pug_style(r[g]), n = pug_style(e[g]); + r[g] = l + n; + } else r[g] = e[g]; + return r; +} + +function pug_style(r) { + if (!r) return ""; + if ("object" == typeof r) { + var t = ""; + for (var e in r) pug_has_own_property.call(r, e) && (t = t + e + ":" + r[e] + ";"); + return t; + } + return r += "", ";" !== r[r.length - 1] ? r + ";" : r; +} + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + var id = 5; + function answer() { + return 42; + } + pug_html = pug_html + ""; + var bar = null; + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/attrs.unescaped.html b/node_modules/pug/test/output/attrs.unescaped.html new file mode 100644 index 0000000..ec71806 --- /dev/null +++ b/node_modules/pug/test/output/attrs.unescaped.html @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/node_modules/pug/test/output/attrs.unescaped.js b/node_modules/pug/test/output/attrs.unescaped.js new file mode 100644 index 0000000..402574d --- /dev/null +++ b/node_modules/pug/test/output/attrs.unescaped.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/basic.html b/node_modules/pug/test/output/basic.html new file mode 100644 index 0000000..15b6870 --- /dev/null +++ b/node_modules/pug/test/output/basic.html @@ -0,0 +1,6 @@ + + + +

    Title

    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/basic.js b/node_modules/pug/test/output/basic.js new file mode 100644 index 0000000..e8d0dd2 --- /dev/null +++ b/node_modules/pug/test/output/basic.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "

    Title

    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/blanks.html b/node_modules/pug/test/output/blanks.html new file mode 100644 index 0000000..53f3b8c --- /dev/null +++ b/node_modules/pug/test/output/blanks.html @@ -0,0 +1,6 @@ + +
      +
    • foo
    • +
    • bar
    • +
    • baz
    • +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/blanks.js b/node_modules/pug/test/output/blanks.js new file mode 100644 index 0000000..aa197b8 --- /dev/null +++ b/node_modules/pug/test/output/blanks.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "
    • foo
    • bar
    • baz
    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/block-code.html b/node_modules/pug/test/output/block-code.html new file mode 100644 index 0000000..26c9cff --- /dev/null +++ b/node_modules/pug/test/output/block-code.html @@ -0,0 +1,7 @@ + +
  • Uno
  • +
  • Dos
  • +
  • Tres
  • +
  • Cuatro
  • +
  • Cinco
  • +
  • Seis
  • \ No newline at end of file diff --git a/node_modules/pug/test/output/block-code.js b/node_modules/pug/test/output/block-code.js new file mode 100644 index 0000000..b736246 --- /dev/null +++ b/node_modules/pug/test/output/block-code.js @@ -0,0 +1,58 @@ +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + var locals_for_with = locals || {}; + (function(list, string) { + list = [ "uno", "dos", "tres", "cuatro", "cinco", "seis" ]; + (function() { + var $$obj = list; + if ("number" == typeof $$obj.length) { + for (var pug_index0 = 0, $$l = $$obj.length; pug_index0 < $$l; pug_index0++) { + var item = $$obj[pug_index0]; + string = item.charAt(0).toUpperCase() + item.slice(1); + pug_html = pug_html + "
  • " + pug_escape(null == (pug_interp = string) ? "" : pug_interp) + "
  • "; + } + } else { + var $$l = 0; + for (var pug_index0 in $$obj) { + $$l++; + var item = $$obj[pug_index0]; + string = item.charAt(0).toUpperCase() + item.slice(1); + pug_html = pug_html + "
  • " + pug_escape(null == (pug_interp = string) ? "" : pug_interp) + "
  • "; + } + } + }).call(this); + }).call(this, "list" in locals_for_with ? locals_for_with.list : typeof list !== "undefined" ? list : undefined, "string" in locals_for_with ? locals_for_with.string : typeof string !== "undefined" ? string : undefined); + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/block-expansion.html b/node_modules/pug/test/output/block-expansion.html new file mode 100644 index 0000000..b76d93d --- /dev/null +++ b/node_modules/pug/test/output/block-expansion.html @@ -0,0 +1,6 @@ + + +

    baz

    \ No newline at end of file diff --git a/node_modules/pug/test/output/block-expansion.js b/node_modules/pug/test/output/block-expansion.js new file mode 100644 index 0000000..001e436 --- /dev/null +++ b/node_modules/pug/test/output/block-expansion.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + '

    baz

    '; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/block-expansion.shorthands.html b/node_modules/pug/test/output/block-expansion.shorthands.html new file mode 100644 index 0000000..931d774 --- /dev/null +++ b/node_modules/pug/test/output/block-expansion.shorthands.html @@ -0,0 +1,8 @@ + +
      +
    • +
      +
      baz
      +
      +
    • +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/block-expansion.shorthands.js b/node_modules/pug/test/output/block-expansion.shorthands.js new file mode 100644 index 0000000..4a294a1 --- /dev/null +++ b/node_modules/pug/test/output/block-expansion.shorthands.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + '
    • baz
    '; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/blockquote.html b/node_modules/pug/test/output/blockquote.html new file mode 100644 index 0000000..0e1777d --- /dev/null +++ b/node_modules/pug/test/output/blockquote.html @@ -0,0 +1,5 @@ + +
    +
    Try to define yourself by what you do, and you’ll burnout every time. You are. That is enough. I rest in that.
    +
    from @thefray at 1:43pm on May 10
    +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/blockquote.js b/node_modules/pug/test/output/blockquote.js new file mode 100644 index 0000000..9a591d9 --- /dev/null +++ b/node_modules/pug/test/output/blockquote.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "
    Try to define yourself by what you do, and you’ll burnout every time. You are. That is enough. I rest in that.
    from @thefray at 1:43pm on May 10
    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/blocks-in-blocks.html b/node_modules/pug/test/output/blocks-in-blocks.html new file mode 100644 index 0000000..688d9c2 --- /dev/null +++ b/node_modules/pug/test/output/blocks-in-blocks.html @@ -0,0 +1,9 @@ + + + + Default title + + +

    Page 2

    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/blocks-in-blocks.js b/node_modules/pug/test/output/blocks-in-blocks.js new file mode 100644 index 0000000..eaa2b98 --- /dev/null +++ b/node_modules/pug/test/output/blocks-in-blocks.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "Default title

    Page 2

    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/blocks-in-if.html b/node_modules/pug/test/output/blocks-in-if.html new file mode 100644 index 0000000..ecdd6db --- /dev/null +++ b/node_modules/pug/test/output/blocks-in-if.html @@ -0,0 +1,2 @@ + +

    ajax contents

    \ No newline at end of file diff --git a/node_modules/pug/test/output/blocks-in-if.js b/node_modules/pug/test/output/blocks-in-if.js new file mode 100644 index 0000000..7e13fa9 --- /dev/null +++ b/node_modules/pug/test/output/blocks-in-if.js @@ -0,0 +1,10 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + var ajax = true; + if (ajax) { + pug_html = pug_html + "

    ajax contents

    "; + } else { + pug_html = pug_html + 'sample

    all contetns

    '; + } + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/case-blocks.html b/node_modules/pug/test/output/case-blocks.html new file mode 100644 index 0000000..44eb479 --- /dev/null +++ b/node_modules/pug/test/output/case-blocks.html @@ -0,0 +1,6 @@ + + + +

    you have a friend

    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/case-blocks.js b/node_modules/pug/test/output/case-blocks.js new file mode 100644 index 0000000..8d5cddf --- /dev/null +++ b/node_modules/pug/test/output/case-blocks.js @@ -0,0 +1,52 @@ +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ""; + var friends = 1; + switch (friends) { + case 0: + pug_html = pug_html + "

    you have no friends

    "; + break; + + case 1: + pug_html = pug_html + "

    you have a friend

    "; + break; + + default: + pug_html = pug_html + "

    you have " + pug_escape(null == (pug_interp = friends) ? "" : pug_interp) + " friends

    "; + break; + } + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/case.html b/node_modules/pug/test/output/case.html new file mode 100644 index 0000000..f264fb7 --- /dev/null +++ b/node_modules/pug/test/output/case.html @@ -0,0 +1,8 @@ + + + +

    you have a friend

    +

    you have very few friends

    +

    Friend is a string

    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/case.js b/node_modules/pug/test/output/case.js new file mode 100644 index 0000000..7d0b028 --- /dev/null +++ b/node_modules/pug/test/output/case.js @@ -0,0 +1,75 @@ +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ""; + var friends = 1; + switch (friends) { + case 0: + pug_html = pug_html + "

    you have no friends

    "; + break; + + case 1: + pug_html = pug_html + "

    you have a friend

    "; + break; + + default: + pug_html = pug_html + "

    you have " + pug_escape(null == (pug_interp = friends) ? "" : pug_interp) + " friends

    "; + break; + } + var friends = 0; + switch (friends) { + case 0: + case 1: + pug_html = pug_html + "

    you have very few friends

    "; + break; + + default: + pug_html = pug_html + "

    you have " + pug_escape(null == (pug_interp = friends) ? "" : pug_interp) + " friends

    "; + break; + } + var friend = "Tim:G"; + switch (friend) { + case "Tim:G": + pug_html = pug_html + "

    Friend is a string

    "; + break; + + case { + tim: "g" + }: + pug_html = pug_html + "

    Friend is an object

    "; + break; + } + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/classes-empty.html b/node_modules/pug/test/output/classes-empty.html new file mode 100644 index 0000000..bcc28a9 --- /dev/null +++ b/node_modules/pug/test/output/classes-empty.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/node_modules/pug/test/output/classes-empty.js b/node_modules/pug/test/output/classes-empty.js new file mode 100644 index 0000000..6d51722 --- /dev/null +++ b/node_modules/pug/test/output/classes-empty.js @@ -0,0 +1,62 @@ +function pug_attr(t, e, n, f) { + return e !== !1 && null != e && (e || "class" !== t && "style" !== t) ? e === !0 ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()), + "string" == typeof e || (e = JSON.stringify(e), n || e.indexOf('"') === -1) ? (n && (e = pug_escape(e)), + " " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "'") + "'") : ""; +} + +function pug_classes(s, r) { + return Array.isArray(s) ? pug_classes_array(s, r) : s && "object" == typeof s ? pug_classes_object(s) : s || ""; +} + +function pug_classes_array(r, a) { + for (var s, e = "", u = "", c = Array.isArray(a), g = 0; g < r.length; g++) s = pug_classes(r[g]), + s && (c && a[g] && (s = pug_escape(s)), e = e + u + s, u = " "); + return e; +} + +function pug_classes_object(r) { + var a = "", n = ""; + for (var o in r) o && r[o] && pug_has_own_property.call(r, o) && (a = a + n + o, + n = " "); + return a; +} + +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_has_own_property = Object.prototype.hasOwnProperty; + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/classes.html b/node_modules/pug/test/output/classes.html new file mode 100644 index 0000000..21cfa19 --- /dev/null +++ b/node_modules/pug/test/output/classes.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/node_modules/pug/test/output/classes.js b/node_modules/pug/test/output/classes.js new file mode 100644 index 0000000..a25495c --- /dev/null +++ b/node_modules/pug/test/output/classes.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/code.conditionals.html b/node_modules/pug/test/output/code.conditionals.html new file mode 100644 index 0000000..1d7bf13 --- /dev/null +++ b/node_modules/pug/test/output/code.conditionals.html @@ -0,0 +1,12 @@ + +

    foo

    +

    foo

    +

    foo

    +

    bar

    +

    baz

    +

    bar

    +

    yay

    +
    +
    +
    +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/code.conditionals.js b/node_modules/pug/test/output/code.conditionals.js new file mode 100644 index 0000000..3a26b76 --- /dev/null +++ b/node_modules/pug/test/output/code.conditionals.js @@ -0,0 +1,47 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + if (true) { + pug_html = pug_html + "

    foo

    "; + } else { + pug_html = pug_html + "

    bar

    "; + } + if (true) { + { + pug_html = pug_html + "

    foo

    "; + } + } else { + { + pug_html = pug_html + "

    bar

    "; + } + } + if (true) { + pug_html = pug_html + "

    foo

    bar

    baz

    "; + } else { + pug_html = pug_html + "

    bar

    "; + } + if (!true) { + pug_html = pug_html + "

    foo

    "; + } else { + pug_html = pug_html + "

    bar

    "; + } + if ("nested") { + if ("works") { + pug_html = pug_html + "

    yay

    "; + } + } + if (false) {} else { + pug_html = pug_html + '
    '; + } + if (true) { + pug_html = pug_html + '
    '; + } + pug_html = pug_html + '
    '; + if (false) { + pug_html = pug_html + '
    '; + } else if (false) { + pug_html = pug_html + '
    '; + } else { + pug_html = pug_html + '
    '; + } + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/code.escape.html b/node_modules/pug/test/output/code.escape.html new file mode 100644 index 0000000..9c18eba --- /dev/null +++ b/node_modules/pug/test/output/code.escape.html @@ -0,0 +1,3 @@ + +

    <script>

    +

    \ No newline at end of file diff --git a/node_modules/pug/test/output/escape-chars.js b/node_modules/pug/test/output/escape-chars.js new file mode 100644 index 0000000..1e451ef --- /dev/null +++ b/node_modules/pug/test/output/escape-chars.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/escape-test.html b/node_modules/pug/test/output/escape-test.html new file mode 100644 index 0000000..073134a --- /dev/null +++ b/node_modules/pug/test/output/escape-test.html @@ -0,0 +1,9 @@ + + + + escape-test + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/escape-test.js b/node_modules/pug/test/output/escape-test.js new file mode 100644 index 0000000..ae6ae07 --- /dev/null +++ b/node_modules/pug/test/output/escape-test.js @@ -0,0 +1,39 @@ +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "escape-test"; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/escaping-class-attribute.html b/node_modules/pug/test/output/escaping-class-attribute.html new file mode 100644 index 0000000..c5a9626 --- /dev/null +++ b/node_modules/pug/test/output/escaping-class-attribute.html @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/escaping-class-attribute.js b/node_modules/pug/test/output/escaping-class-attribute.js new file mode 100644 index 0000000..caa2c17 --- /dev/null +++ b/node_modules/pug/test/output/escaping-class-attribute.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/filter-in-include.html b/node_modules/pug/test/output/filter-in-include.html new file mode 100644 index 0000000..244143f --- /dev/null +++ b/node_modules/pug/test/output/filter-in-include.html @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/filter-in-include.js b/node_modules/pug/test/output/filter-in-include.js new file mode 100644 index 0000000..efb380f --- /dev/null +++ b/node_modules/pug/test/output/filter-in-include.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/filters-empty.html b/node_modules/pug/test/output/filters-empty.html new file mode 100644 index 0000000..8b919e0 --- /dev/null +++ b/node_modules/pug/test/output/filters-empty.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/filters-empty.js b/node_modules/pug/test/output/filters-empty.js new file mode 100644 index 0000000..b3bef8f --- /dev/null +++ b/node_modules/pug/test/output/filters-empty.js @@ -0,0 +1,64 @@ +function pug_attr(t, e, n, f) { + return e !== !1 && null != e && (e || "class" !== t && "style" !== t) ? e === !0 ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()), + "string" == typeof e || (e = JSON.stringify(e), n || e.indexOf('"') === -1) ? (n && (e = pug_escape(e)), + " " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "'") + "'") : ""; +} + +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + var users = [ { + name: "tobi", + age: 2 + } ]; + pug_html = pug_html + ""; + (function() { + var $$obj = users; + if ("number" == typeof $$obj.length) { + for (var pug_index0 = 0, $$l = $$obj.length; pug_index0 < $$l; pug_index0++) { + var user = $$obj[pug_index0]; + pug_html = pug_html + ""; + } + } else { + var $$l = 0; + for (var pug_index0 in $$obj) { + $$l++; + var user = $$obj[pug_index0]; + pug_html = pug_html + ""; + } + } + }).call(this); + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.coffeescript.html b/node_modules/pug/test/output/filters.coffeescript.html new file mode 100644 index 0000000..ea689fa --- /dev/null +++ b/node_modules/pug/test/output/filters.coffeescript.html @@ -0,0 +1,10 @@ + + \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.coffeescript.js b/node_modules/pug/test/output/filters.coffeescript.js new file mode 100644 index 0000000..4321bec --- /dev/null +++ b/node_modules/pug/test/output/filters.coffeescript.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.custom.html b/node_modules/pug/test/output/filters.custom.html new file mode 100644 index 0000000..811701c --- /dev/null +++ b/node_modules/pug/test/output/filters.custom.html @@ -0,0 +1,8 @@ + + + BEGINLine 1 +Line 2 + +Line 4END + + \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.custom.js b/node_modules/pug/test/output/filters.custom.js new file mode 100644 index 0000000..ba8307f --- /dev/null +++ b/node_modules/pug/test/output/filters.custom.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "BEGINLine 1\nLine 2\n\nLine 4END"; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.include.custom.html b/node_modules/pug/test/output/filters.include.custom.html new file mode 100644 index 0000000..dee2b25 --- /dev/null +++ b/node_modules/pug/test/output/filters.include.custom.html @@ -0,0 +1,10 @@ + + + +

    BEGINhtml
    +  body
    +    pre
    +      include:custom(opt='val' num=2) filters.include.custom.pug
    +END
    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.include.custom.js b/node_modules/pug/test/output/filters.include.custom.js new file mode 100644 index 0000000..a029438 --- /dev/null +++ b/node_modules/pug/test/output/filters.include.custom.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "
    BEGINhtml\n  body\n    pre\n      include:custom(opt='val' num=2) filters.include.custom.pug\nEND
    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.include.html b/node_modules/pug/test/output/filters.include.html new file mode 100644 index 0000000..fe0e38c --- /dev/null +++ b/node_modules/pug/test/output/filters.include.html @@ -0,0 +1,20 @@ + + +

    Just some markdown tests.

    +

    With new line.

    + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.include.js b/node_modules/pug/test/output/filters.include.js new file mode 100644 index 0000000..a7a2ea0 --- /dev/null +++ b/node_modules/pug/test/output/filters.include.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "

    Just some markdown tests.

    \n

    With new line.

    \n"; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.inline.html b/node_modules/pug/test/output/filters.inline.html new file mode 100644 index 0000000..e602ebd --- /dev/null +++ b/node_modules/pug/test/output/filters.inline.html @@ -0,0 +1,3 @@ + +

    + before after

    \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.inline.js b/node_modules/pug/test/output/filters.inline.js new file mode 100644 index 0000000..657f16c --- /dev/null +++ b/node_modules/pug/test/output/filters.inline.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "

    before after

    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.less.html b/node_modules/pug/test/output/filters.less.html new file mode 100644 index 0000000..244143f --- /dev/null +++ b/node_modules/pug/test/output/filters.less.html @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.less.js b/node_modules/pug/test/output/filters.less.js new file mode 100644 index 0000000..efb380f --- /dev/null +++ b/node_modules/pug/test/output/filters.less.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.markdown.html b/node_modules/pug/test/output/filters.markdown.html new file mode 100644 index 0000000..0760aef --- /dev/null +++ b/node_modules/pug/test/output/filters.markdown.html @@ -0,0 +1,7 @@ + + +

    This is some awesome markdown +whoop.

    + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.markdown.js b/node_modules/pug/test/output/filters.markdown.js new file mode 100644 index 0000000..4ba6843 --- /dev/null +++ b/node_modules/pug/test/output/filters.markdown.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "

    This is some awesome markdown\nwhoop.

    \n"; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.nested.html b/node_modules/pug/test/output/filters.nested.html new file mode 100644 index 0000000..67f31e3 --- /dev/null +++ b/node_modules/pug/test/output/filters.nested.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.nested.js b/node_modules/pug/test/output/filters.nested.js new file mode 100644 index 0000000..a8c0012 --- /dev/null +++ b/node_modules/pug/test/output/filters.nested.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.stylus.html b/node_modules/pug/test/output/filters.stylus.html new file mode 100644 index 0000000..747ce61 --- /dev/null +++ b/node_modules/pug/test/output/filters.stylus.html @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/filters.stylus.js b/node_modules/pug/test/output/filters.stylus.js new file mode 100644 index 0000000..b0c7c92 --- /dev/null +++ b/node_modules/pug/test/output/filters.stylus.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/html.html b/node_modules/pug/test/output/html.html new file mode 100644 index 0000000..a038efd --- /dev/null +++ b/node_modules/pug/test/output/html.html @@ -0,0 +1,9 @@ +
      +
    • foo
    • +
    • bar
    • +
    • baz
    • +
    + + +

    You can embed html as well.

    +

    Even as the body of a block expansion.

    \ No newline at end of file diff --git a/node_modules/pug/test/output/html.js b/node_modules/pug/test/output/html.js new file mode 100644 index 0000000..12a2fd2 --- /dev/null +++ b/node_modules/pug/test/output/html.js @@ -0,0 +1,38 @@ +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + var version = 1449104952939; + pug_html = pug_html + "
      \n
    • foo
    • \n
    • bar
    • \n
    • baz
    • \n
    \n\n

    You can embed html as well.

    Even as the body of a block expansion.

    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/html5.html b/node_modules/pug/test/output/html5.html new file mode 100644 index 0000000..83a553a --- /dev/null +++ b/node_modules/pug/test/output/html5.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/html5.js b/node_modules/pug/test/output/html5.js new file mode 100644 index 0000000..1f63d39 --- /dev/null +++ b/node_modules/pug/test/output/html5.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/include-extends-from-root.html b/node_modules/pug/test/output/include-extends-from-root.html new file mode 100644 index 0000000..3cef66e --- /dev/null +++ b/node_modules/pug/test/output/include-extends-from-root.html @@ -0,0 +1,9 @@ + + + + My Application + + +

    hello

    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/include-extends-from-root.js b/node_modules/pug/test/output/include-extends-from-root.js new file mode 100644 index 0000000..76568c9 --- /dev/null +++ b/node_modules/pug/test/output/include-extends-from-root.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "My Application

    hello

    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/include-extends-of-common-template.html b/node_modules/pug/test/output/include-extends-of-common-template.html new file mode 100644 index 0000000..1fef4be --- /dev/null +++ b/node_modules/pug/test/output/include-extends-of-common-template.html @@ -0,0 +1,3 @@ + +
    test1
    +
    test2
    \ No newline at end of file diff --git a/node_modules/pug/test/output/include-extends-of-common-template.js b/node_modules/pug/test/output/include-extends-of-common-template.js new file mode 100644 index 0000000..c54ecc4 --- /dev/null +++ b/node_modules/pug/test/output/include-extends-of-common-template.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "
    test1
    test2
    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/include-extends-relative.html b/node_modules/pug/test/output/include-extends-relative.html new file mode 100644 index 0000000..3cef66e --- /dev/null +++ b/node_modules/pug/test/output/include-extends-relative.html @@ -0,0 +1,9 @@ + + + + My Application + + +

    hello

    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/include-extends-relative.js b/node_modules/pug/test/output/include-extends-relative.js new file mode 100644 index 0000000..76568c9 --- /dev/null +++ b/node_modules/pug/test/output/include-extends-relative.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "My Application

    hello

    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/include-only-text-body.html b/node_modules/pug/test/output/include-only-text-body.html new file mode 100644 index 0000000..f86b593 --- /dev/null +++ b/node_modules/pug/test/output/include-only-text-body.html @@ -0,0 +1 @@ +The message is "" \ No newline at end of file diff --git a/node_modules/pug/test/output/include-only-text-body.js b/node_modules/pug/test/output/include-only-text-body.js new file mode 100644 index 0000000..add0fa4 --- /dev/null +++ b/node_modules/pug/test/output/include-only-text-body.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + 'The message is ""'; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/include-only-text.html b/node_modules/pug/test/output/include-only-text.html new file mode 100644 index 0000000..4e3f3b2 --- /dev/null +++ b/node_modules/pug/test/output/include-only-text.html @@ -0,0 +1,6 @@ + + + +

    The message is "hello world"

    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/include-only-text.js b/node_modules/pug/test/output/include-only-text.js new file mode 100644 index 0000000..4618b7d --- /dev/null +++ b/node_modules/pug/test/output/include-only-text.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + '

    The message is "hello world"

    '; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/include-with-text-head.html b/node_modules/pug/test/output/include-with-text-head.html new file mode 100644 index 0000000..29fb3a0 --- /dev/null +++ b/node_modules/pug/test/output/include-with-text-head.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/include-with-text-head.js b/node_modules/pug/test/output/include-with-text-head.js new file mode 100644 index 0000000..60b78f7 --- /dev/null +++ b/node_modules/pug/test/output/include-with-text-head.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/include-with-text.html b/node_modules/pug/test/output/include-with-text.html new file mode 100644 index 0000000..a9e6468 --- /dev/null +++ b/node_modules/pug/test/output/include-with-text.html @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/include-with-text.js b/node_modules/pug/test/output/include-with-text.js new file mode 100644 index 0000000..b143dc3 --- /dev/null +++ b/node_modules/pug/test/output/include-with-text.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/include.script.html b/node_modules/pug/test/output/include.script.html new file mode 100644 index 0000000..4bc68bf --- /dev/null +++ b/node_modules/pug/test/output/include.script.html @@ -0,0 +1,7 @@ + + \ No newline at end of file diff --git a/node_modules/pug/test/output/include.script.js b/node_modules/pug/test/output/include.script.js new file mode 100644 index 0000000..f9f234f --- /dev/null +++ b/node_modules/pug/test/output/include.script.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/include.yield.nested.html b/node_modules/pug/test/output/include.yield.nested.html new file mode 100644 index 0000000..58332bd --- /dev/null +++ b/node_modules/pug/test/output/include.yield.nested.html @@ -0,0 +1,18 @@ + + + + + + +

    Page

    +
    +
    +

    some content

    +

    and some more

    +
    +
    + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/include.yield.nested.js b/node_modules/pug/test/output/include.yield.nested.js new file mode 100644 index 0000000..1e737ac --- /dev/null +++ b/node_modules/pug/test/output/include.yield.nested.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + '

    Page

    some content

    and some more

    '; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/includes-with-ext-js.html b/node_modules/pug/test/output/includes-with-ext-js.html new file mode 100644 index 0000000..a069a38 --- /dev/null +++ b/node_modules/pug/test/output/includes-with-ext-js.html @@ -0,0 +1,3 @@ + +
    var x = "\n here is some \n new lined text";
    +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/includes-with-ext-js.js b/node_modules/pug/test/output/includes-with-ext-js.js new file mode 100644 index 0000000..396bf18 --- /dev/null +++ b/node_modules/pug/test/output/includes-with-ext-js.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + '
    var x = "\\n here is some \\n new lined text";\n
    '; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/includes.html b/node_modules/pug/test/output/includes.html new file mode 100644 index 0000000..22a1ea2 --- /dev/null +++ b/node_modules/pug/test/output/includes.html @@ -0,0 +1,17 @@ + +

    bar

    + +

    :)

    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/includes.js b/node_modules/pug/test/output/includes.js new file mode 100644 index 0000000..946ac4d --- /dev/null +++ b/node_modules/pug/test/output/includes.js @@ -0,0 +1,10 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_mixins["foo"] = pug_interp = function() { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + "

    bar

    "; + }; + pug_mixins["foo"](); + pug_html = pug_html + "

    :)

    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.alert-dialog.html b/node_modules/pug/test/output/inheritance.alert-dialog.html new file mode 100644 index 0000000..dd70e2b --- /dev/null +++ b/node_modules/pug/test/output/inheritance.alert-dialog.html @@ -0,0 +1,7 @@ + +
    Close +
    +

    Alert!

    +

    I'm an alert!

    +
    +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.alert-dialog.js b/node_modules/pug/test/output/inheritance.alert-dialog.js new file mode 100644 index 0000000..f634dc2 --- /dev/null +++ b/node_modules/pug/test/output/inheritance.alert-dialog.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + '
    Close

    Alert!

    I\'m an alert!

    '; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.defaults.html b/node_modules/pug/test/output/inheritance.defaults.html new file mode 100644 index 0000000..5738337 --- /dev/null +++ b/node_modules/pug/test/output/inheritance.defaults.html @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.defaults.js b/node_modules/pug/test/output/inheritance.defaults.js new file mode 100644 index 0000000..86fff57 --- /dev/null +++ b/node_modules/pug/test/output/inheritance.defaults.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.extend.html b/node_modules/pug/test/output/inheritance.extend.html new file mode 100644 index 0000000..2c373ce --- /dev/null +++ b/node_modules/pug/test/output/inheritance.extend.html @@ -0,0 +1,11 @@ + + + + My Application + + + +

    Page

    +

    Some content

    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.extend.include.html b/node_modules/pug/test/output/inheritance.extend.include.html new file mode 100644 index 0000000..3168df2 --- /dev/null +++ b/node_modules/pug/test/output/inheritance.extend.include.html @@ -0,0 +1,15 @@ + + + + My Application + + + +

    Page

    +

    Some content

    +
    Close +

    Awesome

    +

    Now we can extend included blocks!

    +
    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.extend.include.js b/node_modules/pug/test/output/inheritance.extend.include.js new file mode 100644 index 0000000..2b045a2 --- /dev/null +++ b/node_modules/pug/test/output/inheritance.extend.include.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + 'My Application

    Page

    Some content

    Close

    Awesome

    Now we can extend included blocks!

    '; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.extend.js b/node_modules/pug/test/output/inheritance.extend.js new file mode 100644 index 0000000..d7abcf2 --- /dev/null +++ b/node_modules/pug/test/output/inheritance.extend.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + 'My Application

    Page

    Some content

    '; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.extend.mixins.block.html b/node_modules/pug/test/output/inheritance.extend.mixins.block.html new file mode 100644 index 0000000..6854090 --- /dev/null +++ b/node_modules/pug/test/output/inheritance.extend.mixins.block.html @@ -0,0 +1,11 @@ + + + + My Application + + +
    +

    Hello World!

    +
    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.extend.mixins.block.js b/node_modules/pug/test/output/inheritance.extend.mixins.block.js new file mode 100644 index 0000000..d46c998 --- /dev/null +++ b/node_modules/pug/test/output/inheritance.extend.mixins.block.js @@ -0,0 +1,17 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_mixins["article"] = pug_interp = function() { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + "
    "; + block && block(); + pug_html = pug_html + "
    "; + }; + pug_html = pug_html + "My Application"; + pug_mixins["article"].call({ + block: function() { + pug_html = pug_html + "

    Hello World!

    "; + } + }); + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.extend.mixins.html b/node_modules/pug/test/output/inheritance.extend.mixins.html new file mode 100644 index 0000000..469e38e --- /dev/null +++ b/node_modules/pug/test/output/inheritance.extend.mixins.html @@ -0,0 +1,10 @@ + + + + My Application + + +

    The meaning of life

    +

    Foo bar baz!

    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.extend.mixins.js b/node_modules/pug/test/output/inheritance.extend.mixins.js new file mode 100644 index 0000000..3309c14 --- /dev/null +++ b/node_modules/pug/test/output/inheritance.extend.mixins.js @@ -0,0 +1,50 @@ +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_mixins["article"] = pug_interp = function(title) { + var block = this && this.block, attributes = this && this.attributes || {}; + if (title) { + pug_html = pug_html + "

    " + pug_escape(null == (pug_interp = title) ? "" : pug_interp) + "

    "; + } + block && block(); + }; + pug_html = pug_html + "My Application"; + pug_mixins["article"].call({ + block: function() { + pug_html = pug_html + "

    Foo bar baz!

    "; + } + }, "The meaning of life"); + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.extend.recursive.html b/node_modules/pug/test/output/inheritance.extend.recursive.html new file mode 100644 index 0000000..837172f --- /dev/null +++ b/node_modules/pug/test/output/inheritance.extend.recursive.html @@ -0,0 +1,5 @@ + +

    grand-grandparent

    +

    grandparent

    +

    parent

    +

    child

    \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.extend.recursive.js b/node_modules/pug/test/output/inheritance.extend.recursive.js new file mode 100644 index 0000000..5e16777 --- /dev/null +++ b/node_modules/pug/test/output/inheritance.extend.recursive.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "

    grand-grandparent

    grandparent

    parent

    child

    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.extend.whitespace.html b/node_modules/pug/test/output/inheritance.extend.whitespace.html new file mode 100644 index 0000000..2c373ce --- /dev/null +++ b/node_modules/pug/test/output/inheritance.extend.whitespace.html @@ -0,0 +1,11 @@ + + + + My Application + + + +

    Page

    +

    Some content

    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.extend.whitespace.js b/node_modules/pug/test/output/inheritance.extend.whitespace.js new file mode 100644 index 0000000..d7abcf2 --- /dev/null +++ b/node_modules/pug/test/output/inheritance.extend.whitespace.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + 'My Application

    Page

    Some content

    '; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.html b/node_modules/pug/test/output/inheritance.html new file mode 100644 index 0000000..2c373ce --- /dev/null +++ b/node_modules/pug/test/output/inheritance.html @@ -0,0 +1,11 @@ + + + + My Application + + + +

    Page

    +

    Some content

    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/inheritance.js b/node_modules/pug/test/output/inheritance.js new file mode 100644 index 0000000..d7abcf2 --- /dev/null +++ b/node_modules/pug/test/output/inheritance.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + 'My Application

    Page

    Some content

    '; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/inline-tag.html b/node_modules/pug/test/output/inline-tag.html new file mode 100644 index 0000000..7ea3af7 --- /dev/null +++ b/node_modules/pug/test/output/inline-tag.html @@ -0,0 +1,21 @@ + +

    bing foo bong

    +

    + bing + foo + [foo] + + bong + +

    +

    + bing + foo + [foo] + + bong +

    +

    + #[strong escaped] + #[escaped +

    \ No newline at end of file diff --git a/node_modules/pug/test/output/inline-tag.js b/node_modules/pug/test/output/inline-tag.js new file mode 100644 index 0000000..b4bd8f9 --- /dev/null +++ b/node_modules/pug/test/output/inline-tag.js @@ -0,0 +1,41 @@ +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "

    bing foo bong

    bing\nfoo\n" + pug_escape(null == (pug_interp = "[foo]") ? "" : pug_interp) + "\n"; + var foo = "foo]"; + pug_html = pug_html + "\nbong\n

    bing\nfoo\n" + pug_escape(null == (pug_interp = "[foo]") ? "" : pug_interp) + "\n"; + var foo = "foo]"; + pug_html = pug_html + "\nbong

    #[strong escaped]\n#[escaped

    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/intepolated-elements.html b/node_modules/pug/test/output/intepolated-elements.html new file mode 100644 index 0000000..721fa02 --- /dev/null +++ b/node_modules/pug/test/output/intepolated-elements.html @@ -0,0 +1,4 @@ + +

    with inline link

    +

    Some text

    +

    Some text with inline link

    \ No newline at end of file diff --git a/node_modules/pug/test/output/intepolated-elements.js b/node_modules/pug/test/output/intepolated-elements.js new file mode 100644 index 0000000..05cea76 --- /dev/null +++ b/node_modules/pug/test/output/intepolated-elements.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + '

    with inline link

    Some text

    Some text with inline link

    '; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/interpolated-mixin.html b/node_modules/pug/test/output/interpolated-mixin.html new file mode 100644 index 0000000..101aa95 --- /dev/null +++ b/node_modules/pug/test/output/interpolated-mixin.html @@ -0,0 +1,3 @@ + +

    This also works http://www.bing.com so hurrah for Pug +

    \ No newline at end of file diff --git a/node_modules/pug/test/output/interpolated-mixin.js b/node_modules/pug/test/output/interpolated-mixin.js new file mode 100644 index 0000000..4a1a8c2 --- /dev/null +++ b/node_modules/pug/test/output/interpolated-mixin.js @@ -0,0 +1,49 @@ +function pug_attr(t, e, n, f) { + return e !== !1 && null != e && (e || "class" !== t && "style" !== t) ? e === !0 ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()), + "string" == typeof e || (e = JSON.stringify(e), n || e.indexOf('"') === -1) ? (n && (e = pug_escape(e)), + " " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "'") + "'") : ""; +} + +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_mixins["linkit"] = pug_interp = function(url) { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + "" + pug_escape(null == (pug_interp = url) ? "" : pug_interp) + ""; + }; + pug_html = pug_html + "

    This also works "; + pug_mixins["linkit"]("http://www.bing.com"); + pug_html = pug_html + " so hurrah for Pug

    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/interpolation.escape.html b/node_modules/pug/test/output/interpolation.escape.html new file mode 100644 index 0000000..67c8f21 --- /dev/null +++ b/node_modules/pug/test/output/interpolation.escape.html @@ -0,0 +1,7 @@ + + + some + #{text} + here + My ID is {42} + \ No newline at end of file diff --git a/node_modules/pug/test/output/interpolation.escape.js b/node_modules/pug/test/output/interpolation.escape.js new file mode 100644 index 0000000..437614b --- /dev/null +++ b/node_modules/pug/test/output/interpolation.escape.js @@ -0,0 +1,38 @@ +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + var id = 42; + pug_html = pug_html + "some\n#{text}\nhere\nMy ID " + pug_escape(null == (pug_interp = "is {" + id + "}") ? "" : pug_interp) + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/layout.append.html b/node_modules/pug/test/output/layout.append.html new file mode 100644 index 0000000..35ecb1a --- /dev/null +++ b/node_modules/pug/test/output/layout.append.html @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/layout.append.js b/node_modules/pug/test/output/layout.append.js new file mode 100644 index 0000000..1254165 --- /dev/null +++ b/node_modules/pug/test/output/layout.append.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/layout.append.without-block.html b/node_modules/pug/test/output/layout.append.without-block.html new file mode 100644 index 0000000..35ecb1a --- /dev/null +++ b/node_modules/pug/test/output/layout.append.without-block.html @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/layout.append.without-block.js b/node_modules/pug/test/output/layout.append.without-block.js new file mode 100644 index 0000000..1254165 --- /dev/null +++ b/node_modules/pug/test/output/layout.append.without-block.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/layout.multi.append.prepend.block.html b/node_modules/pug/test/output/layout.multi.append.prepend.block.html new file mode 100644 index 0000000..6bb714b --- /dev/null +++ b/node_modules/pug/test/output/layout.multi.append.prepend.block.html @@ -0,0 +1,9 @@ + +

    Last prepend must appear at top

    +

    Something prepended to content

    +
    Defined content
    +

    Something appended to content

    +

    Last append must be most last

    + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/layout.multi.append.prepend.block.js b/node_modules/pug/test/output/layout.multi.append.prepend.block.js new file mode 100644 index 0000000..9753130 --- /dev/null +++ b/node_modules/pug/test/output/layout.multi.append.prepend.block.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + '

    Last prepend must appear at top

    Something prepended to content

    Defined content

    Something appended to content

    Last append must be most last

    '; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/layout.prepend.html b/node_modules/pug/test/output/layout.prepend.html new file mode 100644 index 0000000..c644f99 --- /dev/null +++ b/node_modules/pug/test/output/layout.prepend.html @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/layout.prepend.js b/node_modules/pug/test/output/layout.prepend.js new file mode 100644 index 0000000..921f655 --- /dev/null +++ b/node_modules/pug/test/output/layout.prepend.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/layout.prepend.without-block.html b/node_modules/pug/test/output/layout.prepend.without-block.html new file mode 100644 index 0000000..c644f99 --- /dev/null +++ b/node_modules/pug/test/output/layout.prepend.without-block.html @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/layout.prepend.without-block.js b/node_modules/pug/test/output/layout.prepend.without-block.js new file mode 100644 index 0000000..921f655 --- /dev/null +++ b/node_modules/pug/test/output/layout.prepend.without-block.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin-at-end-of-file.html b/node_modules/pug/test/output/mixin-at-end-of-file.html new file mode 100644 index 0000000..718b2b1 --- /dev/null +++ b/node_modules/pug/test/output/mixin-at-end-of-file.html @@ -0,0 +1,4 @@ + +
    +

    some awesome content

    +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin-at-end-of-file.js b/node_modules/pug/test/output/mixin-at-end-of-file.js new file mode 100644 index 0000000..35fe35e --- /dev/null +++ b/node_modules/pug/test/output/mixin-at-end-of-file.js @@ -0,0 +1,15 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_mixins["slide"] = pug_interp = function() { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + '
    '; + block && block(); + pug_html = pug_html + "
    "; + }; + pug_mixins["slide"].call({ + block: function() { + pug_html = pug_html + "

    some awesome content

    "; + } + }); + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin-block-with-space.html b/node_modules/pug/test/output/mixin-block-with-space.html new file mode 100644 index 0000000..5f1fc02 --- /dev/null +++ b/node_modules/pug/test/output/mixin-block-with-space.html @@ -0,0 +1,3 @@ + +
    This text should appear +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin-block-with-space.js b/node_modules/pug/test/output/mixin-block-with-space.js new file mode 100644 index 0000000..c8b8ba0 --- /dev/null +++ b/node_modules/pug/test/output/mixin-block-with-space.js @@ -0,0 +1,15 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_mixins["m"] = pug_interp = function(id) { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + "
    "; + block && block(); + pug_html = pug_html + "
    "; + }; + pug_mixins["m"].call({ + block: function() { + pug_html = pug_html + "This text should appear"; + } + }); + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin-hoist.html b/node_modules/pug/test/output/mixin-hoist.html new file mode 100644 index 0000000..62949ab --- /dev/null +++ b/node_modules/pug/test/output/mixin-hoist.html @@ -0,0 +1,6 @@ + + + +

    Pug

    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin-hoist.js b/node_modules/pug/test/output/mixin-hoist.js new file mode 100644 index 0000000..bf381d0 --- /dev/null +++ b/node_modules/pug/test/output/mixin-hoist.js @@ -0,0 +1,46 @@ +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + var locals_for_with = locals || {}; + (function(title) { + pug_mixins["foo"] = pug_interp = function() { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + "

    " + pug_escape(null == (pug_interp = title) ? "" : pug_interp) + "

    "; + }; + pug_html = pug_html + ""; + pug_mixins["foo"](); + pug_html = pug_html + ""; + }).call(this, "title" in locals_for_with ? locals_for_with.title : typeof title !== "undefined" ? title : undefined); + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin-via-include.html b/node_modules/pug/test/output/mixin-via-include.html new file mode 100644 index 0000000..a6078eb --- /dev/null +++ b/node_modules/pug/test/output/mixin-via-include.html @@ -0,0 +1,2 @@ + +

    bar

    \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin-via-include.js b/node_modules/pug/test/output/mixin-via-include.js new file mode 100644 index 0000000..b4f595a --- /dev/null +++ b/node_modules/pug/test/output/mixin-via-include.js @@ -0,0 +1,13 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_mixins["bang"] = pug_interp = function() { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_mixins["foo"](); + }; + pug_mixins["foo"] = pug_interp = function() { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + "

    bar

    "; + }; + pug_mixins["bang"](); + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin.attrs.html b/node_modules/pug/test/output/mixin.attrs.html new file mode 100644 index 0000000..3dc6364 --- /dev/null +++ b/node_modules/pug/test/output/mixin.attrs.html @@ -0,0 +1,33 @@ + + +
    Hello World +
    +
    +

    Section 1

    +

    Some important content.

    +
    +
    +

    Section 2

    +

    Even more important content.

    + +
    +
    +
    +

    Section 3

    +

    Last content.

    + +
    +
    +
    +

    Some final words.

    +
    +
    +
    + +
    +
    work
    +
    +

    1

    +

    2

    +

    3

    +

    4

    \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin.attrs.js b/node_modules/pug/test/output/mixin.attrs.js new file mode 100644 index 0000000..d8cb7be --- /dev/null +++ b/node_modules/pug/test/output/mixin.attrs.js @@ -0,0 +1,223 @@ +function pug_attr(t, e, n, f) { + return e !== !1 && null != e && (e || "class" !== t && "style" !== t) ? e === !0 ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()), + "string" == typeof e || (e = JSON.stringify(e), n || e.indexOf('"') === -1) ? (n && (e = pug_escape(e)), + " " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "'") + "'") : ""; +} + +function pug_attrs(t, r) { + var a = ""; + for (var s in t) if (pug_has_own_property.call(t, s)) { + var u = t[s]; + if ("class" === s) { + u = pug_classes(u), a = pug_attr(s, u, !1, r) + a; + continue; + } + "style" === s && (u = pug_style(u)), a += pug_attr(s, u, !1, r); + } + return a; +} + +function pug_classes(s, r) { + return Array.isArray(s) ? pug_classes_array(s, r) : s && "object" == typeof s ? pug_classes_object(s) : s || ""; +} + +function pug_classes_array(r, a) { + for (var s, e = "", u = "", c = Array.isArray(a), g = 0; g < r.length; g++) s = pug_classes(r[g]), + s && (c && a[g] && (s = pug_escape(s)), e = e + u + s, u = " "); + return e; +} + +function pug_classes_object(r) { + var a = "", n = ""; + for (var o in r) o && r[o] && pug_has_own_property.call(r, o) && (a = a + n + o, + n = " "); + return a; +} + +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_has_own_property = Object.prototype.hasOwnProperty; + +var pug_match_html = /["&<>]/; + +function pug_merge(r, e) { + if (1 === arguments.length) { + for (var t = r[0], a = 1; a < r.length; a++) t = pug_merge(t, r[a]); + return t; + } + for (var g in e) if ("class" === g) { + var l = r[g] || []; + r[g] = (Array.isArray(l) ? l : [ l ]).concat(e[g] || []); + } else if ("style" === g) { + var l = pug_style(r[g]), n = pug_style(e[g]); + r[g] = l + n; + } else r[g] = e[g]; + return r; +} + +function pug_style(r) { + if (!r) return ""; + if ("object" == typeof r) { + var t = ""; + for (var e in r) pug_has_own_property.call(r, e) && (t = t + e + ":" + r[e] + ";"); + return t; + } + return r += "", ";" !== r[r.length - 1] ? r + ";" : r; +} + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_mixins["centered"] = pug_interp = function(title) { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + ""; + if (title) { + pug_html = pug_html + "" + pug_escape(null == (pug_interp = title) ? "" : pug_interp) + ""; + } + block && block(); + if (attributes.href) { + pug_html = pug_html + '"; + } + pug_html = pug_html + ""; + }; + pug_mixins["main"] = pug_interp = function(title) { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + '
    '; + pug_mixins["centered"].call({ + block: function() { + block && block(); + }, + attributes: pug_merge([ { + class: "highlight" + }, attributes ]) + }, title); + pug_html = pug_html + "
    "; + }; + pug_mixins["bottom"] = pug_interp = function() { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + ""; + block && block(); + pug_html = pug_html + ""; + }; + pug_html = pug_html + ""; + pug_mixins["centered"].call({ + block: function() { + pug_html = pug_html + "Hello World"; + }, + attributes: { + id: "First" + } + }); + pug_mixins["centered"].call({ + block: function() { + pug_html = pug_html + "

    Some important content.

    "; + }, + attributes: { + id: "Second" + } + }, "Section 1"); + pug_mixins["centered"].call({ + block: function() { + pug_html = pug_html + "

    Even more important content.

    "; + }, + attributes: { + class: "foo bar", + id: "Third", + href: "menu.html" + } + }, "Section 2"); + pug_mixins["main"].call({ + block: function() { + pug_html = pug_html + "

    Last content.

    "; + }, + attributes: { + href: "#" + } + }, "Section 3"); + pug_mixins["bottom"].call({ + block: function() { + pug_html = pug_html + "

    Some final words.

    "; + }, + attributes: { + class: "foo bar", + name: "end", + id: "Last", + "data-attr": "baz" + } + }); + pug_mixins["bottom"].call({ + attributes: { + class: "class1 class2" + } + }); + pug_html = pug_html + ""; + pug_mixins["foo"] = pug_interp = function() { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + ""; + }; + var val = ""; + var classes = [ "foo", "bar" ]; + pug_mixins["foo"].call({ + attributes: { + class: pug_classes([ classes, "thunk" ], [ true, false ]), + attr3: "baz", + "data-foo": pug_escape(val), + "data-bar": val + } + }); + pug_mixins["work_filmstrip_item"] = pug_interp = function(work) { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + "" + pug_escape(null == (pug_interp = work) ? "" : pug_interp) + ""; + }; + pug_mixins["work_filmstrip_item"].call({ + attributes: { + "data-profile": "profile", + "data-creator-name": "name" + } + }, "work"); + pug_mixins["my-mixin"] = pug_interp = function(arg1, arg2, arg3, arg4) { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + "

    " + pug_escape(null == (pug_interp = arg1) ? "" : pug_interp) + "

    " + pug_escape(null == (pug_interp = arg2) ? "" : pug_interp) + "

    " + pug_escape(null == (pug_interp = arg3) ? "" : pug_interp) + "

    " + pug_escape(null == (pug_interp = arg4) ? "" : pug_interp) + "

    "; + }; + pug_mixins["foo"].call({ + attributes: { + class: "baz", + attr3: "qux" + } + }); + pug_mixins["my-mixin"]("1", "2", "3", "4"); + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin.block-tag-behaviour.html b/node_modules/pug/test/output/mixin.block-tag-behaviour.html new file mode 100644 index 0000000..c0b49f7 --- /dev/null +++ b/node_modules/pug/test/output/mixin.block-tag-behaviour.html @@ -0,0 +1,23 @@ + + + +
    +

    Foo

    +

    I'm article foo

    +
    + + + + +
    +

    Something

    +

    + I'm a much longer + text-only article, + but you can still + inline html tags + in me if you want. +

    +
    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin.block-tag-behaviour.js b/node_modules/pug/test/output/mixin.block-tag-behaviour.js new file mode 100644 index 0000000..2f6552d --- /dev/null +++ b/node_modules/pug/test/output/mixin.block-tag-behaviour.js @@ -0,0 +1,62 @@ +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_mixins["article"] = pug_interp = function(name) { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + '

    ' + pug_escape(null == (pug_interp = name) ? "" : pug_interp) + "

    "; + block && block(); + pug_html = pug_html + "
    "; + }; + pug_html = pug_html + ""; + pug_mixins["article"].call({ + block: function() { + pug_html = pug_html + "

    I'm article foo

    "; + } + }, "Foo"); + pug_html = pug_html + ""; + pug_mixins["article"] = pug_interp = function(name) { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + '

    ' + pug_escape(null == (pug_interp = name) ? "" : pug_interp) + "

    "; + block && block(); + pug_html = pug_html + "

    "; + }; + pug_html = pug_html + ""; + pug_mixins["article"].call({ + block: function() { + pug_html = pug_html + "I'm a much longer\ntext-only article,\nbut you can still\ninline html tags\nin me if you want."; + } + }, "Something"); + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin.blocks.html b/node_modules/pug/test/output/mixin.blocks.html new file mode 100644 index 0000000..fc08bd9 --- /dev/null +++ b/node_modules/pug/test/output/mixin.blocks.html @@ -0,0 +1,35 @@ + + + +
    + + + +
    + + + + +
    + + + +
    + + + + +
    + +
    + + +
    +
    +

    one

    +

    two

    +

    three

    +
    +
    +
    123 +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin.blocks.js b/node_modules/pug/test/output/mixin.blocks.js new file mode 100644 index 0000000..e732375 --- /dev/null +++ b/node_modules/pug/test/output/mixin.blocks.js @@ -0,0 +1,97 @@ +function pug_attr(t, e, n, f) { + return e !== !1 && null != e && (e || "class" !== t && "style" !== t) ? e === !0 ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()), + "string" == typeof e || (e = JSON.stringify(e), n || e.indexOf('"') === -1) ? (n && (e = pug_escape(e)), + " " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "'") + "'") : ""; +} + +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_mixins["form"] = pug_interp = function(method, action) { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + ""; + var csrf_token_from_somewhere = "hey"; + pug_html = pug_html + ""; + block && block(); + pug_html = pug_html + ""; + }; + pug_html = pug_html + ""; + pug_mixins["form"].call({ + block: function() { + pug_html = pug_html + ''; + } + }, "GET", "/search"); + pug_html = pug_html + ""; + pug_mixins["form"].call({ + block: function() { + pug_html = pug_html + ''; + } + }, "POST", "/search"); + pug_html = pug_html + ""; + pug_mixins["form"]("POST", "/search"); + pug_html = pug_html + ""; + pug_mixins["bar"] = pug_interp = function() { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + '
    '; + block && block(); + pug_html = pug_html + "
    "; + }; + pug_mixins["foo"] = pug_interp = function() { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + '
    '; + pug_mixins["bar"].call({ + block: function() { + block && block(); + } + }); + pug_html = pug_html + "
    "; + }; + pug_mixins["foo"].call({ + block: function() { + pug_html = pug_html + "

    one

    two

    three

    "; + } + }); + pug_mixins["baz"] = pug_interp = function() { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + '
    '; + block && block(); + pug_html = pug_html + "
    "; + }; + pug_mixins["baz"].call({ + block: function() { + pug_html = pug_html + pug_escape(null == (pug_interp = "123") ? "" : pug_interp); + } + }); + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin.merge.html b/node_modules/pug/test/output/mixin.merge.html new file mode 100644 index 0000000..260c16c --- /dev/null +++ b/node_modules/pug/test/output/mixin.merge.html @@ -0,0 +1,35 @@ + + +

    One

    +

    Two

    +

    Three

    +

    Four

    +

    One

    +

    Two

    +

    Three

    +

    Four

    +

    One

    +

    Two

    +

    Three

    +

    Four

    +

    One

    +

    Two

    +

    Three

    +

    Four

    +

    One

    +

    Two

    +

    Three

    +

    Four

    +

    One

    +

    Two

    +

    Three

    +

    Four

    +

    One

    +

    Two

    +

    Three

    +

    Four

    +

    One

    +

    Two

    +

    Three

    +

    Four

    + \ No newline at end of file diff --git a/node_modules/pug/test/output/mixin.merge.js b/node_modules/pug/test/output/mixin.merge.js new file mode 100644 index 0000000..e1695c5 --- /dev/null +++ b/node_modules/pug/test/output/mixin.merge.js @@ -0,0 +1,148 @@ +function pug_attr(t, e, n, f) { + return e !== !1 && null != e && (e || "class" !== t && "style" !== t) ? e === !0 ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()), + "string" == typeof e || (e = JSON.stringify(e), n || e.indexOf('"') === -1) ? (n && (e = pug_escape(e)), + " " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "'") + "'") : ""; +} + +function pug_attrs(t, r) { + var a = ""; + for (var s in t) if (pug_has_own_property.call(t, s)) { + var u = t[s]; + if ("class" === s) { + u = pug_classes(u), a = pug_attr(s, u, !1, r) + a; + continue; + } + "style" === s && (u = pug_style(u)), a += pug_attr(s, u, !1, r); + } + return a; +} + +function pug_classes(s, r) { + return Array.isArray(s) ? pug_classes_array(s, r) : s && "object" == typeof s ? pug_classes_object(s) : s || ""; +} + +function pug_classes_array(r, a) { + for (var s, e = "", u = "", c = Array.isArray(a), g = 0; g < r.length; g++) s = pug_classes(r[g]), + s && (c && a[g] && (s = pug_escape(s)), e = e + u + s, u = " "); + return e; +} + +function pug_classes_object(r) { + var a = "", n = ""; + for (var o in r) o && r[o] && pug_has_own_property.call(r, o) && (a = a + n + o, + n = " "); + return a; +} + +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_has_own_property = Object.prototype.hasOwnProperty; + +var pug_match_html = /["&<>]/; + +function pug_merge(r, e) { + if (1 === arguments.length) { + for (var t = r[0], a = 1; a < r.length; a++) t = pug_merge(t, r[a]); + return t; + } + for (var g in e) if ("class" === g) { + var l = r[g] || []; + r[g] = (Array.isArray(l) ? l : [ l ]).concat(e[g] || []); + } else if ("style" === g) { + var l = pug_style(r[g]), n = pug_style(e[g]); + r[g] = l + n; + } else r[g] = e[g]; + return r; +} + +function pug_style(r) { + if (!r) return ""; + if ("object" == typeof r) { + var t = ""; + for (var e in r) pug_has_own_property.call(r, e) && (t = t + e + ":" + r[e] + ";"); + return t; + } + return r += "", ";" !== r[r.length - 1] ? r + ";" : r; +} + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_mixins["foo"] = pug_interp = function() { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + "One

    Two

    Three

    Four

    "; + }; + pug_html = pug_html + ""; + pug_mixins["foo"].call({ + attributes: { + class: "hello" + } + }); + pug_mixins["foo"].call({ + attributes: { + id: "world" + } + }); + pug_mixins["foo"].call({ + attributes: { + class: "hello", + id: "world" + } + }); + pug_mixins["foo"].call({ + attributes: { + class: "hello world" + } + }); + pug_mixins["foo"].call({ + attributes: { + class: "hello" + } + }); + pug_mixins["foo"].call({ + attributes: { + class: "hello world" + } + }); + pug_mixins["foo"](); + pug_mixins["foo"].call({ + attributes: { + class: "hello" + } + }); + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/mixins-unused.html b/node_modules/pug/test/output/mixins-unused.html new file mode 100644 index 0000000..f8f1281 --- /dev/null +++ b/node_modules/pug/test/output/mixins-unused.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/node_modules/pug/test/output/mixins-unused.js b/node_modules/pug/test/output/mixins-unused.js new file mode 100644 index 0000000..4ad2f09 --- /dev/null +++ b/node_modules/pug/test/output/mixins-unused.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/mixins.html b/node_modules/pug/test/output/mixins.html new file mode 100644 index 0000000..a75b175 --- /dev/null +++ b/node_modules/pug/test/output/mixins.html @@ -0,0 +1,23 @@ + +
    +

    Tobi

    +
    +
    +

    This

    +

    is regular, javascript

    +
    +
    +
    + +
      +
    • foo
    • +
    • bar
    • +
    • baz
    • +
    +
      +
    • foo
    • +
    • bar
    • +
    • baz
    • +
    + +
    This is interpolated
    \ No newline at end of file diff --git a/node_modules/pug/test/output/mixins.js b/node_modules/pug/test/output/mixins.js new file mode 100644 index 0000000..4dcc54a --- /dev/null +++ b/node_modules/pug/test/output/mixins.js @@ -0,0 +1,61 @@ +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_mixins["comment"] = pug_interp = function(title, str) { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + '

    ' + pug_escape(null == (pug_interp = title) ? "" : pug_interp) + '

    ' + pug_escape(null == (pug_interp = str) ? "" : pug_interp) + "

    "; + }; + pug_mixins["comment"] = pug_interp = function(title, str) { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + '

    ' + pug_escape(null == (pug_interp = title) ? "" : pug_interp) + '

    ' + pug_escape(null == (pug_interp = str) ? "" : pug_interp) + "

    "; + }; + pug_html = pug_html + '

    Tobi

    '; + pug_mixins["comment"]("This", "is regular, javascript"); + pug_html = pug_html + "
    "; + pug_mixins["list"] = pug_interp = function() { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + "
    • foo
    • bar
    • baz
    "; + }; + pug_html = pug_html + ""; + pug_mixins["list"](); + pug_mixins["list"](); + pug_html = pug_html + ""; + pug_mixins["foobar"] = pug_interp = function(str) { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + '
    ' + pug_escape(null == (pug_interp = str + "interpolated") ? "" : pug_interp) + "
    "; + }; + var suffix = "bar"; + pug_mixins["foo" + suffix]("This is "); + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/mixins.rest-args.html b/node_modules/pug/test/output/mixins.rest-args.html new file mode 100644 index 0000000..9ab9c6d --- /dev/null +++ b/node_modules/pug/test/output/mixins.rest-args.html @@ -0,0 +1,7 @@ + +
      +
    • 1
    • +
    • 2
    • +
    • 3
    • +
    • 4
    • +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/mixins.rest-args.js b/node_modules/pug/test/output/mixins.rest-args.js new file mode 100644 index 0000000..9d4b35d --- /dev/null +++ b/node_modules/pug/test/output/mixins.rest-args.js @@ -0,0 +1,62 @@ +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_mixins["list"] = pug_interp = function(tag) { + var block = this && this.block, attributes = this && this.attributes || {}; + var items = []; + for (pug_interp = 1; pug_interp < arguments.length; pug_interp++) { + items.push(arguments[pug_interp]); + } + pug_html = pug_html + "<" + tag + ">"; + (function() { + var $$obj = items; + if ("number" == typeof $$obj.length) { + for (var pug_index0 = 0, $$l = $$obj.length; pug_index0 < $$l; pug_index0++) { + var item = $$obj[pug_index0]; + pug_html = pug_html + "
  • " + pug_escape(null == (pug_interp = item) ? "" : pug_interp) + "
  • "; + } + } else { + var $$l = 0; + for (var pug_index0 in $$obj) { + $$l++; + var item = $$obj[pug_index0]; + pug_html = pug_html + "
  • " + pug_escape(null == (pug_interp = item) ? "" : pug_interp) + "
  • "; + } + } + }).call(this); + pug_html = pug_html + ""; + }; + pug_mixins["list"]("ul", 1, 2, 3, 4); + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/namespaces.html b/node_modules/pug/test/output/namespaces.html new file mode 100644 index 0000000..5f2cab7 --- /dev/null +++ b/node_modules/pug/test/output/namespaces.html @@ -0,0 +1,3 @@ + +Something + \ No newline at end of file diff --git a/node_modules/pug/test/output/namespaces.js b/node_modules/pug/test/output/namespaces.js new file mode 100644 index 0000000..b2c7776 --- /dev/null +++ b/node_modules/pug/test/output/namespaces.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + 'Something'; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/nesting.html b/node_modules/pug/test/output/nesting.html new file mode 100644 index 0000000..eed785e --- /dev/null +++ b/node_modules/pug/test/output/nesting.html @@ -0,0 +1,12 @@ + +
      +
    • a
    • +
    • b
    • +
    • +
        +
      • c
      • +
      • d
      • +
      +
    • +
    • e
    • +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/nesting.js b/node_modules/pug/test/output/nesting.js new file mode 100644 index 0000000..19d6cee --- /dev/null +++ b/node_modules/pug/test/output/nesting.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "
    • a
    • b
      • c
      • d
    • e
    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/pipeless-comments.html b/node_modules/pug/test/output/pipeless-comments.html new file mode 100644 index 0000000..5f9af83 --- /dev/null +++ b/node_modules/pug/test/output/pipeless-comments.html @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/node_modules/pug/test/output/pipeless-comments.js b/node_modules/pug/test/output/pipeless-comments.js new file mode 100644 index 0000000..29e79ec --- /dev/null +++ b/node_modules/pug/test/output/pipeless-comments.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/pipeless-filters.html b/node_modules/pug/test/output/pipeless-filters.html new file mode 100644 index 0000000..d21d32f --- /dev/null +++ b/node_modules/pug/test/output/pipeless-filters.html @@ -0,0 +1,3 @@ +
    code sample
    +
    +

    Heading

    diff --git a/node_modules/pug/test/output/pipeless-filters.js b/node_modules/pug/test/output/pipeless-filters.js new file mode 100644 index 0000000..97b6673 --- /dev/null +++ b/node_modules/pug/test/output/pipeless-filters.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "
    code sample\n
    \n

    Heading

    \n"; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/pipeless-tag.html b/node_modules/pug/test/output/pipeless-tag.html new file mode 100644 index 0000000..f6f8935 --- /dev/null +++ b/node_modules/pug/test/output/pipeless-tag.html @@ -0,0 +1,3 @@ + +
      what
    +is going on
    \ No newline at end of file diff --git a/node_modules/pug/test/output/pipeless-tag.js b/node_modules/pug/test/output/pipeless-tag.js new file mode 100644 index 0000000..4c9a59f --- /dev/null +++ b/node_modules/pug/test/output/pipeless-tag.js @@ -0,0 +1,37 @@ +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "
      what\nis " + pug_escape(null == (pug_interp = "going") ? "" : pug_interp) + " " + pug_escape(null == (pug_interp = "on") ? "" : pug_interp) + "
    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/pre.html b/node_modules/pug/test/output/pre.html new file mode 100644 index 0000000..e568c2c --- /dev/null +++ b/node_modules/pug/test/output/pre.html @@ -0,0 +1,8 @@ + +
    foo
    +bar
    +baz
    +
    +
    foo
    +bar
    +baz
    \ No newline at end of file diff --git a/node_modules/pug/test/output/pre.js b/node_modules/pug/test/output/pre.js new file mode 100644 index 0000000..11950f9 --- /dev/null +++ b/node_modules/pug/test/output/pre.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "
    foo\nbar\nbaz\n
    foo\nbar\nbaz
    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/quotes.html b/node_modules/pug/test/output/quotes.html new file mode 100644 index 0000000..41c77b0 --- /dev/null +++ b/node_modules/pug/test/output/quotes.html @@ -0,0 +1,3 @@ + +

    "foo"

    +

    'foo'

    \ No newline at end of file diff --git a/node_modules/pug/test/output/quotes.js b/node_modules/pug/test/output/quotes.js new file mode 100644 index 0000000..07fe9cf --- /dev/null +++ b/node_modules/pug/test/output/quotes.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "

    \"foo\"

    'foo'

    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/regression.1794.html b/node_modules/pug/test/output/regression.1794.html new file mode 100644 index 0000000..105729c --- /dev/null +++ b/node_modules/pug/test/output/regression.1794.html @@ -0,0 +1,2 @@ + +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/regression.1794.js b/node_modules/pug/test/output/regression.1794.js new file mode 100644 index 0000000..b752d03 --- /dev/null +++ b/node_modules/pug/test/output/regression.1794.js @@ -0,0 +1,106 @@ +function pug_attr(t, e, n, f) { + return e !== !1 && null != e && (e || "class" !== t && "style" !== t) ? e === !0 ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()), + "string" == typeof e || (e = JSON.stringify(e), n || e.indexOf('"') === -1) ? (n && (e = pug_escape(e)), + " " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "'") + "'") : ""; +} + +function pug_attrs(t, r) { + var a = ""; + for (var s in t) if (pug_has_own_property.call(t, s)) { + var u = t[s]; + if ("class" === s) { + u = pug_classes(u), a = pug_attr(s, u, !1, r) + a; + continue; + } + "style" === s && (u = pug_style(u)), a += pug_attr(s, u, !1, r); + } + return a; +} + +function pug_classes(s, r) { + return Array.isArray(s) ? pug_classes_array(s, r) : s && "object" == typeof s ? pug_classes_object(s) : s || ""; +} + +function pug_classes_array(r, a) { + for (var s, e = "", u = "", c = Array.isArray(a), g = 0; g < r.length; g++) s = pug_classes(r[g]), + s && (c && a[g] && (s = pug_escape(s)), e = e + u + s, u = " "); + return e; +} + +function pug_classes_object(r) { + var a = "", n = ""; + for (var o in r) o && r[o] && pug_has_own_property.call(r, o) && (a = a + n + o, + n = " "); + return a; +} + +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_has_own_property = Object.prototype.hasOwnProperty; + +var pug_match_html = /["&<>]/; + +function pug_merge(r, e) { + if (1 === arguments.length) { + for (var t = r[0], a = 1; a < r.length; a++) t = pug_merge(t, r[a]); + return t; + } + for (var g in e) if ("class" === g) { + var l = r[g] || []; + r[g] = (Array.isArray(l) ? l : [ l ]).concat(e[g] || []); + } else if ("style" === g) { + var l = pug_style(r[g]), n = pug_style(e[g]); + r[g] = l + n; + } else r[g] = e[g]; + return r; +} + +function pug_style(r) { + if (!r) return ""; + if ("object" == typeof r) { + var t = ""; + for (var e in r) pug_has_own_property.call(r, e) && (t = t + e + ":" + r[e] + ";"); + return t; + } + return r += "", ";" !== r[r.length - 1] ? r + ";" : r; +} + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_mixins["test"] = pug_interp = function() { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + ""; + }; + pug_mixins["test"](); + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/regression.784.html b/node_modules/pug/test/output/regression.784.html new file mode 100644 index 0000000..e9545ab --- /dev/null +++ b/node_modules/pug/test/output/regression.784.html @@ -0,0 +1,2 @@ + +
    google.com
    \ No newline at end of file diff --git a/node_modules/pug/test/output/regression.784.js b/node_modules/pug/test/output/regression.784.js new file mode 100644 index 0000000..1e73fec --- /dev/null +++ b/node_modules/pug/test/output/regression.784.js @@ -0,0 +1,38 @@ +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + var url = "http://www.google.com"; + pug_html = pug_html + '
    ' + pug_escape(null == (pug_interp = url.replace("http://", "").replace(/^www\./, "")) ? "" : pug_interp) + "
    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/script.whitespace.html b/node_modules/pug/test/output/script.whitespace.html new file mode 100644 index 0000000..ebc37f8 --- /dev/null +++ b/node_modules/pug/test/output/script.whitespace.html @@ -0,0 +1,8 @@ + + \ No newline at end of file diff --git a/node_modules/pug/test/output/script.whitespace.js b/node_modules/pug/test/output/script.whitespace.js new file mode 100644 index 0000000..4bcfb6e --- /dev/null +++ b/node_modules/pug/test/output/script.whitespace.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/scripts.html b/node_modules/pug/test/output/scripts.html new file mode 100644 index 0000000..1fddcc6 --- /dev/null +++ b/node_modules/pug/test/output/scripts.html @@ -0,0 +1,10 @@ + + + + + +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/scripts.js b/node_modules/pug/test/output/scripts.js new file mode 100644 index 0000000..b548516 --- /dev/null +++ b/node_modules/pug/test/output/scripts.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "
    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/scripts.non-js.html b/node_modules/pug/test/output/scripts.non-js.html new file mode 100644 index 0000000..ec5399e --- /dev/null +++ b/node_modules/pug/test/output/scripts.non-js.html @@ -0,0 +1,12 @@ + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/scripts.non-js.js b/node_modules/pug/test/output/scripts.non-js.js new file mode 100644 index 0000000..906e8c5 --- /dev/null +++ b/node_modules/pug/test/output/scripts.non-js.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/self-closing-html.html b/node_modules/pug/test/output/self-closing-html.html new file mode 100644 index 0000000..4f3bd5f --- /dev/null +++ b/node_modules/pug/test/output/self-closing-html.html @@ -0,0 +1,4 @@ + + +
    + \ No newline at end of file diff --git a/node_modules/pug/test/output/self-closing-html.js b/node_modules/pug/test/output/self-closing-html.js new file mode 100644 index 0000000..b30f641 --- /dev/null +++ b/node_modules/pug/test/output/self-closing-html.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "
    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/single-period.html b/node_modules/pug/test/output/single-period.html new file mode 100644 index 0000000..430944c --- /dev/null +++ b/node_modules/pug/test/output/single-period.html @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/node_modules/pug/test/output/single-period.js b/node_modules/pug/test/output/single-period.js new file mode 100644 index 0000000..15350a1 --- /dev/null +++ b/node_modules/pug/test/output/single-period.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + "."; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/source.html b/node_modules/pug/test/output/source.html new file mode 100644 index 0000000..e2d4a60 --- /dev/null +++ b/node_modules/pug/test/output/source.html @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/source.js b/node_modules/pug/test/output/source.js new file mode 100644 index 0000000..3e8cf09 --- /dev/null +++ b/node_modules/pug/test/output/source.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/styles.html b/node_modules/pug/test/output/styles.html new file mode 100644 index 0000000..bd9d46f --- /dev/null +++ b/node_modules/pug/test/output/styles.html @@ -0,0 +1,21 @@ + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + \ No newline at end of file diff --git a/node_modules/pug/test/output/styles.js b/node_modules/pug/test/output/styles.js new file mode 100644 index 0000000..8d1c25a --- /dev/null +++ b/node_modules/pug/test/output/styles.js @@ -0,0 +1,125 @@ +function pug_attr(t, e, n, f) { + return e !== !1 && null != e && (e || "class" !== t && "style" !== t) ? e === !0 ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()), + "string" == typeof e || (e = JSON.stringify(e), n || e.indexOf('"') === -1) ? (n && (e = pug_escape(e)), + " " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "'") + "'") : ""; +} + +function pug_attrs(t, r) { + var a = ""; + for (var s in t) if (pug_has_own_property.call(t, s)) { + var u = t[s]; + if ("class" === s) { + u = pug_classes(u), a = pug_attr(s, u, !1, r) + a; + continue; + } + "style" === s && (u = pug_style(u)), a += pug_attr(s, u, !1, r); + } + return a; +} + +function pug_classes(s, r) { + return Array.isArray(s) ? pug_classes_array(s, r) : s && "object" == typeof s ? pug_classes_object(s) : s || ""; +} + +function pug_classes_array(r, a) { + for (var s, e = "", u = "", c = Array.isArray(a), g = 0; g < r.length; g++) s = pug_classes(r[g]), + s && (c && a[g] && (s = pug_escape(s)), e = e + u + s, u = " "); + return e; +} + +function pug_classes_object(r) { + var a = "", n = ""; + for (var o in r) o && r[o] && pug_has_own_property.call(r, o) && (a = a + n + o, + n = " "); + return a; +} + +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_has_own_property = Object.prototype.hasOwnProperty; + +var pug_match_html = /["&<>]/; + +function pug_style(r) { + if (!r) return ""; + if ("object" == typeof r) { + var t = ""; + for (var e in r) pug_has_own_property.call(r, e) && (t = t + e + ":" + r[e] + ";"); + return t; + } + return r += "", ";" !== r[r.length - 1] ? r + ";" : r; +} + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + '
    "; + pug_mixins["div"] = pug_interp = function() { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + ""; + }; + pug_mixins["div"].call({ + attributes: { + style: "color:red;background:green;" + } + }); + pug_mixins["div"].call({ + attributes: { + style: "color:red;background:green;" + } + }); + var bg = "green"; + pug_html = pug_html + ""; + pug_mixins["div"].call({ + attributes: { + style: pug_escape(pug_style({ + color: "red", + background: bg + })) + } + }); + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/tag.interpolation.html b/node_modules/pug/test/output/tag.interpolation.html new file mode 100644 index 0000000..7973bf7 --- /dev/null +++ b/node_modules/pug/test/output/tag.interpolation.html @@ -0,0 +1,10 @@ + +

    value

    +

    value

    +here + \ No newline at end of file diff --git a/node_modules/pug/test/output/tag.interpolation.js b/node_modules/pug/test/output/tag.interpolation.js new file mode 100644 index 0000000..5e6c7bd --- /dev/null +++ b/node_modules/pug/test/output/tag.interpolation.js @@ -0,0 +1,116 @@ +function pug_attr(t, e, n, f) { + return e !== !1 && null != e && (e || "class" !== t && "style" !== t) ? e === !0 ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()), + "string" == typeof e || (e = JSON.stringify(e), n || e.indexOf('"') === -1) ? (n && (e = pug_escape(e)), + " " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "'") + "'") : ""; +} + +function pug_attrs(t, r) { + var a = ""; + for (var s in t) if (pug_has_own_property.call(t, s)) { + var u = t[s]; + if ("class" === s) { + u = pug_classes(u), a = pug_attr(s, u, !1, r) + a; + continue; + } + "style" === s && (u = pug_style(u)), a += pug_attr(s, u, !1, r); + } + return a; +} + +function pug_classes(s, r) { + return Array.isArray(s) ? pug_classes_array(s, r) : s && "object" == typeof s ? pug_classes_object(s) : s || ""; +} + +function pug_classes_array(r, a) { + for (var s, e = "", u = "", c = Array.isArray(a), g = 0; g < r.length; g++) s = pug_classes(r[g]), + s && (c && a[g] && (s = pug_escape(s)), e = e + u + s, u = " "); + return e; +} + +function pug_classes_object(r) { + var a = "", n = ""; + for (var o in r) o && r[o] && pug_has_own_property.call(r, o) && (a = a + n + o, + n = " "); + return a; +} + +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_has_own_property = Object.prototype.hasOwnProperty; + +var pug_match_html = /["&<>]/; + +function pug_style(r) { + if (!r) return ""; + if ("object" == typeof r) { + var t = ""; + for (var e in r) pug_has_own_property.call(r, e) && (t = t + e + ":" + r[e] + ";"); + return t; + } + return r += "", ";" !== r[r.length - 1] ? r + ";" : r; +} + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + var tag = "p"; + var foo = "bar"; + pug_html = pug_html + "<" + tag + ">value<" + tag + ' foo="bar">value<" + (foo ? "a" : "li") + ' something="something">here"; + pug_mixins["item"] = pug_interp = function(icon) { + var block = this && this.block, attributes = this && this.attributes || {}; + pug_html = pug_html + "
  • "; + if (attributes.href) { + pug_html = pug_html + ""; + block && block(); + pug_html = pug_html + ""; + } else { + pug_html = pug_html + ""; + block && block(); + pug_html = pug_html + ""; + } + pug_html = pug_html + "
  • "; + }; + pug_html = pug_html + "
      "; + pug_mixins["item"].call({ + block: function() { + pug_html = pug_html + "Contact"; + } + }, "contact"); + pug_mixins["item"].call({ + block: function() { + pug_html = pug_html + "Contact"; + }, + attributes: { + href: "/contact" + } + }); + pug_html = pug_html + "
    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/tags.self-closing.html b/node_modules/pug/test/output/tags.self-closing.html new file mode 100644 index 0000000..4f0bc7b --- /dev/null +++ b/node_modules/pug/test/output/tags.self-closing.html @@ -0,0 +1,14 @@ + + + + + + + / + / + + + / + / + + \ No newline at end of file diff --git a/node_modules/pug/test/output/tags.self-closing.js b/node_modules/pug/test/output/tags.self-closing.js new file mode 100644 index 0000000..7746740 --- /dev/null +++ b/node_modules/pug/test/output/tags.self-closing.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + '////'; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/template.html b/node_modules/pug/test/output/template.html new file mode 100644 index 0000000..2d05bce --- /dev/null +++ b/node_modules/pug/test/output/template.html @@ -0,0 +1,12 @@ + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/template.js b/node_modules/pug/test/output/template.js new file mode 100644 index 0000000..88c9571 --- /dev/null +++ b/node_modules/pug/test/output/template.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/text-block.html b/node_modules/pug/test/output/text-block.html new file mode 100644 index 0000000..4b9b34e --- /dev/null +++ b/node_modules/pug/test/output/text-block.html @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/text-block.js b/node_modules/pug/test/output/text-block.js new file mode 100644 index 0000000..ef97cd6 --- /dev/null +++ b/node_modules/pug/test/output/text-block.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/text.html b/node_modules/pug/test/output/text.html new file mode 100644 index 0000000..7ab78fa --- /dev/null +++ b/node_modules/pug/test/output/text.html @@ -0,0 +1,38 @@ + + +

    +

    +

    + foo + bar + + + baz +

    +

    + foo + + + bar + baz + +

    +foo + + +bar +baz + +
    foo
    +  bar
    +    baz
    +.
    +
    foo
    +  bar
    +    baz
    +.
    +
    +foo + bar + baz +. \ No newline at end of file diff --git a/node_modules/pug/test/output/text.js b/node_modules/pug/test/output/text.js new file mode 100644 index 0000000..0ffa7fa --- /dev/null +++ b/node_modules/pug/test/output/text.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + '

    foo\nbar\n\n\nbaz

    foo\n\n\nbar\nbaz\n

    foo\n\n\nbar\nbaz\n
    foo\n  bar\n    baz\n.
    foo\n  bar\n    baz\n.\n
    foo\n bar\n baz\n.'; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/utf8bom.html b/node_modules/pug/test/output/utf8bom.html new file mode 100644 index 0000000..d25c9ef --- /dev/null +++ b/node_modules/pug/test/output/utf8bom.html @@ -0,0 +1,2 @@ + +

    "foo"

    \ No newline at end of file diff --git a/node_modules/pug/test/output/utf8bom.js b/node_modules/pug/test/output/utf8bom.js new file mode 100644 index 0000000..7fc490b --- /dev/null +++ b/node_modules/pug/test/output/utf8bom.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + '

    "foo"

    '; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/vars.html b/node_modules/pug/test/output/vars.html new file mode 100644 index 0000000..e9b7590 --- /dev/null +++ b/node_modules/pug/test/output/vars.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/node_modules/pug/test/output/vars.js b/node_modules/pug/test/output/vars.js new file mode 100644 index 0000000..0488763 --- /dev/null +++ b/node_modules/pug/test/output/vars.js @@ -0,0 +1,64 @@ +function pug_attr(t, e, n, f) { + return e !== !1 && null != e && (e || "class" !== t && "style" !== t) ? e === !0 ? " " + (f ? t : t + '="' + t + '"') : ("function" == typeof e.toJSON && (e = e.toJSON()), + "string" == typeof e || (e = JSON.stringify(e), n || e.indexOf('"') === -1) ? (n && (e = pug_escape(e)), + " " + t + '="' + e + '"') : " " + t + "='" + e.replace(/'/g, "'") + "'") : ""; +} + +function pug_classes(s, r) { + return Array.isArray(s) ? pug_classes_array(s, r) : s && "object" == typeof s ? pug_classes_object(s) : s || ""; +} + +function pug_classes_array(r, a) { + for (var s, e = "", u = "", c = Array.isArray(a), g = 0; g < r.length; g++) s = pug_classes(r[g]), + s && (c && a[g] && (s = pug_escape(s)), e = e + u + s, u = " "); + return e; +} + +function pug_classes_object(r) { + var a = "", n = ""; + for (var o in r) o && r[o] && pug_has_own_property.call(r, o) && (a = a + n + o, + n = " "); + return a; +} + +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_has_own_property = Object.prototype.hasOwnProperty; + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + var foo = "bar"; + var list = [ 1, 2, 3 ]; + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/while.html b/node_modules/pug/test/output/while.html new file mode 100644 index 0000000..7518980 --- /dev/null +++ b/node_modules/pug/test/output/while.html @@ -0,0 +1,12 @@ + +
      +
    • 2
    • +
    • 3
    • +
    • 4
    • +
    • 5
    • +
    • 6
    • +
    • 7
    • +
    • 8
    • +
    • 9
    • +
    • 10
    • +
    \ No newline at end of file diff --git a/node_modules/pug/test/output/while.js b/node_modules/pug/test/output/while.js new file mode 100644 index 0000000..4befe2d --- /dev/null +++ b/node_modules/pug/test/output/while.js @@ -0,0 +1,43 @@ +function pug_escape(e) { + var a = "" + e, t = pug_match_html.exec(a); + if (!t) return e; + var r, c, n, s = ""; + for (r = t.index, c = 0; r < a.length; r++) { + switch (a.charCodeAt(r)) { + case 34: + n = """; + break; + + case 38: + n = "&"; + break; + + case 60: + n = "<"; + break; + + case 62: + n = ">"; + break; + + default: + continue; + } + c !== r && (s += a.substring(c, r)), c = r + 1, s += n; + } + return c !== r ? s + a.substring(c, r) : s; +} + +var pug_match_html = /["&<>]/; + +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + var x = 1; + pug_html = pug_html + "
      "; + while (x < 10) { + x++; + pug_html = pug_html + "
    • " + pug_escape(null == (pug_interp = x) ? "" : pug_interp) + "
    • "; + } + pug_html = pug_html + "
    "; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/xml.html b/node_modules/pug/test/output/xml.html new file mode 100644 index 0000000..5fd9f1a --- /dev/null +++ b/node_modules/pug/test/output/xml.html @@ -0,0 +1,3 @@ + + +http://google.com \ No newline at end of file diff --git a/node_modules/pug/test/output/xml.js b/node_modules/pug/test/output/xml.js new file mode 100644 index 0000000..3bfe675 --- /dev/null +++ b/node_modules/pug/test/output/xml.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + 'http://google.com'; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/yield-before-conditional-head.html b/node_modules/pug/test/output/yield-before-conditional-head.html new file mode 100644 index 0000000..c2efe94 --- /dev/null +++ b/node_modules/pug/test/output/yield-before-conditional-head.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/yield-before-conditional-head.js b/node_modules/pug/test/output/yield-before-conditional-head.js new file mode 100644 index 0000000..d470f7c --- /dev/null +++ b/node_modules/pug/test/output/yield-before-conditional-head.js @@ -0,0 +1,9 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + if (false) { + pug_html = pug_html + ''; + } + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/yield-before-conditional.html b/node_modules/pug/test/output/yield-before-conditional.html new file mode 100644 index 0000000..1dad26e --- /dev/null +++ b/node_modules/pug/test/output/yield-before-conditional.html @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/yield-before-conditional.js b/node_modules/pug/test/output/yield-before-conditional.js new file mode 100644 index 0000000..1e70d4b --- /dev/null +++ b/node_modules/pug/test/output/yield-before-conditional.js @@ -0,0 +1,9 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + if (false) { + pug_html = pug_html + ''; + } + pug_html = pug_html + ""; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/yield-head.html b/node_modules/pug/test/output/yield-head.html new file mode 100644 index 0000000..a9c8355 --- /dev/null +++ b/node_modules/pug/test/output/yield-head.html @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/yield-head.js b/node_modules/pug/test/output/yield-head.js new file mode 100644 index 0000000..f1f3f6f --- /dev/null +++ b/node_modules/pug/test/output/yield-head.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/yield-title-head.html b/node_modules/pug/test/output/yield-title-head.html new file mode 100644 index 0000000..b051088 --- /dev/null +++ b/node_modules/pug/test/output/yield-title-head.html @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/yield-title-head.js b/node_modules/pug/test/output/yield-title-head.js new file mode 100644 index 0000000..f45063a --- /dev/null +++ b/node_modules/pug/test/output/yield-title-head.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/yield-title.html b/node_modules/pug/test/output/yield-title.html new file mode 100644 index 0000000..128c5d4 --- /dev/null +++ b/node_modules/pug/test/output/yield-title.html @@ -0,0 +1,10 @@ + + + + + My Title + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/yield-title.js b/node_modules/pug/test/output/yield-title.js new file mode 100644 index 0000000..1b2156d --- /dev/null +++ b/node_modules/pug/test/output/yield-title.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + 'My Title'; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/output/yield.html b/node_modules/pug/test/output/yield.html new file mode 100644 index 0000000..46fa928 --- /dev/null +++ b/node_modules/pug/test/output/yield.html @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/node_modules/pug/test/output/yield.js b/node_modules/pug/test/output/yield.js new file mode 100644 index 0000000..7fc4c6e --- /dev/null +++ b/node_modules/pug/test/output/yield.js @@ -0,0 +1,5 @@ +function template(locals) { + var pug_html = "", pug_mixins = {}, pug_interp; + pug_html = pug_html + ''; + return pug_html; +} \ No newline at end of file diff --git a/node_modules/pug/test/pug.test.js b/node_modules/pug/test/pug.test.js new file mode 100644 index 0000000..608419d --- /dev/null +++ b/node_modules/pug/test/pug.test.js @@ -0,0 +1,1164 @@ +'use strict'; + +var assert = require('assert'); +var fs = require('fs'); +var path = require('path'); +var pug = require('../'); + +var perfTest = fs.readFileSync(__dirname + '/fixtures/perf.pug', 'utf8') + +try { + fs.mkdirSync(__dirname + '/temp'); +} catch (ex) { + if (ex.code !== 'EEXIST') { + throw ex; + } +} + +describe('pug', function(){ + + describe('unit tests with .render()', function(){ + it('should support doctypes', function(){ + assert.equal('', pug.render('doctype xml')); + assert.equal('', pug.render('doctype html')); + assert.equal('', pug.render('doctype foo bar baz')); + assert.equal('', pug.render('doctype html')); + assert.equal('', pug.render('doctype', { doctype:'html' })); + assert.equal('', pug.render('doctype html', { doctype:'xml' })); + assert.equal('', pug.render('html')); + assert.equal('', pug.render('html', { doctype:'html' })); + assert.equal('', pug.render('doctype html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN')); + }); + + it('should support Buffers', function(){ + assert.equal('

    foo

    ', pug.render(new Buffer('p foo'))); + }); + + it('should support line endings', function(){ + var src = [ + 'p', + 'div', + 'img' + ]; + + var html = [ + '

    ', + '
    ', + '' + ].join(''); + + assert.equal(html, pug.render(src.join('\n'))); + assert.equal(html, pug.render(src.join('\r'))); + assert.equal(html, pug.render(src.join('\r\n'))); + + html = [ + '

    ', + '
    ', + '' + ].join(''); + + assert.equal(html, pug.render(src.join('\n'), { doctype:'html' })); + assert.equal(html, pug.render(src.join('\r'), { doctype:'html' })); + assert.equal(html, pug.render(src.join('\r\n'), { doctype:'html' })); + }); + + it('should support single quotes', function(){ + assert.equal("

    'foo'

    ", pug.render("p 'foo'")); + assert.equal("

    'foo'

    ", pug.render("p\n | 'foo'")); + assert.equal('', pug.render("- var path = 'foo';\na(href='/' + path)")); + }); + + it('should support block-expansion', function(){ + assert.equal("
  • foo
  • bar
  • baz
  • ", pug.render("li: a foo\nli: a bar\nli: a baz")); + assert.equal("
  • foo
  • bar
  • baz
  • ", pug.render("li.first: a foo\nli: a bar\nli: a baz")); + assert.equal('
    baz
    ', pug.render(".foo: .bar baz")); + }); + + it('should support tags', function(){ + var str = [ + 'p', + 'div', + 'img', + 'br/' + ].join('\n'); + + var html = [ + '

    ', + '
    ', + '', + '
    ' + ].join(''); + + assert.equal(html, pug.render(str), 'Test basic tags'); + assert.equal('', pug.render('fb:foo-bar'), 'Test hyphens'); + assert.equal('
    ', pug.render('div.something'), 'Test classes'); + assert.equal('
    ', pug.render('div#something'), 'Test ids'); + assert.equal('
    ', pug.render('.something'), 'Test stand-alone classes'); + assert.equal('
    ', pug.render('#something'), 'Test stand-alone ids'); + assert.equal('
    ', pug.render('#foo.bar')); + assert.equal('
    ', pug.render('.bar#foo')); + assert.equal('
    ', pug.render('div#foo(class="bar")')); + assert.equal('
    ', pug.render('div(class="bar")#foo')); + assert.equal('
    ', pug.render('div(id="bar").foo')); + assert.equal('
    ', pug.render('div.foo.bar.baz')); + assert.equal('
    ', pug.render('div(class="foo").bar.baz')); + assert.equal('
    ', pug.render('div.foo(class="bar").baz')); + assert.equal('
    ', pug.render('div.foo.bar(class="baz")')); + assert.equal('
    ', pug.render('div.a-b2')); + assert.equal('
    ', pug.render('div.a_b2')); + assert.equal('', pug.render('fb:user')); + assert.equal('', pug.render('fb:user:role')); + assert.equal('', pug.render('colgroup\n col.test')); + }); + + it('should support nested tags', function(){ + var str = [ + 'ul', + ' li a', + ' li b', + ' li', + ' ul', + ' li c', + ' li d', + ' li e', + ].join('\n'); + + var html = [ + '
      ', + '
    • a
    • ', + '
    • b
    • ', + '
      • c
      • d
    • ', + '
    • e
    • ', + '
    ' + ].join(''); + + assert.equal(html, pug.render(str)); + + var str = [ + 'a(href="#")', + ' | foo ', + ' | bar ', + ' | baz' + ].join('\n'); + + assert.equal('foo \nbar \nbaz', pug.render(str)); + + var str = [ + 'ul', + ' li one', + ' ul', + ' | two', + ' li three' + ].join('\n'); + + var html = [ + '
      ', + '
    • one
    • ', + '
        two', + '
      • three
      • ', + '
      ', + '
    ' + ].join(''); + + assert.equal(html, pug.render(str)); + }); + + it('should support variable length newlines', function(){ + var str = [ + 'ul', + ' li a', + ' ', + ' li b', + ' ', + ' ', + ' li', + ' ul', + ' li c', + '', + ' li d', + ' li e', + ].join('\n'); + + var html = [ + '
      ', + '
    • a
    • ', + '
    • b
    • ', + '
      • c
      • d
    • ', + '
    • e
    • ', + '
    ' + ].join(''); + + assert.equal(html, pug.render(str)); + }); + + it('should support tab conversion', function(){ + var str = [ + 'ul', + '\tli a', + '\t', + '\tli b', + '\t\t', + '\t\t\t\t\t\t', + '\tli', + '\t\tul', + '\t\t\tli c', + '', + '\t\t\tli d', + '\tli e', + ].join('\n'); + + var html = [ + '
      ', + '
    • a
    • ', + '
    • b
    • ', + '
      • c
      • d
    • ', + '
    • e
    • ', + '
    ' + ].join(''); + + assert.equal(html, pug.render(str)); + }); + + it('should support newlines', function(){ + var str = [ + 'ul', + ' li a', + ' ', + ' ', + '', + ' ', + ' li b', + ' li', + ' ', + ' ', + ' ', + ' ul', + ' ', + ' li c', + ' li d', + ' li e', + ].join('\n'); + + var html = [ + '
      ', + '
    • a
    • ', + '
    • b
    • ', + '
      • c
      • d
    • ', + '
    • e
    • ', + '
    ' + ].join(''); + + assert.equal(html, pug.render(str)); + + var str = [ + 'html', + ' ', + ' head', + ' != "test"', + ' ', + ' ', + ' ', + ' body' + ].join('\n'); + + var html = [ + '', + '', + 'test', + '', + '', + '' + ].join(''); + + assert.equal(html, pug.render(str)); + assert.equal('something', pug.render('foo\n= "something"\nbar')); + assert.equal('somethingelse', pug.render('foo\n= "something"\nbar\n= "else"')); + }); + + it('should support text', function(){ + assert.equal('foo\nbar\nbaz', pug.render('| foo\n| bar\n| baz')); + assert.equal('foo \nbar \nbaz', pug.render('| foo \n| bar \n| baz')); + assert.equal('(hey)', pug.render('| (hey)')); + assert.equal('some random text', pug.render('| some random text')); + assert.equal(' foo', pug.render('| foo')); + assert.equal(' foo ', pug.render('| foo ')); + assert.equal(' foo \n bar ', pug.render('| foo \n| bar ')); + }); + + it('should support pipe-less text', function(){ + assert.equal('
    ', pug.render('pre\n code\n foo\n\n bar')); + assert.equal('

    foo\n\nbar

    ', pug.render('p.\n foo\n\n bar')); + assert.equal('

    foo\n\n\n\nbar

    ', pug.render('p.\n foo\n\n\n\n bar')); + assert.equal('

    foo\n bar\nfoo

    ', pug.render('p.\n foo\n bar\n foo')); + assert.equal('', pug.render('script.\n s.parentNode.insertBefore(g,s)\n')); + assert.equal('', pug.render('script.\n s.parentNode.insertBefore(g,s)')); + }); + + it('should support tag text', function(){ + assert.equal('

    some random text

    ', pug.render('p some random text')); + assert.equal('

    clickGoogle.

    ', pug.render('p\n | click\n a Google\n | .')); + assert.equal('

    (parens)

    ', pug.render('p (parens)')); + assert.equal('

    (parens)

    ', pug.render('p(foo="bar") (parens)')); + assert.equal('', pug.render('option(value="") -- (optional) foo --')); + }); + + it('should support tag text block', function(){ + assert.equal('

    foo \nbar \nbaz

    ', pug.render('p\n | foo \n | bar \n | baz')); + assert.equal('', pug.render('label\n | Password:\n input')); + assert.equal('', pug.render('label Password:\n input')); + }); + + it('should support tag text interpolation', function(){ + assert.equal('yo, pug is cool', pug.render('| yo, #{name} is cool\n', { name: 'pug' })); + assert.equal('

    yo, pug is cool

    ', pug.render('p yo, #{name} is cool', { name: 'pug' })); + assert.equal('yo, pug is cool', pug.render('| yo, #{name || "pug"} is cool', { name: null })); + assert.equal('yo, \'pug\' is cool', pug.render('| yo, #{name || "\'pug\'"} is cool', { name: null })); + assert.equal('foo <script> bar', pug.render('| foo #{code} bar', { code: '', + '', + '' + ].join(''); + + assert.equal(html, pug.render(str)); + }); + + it('should support comments', function(){ + // Regular + var str = [ + '//foo', + 'p bar' + ].join('\n'); + + var html = [ + '', + '

    bar

    ' + ].join(''); + + assert.equal(html, pug.render(str)); + + // Between tags + + var str = [ + 'p foo', + '// bar ', + 'p baz' + ].join('\n'); + + var html = [ + '

    foo

    ', + '', + '

    baz

    ' + ].join(''); + + assert.equal(html, pug.render(str)); + + // Quotes + + var str = "", + js = "// script(src: '/js/validate.js') "; + assert.equal(str, pug.render(js)); + }); + + it('should support unbuffered comments', function(){ + var str = [ + '//- foo', + 'p bar' + ].join('\n'); + + var html = [ + '

    bar

    ' + ].join(''); + + assert.equal(html, pug.render(str)); + + var str = [ + 'p foo', + '//- bar ', + 'p baz' + ].join('\n'); + + var html = [ + '

    foo

    ', + '

    baz

    ' + ].join(''); + + assert.equal(html, pug.render(str)); + }); + + it('should support literal html', function(){ + assert.equal('', pug.render('')); + }); + + it('should support code', function(){ + assert.equal('test', pug.render('!= "test"')); + assert.equal('test', pug.render('= "test"')); + assert.equal('test', pug.render('- var foo = "test"\n=foo')); + assert.equal('footestbar', pug.render('- var foo = "test"\n| foo\nem= foo\n| bar')); + assert.equal('test

    something

    ', pug.render('!= "test"\nh2 something')); + + var str = [ + '- var foo = "' + , pug.render(str, { filename: __dirname + '/pug.test.js' })); + }); + + it('should not fail on js newlines', function(){ + assert.equal("

    foo\u2028bar

    ", pug.render("p foo\u2028bar")); + assert.equal("

    foo\u2029bar

    ", pug.render("p foo\u2029bar")); + }); + + it('should display error line number correctly up to token level', function() { + var str = [ + 'p.', + ' Lorem ipsum dolor sit amet, consectetur', + ' adipisicing elit, sed do eiusmod tempor', + ' incididunt ut labore et dolore magna aliqua.', + 'p.', + ' Ut enim ad minim veniam, quis nostrud', + ' exercitation ullamco laboris nisi ut aliquip', + ' ex ea commodo consequat.', + 'p.', + ' Duis aute irure dolor in reprehenderit', + ' in voluptate velit esse cillum dolore eu', + ' fugiat nulla pariatur.', + 'a(href="#" Next', + ].join('\n'); + var errorLocation = function(str) { + try { + pug.render(str); + } catch (err) { + return err.message.split('\n')[0]; + } + }; + assert.equal(errorLocation(str), "Pug:13:16"); + }); + }); + + describe('.compileFile()', function () { + it('does not produce warnings for issue-1593', function () { + pug.compileFile(__dirname + '/fixtures/issue-1593/index.pug'); + }); + it('should support caching (pass 1)', function () { + fs.writeFileSync(__dirname + '/temp/input-compileFile.pug', '.foo bar'); + var fn = pug.compileFile(__dirname + '/temp/input-compileFile.pug', + { cache: true }); + var expected = '
    bar
    '; + assert(fn() === expected); + }); + it('should support caching (pass 2)', function () { + // Poison the input file + fs.writeFileSync(__dirname + '/temp/input-compileFile.pug', '.big fat hen'); + var fn = pug.compileFile(__dirname + '/temp/input-compileFile.pug', + { cache: true }); + var expected = '
    bar
    '; + assert(fn() === expected); + }); + }); + + describe('.render()', function () { + it('should support .pug.render(str, fn)', function(){ + pug.render('p foo bar', function(err, str){ + assert.ok(!err); + assert.equal('

    foo bar

    ', str); + }); + }); + + it('should support .pug.render(str, options, fn)', function(){ + pug.render('p #{foo}', { foo: 'bar' }, function(err, str){ + assert.ok(!err); + assert.equal('

    bar

    ', str); + }); + }); + + it('should support .pug.render(str, options, fn) cache', function(){ + pug.render('p bar', { cache: true }, function(err, str){ + assert.ok(/the "filename" option is required for caching/.test(err.message)); + }); + + pug.render('p foo bar', { cache: true, filename: 'test' }, function(err, str){ + assert.ok(!err); + assert.equal('

    foo bar

    ', str); + }); + }); + }) + + describe('.compile()', function(){ + it('should support .compile()', function(){ + var fn = pug.compile('p foo'); + assert.equal('

    foo

    ', fn()); + }); + + it('should support .compile() locals', function(){ + var fn = pug.compile('p= foo'); + assert.equal('

    bar

    ', fn({ foo: 'bar' })); + }); + + it('should support .compile() locals in \'self\' hash', function(){ + var fn = pug.compile('p= self.foo', {self: true}); + assert.equal('

    bar

    ', fn({ foo: 'bar' })); + }); + + it('should support .compile() no debug', function(){ + var fn = pug.compile('p foo\np #{bar}', {compileDebug: false}); + assert.equal('

    foo

    baz

    ', fn({bar: 'baz'})); + }); + + it('should support .compile() no debug and global helpers', function(){ + var fn = pug.compile('p foo\np #{bar}', {compileDebug: false, helpers: 'global'}); + assert.equal('

    foo

    baz

    ', fn({bar: 'baz'})); + }); + + it('should be reasonably fast', function(){ + pug.compile(perfTest, {}) + }); + it('allows trailing space (see #1586)', function () { + var res = pug.render('ul \n li An Item'); + assert.equal('
    • An Item
    ', res); + }); + }); + + describe('.compileClient()', function () { + it('should support .pug.compileClient(str)', function () { + var src = fs.readFileSync(__dirname + '/cases/basic.pug'); + var expected = fs.readFileSync(__dirname + '/cases/basic.html', 'utf8').replace(/\s/g, ''); + var fn = pug.compileClient(src); + fn = Function('pug', fn.toString() + '\nreturn template;')(pug.runtime); + var actual = fn({name: 'foo'}).replace(/\s/g, ''); + assert(actual === expected); + }); + it('should support .pug.compileClient(str, options)', function () { + var src = '.bar= self.foo' + var fn = pug.compileClient(src, {self: true}); + fn = Function('pug', fn.toString() + '\nreturn template;')(pug.runtime); + var actual = fn({foo: 'baz'}); + assert(actual === '
    baz
    '); + }); + }); + + describe('.renderFile()', function () { + it('will synchronously return a string', function () { + var expected = fs.readFileSync(__dirname + '/cases/basic.html', 'utf8').replace(/\s/g, ''); + var actual = pug.renderFile(__dirname + '/cases/basic.pug', {name: 'foo'}).replace(/\s/g, ''); + assert(actual === expected); + }); + it('when given a callback, it calls that rather than returning', function (done) { + var expected = fs.readFileSync(__dirname + '/cases/basic.html', 'utf8').replace(/\s/g, ''); + pug.renderFile(__dirname + '/cases/basic.pug', {name: 'foo'}, function (err, actual) { + if (err) return done(err); + assert(actual.replace(/\s/g, '') === expected); + done(); + }); + }); + it('when given a callback, it calls that rather than returning even if there are no options', function (done) { + var expected = fs.readFileSync(__dirname + '/cases/basic.html', 'utf8').replace(/\s/g, ''); + pug.renderFile(__dirname + '/cases/basic.pug', function (err, actual) { + if (err) return done(err); + assert(actual.replace(/\s/g, '') === expected); + done(); + }); + }); + it('when given a callback, it calls that with any errors', function (done) { + pug.renderFile(__dirname + '/fixtures/runtime.error.pug', function (err, actual) { + assert.ok(err); + done(); + }); + }); + it('should support caching (pass 1)', function (done) { + fs.writeFileSync(__dirname + '/temp/input-renderFile.pug', '.foo bar'); + pug.renderFile(__dirname + '/temp/input-renderFile.pug', { cache: true }, function (err, actual) { + if (err) return done(err); + assert.equal('
    bar
    ', actual); + done(); + }); + }); + it('should support caching (pass 2)', function (done) { + // Poison the input file + fs.writeFileSync(__dirname + '/temp/input-renderFile.pug', '.big fat hen'); + pug.renderFile(__dirname + '/temp/input-renderFile.pug', { cache: true }, function (err, actual) { + if (err) return done(err); + assert.equal('
    bar
    ', actual); + done(); + }); + }); + }); + + describe('.compileFileClient(path, options)', function () { + it('returns a string form of a function called `template`', function () { + var src = pug.compileFileClient(__dirname + '/cases/basic.pug'); + var expected = fs.readFileSync(__dirname + '/cases/basic.html', 'utf8').replace(/\s/g, ''); + var fn = Function('pug', src + '\nreturn template;')(pug.runtime); + var actual = fn({name: 'foo'}).replace(/\s/g, ''); + assert(actual === expected); + }); + it('accepts the `name` option to rename the resulting function', function () { + var src = pug.compileFileClient(__dirname + '/cases/basic.pug', {name: 'myTemplateName'}); + var expected = fs.readFileSync(__dirname + '/cases/basic.html', 'utf8').replace(/\s/g, ''); + var fn = Function('pug', src + '\nreturn myTemplateName;')(pug.runtime); + var actual = fn({name: 'foo'}).replace(/\s/g, ''); + assert(actual === expected); + }); + it('should support caching (pass 1)', function () { + fs.writeFileSync(__dirname + '/temp/input-compileFileClient.pug', '.foo bar'); + var src = pug.compileFileClient(__dirname + '/temp/input-compileFileClient.pug', + { name: 'myTemplateName', + cache: true }); + var expected = '
    bar
    '; + var fn = Function('pug', src + '\nreturn myTemplateName;')(pug.runtime); + assert(fn() === expected); + }); + it('should support caching (pass 2)', function () { + // Poison the input file + fs.writeFileSync(__dirname + '/temp/input-compileFileClient.pug', '.big fat hen'); + var src = pug.compileFileClient(__dirname + '/temp/input-compileFileClient.pug', + { name: 'myTemplateName', + cache: true }); + var expected = '
    bar
    '; + var fn = Function('pug', src + '\nreturn myTemplateName;')(pug.runtime); + assert(fn() === expected); + }); + }); + + describe('.runtime', function () { + describe('.merge', function () { + it('merges two attribute objects, giving precedensce to the second object', function () { + assert.deepEqual(pug.runtime.merge({}, {'class': ['foo', 'bar'], 'foo': 'bar'}), {'class': ['foo', 'bar'], 'foo': 'bar'}); + assert.deepEqual(pug.runtime.merge({'class': ['foo'], 'foo': 'baz'}, {'class': ['bar'], 'foo': 'bar'}), {'class': ['foo', 'bar'], 'foo': 'bar'}); + assert.deepEqual(pug.runtime.merge({'class': ['foo', 'bar'], 'foo': 'bar'}, {}), {'class': ['foo', 'bar'], 'foo': 'bar'}); + }); + }); + describe('.attrs', function () { + it('Renders the given attributes object', function () { + assert.equal(pug.runtime.attrs({}), ''); + assert.equal(pug.runtime.attrs({'class': []}), ''); + assert.equal(pug.runtime.attrs({'class': ['foo']}), ' class="foo"'); + assert.equal(pug.runtime.attrs({'class': ['foo'], 'id': 'bar'}), ' class="foo" id="bar"'); + }); + }); + }); + + describe('filter indentation', function () { + it('is maintained', function () { + var filters = { + indents: function(str){ + return str.split(/\n/).map(function (line) { return line.match(/^ */)[0].length; }).join(","); + } + }; + + var indents = [ + ':indents', + ' x', + ' x', + ' x', + ' x', + ' x', + ' x', + ' x', + ' x', + ' x', + ' x', + ' x', + ' x', + ' x', + ' x', + ' x' + ].join('\n'); + + assert.equal(pug.render(indents, {filters: filters}), '0,1,2,3,0,4,4,3,3,4,2,0,2,0,1'); + }); + }); + + describe('.compile().dependencies', function() { + it('should list the filename of the template referenced by extends', function(){ + var filename = __dirname + '/dependencies/extends1.pug'; + var str = fs.readFileSync(filename, 'utf8'); + var info = pug.compile(str, {filename: filename}); + assert.deepEqual([ + path.resolve(__dirname + '/dependencies/dependency1.pug') + ], info.dependencies); + }); + it('should list the filename of the template referenced by an include', function() { + var filename = __dirname + '/dependencies/include1.pug'; + var str = fs.readFileSync(filename, 'utf8'); + var info = pug.compile(str, {filename: filename}); + assert.deepEqual([ + path.resolve(__dirname + '/dependencies/dependency1.pug') + ], info.dependencies); + }); + it('should list the dependencies of extends dependencies', function() { + var filename = __dirname + '/dependencies/extends2.pug'; + var str = fs.readFileSync(filename, 'utf8'); + var info = pug.compile(str, {filename: filename}); + assert.deepEqual([ + path.resolve(__dirname + '/dependencies/dependency2.pug'), + path.resolve(__dirname + '/dependencies/dependency3.pug') + ], info.dependencies); + }); + it('should list the dependencies of include dependencies', function() { + var filename = __dirname + '/dependencies/include2.pug'; + var str = fs.readFileSync(filename, 'utf8'); + var info = pug.compile(str, {filename: filename}); + assert.deepEqual([ + path.resolve(__dirname + '/dependencies/dependency2.pug'), + path.resolve(__dirname + '/dependencies/dependency3.pug') + ],info.dependencies); + }); + }); + + describe('.name', function() { + it('should have a name attribute', function() { + assert.strictEqual(pug.name, 'Pug'); + }); + }); +}); diff --git a/node_modules/pug/test/run-es2015.test.js b/node_modules/pug/test/run-es2015.test.js new file mode 100644 index 0000000..0ab14df --- /dev/null +++ b/node_modules/pug/test/run-es2015.test.js @@ -0,0 +1,21 @@ +'use strict'; + +const fs = require('fs'); +const assert = require('assert'); +const mkdirp = require('mkdirp').sync; +const runUtils = require('./run-utils'); +const pug = require('../'); + +var cases = runUtils.findCases(__dirname + '/cases'); +var es2015 = runUtils.findCases(__dirname + '/cases-es2015'); + +mkdirp(__dirname + '/output-es2015'); + +describe('test cases for ECMAScript 2015', function () { + try { + eval('``'); + es2015.forEach(runUtils.testSingle.bind(null, it, '-es2015')); + } catch (ex) { + es2015.forEach(runUtils.testSingle.bind(null, it.skip, '-es2015')); + } +}); diff --git a/node_modules/pug/test/run-syntax-errors.test.js b/node_modules/pug/test/run-syntax-errors.test.js new file mode 100644 index 0000000..8a0a54a --- /dev/null +++ b/node_modules/pug/test/run-syntax-errors.test.js @@ -0,0 +1,34 @@ +const assert = require('assert'); +const fs = require('fs'); +const runUtils = require('./run-utils'); +const pug = require('../'); + +const anti = runUtils.findCases(__dirname + '/anti-cases'); + +describe('certain syntax is not allowed and will throw a compile time error', function () { + anti.forEach(function(test){ + var name = test.replace(/[-.]/g, ' '); + it(name, function(){ + var path = __dirname.replace(/\\/g, '/') + '/anti-cases/' + test + '.pug'; + var str = fs.readFileSync(path, 'utf8'); + try { + var fn = pug.compile(str, { + filename: path, + pretty: true, + basedir: __dirname + '/anti-cases', + filters: runUtils.filters + }); + } catch (ex) { + if (!ex.code) { + throw ex; + } + assert(ex instanceof Error, 'Should throw a real Error'); + assert(ex.code.indexOf('PUG:') === 0, 'It should have a code of "PUG:SOMETHING"'); + assert(ex.message.replace(/\\/g, '/').indexOf(path) === 0, 'it should start with the path'); + assert(/:\d+$/m.test(ex.message.replace(/\\/g, '/')), 'it should include a line number.'); + return; + } + throw new Error(test + ' should have thrown an error'); + }) + }); +}); diff --git a/node_modules/pug/test/run-utils.js b/node_modules/pug/test/run-utils.js new file mode 100644 index 0000000..5307898 --- /dev/null +++ b/node_modules/pug/test/run-utils.js @@ -0,0 +1,106 @@ +var fs = require('fs'); +var assert = require('assert'); +var pug = require('../'); +var uglify = require('uglify-js'); +var mkdirp = require('mkdirp').sync; + +var filters = { + custom: function (str, options) { + assert(options.opt === 'val'); + assert(options.num === 2); + return 'BEGIN' + str + 'END'; + } +}; + +// test cases + +function writeFileSync(filename, data) { + try { + if (fs.readFileSync(filename, 'utf8') === data.toString('utf8')) { + return; + } + } catch (ex) { + if (ex.code !== 'ENOENT') { + throw ex; + } + } + fs.writeFileSync(filename, data); +} + +function findCases(dir) { + return fs.readdirSync(dir).filter(function(file){ + return ~file.indexOf('.pug'); + }).map(function(file){ + return file.replace('.pug', ''); + }); +} + +function testSingle(it, suffix, test){ + var name = test.replace(/[-.]/g, ' '); + it(name, function(){ + var path = __dirname + '/cases' + suffix + '/' + test + '.pug'; + var str = fs.readFileSync(path, 'utf8'); + var fn = pug.compile(str, { + filename: path, + pretty: true, + basedir: __dirname + '/cases' + suffix, + filters: filters, + filterAliases: {'markdown': 'markdown-it'}, + }); + var actual = fn({ title: 'Pug' }); + + writeFileSync(__dirname + '/output' + suffix + '/' + test + '.html', actual); + + var html = fs.readFileSync(__dirname + '/cases' + suffix + '/' + test + '.html', 'utf8').trim().replace(/\r/g, ''); + var clientCode = uglify.minify(pug.compileClient(str, { + filename: path, + pretty: true, + compileDebug: false, + basedir: __dirname + '/cases' + suffix, + filters: filters, + filterAliases: {'markdown': 'markdown-it'}, + }), {output: {beautify: true}, mangle: false, compress: false, fromString: true}).code; + var clientCodeDebug = uglify.minify(pug.compileClient(str, { + filename: path, + pretty: true, + compileDebug: true, + basedir: __dirname + '/cases' + suffix, + filters: filters, + filterAliases: {'markdown': 'markdown-it'}, + }), {output: {beautify: true}, mangle: false, compress: false, fromString: true}).code; + writeFileSync(__dirname + '/output' + suffix + '/' + test + '.js', uglify.minify(pug.compileClient(str, { + filename: path, + pretty: false, + compileDebug: false, + basedir: __dirname + '/cases' + suffix, + filters: filters, + filterAliases: {'markdown': 'markdown-it'}, + }), {output: {beautify: true}, mangle: false, compress: false, fromString: true}).code); + if (/filter/.test(test)) { + actual = actual.replace(/\n| /g, ''); + html = html.replace(/\n| /g, ''); + } + if (/mixins-unused/.test(test)) { + assert(/never-called/.test(str), 'never-called is in the pug file for mixins-unused'); + assert(!/never-called/.test(clientCode), 'never-called should be removed from the code'); + } + expect(actual.trim()).toEqual(html); + actual = Function('pug', clientCode + '\nreturn template;')()({ title: 'Pug' }); + if (/filter/.test(test)) { + actual = actual.replace(/\n| /g, ''); + } + expect(actual.trim()).toEqual(html); + actual = Function('pug', clientCodeDebug + '\nreturn template;')()({ title: 'Pug' }); + if (/filter/.test(test)) { + actual = actual.replace(/\n| /g, ''); + } + expect(actual.trim()).toEqual(html); + }); +} + + +module.exports = { + filters, + findCases, + testSingle, +}; diff --git a/node_modules/pug/test/run.test.js b/node_modules/pug/test/run.test.js new file mode 100644 index 0000000..83a668f --- /dev/null +++ b/node_modules/pug/test/run.test.js @@ -0,0 +1,20 @@ +'use strict'; + +// even and odd tests are arbitrarily split because jest is faster that way + +const fs = require('fs'); +const assert = require('assert'); +const mkdirp = require('mkdirp').sync; +const runUtils = require('./run-utils'); +const pug = require('../'); + +var cases = runUtils.findCases(__dirname + '/cases'); +var es2015 = runUtils.findCases(__dirname + '/cases-es2015'); + +mkdirp(__dirname + '/output'); + +describe('test cases', function () { + cases.forEach((test, i) => { + runUtils.testSingle(it, '', test); + }); +}); diff --git a/node_modules/pug/test/temp/input-compileFile.pug b/node_modules/pug/test/temp/input-compileFile.pug new file mode 100644 index 0000000..7a3caea --- /dev/null +++ b/node_modules/pug/test/temp/input-compileFile.pug @@ -0,0 +1 @@ +.big fat hen \ No newline at end of file diff --git a/node_modules/pug/test/temp/input-compileFileClient.pug b/node_modules/pug/test/temp/input-compileFileClient.pug new file mode 100644 index 0000000..7a3caea --- /dev/null +++ b/node_modules/pug/test/temp/input-compileFileClient.pug @@ -0,0 +1 @@ +.big fat hen \ No newline at end of file diff --git a/node_modules/pug/test/temp/input-renderFile.pug b/node_modules/pug/test/temp/input-renderFile.pug new file mode 100644 index 0000000..7a3caea --- /dev/null +++ b/node_modules/pug/test/temp/input-renderFile.pug @@ -0,0 +1 @@ +.big fat hen \ No newline at end of file diff --git a/node_modules/qs/.editorconfig b/node_modules/qs/.editorconfig new file mode 100644 index 0000000..b2654e7 --- /dev/null +++ b/node_modules/qs/.editorconfig @@ -0,0 +1,30 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 140 + +[test/*] +max_line_length = off + +[*.md] +max_line_length = off + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[LICENSE] +indent_size = 2 +max_line_length = off diff --git a/node_modules/qs/.eslintignore b/node_modules/qs/.eslintignore new file mode 100644 index 0000000..1521c8b --- /dev/null +++ b/node_modules/qs/.eslintignore @@ -0,0 +1 @@ +dist diff --git a/node_modules/qs/.eslintrc b/node_modules/qs/.eslintrc new file mode 100644 index 0000000..a33d179 --- /dev/null +++ b/node_modules/qs/.eslintrc @@ -0,0 +1,19 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "complexity": [2, 28], + "consistent-return": 1, + "func-name-matching": 0, + "id-length": [2, { "min": 1, "max": 25, "properties": "never" }], + "indent": [2, 4], + "max-params": [2, 12], + "max-statements": [2, 45], + "no-continue": 1, + "no-magic-numbers": 0, + "no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"], + "operator-linebreak": [2, "before"], + } +} diff --git a/node_modules/qs/CHANGELOG.md b/node_modules/qs/CHANGELOG.md new file mode 100644 index 0000000..71d5a3e --- /dev/null +++ b/node_modules/qs/CHANGELOG.md @@ -0,0 +1,221 @@ +## **6.5.1** +- [Fix] Fix parsing & compacting very deep objects (#224) +- [Refactor] name utils functions +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` +- [Tests] up to `node` `v8.4`; use `nvm install-latest-npm` so newer npm doesn’t break older node +- [Tests] Use precise dist for Node.js 0.6 runtime (#225) +- [Tests] make 0.6 required, now that it’s passing +- [Tests] on `node` `v8.2`; fix npm on node 0.6 + +## **6.5.0** +- [New] add `utils.assign` +- [New] pass default encoder/decoder to custom encoder/decoder functions (#206) +- [New] `parse`/`stringify`: add `ignoreQueryPrefix`/`addQueryPrefix` options, respectively (#213) +- [Fix] Handle stringifying empty objects with addQueryPrefix (#217) +- [Fix] do not mutate `options` argument (#207) +- [Refactor] `parse`: cache index to reuse in else statement (#182) +- [Docs] add various badges to readme (#208) +- [Dev Deps] update `eslint`, `browserify`, `iconv-lite`, `tape` +- [Tests] up to `node` `v8.1`, `v7.10`, `v6.11`; npm v4.6 breaks on node < v1; npm v5+ breaks on node < v4 +- [Tests] add `editorconfig-tools` + +## **6.4.0** +- [New] `qs.stringify`: add `encodeValuesOnly` option +- [Fix] follow `allowPrototypes` option during merge (#201, #201) +- [Fix] support keys starting with brackets (#202, #200) +- [Fix] chmod a-x +- [Dev Deps] update `eslint` +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds +- [eslint] reduce warnings + +## **6.3.2** +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Dev Deps] update `eslint` +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.3.1** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties (thanks, @snyk!) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `browserify`, `iconv-lite`, `qs-iconv`, `tape` +- [Tests] on all node minors; improve test matrix +- [Docs] document stringify option `allowDots` (#195) +- [Docs] add empty object and array values example (#195) +- [Docs] Fix minor inconsistency/typo (#192) +- [Docs] document stringify option `sort` (#191) +- [Refactor] `stringify`: throw faster with an invalid encoder +- [Refactor] remove unnecessary escapes (#184) +- Remove contributing.md, since `qs` is no longer part of `hapi` (#183) + +## **6.3.0** +- [New] Add support for RFC 1738 (#174, #173) +- [New] `stringify`: Add `serializeDate` option to customize Date serialization (#159) +- [Fix] ensure `utils.merge` handles merging two arrays +- [Refactor] only constructors should be capitalized +- [Refactor] capitalized var names are for constructors only +- [Refactor] avoid using a sparse array +- [Robustness] `formats`: cache `String#replace` +- [Dev Deps] update `browserify`, `eslint`, `@ljharb/eslint-config`; add `safe-publish-latest` +- [Tests] up to `node` `v6.8`, `v4.6`; improve test matrix +- [Tests] flesh out arrayLimit/arrayFormat tests (#107) +- [Tests] skip Object.create tests when null objects are not available +- [Tests] Turn on eslint for test files (#175) + +## **6.2.3** +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.2.2** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties + +## **6.2.1** +- [Fix] ensure `key[]=x&key[]&key[]=y` results in 3, not 2, values +- [Refactor] Be explicit and use `Object.prototype.hasOwnProperty.call` +- [Tests] remove `parallelshell` since it does not reliably report failures +- [Tests] up to `node` `v6.3`, `v5.12` +- [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config`, `qs-iconv` + +## [**6.2.0**](https://github.com/ljharb/qs/issues?milestone=36&state=closed) +- [New] pass Buffers to the encoder/decoder directly (#161) +- [New] add "encoder" and "decoder" options, for custom param encoding/decoding (#160) +- [Fix] fix compacting of nested sparse arrays (#150) + +## **6.1.2 +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.1.1** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties + +## [**6.1.0**](https://github.com/ljharb/qs/issues?milestone=35&state=closed) +- [New] allowDots option for `stringify` (#151) +- [Fix] "sort" option should work at a depth of 3 or more (#151) +- [Fix] Restore `dist` directory; will be removed in v7 (#148) + +## **6.0.4** +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.0.3** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties +- [Fix] Restore `dist` directory; will be removed in v7 (#148) + +## [**6.0.2**](https://github.com/ljharb/qs/issues?milestone=33&state=closed) +- Revert ES6 requirement and restore support for node down to v0.8. + +## [**6.0.1**](https://github.com/ljharb/qs/issues?milestone=32&state=closed) +- [**#127**](https://github.com/ljharb/qs/pull/127) Fix engines definition in package.json + +## [**6.0.0**](https://github.com/ljharb/qs/issues?milestone=31&state=closed) +- [**#124**](https://github.com/ljharb/qs/issues/124) Use ES6 and drop support for node < v4 + +## **5.2.1** +- [Fix] ensure `key[]=x&key[]&key[]=y` results in 3, not 2, values + +## [**5.2.0**](https://github.com/ljharb/qs/issues?milestone=30&state=closed) +- [**#64**](https://github.com/ljharb/qs/issues/64) Add option to sort object keys in the query string + +## [**5.1.0**](https://github.com/ljharb/qs/issues?milestone=29&state=closed) +- [**#117**](https://github.com/ljharb/qs/issues/117) make URI encoding stringified results optional +- [**#106**](https://github.com/ljharb/qs/issues/106) Add flag `skipNulls` to optionally skip null values in stringify + +## [**5.0.0**](https://github.com/ljharb/qs/issues?milestone=28&state=closed) +- [**#114**](https://github.com/ljharb/qs/issues/114) default allowDots to false +- [**#100**](https://github.com/ljharb/qs/issues/100) include dist to npm + +## [**4.0.0**](https://github.com/ljharb/qs/issues?milestone=26&state=closed) +- [**#98**](https://github.com/ljharb/qs/issues/98) make returning plain objects and allowing prototype overwriting properties optional + +## [**3.1.0**](https://github.com/ljharb/qs/issues?milestone=24&state=closed) +- [**#89**](https://github.com/ljharb/qs/issues/89) Add option to disable "Transform dot notation to bracket notation" + +## [**3.0.0**](https://github.com/ljharb/qs/issues?milestone=23&state=closed) +- [**#80**](https://github.com/ljharb/qs/issues/80) qs.parse silently drops properties +- [**#77**](https://github.com/ljharb/qs/issues/77) Perf boost +- [**#60**](https://github.com/ljharb/qs/issues/60) Add explicit option to disable array parsing +- [**#74**](https://github.com/ljharb/qs/issues/74) Bad parse when turning array into object +- [**#81**](https://github.com/ljharb/qs/issues/81) Add a `filter` option +- [**#68**](https://github.com/ljharb/qs/issues/68) Fixed issue with recursion and passing strings into objects. +- [**#66**](https://github.com/ljharb/qs/issues/66) Add mixed array and object dot notation support Closes: #47 +- [**#76**](https://github.com/ljharb/qs/issues/76) RFC 3986 +- [**#85**](https://github.com/ljharb/qs/issues/85) No equal sign +- [**#84**](https://github.com/ljharb/qs/issues/84) update license attribute + +## [**2.4.1**](https://github.com/ljharb/qs/issues?milestone=20&state=closed) +- [**#73**](https://github.com/ljharb/qs/issues/73) Property 'hasOwnProperty' of object # is not a function + +## [**2.4.0**](https://github.com/ljharb/qs/issues?milestone=19&state=closed) +- [**#70**](https://github.com/ljharb/qs/issues/70) Add arrayFormat option + +## [**2.3.3**](https://github.com/ljharb/qs/issues?milestone=18&state=closed) +- [**#59**](https://github.com/ljharb/qs/issues/59) make sure array indexes are >= 0, closes #57 +- [**#58**](https://github.com/ljharb/qs/issues/58) make qs usable for browser loader + +## [**2.3.2**](https://github.com/ljharb/qs/issues?milestone=17&state=closed) +- [**#55**](https://github.com/ljharb/qs/issues/55) allow merging a string into an object + +## [**2.3.1**](https://github.com/ljharb/qs/issues?milestone=16&state=closed) +- [**#52**](https://github.com/ljharb/qs/issues/52) Return "undefined" and "false" instead of throwing "TypeError". + +## [**2.3.0**](https://github.com/ljharb/qs/issues?milestone=15&state=closed) +- [**#50**](https://github.com/ljharb/qs/issues/50) add option to omit array indices, closes #46 + +## [**2.2.5**](https://github.com/ljharb/qs/issues?milestone=14&state=closed) +- [**#39**](https://github.com/ljharb/qs/issues/39) Is there an alternative to Buffer.isBuffer? +- [**#49**](https://github.com/ljharb/qs/issues/49) refactor utils.merge, fixes #45 +- [**#41**](https://github.com/ljharb/qs/issues/41) avoid browserifying Buffer, for #39 + +## [**2.2.4**](https://github.com/ljharb/qs/issues?milestone=13&state=closed) +- [**#38**](https://github.com/ljharb/qs/issues/38) how to handle object keys beginning with a number + +## [**2.2.3**](https://github.com/ljharb/qs/issues?milestone=12&state=closed) +- [**#37**](https://github.com/ljharb/qs/issues/37) parser discards first empty value in array +- [**#36**](https://github.com/ljharb/qs/issues/36) Update to lab 4.x + +## [**2.2.2**](https://github.com/ljharb/qs/issues?milestone=11&state=closed) +- [**#33**](https://github.com/ljharb/qs/issues/33) Error when plain object in a value +- [**#34**](https://github.com/ljharb/qs/issues/34) use Object.prototype.hasOwnProperty.call instead of obj.hasOwnProperty +- [**#24**](https://github.com/ljharb/qs/issues/24) Changelog? Semver? + +## [**2.2.1**](https://github.com/ljharb/qs/issues?milestone=10&state=closed) +- [**#32**](https://github.com/ljharb/qs/issues/32) account for circular references properly, closes #31 +- [**#31**](https://github.com/ljharb/qs/issues/31) qs.parse stackoverflow on circular objects + +## [**2.2.0**](https://github.com/ljharb/qs/issues?milestone=9&state=closed) +- [**#26**](https://github.com/ljharb/qs/issues/26) Don't use Buffer global if it's not present +- [**#30**](https://github.com/ljharb/qs/issues/30) Bug when merging non-object values into arrays +- [**#29**](https://github.com/ljharb/qs/issues/29) Don't call Utils.clone at the top of Utils.merge +- [**#23**](https://github.com/ljharb/qs/issues/23) Ability to not limit parameters? + +## [**2.1.0**](https://github.com/ljharb/qs/issues?milestone=8&state=closed) +- [**#22**](https://github.com/ljharb/qs/issues/22) Enable using a RegExp as delimiter + +## [**2.0.0**](https://github.com/ljharb/qs/issues?milestone=7&state=closed) +- [**#18**](https://github.com/ljharb/qs/issues/18) Why is there arrayLimit? +- [**#20**](https://github.com/ljharb/qs/issues/20) Configurable parametersLimit +- [**#21**](https://github.com/ljharb/qs/issues/21) make all limits optional, for #18, for #20 + +## [**1.2.2**](https://github.com/ljharb/qs/issues?milestone=6&state=closed) +- [**#19**](https://github.com/ljharb/qs/issues/19) Don't overwrite null values + +## [**1.2.1**](https://github.com/ljharb/qs/issues?milestone=5&state=closed) +- [**#16**](https://github.com/ljharb/qs/issues/16) ignore non-string delimiters +- [**#15**](https://github.com/ljharb/qs/issues/15) Close code block + +## [**1.2.0**](https://github.com/ljharb/qs/issues?milestone=4&state=closed) +- [**#12**](https://github.com/ljharb/qs/issues/12) Add optional delim argument +- [**#13**](https://github.com/ljharb/qs/issues/13) fix #11: flattened keys in array are now correctly parsed + +## [**1.1.0**](https://github.com/ljharb/qs/issues?milestone=3&state=closed) +- [**#7**](https://github.com/ljharb/qs/issues/7) Empty values of a POST array disappear after being submitted +- [**#9**](https://github.com/ljharb/qs/issues/9) Should not omit equals signs (=) when value is null +- [**#6**](https://github.com/ljharb/qs/issues/6) Minor grammar fix in README + +## [**1.0.2**](https://github.com/ljharb/qs/issues?milestone=2&state=closed) +- [**#5**](https://github.com/ljharb/qs/issues/5) array holes incorrectly copied into object on large index diff --git a/node_modules/qs/LICENSE b/node_modules/qs/LICENSE new file mode 100644 index 0000000..d456948 --- /dev/null +++ b/node_modules/qs/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2014 Nathan LaFreniere and other contributors. +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. + * The names of any contributors may not 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 HOLDERS AND 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. + + * * * + +The complete list of contributors can be found at: https://github.com/hapijs/qs/graphs/contributors diff --git a/node_modules/qs/README.md b/node_modules/qs/README.md new file mode 100644 index 0000000..d811966 --- /dev/null +++ b/node_modules/qs/README.md @@ -0,0 +1,475 @@ +# qs [![Version Badge][2]][1] + +[![Build Status][3]][4] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +A querystring parsing and stringifying library with some added security. + +Lead Maintainer: [Jordan Harband](https://github.com/ljharb) + +The **qs** module was originally created and maintained by [TJ Holowaychuk](https://github.com/visionmedia/node-querystring). + +## Usage + +```javascript +var qs = require('qs'); +var assert = require('assert'); + +var obj = qs.parse('a=c'); +assert.deepEqual(obj, { a: 'c' }); + +var str = qs.stringify(obj); +assert.equal(str, 'a=c'); +``` + +### Parsing Objects + +[](#preventEval) +```javascript +qs.parse(string, [options]); +``` + +**qs** allows you to create nested objects within your query strings, by surrounding the name of sub-keys with square brackets `[]`. +For example, the string `'foo[bar]=baz'` converts to: + +```javascript +assert.deepEqual(qs.parse('foo[bar]=baz'), { + foo: { + bar: 'baz' + } +}); +``` + +When using the `plainObjects` option the parsed value is returned as a null object, created via `Object.create(null)` and as such you should be aware that prototype methods will not exist on it and a user may set those names to whatever value they like: + +```javascript +var nullObject = qs.parse('a[hasOwnProperty]=b', { plainObjects: true }); +assert.deepEqual(nullObject, { a: { hasOwnProperty: 'b' } }); +``` + +By default parameters that would overwrite properties on the object prototype are ignored, if you wish to keep the data from those fields either use `plainObjects` as mentioned above, or set `allowPrototypes` to `true` which will allow user input to overwrite those properties. *WARNING* It is generally a bad idea to enable this option as it can cause problems when attempting to use the properties that have been overwritten. Always be careful with this option. + +```javascript +var protoObject = qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }); +assert.deepEqual(protoObject, { a: { hasOwnProperty: 'b' } }); +``` + +URI encoded strings work too: + +```javascript +assert.deepEqual(qs.parse('a%5Bb%5D=c'), { + a: { b: 'c' } +}); +``` + +You can also nest your objects, like `'foo[bar][baz]=foobarbaz'`: + +```javascript +assert.deepEqual(qs.parse('foo[bar][baz]=foobarbaz'), { + foo: { + bar: { + baz: 'foobarbaz' + } + } +}); +``` + +By default, when nesting objects **qs** will only parse up to 5 children deep. This means if you attempt to parse a string like +`'a[b][c][d][e][f][g][h][i]=j'` your resulting object will be: + +```javascript +var expected = { + a: { + b: { + c: { + d: { + e: { + f: { + '[g][h][i]': 'j' + } + } + } + } + } + } +}; +var string = 'a[b][c][d][e][f][g][h][i]=j'; +assert.deepEqual(qs.parse(string), expected); +``` + +This depth can be overridden by passing a `depth` option to `qs.parse(string, [options])`: + +```javascript +var deep = qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1 }); +assert.deepEqual(deep, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }); +``` + +The depth limit helps mitigate abuse when **qs** is used to parse user input, and it is recommended to keep it a reasonably small number. + +For similar reasons, by default **qs** will only parse up to 1000 parameters. This can be overridden by passing a `parameterLimit` option: + +```javascript +var limited = qs.parse('a=b&c=d', { parameterLimit: 1 }); +assert.deepEqual(limited, { a: 'b' }); +``` + +To bypass the leading question mark, use `ignoreQueryPrefix`: + +```javascript +var prefixed = qs.parse('?a=b&c=d', { ignoreQueryPrefix: true }); +assert.deepEqual(prefixed, { a: 'b', c: 'd' }); +``` + +An optional delimiter can also be passed: + +```javascript +var delimited = qs.parse('a=b;c=d', { delimiter: ';' }); +assert.deepEqual(delimited, { a: 'b', c: 'd' }); +``` + +Delimiters can be a regular expression too: + +```javascript +var regexed = qs.parse('a=b;c=d,e=f', { delimiter: /[;,]/ }); +assert.deepEqual(regexed, { a: 'b', c: 'd', e: 'f' }); +``` + +Option `allowDots` can be used to enable dot notation: + +```javascript +var withDots = qs.parse('a.b=c', { allowDots: true }); +assert.deepEqual(withDots, { a: { b: 'c' } }); +``` + +### Parsing Arrays + +**qs** can also parse arrays using a similar `[]` notation: + +```javascript +var withArray = qs.parse('a[]=b&a[]=c'); +assert.deepEqual(withArray, { a: ['b', 'c'] }); +``` + +You may specify an index as well: + +```javascript +var withIndexes = qs.parse('a[1]=c&a[0]=b'); +assert.deepEqual(withIndexes, { a: ['b', 'c'] }); +``` + +Note that the only difference between an index in an array and a key in an object is that the value between the brackets must be a number +to create an array. When creating arrays with specific indices, **qs** will compact a sparse array to only the existing values preserving +their order: + +```javascript +var noSparse = qs.parse('a[1]=b&a[15]=c'); +assert.deepEqual(noSparse, { a: ['b', 'c'] }); +``` + +Note that an empty string is also a value, and will be preserved: + +```javascript +var withEmptyString = qs.parse('a[]=&a[]=b'); +assert.deepEqual(withEmptyString, { a: ['', 'b'] }); + +var withIndexedEmptyString = qs.parse('a[0]=b&a[1]=&a[2]=c'); +assert.deepEqual(withIndexedEmptyString, { a: ['b', '', 'c'] }); +``` + +**qs** will also limit specifying indices in an array to a maximum index of `20`. Any array members with an index of greater than `20` will +instead be converted to an object with the index as the key: + +```javascript +var withMaxIndex = qs.parse('a[100]=b'); +assert.deepEqual(withMaxIndex, { a: { '100': 'b' } }); +``` + +This limit can be overridden by passing an `arrayLimit` option: + +```javascript +var withArrayLimit = qs.parse('a[1]=b', { arrayLimit: 0 }); +assert.deepEqual(withArrayLimit, { a: { '1': 'b' } }); +``` + +To disable array parsing entirely, set `parseArrays` to `false`. + +```javascript +var noParsingArrays = qs.parse('a[]=b', { parseArrays: false }); +assert.deepEqual(noParsingArrays, { a: { '0': 'b' } }); +``` + +If you mix notations, **qs** will merge the two items into an object: + +```javascript +var mixedNotation = qs.parse('a[0]=b&a[b]=c'); +assert.deepEqual(mixedNotation, { a: { '0': 'b', b: 'c' } }); +``` + +You can also create arrays of objects: + +```javascript +var arraysOfObjects = qs.parse('a[][b]=c'); +assert.deepEqual(arraysOfObjects, { a: [{ b: 'c' }] }); +``` + +### Stringifying + +[](#preventEval) +```javascript +qs.stringify(object, [options]); +``` + +When stringifying, **qs** by default URI encodes output. Objects are stringified as you would expect: + +```javascript +assert.equal(qs.stringify({ a: 'b' }), 'a=b'); +assert.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); +``` + +This encoding can be disabled by setting the `encode` option to `false`: + +```javascript +var unencoded = qs.stringify({ a: { b: 'c' } }, { encode: false }); +assert.equal(unencoded, 'a[b]=c'); +``` + +Encoding can be disabled for keys by setting the `encodeValuesOnly` option to `true`: +```javascript +var encodedValues = qs.stringify( + { a: 'b', c: ['d', 'e=f'], f: [['g'], ['h']] }, + { encodeValuesOnly: true } +); +assert.equal(encodedValues,'a=b&c[0]=d&c[1]=e%3Df&f[0][0]=g&f[1][0]=h'); +``` + +This encoding can also be replaced by a custom encoding method set as `encoder` option: + +```javascript +var encoded = qs.stringify({ a: { b: 'c' } }, { encoder: function (str) { + // Passed in values `a`, `b`, `c` + return // Return encoded string +}}) +``` + +_(Note: the `encoder` option does not apply if `encode` is `false`)_ + +Analogue to the `encoder` there is a `decoder` option for `parse` to override decoding of properties and values: + +```javascript +var decoded = qs.parse('x=z', { decoder: function (str) { + // Passed in values `x`, `z` + return // Return decoded string +}}) +``` + +Examples beyond this point will be shown as though the output is not URI encoded for clarity. Please note that the return values in these cases *will* be URI encoded during real usage. + +When arrays are stringified, by default they are given explicit indices: + +```javascript +qs.stringify({ a: ['b', 'c', 'd'] }); +// 'a[0]=b&a[1]=c&a[2]=d' +``` + +You may override this by setting the `indices` option to `false`: + +```javascript +qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }); +// 'a=b&a=c&a=d' +``` + +You may use the `arrayFormat` option to specify the format of the output array: + +```javascript +qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }) +// 'a[0]=b&a[1]=c' +qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }) +// 'a[]=b&a[]=c' +qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }) +// 'a=b&a=c' +``` + +When objects are stringified, by default they use bracket notation: + +```javascript +qs.stringify({ a: { b: { c: 'd', e: 'f' } } }); +// 'a[b][c]=d&a[b][e]=f' +``` + +You may override this to use dot notation by setting the `allowDots` option to `true`: + +```javascript +qs.stringify({ a: { b: { c: 'd', e: 'f' } } }, { allowDots: true }); +// 'a.b.c=d&a.b.e=f' +``` + +Empty strings and null values will omit the value, but the equals sign (=) remains in place: + +```javascript +assert.equal(qs.stringify({ a: '' }), 'a='); +``` + +Key with no values (such as an empty object or array) will return nothing: + +```javascript +assert.equal(qs.stringify({ a: [] }), ''); +assert.equal(qs.stringify({ a: {} }), ''); +assert.equal(qs.stringify({ a: [{}] }), ''); +assert.equal(qs.stringify({ a: { b: []} }), ''); +assert.equal(qs.stringify({ a: { b: {}} }), ''); +``` + +Properties that are set to `undefined` will be omitted entirely: + +```javascript +assert.equal(qs.stringify({ a: null, b: undefined }), 'a='); +``` + +The query string may optionally be prepended with a question mark: + +```javascript +assert.equal(qs.stringify({ a: 'b', c: 'd' }, { addQueryPrefix: true }), '?a=b&c=d'); +``` + +The delimiter may be overridden with stringify as well: + +```javascript +assert.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d'); +``` + +If you only want to override the serialization of `Date` objects, you can provide a `serializeDate` option: + +```javascript +var date = new Date(7); +assert.equal(qs.stringify({ a: date }), 'a=1970-01-01T00:00:00.007Z'.replace(/:/g, '%3A')); +assert.equal( + qs.stringify({ a: date }, { serializeDate: function (d) { return d.getTime(); } }), + 'a=7' +); +``` + +You may use the `sort` option to affect the order of parameter keys: + +```javascript +function alphabeticalSort(a, b) { + return a.localeCompare(b); +} +assert.equal(qs.stringify({ a: 'c', z: 'y', b : 'f' }, { sort: alphabeticalSort }), 'a=c&b=f&z=y'); +``` + +Finally, you can use the `filter` option to restrict which keys will be included in the stringified output. +If you pass a function, it will be called for each key to obtain the replacement value. Otherwise, if you +pass an array, it will be used to select properties and array indices for stringification: + +```javascript +function filterFunc(prefix, value) { + if (prefix == 'b') { + // Return an `undefined` value to omit a property. + return; + } + if (prefix == 'e[f]') { + return value.getTime(); + } + if (prefix == 'e[g][0]') { + return value * 2; + } + return value; +} +qs.stringify({ a: 'b', c: 'd', e: { f: new Date(123), g: [2] } }, { filter: filterFunc }); +// 'a=b&c=d&e[f]=123&e[g][0]=4' +qs.stringify({ a: 'b', c: 'd', e: 'f' }, { filter: ['a', 'e'] }); +// 'a=b&e=f' +qs.stringify({ a: ['b', 'c', 'd'], e: 'f' }, { filter: ['a', 0, 2] }); +// 'a[0]=b&a[2]=d' +``` + +### Handling of `null` values + +By default, `null` values are treated like empty strings: + +```javascript +var withNull = qs.stringify({ a: null, b: '' }); +assert.equal(withNull, 'a=&b='); +``` + +Parsing does not distinguish between parameters with and without equal signs. Both are converted to empty strings. + +```javascript +var equalsInsensitive = qs.parse('a&b='); +assert.deepEqual(equalsInsensitive, { a: '', b: '' }); +``` + +To distinguish between `null` values and empty strings use the `strictNullHandling` flag. In the result string the `null` +values have no `=` sign: + +```javascript +var strictNull = qs.stringify({ a: null, b: '' }, { strictNullHandling: true }); +assert.equal(strictNull, 'a&b='); +``` + +To parse values without `=` back to `null` use the `strictNullHandling` flag: + +```javascript +var parsedStrictNull = qs.parse('a&b=', { strictNullHandling: true }); +assert.deepEqual(parsedStrictNull, { a: null, b: '' }); +``` + +To completely skip rendering keys with `null` values, use the `skipNulls` flag: + +```javascript +var nullsSkipped = qs.stringify({ a: 'b', c: null}, { skipNulls: true }); +assert.equal(nullsSkipped, 'a=b'); +``` + +### Dealing with special character sets + +By default the encoding and decoding of characters is done in `utf-8`. If you +wish to encode querystrings to a different character set (i.e. +[Shift JIS](https://en.wikipedia.org/wiki/Shift_JIS)) you can use the +[`qs-iconv`](https://github.com/martinheidegger/qs-iconv) library: + +```javascript +var encoder = require('qs-iconv/encoder')('shift_jis'); +var shiftJISEncoded = qs.stringify({ a: 'こんにちは!' }, { encoder: encoder }); +assert.equal(shiftJISEncoded, 'a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I'); +``` + +This also works for decoding of query strings: + +```javascript +var decoder = require('qs-iconv/decoder')('shift_jis'); +var obj = qs.parse('a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I', { decoder: decoder }); +assert.deepEqual(obj, { a: 'こんにちは!' }); +``` + +### RFC 3986 and RFC 1738 space encoding + +RFC3986 used as default option and encodes ' ' to *%20* which is backward compatible. +In the same time, output can be stringified as per RFC1738 with ' ' equal to '+'. + +``` +assert.equal(qs.stringify({ a: 'b c' }), 'a=b%20c'); +assert.equal(qs.stringify({ a: 'b c' }, { format : 'RFC3986' }), 'a=b%20c'); +assert.equal(qs.stringify({ a: 'b c' }, { format : 'RFC1738' }), 'a=b+c'); +``` + +[1]: https://npmjs.org/package/qs +[2]: http://versionbadg.es/ljharb/qs.svg +[3]: https://api.travis-ci.org/ljharb/qs.svg +[4]: https://travis-ci.org/ljharb/qs +[5]: https://david-dm.org/ljharb/qs.svg +[6]: https://david-dm.org/ljharb/qs +[7]: https://david-dm.org/ljharb/qs/dev-status.svg +[8]: https://david-dm.org/ljharb/qs?type=dev +[9]: https://ci.testling.com/ljharb/qs.png +[10]: https://ci.testling.com/ljharb/qs +[11]: https://nodei.co/npm/qs.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/qs.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/qs.svg +[downloads-url]: http://npm-stat.com/charts.html?package=qs diff --git a/node_modules/qs/dist/qs.js b/node_modules/qs/dist/qs.js new file mode 100644 index 0000000..713c6d1 --- /dev/null +++ b/node_modules/qs/dist/qs.js @@ -0,0 +1,627 @@ +(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.Qs = 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= 0; --i) { + var obj; + var root = chain[i]; + + if (root === '[]') { + obj = []; + obj = obj.concat(leaf); + } else { + obj = options.plainObjects ? Object.create(null) : {}; + var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root; + var index = parseInt(cleanRoot, 10); + if ( + !isNaN(index) + && root !== cleanRoot + && String(index) === cleanRoot + && index >= 0 + && (options.parseArrays && index <= options.arrayLimit) + ) { + obj = []; + obj[index] = leaf; + } else { + obj[cleanRoot] = leaf; + } + } + + leaf = obj; + } + + return leaf; +}; + +var parseKeys = function parseQueryStringKeys(givenKey, val, options) { + if (!givenKey) { + return; + } + + // Transform dot notation to bracket notation + var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; + + // The regex chunks + + var brackets = /(\[[^[\]]*])/; + var child = /(\[[^[\]]*])/g; + + // Get the parent + + var segment = brackets.exec(key); + var parent = segment ? key.slice(0, segment.index) : key; + + // Stash the parent if it exists + + var keys = []; + if (parent) { + // If we aren't using plain objects, optionally prefix keys + // that would overwrite object prototype properties + if (!options.plainObjects && has.call(Object.prototype, parent)) { + if (!options.allowPrototypes) { + return; + } + } + + keys.push(parent); + } + + // Loop through children appending to the array until we hit depth + + var i = 0; + while ((segment = child.exec(key)) !== null && i < options.depth) { + i += 1; + if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { + if (!options.allowPrototypes) { + return; + } + } + keys.push(segment[1]); + } + + // If there's a remainder, just add whatever is left + + if (segment) { + keys.push('[' + key.slice(segment.index) + ']'); + } + + return parseObject(keys, val, options); +}; + +module.exports = function (str, opts) { + var options = opts ? utils.assign({}, opts) : {}; + + if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') { + throw new TypeError('Decoder has to be a function.'); + } + + options.ignoreQueryPrefix = options.ignoreQueryPrefix === true; + options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter; + options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth; + options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit; + options.parseArrays = options.parseArrays !== false; + options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder; + options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults.allowDots; + options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects; + options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes; + options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit; + options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling; + + if (str === '' || str === null || typeof str === 'undefined') { + return options.plainObjects ? Object.create(null) : {}; + } + + var tempObj = typeof str === 'string' ? parseValues(str, options) : str; + var obj = options.plainObjects ? Object.create(null) : {}; + + // Iterate over the keys and setup the new object + + var keys = Object.keys(tempObj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var newObj = parseKeys(key, tempObj[key], options); + obj = utils.merge(obj, newObj, options); + } + + return utils.compact(obj); +}; + +},{"./utils":5}],4:[function(require,module,exports){ +'use strict'; + +var utils = require('./utils'); +var formats = require('./formats'); + +var arrayPrefixGenerators = { + brackets: function brackets(prefix) { // eslint-disable-line func-name-matching + return prefix + '[]'; + }, + indices: function indices(prefix, key) { // eslint-disable-line func-name-matching + return prefix + '[' + key + ']'; + }, + repeat: function repeat(prefix) { // eslint-disable-line func-name-matching + return prefix; + } +}; + +var toISO = Date.prototype.toISOString; + +var defaults = { + delimiter: '&', + encode: true, + encoder: utils.encode, + encodeValuesOnly: false, + serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching + return toISO.call(date); + }, + skipNulls: false, + strictNullHandling: false +}; + +var stringify = function stringify( // eslint-disable-line func-name-matching + object, + prefix, + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly +) { + var obj = object; + if (typeof filter === 'function') { + obj = filter(prefix, obj); + } else if (obj instanceof Date) { + obj = serializeDate(obj); + } else if (obj === null) { + if (strictNullHandling) { + return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder) : prefix; + } + + obj = ''; + } + + if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) { + if (encoder) { + var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder); + return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder))]; + } + return [formatter(prefix) + '=' + formatter(String(obj))]; + } + + var values = []; + + if (typeof obj === 'undefined') { + return values; + } + + var objKeys; + if (Array.isArray(filter)) { + objKeys = filter; + } else { + var keys = Object.keys(obj); + objKeys = sort ? keys.sort(sort) : keys; + } + + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (skipNulls && obj[key] === null) { + continue; + } + + if (Array.isArray(obj)) { + values = values.concat(stringify( + obj[key], + generateArrayPrefix(prefix, key), + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } else { + values = values.concat(stringify( + obj[key], + prefix + (allowDots ? '.' + key : '[' + key + ']'), + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } + } + + return values; +}; + +module.exports = function (object, opts) { + var obj = object; + var options = opts ? utils.assign({}, opts) : {}; + + if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') { + throw new TypeError('Encoder has to be a function.'); + } + + var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter; + var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling; + var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls; + var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode; + var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder; + var sort = typeof options.sort === 'function' ? options.sort : null; + var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots; + var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate; + var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly; + if (typeof options.format === 'undefined') { + options.format = formats['default']; + } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) { + throw new TypeError('Unknown format option provided.'); + } + var formatter = formats.formatters[options.format]; + var objKeys; + var filter; + + if (typeof options.filter === 'function') { + filter = options.filter; + obj = filter('', obj); + } else if (Array.isArray(options.filter)) { + filter = options.filter; + objKeys = filter; + } + + var keys = []; + + if (typeof obj !== 'object' || obj === null) { + return ''; + } + + var arrayFormat; + if (options.arrayFormat in arrayPrefixGenerators) { + arrayFormat = options.arrayFormat; + } else if ('indices' in options) { + arrayFormat = options.indices ? 'indices' : 'repeat'; + } else { + arrayFormat = 'indices'; + } + + var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; + + if (!objKeys) { + objKeys = Object.keys(obj); + } + + if (sort) { + objKeys.sort(sort); + } + + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (skipNulls && obj[key] === null) { + continue; + } + + keys = keys.concat(stringify( + obj[key], + key, + generateArrayPrefix, + strictNullHandling, + skipNulls, + encode ? encoder : null, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } + + var joined = keys.join(delimiter); + var prefix = options.addQueryPrefix === true ? '?' : ''; + + return joined.length > 0 ? prefix + joined : ''; +}; + +},{"./formats":1,"./utils":5}],5:[function(require,module,exports){ +'use strict'; + +var has = Object.prototype.hasOwnProperty; + +var hexTable = (function () { + var array = []; + for (var i = 0; i < 256; ++i) { + array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); + } + + return array; +}()); + +var compactQueue = function compactQueue(queue) { + var obj; + + while (queue.length) { + var item = queue.pop(); + obj = item.obj[item.prop]; + + if (Array.isArray(obj)) { + var compacted = []; + + for (var j = 0; j < obj.length; ++j) { + if (typeof obj[j] !== 'undefined') { + compacted.push(obj[j]); + } + } + + item.obj[item.prop] = compacted; + } + } + + return obj; +}; + +exports.arrayToObject = function arrayToObject(source, options) { + var obj = options && options.plainObjects ? Object.create(null) : {}; + for (var i = 0; i < source.length; ++i) { + if (typeof source[i] !== 'undefined') { + obj[i] = source[i]; + } + } + + return obj; +}; + +exports.merge = function merge(target, source, options) { + if (!source) { + return target; + } + + if (typeof source !== 'object') { + if (Array.isArray(target)) { + target.push(source); + } else if (typeof target === 'object') { + if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) { + target[source] = true; + } + } else { + return [target, source]; + } + + return target; + } + + if (typeof target !== 'object') { + return [target].concat(source); + } + + var mergeTarget = target; + if (Array.isArray(target) && !Array.isArray(source)) { + mergeTarget = exports.arrayToObject(target, options); + } + + if (Array.isArray(target) && Array.isArray(source)) { + source.forEach(function (item, i) { + if (has.call(target, i)) { + if (target[i] && typeof target[i] === 'object') { + target[i] = exports.merge(target[i], item, options); + } else { + target.push(item); + } + } else { + target[i] = item; + } + }); + return target; + } + + return Object.keys(source).reduce(function (acc, key) { + var value = source[key]; + + if (has.call(acc, key)) { + acc[key] = exports.merge(acc[key], value, options); + } else { + acc[key] = value; + } + return acc; + }, mergeTarget); +}; + +exports.assign = function assignSingleSource(target, source) { + return Object.keys(source).reduce(function (acc, key) { + acc[key] = source[key]; + return acc; + }, target); +}; + +exports.decode = function (str) { + try { + return decodeURIComponent(str.replace(/\+/g, ' ')); + } catch (e) { + return str; + } +}; + +exports.encode = function encode(str) { + // This code was originally written by Brian White (mscdex) for the io.js core querystring library. + // It has been adapted here for stricter adherence to RFC 3986 + if (str.length === 0) { + return str; + } + + var string = typeof str === 'string' ? str : String(str); + + var out = ''; + for (var i = 0; i < string.length; ++i) { + var c = string.charCodeAt(i); + + if ( + c === 0x2D // - + || c === 0x2E // . + || c === 0x5F // _ + || c === 0x7E // ~ + || (c >= 0x30 && c <= 0x39) // 0-9 + || (c >= 0x41 && c <= 0x5A) // a-z + || (c >= 0x61 && c <= 0x7A) // A-Z + ) { + out += string.charAt(i); + continue; + } + + if (c < 0x80) { + out = out + hexTable[c]; + continue; + } + + if (c < 0x800) { + out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + if (c < 0xD800 || c >= 0xE000) { + out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + i += 1; + c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); + out += hexTable[0xF0 | (c >> 18)] + + hexTable[0x80 | ((c >> 12) & 0x3F)] + + hexTable[0x80 | ((c >> 6) & 0x3F)] + + hexTable[0x80 | (c & 0x3F)]; + } + + return out; +}; + +exports.compact = function compact(value) { + var queue = [{ obj: { o: value }, prop: 'o' }]; + var refs = []; + + for (var i = 0; i < queue.length; ++i) { + var item = queue[i]; + var obj = item.obj[item.prop]; + + var keys = Object.keys(obj); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + var val = obj[key]; + if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) { + queue.push({ obj: obj, prop: key }); + refs.push(val); + } + } + } + + return compactQueue(queue); +}; + +exports.isRegExp = function isRegExp(obj) { + return Object.prototype.toString.call(obj) === '[object RegExp]'; +}; + +exports.isBuffer = function isBuffer(obj) { + if (obj === null || typeof obj === 'undefined') { + return false; + } + + return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); +}; + +},{}]},{},[2])(2) +}); \ No newline at end of file diff --git a/node_modules/qs/lib/formats.js b/node_modules/qs/lib/formats.js new file mode 100644 index 0000000..df45997 --- /dev/null +++ b/node_modules/qs/lib/formats.js @@ -0,0 +1,18 @@ +'use strict'; + +var replace = String.prototype.replace; +var percentTwenties = /%20/g; + +module.exports = { + 'default': 'RFC3986', + formatters: { + RFC1738: function (value) { + return replace.call(value, percentTwenties, '+'); + }, + RFC3986: function (value) { + return value; + } + }, + RFC1738: 'RFC1738', + RFC3986: 'RFC3986' +}; diff --git a/node_modules/qs/lib/index.js b/node_modules/qs/lib/index.js new file mode 100644 index 0000000..0d6a97d --- /dev/null +++ b/node_modules/qs/lib/index.js @@ -0,0 +1,11 @@ +'use strict'; + +var stringify = require('./stringify'); +var parse = require('./parse'); +var formats = require('./formats'); + +module.exports = { + formats: formats, + parse: parse, + stringify: stringify +}; diff --git a/node_modules/qs/lib/parse.js b/node_modules/qs/lib/parse.js new file mode 100644 index 0000000..8c9872e --- /dev/null +++ b/node_modules/qs/lib/parse.js @@ -0,0 +1,174 @@ +'use strict'; + +var utils = require('./utils'); + +var has = Object.prototype.hasOwnProperty; + +var defaults = { + allowDots: false, + allowPrototypes: false, + arrayLimit: 20, + decoder: utils.decode, + delimiter: '&', + depth: 5, + parameterLimit: 1000, + plainObjects: false, + strictNullHandling: false +}; + +var parseValues = function parseQueryStringValues(str, options) { + var obj = {}; + var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str; + var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit; + var parts = cleanStr.split(options.delimiter, limit); + + for (var i = 0; i < parts.length; ++i) { + var part = parts[i]; + + var bracketEqualsPos = part.indexOf(']='); + var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1; + + var key, val; + if (pos === -1) { + key = options.decoder(part, defaults.decoder); + val = options.strictNullHandling ? null : ''; + } else { + key = options.decoder(part.slice(0, pos), defaults.decoder); + val = options.decoder(part.slice(pos + 1), defaults.decoder); + } + if (has.call(obj, key)) { + obj[key] = [].concat(obj[key]).concat(val); + } else { + obj[key] = val; + } + } + + return obj; +}; + +var parseObject = function (chain, val, options) { + var leaf = val; + + for (var i = chain.length - 1; i >= 0; --i) { + var obj; + var root = chain[i]; + + if (root === '[]') { + obj = []; + obj = obj.concat(leaf); + } else { + obj = options.plainObjects ? Object.create(null) : {}; + var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root; + var index = parseInt(cleanRoot, 10); + if ( + !isNaN(index) + && root !== cleanRoot + && String(index) === cleanRoot + && index >= 0 + && (options.parseArrays && index <= options.arrayLimit) + ) { + obj = []; + obj[index] = leaf; + } else { + obj[cleanRoot] = leaf; + } + } + + leaf = obj; + } + + return leaf; +}; + +var parseKeys = function parseQueryStringKeys(givenKey, val, options) { + if (!givenKey) { + return; + } + + // Transform dot notation to bracket notation + var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; + + // The regex chunks + + var brackets = /(\[[^[\]]*])/; + var child = /(\[[^[\]]*])/g; + + // Get the parent + + var segment = brackets.exec(key); + var parent = segment ? key.slice(0, segment.index) : key; + + // Stash the parent if it exists + + var keys = []; + if (parent) { + // If we aren't using plain objects, optionally prefix keys + // that would overwrite object prototype properties + if (!options.plainObjects && has.call(Object.prototype, parent)) { + if (!options.allowPrototypes) { + return; + } + } + + keys.push(parent); + } + + // Loop through children appending to the array until we hit depth + + var i = 0; + while ((segment = child.exec(key)) !== null && i < options.depth) { + i += 1; + if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { + if (!options.allowPrototypes) { + return; + } + } + keys.push(segment[1]); + } + + // If there's a remainder, just add whatever is left + + if (segment) { + keys.push('[' + key.slice(segment.index) + ']'); + } + + return parseObject(keys, val, options); +}; + +module.exports = function (str, opts) { + var options = opts ? utils.assign({}, opts) : {}; + + if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') { + throw new TypeError('Decoder has to be a function.'); + } + + options.ignoreQueryPrefix = options.ignoreQueryPrefix === true; + options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter; + options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth; + options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit; + options.parseArrays = options.parseArrays !== false; + options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder; + options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults.allowDots; + options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects; + options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes; + options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit; + options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling; + + if (str === '' || str === null || typeof str === 'undefined') { + return options.plainObjects ? Object.create(null) : {}; + } + + var tempObj = typeof str === 'string' ? parseValues(str, options) : str; + var obj = options.plainObjects ? Object.create(null) : {}; + + // Iterate over the keys and setup the new object + + var keys = Object.keys(tempObj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var newObj = parseKeys(key, tempObj[key], options); + obj = utils.merge(obj, newObj, options); + } + + return utils.compact(obj); +}; diff --git a/node_modules/qs/lib/stringify.js b/node_modules/qs/lib/stringify.js new file mode 100644 index 0000000..ab915ac --- /dev/null +++ b/node_modules/qs/lib/stringify.js @@ -0,0 +1,210 @@ +'use strict'; + +var utils = require('./utils'); +var formats = require('./formats'); + +var arrayPrefixGenerators = { + brackets: function brackets(prefix) { // eslint-disable-line func-name-matching + return prefix + '[]'; + }, + indices: function indices(prefix, key) { // eslint-disable-line func-name-matching + return prefix + '[' + key + ']'; + }, + repeat: function repeat(prefix) { // eslint-disable-line func-name-matching + return prefix; + } +}; + +var toISO = Date.prototype.toISOString; + +var defaults = { + delimiter: '&', + encode: true, + encoder: utils.encode, + encodeValuesOnly: false, + serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching + return toISO.call(date); + }, + skipNulls: false, + strictNullHandling: false +}; + +var stringify = function stringify( // eslint-disable-line func-name-matching + object, + prefix, + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly +) { + var obj = object; + if (typeof filter === 'function') { + obj = filter(prefix, obj); + } else if (obj instanceof Date) { + obj = serializeDate(obj); + } else if (obj === null) { + if (strictNullHandling) { + return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder) : prefix; + } + + obj = ''; + } + + if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) { + if (encoder) { + var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder); + return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder))]; + } + return [formatter(prefix) + '=' + formatter(String(obj))]; + } + + var values = []; + + if (typeof obj === 'undefined') { + return values; + } + + var objKeys; + if (Array.isArray(filter)) { + objKeys = filter; + } else { + var keys = Object.keys(obj); + objKeys = sort ? keys.sort(sort) : keys; + } + + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (skipNulls && obj[key] === null) { + continue; + } + + if (Array.isArray(obj)) { + values = values.concat(stringify( + obj[key], + generateArrayPrefix(prefix, key), + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } else { + values = values.concat(stringify( + obj[key], + prefix + (allowDots ? '.' + key : '[' + key + ']'), + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } + } + + return values; +}; + +module.exports = function (object, opts) { + var obj = object; + var options = opts ? utils.assign({}, opts) : {}; + + if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') { + throw new TypeError('Encoder has to be a function.'); + } + + var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter; + var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling; + var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls; + var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode; + var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder; + var sort = typeof options.sort === 'function' ? options.sort : null; + var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots; + var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate; + var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly; + if (typeof options.format === 'undefined') { + options.format = formats['default']; + } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) { + throw new TypeError('Unknown format option provided.'); + } + var formatter = formats.formatters[options.format]; + var objKeys; + var filter; + + if (typeof options.filter === 'function') { + filter = options.filter; + obj = filter('', obj); + } else if (Array.isArray(options.filter)) { + filter = options.filter; + objKeys = filter; + } + + var keys = []; + + if (typeof obj !== 'object' || obj === null) { + return ''; + } + + var arrayFormat; + if (options.arrayFormat in arrayPrefixGenerators) { + arrayFormat = options.arrayFormat; + } else if ('indices' in options) { + arrayFormat = options.indices ? 'indices' : 'repeat'; + } else { + arrayFormat = 'indices'; + } + + var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; + + if (!objKeys) { + objKeys = Object.keys(obj); + } + + if (sort) { + objKeys.sort(sort); + } + + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (skipNulls && obj[key] === null) { + continue; + } + + keys = keys.concat(stringify( + obj[key], + key, + generateArrayPrefix, + strictNullHandling, + skipNulls, + encode ? encoder : null, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } + + var joined = keys.join(delimiter); + var prefix = options.addQueryPrefix === true ? '?' : ''; + + return joined.length > 0 ? prefix + joined : ''; +}; diff --git a/node_modules/qs/lib/utils.js b/node_modules/qs/lib/utils.js new file mode 100644 index 0000000..06cae2f --- /dev/null +++ b/node_modules/qs/lib/utils.js @@ -0,0 +1,202 @@ +'use strict'; + +var has = Object.prototype.hasOwnProperty; + +var hexTable = (function () { + var array = []; + for (var i = 0; i < 256; ++i) { + array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); + } + + return array; +}()); + +var compactQueue = function compactQueue(queue) { + var obj; + + while (queue.length) { + var item = queue.pop(); + obj = item.obj[item.prop]; + + if (Array.isArray(obj)) { + var compacted = []; + + for (var j = 0; j < obj.length; ++j) { + if (typeof obj[j] !== 'undefined') { + compacted.push(obj[j]); + } + } + + item.obj[item.prop] = compacted; + } + } + + return obj; +}; + +exports.arrayToObject = function arrayToObject(source, options) { + var obj = options && options.plainObjects ? Object.create(null) : {}; + for (var i = 0; i < source.length; ++i) { + if (typeof source[i] !== 'undefined') { + obj[i] = source[i]; + } + } + + return obj; +}; + +exports.merge = function merge(target, source, options) { + if (!source) { + return target; + } + + if (typeof source !== 'object') { + if (Array.isArray(target)) { + target.push(source); + } else if (typeof target === 'object') { + if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) { + target[source] = true; + } + } else { + return [target, source]; + } + + return target; + } + + if (typeof target !== 'object') { + return [target].concat(source); + } + + var mergeTarget = target; + if (Array.isArray(target) && !Array.isArray(source)) { + mergeTarget = exports.arrayToObject(target, options); + } + + if (Array.isArray(target) && Array.isArray(source)) { + source.forEach(function (item, i) { + if (has.call(target, i)) { + if (target[i] && typeof target[i] === 'object') { + target[i] = exports.merge(target[i], item, options); + } else { + target.push(item); + } + } else { + target[i] = item; + } + }); + return target; + } + + return Object.keys(source).reduce(function (acc, key) { + var value = source[key]; + + if (has.call(acc, key)) { + acc[key] = exports.merge(acc[key], value, options); + } else { + acc[key] = value; + } + return acc; + }, mergeTarget); +}; + +exports.assign = function assignSingleSource(target, source) { + return Object.keys(source).reduce(function (acc, key) { + acc[key] = source[key]; + return acc; + }, target); +}; + +exports.decode = function (str) { + try { + return decodeURIComponent(str.replace(/\+/g, ' ')); + } catch (e) { + return str; + } +}; + +exports.encode = function encode(str) { + // This code was originally written by Brian White (mscdex) for the io.js core querystring library. + // It has been adapted here for stricter adherence to RFC 3986 + if (str.length === 0) { + return str; + } + + var string = typeof str === 'string' ? str : String(str); + + var out = ''; + for (var i = 0; i < string.length; ++i) { + var c = string.charCodeAt(i); + + if ( + c === 0x2D // - + || c === 0x2E // . + || c === 0x5F // _ + || c === 0x7E // ~ + || (c >= 0x30 && c <= 0x39) // 0-9 + || (c >= 0x41 && c <= 0x5A) // a-z + || (c >= 0x61 && c <= 0x7A) // A-Z + ) { + out += string.charAt(i); + continue; + } + + if (c < 0x80) { + out = out + hexTable[c]; + continue; + } + + if (c < 0x800) { + out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + if (c < 0xD800 || c >= 0xE000) { + out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + i += 1; + c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); + out += hexTable[0xF0 | (c >> 18)] + + hexTable[0x80 | ((c >> 12) & 0x3F)] + + hexTable[0x80 | ((c >> 6) & 0x3F)] + + hexTable[0x80 | (c & 0x3F)]; + } + + return out; +}; + +exports.compact = function compact(value) { + var queue = [{ obj: { o: value }, prop: 'o' }]; + var refs = []; + + for (var i = 0; i < queue.length; ++i) { + var item = queue[i]; + var obj = item.obj[item.prop]; + + var keys = Object.keys(obj); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + var val = obj[key]; + if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) { + queue.push({ obj: obj, prop: key }); + refs.push(val); + } + } + } + + return compactQueue(queue); +}; + +exports.isRegExp = function isRegExp(obj) { + return Object.prototype.toString.call(obj) === '[object RegExp]'; +}; + +exports.isBuffer = function isBuffer(obj) { + if (obj === null || typeof obj === 'undefined') { + return false; + } + + return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); +}; diff --git a/node_modules/qs/package.json b/node_modules/qs/package.json new file mode 100644 index 0000000..6578298 --- /dev/null +++ b/node_modules/qs/package.json @@ -0,0 +1,79 @@ +{ + "_from": "qs@6.5.1", + "_id": "qs@6.5.1", + "_inBundle": false, + "_integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", + "_location": "/qs", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "qs@6.5.1", + "name": "qs", + "escapedName": "qs", + "rawSpec": "6.5.1", + "saveSpec": null, + "fetchSpec": "6.5.1" + }, + "_requiredBy": [ + "/body-parser" + ], + "_resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "_shasum": "349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8", + "_spec": "qs@6.5.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/body-parser", + "bugs": { + "url": "https://github.com/ljharb/qs/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "A querystring parser that supports nesting and arrays, with a depth limit", + "devDependencies": { + "@ljharb/eslint-config": "^12.2.1", + "browserify": "^14.4.0", + "covert": "^1.1.0", + "editorconfig-tools": "^0.1.1", + "eslint": "^4.6.1", + "evalmd": "^0.0.17", + "iconv-lite": "^0.4.18", + "mkdirp": "^0.5.1", + "qs-iconv": "^1.0.4", + "safe-publish-latest": "^1.1.1", + "tape": "^4.8.0" + }, + "engines": { + "node": ">=0.6" + }, + "homepage": "https://github.com/ljharb/qs", + "keywords": [ + "querystring", + "qs" + ], + "license": "BSD-3-Clause", + "main": "lib/index.js", + "name": "qs", + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/qs.git" + }, + "scripts": { + "coverage": "covert test", + "dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js", + "lint": "eslint lib/*.js test/*.js", + "prelint": "editorconfig-tools check * lib/* test/*", + "prepublish": "safe-publish-latest && npm run dist", + "pretest": "npm run --silent readme && npm run --silent lint", + "readme": "evalmd README.md", + "test": "npm run --silent coverage", + "tests-only": "node test" + }, + "version": "6.5.1" +} diff --git a/node_modules/qs/test/.eslintrc b/node_modules/qs/test/.eslintrc new file mode 100644 index 0000000..20175d6 --- /dev/null +++ b/node_modules/qs/test/.eslintrc @@ -0,0 +1,15 @@ +{ + "rules": { + "array-bracket-newline": 0, + "array-element-newline": 0, + "consistent-return": 2, + "max-lines": 0, + "max-nested-callbacks": [2, 3], + "max-statements": 0, + "no-buffer-constructor": 0, + "no-extend-native": 0, + "no-magic-numbers": 0, + "object-curly-newline": 0, + "sort-keys": 0 + } +} diff --git a/node_modules/qs/test/index.js b/node_modules/qs/test/index.js new file mode 100644 index 0000000..5e6bc8f --- /dev/null +++ b/node_modules/qs/test/index.js @@ -0,0 +1,7 @@ +'use strict'; + +require('./parse'); + +require('./stringify'); + +require('./utils'); diff --git a/node_modules/qs/test/parse.js b/node_modules/qs/test/parse.js new file mode 100644 index 0000000..d7d8641 --- /dev/null +++ b/node_modules/qs/test/parse.js @@ -0,0 +1,573 @@ +'use strict'; + +var test = require('tape'); +var qs = require('../'); +var utils = require('../lib/utils'); +var iconv = require('iconv-lite'); + +test('parse()', function (t) { + t.test('parses a simple string', function (st) { + st.deepEqual(qs.parse('0=foo'), { 0: 'foo' }); + st.deepEqual(qs.parse('foo=c++'), { foo: 'c ' }); + st.deepEqual(qs.parse('a[>=]=23'), { a: { '>=': '23' } }); + st.deepEqual(qs.parse('a[<=>]==23'), { a: { '<=>': '=23' } }); + st.deepEqual(qs.parse('a[==]=23'), { a: { '==': '23' } }); + st.deepEqual(qs.parse('foo', { strictNullHandling: true }), { foo: null }); + st.deepEqual(qs.parse('foo'), { foo: '' }); + st.deepEqual(qs.parse('foo='), { foo: '' }); + st.deepEqual(qs.parse('foo=bar'), { foo: 'bar' }); + st.deepEqual(qs.parse(' foo = bar = baz '), { ' foo ': ' bar = baz ' }); + st.deepEqual(qs.parse('foo=bar=baz'), { foo: 'bar=baz' }); + st.deepEqual(qs.parse('foo=bar&bar=baz'), { foo: 'bar', bar: 'baz' }); + st.deepEqual(qs.parse('foo2=bar2&baz2='), { foo2: 'bar2', baz2: '' }); + st.deepEqual(qs.parse('foo=bar&baz', { strictNullHandling: true }), { foo: 'bar', baz: null }); + st.deepEqual(qs.parse('foo=bar&baz'), { foo: 'bar', baz: '' }); + st.deepEqual(qs.parse('cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World'), { + cht: 'p3', + chd: 't:60,40', + chs: '250x100', + chl: 'Hello|World' + }); + st.end(); + }); + + t.test('allows enabling dot notation', function (st) { + st.deepEqual(qs.parse('a.b=c'), { 'a.b': 'c' }); + st.deepEqual(qs.parse('a.b=c', { allowDots: true }), { a: { b: 'c' } }); + st.end(); + }); + + t.deepEqual(qs.parse('a[b]=c'), { a: { b: 'c' } }, 'parses a single nested string'); + t.deepEqual(qs.parse('a[b][c]=d'), { a: { b: { c: 'd' } } }, 'parses a double nested string'); + t.deepEqual( + qs.parse('a[b][c][d][e][f][g][h]=i'), + { a: { b: { c: { d: { e: { f: { '[g][h]': 'i' } } } } } } }, + 'defaults to a depth of 5' + ); + + t.test('only parses one level when depth = 1', function (st) { + st.deepEqual(qs.parse('a[b][c]=d', { depth: 1 }), { a: { b: { '[c]': 'd' } } }); + st.deepEqual(qs.parse('a[b][c][d]=e', { depth: 1 }), { a: { b: { '[c][d]': 'e' } } }); + st.end(); + }); + + t.deepEqual(qs.parse('a=b&a=c'), { a: ['b', 'c'] }, 'parses a simple array'); + + t.test('parses an explicit array', function (st) { + st.deepEqual(qs.parse('a[]=b'), { a: ['b'] }); + st.deepEqual(qs.parse('a[]=b&a[]=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a[]=c&a[]=d'), { a: ['b', 'c', 'd'] }); + st.end(); + }); + + t.test('parses a mix of simple and explicit arrays', function (st) { + st.deepEqual(qs.parse('a=b&a[]=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[0]=b&a=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b&a[0]=c'), { a: ['b', 'c'] }); + + st.deepEqual(qs.parse('a[1]=b&a=c', { arrayLimit: 20 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a=c', { arrayLimit: 0 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a=c'), { a: ['b', 'c'] }); + + st.deepEqual(qs.parse('a=b&a[1]=c', { arrayLimit: 20 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b&a[]=c', { arrayLimit: 0 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b&a[]=c'), { a: ['b', 'c'] }); + + st.end(); + }); + + t.test('parses a nested array', function (st) { + st.deepEqual(qs.parse('a[b][]=c&a[b][]=d'), { a: { b: ['c', 'd'] } }); + st.deepEqual(qs.parse('a[>=]=25'), { a: { '>=': '25' } }); + st.end(); + }); + + t.test('allows to specify array indices', function (st) { + st.deepEqual(qs.parse('a[1]=c&a[0]=b&a[2]=d'), { a: ['b', 'c', 'd'] }); + st.deepEqual(qs.parse('a[1]=c&a[0]=b'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[1]=c', { arrayLimit: 20 }), { a: ['c'] }); + st.deepEqual(qs.parse('a[1]=c', { arrayLimit: 0 }), { a: { 1: 'c' } }); + st.deepEqual(qs.parse('a[1]=c'), { a: ['c'] }); + st.end(); + }); + + t.test('limits specific array indices to arrayLimit', function (st) { + st.deepEqual(qs.parse('a[20]=a', { arrayLimit: 20 }), { a: ['a'] }); + st.deepEqual(qs.parse('a[21]=a', { arrayLimit: 20 }), { a: { 21: 'a' } }); + st.end(); + }); + + t.deepEqual(qs.parse('a[12b]=c'), { a: { '12b': 'c' } }, 'supports keys that begin with a number'); + + t.test('supports encoded = signs', function (st) { + st.deepEqual(qs.parse('he%3Dllo=th%3Dere'), { 'he=llo': 'th=ere' }); + st.end(); + }); + + t.test('is ok with url encoded strings', function (st) { + st.deepEqual(qs.parse('a[b%20c]=d'), { a: { 'b c': 'd' } }); + st.deepEqual(qs.parse('a[b]=c%20d'), { a: { b: 'c d' } }); + st.end(); + }); + + t.test('allows brackets in the value', function (st) { + st.deepEqual(qs.parse('pets=["tobi"]'), { pets: '["tobi"]' }); + st.deepEqual(qs.parse('operators=[">=", "<="]'), { operators: '[">=", "<="]' }); + st.end(); + }); + + t.test('allows empty values', function (st) { + st.deepEqual(qs.parse(''), {}); + st.deepEqual(qs.parse(null), {}); + st.deepEqual(qs.parse(undefined), {}); + st.end(); + }); + + t.test('transforms arrays to objects', function (st) { + st.deepEqual(qs.parse('foo[0]=bar&foo[bad]=baz'), { foo: { 0: 'bar', bad: 'baz' } }); + st.deepEqual(qs.parse('foo[bad]=baz&foo[0]=bar'), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar'), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo[]=bar&foo[bad]=baz'), { foo: { 0: 'bar', bad: 'baz' } }); + st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar&foo[]=foo'), { foo: { bad: 'baz', 0: 'bar', 1: 'foo' } }); + st.deepEqual(qs.parse('foo[0][a]=a&foo[0][b]=b&foo[1][a]=aa&foo[1][b]=bb'), { foo: [{ a: 'a', b: 'b' }, { a: 'aa', b: 'bb' }] }); + + st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c', { allowPrototypes: false }), { a: { 0: 'b', t: 'u' } }); + st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c', { allowPrototypes: true }), { a: { 0: 'b', t: 'u', hasOwnProperty: 'c' } }); + st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y', { allowPrototypes: false }), { a: { 0: 'b', x: 'y' } }); + st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y', { allowPrototypes: true }), { a: { 0: 'b', hasOwnProperty: 'c', x: 'y' } }); + st.end(); + }); + + t.test('transforms arrays to objects (dot notation)', function (st) { + st.deepEqual(qs.parse('foo[0].baz=bar&fool.bad=baz', { allowDots: true }), { foo: [{ baz: 'bar' }], fool: { bad: 'baz' } }); + st.deepEqual(qs.parse('foo[0].baz=bar&fool.bad.boo=baz', { allowDots: true }), { foo: [{ baz: 'bar' }], fool: { bad: { boo: 'baz' } } }); + st.deepEqual(qs.parse('foo[0][0].baz=bar&fool.bad=baz', { allowDots: true }), { foo: [[{ baz: 'bar' }]], fool: { bad: 'baz' } }); + st.deepEqual(qs.parse('foo[0].baz[0]=15&foo[0].bar=2', { allowDots: true }), { foo: [{ baz: ['15'], bar: '2' }] }); + st.deepEqual(qs.parse('foo[0].baz[0]=15&foo[0].baz[1]=16&foo[0].bar=2', { allowDots: true }), { foo: [{ baz: ['15', '16'], bar: '2' }] }); + st.deepEqual(qs.parse('foo.bad=baz&foo[0]=bar', { allowDots: true }), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar', { allowDots: true }), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo[]=bar&foo.bad=baz', { allowDots: true }), { foo: { 0: 'bar', bad: 'baz' } }); + st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar&foo[]=foo', { allowDots: true }), { foo: { bad: 'baz', 0: 'bar', 1: 'foo' } }); + st.deepEqual(qs.parse('foo[0].a=a&foo[0].b=b&foo[1].a=aa&foo[1].b=bb', { allowDots: true }), { foo: [{ a: 'a', b: 'b' }, { a: 'aa', b: 'bb' }] }); + st.end(); + }); + + t.test('correctly prunes undefined values when converting an array to an object', function (st) { + st.deepEqual(qs.parse('a[2]=b&a[99999999]=c'), { a: { 2: 'b', 99999999: 'c' } }); + st.end(); + }); + + t.test('supports malformed uri characters', function (st) { + st.deepEqual(qs.parse('{%:%}', { strictNullHandling: true }), { '{%:%}': null }); + st.deepEqual(qs.parse('{%:%}='), { '{%:%}': '' }); + st.deepEqual(qs.parse('foo=%:%}'), { foo: '%:%}' }); + st.end(); + }); + + t.test('doesn\'t produce empty keys', function (st) { + st.deepEqual(qs.parse('_r=1&'), { _r: '1' }); + st.end(); + }); + + t.test('cannot access Object prototype', function (st) { + qs.parse('constructor[prototype][bad]=bad'); + qs.parse('bad[constructor][prototype][bad]=bad'); + st.equal(typeof Object.prototype.bad, 'undefined'); + st.end(); + }); + + t.test('parses arrays of objects', function (st) { + st.deepEqual(qs.parse('a[][b]=c'), { a: [{ b: 'c' }] }); + st.deepEqual(qs.parse('a[0][b]=c'), { a: [{ b: 'c' }] }); + st.end(); + }); + + t.test('allows for empty strings in arrays', function (st) { + st.deepEqual(qs.parse('a[]=b&a[]=&a[]=c'), { a: ['b', '', 'c'] }); + + st.deepEqual( + qs.parse('a[0]=b&a[1]&a[2]=c&a[19]=', { strictNullHandling: true, arrayLimit: 20 }), + { a: ['b', null, 'c', ''] }, + 'with arrayLimit 20 + array indices: null then empty string works' + ); + st.deepEqual( + qs.parse('a[]=b&a[]&a[]=c&a[]=', { strictNullHandling: true, arrayLimit: 0 }), + { a: ['b', null, 'c', ''] }, + 'with arrayLimit 0 + array brackets: null then empty string works' + ); + + st.deepEqual( + qs.parse('a[0]=b&a[1]=&a[2]=c&a[19]', { strictNullHandling: true, arrayLimit: 20 }), + { a: ['b', '', 'c', null] }, + 'with arrayLimit 20 + array indices: empty string then null works' + ); + st.deepEqual( + qs.parse('a[]=b&a[]=&a[]=c&a[]', { strictNullHandling: true, arrayLimit: 0 }), + { a: ['b', '', 'c', null] }, + 'with arrayLimit 0 + array brackets: empty string then null works' + ); + + st.deepEqual( + qs.parse('a[]=&a[]=b&a[]=c'), + { a: ['', 'b', 'c'] }, + 'array brackets: empty strings work' + ); + st.end(); + }); + + t.test('compacts sparse arrays', function (st) { + st.deepEqual(qs.parse('a[10]=1&a[2]=2', { arrayLimit: 20 }), { a: ['2', '1'] }); + st.deepEqual(qs.parse('a[1][b][2][c]=1', { arrayLimit: 20 }), { a: [{ b: [{ c: '1' }] }] }); + st.deepEqual(qs.parse('a[1][2][3][c]=1', { arrayLimit: 20 }), { a: [[[{ c: '1' }]]] }); + st.deepEqual(qs.parse('a[1][2][3][c][1]=1', { arrayLimit: 20 }), { a: [[[{ c: ['1'] }]]] }); + st.end(); + }); + + t.test('parses semi-parsed strings', function (st) { + st.deepEqual(qs.parse({ 'a[b]': 'c' }), { a: { b: 'c' } }); + st.deepEqual(qs.parse({ 'a[b]': 'c', 'a[d]': 'e' }), { a: { b: 'c', d: 'e' } }); + st.end(); + }); + + t.test('parses buffers correctly', function (st) { + var b = new Buffer('test'); + st.deepEqual(qs.parse({ a: b }), { a: b }); + st.end(); + }); + + t.test('continues parsing when no parent is found', function (st) { + st.deepEqual(qs.parse('[]=&a=b'), { 0: '', a: 'b' }); + st.deepEqual(qs.parse('[]&a=b', { strictNullHandling: true }), { 0: null, a: 'b' }); + st.deepEqual(qs.parse('[foo]=bar'), { foo: 'bar' }); + st.end(); + }); + + t.test('does not error when parsing a very long array', function (st) { + var str = 'a[]=a'; + while (Buffer.byteLength(str) < 128 * 1024) { + str = str + '&' + str; + } + + st.doesNotThrow(function () { + qs.parse(str); + }); + + st.end(); + }); + + t.test('should not throw when a native prototype has an enumerable property', { parallel: false }, function (st) { + Object.prototype.crash = ''; + Array.prototype.crash = ''; + st.doesNotThrow(qs.parse.bind(null, 'a=b')); + st.deepEqual(qs.parse('a=b'), { a: 'b' }); + st.doesNotThrow(qs.parse.bind(null, 'a[][b]=c')); + st.deepEqual(qs.parse('a[][b]=c'), { a: [{ b: 'c' }] }); + delete Object.prototype.crash; + delete Array.prototype.crash; + st.end(); + }); + + t.test('parses a string with an alternative string delimiter', function (st) { + st.deepEqual(qs.parse('a=b;c=d', { delimiter: ';' }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('parses a string with an alternative RegExp delimiter', function (st) { + st.deepEqual(qs.parse('a=b; c=d', { delimiter: /[;,] */ }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('does not use non-splittable objects as delimiters', function (st) { + st.deepEqual(qs.parse('a=b&c=d', { delimiter: true }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('allows overriding parameter limit', function (st) { + st.deepEqual(qs.parse('a=b&c=d', { parameterLimit: 1 }), { a: 'b' }); + st.end(); + }); + + t.test('allows setting the parameter limit to Infinity', function (st) { + st.deepEqual(qs.parse('a=b&c=d', { parameterLimit: Infinity }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('allows overriding array limit', function (st) { + st.deepEqual(qs.parse('a[0]=b', { arrayLimit: -1 }), { a: { 0: 'b' } }); + st.deepEqual(qs.parse('a[-1]=b', { arrayLimit: -1 }), { a: { '-1': 'b' } }); + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { arrayLimit: 0 }), { a: { 0: 'b', 1: 'c' } }); + st.end(); + }); + + t.test('allows disabling array parsing', function (st) { + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { parseArrays: false }), { a: { 0: 'b', 1: 'c' } }); + st.end(); + }); + + t.test('allows for query string prefix', function (st) { + st.deepEqual(qs.parse('?foo=bar', { ignoreQueryPrefix: true }), { foo: 'bar' }); + st.deepEqual(qs.parse('foo=bar', { ignoreQueryPrefix: true }), { foo: 'bar' }); + st.deepEqual(qs.parse('?foo=bar', { ignoreQueryPrefix: false }), { '?foo': 'bar' }); + st.end(); + }); + + t.test('parses an object', function (st) { + var input = { + 'user[name]': { 'pop[bob]': 3 }, + 'user[email]': null + }; + + var expected = { + user: { + name: { 'pop[bob]': 3 }, + email: null + } + }; + + var result = qs.parse(input); + + st.deepEqual(result, expected); + st.end(); + }); + + t.test('parses an object in dot notation', function (st) { + var input = { + 'user.name': { 'pop[bob]': 3 }, + 'user.email.': null + }; + + var expected = { + user: { + name: { 'pop[bob]': 3 }, + email: null + } + }; + + var result = qs.parse(input, { allowDots: true }); + + st.deepEqual(result, expected); + st.end(); + }); + + t.test('parses an object and not child values', function (st) { + var input = { + 'user[name]': { 'pop[bob]': { test: 3 } }, + 'user[email]': null + }; + + var expected = { + user: { + name: { 'pop[bob]': { test: 3 } }, + email: null + } + }; + + var result = qs.parse(input); + + st.deepEqual(result, expected); + st.end(); + }); + + t.test('does not blow up when Buffer global is missing', function (st) { + var tempBuffer = global.Buffer; + delete global.Buffer; + var result = qs.parse('a=b&c=d'); + global.Buffer = tempBuffer; + st.deepEqual(result, { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('does not crash when parsing circular references', function (st) { + var a = {}; + a.b = a; + + var parsed; + + st.doesNotThrow(function () { + parsed = qs.parse({ 'foo[bar]': 'baz', 'foo[baz]': a }); + }); + + st.equal('foo' in parsed, true, 'parsed has "foo" property'); + st.equal('bar' in parsed.foo, true); + st.equal('baz' in parsed.foo, true); + st.equal(parsed.foo.bar, 'baz'); + st.deepEqual(parsed.foo.baz, a); + st.end(); + }); + + t.test('does not crash when parsing deep objects', function (st) { + var parsed; + var str = 'foo'; + + for (var i = 0; i < 5000; i++) { + str += '[p]'; + } + + str += '=bar'; + + st.doesNotThrow(function () { + parsed = qs.parse(str, { depth: 5000 }); + }); + + st.equal('foo' in parsed, true, 'parsed has "foo" property'); + + var depth = 0; + var ref = parsed.foo; + while ((ref = ref.p)) { + depth += 1; + } + + st.equal(depth, 5000, 'parsed is 5000 properties deep'); + + st.end(); + }); + + t.test('parses null objects correctly', { skip: !Object.create }, function (st) { + var a = Object.create(null); + a.b = 'c'; + + st.deepEqual(qs.parse(a), { b: 'c' }); + var result = qs.parse({ a: a }); + st.equal('a' in result, true, 'result has "a" property'); + st.deepEqual(result.a, a); + st.end(); + }); + + t.test('parses dates correctly', function (st) { + var now = new Date(); + st.deepEqual(qs.parse({ a: now }), { a: now }); + st.end(); + }); + + t.test('parses regular expressions correctly', function (st) { + var re = /^test$/; + st.deepEqual(qs.parse({ a: re }), { a: re }); + st.end(); + }); + + t.test('does not allow overwriting prototype properties', function (st) { + st.deepEqual(qs.parse('a[hasOwnProperty]=b', { allowPrototypes: false }), {}); + st.deepEqual(qs.parse('hasOwnProperty=b', { allowPrototypes: false }), {}); + + st.deepEqual( + qs.parse('toString', { allowPrototypes: false }), + {}, + 'bare "toString" results in {}' + ); + + st.end(); + }); + + t.test('can allow overwriting prototype properties', function (st) { + st.deepEqual(qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }), { a: { hasOwnProperty: 'b' } }); + st.deepEqual(qs.parse('hasOwnProperty=b', { allowPrototypes: true }), { hasOwnProperty: 'b' }); + + st.deepEqual( + qs.parse('toString', { allowPrototypes: true }), + { toString: '' }, + 'bare "toString" results in { toString: "" }' + ); + + st.end(); + }); + + t.test('params starting with a closing bracket', function (st) { + st.deepEqual(qs.parse(']=toString'), { ']': 'toString' }); + st.deepEqual(qs.parse(']]=toString'), { ']]': 'toString' }); + st.deepEqual(qs.parse(']hello]=toString'), { ']hello]': 'toString' }); + st.end(); + }); + + t.test('params starting with a starting bracket', function (st) { + st.deepEqual(qs.parse('[=toString'), { '[': 'toString' }); + st.deepEqual(qs.parse('[[=toString'), { '[[': 'toString' }); + st.deepEqual(qs.parse('[hello[=toString'), { '[hello[': 'toString' }); + st.end(); + }); + + t.test('add keys to objects', function (st) { + st.deepEqual( + qs.parse('a[b]=c&a=d'), + { a: { b: 'c', d: true } }, + 'can add keys to objects' + ); + + st.deepEqual( + qs.parse('a[b]=c&a=toString'), + { a: { b: 'c' } }, + 'can not overwrite prototype' + ); + + st.deepEqual( + qs.parse('a[b]=c&a=toString', { allowPrototypes: true }), + { a: { b: 'c', toString: true } }, + 'can overwrite prototype with allowPrototypes true' + ); + + st.deepEqual( + qs.parse('a[b]=c&a=toString', { plainObjects: true }), + { a: { b: 'c', toString: true } }, + 'can overwrite prototype with plainObjects true' + ); + + st.end(); + }); + + t.test('can return null objects', { skip: !Object.create }, function (st) { + var expected = Object.create(null); + expected.a = Object.create(null); + expected.a.b = 'c'; + expected.a.hasOwnProperty = 'd'; + st.deepEqual(qs.parse('a[b]=c&a[hasOwnProperty]=d', { plainObjects: true }), expected); + st.deepEqual(qs.parse(null, { plainObjects: true }), Object.create(null)); + var expectedArray = Object.create(null); + expectedArray.a = Object.create(null); + expectedArray.a[0] = 'b'; + expectedArray.a.c = 'd'; + st.deepEqual(qs.parse('a[]=b&a[c]=d', { plainObjects: true }), expectedArray); + st.end(); + }); + + t.test('can parse with custom encoding', function (st) { + st.deepEqual(qs.parse('%8c%a7=%91%e5%8d%e3%95%7b', { + decoder: function (str) { + var reg = /%([0-9A-F]{2})/ig; + var result = []; + var parts = reg.exec(str); + while (parts) { + result.push(parseInt(parts[1], 16)); + parts = reg.exec(str); + } + return iconv.decode(new Buffer(result), 'shift_jis').toString(); + } + }), { 県: '大阪府' }); + st.end(); + }); + + t.test('receives the default decoder as a second argument', function (st) { + st.plan(1); + qs.parse('a', { + decoder: function (str, defaultDecoder) { + st.equal(defaultDecoder, utils.decode); + } + }); + st.end(); + }); + + t.test('throws error with wrong decoder', function (st) { + st['throws'](function () { + qs.parse({}, { decoder: 'string' }); + }, new TypeError('Decoder has to be a function.')); + st.end(); + }); + + t.test('does not mutate the options argument', function (st) { + var options = {}; + qs.parse('a[b]=true', options); + st.deepEqual(options, {}); + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/qs/test/stringify.js b/node_modules/qs/test/stringify.js new file mode 100644 index 0000000..124a99d --- /dev/null +++ b/node_modules/qs/test/stringify.js @@ -0,0 +1,596 @@ +'use strict'; + +var test = require('tape'); +var qs = require('../'); +var utils = require('../lib/utils'); +var iconv = require('iconv-lite'); + +test('stringify()', function (t) { + t.test('stringifies a querystring object', function (st) { + st.equal(qs.stringify({ a: 'b' }), 'a=b'); + st.equal(qs.stringify({ a: 1 }), 'a=1'); + st.equal(qs.stringify({ a: 1, b: 2 }), 'a=1&b=2'); + st.equal(qs.stringify({ a: 'A_Z' }), 'a=A_Z'); + st.equal(qs.stringify({ a: '€' }), 'a=%E2%82%AC'); + st.equal(qs.stringify({ a: '' }), 'a=%EE%80%80'); + st.equal(qs.stringify({ a: 'א' }), 'a=%D7%90'); + st.equal(qs.stringify({ a: '𐐷' }), 'a=%F0%90%90%B7'); + st.end(); + }); + + t.test('adds query prefix', function (st) { + st.equal(qs.stringify({ a: 'b' }, { addQueryPrefix: true }), '?a=b'); + st.end(); + }); + + t.test('with query prefix, outputs blank string given an empty object', function (st) { + st.equal(qs.stringify({}, { addQueryPrefix: true }), ''); + st.end(); + }); + + t.test('stringifies a nested object', function (st) { + st.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); + st.equal(qs.stringify({ a: { b: { c: { d: 'e' } } } }), 'a%5Bb%5D%5Bc%5D%5Bd%5D=e'); + st.end(); + }); + + t.test('stringifies a nested object with dots notation', function (st) { + st.equal(qs.stringify({ a: { b: 'c' } }, { allowDots: true }), 'a.b=c'); + st.equal(qs.stringify({ a: { b: { c: { d: 'e' } } } }, { allowDots: true }), 'a.b.c.d=e'); + st.end(); + }); + + t.test('stringifies an array value', function (st) { + st.equal( + qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'indices' }), + 'a%5B0%5D=b&a%5B1%5D=c&a%5B2%5D=d', + 'indices => indices' + ); + st.equal( + qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'brackets' }), + 'a%5B%5D=b&a%5B%5D=c&a%5B%5D=d', + 'brackets => brackets' + ); + st.equal( + qs.stringify({ a: ['b', 'c', 'd'] }), + 'a%5B0%5D=b&a%5B1%5D=c&a%5B2%5D=d', + 'default => indices' + ); + st.end(); + }); + + t.test('omits nulls when asked', function (st) { + st.equal(qs.stringify({ a: 'b', c: null }, { skipNulls: true }), 'a=b'); + st.end(); + }); + + t.test('omits nested nulls when asked', function (st) { + st.equal(qs.stringify({ a: { b: 'c', d: null } }, { skipNulls: true }), 'a%5Bb%5D=c'); + st.end(); + }); + + t.test('omits array indices when asked', function (st) { + st.equal(qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }), 'a=b&a=c&a=d'); + st.end(); + }); + + t.test('stringifies a nested array value', function (st) { + st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { arrayFormat: 'indices' }), 'a%5Bb%5D%5B0%5D=c&a%5Bb%5D%5B1%5D=d'); + st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { arrayFormat: 'brackets' }), 'a%5Bb%5D%5B%5D=c&a%5Bb%5D%5B%5D=d'); + st.equal(qs.stringify({ a: { b: ['c', 'd'] } }), 'a%5Bb%5D%5B0%5D=c&a%5Bb%5D%5B1%5D=d'); + st.end(); + }); + + t.test('stringifies a nested array value with dots notation', function (st) { + st.equal( + qs.stringify( + { a: { b: ['c', 'd'] } }, + { allowDots: true, encode: false, arrayFormat: 'indices' } + ), + 'a.b[0]=c&a.b[1]=d', + 'indices: stringifies with dots + indices' + ); + st.equal( + qs.stringify( + { a: { b: ['c', 'd'] } }, + { allowDots: true, encode: false, arrayFormat: 'brackets' } + ), + 'a.b[]=c&a.b[]=d', + 'brackets: stringifies with dots + brackets' + ); + st.equal( + qs.stringify( + { a: { b: ['c', 'd'] } }, + { allowDots: true, encode: false } + ), + 'a.b[0]=c&a.b[1]=d', + 'default: stringifies with dots + indices' + ); + st.end(); + }); + + t.test('stringifies an object inside an array', function (st) { + st.equal( + qs.stringify({ a: [{ b: 'c' }] }, { arrayFormat: 'indices' }), + 'a%5B0%5D%5Bb%5D=c', + 'indices => brackets' + ); + st.equal( + qs.stringify({ a: [{ b: 'c' }] }, { arrayFormat: 'brackets' }), + 'a%5B%5D%5Bb%5D=c', + 'brackets => brackets' + ); + st.equal( + qs.stringify({ a: [{ b: 'c' }] }), + 'a%5B0%5D%5Bb%5D=c', + 'default => indices' + ); + + st.equal( + qs.stringify({ a: [{ b: { c: [1] } }] }, { arrayFormat: 'indices' }), + 'a%5B0%5D%5Bb%5D%5Bc%5D%5B0%5D=1', + 'indices => indices' + ); + + st.equal( + qs.stringify({ a: [{ b: { c: [1] } }] }, { arrayFormat: 'brackets' }), + 'a%5B%5D%5Bb%5D%5Bc%5D%5B%5D=1', + 'brackets => brackets' + ); + + st.equal( + qs.stringify({ a: [{ b: { c: [1] } }] }), + 'a%5B0%5D%5Bb%5D%5Bc%5D%5B0%5D=1', + 'default => indices' + ); + + st.end(); + }); + + t.test('stringifies an array with mixed objects and primitives', function (st) { + st.equal( + qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encode: false, arrayFormat: 'indices' }), + 'a[0][b]=1&a[1]=2&a[2]=3', + 'indices => indices' + ); + st.equal( + qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encode: false, arrayFormat: 'brackets' }), + 'a[][b]=1&a[]=2&a[]=3', + 'brackets => brackets' + ); + st.equal( + qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encode: false }), + 'a[0][b]=1&a[1]=2&a[2]=3', + 'default => indices' + ); + + st.end(); + }); + + t.test('stringifies an object inside an array with dots notation', function (st) { + st.equal( + qs.stringify( + { a: [{ b: 'c' }] }, + { allowDots: true, encode: false, arrayFormat: 'indices' } + ), + 'a[0].b=c', + 'indices => indices' + ); + st.equal( + qs.stringify( + { a: [{ b: 'c' }] }, + { allowDots: true, encode: false, arrayFormat: 'brackets' } + ), + 'a[].b=c', + 'brackets => brackets' + ); + st.equal( + qs.stringify( + { a: [{ b: 'c' }] }, + { allowDots: true, encode: false } + ), + 'a[0].b=c', + 'default => indices' + ); + + st.equal( + qs.stringify( + { a: [{ b: { c: [1] } }] }, + { allowDots: true, encode: false, arrayFormat: 'indices' } + ), + 'a[0].b.c[0]=1', + 'indices => indices' + ); + st.equal( + qs.stringify( + { a: [{ b: { c: [1] } }] }, + { allowDots: true, encode: false, arrayFormat: 'brackets' } + ), + 'a[].b.c[]=1', + 'brackets => brackets' + ); + st.equal( + qs.stringify( + { a: [{ b: { c: [1] } }] }, + { allowDots: true, encode: false } + ), + 'a[0].b.c[0]=1', + 'default => indices' + ); + + st.end(); + }); + + t.test('does not omit object keys when indices = false', function (st) { + st.equal(qs.stringify({ a: [{ b: 'c' }] }, { indices: false }), 'a%5Bb%5D=c'); + st.end(); + }); + + t.test('uses indices notation for arrays when indices=true', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { indices: true }), 'a%5B0%5D=b&a%5B1%5D=c'); + st.end(); + }); + + t.test('uses indices notation for arrays when no arrayFormat is specified', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }), 'a%5B0%5D=b&a%5B1%5D=c'); + st.end(); + }); + + t.test('uses indices notation for arrays when no arrayFormat=indices', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }), 'a%5B0%5D=b&a%5B1%5D=c'); + st.end(); + }); + + t.test('uses repeat notation for arrays when no arrayFormat=repeat', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }), 'a=b&a=c'); + st.end(); + }); + + t.test('uses brackets notation for arrays when no arrayFormat=brackets', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }), 'a%5B%5D=b&a%5B%5D=c'); + st.end(); + }); + + t.test('stringifies a complicated object', function (st) { + st.equal(qs.stringify({ a: { b: 'c', d: 'e' } }), 'a%5Bb%5D=c&a%5Bd%5D=e'); + st.end(); + }); + + t.test('stringifies an empty value', function (st) { + st.equal(qs.stringify({ a: '' }), 'a='); + st.equal(qs.stringify({ a: null }, { strictNullHandling: true }), 'a'); + + st.equal(qs.stringify({ a: '', b: '' }), 'a=&b='); + st.equal(qs.stringify({ a: null, b: '' }, { strictNullHandling: true }), 'a&b='); + + st.equal(qs.stringify({ a: { b: '' } }), 'a%5Bb%5D='); + st.equal(qs.stringify({ a: { b: null } }, { strictNullHandling: true }), 'a%5Bb%5D'); + st.equal(qs.stringify({ a: { b: null } }, { strictNullHandling: false }), 'a%5Bb%5D='); + + st.end(); + }); + + t.test('stringifies a null object', { skip: !Object.create }, function (st) { + var obj = Object.create(null); + obj.a = 'b'; + st.equal(qs.stringify(obj), 'a=b'); + st.end(); + }); + + t.test('returns an empty string for invalid input', function (st) { + st.equal(qs.stringify(undefined), ''); + st.equal(qs.stringify(false), ''); + st.equal(qs.stringify(null), ''); + st.equal(qs.stringify(''), ''); + st.end(); + }); + + t.test('stringifies an object with a null object as a child', { skip: !Object.create }, function (st) { + var obj = { a: Object.create(null) }; + + obj.a.b = 'c'; + st.equal(qs.stringify(obj), 'a%5Bb%5D=c'); + st.end(); + }); + + t.test('drops keys with a value of undefined', function (st) { + st.equal(qs.stringify({ a: undefined }), ''); + + st.equal(qs.stringify({ a: { b: undefined, c: null } }, { strictNullHandling: true }), 'a%5Bc%5D'); + st.equal(qs.stringify({ a: { b: undefined, c: null } }, { strictNullHandling: false }), 'a%5Bc%5D='); + st.equal(qs.stringify({ a: { b: undefined, c: '' } }), 'a%5Bc%5D='); + st.end(); + }); + + t.test('url encodes values', function (st) { + st.equal(qs.stringify({ a: 'b c' }), 'a=b%20c'); + st.end(); + }); + + t.test('stringifies a date', function (st) { + var now = new Date(); + var str = 'a=' + encodeURIComponent(now.toISOString()); + st.equal(qs.stringify({ a: now }), str); + st.end(); + }); + + t.test('stringifies the weird object from qs', function (st) { + st.equal(qs.stringify({ 'my weird field': '~q1!2"\'w$5&7/z8)?' }), 'my%20weird%20field=~q1%212%22%27w%245%267%2Fz8%29%3F'); + st.end(); + }); + + t.test('skips properties that are part of the object prototype', function (st) { + Object.prototype.crash = 'test'; + st.equal(qs.stringify({ a: 'b' }), 'a=b'); + st.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); + delete Object.prototype.crash; + st.end(); + }); + + t.test('stringifies boolean values', function (st) { + st.equal(qs.stringify({ a: true }), 'a=true'); + st.equal(qs.stringify({ a: { b: true } }), 'a%5Bb%5D=true'); + st.equal(qs.stringify({ b: false }), 'b=false'); + st.equal(qs.stringify({ b: { c: false } }), 'b%5Bc%5D=false'); + st.end(); + }); + + t.test('stringifies buffer values', function (st) { + st.equal(qs.stringify({ a: new Buffer('test') }), 'a=test'); + st.equal(qs.stringify({ a: { b: new Buffer('test') } }), 'a%5Bb%5D=test'); + st.end(); + }); + + t.test('stringifies an object using an alternative delimiter', function (st) { + st.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d'); + st.end(); + }); + + t.test('doesn\'t blow up when Buffer global is missing', function (st) { + var tempBuffer = global.Buffer; + delete global.Buffer; + var result = qs.stringify({ a: 'b', c: 'd' }); + global.Buffer = tempBuffer; + st.equal(result, 'a=b&c=d'); + st.end(); + }); + + t.test('selects properties when filter=array', function (st) { + st.equal(qs.stringify({ a: 'b' }, { filter: ['a'] }), 'a=b'); + st.equal(qs.stringify({ a: 1 }, { filter: [] }), ''); + + st.equal( + qs.stringify( + { a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' }, + { filter: ['a', 'b', 0, 2], arrayFormat: 'indices' } + ), + 'a%5Bb%5D%5B0%5D=1&a%5Bb%5D%5B2%5D=3', + 'indices => indices' + ); + st.equal( + qs.stringify( + { a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' }, + { filter: ['a', 'b', 0, 2], arrayFormat: 'brackets' } + ), + 'a%5Bb%5D%5B%5D=1&a%5Bb%5D%5B%5D=3', + 'brackets => brackets' + ); + st.equal( + qs.stringify( + { a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' }, + { filter: ['a', 'b', 0, 2] } + ), + 'a%5Bb%5D%5B0%5D=1&a%5Bb%5D%5B2%5D=3', + 'default => indices' + ); + + st.end(); + }); + + t.test('supports custom representations when filter=function', function (st) { + var calls = 0; + var obj = { a: 'b', c: 'd', e: { f: new Date(1257894000000) } }; + var filterFunc = function (prefix, value) { + calls += 1; + if (calls === 1) { + st.equal(prefix, '', 'prefix is empty'); + st.equal(value, obj); + } else if (prefix === 'c') { + return void 0; + } else if (value instanceof Date) { + st.equal(prefix, 'e[f]'); + return value.getTime(); + } + return value; + }; + + st.equal(qs.stringify(obj, { filter: filterFunc }), 'a=b&e%5Bf%5D=1257894000000'); + st.equal(calls, 5); + st.end(); + }); + + t.test('can disable uri encoding', function (st) { + st.equal(qs.stringify({ a: 'b' }, { encode: false }), 'a=b'); + st.equal(qs.stringify({ a: { b: 'c' } }, { encode: false }), 'a[b]=c'); + st.equal(qs.stringify({ a: 'b', c: null }, { strictNullHandling: true, encode: false }), 'a=b&c'); + st.end(); + }); + + t.test('can sort the keys', function (st) { + var sort = function (a, b) { + return a.localeCompare(b); + }; + st.equal(qs.stringify({ a: 'c', z: 'y', b: 'f' }, { sort: sort }), 'a=c&b=f&z=y'); + st.equal(qs.stringify({ a: 'c', z: { j: 'a', i: 'b' }, b: 'f' }, { sort: sort }), 'a=c&b=f&z%5Bi%5D=b&z%5Bj%5D=a'); + st.end(); + }); + + t.test('can sort the keys at depth 3 or more too', function (st) { + var sort = function (a, b) { + return a.localeCompare(b); + }; + st.equal( + qs.stringify( + { a: 'a', z: { zj: { zjb: 'zjb', zja: 'zja' }, zi: { zib: 'zib', zia: 'zia' } }, b: 'b' }, + { sort: sort, encode: false } + ), + 'a=a&b=b&z[zi][zia]=zia&z[zi][zib]=zib&z[zj][zja]=zja&z[zj][zjb]=zjb' + ); + st.equal( + qs.stringify( + { a: 'a', z: { zj: { zjb: 'zjb', zja: 'zja' }, zi: { zib: 'zib', zia: 'zia' } }, b: 'b' }, + { sort: null, encode: false } + ), + 'a=a&z[zj][zjb]=zjb&z[zj][zja]=zja&z[zi][zib]=zib&z[zi][zia]=zia&b=b' + ); + st.end(); + }); + + t.test('can stringify with custom encoding', function (st) { + st.equal(qs.stringify({ 県: '大阪府', '': '' }, { + encoder: function (str) { + if (str.length === 0) { + return ''; + } + var buf = iconv.encode(str, 'shiftjis'); + var result = []; + for (var i = 0; i < buf.length; ++i) { + result.push(buf.readUInt8(i).toString(16)); + } + return '%' + result.join('%'); + } + }), '%8c%a7=%91%e5%8d%e3%95%7b&='); + st.end(); + }); + + t.test('receives the default encoder as a second argument', function (st) { + st.plan(2); + qs.stringify({ a: 1 }, { + encoder: function (str, defaultEncoder) { + st.equal(defaultEncoder, utils.encode); + } + }); + st.end(); + }); + + t.test('throws error with wrong encoder', function (st) { + st['throws'](function () { + qs.stringify({}, { encoder: 'string' }); + }, new TypeError('Encoder has to be a function.')); + st.end(); + }); + + t.test('can use custom encoder for a buffer object', { skip: typeof Buffer === 'undefined' }, function (st) { + st.equal(qs.stringify({ a: new Buffer([1]) }, { + encoder: function (buffer) { + if (typeof buffer === 'string') { + return buffer; + } + return String.fromCharCode(buffer.readUInt8(0) + 97); + } + }), 'a=b'); + st.end(); + }); + + t.test('serializeDate option', function (st) { + var date = new Date(); + st.equal( + qs.stringify({ a: date }), + 'a=' + date.toISOString().replace(/:/g, '%3A'), + 'default is toISOString' + ); + + var mutatedDate = new Date(); + mutatedDate.toISOString = function () { + throw new SyntaxError(); + }; + st['throws'](function () { + mutatedDate.toISOString(); + }, SyntaxError); + st.equal( + qs.stringify({ a: mutatedDate }), + 'a=' + Date.prototype.toISOString.call(mutatedDate).replace(/:/g, '%3A'), + 'toISOString works even when method is not locally present' + ); + + var specificDate = new Date(6); + st.equal( + qs.stringify( + { a: specificDate }, + { serializeDate: function (d) { return d.getTime() * 7; } } + ), + 'a=42', + 'custom serializeDate function called' + ); + + st.end(); + }); + + t.test('RFC 1738 spaces serialization', function (st) { + st.equal(qs.stringify({ a: 'b c' }, { format: qs.formats.RFC1738 }), 'a=b+c'); + st.equal(qs.stringify({ 'a b': 'c d' }, { format: qs.formats.RFC1738 }), 'a+b=c+d'); + st.end(); + }); + + t.test('RFC 3986 spaces serialization', function (st) { + st.equal(qs.stringify({ a: 'b c' }, { format: qs.formats.RFC3986 }), 'a=b%20c'); + st.equal(qs.stringify({ 'a b': 'c d' }, { format: qs.formats.RFC3986 }), 'a%20b=c%20d'); + st.end(); + }); + + t.test('Backward compatibility to RFC 3986', function (st) { + st.equal(qs.stringify({ a: 'b c' }), 'a=b%20c'); + st.end(); + }); + + t.test('Edge cases and unknown formats', function (st) { + ['UFO1234', false, 1234, null, {}, []].forEach( + function (format) { + st['throws']( + function () { + qs.stringify({ a: 'b c' }, { format: format }); + }, + new TypeError('Unknown format option provided.') + ); + } + ); + st.end(); + }); + + t.test('encodeValuesOnly', function (st) { + st.equal( + qs.stringify( + { a: 'b', c: ['d', 'e=f'], f: [['g'], ['h']] }, + { encodeValuesOnly: true } + ), + 'a=b&c[0]=d&c[1]=e%3Df&f[0][0]=g&f[1][0]=h' + ); + st.equal( + qs.stringify( + { a: 'b', c: ['d', 'e'], f: [['g'], ['h']] } + ), + 'a=b&c%5B0%5D=d&c%5B1%5D=e&f%5B0%5D%5B0%5D=g&f%5B1%5D%5B0%5D=h' + ); + st.end(); + }); + + t.test('encodeValuesOnly - strictNullHandling', function (st) { + st.equal( + qs.stringify( + { a: { b: null } }, + { encodeValuesOnly: true, strictNullHandling: true } + ), + 'a[b]' + ); + st.end(); + }); + + t.test('does not mutate the options argument', function (st) { + var options = {}; + qs.stringify({}, options); + st.deepEqual(options, {}); + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/qs/test/utils.js b/node_modules/qs/test/utils.js new file mode 100644 index 0000000..eff4011 --- /dev/null +++ b/node_modules/qs/test/utils.js @@ -0,0 +1,34 @@ +'use strict'; + +var test = require('tape'); +var utils = require('../lib/utils'); + +test('merge()', function (t) { + t.deepEqual(utils.merge({ a: 'b' }, { a: 'c' }), { a: ['b', 'c'] }, 'merges two objects with the same key'); + + var oneMerged = utils.merge({ foo: 'bar' }, { foo: { first: '123' } }); + t.deepEqual(oneMerged, { foo: ['bar', { first: '123' }] }, 'merges a standalone and an object into an array'); + + var twoMerged = utils.merge({ foo: ['bar', { first: '123' }] }, { foo: { second: '456' } }); + t.deepEqual(twoMerged, { foo: { 0: 'bar', 1: { first: '123' }, second: '456' } }, 'merges a standalone and two objects into an array'); + + var sandwiched = utils.merge({ foo: ['bar', { first: '123', second: '456' }] }, { foo: 'baz' }); + t.deepEqual(sandwiched, { foo: ['bar', { first: '123', second: '456' }, 'baz'] }, 'merges an object sandwiched by two standalones into an array'); + + var nestedArrays = utils.merge({ foo: ['baz'] }, { foo: ['bar', 'xyzzy'] }); + t.deepEqual(nestedArrays, { foo: ['baz', 'bar', 'xyzzy'] }); + + t.end(); +}); + +test('assign()', function (t) { + var target = { a: 1, b: 2 }; + var source = { b: 3, c: 4 }; + var result = utils.assign(target, source); + + t.equal(result, target, 'returns the target'); + t.deepEqual(target, { a: 1, b: 3, c: 4 }, 'target and source are merged'); + t.deepEqual(source, { b: 3, c: 4 }, 'source is untouched'); + + t.end(); +}); diff --git a/node_modules/range-parser/HISTORY.md b/node_modules/range-parser/HISTORY.md new file mode 100644 index 0000000..5e01eef --- /dev/null +++ b/node_modules/range-parser/HISTORY.md @@ -0,0 +1,51 @@ +1.2.0 / 2016-06-01 +================== + + * Add `combine` option to combine overlapping ranges + +1.1.0 / 2016-05-13 +================== + + * Fix incorrectly returning -1 when there is at least one valid range + * perf: remove internal function + +1.0.3 / 2015-10-29 +================== + + * perf: enable strict mode + +1.0.2 / 2014-09-08 +================== + + * Support Node.js 0.6 + +1.0.1 / 2014-09-07 +================== + + * Move repository to jshttp + +1.0.0 / 2013-12-11 +================== + + * Add repository to package.json + * Add MIT license + +0.0.4 / 2012-06-17 +================== + + * Change ret -1 for unsatisfiable and -2 when invalid + +0.0.3 / 2012-06-17 +================== + + * Fix last-byte-pos default to len - 1 + +0.0.2 / 2012-06-14 +================== + + * Add `.type` + +0.0.1 / 2012-06-11 +================== + + * Initial release diff --git a/node_modules/range-parser/LICENSE b/node_modules/range-parser/LICENSE new file mode 100644 index 0000000..3599954 --- /dev/null +++ b/node_modules/range-parser/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2012-2014 TJ Holowaychuk +Copyright (c) 2015-2016 Douglas Christopher Wilson [ +// { start: 0, end: 10 }, +// { start: 50, end: 60 } +// ] +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/range-parser.svg +[npm-url]: https://npmjs.org/package/range-parser +[node-version-image]: https://img.shields.io/node/v/range-parser.svg +[node-version-url]: https://nodejs.org/endownload +[travis-image]: https://img.shields.io/travis/jshttp/range-parser.svg +[travis-url]: https://travis-ci.org/jshttp/range-parser +[coveralls-image]: https://img.shields.io/coveralls/jshttp/range-parser.svg +[coveralls-url]: https://coveralls.io/r/jshttp/range-parser +[downloads-image]: https://img.shields.io/npm/dm/range-parser.svg +[downloads-url]: https://npmjs.org/package/range-parser diff --git a/node_modules/range-parser/index.js b/node_modules/range-parser/index.js new file mode 100644 index 0000000..83b2eb6 --- /dev/null +++ b/node_modules/range-parser/index.js @@ -0,0 +1,158 @@ +/*! + * range-parser + * Copyright(c) 2012-2014 TJ Holowaychuk + * Copyright(c) 2015-2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = rangeParser + +/** + * Parse "Range" header `str` relative to the given file `size`. + * + * @param {Number} size + * @param {String} str + * @param {Object} [options] + * @return {Array} + * @public + */ + +function rangeParser (size, str, options) { + var index = str.indexOf('=') + + if (index === -1) { + return -2 + } + + // split the range string + var arr = str.slice(index + 1).split(',') + var ranges = [] + + // add ranges type + ranges.type = str.slice(0, index) + + // parse all ranges + for (var i = 0; i < arr.length; i++) { + var range = arr[i].split('-') + var start = parseInt(range[0], 10) + var end = parseInt(range[1], 10) + + // -nnn + if (isNaN(start)) { + start = size - end + end = size - 1 + // nnn- + } else if (isNaN(end)) { + end = size - 1 + } + + // limit last-byte-pos to current length + if (end > size - 1) { + end = size - 1 + } + + // invalid or unsatisifiable + if (isNaN(start) || isNaN(end) || start > end || start < 0) { + continue + } + + // add range + ranges.push({ + start: start, + end: end + }) + } + + if (ranges.length < 1) { + // unsatisifiable + return -1 + } + + return options && options.combine + ? combineRanges(ranges) + : ranges +} + +/** + * Combine overlapping & adjacent ranges. + * @private + */ + +function combineRanges (ranges) { + var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart) + + for (var j = 0, i = 1; i < ordered.length; i++) { + var range = ordered[i] + var current = ordered[j] + + if (range.start > current.end + 1) { + // next range + ordered[++j] = range + } else if (range.end > current.end) { + // extend range + current.end = range.end + current.index = Math.min(current.index, range.index) + } + } + + // trim ordered array + ordered.length = j + 1 + + // generate combined range + var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex) + + // copy ranges type + combined.type = ranges.type + + return combined +} + +/** + * Map function to add index value to ranges. + * @private + */ + +function mapWithIndex (range, index) { + return { + start: range.start, + end: range.end, + index: index + } +} + +/** + * Map function to remove index value from ranges. + * @private + */ + +function mapWithoutIndex (range) { + return { + start: range.start, + end: range.end + } +} + +/** + * Sort function to sort ranges by index. + * @private + */ + +function sortByRangeIndex (a, b) { + return a.index - b.index +} + +/** + * Sort function to sort ranges by start position. + * @private + */ + +function sortByRangeStart (a, b) { + return a.start - b.start +} diff --git a/node_modules/range-parser/package.json b/node_modules/range-parser/package.json new file mode 100644 index 0000000..e1cc52b --- /dev/null +++ b/node_modules/range-parser/package.json @@ -0,0 +1,87 @@ +{ + "_from": "range-parser@~1.2.0", + "_id": "range-parser@1.2.0", + "_inBundle": false, + "_integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=", + "_location": "/range-parser", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "range-parser@~1.2.0", + "name": "range-parser", + "escapedName": "range-parser", + "rawSpec": "~1.2.0", + "saveSpec": null, + "fetchSpec": "~1.2.0" + }, + "_requiredBy": [ + "/express", + "/send" + ], + "_resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "_shasum": "f49be6b487894ddc40dcc94a322f611092e00d5e", + "_spec": "range-parser@~1.2.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/express", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca", + "url": "http://tjholowaychuk.com" + }, + "bugs": { + "url": "https://github.com/jshttp/range-parser/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + { + "name": "James Wyatt Cready", + "email": "wyatt.cready@lanetix.com" + }, + { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com" + } + ], + "deprecated": false, + "description": "Range header field string parser", + "devDependencies": { + "eslint": "2.11.1", + "eslint-config-standard": "5.3.1", + "eslint-plugin-promise": "1.1.0", + "eslint-plugin-standard": "1.3.2", + "istanbul": "0.4.3", + "mocha": "1.21.5" + }, + "engines": { + "node": ">= 0.6" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "index.js" + ], + "homepage": "https://github.com/jshttp/range-parser#readme", + "keywords": [ + "range", + "parser", + "http" + ], + "license": "MIT", + "name": "range-parser", + "repository": { + "type": "git", + "url": "git+https://github.com/jshttp/range-parser.git" + }, + "scripts": { + "lint": "eslint **/*.js", + "test": "mocha --reporter spec", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot" + }, + "version": "1.2.0" +} diff --git a/node_modules/raw-body/HISTORY.md b/node_modules/raw-body/HISTORY.md new file mode 100644 index 0000000..9f1961f --- /dev/null +++ b/node_modules/raw-body/HISTORY.md @@ -0,0 +1,247 @@ +2.3.2 / 2017-09-09 +================== + + * deps: iconv-lite@0.4.19 + - Fix ISO-8859-1regression + - Update Windows-1255 + +2.3.1 / 2017-09-07 +================== + + * deps: bytes@3.0.0 + * deps: http-errors@1.6.2 + - deps: depd@1.1.1 + * perf: skip buffer decoding on overage chunk + +2.3.0 / 2017-08-04 +================== + + * Add TypeScript definitions + * Use `http-errors` for standard emitted errors + * deps: bytes@2.5.0 + * deps: iconv-lite@0.4.18 + - Add support for React Native + - Add a warning if not loaded as utf-8 + - Fix CESU-8 decoding in Node.js 8 + - Improve speed of ISO-8859-1 encoding + +2.2.0 / 2017-01-02 +================== + + * deps: iconv-lite@0.4.15 + - Added encoding MS-31J + - Added encoding MS-932 + - Added encoding MS-936 + - Added encoding MS-949 + - Added encoding MS-950 + - Fix GBK/GB18030 handling of Euro character + +2.1.7 / 2016-06-19 +================== + + * deps: bytes@2.4.0 + * perf: remove double-cleanup on happy path + +2.1.6 / 2016-03-07 +================== + + * deps: bytes@2.3.0 + - Drop partial bytes on all parsed units + - Fix parsing byte string that looks like hex + +2.1.5 / 2015-11-30 +================== + + * deps: bytes@2.2.0 + * deps: iconv-lite@0.4.13 + +2.1.4 / 2015-09-27 +================== + + * Fix masking critical errors from `iconv-lite` + * deps: iconv-lite@0.4.12 + - Fix CESU-8 decoding in Node.js 4.x + +2.1.3 / 2015-09-12 +================== + + * Fix sync callback when attaching data listener causes sync read + - Node.js 0.10 compatibility issue + +2.1.2 / 2015-07-05 +================== + + * Fix error stack traces to skip `makeError` + * deps: iconv-lite@0.4.11 + - Add encoding CESU-8 + +2.1.1 / 2015-06-14 +================== + + * Use `unpipe` module for unpiping requests + +2.1.0 / 2015-05-28 +================== + + * deps: iconv-lite@0.4.10 + - Improved UTF-16 endianness detection + - Leading BOM is now removed when decoding + - The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails + +2.0.2 / 2015-05-21 +================== + + * deps: bytes@2.1.0 + - Slight optimizations + +2.0.1 / 2015-05-10 +================== + + * Fix a false-positive when unpiping in Node.js 0.8 + +2.0.0 / 2015-05-08 +================== + + * Return a promise without callback instead of thunk + * deps: bytes@2.0.1 + - units no longer case sensitive when parsing + +1.3.4 / 2015-04-15 +================== + + * Fix hanging callback if request aborts during read + * deps: iconv-lite@0.4.8 + - Add encoding alias UNICODE-1-1-UTF-7 + +1.3.3 / 2015-02-08 +================== + + * deps: iconv-lite@0.4.7 + - Gracefully support enumerables on `Object.prototype` + +1.3.2 / 2015-01-20 +================== + + * deps: iconv-lite@0.4.6 + - Fix rare aliases of single-byte encodings + +1.3.1 / 2014-11-21 +================== + + * deps: iconv-lite@0.4.5 + - Fix Windows-31J and X-SJIS encoding support + +1.3.0 / 2014-07-20 +================== + + * Fully unpipe the stream on error + - Fixes `Cannot switch to old mode now` error on Node.js 0.10+ + +1.2.3 / 2014-07-20 +================== + + * deps: iconv-lite@0.4.4 + - Added encoding UTF-7 + +1.2.2 / 2014-06-19 +================== + + * Send invalid encoding error to callback + +1.2.1 / 2014-06-15 +================== + + * deps: iconv-lite@0.4.3 + - Added encodings UTF-16BE and UTF-16 with BOM + +1.2.0 / 2014-06-13 +================== + + * Passing string as `options` interpreted as encoding + * Support all encodings from `iconv-lite` + +1.1.7 / 2014-06-12 +================== + + * use `string_decoder` module from npm + +1.1.6 / 2014-05-27 +================== + + * check encoding for old streams1 + * support node.js < 0.10.6 + +1.1.5 / 2014-05-14 +================== + + * bump bytes + +1.1.4 / 2014-04-19 +================== + + * allow true as an option + * bump bytes + +1.1.3 / 2014-03-02 +================== + + * fix case when length=null + +1.1.2 / 2013-12-01 +================== + + * be less strict on state.encoding check + +1.1.1 / 2013-11-27 +================== + + * add engines + +1.1.0 / 2013-11-27 +================== + + * add err.statusCode and err.type + * allow for encoding option to be true + * pause the stream instead of dumping on error + * throw if the stream's encoding is set + +1.0.1 / 2013-11-19 +================== + + * dont support streams1, throw if dev set encoding + +1.0.0 / 2013-11-17 +================== + + * rename `expected` option to `length` + +0.2.0 / 2013-11-15 +================== + + * republish + +0.1.1 / 2013-11-15 +================== + + * use bytes + +0.1.0 / 2013-11-11 +================== + + * generator support + +0.0.3 / 2013-10-10 +================== + + * update repo + +0.0.2 / 2013-09-14 +================== + + * dump stream on bad headers + * listen to events after defining received and buffers + +0.0.1 / 2013-09-14 +================== + + * Initial release diff --git a/node_modules/raw-body/LICENSE b/node_modules/raw-body/LICENSE new file mode 100644 index 0000000..d695c8f --- /dev/null +++ b/node_modules/raw-body/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2013-2014 Jonathan Ong +Copyright (c) 2014-2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/raw-body/README.md b/node_modules/raw-body/README.md new file mode 100644 index 0000000..c4db8a6 --- /dev/null +++ b/node_modules/raw-body/README.md @@ -0,0 +1,219 @@ +# raw-body + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build status][travis-image]][travis-url] +[![Test coverage][coveralls-image]][coveralls-url] + +Gets the entire buffer of a stream either as a `Buffer` or a string. +Validates the stream's length against an expected length and maximum limit. +Ideal for parsing request bodies. + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install raw-body +``` + +### TypeScript + +This module includes a [TypeScript](https://www.typescriptlang.org/) +declarition file to enable auto complete in compatible editors and type +information for TypeScript projects. This module depends on the Node.js +types, so install `@types/node`: + +```sh +$ npm install @types/node +``` + +## API + + + +```js +var getRawBody = require('raw-body') +``` + +### getRawBody(stream, [options], [callback]) + +**Returns a promise if no callback specified and global `Promise` exists.** + +Options: + +- `length` - The length of the stream. + If the contents of the stream do not add up to this length, + an `400` error code is returned. +- `limit` - The byte limit of the body. + This is the number of bytes or any string format supported by + [bytes](https://www.npmjs.com/package/bytes), + for example `1000`, `'500kb'` or `'3mb'`. + If the body ends up being larger than this limit, + a `413` error code is returned. +- `encoding` - The encoding to use to decode the body into a string. + By default, a `Buffer` instance will be returned when no encoding is specified. + Most likely, you want `utf-8`, so setting `encoding` to `true` will decode as `utf-8`. + You can use any type of encoding supported by [iconv-lite](https://www.npmjs.org/package/iconv-lite#readme). + +You can also pass a string in place of options to just specify the encoding. + +If an error occurs, the stream will be paused, everything unpiped, +and you are responsible for correctly disposing the stream. +For HTTP requests, no handling is required if you send a response. +For streams that use file descriptors, you should `stream.destroy()` or `stream.close()` to prevent leaks. + +## Errors + +This module creates errors depending on the error condition during reading. +The error may be an error from the underlying Node.js implementation, but is +otherwise an error created by this module, which has the following attributes: + + * `limit` - the limit in bytes + * `length` and `expected` - the expected length of the stream + * `received` - the received bytes + * `encoding` - the invalid encoding + * `status` and `statusCode` - the corresponding status code for the error + * `type` - the error type + +### Types + +The errors from this module have a `type` property which allows for the progamatic +determination of the type of error returned. + +#### encoding.unsupported + +This error will occur when the `encoding` option is specified, but the value does +not map to an encoding supported by the [iconv-lite](https://www.npmjs.org/package/iconv-lite#readme) +module. + +#### entity.too.large + +This error will occur when the `limit` option is specified, but the stream has +an entity that is larger. + +#### request.aborted + +This error will occur when the request stream is aborted by the client before +reading the body has finished. + +#### request.size.invalid + +This error will occur when the `length` option is specified, but the stream has +emitted more bytes. + +#### stream.encoding.set + +This error will occur when the given stream has an encoding set on it, making it +a decoded stream. The stream should not have an encoding set and is expected to +emit `Buffer` objects. + +## Examples + +### Simple Express example + +```js +var contentType = require('content-type') +var express = require('express') +var getRawBody = require('raw-body') + +var app = express() + +app.use(function (req, res, next) { + getRawBody(req, { + length: req.headers['content-length'], + limit: '1mb', + encoding: contentType.parse(req).parameters.charset + }, function (err, string) { + if (err) return next(err) + req.text = string + next() + }) +}) + +// now access req.text +``` + +### Simple Koa example + +```js +var contentType = require('content-type') +var getRawBody = require('raw-body') +var koa = require('koa') + +var app = koa() + +app.use(function * (next) { + this.text = yield getRawBody(this.req, { + length: this.req.headers['content-length'], + limit: '1mb', + encoding: contentType.parse(this.req).parameters.charset + }) + yield next +}) + +// now access this.text +``` + +### Using as a promise + +To use this library as a promise, simply omit the `callback` and a promise is +returned, provided that a global `Promise` is defined. + +```js +var getRawBody = require('raw-body') +var http = require('http') + +var server = http.createServer(function (req, res) { + getRawBody(req) + .then(function (buf) { + res.statusCode = 200 + res.end(buf.length + ' bytes submitted') + }) + .catch(function (err) { + res.statusCode = 500 + res.end(err.message) + }) +}) + +server.listen(3000) +``` + +### Using with TypeScript + +```ts +import * as getRawBody from 'raw-body'; +import * as http from 'http'; + +const server = http.createServer((req, res) => { + getRawBody(req) + .then((buf) => { + res.statusCode = 200; + res.end(buf.length + ' bytes submitted'); + }) + .catch((err) => { + res.statusCode = err.statusCode; + res.end(err.message); + }); +}); + +server.listen(3000); +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/raw-body.svg +[npm-url]: https://npmjs.org/package/raw-body +[node-version-image]: https://img.shields.io/node/v/raw-body.svg +[node-version-url]: https://nodejs.org/en/download/ +[travis-image]: https://img.shields.io/travis/stream-utils/raw-body/master.svg +[travis-url]: https://travis-ci.org/stream-utils/raw-body +[coveralls-image]: https://img.shields.io/coveralls/stream-utils/raw-body/master.svg +[coveralls-url]: https://coveralls.io/r/stream-utils/raw-body?branch=master +[downloads-image]: https://img.shields.io/npm/dm/raw-body.svg +[downloads-url]: https://npmjs.org/package/raw-body diff --git a/node_modules/raw-body/index.d.ts b/node_modules/raw-body/index.d.ts new file mode 100644 index 0000000..dcbbebd --- /dev/null +++ b/node_modules/raw-body/index.d.ts @@ -0,0 +1,87 @@ +import { Readable } from 'stream'; + +declare namespace getRawBody { + export type Encoding = string | true; + + export interface Options { + /** + * The expected length of the stream. + */ + length?: number | string | null; + /** + * The byte limit of the body. This is the number of bytes or any string + * format supported by `bytes`, for example `1000`, `'500kb'` or `'3mb'`. + */ + limit?: number | string | null; + /** + * The encoding to use to decode the body into a string. By default, a + * `Buffer` instance will be returned when no encoding is specified. Most + * likely, you want `utf-8`, so setting encoding to `true` will decode as + * `utf-8`. You can use any type of encoding supported by `iconv-lite`. + */ + encoding?: Encoding | null; + } + + export interface RawBodyError extends Error { + /** + * The limit in bytes. + */ + limit?: number; + /** + * The expected length of the stream. + */ + length?: number; + expected?: number; + /** + * The received bytes. + */ + received?: number; + /** + * The encoding. + */ + encoding?: string; + /** + * The corresponding status code for the error. + */ + status: number; + statusCode: number; + /** + * The error type. + */ + type: string; + } +} + +/** + * Gets the entire buffer of a stream either as a `Buffer` or a string. + * Validates the stream's length against an expected length and maximum + * limit. Ideal for parsing request bodies. + */ +declare function getRawBody( + stream: Readable, + callback: (err: getRawBody.RawBodyError, body: Buffer) => void +): void; + +declare function getRawBody( + stream: Readable, + options: (getRawBody.Options & { encoding: getRawBody.Encoding }) | getRawBody.Encoding, + callback: (err: getRawBody.RawBodyError, body: string) => void +): void; + +declare function getRawBody( + stream: Readable, + options: getRawBody.Options, + callback: (err: getRawBody.RawBodyError, body: Buffer) => void +): void; + +declare function getRawBody( + stream: Readable, + options: (getRawBody.Options & { encoding: getRawBody.Encoding }) | getRawBody.Encoding +): Promise; + +declare function getRawBody( + stream: Readable, + options?: getRawBody.Options +): Promise; + +export = getRawBody; diff --git a/node_modules/raw-body/index.js b/node_modules/raw-body/index.js new file mode 100644 index 0000000..7fe8186 --- /dev/null +++ b/node_modules/raw-body/index.js @@ -0,0 +1,286 @@ +/*! + * raw-body + * Copyright(c) 2013-2014 Jonathan Ong + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var bytes = require('bytes') +var createError = require('http-errors') +var iconv = require('iconv-lite') +var unpipe = require('unpipe') + +/** + * Module exports. + * @public + */ + +module.exports = getRawBody + +/** + * Module variables. + * @private + */ + +var ICONV_ENCODING_MESSAGE_REGEXP = /^Encoding not recognized: / + +/** + * Get the decoder for a given encoding. + * + * @param {string} encoding + * @private + */ + +function getDecoder (encoding) { + if (!encoding) return null + + try { + return iconv.getDecoder(encoding) + } catch (e) { + // error getting decoder + if (!ICONV_ENCODING_MESSAGE_REGEXP.test(e.message)) throw e + + // the encoding was not found + throw createError(415, 'specified encoding unsupported', { + encoding: encoding, + type: 'encoding.unsupported' + }) + } +} + +/** + * Get the raw body of a stream (typically HTTP). + * + * @param {object} stream + * @param {object|string|function} [options] + * @param {function} [callback] + * @public + */ + +function getRawBody (stream, options, callback) { + var done = callback + var opts = options || {} + + if (options === true || typeof options === 'string') { + // short cut for encoding + opts = { + encoding: options + } + } + + if (typeof options === 'function') { + done = options + opts = {} + } + + // validate callback is a function, if provided + if (done !== undefined && typeof done !== 'function') { + throw new TypeError('argument callback must be a function') + } + + // require the callback without promises + if (!done && !global.Promise) { + throw new TypeError('argument callback is required') + } + + // get encoding + var encoding = opts.encoding !== true + ? opts.encoding + : 'utf-8' + + // convert the limit to an integer + var limit = bytes.parse(opts.limit) + + // convert the expected length to an integer + var length = opts.length != null && !isNaN(opts.length) + ? parseInt(opts.length, 10) + : null + + if (done) { + // classic callback style + return readStream(stream, encoding, length, limit, done) + } + + return new Promise(function executor (resolve, reject) { + readStream(stream, encoding, length, limit, function onRead (err, buf) { + if (err) return reject(err) + resolve(buf) + }) + }) +} + +/** + * Halt a stream. + * + * @param {Object} stream + * @private + */ + +function halt (stream) { + // unpipe everything from the stream + unpipe(stream) + + // pause stream + if (typeof stream.pause === 'function') { + stream.pause() + } +} + +/** + * Read the data from the stream. + * + * @param {object} stream + * @param {string} encoding + * @param {number} length + * @param {number} limit + * @param {function} callback + * @public + */ + +function readStream (stream, encoding, length, limit, callback) { + var complete = false + var sync = true + + // check the length and limit options. + // note: we intentionally leave the stream paused, + // so users should handle the stream themselves. + if (limit !== null && length !== null && length > limit) { + return done(createError(413, 'request entity too large', { + expected: length, + length: length, + limit: limit, + type: 'entity.too.large' + })) + } + + // streams1: assert request encoding is buffer. + // streams2+: assert the stream encoding is buffer. + // stream._decoder: streams1 + // state.encoding: streams2 + // state.decoder: streams2, specifically < 0.10.6 + var state = stream._readableState + if (stream._decoder || (state && (state.encoding || state.decoder))) { + // developer error + return done(createError(500, 'stream encoding should not be set', { + type: 'stream.encoding.set' + })) + } + + var received = 0 + var decoder + + try { + decoder = getDecoder(encoding) + } catch (err) { + return done(err) + } + + var buffer = decoder + ? '' + : [] + + // attach listeners + stream.on('aborted', onAborted) + stream.on('close', cleanup) + stream.on('data', onData) + stream.on('end', onEnd) + stream.on('error', onEnd) + + // mark sync section complete + sync = false + + function done () { + var args = new Array(arguments.length) + + // copy arguments + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + + // mark complete + complete = true + + if (sync) { + process.nextTick(invokeCallback) + } else { + invokeCallback() + } + + function invokeCallback () { + cleanup() + + if (args[0]) { + // halt the stream on error + halt(stream) + } + + callback.apply(null, args) + } + } + + function onAborted () { + if (complete) return + + done(createError(400, 'request aborted', { + code: 'ECONNABORTED', + expected: length, + length: length, + received: received, + type: 'request.aborted' + })) + } + + function onData (chunk) { + if (complete) return + + received += chunk.length + + if (limit !== null && received > limit) { + done(createError(413, 'request entity too large', { + limit: limit, + received: received, + type: 'entity.too.large' + })) + } else if (decoder) { + buffer += decoder.write(chunk) + } else { + buffer.push(chunk) + } + } + + function onEnd (err) { + if (complete) return + if (err) return done(err) + + if (length !== null && received !== length) { + done(createError(400, 'request size did not match content length', { + expected: length, + length: length, + received: received, + type: 'request.size.invalid' + })) + } else { + var string = decoder + ? buffer + (decoder.end() || '') + : Buffer.concat(buffer) + done(null, string) + } + } + + function cleanup () { + buffer = null + + stream.removeListener('aborted', onAborted) + stream.removeListener('data', onData) + stream.removeListener('end', onEnd) + stream.removeListener('error', onEnd) + stream.removeListener('close', cleanup) + } +} diff --git a/node_modules/raw-body/package.json b/node_modules/raw-body/package.json new file mode 100644 index 0000000..f219b72 --- /dev/null +++ b/node_modules/raw-body/package.json @@ -0,0 +1,90 @@ +{ + "_from": "raw-body@2.3.2", + "_id": "raw-body@2.3.2", + "_inBundle": false, + "_integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", + "_location": "/raw-body", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "raw-body@2.3.2", + "name": "raw-body", + "escapedName": "raw-body", + "rawSpec": "2.3.2", + "saveSpec": null, + "fetchSpec": "2.3.2" + }, + "_requiredBy": [ + "/body-parser" + ], + "_resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", + "_shasum": "bcd60c77d3eb93cde0050295c3f379389bc88f89", + "_spec": "raw-body@2.3.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/body-parser", + "author": { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com" + }, + "bugs": { + "url": "https://github.com/stream-utils/raw-body/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + { + "name": "Raynos", + "email": "raynos2@gmail.com" + } + ], + "dependencies": { + "bytes": "3.0.0", + "http-errors": "1.6.2", + "iconv-lite": "0.4.19", + "unpipe": "1.0.0" + }, + "deprecated": false, + "description": "Get and validate the raw body of a readable stream.", + "devDependencies": { + "bluebird": "3.5.0", + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.7.0", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-node": "5.1.1", + "eslint-plugin-promise": "3.5.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "mocha": "2.5.3", + "readable-stream": "2.3.3", + "safe-buffer": "5.1.1" + }, + "engines": { + "node": ">= 0.8" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "index.d.ts", + "index.js" + ], + "homepage": "https://github.com/stream-utils/raw-body#readme", + "license": "MIT", + "name": "raw-body", + "repository": { + "type": "git", + "url": "git+https://github.com/stream-utils/raw-body.git" + }, + "scripts": { + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --trace-deprecation --reporter spec --bail --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --trace-deprecation --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --trace-deprecation --reporter spec --check-leaks test/" + }, + "version": "2.3.2" +} diff --git a/node_modules/rc/.npmignore b/node_modules/rc/.npmignore new file mode 100644 index 0000000..13abef4 --- /dev/null +++ b/node_modules/rc/.npmignore @@ -0,0 +1,3 @@ +node_modules +node_modules/* +npm_debug.log diff --git a/node_modules/rc/LICENSE.APACHE2 b/node_modules/rc/LICENSE.APACHE2 new file mode 100644 index 0000000..6366c04 --- /dev/null +++ b/node_modules/rc/LICENSE.APACHE2 @@ -0,0 +1,15 @@ +Apache License, Version 2.0 + +Copyright (c) 2011 Dominic Tarr + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/node_modules/rc/LICENSE.BSD b/node_modules/rc/LICENSE.BSD new file mode 100644 index 0000000..96bb796 --- /dev/null +++ b/node_modules/rc/LICENSE.BSD @@ -0,0 +1,26 @@ +Copyright (c) 2013, Dominic Tarr +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. 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. + +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. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. diff --git a/node_modules/rc/LICENSE.MIT b/node_modules/rc/LICENSE.MIT new file mode 100644 index 0000000..6eafbd7 --- /dev/null +++ b/node_modules/rc/LICENSE.MIT @@ -0,0 +1,24 @@ +The MIT License + +Copyright (c) 2011 Dominic Tarr + +Permission is hereby granted, free of charge, +to any person obtaining a copy of this software and +associated documentation files (the "Software"), to +deal in the Software without restriction, including +without limitation the rights to use, copy, modify, +merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom +the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/rc/README.md b/node_modules/rc/README.md new file mode 100644 index 0000000..7f4b85e --- /dev/null +++ b/node_modules/rc/README.md @@ -0,0 +1,225 @@ +# rc + +The non-configurable configuration loader for lazy people. + +## Usage + +The only option is to pass rc the name of your app, and your default configuration. + +```javascript +var conf = require('rc')(appname, { + //defaults go here. + port: 2468, + + //defaults which are objects will be merged, not replaced + views: { + engine: 'jade' + } +}); +``` + +`rc` will return your configuration options merged with the defaults you specify. +If you pass in a predefined defaults object, it will be mutated: + +```javascript +var conf = {}; +require('rc')(appname, conf); +``` + +If `rc` finds any config files for your app, the returned config object will have +a `configs` array containing their paths: + +```javascript +var appCfg = require('rc')(appname, conf); +appCfg.configs[0] // /etc/appnamerc +appCfg.configs[1] // /home/dominictarr/.config/appname +appCfg.config // same as appCfg.configs[appCfg.configs.length - 1] +``` + +## Standards + +Given your application name (`appname`), rc will look in all the obvious places for configuration. + + * command line arguments, parsed by minimist _(e.g. `--foo baz`, also nested: `--foo.bar=baz`)_ + * environment variables prefixed with `${appname}_` + * or use "\_\_" to indicate nested properties
    _(e.g. `appname_foo__bar__baz` => `foo.bar.baz`)_ + * if you passed an option `--config file` then from that file + * a local `.${appname}rc` or the first found looking in `./ ../ ../../ ../../../` etc. + * `$HOME/.${appname}rc` + * `$HOME/.${appname}/config` + * `$HOME/.config/${appname}` + * `$HOME/.config/${appname}/config` + * `/etc/${appname}rc` + * `/etc/${appname}/config` + * the defaults object you passed in. + +All configuration sources that were found will be flattened into one object, +so that sources **earlier** in this list override later ones. + + +## Configuration File Formats + +Configuration files (e.g. `.appnamerc`) may be in either [json](http://json.org/example) or [ini](http://en.wikipedia.org/wiki/INI_file) format. **No** file extension (`.json` or `.ini`) should be used. The example configurations below are equivalent: + + +#### Formatted as `ini` + +``` +; You can include comments in `ini` format if you want. + +dependsOn=0.10.0 + + +; `rc` has built-in support for ini sections, see? + +[commands] + www = ./commands/www + console = ./commands/repl + + +; You can even do nested sections + +[generators.options] + engine = ejs + +[generators.modules] + new = generate-new + engine = generate-backend + +``` + +#### Formatted as `json` + +```javascript +{ + // You can even comment your JSON, if you want + "dependsOn": "0.10.0", + "commands": { + "www": "./commands/www", + "console": "./commands/repl" + }, + "generators": { + "options": { + "engine": "ejs" + }, + "modules": { + "new": "generate-new", + "backend": "generate-backend" + } + } +} +``` + +Comments are stripped from JSON config via [strip-json-comments](https://github.com/sindresorhus/strip-json-comments). + +> Since ini, and env variables do not have a standard for types, your application needs be prepared for strings. + + +## Simple example demonstrating precedence +Assume you have an application like this (notice the hard-coded defaults passed to rc): +``` +const conf = require('rc')('myapp', { + port: 12345, + mode: 'test' +}); + +console.log(JSON.stringify(conf, null, 2)); +``` +You also have a file `config.json`, with these contents: +``` +{ + "port": 9000, + "foo": "from config json", + "something": "else" +} +``` +And a file `.myapprc` in the same folder, with these contents: +``` +{ + "port": "3001", + "foo": "bar" +} +``` +Here is the expected output from various commands: + +`node .` +``` +{ + "port": "3001", + "mode": "test", + "foo": "bar", + "_": [], + "configs": [ + "/Users/stephen/repos/conftest/.myapprc" + ], + "config": "/Users/stephen/repos/conftest/.myapprc" +} +``` +*Default `mode` from hard-coded object is retained, but port is overridden by `.myapprc` file (automatically found based on appname match), and `foo` is added.* + + +`node . --foo baz` +``` +{ + "port": "3001", + "mode": "test", + "foo": "baz", + "_": [], + "configs": [ + "/Users/stephen/repos/conftest/.myapprc" + ], + "config": "/Users/stephen/repos/conftest/.myapprc" +} +``` +*Same result as above but `foo` is overridden because command-line arguments take precedence over `.myapprc` file.* + +`node . --foo barbar --config config.json` +``` +{ + "port": 9000, + "mode": "test", + "foo": "barbar", + "something": "else", + "_": [], + "config": "config.json", + "configs": [ + "/Users/stephen/repos/conftest/.myapprc", + "config.json" + ] +} +``` +*Now the `port` comes from the `config.json` file specified (overriding the value from `.myapprc`), and `foo` value is overriden by command-line despite also being specified in the `config.json` file.* + + + +## Advanced Usage + +#### Pass in your own `argv` + +You may pass in your own `argv` as the third argument to `rc`. This is in case you want to [use your own command-line opts parser](https://github.com/dominictarr/rc/pull/12). + +```javascript +require('rc')(appname, defaults, customArgvParser); +``` + +## Pass in your own parser + +If you have a special need to use a non-standard parser, +you can do so by passing in the parser as the 4th argument. +(leave the 3rd as null to get the default args parser) + +```javascript +require('rc')(appname, defaults, null, parser); +``` + +This may also be used to force a more strict format, +such as strict, valid JSON only. + +## Note on Performance + +`rc` is running `fs.statSync`-- so make sure you don't use it in a hot code path (e.g. a request handler) + + +## License + +Multi-licensed under the two-clause BSD License, MIT License, or Apache License, version 2.0 diff --git a/node_modules/rc/browser.js b/node_modules/rc/browser.js new file mode 100644 index 0000000..8c230c5 --- /dev/null +++ b/node_modules/rc/browser.js @@ -0,0 +1,7 @@ + +// when this is loaded into the browser, +// just use the defaults... + +module.exports = function (name, defaults) { + return defaults +} diff --git a/node_modules/rc/cli.js b/node_modules/rc/cli.js new file mode 100755 index 0000000..ab05b60 --- /dev/null +++ b/node_modules/rc/cli.js @@ -0,0 +1,4 @@ +#! /usr/bin/env node +var rc = require('./index') + +console.log(JSON.stringify(rc(process.argv[2]), false, 2)) diff --git a/node_modules/rc/index.js b/node_modules/rc/index.js new file mode 100755 index 0000000..65eb47a --- /dev/null +++ b/node_modules/rc/index.js @@ -0,0 +1,53 @@ +var cc = require('./lib/utils') +var join = require('path').join +var deepExtend = require('deep-extend') +var etc = '/etc' +var win = process.platform === "win32" +var home = win + ? process.env.USERPROFILE + : process.env.HOME + +module.exports = function (name, defaults, argv, parse) { + if('string' !== typeof name) + throw new Error('rc(name): name *must* be string') + if(!argv) + argv = require('minimist')(process.argv.slice(2)) + defaults = ( + 'string' === typeof defaults + ? cc.json(defaults) : defaults + ) || {} + + parse = parse || cc.parse + + var env = cc.env(name + '_') + + var configs = [defaults] + var configFiles = [] + function addConfigFile (file) { + if (configFiles.indexOf(file) >= 0) return + var fileConfig = cc.file(file) + if (fileConfig) { + configs.push(parse(fileConfig)) + configFiles.push(file) + } + } + + // which files do we look at? + if (!win) + [join(etc, name, 'config'), + join(etc, name + 'rc')].forEach(addConfigFile) + if (home) + [join(home, '.config', name, 'config'), + join(home, '.config', name), + join(home, '.' + name, 'config'), + join(home, '.' + name + 'rc')].forEach(addConfigFile) + addConfigFile(cc.find('.'+name+'rc')) + if (env.config) addConfigFile(env.config) + if (argv.config) addConfigFile(argv.config) + + return deepExtend.apply(null, configs.concat([ + env, + argv, + configFiles.length ? {configs: configFiles, config: configFiles[configFiles.length - 1]} : undefined, + ])) +} diff --git a/node_modules/rc/lib/utils.js b/node_modules/rc/lib/utils.js new file mode 100644 index 0000000..8b3beff --- /dev/null +++ b/node_modules/rc/lib/utils.js @@ -0,0 +1,104 @@ +'use strict'; +var fs = require('fs') +var ini = require('ini') +var path = require('path') +var stripJsonComments = require('strip-json-comments') + +var parse = exports.parse = function (content) { + + //if it ends in .json or starts with { then it must be json. + //must be done this way, because ini accepts everything. + //can't just try and parse it and let it throw if it's not ini. + //everything is ini. even json with a syntax error. + + if(/^\s*{/.test(content)) + return JSON.parse(stripJsonComments(content)) + return ini.parse(content) + +} + +var file = exports.file = function () { + var args = [].slice.call(arguments).filter(function (arg) { return arg != null }) + + //path.join breaks if it's a not a string, so just skip this. + for(var i in args) + if('string' !== typeof args[i]) + return + + var file = path.join.apply(null, args) + var content + try { + return fs.readFileSync(file,'utf-8') + } catch (err) { + return + } +} + +var json = exports.json = function () { + var content = file.apply(null, arguments) + return content ? parse(content) : null +} + +var env = exports.env = function (prefix, env) { + env = env || process.env + var obj = {} + var l = prefix.length + for(var k in env) { + if(k.toLowerCase().indexOf(prefix.toLowerCase()) === 0) { + + var keypath = k.substring(l).split('__') + + // Trim empty strings from keypath array + var _emptyStringIndex + while ((_emptyStringIndex=keypath.indexOf('')) > -1) { + keypath.splice(_emptyStringIndex, 1) + } + + var cursor = obj + keypath.forEach(function _buildSubObj(_subkey,i){ + + // (check for _subkey first so we ignore empty strings) + // (check for cursor to avoid assignment to primitive objects) + if (!_subkey || typeof cursor !== 'object') + return + + // If this is the last key, just stuff the value in there + // Assigns actual value from env variable to final key + // (unless it's just an empty string- in that case use the last valid key) + if (i === keypath.length-1) + cursor[_subkey] = env[k] + + + // Build sub-object if nothing already exists at the keypath + if (cursor[_subkey] === undefined) + cursor[_subkey] = {} + + // Increment cursor used to track the object at the current depth + cursor = cursor[_subkey] + + }) + + } + + } + + return obj +} + +var find = exports.find = function () { + var rel = path.join.apply(null, [].slice.call(arguments)) + + function find(start, rel) { + var file = path.join(start, rel) + try { + fs.statSync(file) + return file + } catch (err) { + if(path.dirname(start) !== start) // root + return find(path.dirname(start), rel) + } + } + return find(process.cwd(), rel) +} + + diff --git a/node_modules/rc/package.json b/node_modules/rc/package.json new file mode 100644 index 0000000..4404c9a --- /dev/null +++ b/node_modules/rc/package.json @@ -0,0 +1,65 @@ +{ + "_from": "rc@^1.1.6", + "_id": "rc@1.2.5", + "_inBundle": false, + "_integrity": "sha1-J1zWh/bjs2zHVrqibf7oCnkDAf0=", + "_location": "/rc", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "rc@^1.1.6", + "name": "rc", + "escapedName": "rc", + "rawSpec": "^1.1.6", + "saveSpec": null, + "fetchSpec": "^1.1.6" + }, + "_requiredBy": [ + "/registry-auth-token", + "/registry-url" + ], + "_resolved": "https://registry.npmjs.org/rc/-/rc-1.2.5.tgz", + "_shasum": "275cd687f6e3b36cc756baa26dfee80a790301fd", + "_spec": "rc@^1.1.6", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/registry-auth-token", + "author": { + "name": "Dominic Tarr", + "email": "dominic.tarr@gmail.com", + "url": "dominictarr.com" + }, + "bin": { + "rc": "./cli.js" + }, + "browser": "browser.js", + "bugs": { + "url": "https://github.com/dominictarr/rc/issues" + }, + "bundleDependencies": false, + "dependencies": { + "deep-extend": "~0.4.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "deprecated": false, + "description": "hardwired configuration loader", + "homepage": "https://github.com/dominictarr/rc#readme", + "keywords": [ + "config", + "rc", + "unix", + "defaults" + ], + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "main": "index.js", + "name": "rc", + "repository": { + "type": "git", + "url": "git+https://github.com/dominictarr/rc.git" + }, + "scripts": { + "test": "set -e; node test/test.js; node test/ini.js; node test/nested-env-vars.js" + }, + "version": "1.2.5" +} diff --git a/node_modules/rc/test/ini.js b/node_modules/rc/test/ini.js new file mode 100644 index 0000000..e6857f8 --- /dev/null +++ b/node_modules/rc/test/ini.js @@ -0,0 +1,16 @@ +var cc =require('../lib/utils') +var INI = require('ini') +var assert = require('assert') + +function test(obj) { + + var _json, _ini + var json = cc.parse (_json = JSON.stringify(obj)) + var ini = cc.parse (_ini = INI.stringify(obj)) + console.log(_ini, _json) + assert.deepEqual(json, ini) +} + + +test({hello: true}) + diff --git a/node_modules/rc/test/nested-env-vars.js b/node_modules/rc/test/nested-env-vars.js new file mode 100644 index 0000000..0ecd176 --- /dev/null +++ b/node_modules/rc/test/nested-env-vars.js @@ -0,0 +1,50 @@ + +var seed = Math.random(); +var n = 'rc'+ seed; +var N = 'RC'+ seed; +var assert = require('assert') + + +// Basic usage +process.env[n+'_someOpt__a'] = 42 +process.env[n+'_someOpt__x__'] = 99 +process.env[n+'_someOpt__a__b'] = 186 +process.env[n+'_someOpt__a__b__c'] = 243 +process.env[n+'_someOpt__x__y'] = 1862 +process.env[n+'_someOpt__z'] = 186577 + +// Should ignore empty strings from orphaned '__' +process.env[n+'_someOpt__z__x__'] = 18629 +process.env[n+'_someOpt__w__w__'] = 18629 + +// Leading '__' should ignore everything up to 'z' +process.env[n+'___z__i__'] = 9999 + +// should ignore case for config name section. +process.env[N+'_test_upperCase'] = 187 + +function testPrefix(prefix) { + var config = require('../')(prefix, { + option: true + }) + + console.log('\n\n------ nested-env-vars ------\n',{prefix: prefix}, '\n', config); + + assert.equal(config.option, true) + assert.equal(config.someOpt.a, 42) + assert.equal(config.someOpt.x, 99) + // Should not override `a` once it's been set + assert.equal(config.someOpt.a/*.b*/, 42) + // Should not override `x` once it's been set + assert.equal(config.someOpt.x/*.y*/, 99) + assert.equal(config.someOpt.z, 186577) + // Should not override `z` once it's been set + assert.equal(config.someOpt.z/*.x*/, 186577) + assert.equal(config.someOpt.w.w, 18629) + assert.equal(config.z.i, 9999) + + assert.equal(config.test_upperCase, 187) +} + +testPrefix(n); +testPrefix(N); diff --git a/node_modules/rc/test/test.js b/node_modules/rc/test/test.js new file mode 100644 index 0000000..4f63351 --- /dev/null +++ b/node_modules/rc/test/test.js @@ -0,0 +1,59 @@ + +var n = 'rc'+Math.random() +var assert = require('assert') + +process.env[n+'_envOption'] = 42 + +var config = require('../')(n, { + option: true +}) + +console.log(config) + +assert.equal(config.option, true) +assert.equal(config.envOption, 42) + +var customArgv = require('../')(n, { + option: true +}, { // nopt-like argv + option: false, + envOption: 24, + argv: { + remain: [], + cooked: ['--no-option', '--envOption', '24'], + original: ['--no-option', '--envOption=24'] + } +}) + +console.log(customArgv) + +assert.equal(customArgv.option, false) +assert.equal(customArgv.envOption, 24) + +var fs = require('fs') +var path = require('path') +var jsonrc = path.resolve('.' + n + 'rc'); + +fs.writeFileSync(jsonrc, [ + '{', + '// json overrides default', + '"option": false,', + '/* env overrides json */', + '"envOption": 24', + '}' +].join('\n')); + +var commentedJSON = require('../')(n, { + option: true +}) + +fs.unlinkSync(jsonrc); + +console.log(commentedJSON) + +assert.equal(commentedJSON.option, false) +assert.equal(commentedJSON.envOption, 42) + +assert.equal(commentedJSON.config, jsonrc) +assert.equal(commentedJSON.configs.length, 1) +assert.equal(commentedJSON.configs[0], jsonrc) diff --git a/node_modules/readable-stream/.travis.yml b/node_modules/readable-stream/.travis.yml new file mode 100644 index 0000000..4099255 --- /dev/null +++ b/node_modules/readable-stream/.travis.yml @@ -0,0 +1,55 @@ +sudo: false +language: node_js +before_install: + - npm install -g npm@2 + - test $NPM_LEGACY && npm install -g npm@latest-3 || npm install npm -g +notifications: + email: false +matrix: + fast_finish: true + include: + - node_js: '0.8' + env: + - TASK=test + - NPM_LEGACY=true + - node_js: '0.10' + env: + - TASK=test + - NPM_LEGACY=true + - node_js: '0.11' + env: + - TASK=test + - NPM_LEGACY=true + - node_js: '0.12' + env: + - TASK=test + - NPM_LEGACY=true + - node_js: 1 + env: + - TASK=test + - NPM_LEGACY=true + - node_js: 2 + env: + - TASK=test + - NPM_LEGACY=true + - node_js: 3 + env: + - TASK=test + - NPM_LEGACY=true + - node_js: 4 + env: TASK=test + - node_js: 5 + env: TASK=test + - node_js: 6 + env: TASK=test + - node_js: 7 + env: TASK=test + - node_js: 8 + env: TASK=test + - node_js: 9 + env: TASK=test +script: "npm run $TASK" +env: + global: + - secure: rE2Vvo7vnjabYNULNyLFxOyt98BoJexDqsiOnfiD6kLYYsiQGfr/sbZkPMOFm9qfQG7pjqx+zZWZjGSswhTt+626C0t/njXqug7Yps4c3dFblzGfreQHp7wNX5TFsvrxd6dAowVasMp61sJcRnB2w8cUzoe3RAYUDHyiHktwqMc= + - secure: g9YINaKAdMatsJ28G9jCGbSaguXCyxSTy+pBO6Ch0Cf57ZLOTka3HqDj8p3nV28LUIHZ3ut5WO43CeYKwt4AUtLpBS3a0dndHdY6D83uY6b2qh5hXlrcbeQTq2cvw2y95F7hm4D1kwrgZ7ViqaKggRcEupAL69YbJnxeUDKWEdI= diff --git a/node_modules/readable-stream/CONTRIBUTING.md b/node_modules/readable-stream/CONTRIBUTING.md new file mode 100644 index 0000000..f478d58 --- /dev/null +++ b/node_modules/readable-stream/CONTRIBUTING.md @@ -0,0 +1,38 @@ +# Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +* (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +* (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +* (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +* (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. + +## Moderation Policy + +The [Node.js Moderation Policy] applies to this WG. + +## Code of Conduct + +The [Node.js Code of Conduct][] applies to this WG. + +[Node.js Code of Conduct]: +https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md +[Node.js Moderation Policy]: +https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md diff --git a/node_modules/readable-stream/GOVERNANCE.md b/node_modules/readable-stream/GOVERNANCE.md new file mode 100644 index 0000000..16ffb93 --- /dev/null +++ b/node_modules/readable-stream/GOVERNANCE.md @@ -0,0 +1,136 @@ +### Streams Working Group + +The Node.js Streams is jointly governed by a Working Group +(WG) +that is responsible for high-level guidance of the project. + +The WG has final authority over this project including: + +* Technical direction +* Project governance and process (including this policy) +* Contribution policy +* GitHub repository hosting +* Conduct guidelines +* Maintaining the list of additional Collaborators + +For the current list of WG members, see the project +[README.md](./README.md#current-project-team-members). + +### Collaborators + +The readable-stream GitHub repository is +maintained by the WG and additional Collaborators who are added by the +WG on an ongoing basis. + +Individuals making significant and valuable contributions are made +Collaborators and given commit-access to the project. These +individuals are identified by the WG and their addition as +Collaborators is discussed during the WG meeting. + +_Note:_ If you make a significant contribution and are not considered +for commit-access log an issue or contact a WG member directly and it +will be brought up in the next WG meeting. + +Modifications of the contents of the readable-stream repository are +made on +a collaborative basis. Anybody with a GitHub account may propose a +modification via pull request and it will be considered by the project +Collaborators. All pull requests must be reviewed and accepted by a +Collaborator with sufficient expertise who is able to take full +responsibility for the change. In the case of pull requests proposed +by an existing Collaborator, an additional Collaborator is required +for sign-off. Consensus should be sought if additional Collaborators +participate and there is disagreement around a particular +modification. See _Consensus Seeking Process_ below for further detail +on the consensus model used for governance. + +Collaborators may opt to elevate significant or controversial +modifications, or modifications that have not found consensus to the +WG for discussion by assigning the ***WG-agenda*** tag to a pull +request or issue. The WG should serve as the final arbiter where +required. + +For the current list of Collaborators, see the project +[README.md](./README.md#members). + +### WG Membership + +WG seats are not time-limited. There is no fixed size of the WG. +However, the expected target is between 6 and 12, to ensure adequate +coverage of important areas of expertise, balanced with the ability to +make decisions efficiently. + +There is no specific set of requirements or qualifications for WG +membership beyond these rules. + +The WG may add additional members to the WG by unanimous consensus. + +A WG member may be removed from the WG by voluntary resignation, or by +unanimous consensus of all other WG members. + +Changes to WG membership should be posted in the agenda, and may be +suggested as any other agenda item (see "WG Meetings" below). + +If an addition or removal is proposed during a meeting, and the full +WG is not in attendance to participate, then the addition or removal +is added to the agenda for the subsequent meeting. This is to ensure +that all members are given the opportunity to participate in all +membership decisions. If a WG member is unable to attend a meeting +where a planned membership decision is being made, then their consent +is assumed. + +No more than 1/3 of the WG members may be affiliated with the same +employer. If removal or resignation of a WG member, or a change of +employment by a WG member, creates a situation where more than 1/3 of +the WG membership shares an employer, then the situation must be +immediately remedied by the resignation or removal of one or more WG +members affiliated with the over-represented employer(s). + +### WG Meetings + +The WG meets occasionally on a Google Hangout On Air. A designated moderator +approved by the WG runs the meeting. Each meeting should be +published to YouTube. + +Items are added to the WG agenda that are considered contentious or +are modifications of governance, contribution policy, WG membership, +or release process. + +The intention of the agenda is not to approve or review all patches; +that should happen continuously on GitHub and be handled by the larger +group of Collaborators. + +Any community member or contributor can ask that something be added to +the next meeting's agenda by logging a GitHub Issue. Any Collaborator, +WG member or the moderator can add the item to the agenda by adding +the ***WG-agenda*** tag to the issue. + +Prior to each WG meeting the moderator will share the Agenda with +members of the WG. WG members can add any items they like to the +agenda at the beginning of each meeting. The moderator and the WG +cannot veto or remove items. + +The WG may invite persons or representatives from certain projects to +participate in a non-voting capacity. + +The moderator is responsible for summarizing the discussion of each +agenda item and sends it as a pull request after the meeting. + +### Consensus Seeking Process + +The WG follows a +[Consensus +Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making) +decision-making model. + +When an agenda item has appeared to reach a consensus the moderator +will ask "Does anyone object?" as a final call for dissent from the +consensus. + +If an agenda item cannot reach a consensus a WG member can call for +either a closing vote or a vote to table the issue to the next +meeting. The call for a vote must be seconded by a majority of the WG +or else the discussion will continue. Simple majority wins. + +Note that changes to WG membership require a majority consensus. See +"WG Membership" above. diff --git a/node_modules/readable-stream/LICENSE b/node_modules/readable-stream/LICENSE new file mode 100644 index 0000000..2873b3b --- /dev/null +++ b/node_modules/readable-stream/LICENSE @@ -0,0 +1,47 @@ +Node.js is licensed for use as follows: + +""" +Copyright Node.js contributors. All rights reserved. + +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 license applies to parts of Node.js originating from the +https://github.com/joyent/node repository: + +""" +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" diff --git a/node_modules/readable-stream/README.md b/node_modules/readable-stream/README.md new file mode 100644 index 0000000..f0d8b47 --- /dev/null +++ b/node_modules/readable-stream/README.md @@ -0,0 +1,58 @@ +# readable-stream + +***Node-core v8.9.4 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/) +[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/) + + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/readable-stream.svg)](https://saucelabs.com/u/readable-stream) + +```bash +npm install --save readable-stream +``` + +***Node-core streams for userland*** + +This package is a mirror of the Streams2 and Streams3 implementations in +Node-core. + +Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.9.4/docs/api/stream.html). + +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). + +As of version 2.0.0 **readable-stream** uses semantic versioning. + +# Streams Working Group + +`readable-stream` is maintained by the Streams Working Group, which +oversees the development and maintenance of the Streams API within +Node.js. The responsibilities of the Streams Working Group include: + +* Addressing stream issues on the Node.js issue tracker. +* Authoring and editing stream documentation within the Node.js project. +* Reviewing changes to stream subclasses within the Node.js project. +* Redirecting changes to streams from the Node.js project to this + project. +* Assisting in the implementation of stream providers within Node.js. +* Recommending versions of `readable-stream` to be included in Node.js. +* Messaging about the future of streams to give the community advance + notice of changes. + + +## Team Members + +* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) <christopher.s.dickinson@gmail.com> + - Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B +* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com> + - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242 +* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) <rod@vagg.org> + - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D +* **Sam Newman** ([@sonewman](https://github.com/sonewman)) <newmansam@outlook.com> +* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com> +* **Domenic Denicola** ([@domenic](https://github.com/domenic)) <d@domenic.me> +* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com> + - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E +* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) <shestak.irina@gmail.com> diff --git a/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md b/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md new file mode 100644 index 0000000..83275f1 --- /dev/null +++ b/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md @@ -0,0 +1,60 @@ +# streams WG Meeting 2015-01-30 + +## Links + +* **Google Hangouts Video**: http://www.youtube.com/watch?v=I9nDOSGfwZg +* **GitHub Issue**: https://github.com/iojs/readable-stream/issues/106 +* **Original Minutes Google Doc**: https://docs.google.com/document/d/17aTgLnjMXIrfjgNaTUnHQO7m3xgzHR2VXBTmi03Qii4/ + +## Agenda + +Extracted from https://github.com/iojs/readable-stream/labels/wg-agenda prior to meeting. + +* adopt a charter [#105](https://github.com/iojs/readable-stream/issues/105) +* release and versioning strategy [#101](https://github.com/iojs/readable-stream/issues/101) +* simpler stream creation [#102](https://github.com/iojs/readable-stream/issues/102) +* proposal: deprecate implicit flowing of streams [#99](https://github.com/iojs/readable-stream/issues/99) + +## Minutes + +### adopt a charter + +* group: +1's all around + +### What versioning scheme should be adopted? +* group: +1’s 3.0.0 +* domenic+group: pulling in patches from other sources where appropriate +* mikeal: version independently, suggesting versions for io.js +* mikeal+domenic: work with TC to notify in advance of changes +simpler stream creation + +### streamline creation of streams +* sam: streamline creation of streams +* domenic: nice simple solution posted + but, we lose the opportunity to change the model + may not be backwards incompatible (double check keys) + + **action item:** domenic will check + +### remove implicit flowing of streams on(‘data’) +* add isFlowing / isPaused +* mikeal: worrying that we’re documenting polyfill methods – confuses users +* domenic: more reflective API is probably good, with warning labels for users +* new section for mad scientists (reflective stream access) +* calvin: name the “third state” +* mikeal: maybe borrow the name from whatwg? +* domenic: we’re missing the “third state” +* consensus: kind of difficult to name the third state +* mikeal: figure out differences in states / compat +* mathias: always flow on data – eliminates third state + * explore what it breaks + +**action items:** +* ask isaac for ability to list packages by what public io.js APIs they use (esp. Stream) +* ask rod/build for infrastructure +* **chris**: explore the “flow on data” approach +* add isPaused/isFlowing +* add new docs section +* move isPaused to that section + + diff --git a/node_modules/readable-stream/duplex-browser.js b/node_modules/readable-stream/duplex-browser.js new file mode 100644 index 0000000..f8b2db8 --- /dev/null +++ b/node_modules/readable-stream/duplex-browser.js @@ -0,0 +1 @@ +module.exports = require('./lib/_stream_duplex.js'); diff --git a/node_modules/readable-stream/duplex.js b/node_modules/readable-stream/duplex.js new file mode 100644 index 0000000..46924cb --- /dev/null +++ b/node_modules/readable-stream/duplex.js @@ -0,0 +1 @@ +module.exports = require('./readable').Duplex diff --git a/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/readable-stream/lib/_stream_duplex.js new file mode 100644 index 0000000..1045089 --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_duplex.js @@ -0,0 +1,124 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// 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'; + +/**/ + +var pna = require('process-nextick-args'); +/**/ + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + }return keys; +}; +/**/ + +module.exports = Duplex; + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +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) { + if (!(this instanceof Duplex)) return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) this.readable = false; + + if (options && options.writable === false) this.writable = false; + + this.allowHalfOpen = true; + if (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. + if (this.allowHalfOpen || this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + pna.nextTick(onEndNT, this); +} + +function onEndNT(self) { + self.end(); +} + +Object.defineProperty(Duplex.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); + +Duplex.prototype._destroy = function (err, cb) { + this.push(null); + this.end(); + + pna.nextTick(cb, err); +}; + +function forEach(xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/readable-stream/lib/_stream_passthrough.js new file mode 100644 index 0000000..a9c8358 --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_passthrough.js @@ -0,0 +1,47 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// 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'); + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +util.inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + + Transform.call(this, options); +} + +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/readable-stream/lib/_stream_readable.js new file mode 100644 index 0000000..af150f4 --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_readable.js @@ -0,0 +1,1015 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +/**/ + +var pna = require('process-nextick-args'); +/**/ + +module.exports = Readable; + +/**/ +var isArray = require('isarray'); +/**/ + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = require('events').EventEmitter; + +var EElistenerCount = function (emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = require('./internal/streams/stream'); +/**/ + +/**/ + +var Buffer = require('safe-buffer').Buffer; +var OurUint8Array = global.Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +/**/ +var debugUtil = require('util'); +var debug = void 0; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function () {}; +} +/**/ + +var BufferList = require('./internal/streams/BufferList'); +var destroyImpl = require('./internal/streams/destroy'); +var StringDecoder; + +util.inherits(Readable, Stream); + +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; + +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // This is a 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]]; +} + +function ReadableState(options, stream) { + Duplex = Duplex || require('./_stream_duplex'); + + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + var isDuplex = stream instanceof Duplex; + + // 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 (isDuplex) 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 readableHwm = options.readableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; + + // cast to ints. + this.highWaterMark = Math.floor(this.highWaterMark); + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + 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 event 'readable'/'data' is emitted + // 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 read 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; + + // has it been destroyed + this.destroyed = 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'; + + // 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; + } +} + +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) { + if (typeof options.read === 'function') this._read = options.read; + + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + + Stream.call(this); +} + +Object.defineProperty(Readable.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined) { + return false; + } + return this._readableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + } +}); + +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; +Readable.prototype._destroy = function (err, cb) { + this.push(null); + cb(err); +}; + +// 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; + var skipChunkCheck; + + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; + +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (addToFront) { + if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true); + } else if (state.ended) { + stream.emit('error', new Error('stream.push() after EOF')); + } else { + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + } + } + + return needMoreData(state); +} + +function addChunk(stream, state, chunk, addToFront) { + 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); +} + +function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + +// 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); +} + +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +// 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) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + + if (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); + } else 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 (!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; + } else { + state.length -= n; + } + + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!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) endReadable(this); + } + + if (ret !== null) this.emit('data', ret); + + return ret; +}; + +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) pna.nextTick(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; + pna.nextTick(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('_read() is 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 : unpipe; + if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + 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', unpipe); + 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(); + } + + // If the user pushes more data while we're writing to dest then we'll end up + // in ondata again. However, we only want to increase awaitDrain once because + // dest will only emit one 'drain' event for the multiple writes. + // => Introduce a guard on increasing awaitDrain. + var increasedAwaitDrain = false; + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + increasedAwaitDrain = false; + var ret = dest.write(chunk); + if (false === ret && !increasedAwaitDrain) { + // 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++; + increasedAwaitDrain = true; + } + 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; + var unpipeInfo = { hasUnpiped: false }; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + 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, unpipeInfo); + }return this; + } + + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + + dest.emit('unpipe', this, unpipeInfo); + + 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 (ev === 'data') { + // Start flowing on next tick if stream isn't explicitly paused + if (this._readableState.flowing !== false) this.resume(); + } else if (ev === 'readable') { + var state = this._readableState; + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.emittedReadable = false; + if (!state.reading) { + pna.nextTick(nReadingNextTick, this); + } else if (state.length) { + emitReadable(this); + } + } + } + + 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; + pna.nextTick(resume_, stream, state); + } +} + +function resume_(stream, state) { + if (!state.reading) { + debug('resume read 0'); + stream.read(0); + } + + state.resumeScheduled = false; + state.awaitDrain = 0; + 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); + while (state.flowing && stream.read() !== null) {} +} + +// 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 _this = this; + + var state = this._readableState; + var paused = false; + + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } + + _this.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 = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function (method) { + return function () { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + this._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + + return this; +}; + +// 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. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = fromListPartial(n, state.buffer, state.decoder); + } + + return ret; +} + +// Extracts only enough buffered data to satisfy the amount requested. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromListPartial(n, list, hasStrings) { + var ret; + if (n < list.head.data.length) { + // slice is the same for buffers and strings + ret = list.head.data.slice(0, n); + list.head.data = list.head.data.slice(n); + } else if (n === list.head.data.length) { + // first chunk is a perfect match + ret = list.shift(); + } else { + // result spans more than one buffer + ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); + } + return ret; +} + +// Copies a specified amount of characters from the list of buffered data +// chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBufferString(n, list) { + var p = list.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +// Copies a specified amount of bytes from the list of buffered data chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBuffer(n, list) { + var ret = Buffer.allocUnsafe(n); + var p = list.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + 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. + if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); + + if (!state.endEmitted) { + state.ended = true; + pna.nextTick(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; +} \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/readable-stream/lib/_stream_transform.js new file mode 100644 index 0000000..5d1f8b8 --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_transform.js @@ -0,0 +1,214 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// 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'); + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +util.inherits(Transform, Duplex); + +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) { + return this.emit('error', new Error('write callback called multiple times')); + } + + ts.writechunk = null; + ts.writecb = null; + + if (data != null) // single equals check for both `null` and `undefined` + this.push(data); + + cb(er); + + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} + +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + + Duplex.call(this, options); + + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; + + // 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; + } + + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); +} + +function prefinish() { + var _this = this; + + if (typeof this._flush === 'function') { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} + +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('_transform() is not implemented'); +}; + +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!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; + } +}; + +Transform.prototype._destroy = function (err, cb) { + var _this2 = this; + + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + _this2.emit('close'); + }); +}; + +function done(stream, er, data) { + if (er) return stream.emit('error', er); + + if (data != null) // single equals check for both `null` and `undefined` + stream.push(data); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); + + if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); + + return stream.push(null); +} \ No newline at end of file diff --git a/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/readable-stream/lib/_stream_writable.js new file mode 100644 index 0000000..0e1c28d --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_writable.js @@ -0,0 +1,677 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// 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'; + +/**/ + +var pna = require('process-nextick-args'); +/**/ + +module.exports = Writable; + +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// 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 () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ +var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; +/**/ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +/**/ +var internalUtil = { + deprecate: require('util-deprecate') +}; +/**/ + +/**/ +var Stream = require('./internal/streams/stream'); +/**/ + +/**/ + +var Buffer = require('safe-buffer').Buffer; +var OurUint8Array = global.Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ + +var destroyImpl = require('./internal/streams/destroy'); + +util.inherits(Writable, Stream); + +function nop() {} + +function WritableState(options, stream) { + Duplex = Duplex || require('./_stream_duplex'); + + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + var isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + if (isDuplex) 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 writableHwm = options.writableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; + + // cast to ints. + this.highWaterMark = Math.floor(this.highWaterMark); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + 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; + + // has it been destroyed + this.destroyed = 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 getBuffer() { + 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.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function (object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function (object) { + return object instanceof this; + }; +} + +function Writable(options) { + Duplex = Duplex || require('./_stream_duplex'); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + if (!realHasInstance.call(Writable, this) && !(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; + + if (typeof options.destroy === 'function') this._destroy = options.destroy; + + if (typeof options.final === 'function') this._final = options.final; + } + + 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); + pna.nextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var valid = true; + var er = false; + + if (chunk === null) { + er = new TypeError('May not write null values to stream'); + } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + if (er) { + stream.emit('error', er); + pna.nextTick(cb, er); + valid = false; + } + return valid; +} + +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + + if (typeof cb !== 'function') cb = nop; + + if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + + return ret; +}; + +Writable.prototype.cork = function () { + var state = this._writableState; + + state.corked++; +}; + +Writable.prototype.uncork = function () { + var state = this._writableState; + + if (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 = Buffer.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, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + 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 = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + 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) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + pna.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + pna.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + stream.emit('error', er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + stream.emit('error', er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} + +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); + + if (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) { + /**/ + asyncWrite(afterWrite, stream, state, finished, cb); + /**/ + } 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; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + + 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; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } 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; + state.bufferedRequestCount--; + // 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.bufferedRequest = entry; + state.bufferProcessing = false; +} + +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new Error('_write() is 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 callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + stream.emit('error', err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function') { + state.pendingcb++; + state.finalCalled = true; + pna.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} + +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + } + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) pna.nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} + +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + if (state.corkedRequestsFree) { + state.corkedRequestsFree.next = corkReq; + } else { + state.corkedRequestsFree = corkReq; + } +} + +Object.defineProperty(Writable.prototype, 'destroyed', { + get: function () { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); + +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + this.end(); + cb(err); +}; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/BufferList.js b/node_modules/readable-stream/lib/internal/streams/BufferList.js new file mode 100644 index 0000000..aefc68b --- /dev/null +++ b/node_modules/readable-stream/lib/internal/streams/BufferList.js @@ -0,0 +1,79 @@ +'use strict'; + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Buffer = require('safe-buffer').Buffer; +var util = require('util'); + +function copyBuffer(src, target, offset) { + src.copy(target, offset); +} + +module.exports = function () { + function BufferList() { + _classCallCheck(this, BufferList); + + this.head = null; + this.tail = null; + this.length = 0; + } + + BufferList.prototype.push = function push(v) { + var entry = { data: v, next: null }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + }; + + BufferList.prototype.unshift = function unshift(v) { + var entry = { data: v, next: this.head }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + }; + + BufferList.prototype.shift = function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + }; + + BufferList.prototype.clear = function clear() { + this.head = this.tail = null; + this.length = 0; + }; + + BufferList.prototype.join = function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) { + ret += s + p.data; + }return ret; + }; + + BufferList.prototype.concat = function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + if (this.length === 1) return this.head.data; + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; + }; + + return BufferList; +}(); + +if (util && util.inspect && util.inspect.custom) { + module.exports.prototype[util.inspect.custom] = function () { + var obj = util.inspect({ length: this.length }); + return this.constructor.name + ' ' + obj; + }; +} \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/destroy.js b/node_modules/readable-stream/lib/internal/streams/destroy.js new file mode 100644 index 0000000..5a0a0d8 --- /dev/null +++ b/node_modules/readable-stream/lib/internal/streams/destroy.js @@ -0,0 +1,74 @@ +'use strict'; + +/**/ + +var pna = require('process-nextick-args'); +/**/ + +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { + pna.nextTick(emitErrorNT, this, err); + } + return this; + } + + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + if (this._readableState) { + this._readableState.destroyed = true; + } + + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + + this._destroy(err || null, function (err) { + if (!cb && err) { + pna.nextTick(emitErrorNT, _this, err); + if (_this._writableState) { + _this._writableState.errorEmitted = true; + } + } else if (cb) { + cb(err); + } + }); + + return this; +} + +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} + +function emitErrorNT(self, err) { + self.emit('error', err); +} + +module.exports = { + destroy: destroy, + undestroy: undestroy +}; \ No newline at end of file diff --git a/node_modules/readable-stream/lib/internal/streams/stream-browser.js b/node_modules/readable-stream/lib/internal/streams/stream-browser.js new file mode 100644 index 0000000..9332a3f --- /dev/null +++ b/node_modules/readable-stream/lib/internal/streams/stream-browser.js @@ -0,0 +1 @@ +module.exports = require('events').EventEmitter; diff --git a/node_modules/readable-stream/lib/internal/streams/stream.js b/node_modules/readable-stream/lib/internal/streams/stream.js new file mode 100644 index 0000000..ce2ad5b --- /dev/null +++ b/node_modules/readable-stream/lib/internal/streams/stream.js @@ -0,0 +1 @@ +module.exports = require('stream'); diff --git a/node_modules/readable-stream/package.json b/node_modules/readable-stream/package.json new file mode 100644 index 0000000..675b217 --- /dev/null +++ b/node_modules/readable-stream/package.json @@ -0,0 +1,85 @@ +{ + "_from": "readable-stream@^2.0.2", + "_id": "readable-stream@2.3.5", + "_inBundle": false, + "_integrity": "sha512-tK0yDhrkygt/knjowCUiWP9YdV7c5R+8cR0r/kt9ZhBU906Fs6RpQJCEilamRJj1Nx2rWI6LkW9gKqjTkshhEw==", + "_location": "/readable-stream", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "readable-stream@^2.0.2", + "name": "readable-stream", + "escapedName": "readable-stream", + "rawSpec": "^2.0.2", + "saveSpec": null, + "fetchSpec": "^2.0.2" + }, + "_requiredBy": [ + "/readdirp" + ], + "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.5.tgz", + "_shasum": "b4f85003a938cbb6ecbce2a124fb1012bd1a838d", + "_spec": "readable-stream@^2.0.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/readdirp", + "browser": { + "util": false, + "./readable.js": "./readable-browser.js", + "./writable.js": "./writable-browser.js", + "./duplex.js": "./duplex-browser.js", + "./lib/internal/streams/stream.js": "./lib/internal/streams/stream-browser.js" + }, + "bugs": { + "url": "https://github.com/nodejs/readable-stream/issues" + }, + "bundleDependencies": false, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" + }, + "deprecated": false, + "description": "Streams3, a user-land copy of the stream library from Node.js", + "devDependencies": { + "assert": "^1.4.0", + "babel-polyfill": "^6.9.1", + "buffer": "^4.9.0", + "lolex": "^2.3.2", + "nyc": "^6.4.0", + "tap": "^0.7.0", + "tape": "^4.8.0", + "zuul": "^3.11.1" + }, + "homepage": "https://github.com/nodejs/readable-stream#readme", + "keywords": [ + "readable", + "stream", + "pipe" + ], + "license": "MIT", + "main": "readable.js", + "name": "readable-stream", + "nyc": { + "include": [ + "lib/**.js" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/nodejs/readable-stream.git" + }, + "scripts": { + "browser": "npm run write-zuul && zuul --browser-retries 2 -- test/browser.js", + "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js", + "cover": "nyc npm test", + "local": "zuul --local 3000 --no-coverage -- test/browser.js", + "report": "nyc report --reporter=lcov", + "test": "tap test/parallel/*.js test/ours/*.js && node test/verify-dependencies.js", + "write-zuul": "printf \"ui: tape\nbrowsers:\n - name: $BROWSER_NAME\n version: $BROWSER_VERSION\n\">.zuul.yml" + }, + "version": "2.3.5" +} diff --git a/node_modules/readable-stream/passthrough.js b/node_modules/readable-stream/passthrough.js new file mode 100644 index 0000000..ffd791d --- /dev/null +++ b/node_modules/readable-stream/passthrough.js @@ -0,0 +1 @@ +module.exports = require('./readable').PassThrough diff --git a/node_modules/readable-stream/readable-browser.js b/node_modules/readable-stream/readable-browser.js new file mode 100644 index 0000000..e503725 --- /dev/null +++ b/node_modules/readable-stream/readable-browser.js @@ -0,0 +1,7 @@ +exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = require('./lib/_stream_writable.js'); +exports.Duplex = require('./lib/_stream_duplex.js'); +exports.Transform = require('./lib/_stream_transform.js'); +exports.PassThrough = require('./lib/_stream_passthrough.js'); diff --git a/node_modules/readable-stream/readable.js b/node_modules/readable-stream/readable.js new file mode 100644 index 0000000..ec89ec5 --- /dev/null +++ b/node_modules/readable-stream/readable.js @@ -0,0 +1,19 @@ +var Stream = require('stream'); +if (process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream; + exports = module.exports = Stream.Readable; + exports.Readable = Stream.Readable; + exports.Writable = Stream.Writable; + exports.Duplex = Stream.Duplex; + exports.Transform = Stream.Transform; + exports.PassThrough = Stream.PassThrough; + exports.Stream = Stream; +} else { + exports = module.exports = require('./lib/_stream_readable.js'); + exports.Stream = Stream || exports; + exports.Readable = exports; + exports.Writable = require('./lib/_stream_writable.js'); + exports.Duplex = require('./lib/_stream_duplex.js'); + exports.Transform = require('./lib/_stream_transform.js'); + exports.PassThrough = require('./lib/_stream_passthrough.js'); +} diff --git a/node_modules/readable-stream/transform.js b/node_modules/readable-stream/transform.js new file mode 100644 index 0000000..b1baba2 --- /dev/null +++ b/node_modules/readable-stream/transform.js @@ -0,0 +1 @@ +module.exports = require('./readable').Transform diff --git a/node_modules/readable-stream/writable-browser.js b/node_modules/readable-stream/writable-browser.js new file mode 100644 index 0000000..ebdde6a --- /dev/null +++ b/node_modules/readable-stream/writable-browser.js @@ -0,0 +1 @@ +module.exports = require('./lib/_stream_writable.js'); diff --git a/node_modules/readable-stream/writable.js b/node_modules/readable-stream/writable.js new file mode 100644 index 0000000..3211a6f --- /dev/null +++ b/node_modules/readable-stream/writable.js @@ -0,0 +1,8 @@ +var Stream = require("stream") +var Writable = require("./lib/_stream_writable.js") + +if (process.env.READABLE_STREAM === 'disable') { + module.exports = Stream && Stream.Writable || Writable +} else { + module.exports = Writable +} diff --git a/node_modules/readdirp/.npmignore b/node_modules/readdirp/.npmignore new file mode 100644 index 0000000..7dccd97 --- /dev/null +++ b/node_modules/readdirp/.npmignore @@ -0,0 +1,15 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +node_modules +npm-debug.log \ No newline at end of file diff --git a/node_modules/readdirp/.travis.yml b/node_modules/readdirp/.travis.yml new file mode 100644 index 0000000..0cdb6c3 --- /dev/null +++ b/node_modules/readdirp/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - "0.10" + - "0.12" + - "4.4" + - "6.2" diff --git a/node_modules/readdirp/LICENSE b/node_modules/readdirp/LICENSE new file mode 100644 index 0000000..8a63b80 --- /dev/null +++ b/node_modules/readdirp/LICENSE @@ -0,0 +1,20 @@ +This software is released under the MIT license: + +Copyright (c) 2012-2015 Thorsten Lorenz + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/readdirp/README.md b/node_modules/readdirp/README.md new file mode 100644 index 0000000..b0c1626 --- /dev/null +++ b/node_modules/readdirp/README.md @@ -0,0 +1,233 @@ +# readdirp [![Build Status](https://secure.travis-ci.org/thlorenz/readdirp.png)](http://travis-ci.org/thlorenz/readdirp) + +[![NPM](https://nodei.co/npm/readdirp.png?downloads=true&stars=true)](https://nodei.co/npm/readdirp/) + +Recursive version of [fs.readdir](http://nodejs.org/docs/latest/api/fs.html#fs_fs_readdir_path_callback). Exposes a **stream api**. + +```javascript +var readdirp = require('readdirp') + , path = require('path') + , es = require('event-stream'); + +// print out all JavaScript files along with their size + +var stream = readdirp({ root: path.join(__dirname), fileFilter: '*.js' }); +stream + .on('warn', function (err) { + console.error('non-fatal error', err); + // optionally call stream.destroy() here in order to abort and cause 'close' to be emitted + }) + .on('error', function (err) { console.error('fatal error', err); }) + .pipe(es.mapSync(function (entry) { + return { path: entry.path, size: entry.stat.size }; + })) + .pipe(es.stringify()) + .pipe(process.stdout); +``` + +Meant to be one of the recursive versions of [fs](http://nodejs.org/docs/latest/api/fs.html) functions, e.g., like [mkdirp](https://github.com/substack/node-mkdirp). + +**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* + +- [Installation](#installation) +- [API](#api) + - [entry stream](#entry-stream) + - [options](#options) + - [entry info](#entry-info) + - [Filters](#filters) + - [Callback API](#callback-api) + - [allProcessed ](#allprocessed) + - [fileProcessed](#fileprocessed) +- [More Examples](#more-examples) + - [stream api](#stream-api) + - [stream api pipe](#stream-api-pipe) + - [grep](#grep) + - [using callback api](#using-callback-api) + - [tests](#tests) + + +# Installation + + npm install readdirp + +# API + +***var entryStream = readdirp (options)*** + +Reads given root recursively and returns a `stream` of [entry info](#entry-info)s. + +## entry stream + +Behaves as follows: + +- `emit('data')` passes an [entry info](#entry-info) whenever one is found +- `emit('warn')` passes a non-fatal `Error` that prevents a file/directory from being processed (i.e., if it is + inaccessible to the user) +- `emit('error')` passes a fatal `Error` which also ends the stream (i.e., when illegal options where passed) +- `emit('end')` called when all entries were found and no more will be emitted (i.e., we are done) +- `emit('close')` called when the stream is destroyed via `stream.destroy()` (which could be useful if you want to + manually abort even on a non fatal error) - at that point the stream is no longer `readable` and no more entries, + warning or errors are emitted +- to learn more about streams, consult the very detailed + [nodejs streams documentation](http://nodejs.org/api/stream.html) or the + [stream-handbook](https://github.com/substack/stream-handbook) + + +## options + +- **root**: path in which to start reading and recursing into subdirectories + +- **fileFilter**: filter to include/exclude files found (see [Filters](#filters) for more) + +- **directoryFilter**: filter to include/exclude directories found and to recurse into (see [Filters](#filters) for more) + +- **depth**: depth at which to stop recursing even if more subdirectories are found + +- **entryType**: determines if data events on the stream should be emitted for `'files'`, `'directories'`, `'both'`, or `'all'`. Setting to `'all'` will also include entries for other types of file descriptors like character devices, unix sockets and named pipes. Defaults to `'files'`. + +- **lstat**: if `true`, readdirp uses `fs.lstat` instead of `fs.stat` in order to stat files and includes symlink entries in the stream along with files. + +## entry info + +Has the following properties: + +- **parentDir** : directory in which entry was found (relative to given root) +- **fullParentDir** : full path to parent directory +- **name** : name of the file/directory +- **path** : path to the file/directory (relative to given root) +- **fullPath** : full path to the file/directory found +- **stat** : built in [stat object](http://nodejs.org/docs/v0.4.9/api/fs.html#fs.Stats) +- **Example**: (assuming root was `/User/dev/readdirp`) + + parentDir : 'test/bed/root_dir1', + fullParentDir : '/User/dev/readdirp/test/bed/root_dir1', + name : 'root_dir1_subdir1', + path : 'test/bed/root_dir1/root_dir1_subdir1', + fullPath : '/User/dev/readdirp/test/bed/root_dir1/root_dir1_subdir1', + stat : [ ... ] + +## Filters + +There are three different ways to specify filters for files and directories respectively. + +- **function**: a function that takes an entry info as a parameter and returns true to include or false to exclude the entry + +- **glob string**: a string (e.g., `*.js`) which is matched using [minimatch](https://github.com/isaacs/minimatch), so go there for more + information. + + Globstars (`**`) are not supported since specifiying a recursive pattern for an already recursive function doesn't make sense. + + Negated globs (as explained in the minimatch documentation) are allowed, e.g., `!*.txt` matches everything but text files. + +- **array of glob strings**: either need to be all inclusive or all exclusive (negated) patterns otherwise an error is thrown. + + `[ '*.json', '*.js' ]` includes all JavaScript and Json files. + + + `[ '!.git', '!node_modules' ]` includes all directories except the '.git' and 'node_modules'. + +Directories that do not pass a filter will not be recursed into. + +## Callback API + +Although the stream api is recommended, readdirp also exposes a callback based api. + +***readdirp (options, callback1 [, callback2])*** + +If callback2 is given, callback1 functions as the **fileProcessed** callback, and callback2 as the **allProcessed** callback. + +If only callback1 is given, it functions as the **allProcessed** callback. + +### allProcessed + +- function with err and res parameters, e.g., `function (err, res) { ... }` +- **err**: array of errors that occurred during the operation, **res may still be present, even if errors occurred** +- **res**: collection of file/directory [entry infos](#entry-info) + +### fileProcessed + +- function with [entry info](#entry-info) parameter e.g., `function (entryInfo) { ... }` + + +# More Examples + +`on('error', ..)`, `on('warn', ..)` and `on('end', ..)` handling omitted for brevity + +```javascript +var readdirp = require('readdirp'); + +// Glob file filter +readdirp({ root: './test/bed', fileFilter: '*.js' }) + .on('data', function (entry) { + // do something with each JavaScript file entry + }); + +// Combined glob file filters +readdirp({ root: './test/bed', fileFilter: [ '*.js', '*.json' ] }) + .on('data', function (entry) { + // do something with each JavaScript and Json file entry + }); + +// Combined negated directory filters +readdirp({ root: './test/bed', directoryFilter: [ '!.git', '!*modules' ] }) + .on('data', function (entry) { + // do something with each file entry found outside '.git' or any modules directory + }); + +// Function directory filter +readdirp({ root: './test/bed', directoryFilter: function (di) { return di.name.length === 9; } }) + .on('data', function (entry) { + // do something with each file entry found inside directories whose name has length 9 + }); + +// Limiting depth +readdirp({ root: './test/bed', depth: 1 }) + .on('data', function (entry) { + // do something with each file entry found up to 1 subdirectory deep + }); + +// callback api +readdirp( + { root: '.' } + , function(fileInfo) { + // do something with file entry here + } + , function (err, res) { + // all done, move on or do final step for all file entries here + } +); +``` + +Try more examples by following [instructions](https://github.com/thlorenz/readdirp/blob/master/examples/Readme.md) +on how to get going. + +## stream api + +[stream-api.js](https://github.com/thlorenz/readdirp/blob/master/examples/stream-api.js) + +Demonstrates error and data handling by listening to events emitted from the readdirp stream. + +## stream api pipe + +[stream-api-pipe.js](https://github.com/thlorenz/readdirp/blob/master/examples/stream-api-pipe.js) + +Demonstrates error handling by listening to events emitted from the readdirp stream and how to pipe the data stream into +another destination stream. + +## grep + +[grep.js](https://github.com/thlorenz/readdirp/blob/master/examples/grep.js) + +Very naive implementation of grep, for demonstration purposes only. + +## using callback api + +[callback-api.js](https://github.com/thlorenz/readdirp/blob/master/examples/callback-api.js) + +Shows how to pass callbacks in order to handle errors and/or data. + +## tests + +The [readdirp tests](https://github.com/thlorenz/readdirp/blob/master/test/readdirp.js) also will give you a good idea on +how things work. + diff --git a/node_modules/readdirp/examples/Readme.md b/node_modules/readdirp/examples/Readme.md new file mode 100644 index 0000000..55fc461 --- /dev/null +++ b/node_modules/readdirp/examples/Readme.md @@ -0,0 +1,37 @@ +# readdirp examples + +## How to run the examples + +Assuming you installed readdirp (`npm install readdirp`), you can do the following: + +1. `npm explore readdirp` +2. `cd examples` +3. `npm install` + +At that point you can run the examples with node, i.e., `node grep`. + +## stream api + +[stream-api.js](https://github.com/thlorenz/readdirp/blob/master/examples/stream-api.js) + +Demonstrates error and data handling by listening to events emitted from the readdirp stream. + +## stream api pipe + +[stream-api-pipe.js](https://github.com/thlorenz/readdirp/blob/master/examples/stream-api-pipe.js) + +Demonstrates error handling by listening to events emitted from the readdirp stream and how to pipe the data stream into +another destination stream. + +## grep + +[grep.js](https://github.com/thlorenz/readdirp/blob/master/examples/grep.js) + +Very naive implementation of grep, for demonstration purposes only. + +## using callback api + +[callback-api.js](https://github.com/thlorenz/readdirp/blob/master/examples/callback-api.js) + +Shows how to pass callbacks in order to handle errors and/or data. + diff --git a/node_modules/readdirp/examples/callback-api.js b/node_modules/readdirp/examples/callback-api.js new file mode 100644 index 0000000..39bd2d7 --- /dev/null +++ b/node_modules/readdirp/examples/callback-api.js @@ -0,0 +1,10 @@ +var readdirp = require('..'); + +readdirp({ root: '.', fileFilter: '*.js' }, function (errors, res) { + if (errors) { + errors.forEach(function (err) { + console.error('Error: ', err); + }); + } + console.log('all javascript files', res); +}); diff --git a/node_modules/readdirp/examples/grep.js b/node_modules/readdirp/examples/grep.js new file mode 100644 index 0000000..01d5f29 --- /dev/null +++ b/node_modules/readdirp/examples/grep.js @@ -0,0 +1,71 @@ +'use strict'; +var readdirp = require('..') + , util = require('util') + , fs = require('fs') + , path = require('path') + , es = require('event-stream') + ; + +function findLinesMatching (searchTerm) { + + return es.through(function (entry) { + var lineno = 0 + , matchingLines = [] + , fileStream = this; + + function filter () { + return es.mapSync(function (line) { + lineno++; + return ~line.indexOf(searchTerm) ? lineno + ': ' + line : undefined; + }); + } + + function aggregate () { + return es.through( + function write (data) { + matchingLines.push(data); + } + , function end () { + + // drop files that had no matches + if (matchingLines.length) { + var result = { file: entry, lines: matchingLines }; + + // pass result on to file stream + fileStream.emit('data', result); + } + this.emit('end'); + } + ); + } + + fs.createReadStream(entry.fullPath, { encoding: 'utf-8' }) + + // handle file contents line by line + .pipe(es.split('\n')) + + // keep only the lines that matched the term + .pipe(filter()) + + // aggregate all matching lines and delegate control back to the file stream + .pipe(aggregate()) + ; + }); +} + +console.log('grepping for "arguments"'); + +// create a stream of all javascript files found in this and all sub directories +readdirp({ root: path.join(__dirname), fileFilter: '*.js' }) + + // find all lines matching the term for each file (if none found, that file is ignored) + .pipe(findLinesMatching('arguments')) + + // format the results and output + .pipe( + es.mapSync(function (res) { + return '\n\n' + res.file.path + '\n\t' + res.lines.join('\n\t'); + }) + ) + .pipe(process.stdout) + ; diff --git a/node_modules/readdirp/examples/package.json b/node_modules/readdirp/examples/package.json new file mode 100644 index 0000000..2d9b341 --- /dev/null +++ b/node_modules/readdirp/examples/package.json @@ -0,0 +1,9 @@ +{ + "name": "readdirp-examples", + "version": "0.0.0", + "description": "Examples for readdirp.", + "dependencies": { + "tap-stream": "~0.1.0", + "event-stream": "~3.0.7" + } +} diff --git a/node_modules/readdirp/examples/stream-api-pipe.js b/node_modules/readdirp/examples/stream-api-pipe.js new file mode 100644 index 0000000..4003be8 --- /dev/null +++ b/node_modules/readdirp/examples/stream-api-pipe.js @@ -0,0 +1,19 @@ +var readdirp = require('..') + , path = require('path') + , through = require('through2') + +// print out all JavaScript files along with their size +readdirp({ root: path.join(__dirname), fileFilter: '*.js' }) + .on('warn', function (err) { console.error('non-fatal error', err); }) + .on('error', function (err) { console.error('fatal error', err); }) + .pipe(through.obj(function (entry, _, cb) { + this.push({ path: entry.path, size: entry.stat.size }); + cb(); + })) + .pipe(through.obj( + function (res, _, cb) { + this.push(JSON.stringify(res) + '\n'); + cb(); + }) + ) + .pipe(process.stdout); diff --git a/node_modules/readdirp/examples/stream-api.js b/node_modules/readdirp/examples/stream-api.js new file mode 100644 index 0000000..0f7b327 --- /dev/null +++ b/node_modules/readdirp/examples/stream-api.js @@ -0,0 +1,15 @@ +var readdirp = require('..') + , path = require('path'); + +readdirp({ root: path.join(__dirname), fileFilter: '*.js' }) + .on('warn', function (err) { + console.error('something went wrong when processing an entry', err); + }) + .on('error', function (err) { + console.error('something went fatally wrong and the stream was aborted', err); + }) + .on('data', function (entry) { + console.log('%s is ready for processing', entry.path); + // process entry here + }); + diff --git a/node_modules/readdirp/package.json b/node_modules/readdirp/package.json new file mode 100644 index 0000000..91cd89d --- /dev/null +++ b/node_modules/readdirp/package.json @@ -0,0 +1,79 @@ +{ + "_from": "readdirp@^2.0.0", + "_id": "readdirp@2.1.0", + "_inBundle": false, + "_integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", + "_location": "/readdirp", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "readdirp@^2.0.0", + "name": "readdirp", + "escapedName": "readdirp", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/chokidar" + ], + "_resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", + "_shasum": "4ed0ad060df3073300c48440373f72d1cc642d78", + "_spec": "readdirp@^2.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/chokidar", + "author": { + "name": "Thorsten Lorenz", + "email": "thlorenz@gmx.de", + "url": "thlorenz.com" + }, + "bugs": { + "url": "https://github.com/thlorenz/readdirp/issues" + }, + "bundleDependencies": false, + "dependencies": { + "graceful-fs": "^4.1.2", + "minimatch": "^3.0.2", + "readable-stream": "^2.0.2", + "set-immediate-shim": "^1.0.1" + }, + "deprecated": false, + "description": "Recursive version of fs.readdir with streaming api.", + "devDependencies": { + "nave": "^0.5.1", + "proxyquire": "^1.7.9", + "tap": "1.3.2", + "through2": "^2.0.0" + }, + "engines": { + "node": ">=0.6" + }, + "homepage": "https://github.com/thlorenz/readdirp", + "keywords": [ + "recursive", + "fs", + "stream", + "streams", + "readdir", + "filesystem", + "find", + "filter" + ], + "license": "MIT", + "main": "readdirp.js", + "name": "readdirp", + "repository": { + "type": "git", + "url": "git://github.com/thlorenz/readdirp.git" + }, + "scripts": { + "test": "if [ -e $TRAVIS ]; then npm run test-all; else npm run test-main; fi", + "test-0.10": "nave use 0.10 npm run test-main", + "test-0.12": "nave use 0.12 npm run test-main", + "test-4": "nave use 4.4 npm run test-main", + "test-6": "nave use 6.2 npm run test-main", + "test-all": "npm run test-main && npm run test-0.10 && npm run test-0.12 && npm run test-4 && npm run test-6", + "test-main": "(cd test && set -e; for t in ./*.js; do node $t; done)" + }, + "version": "2.1.0" +} diff --git a/node_modules/readdirp/readdirp.js b/node_modules/readdirp/readdirp.js new file mode 100644 index 0000000..b6b21e4 --- /dev/null +++ b/node_modules/readdirp/readdirp.js @@ -0,0 +1,300 @@ +'use strict'; + +var fs = require('graceful-fs') + , path = require('path') + , minimatch = require('minimatch') + , toString = Object.prototype.toString + , si = require('set-immediate-shim') + ; + + +// Standard helpers +function isFunction (obj) { + return toString.call(obj) === '[object Function]'; +} + +function isString (obj) { + return toString.call(obj) === '[object String]'; +} + +function isRegExp (obj) { + return toString.call(obj) === '[object RegExp]'; +} + +function isUndefined (obj) { + return obj === void 0; +} + +/** + * Main function which ends up calling readdirRec and reads all files and directories in given root recursively. + * @param { Object } opts Options to specify root (start directory), filters and recursion depth + * @param { function } callback1 When callback2 is given calls back for each processed file - function (fileInfo) { ... }, + * when callback2 is not given, it behaves like explained in callback2 + * @param { function } callback2 Calls back once all files have been processed with an array of errors and file infos + * function (err, fileInfos) { ... } + */ +function readdir(opts, callback1, callback2) { + var stream + , handleError + , handleFatalError + , pending = 0 + , errors = [] + , readdirResult = { + directories: [] + , files: [] + } + , fileProcessed + , allProcessed + , realRoot + , aborted = false + , paused = false + ; + + // If no callbacks were given we will use a streaming interface + if (isUndefined(callback1)) { + var api = require('./stream-api')(); + stream = api.stream; + callback1 = api.processEntry; + callback2 = api.done; + handleError = api.handleError; + handleFatalError = api.handleFatalError; + + stream.on('close', function () { aborted = true; }); + stream.on('pause', function () { paused = true; }); + stream.on('resume', function () { paused = false; }); + } else { + handleError = function (err) { errors.push(err); }; + handleFatalError = function (err) { + handleError(err); + allProcessed(errors, null); + }; + } + + if (isUndefined(opts)){ + handleFatalError(new Error ( + 'Need to pass at least one argument: opts! \n' + + 'https://github.com/thlorenz/readdirp#options' + ) + ); + return stream; + } + + opts.root = opts.root || '.'; + opts.fileFilter = opts.fileFilter || function() { return true; }; + opts.directoryFilter = opts.directoryFilter || function() { return true; }; + opts.depth = typeof opts.depth === 'undefined' ? 999999999 : opts.depth; + opts.entryType = opts.entryType || 'files'; + + var statfn = opts.lstat === true ? fs.lstat.bind(fs) : fs.stat.bind(fs); + + if (isUndefined(callback2)) { + fileProcessed = function() { }; + allProcessed = callback1; + } else { + fileProcessed = callback1; + allProcessed = callback2; + } + + function normalizeFilter (filter) { + + if (isUndefined(filter)) return undefined; + + function isNegated (filters) { + + function negated(f) { + return f.indexOf('!') === 0; + } + + var some = filters.some(negated); + if (!some) { + return false; + } else { + if (filters.every(negated)) { + return true; + } else { + // if we detect illegal filters, bail out immediately + throw new Error( + 'Cannot mix negated with non negated glob filters: ' + filters + '\n' + + 'https://github.com/thlorenz/readdirp#filters' + ); + } + } + } + + // Turn all filters into a function + if (isFunction(filter)) { + + return filter; + + } else if (isString(filter)) { + + return function (entryInfo) { + return minimatch(entryInfo.name, filter.trim()); + }; + + } else if (filter && Array.isArray(filter)) { + + if (filter) filter = filter.map(function (f) { + return f.trim(); + }); + + return isNegated(filter) ? + // use AND to concat multiple negated filters + function (entryInfo) { + return filter.every(function (f) { + return minimatch(entryInfo.name, f); + }); + } + : + // use OR to concat multiple inclusive filters + function (entryInfo) { + return filter.some(function (f) { + return minimatch(entryInfo.name, f); + }); + }; + } + } + + function processDir(currentDir, entries, callProcessed) { + if (aborted) return; + var total = entries.length + , processed = 0 + , entryInfos = [] + ; + + fs.realpath(currentDir, function(err, realCurrentDir) { + if (aborted) return; + if (err) { + handleError(err); + callProcessed(entryInfos); + return; + } + + var relDir = path.relative(realRoot, realCurrentDir); + + if (entries.length === 0) { + callProcessed([]); + } else { + entries.forEach(function (entry) { + + var fullPath = path.join(realCurrentDir, entry) + , relPath = path.join(relDir, entry); + + statfn(fullPath, function (err, stat) { + if (err) { + handleError(err); + } else { + entryInfos.push({ + name : entry + , path : relPath // relative to root + , fullPath : fullPath + + , parentDir : relDir // relative to root + , fullParentDir : realCurrentDir + + , stat : stat + }); + } + processed++; + if (processed === total) callProcessed(entryInfos); + }); + }); + } + }); + } + + function readdirRec(currentDir, depth, callCurrentDirProcessed) { + var args = arguments; + if (aborted) return; + if (paused) { + si(function () { + readdirRec.apply(null, args); + }) + return; + } + + fs.readdir(currentDir, function (err, entries) { + if (err) { + handleError(err); + callCurrentDirProcessed(); + return; + } + + processDir(currentDir, entries, function(entryInfos) { + + var subdirs = entryInfos + .filter(function (ei) { return ei.stat.isDirectory() && opts.directoryFilter(ei); }); + + subdirs.forEach(function (di) { + if(opts.entryType === 'directories' || opts.entryType === 'both' || opts.entryType === 'all') { + fileProcessed(di); + } + readdirResult.directories.push(di); + }); + + entryInfos + .filter(function(ei) { + var isCorrectType = opts.entryType === 'all' ? + !ei.stat.isDirectory() : ei.stat.isFile() || ei.stat.isSymbolicLink(); + return isCorrectType && opts.fileFilter(ei); + }) + .forEach(function (fi) { + if(opts.entryType === 'files' || opts.entryType === 'both' || opts.entryType === 'all') { + fileProcessed(fi); + } + readdirResult.files.push(fi); + }); + + var pendingSubdirs = subdirs.length; + + // Be done if no more subfolders exist or we reached the maximum desired depth + if(pendingSubdirs === 0 || depth === opts.depth) { + callCurrentDirProcessed(); + } else { + // recurse into subdirs, keeping track of which ones are done + // and call back once all are processed + subdirs.forEach(function (subdir) { + readdirRec(subdir.fullPath, depth + 1, function () { + pendingSubdirs = pendingSubdirs - 1; + if(pendingSubdirs === 0) { + callCurrentDirProcessed(); + } + }); + }); + } + }); + }); + } + + // Validate and normalize filters + try { + opts.fileFilter = normalizeFilter(opts.fileFilter); + opts.directoryFilter = normalizeFilter(opts.directoryFilter); + } catch (err) { + // if we detect illegal filters, bail out immediately + handleFatalError(err); + return stream; + } + + // If filters were valid get on with the show + fs.realpath(opts.root, function(err, res) { + if (err) { + handleFatalError(err); + return stream; + } + + realRoot = res; + readdirRec(opts.root, 0, function () { + // All errors are collected into the errors array + if (errors.length > 0) { + allProcessed(errors, readdirResult); + } else { + allProcessed(null, readdirResult); + } + }); + }); + + return stream; +} + +module.exports = readdir; diff --git a/node_modules/readdirp/stream-api.js b/node_modules/readdirp/stream-api.js new file mode 100644 index 0000000..91c6808 --- /dev/null +++ b/node_modules/readdirp/stream-api.js @@ -0,0 +1,99 @@ +'use strict'; + +var si = require('set-immediate-shim'); +var stream = require('readable-stream'); +var util = require('util'); + +var Readable = stream.Readable; + +module.exports = ReaddirpReadable; + +util.inherits(ReaddirpReadable, Readable); + +function ReaddirpReadable (opts) { + if (!(this instanceof ReaddirpReadable)) return new ReaddirpReadable(opts); + + opts = opts || {}; + + opts.objectMode = true; + Readable.call(this, opts); + + // backpressure not implemented at this point + this.highWaterMark = Infinity; + + this._destroyed = false; + this._paused = false; + this._warnings = []; + this._errors = []; + + this._pauseResumeErrors(); +} + +var proto = ReaddirpReadable.prototype; + +proto._pauseResumeErrors = function () { + var self = this; + self.on('pause', function () { self._paused = true }); + self.on('resume', function () { + if (self._destroyed) return; + self._paused = false; + + self._warnings.forEach(function (err) { self.emit('warn', err) }); + self._warnings.length = 0; + + self._errors.forEach(function (err) { self.emit('error', err) }); + self._errors.length = 0; + }) +} + +// called for each entry +proto._processEntry = function (entry) { + if (this._destroyed) return; + this.push(entry); +} + +proto._read = function () { } + +proto.destroy = function () { + // when stream is destroyed it will emit nothing further, not even errors or warnings + this.push(null); + this.readable = false; + this._destroyed = true; + this.emit('close'); +} + +proto._done = function () { + this.push(null); +} + +// we emit errors and warnings async since we may handle errors like invalid args +// within the initial event loop before any event listeners subscribed +proto._handleError = function (err) { + var self = this; + si(function () { + if (self._paused) return self._warnings.push(err); + if (!self._destroyed) self.emit('warn', err); + }); +} + +proto._handleFatalError = function (err) { + var self = this; + si(function () { + if (self._paused) return self._errors.push(err); + if (!self._destroyed) self.emit('error', err); + }); +} + +function createStreamAPI () { + var stream = new ReaddirpReadable(); + + return { + stream : stream + , processEntry : stream._processEntry.bind(stream) + , done : stream._done.bind(stream) + , handleError : stream._handleError.bind(stream) + , handleFatalError : stream._handleFatalError.bind(stream) + }; +} + +module.exports = createStreamAPI; diff --git a/node_modules/readdirp/test/bed/root_dir1/root_dir1_file1.ext1 b/node_modules/readdirp/test/bed/root_dir1/root_dir1_file1.ext1 new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/readdirp/test/bed/root_dir1/root_dir1_file2.ext2 b/node_modules/readdirp/test/bed/root_dir1/root_dir1_file2.ext2 new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/readdirp/test/bed/root_dir1/root_dir1_file3.ext3 b/node_modules/readdirp/test/bed/root_dir1/root_dir1_file3.ext3 new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/readdirp/test/bed/root_dir1/root_dir1_subdir1/root1_dir1_subdir1_file1.ext1 b/node_modules/readdirp/test/bed/root_dir1/root_dir1_subdir1/root1_dir1_subdir1_file1.ext1 new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/readdirp/test/bed/root_dir2/root_dir2_file1.ext1 b/node_modules/readdirp/test/bed/root_dir2/root_dir2_file1.ext1 new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/readdirp/test/bed/root_dir2/root_dir2_file2.ext2 b/node_modules/readdirp/test/bed/root_dir2/root_dir2_file2.ext2 new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/readdirp/test/bed/root_file1.ext1 b/node_modules/readdirp/test/bed/root_file1.ext1 new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/readdirp/test/bed/root_file2.ext2 b/node_modules/readdirp/test/bed/root_file2.ext2 new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/readdirp/test/bed/root_file3.ext3 b/node_modules/readdirp/test/bed/root_file3.ext3 new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/readdirp/test/readdirp-stream.js b/node_modules/readdirp/test/readdirp-stream.js new file mode 100644 index 0000000..c43d132 --- /dev/null +++ b/node_modules/readdirp/test/readdirp-stream.js @@ -0,0 +1,338 @@ +/*jshint asi:true */ + +var debug //= true; +var test = debug ? function () {} : require('tap').test +var test_ = !debug ? function () {} : require('tap').test + , path = require('path') + , fs = require('fs') + , util = require('util') + , TransformStream = require('readable-stream').Transform + , through = require('through2') + , proxyquire = require('proxyquire') + , streamapi = require('../stream-api') + , readdirp = require('..') + , root = path.join(__dirname, 'bed') + , totalDirs = 6 + , totalFiles = 12 + , ext1Files = 4 + , ext2Files = 3 + , ext3Files = 2 + ; + +// see test/readdirp.js for test bed layout + +function opts (extend) { + var o = { root: root }; + + if (extend) { + for (var prop in extend) { + o[prop] = extend[prop]; + } + } + return o; +} + +function capture () { + var result = { entries: [], errors: [], ended: false } + , dst = new TransformStream({ objectMode: true }); + + dst._transform = function (entry, _, cb) { + result.entries.push(entry); + cb(); + } + + dst._flush = function (cb) { + result.ended = true; + this.push(result); + cb(); + } + + return dst; +} + +test('\nintegrated', function (t) { + t.test('\n# reading root without filter', function (t) { + t.plan(2); + + readdirp(opts()) + .on('error', function (err) { + t.fail('should not throw error', err); + }) + .pipe(capture()) + .pipe(through.obj( + function (result, _ , cb) { + t.equals(result.entries.length, totalFiles, 'emits all files'); + t.ok(result.ended, 'ends stream'); + t.end(); + cb(); + } + )); + }) + + t.test('\n# normal: ["*.ext1", "*.ext3"]', function (t) { + t.plan(2); + + readdirp(opts( { fileFilter: [ '*.ext1', '*.ext3' ] } )) + .on('error', function (err) { + t.fail('should not throw error', err); + }) + .pipe(capture()) + .pipe(through.obj( + function (result, _ , cb) { + t.equals(result.entries.length, ext1Files + ext3Files, 'all ext1 and ext3 files'); + t.ok(result.ended, 'ends stream'); + t.end(); + cb(); + } + )) + }) + + t.test('\n# files only', function (t) { + t.plan(2); + + readdirp(opts( { entryType: 'files' } )) + .on('error', function (err) { + t.fail('should not throw error', err); + }) + .pipe(capture()) + .pipe(through.obj( + function (result, _ , cb) { + t.equals(result.entries.length, totalFiles, 'returned files'); + t.ok(result.ended, 'ends stream'); + t.end(); + cb(); + } + )) + }) + + t.test('\n# directories only', function (t) { + t.plan(2); + + readdirp(opts( { entryType: 'directories' } )) + .on('error', function (err) { + t.fail('should not throw error', err); + }) + .pipe(capture()) + .pipe(through.obj( + function (result, _ , cb) { + t.equals(result.entries.length, totalDirs, 'returned directories'); + t.ok(result.ended, 'ends stream'); + t.end(); + cb(); + } + )) + }) + + t.test('\n# both directories + files', function (t) { + t.plan(2); + + readdirp(opts( { entryType: 'both' } )) + .on('error', function (err) { + t.fail('should not throw error', err); + }) + .pipe(capture()) + .pipe(through.obj( + function (result, _ , cb) { + t.equals(result.entries.length, totalDirs + totalFiles, 'returned everything'); + t.ok(result.ended, 'ends stream'); + t.end(); + cb(); + } + )) + }) + + t.test('\n# directory filter with directories only', function (t) { + t.plan(2); + + readdirp(opts( { entryType: 'directories', directoryFilter: [ 'root_dir1', '*dir1_subdir1' ] } )) + .on('error', function (err) { + t.fail('should not throw error', err); + }) + .pipe(capture()) + .pipe(through.obj( + function (result, _ , cb) { + t.equals(result.entries.length, 2, 'two directories'); + t.ok(result.ended, 'ends stream'); + t.end(); + cb(); + } + )) + }) + + t.test('\n# directory and file filters with both entries', function (t) { + t.plan(2); + + readdirp(opts( { entryType: 'both', directoryFilter: [ 'root_dir1', '*dir1_subdir1' ], fileFilter: [ '!*.ext1' ] } )) + .on('error', function (err) { + t.fail('should not throw error', err); + }) + .pipe(capture()) + .pipe(through.obj( + function (result, _ , cb) { + t.equals(result.entries.length, 6, '2 directories and 4 files'); + t.ok(result.ended, 'ends stream'); + t.end(); + cb(); + } + )) + }) + + t.test('\n# negated: ["!*.ext1", "!*.ext3"]', function (t) { + t.plan(2); + + readdirp(opts( { fileFilter: [ '!*.ext1', '!*.ext3' ] } )) + .on('error', function (err) { + t.fail('should not throw error', err); + }) + .pipe(capture()) + .pipe(through.obj( + function (result, _ , cb) { + t.equals(result.entries.length, totalFiles - ext1Files - ext3Files, 'all but ext1 and ext3 files'); + t.ok(result.ended, 'ends stream'); + t.end(); + } + )) + }) + + t.test('\n# no options given', function (t) { + t.plan(1); + readdirp() + .on('error', function (err) { + t.similar(err.toString() , /Need to pass at least one argument/ , 'emits meaningful error'); + t.end(); + }) + }) + + t.test('\n# mixed: ["*.ext1", "!*.ext3"]', function (t) { + t.plan(1); + + readdirp(opts( { fileFilter: [ '*.ext1', '!*.ext3' ] } )) + .on('error', function (err) { + t.similar(err.toString() , /Cannot mix negated with non negated glob filters/ , 'emits meaningful error'); + t.end(); + }) + }) +}) + + +test('\napi separately', function (t) { + + t.test('\n# handleError', function (t) { + t.plan(1); + + var api = streamapi() + , warning = new Error('some file caused problems'); + + api.stream + .on('warn', function (err) { + t.equals(err, warning, 'warns with the handled error'); + }) + api.handleError(warning); + }) + + t.test('\n# when stream is paused and then resumed', function (t) { + t.plan(6); + var api = streamapi() + , resumed = false + , fatalError = new Error('fatal!') + , nonfatalError = new Error('nonfatal!') + , processedData = 'some data' + ; + + api.stream + .on('warn', function (err) { + t.equals(err, nonfatalError, 'emits the buffered warning'); + t.ok(resumed, 'emits warning only after it was resumed'); + }) + .on('error', function (err) { + t.equals(err, fatalError, 'emits the buffered fatal error'); + t.ok(resumed, 'emits errors only after it was resumed'); + }) + .on('data', function (data) { + t.equals(data, processedData, 'emits the buffered data'); + t.ok(resumed, 'emits data only after it was resumed'); + }) + .pause() + + api.processEntry(processedData); + api.handleError(nonfatalError); + api.handleFatalError(fatalError); + + setTimeout(function () { + resumed = true; + api.stream.resume(); + }, 1) + }) + + t.test('\n# when a stream is paused it stops walking the fs', function (t) { + var resumed = false, + mockedAPI = streamapi(); + + mockedAPI.processEntry = function (entry) { + if (!resumed) t.notOk(true, 'should not emit while paused') + t.ok(entry, 'emitted while resumed') + }.bind(mockedAPI.stream) + + function wrapper () { + return mockedAPI + } + + var readdirp = proxyquire('../readdirp', {'./stream-api': wrapper}) + , stream = readdirp(opts()) + .on('error', function (err) { + t.fail('should not throw error', err); + }) + .on('end', function () { + t.end() + }) + .pause(); + + setTimeout(function () { + resumed = true; + stream.resume(); + }, 5) + }) + + t.test('\n# when a stream is destroyed, it emits "closed", but no longer emits "data", "warn" and "error"', function (t) { + var api = streamapi() + , fatalError = new Error('fatal!') + , nonfatalError = new Error('nonfatal!') + , processedData = 'some data' + , plan = 0; + + t.plan(6) + var stream = api.stream + .on('warn', function (err) { + t.ok(!stream._destroyed, 'emits warning until destroyed'); + }) + .on('error', function (err) { + t.ok(!stream._destroyed, 'emits errors until destroyed'); + }) + .on('data', function (data) { + t.ok(!stream._destroyed, 'emits data until destroyed'); + }) + .on('close', function () { + t.ok(stream._destroyed, 'emits close when stream is destroyed'); + }) + + + api.processEntry(processedData); + api.handleError(nonfatalError); + api.handleFatalError(fatalError); + + setTimeout(function () { + stream.destroy() + + t.notOk(stream.readable, 'stream is no longer readable after it is destroyed') + + api.processEntry(processedData); + api.handleError(nonfatalError); + api.handleFatalError(fatalError); + + process.nextTick(function () { + t.pass('emits no more data, warn or error events after it was destroyed') + t.end(); + }) + }, 10) + }) +}) diff --git a/node_modules/readdirp/test/readdirp.js b/node_modules/readdirp/test/readdirp.js new file mode 100644 index 0000000..812afbb --- /dev/null +++ b/node_modules/readdirp/test/readdirp.js @@ -0,0 +1,289 @@ +/*jshint asi:true */ + +var test = require('tap').test + , path = require('path') + , fs = require('fs') + , util = require('util') + , net = require('net') + , readdirp = require('../readdirp.js') + , root = path.join(__dirname, '../test/bed') + , totalDirs = 6 + , totalFiles = 12 + , ext1Files = 4 + , ext2Files = 3 + , ext3Files = 2 + , rootDir2Files = 2 + , nameHasLength9Dirs = 2 + , depth1Files = 8 + , depth0Files = 3 + ; + +/* +Structure of test bed: + . + ├── root_dir1 + │   ├── root_dir1_file1.ext1 + │   ├── root_dir1_file2.ext2 + │   ├── root_dir1_file3.ext3 + │   ├── root_dir1_subdir1 + │   │   └── root1_dir1_subdir1_file1.ext1 + │   └── root_dir1_subdir2 + │   └── .gitignore + ├── root_dir2 + │   ├── root_dir2_file1.ext1 + │   ├── root_dir2_file2.ext2 + │   ├── root_dir2_subdir1 + │   │   └── .gitignore + │   └── root_dir2_subdir2 + │   └── .gitignore + ├── root_file1.ext1 + ├── root_file2.ext2 + └── root_file3.ext3 + + 6 directories, 13 files +*/ + +// console.log('\033[2J'); // clear console + +function opts (extend) { + var o = { root: root }; + + if (extend) { + for (var prop in extend) { + o[prop] = extend[prop]; + } + } + return o; +} + +test('\nreading root without filter', function (t) { + t.plan(2); + readdirp(opts(), function (err, res) { + t.equals(res.directories.length, totalDirs, 'all directories'); + t.equals(res.files.length, totalFiles, 'all files'); + t.end(); + }) +}) + +test('\nreading root without filter using lstat', function (t) { + t.plan(2); + readdirp(opts({ lstat: true }), function (err, res) { + t.equals(res.directories.length, totalDirs, 'all directories'); + t.equals(res.files.length, totalFiles, 'all files'); + t.end(); + }) +}) + +test('\nreading root with symlinks using lstat', function (t) { + t.plan(2); + fs.symlinkSync(path.join(root, 'root_dir1'), path.join(root, 'dirlink')); + fs.symlinkSync(path.join(root, 'root_file1.ext1'), path.join(root, 'link.ext1')); + readdirp(opts({ lstat: true }), function (err, res) { + t.equals(res.directories.length, totalDirs, 'all directories'); + t.equals(res.files.length, totalFiles + 2, 'all files + symlinks'); + fs.unlinkSync(path.join(root, 'dirlink')); + fs.unlinkSync(path.join(root, 'link.ext1')); + t.end(); + }) +}) + +test('\nreading non-standard fds', function (t) { + t.plan(2); + var server = net.createServer().listen(path.join(root, 'test.sock'), function(){ + readdirp(opts({ entryType: 'all' }), function (err, res) { + t.equals(res.files.length, totalFiles + 1, 'all files + socket'); + readdirp(opts({ entryType: 'both' }), function (err, res) { + t.equals(res.files.length, totalFiles, 'all regular files only'); + server.close(); + t.end(); + }) + }) + }); +}) + +test('\nreading root using glob filter', function (t) { + // normal + t.test('\n# "*.ext1"', function (t) { + t.plan(1); + readdirp(opts( { fileFilter: '*.ext1' } ), function (err, res) { + t.equals(res.files.length, ext1Files, 'all ext1 files'); + t.end(); + }) + }) + t.test('\n# ["*.ext1", "*.ext3"]', function (t) { + t.plan(1); + readdirp(opts( { fileFilter: [ '*.ext1', '*.ext3' ] } ), function (err, res) { + t.equals(res.files.length, ext1Files + ext3Files, 'all ext1 and ext3 files'); + t.end(); + }) + }) + t.test('\n# "root_dir1"', function (t) { + t.plan(1); + readdirp(opts( { directoryFilter: 'root_dir1' }), function (err, res) { + t.equals(res.directories.length, 1, 'one directory'); + t.end(); + }) + }) + t.test('\n# ["root_dir1", "*dir1_subdir1"]', function (t) { + t.plan(1); + readdirp(opts( { directoryFilter: [ 'root_dir1', '*dir1_subdir1' ]}), function (err, res) { + t.equals(res.directories.length, 2, 'two directories'); + t.end(); + }) + }) + + t.test('\n# negated: "!*.ext1"', function (t) { + t.plan(1); + readdirp(opts( { fileFilter: '!*.ext1' } ), function (err, res) { + t.equals(res.files.length, totalFiles - ext1Files, 'all but ext1 files'); + t.end(); + }) + }) + t.test('\n# negated: ["!*.ext1", "!*.ext3"]', function (t) { + t.plan(1); + readdirp(opts( { fileFilter: [ '!*.ext1', '!*.ext3' ] } ), function (err, res) { + t.equals(res.files.length, totalFiles - ext1Files - ext3Files, 'all but ext1 and ext3 files'); + t.end(); + }) + }) + + t.test('\n# mixed: ["*.ext1", "!*.ext3"]', function (t) { + t.plan(1); + readdirp(opts( { fileFilter: [ '*.ext1', '!*.ext3' ] } ), function (err, res) { + t.similar(err[0].toString(), /Cannot mix negated with non negated glob filters/, 'returns meaningfull error'); + t.end(); + }) + }) + + t.test('\n# leading and trailing spaces: [" *.ext1", "*.ext3 "]', function (t) { + t.plan(1); + readdirp(opts( { fileFilter: [ ' *.ext1', '*.ext3 ' ] } ), function (err, res) { + t.equals(res.files.length, ext1Files + ext3Files, 'all ext1 and ext3 files'); + t.end(); + }) + }) + t.test('\n# leading and trailing spaces: [" !*.ext1", " !*.ext3 "]', function (t) { + t.plan(1); + readdirp(opts( { fileFilter: [ ' !*.ext1', ' !*.ext3' ] } ), function (err, res) { + t.equals(res.files.length, totalFiles - ext1Files - ext3Files, 'all but ext1 and ext3 files'); + t.end(); + }) + }) + + t.test('\n# ** glob pattern', function (t) { + t.plan(1); + readdirp(opts( { fileFilter: '**/*.ext1' } ), function (err, res) { + t.equals(res.files.length, ext1Files, 'ignores ** in **/*.ext1 -> only *.ext1 files'); + t.end(); + }) + }) +}) + +test('\n\nreading root using function filter', function (t) { + t.test('\n# file filter -> "contains root_dir2"', function (t) { + t.plan(1); + readdirp( + opts( { fileFilter: function (fi) { return fi.name.indexOf('root_dir2') >= 0; } }) + , function (err, res) { + t.equals(res.files.length, rootDir2Files, 'all rootDir2Files'); + t.end(); + } + ) + }) + + t.test('\n# directory filter -> "name has length 9"', function (t) { + t.plan(1); + readdirp( + opts( { directoryFilter: function (di) { return di.name.length === 9; } }) + , function (err, res) { + t.equals(res.directories.length, nameHasLength9Dirs, 'all all dirs with name length 9'); + t.end(); + } + ) + }) +}) + +test('\nreading root specifying maximum depth', function (t) { + t.test('\n# depth 1', function (t) { + t.plan(1); + readdirp(opts( { depth: 1 } ), function (err, res) { + t.equals(res.files.length, depth1Files, 'does not return files at depth 2'); + }) + }) +}) + +test('\nreading root with no recursion', function (t) { + t.test('\n# depth 0', function (t) { + t.plan(1); + readdirp(opts( { depth: 0 } ), function (err, res) { + t.equals(res.files.length, depth0Files, 'does not return files at depth 0'); + }) + }) +}) + +test('\nprogress callbacks', function (t) { + t.plan(2); + + var pluckName = function(fi) { return fi.name; } + , processedFiles = []; + + readdirp( + opts() + , function(fi) { + processedFiles.push(fi); + } + , function (err, res) { + t.equals(processedFiles.length, res.files.length, 'calls back for each file processed'); + t.deepEquals(processedFiles.map(pluckName).sort(),res.files.map(pluckName).sort(), 'same file names'); + t.end(); + } + ) +}) + +test('resolving of name, full and relative paths', function (t) { + var expected = { + name : 'root_dir1_file1.ext1' + , parentDirName : 'root_dir1' + , path : 'root_dir1/root_dir1_file1.ext1' + , fullPath : 'test/bed/root_dir1/root_dir1_file1.ext1' + } + , opts = [ + { root: './bed' , prefix: '' } + , { root: './bed/' , prefix: '' } + , { root: 'bed' , prefix: '' } + , { root: 'bed/' , prefix: '' } + , { root: '../test/bed/' , prefix: '' } + , { root: '.' , prefix: 'bed' } + ] + t.plan(opts.length); + + opts.forEach(function (op) { + op.fileFilter = 'root_dir1_file1.ext1'; + + t.test('\n' + util.inspect(op), function (t) { + t.plan(4); + + readdirp (op, function(err, res) { + t.equals(res.files[0].name, expected.name, 'correct name'); + t.equals(res.files[0].path, path.join(op.prefix, expected.path), 'correct path'); + }) + + fs.realpath(op.root, function(err, fullRoot) { + readdirp (op, function(err, res) { + t.equals( + res.files[0].fullParentDir + , path.join(fullRoot, op.prefix, expected.parentDirName) + , 'correct parentDir' + ); + t.equals( + res.files[0].fullPath + , path.join(fullRoot, op.prefix, expected.parentDirName, expected.name) + , 'correct fullPath' + ); + }) + }) + }) + }) +}) + + diff --git a/node_modules/regenerator-runtime/README.md b/node_modules/regenerator-runtime/README.md new file mode 100644 index 0000000..d93386a --- /dev/null +++ b/node_modules/regenerator-runtime/README.md @@ -0,0 +1,31 @@ +# regenerator-runtime + +Standalone runtime for +[Regenerator](https://github.com/facebook/regenerator)-compiled generator +and `async` functions. + +To import the runtime as a module (recommended), either of the following +import styles will work: +```js +// CommonJS +const regeneratorRuntime = require("regenerator-runtime"); + +// ECMAScript 2015 +import regeneratorRuntime from "regenerator-runtime"; +``` + +To ensure that `regeneratorRuntime` is defined globally, either of the +following styles will work: +```js +// CommonJS +require("regenerator-runtime/runtime"); + +// ECMAScript 2015 +import "regenerator-runtime/runtime"; +``` + +To get the absolute file system path of `runtime.js`, evaluate the +following expression: +```js +require("regenerator-runtime/path").path +``` diff --git a/node_modules/regenerator-runtime/package.json b/node_modules/regenerator-runtime/package.json new file mode 100644 index 0000000..516b303 --- /dev/null +++ b/node_modules/regenerator-runtime/package.json @@ -0,0 +1,46 @@ +{ + "_from": "regenerator-runtime@^0.11.0", + "_id": "regenerator-runtime@0.11.1", + "_inBundle": false, + "_integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", + "_location": "/regenerator-runtime", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "regenerator-runtime@^0.11.0", + "name": "regenerator-runtime", + "escapedName": "regenerator-runtime", + "rawSpec": "^0.11.0", + "saveSpec": null, + "fetchSpec": "^0.11.0" + }, + "_requiredBy": [ + "/babel-runtime" + ], + "_resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "_shasum": "be05ad7f9bf7d22e056f9726cee5017fbf19e2e9", + "_spec": "regenerator-runtime@^0.11.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/babel-runtime", + "author": { + "name": "Ben Newman", + "email": "bn@cs.stanford.edu" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Runtime for Regenerator-compiled generator and async functions.", + "keywords": [ + "regenerator", + "runtime", + "generator", + "async" + ], + "license": "MIT", + "main": "runtime-module.js", + "name": "regenerator-runtime", + "repository": { + "type": "git", + "url": "https://github.com/facebook/regenerator/tree/master/packages/regenerator-runtime" + }, + "version": "0.11.1" +} diff --git a/node_modules/regenerator-runtime/path.js b/node_modules/regenerator-runtime/path.js new file mode 100644 index 0000000..ced878b --- /dev/null +++ b/node_modules/regenerator-runtime/path.js @@ -0,0 +1,11 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +exports.path = require("path").join( + __dirname, + "runtime.js" +); diff --git a/node_modules/regenerator-runtime/runtime-module.js b/node_modules/regenerator-runtime/runtime-module.js new file mode 100644 index 0000000..ed28431 --- /dev/null +++ b/node_modules/regenerator-runtime/runtime-module.js @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// This method of obtaining a reference to the global object needs to be +// kept identical to the way it is obtained in runtime.js +var g = (function() { return this })() || Function("return this")(); + +// Use `getOwnPropertyNames` because not all browsers support calling +// `hasOwnProperty` on the global `self` object in a worker. See #183. +var hadRuntime = g.regeneratorRuntime && + Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; + +// Save the old regeneratorRuntime in case it needs to be restored later. +var oldRuntime = hadRuntime && g.regeneratorRuntime; + +// Force reevalutation of runtime.js. +g.regeneratorRuntime = undefined; + +module.exports = require("./runtime"); + +if (hadRuntime) { + // Restore the original runtime. + g.regeneratorRuntime = oldRuntime; +} else { + // Remove the global property added by runtime.js. + try { + delete g.regeneratorRuntime; + } catch(e) { + g.regeneratorRuntime = undefined; + } +} diff --git a/node_modules/regenerator-runtime/runtime.js b/node_modules/regenerator-runtime/runtime.js new file mode 100644 index 0000000..22e7b00 --- /dev/null +++ b/node_modules/regenerator-runtime/runtime.js @@ -0,0 +1,727 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +!(function(global) { + "use strict"; + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + + var inModule = typeof module === "object"; + var runtime = global.regeneratorRuntime; + if (runtime) { + if (inModule) { + // If regeneratorRuntime is defined globally and we're in a module, + // make the exports object identical to regeneratorRuntime. + module.exports = runtime; + } + // Don't bother evaluating the rest of this file if the runtime was + // already defined globally. + return; + } + + // Define the runtime globally (as expected by generated code) as either + // module.exports (if we're in a module) or a new, empty object. + runtime = global.regeneratorRuntime = inModule ? module.exports : {}; + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); + + return generator; + } + runtime.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + IteratorPrototype[iteratorSymbol] = function () { + return this; + }; + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = GeneratorFunctionPrototype.prototype = + Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[toStringTagSymbol] = + GeneratorFunction.displayName = "GeneratorFunction"; + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + prototype[method] = function(arg) { + return this._invoke(method, arg); + }; + }); + } + + runtime.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" + : false; + }; + + runtime.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = "GeneratorFunction"; + } + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + runtime.awrap = function(arg) { + return { __await: arg }; + }; + + function AsyncIterator(generator) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && + typeof value === "object" && + hasOwn.call(value, "__await")) { + return Promise.resolve(value.__await).then(function(value) { + invoke("next", value, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); + }); + } + + return Promise.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. If the Promise is rejected, however, the + // result for this iteration will be rejected with the same + // reason. Note that rejections of yielded Promises are not + // thrown back into the generator function, as is the case + // when an awaited Promise is rejected. This difference in + // behavior between yield and await is important, because it + // allows the consumer to decide what to do with the yielded + // rejection (swallow it and continue, manually .throw it back + // into the generator, abandon iteration, whatever). With + // await, by contrast, there is no opportunity to examine the + // rejection reason outside the generator function, so the + // only option is to throw it from the await expression, and + // let the generator function handle the exception. + result.value = unwrapped; + resolve(result); + }, reject); + } + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) : callInvokeWithMethodAndArg(); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + AsyncIterator.prototype[asyncIteratorSymbol] = function () { + return this; + }; + runtime.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + runtime.async = function(innerFn, outerFn, self, tryLocsList) { + var iter = new AsyncIterator( + wrap(innerFn, outerFn, self, tryLocsList) + ); + + return runtime.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } + + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } + + context.method = method; + context.arg = arg; + + while (true) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; + + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } + + context.dispatchException(context.arg); + + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; + + if (record.arg === ContinueSentinel) { + continue; + } + + return { + value: record.arg, + done: context.done + }; + + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } + + // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method always terminates the yield* loop. + context.delegate = null; + + if (context.method === "throw") { + if (delegate.iterator.return) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); + + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } + + context.method = "throw"; + context.arg = new TypeError( + "The iterator does not provide a 'throw' method"); + } + + return ContinueSentinel; + } + + var record = tryCatch(method, delegate.iterator, context.arg); + + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + + var info = record.arg; + + if (! info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; + + // Resume execution at the desired location (see delegateYield). + context.next = delegate.nextLoc; + + // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + + } else { + // Re-yield the result returned by the delegate method. + return info; + } + + // The delegate iterator is finished, so forget it and continue with + // the outer generator. + context.delegate = null; + return ContinueSentinel; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + Gp[toStringTagSymbol] = "Generator"; + + // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + Gp[iteratorSymbol] = function() { + return this; + }; + + Gp.toString = function() { + return "[object Generator]"; + }; + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + runtime.keys = function(object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return next.next = next; + } + } + + // Return an iterator with no values. + return { next: doneResult }; + } + runtime.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.method = "next"; + this.arg = undefined; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && + hasOwn.call(this, name) && + !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + + stop: function() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; + } + + return !! caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && + hasOwn.call(entry, "finallyLoc") && + this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && + (type === "break" || + type === "continue") && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + + return this.complete(record); + }, + + complete: function(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || + record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + + return ContinueSentinel; + }, + + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + + "catch": function(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; +})( + // In sloppy mode, unbound `this` refers to the global object, fallback to + // Function constructor if we're in global strict mode. That is sadly a form + // of indirect eval which violates Content Security Policy. + (function() { return this })() || Function("return this")() +); diff --git a/node_modules/regex-not/LICENSE b/node_modules/regex-not/LICENSE new file mode 100644 index 0000000..8ee09d9 --- /dev/null +++ b/node_modules/regex-not/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016, 2018, 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/node_modules/regex-not/README.md b/node_modules/regex-not/README.md new file mode 100644 index 0000000..24d00e7 --- /dev/null +++ b/node_modules/regex-not/README.md @@ -0,0 +1,133 @@ +# regex-not [![NPM version](https://img.shields.io/npm/v/regex-not.svg?style=flat)](https://www.npmjs.com/package/regex-not) [![NPM monthly downloads](https://img.shields.io/npm/dm/regex-not.svg?style=flat)](https://npmjs.org/package/regex-not) [![NPM total downloads](https://img.shields.io/npm/dt/regex-not.svg?style=flat)](https://npmjs.org/package/regex-not) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/regex-not.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/regex-not) + +> Create a javascript regular expression for matching everything except for the given string. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save regex-not +``` + +## Usage + +```js +var not = require('regex-not'); +``` + +The main export is a function that takes a string an options object. + +```js +not(string[, options]); +``` + +**Example** + +```js +var not = require('regex-not'); +console.log(not('foo')); +//=> /^(?:(?!^(?:foo)$).)+$/ +``` + +**Strict matching** + +By default, the returned regex is for strictly (not) matching the exact given pattern (in other words, "match this string if it does NOT _exactly equal_ `foo`"): + +```js +var re = not('foo'); +console.log(re.test('foo')); //=> false +console.log(re.test('bar')); //=> true +console.log(re.test('foobar')); //=> true +console.log(re.test('barfoo')); //=> true +``` + +### .create + +Returns a string to allow you to create your own regex: + +```js +console.log(not.create('foo')); +//=> '(?:(?!^(?:foo)$).)+' +``` + +### Options + +**options.contains** + +You can relax strict matching by setting `options.contains` to true (in other words, "match this string if it does NOT _contain_ `foo`"): + +```js +var re = not('foo'); +console.log(re.test('foo', {contains: true})); //=> false +console.log(re.test('bar', {contains: true})); //=> true +console.log(re.test('foobar', {contains: true})); //=> false +console.log(re.test('barfoo', {contains: true})); //=> false +``` + +## About + +
    +Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
    + +
    +Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
    + +
    +Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
    + +### Related projects + +You might also be interested in these projects: + +* [regex-cache](https://www.npmjs.com/package/regex-cache): Memoize the results of a call to the RegExp constructor, avoiding repetitious runtime compilation of… [more](https://github.com/jonschlinkert/regex-cache) | [homepage](https://github.com/jonschlinkert/regex-cache "Memoize the results of a call to the RegExp constructor, avoiding repetitious runtime compilation of the same string and options, resulting in surprising performance improvements.") +* [to-regex](https://www.npmjs.com/package/to-regex): Generate a regex from a string or array of strings. | [homepage](https://github.com/jonschlinkert/to-regex "Generate a regex from a string or array of strings.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 9 | [jonschlinkert](https://github.com/jonschlinkert) | +| 1 | [doowb](https://github.com/doowb) | +| 1 | [EdwardBetts](https://github.com/EdwardBetts) | + +### Author + +**Jon Schlinkert** + +* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert) +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on February 19, 2018._ \ No newline at end of file diff --git a/node_modules/regex-not/index.js b/node_modules/regex-not/index.js new file mode 100644 index 0000000..02bfed4 --- /dev/null +++ b/node_modules/regex-not/index.js @@ -0,0 +1,72 @@ +'use strict'; + +var extend = require('extend-shallow'); +var safe = require('safe-regex'); + +/** + * The main export is a function that takes a `pattern` string and an `options` object. + * + * ```js + & var not = require('regex-not'); + & console.log(not('foo')); + & //=> /^(?:(?!^(?:foo)$).)*$/ + * ``` + * + * @param {String} `pattern` + * @param {Object} `options` + * @return {RegExp} Converts the given `pattern` to a regex using the specified `options`. + * @api public + */ + +function toRegex(pattern, options) { + return new RegExp(toRegex.create(pattern, options)); +} + +/** + * Create a regex-compatible string from the given `pattern` and `options`. + * + * ```js + & var not = require('regex-not'); + & console.log(not.create('foo')); + & //=> '^(?:(?!^(?:foo)$).)*$' + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {String} + * @api public + */ + +toRegex.create = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + + var opts = extend({}, options); + if (opts.contains === true) { + opts.strictNegate = false; + } + + var open = opts.strictOpen !== false ? '^' : ''; + var close = opts.strictClose !== false ? '$' : ''; + var endChar = opts.endChar ? opts.endChar : '+'; + var str = pattern; + + if (opts.strictNegate === false) { + str = '(?:(?!(?:' + pattern + ')).)' + endChar; + } else { + str = '(?:(?!^(?:' + pattern + ')$).)' + endChar; + } + + var res = open + str + close; + if (opts.safe === true && safe(res) === false) { + throw new Error('potentially unsafe regular expression: ' + res); + } + + return res; +}; + +/** + * Expose `toRegex` + */ + +module.exports = toRegex; diff --git a/node_modules/regex-not/package.json b/node_modules/regex-not/package.json new file mode 100644 index 0000000..6024099 --- /dev/null +++ b/node_modules/regex-not/package.json @@ -0,0 +1,98 @@ +{ + "_from": "regex-not@^1.0.0", + "_id": "regex-not@1.0.2", + "_inBundle": false, + "_integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "_location": "/regex-not", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "regex-not@^1.0.0", + "name": "regex-not", + "escapedName": "regex-not", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/expand-brackets", + "/extglob", + "/micromatch", + "/nanomatch", + "/to-regex" + ], + "_resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "_shasum": "1f4ece27e00b0b65e0247a6810e6a85d83a5752c", + "_spec": "regex-not@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/micromatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/regex-not/issues" + }, + "bundleDependencies": false, + "dependencies": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + }, + "deprecated": false, + "description": "Create a javascript regular expression for matching everything except for the given string.", + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.5.3" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/regex-not", + "keywords": [ + "exec", + "match", + "negate", + "negation", + "not", + "regex", + "regular expression", + "test" + ], + "license": "MIT", + "main": "index.js", + "name": "regex-not", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/regex-not.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "regex-cache", + "to-regex" + ] + }, + "reflinks": [ + "verb", + "verb-generate-readme" + ], + "lint": { + "reflinks": true + } + }, + "version": "1.0.2" +} diff --git a/node_modules/regexp-clone/.npmignore b/node_modules/regexp-clone/.npmignore new file mode 100644 index 0000000..be106ca --- /dev/null +++ b/node_modules/regexp-clone/.npmignore @@ -0,0 +1,2 @@ +*.sw* +node_modules/ diff --git a/node_modules/regexp-clone/.travis.yml b/node_modules/regexp-clone/.travis.yml new file mode 100644 index 0000000..58f2371 --- /dev/null +++ b/node_modules/regexp-clone/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - 0.6 + - 0.8 + - 0.10 diff --git a/node_modules/regexp-clone/History.md b/node_modules/regexp-clone/History.md new file mode 100644 index 0000000..0beedfc --- /dev/null +++ b/node_modules/regexp-clone/History.md @@ -0,0 +1,5 @@ + +0.0.1 / 2013-04-17 +================== + + * initial commit diff --git a/node_modules/regexp-clone/LICENSE b/node_modules/regexp-clone/LICENSE new file mode 100644 index 0000000..98c7c89 --- /dev/null +++ b/node_modules/regexp-clone/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2013 [Aaron Heckmann](aaron.heckmann+github@gmail.com) + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/regexp-clone/Makefile b/node_modules/regexp-clone/Makefile new file mode 100644 index 0000000..6c8fb75 --- /dev/null +++ b/node_modules/regexp-clone/Makefile @@ -0,0 +1,5 @@ + +test: + @./node_modules/.bin/mocha $(T) --async-only $(TESTS) + +.PHONY: test diff --git a/node_modules/regexp-clone/README.md b/node_modules/regexp-clone/README.md new file mode 100644 index 0000000..2aabe5c --- /dev/null +++ b/node_modules/regexp-clone/README.md @@ -0,0 +1,18 @@ +#regexp-clone +============== + +Clones RegExps with flag preservation + +```js +var regexpClone = require('regexp-clone'); + +var a = /somethin/g; +console.log(a.global); // true + +var b = regexpClone(a); +console.log(b.global); // true +``` + +## License + +[MIT](https://github.com/aheckmann/regexp-clone/blob/master/LICENSE) diff --git a/node_modules/regexp-clone/index.js b/node_modules/regexp-clone/index.js new file mode 100644 index 0000000..e5850ca --- /dev/null +++ b/node_modules/regexp-clone/index.js @@ -0,0 +1,20 @@ + +var toString = Object.prototype.toString; + +function isRegExp (o) { + return 'object' == typeof o + && '[object RegExp]' == toString.call(o); +} + +module.exports = exports = function (regexp) { + if (!isRegExp(regexp)) { + throw new TypeError('Not a RegExp'); + } + + var flags = []; + if (regexp.global) flags.push('g'); + if (regexp.multiline) flags.push('m'); + if (regexp.ignoreCase) flags.push('i'); + return new RegExp(regexp.source, flags.join('')); +} + diff --git a/node_modules/regexp-clone/package.json b/node_modules/regexp-clone/package.json new file mode 100644 index 0000000..a000b21 --- /dev/null +++ b/node_modules/regexp-clone/package.json @@ -0,0 +1,55 @@ +{ + "_from": "regexp-clone@0.0.1", + "_id": "regexp-clone@0.0.1", + "_inBundle": false, + "_integrity": "sha1-p8LgmJH9vzj7sQ03b7cwA+aKxYk=", + "_location": "/regexp-clone", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "regexp-clone@0.0.1", + "name": "regexp-clone", + "escapedName": "regexp-clone", + "rawSpec": "0.0.1", + "saveSpec": null, + "fetchSpec": "0.0.1" + }, + "_requiredBy": [ + "/mongoose", + "/mquery" + ], + "_resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-0.0.1.tgz", + "_shasum": "a7c2e09891fdbf38fbb10d376fb73003e68ac589", + "_spec": "regexp-clone@0.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/mongoose", + "author": { + "name": "Aaron Heckmann", + "email": "aaron.heckmann+github@gmail.com" + }, + "bugs": { + "url": "https://github.com/aheckmann/regexp-clone/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Clone RegExps with options", + "devDependencies": { + "mocha": "1.8.1" + }, + "homepage": "https://github.com/aheckmann/regexp-clone#readme", + "keywords": [ + "RegExp", + "clone" + ], + "license": "MIT", + "main": "index.js", + "name": "regexp-clone", + "repository": { + "type": "git", + "url": "git://github.com/aheckmann/regexp-clone.git" + }, + "scripts": { + "test": "make test" + }, + "version": "0.0.1" +} diff --git a/node_modules/regexp-clone/test/index.js b/node_modules/regexp-clone/test/index.js new file mode 100644 index 0000000..264a776 --- /dev/null +++ b/node_modules/regexp-clone/test/index.js @@ -0,0 +1,112 @@ + +var assert = require('assert') +var clone = require('../'); + +describe('regexp-clone', function(){ + function hasEqualSource (a, b) { + assert.ok(a !== b); + assert.equal(a.source, b.source); + } + + function isInsensitive (a) { + assert.ok(a.ignoreCase); + } + + function isGlobal (a) { + assert.ok(a.global); + } + + function isMultiline (a) { + assert.ok(a.multiline); + } + + function insensitiveFlag (a) { + var b = clone(a); + hasEqualSource(a, b); + isInsensitive(a); + isInsensitive(b); + } + + function globalFlag (a) { + var b = clone(a); + hasEqualSource(a, b); + isGlobal(a); + isGlobal(b); + } + + function multilineFlag (a) { + var b = clone(a); + hasEqualSource(a, b); + isMultiline(a); + isMultiline(b); + } + + describe('literals', function(){ + it('insensitive flag', function(done){ + var a = /hello/i; + insensitiveFlag(a); + done(); + }) + it('global flag', function(done){ + var a = /hello/g; + globalFlag(a); + done(); + }) + it('multiline flag', function(done){ + var a = /hello/m; + multilineFlag(a); + done(); + }) + it('no flags', function(done){ + var a = /hello/; + var b = clone(a); + hasEqualSource(a, b); + assert.ok(!a.insensitive); + assert.ok(!a.global); + assert.ok(!a.global); + done(); + }) + it('all flags', function(done){ + var a = /hello/gim; + insensitiveFlag(a); + globalFlag(a); + multilineFlag(a); + done(); + }) + }) + + describe('instances', function(){ + it('insensitive flag', function(done){ + var a = new RegExp('hello', 'i'); + insensitiveFlag(a); + done(); + }) + it('global flag', function(done){ + var a = new RegExp('hello', 'g'); + globalFlag(a); + done(); + }) + it('multiline flag', function(done){ + var a = new RegExp('hello', 'm'); + multilineFlag(a); + done(); + }) + it('no flags', function(done){ + var a = new RegExp('hmm'); + var b = clone(a); + hasEqualSource(a, b); + assert.ok(!a.insensitive); + assert.ok(!a.global); + assert.ok(!a.global); + done(); + }) + it('all flags', function(done){ + var a = new RegExp('hello', 'gim'); + insensitiveFlag(a); + globalFlag(a); + multilineFlag(a); + done(); + }) + }) +}) + diff --git a/node_modules/registry-auth-token/CHANGELOG.md b/node_modules/registry-auth-token/CHANGELOG.md new file mode 100644 index 0000000..75f7b6f --- /dev/null +++ b/node_modules/registry-auth-token/CHANGELOG.md @@ -0,0 +1,106 @@ +# Change Log + +All notable changes will be documented in this file. + +## [3.3.2] - 2018-01-26 + +### Changes + +- Support password with ENV variable tokens (Nowell Strite) + +## [3.3.1] - 2017-05-02 + +### Fixes + +- Auth legacy token is basic auth (Hutson Betts) + +## [3.3.0] - 2017-04-24 + +### Changes + +- Support legacy auth token config key (Zoltan Kochan) +- Use safe-buffer module for backwards-compatible base64 encoding/decoding (Espen Hovlandsdal) +- Change to standard.js coding style (Espen Hovlandsdal) + +## [3.2.0] - 2017-04-20 + +### Changes + +- Allow passing parsed npmrc from outside (Zoltan Kochan) + +## [3.1.2] - 2017-04-07 + +### Changes + +- Avoid infinite loop on invalid URL (Zoltan Kochan) + +## [3.1.1] - 2017-04-06 + +### Changes + +- Nerf-dart URLs even if recursive is set to false (Espen Hovlandsdal) + +## [3.1.0] - 2016-10-19 + +### Changes + +- Return the password and username for Basic authorization (Zoltan Kochan) + +## [3.0.1] - 2016-08-07 + +### Changes + +- Fix recursion bug (Lukas Eipert) +- Implement alternative base64 encoding/decoding implementation for Node 6 (Lukas Eipert) + +## [3.0.0] - 2016-08-04 + +### Added + +- Support for Basic Authentication (username/password) (Lukas Eipert) + +### Changes + +- The result format of the output changed from a simple string to an object which contains the token type + +```js + // before: returns 'tokenString' + // after: returns {token: 'tokenString', type: 'Bearer'} + getAuthToken() +``` + +## [2.1.1] - 2016-07-10 + +### Changes + +- Fix infinite loop when recursively resolving registry URLs on Windows (Espen Hovlandsdal) + +## [2.1.0] - 2016-07-07 + +### Added + +- Add feature to find configured registry URL for a scope (Espen Hovlandsdal) + +## [2.0.0] - 2016-06-17 + +### Changes + +- Fix tokens defined by reference to environment variables (Dan MacTough) + +## [1.1.1] - 2016-04-26 + +### Changes + +- Fix for registries with port number in URL (Ryan Day) + +[1.1.1]: https://github.com/rexxars/registry-auth-token/compare/a5b4fe2f5ff982110eb8a813ba1b3b3c5d851af1...v1.1.1 +[2.0.0]: https://github.com/rexxars/registry-auth-token/compare/v1.1.1...v2.0.0 +[2.1.0]: https://github.com/rexxars/registry-auth-token/compare/v2.0.0...v2.1.0 +[2.1.1]: https://github.com/rexxars/registry-auth-token/compare/v2.1.0...v2.1.1 +[3.0.0]: https://github.com/rexxars/registry-auth-token/compare/v2.1.1...v3.0.0 +[3.0.1]: https://github.com/rexxars/registry-auth-token/compare/v3.0.0...v3.0.1 +[3.1.0]: https://github.com/rexxars/registry-auth-token/compare/v3.0.1...v3.1.0 +[3.1.1]: https://github.com/rexxars/registry-auth-token/compare/v3.1.0...v3.1.1 +[3.1.2]: https://github.com/rexxars/registry-auth-token/compare/v3.1.1...v3.1.2 +[3.2.0]: https://github.com/rexxars/registry-auth-token/compare/v3.1.2...v3.2.0 +[3.3.0]: https://github.com/rexxars/registry-auth-token/compare/v3.2.0...v3.3.0 diff --git a/node_modules/registry-auth-token/LICENSE b/node_modules/registry-auth-token/LICENSE new file mode 100644 index 0000000..0de12e3 --- /dev/null +++ b/node_modules/registry-auth-token/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Espen Hovlandsdal + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/registry-auth-token/README.md b/node_modules/registry-auth-token/README.md new file mode 100644 index 0000000..5ac9c1a --- /dev/null +++ b/node_modules/registry-auth-token/README.md @@ -0,0 +1,65 @@ +# registry-auth-token + +[![npm version](http://img.shields.io/npm/v/registry-auth-token.svg?style=flat-square)](http://browsenpm.org/package/registry-auth-token)[![Build Status](http://img.shields.io/travis/rexxars/registry-auth-token/master.svg?style=flat-square)](https://travis-ci.org/rexxars/registry-auth-token) + +Get the auth token set for an npm registry from `.npmrc`. Also allows fetching the configured registry URL for a given npm scope. + +## Installing + +``` +npm install --save registry-auth-token +``` + +## Usage + +Returns an object containing `token` and `type`, or `undefined` if no token can be found. `type` can be either `Bearer` or `Basic`. + +```js +var getAuthToken = require('registry-auth-token') +var getRegistryUrl = require('registry-auth-token/registry-url') + +// Get auth token and type for default `registry` set in `.npmrc` +console.log(getAuthToken()) // {token: 'someToken', type: 'Bearer'} + +// Get auth token for a specific registry URL +console.log(getAuthToken('//registry.foo.bar')) + +// Find the registry auth token for a given URL (with deep path): +// If registry is at `//some.host/registry` +// URL passed is `//some.host/registry/deep/path` +// Will find token the closest matching path; `//some.host/registry` +console.log(getAuthToken('//some.host/registry/deep/path', {recursive: true})) + +// Find the configured registry url for scope `@foobar`. +// Falls back to the global registry if not defined. +console.log(getRegistryUrl('@foobar')) + +// Use the npm config that is passed in +console.log(getRegistryUrl('http://registry.foobar.eu/', { + npmrc: { + 'registry': 'http://registry.foobar.eu/', + '//registry.foobar.eu/:_authToken': 'qar' + } +})) +``` + +## Return value + +```js +// If auth info can be found: +{token: 'someToken', type: 'Bearer'} + +// Or: +{token: 'someOtherToken', type: 'Basic'} + +// Or, if nothing is found: +undefined +``` + +## Security + +Please be careful when using this. Leaking your auth token is dangerous. + +## License + +MIT-licensed. See LICENSE. diff --git a/node_modules/registry-auth-token/base64.js b/node_modules/registry-auth-token/base64.js new file mode 100644 index 0000000..d208ae1 --- /dev/null +++ b/node_modules/registry-auth-token/base64.js @@ -0,0 +1,14 @@ +const safeBuffer = require('safe-buffer').Buffer + +function decodeBase64 (base64) { + return safeBuffer.from(base64, 'base64').toString('utf8') +} + +function encodeBase64 (string) { + return safeBuffer.from(string, 'utf8').toString('base64') +} + +module.exports = { + decodeBase64: decodeBase64, + encodeBase64: encodeBase64 +} diff --git a/node_modules/registry-auth-token/index.js b/node_modules/registry-auth-token/index.js new file mode 100644 index 0000000..d68f7ee --- /dev/null +++ b/node_modules/registry-auth-token/index.js @@ -0,0 +1,118 @@ +var url = require('url') +var base64 = require('./base64') + +var decodeBase64 = base64.decodeBase64 +var encodeBase64 = base64.encodeBase64 + +var tokenKey = ':_authToken' +var userKey = ':username' +var passwordKey = ':_password' + +module.exports = function () { + var checkUrl + var options + if (arguments.length >= 2) { + checkUrl = arguments[0] + options = arguments[1] + } else if (typeof arguments[0] === 'string') { + checkUrl = arguments[0] + } else { + options = arguments[0] + } + options = options || {} + options.npmrc = options.npmrc || require('rc')('npm', {registry: 'https://registry.npmjs.org/'}) + checkUrl = checkUrl || options.npmrc.registry + return getRegistryAuthInfo(checkUrl, options) || getLegacyAuthInfo(options.npmrc) +} + +function getRegistryAuthInfo (checkUrl, options) { + var parsed = url.parse(checkUrl, false, true) + var pathname + + while (pathname !== '/' && parsed.pathname !== pathname) { + pathname = parsed.pathname || '/' + + var regUrl = '//' + parsed.host + pathname.replace(/\/$/, '') + var authInfo = getAuthInfoForUrl(regUrl, options.npmrc) + if (authInfo) { + return authInfo + } + + // break if not recursive + if (!options.recursive) { + return /\/$/.test(checkUrl) + ? undefined + : getRegistryAuthInfo(url.resolve(checkUrl, '.'), options) + } + + parsed.pathname = url.resolve(normalizePath(pathname), '..') || '/' + } + + return undefined +} + +function getLegacyAuthInfo (npmrc) { + if (npmrc._auth) { + return {token: npmrc._auth, type: 'Basic'} + } + return undefined +} + +function normalizePath (path) { + return path[path.length - 1] === '/' ? path : path + '/' +} + +function getAuthInfoForUrl (regUrl, npmrc) { + // try to get bearer token + var bearerAuth = getBearerToken(npmrc[regUrl + tokenKey] || npmrc[regUrl + '/' + tokenKey]) + if (bearerAuth) { + return bearerAuth + } + + // try to get basic token + var username = npmrc[regUrl + userKey] || npmrc[regUrl + '/' + userKey] + var password = npmrc[regUrl + passwordKey] || npmrc[regUrl + '/' + passwordKey] + var basicAuth = getTokenForUsernameAndPassword(username, password) + if (basicAuth) { + return basicAuth + } + + return undefined +} + +function getBearerToken (tok) { + if (!tok) { + return undefined + } + + // check if bearer token + var token = tok.replace(/^\$\{?([^}]*)\}?$/, function (fullMatch, envVar) { + return process.env[envVar] + }) + + return {token: token, type: 'Bearer'} +} + +function getTokenForUsernameAndPassword (username, password) { + if (!username || !password) { + return undefined + } + + // passwords are base64 encoded, so we need to decode it + // See https://github.com/npm/npm/blob/v3.10.6/lib/config/set-credentials-by-uri.js#L26 + var pass = decodeBase64(password.replace(/^\$\{?([^}]*)\}?$/, function (fullMatch, envVar) { + return process.env[envVar] + })) + + // a basic auth token is base64 encoded 'username:password' + // See https://github.com/npm/npm/blob/v3.10.6/lib/config/get-credentials-by-uri.js#L70 + var token = encodeBase64(username + ':' + pass) + + // we found a basicToken token so let's exit the loop + return { + token: token, + type: 'Basic', + password: pass, + username: username + } +} diff --git a/node_modules/registry-auth-token/package.json b/node_modules/registry-auth-token/package.json new file mode 100644 index 0000000..b0ecb1c --- /dev/null +++ b/node_modules/registry-auth-token/package.json @@ -0,0 +1,74 @@ +{ + "_from": "registry-auth-token@^3.0.1", + "_id": "registry-auth-token@3.3.2", + "_inBundle": false, + "_integrity": "sha512-JL39c60XlzCVgNrO+qq68FoNb56w/m7JYvGR2jT5iR1xBrUA3Mfx5Twk5rqTThPmQKMWydGmq8oFtDlxfrmxnQ==", + "_location": "/registry-auth-token", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "registry-auth-token@^3.0.1", + "name": "registry-auth-token", + "escapedName": "registry-auth-token", + "rawSpec": "^3.0.1", + "saveSpec": null, + "fetchSpec": "^3.0.1" + }, + "_requiredBy": [ + "/package-json" + ], + "_resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.2.tgz", + "_shasum": "851fd49038eecb586911115af845260eec983f20", + "_spec": "registry-auth-token@^3.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/package-json", + "author": { + "name": "Espen Hovlandsdal", + "email": "espen@hovlandsdal.com" + }, + "bugs": { + "url": "https://github.com/rexxars/registry-auth-token/issues" + }, + "bundleDependencies": false, + "dependencies": { + "rc": "^1.1.6", + "safe-buffer": "^5.0.1" + }, + "deprecated": false, + "description": "Get the auth token set for an npm registry (if any)", + "devDependencies": { + "istanbul": "^0.4.2", + "mocha": "^3.3.0", + "require-uncached": "^1.0.2", + "standard": "^10.0.2" + }, + "homepage": "https://github.com/rexxars/registry-auth-token#readme", + "keywords": [ + "npm", + "conf", + "config", + "npmconf", + "registry", + "auth", + "token", + "authtoken" + ], + "license": "MIT", + "main": "index.js", + "name": "registry-auth-token", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/rexxars/registry-auth-token.git" + }, + "scripts": { + "coverage": "istanbul cover _mocha", + "posttest": "standard", + "test": "mocha" + }, + "standard": { + "ignore": [ + "coverage/**" + ] + }, + "version": "3.3.2" +} diff --git a/node_modules/registry-auth-token/registry-url.js b/node_modules/registry-auth-token/registry-url.js new file mode 100644 index 0000000..9da9a44 --- /dev/null +++ b/node_modules/registry-auth-token/registry-url.js @@ -0,0 +1,5 @@ +module.exports = function (scope, npmrc) { + var rc = npmrc || require('rc')('npm', {registry: 'https://registry.npmjs.org/'}) + var url = rc[scope + ':registry'] || rc.registry + return url.slice(-1) === '/' ? url : url + '/' +} diff --git a/node_modules/registry-auth-token/test/auth-token.test.js b/node_modules/registry-auth-token/test/auth-token.test.js new file mode 100644 index 0000000..824d1bf --- /dev/null +++ b/node_modules/registry-auth-token/test/auth-token.test.js @@ -0,0 +1,419 @@ +var fs = require('fs') +var path = require('path') +var mocha = require('mocha') +var assert = require('assert') +var requireUncached = require('require-uncached') + +var npmRcPath = path.join(__dirname, '..', '.npmrc') +var afterEach = mocha.afterEach +var describe = mocha.describe +var it = mocha.it + +var base64 = require('../base64') +var decodeBase64 = base64.decodeBase64 +var encodeBase64 = base64.encodeBase64 + +/* eslint max-nested-callbacks: ["error", 4] */ + +describe('auth-token', function () { + afterEach(function (done) { + fs.unlink(npmRcPath, function () { + done() + }) + }) + + it('should read global if no local is found', function () { + var getAuthToken = requireUncached('../index') + getAuthToken() + }) + + it('should return undefined if no auth token is given for registry', function (done) { + fs.writeFile(npmRcPath, 'registry=http://registry.npmjs.eu/', function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + assert(!getAuthToken()) + done() + }) + }) + + describe('legacy auth token', function () { + it('should return auth token if it is defined in the legacy way via the `_auth` key', function (done) { + var content = [ + '_auth=foobar', + 'registry=http://registry.foobar.eu/' + ].join('\n') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + assert.deepEqual(getAuthToken(), {token: 'foobar', type: 'Basic'}) + done() + }) + }) + }) + + describe('bearer token', function () { + it('should return auth token if registry is defined', function (done) { + var content = [ + 'registry=http://registry.foobar.eu/', + '//registry.foobar.eu/:_authToken=foobar', '' + ].join('\n') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + assert.deepEqual(getAuthToken(), {token: 'foobar', type: 'Bearer'}) + done() + }) + }) + + it('should use npmrc passed in', function (done) { + var content = [ + 'registry=http://registry.foobar.eu/', + '//registry.foobar.eu/:_authToken=foobar', '' + ].join('\n') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + const npmrc = { + 'registry': 'http://registry.foobar.eu/', + '//registry.foobar.eu/:_authToken': 'qar' + } + assert.deepEqual(getAuthToken({npmrc: npmrc}), {token: 'qar', type: 'Bearer'}) + done() + }) + }) + + it('should return auth token if registry url has port specified', function (done) { + var content = [ + 'registry=http://localhost:8770/', + // before the patch this token was selected. + '//localhost/:_authToken=ohno', + '//localhost:8770/:_authToken=beepboop', '' + ].join('\n') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + assert.deepEqual(getAuthToken(), {token: 'beepboop', type: 'Bearer'}) + done() + }) + }) + + it('should return auth token defined by reference to an environment variable (with curly braces)', function (done) { + var environmentVariable = '__REGISTRY_AUTH_TOKEN_NPM_TOKEN__' + var content = [ + 'registry=http://registry.foobar.cc/', + '//registry.foobar.cc/:_authToken=${' + environmentVariable + '}', '' + ].join('\n') + process.env[environmentVariable] = 'foobar' + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + assert.deepEqual(getAuthToken(), {token: 'foobar', type: 'Bearer'}) + delete process.env[environmentVariable] + done() + }) + }) + + it('should return auth token defined by reference to an environment variable (without curly braces)', function (done) { + var environmentVariable = '__REGISTRY_AUTH_TOKEN_NPM_TOKEN__' + var content = [ + 'registry=http://registry.foobar.cc/', + '//registry.foobar.cc/:_authToken=$' + environmentVariable, '' + ].join('\n') + process.env[environmentVariable] = 'foobar' + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + assert.deepEqual(getAuthToken(), {token: 'foobar', type: 'Bearer'}) + delete process.env[environmentVariable] + done() + }) + }) + + it('should try with and without a slash at the end of registry url', function (done) { + var content = [ + 'registry=http://registry.foobar.eu', + '//registry.foobar.eu:_authToken=barbaz', '' + ].join('\n') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + assert.deepEqual(getAuthToken(), {token: 'barbaz', type: 'Bearer'}) + done() + }) + }) + + it('should fetch for the registry given (if defined)', function (done) { + var content = [ + '//registry.foobar.eu:_authToken=barbaz', + '//registry.blah.foo:_authToken=whatev', + '//registry.last.thing:_authToken=yep', '' + ].join('\n') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + assert.deepEqual(getAuthToken('//registry.blah.foo'), {token: 'whatev', type: 'Bearer'}) + done() + }) + }) + + it('recursively finds registries for deep url if option is set', function (done, undef) { + var opts = {recursive: true} + var content = [ + '//registry.blah.com/foo:_authToken=whatev', + '//registry.blah.org/foo/bar:_authToken=recurseExactlyOneLevel', + '//registry.blah.edu/foo/bar/baz:_authToken=recurseNoLevel', + '//registry.blah.eu:_authToken=yep', '' + ].join('\n') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + assert.deepEqual(getAuthToken('https://registry.blah.edu/foo/bar/baz', opts), {token: 'recurseNoLevel', type: 'Bearer'}) + assert.deepEqual(getAuthToken('https://registry.blah.org/foo/bar/baz', opts), {token: 'recurseExactlyOneLevel', type: 'Bearer'}) + assert.deepEqual(getAuthToken('https://registry.blah.com/foo/bar/baz', opts), {token: 'whatev', type: 'Bearer'}) + assert.deepEqual(getAuthToken('http://registry.blah.eu/what/ever', opts), {token: 'yep', type: 'Bearer'}) + assert.deepEqual(getAuthToken('http://registry.blah.eu//what/ever', opts), undefined, 'does not hang') + assert.equal(getAuthToken('//some.registry', opts), undef) + done() + }) + }) + + it('should try both with and without trailing slash', function (done) { + fs.writeFile(npmRcPath, '//registry.blah.com:_authToken=whatev', function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + assert.deepEqual(getAuthToken('https://registry.blah.com'), {token: 'whatev', type: 'Bearer'}) + done() + }) + }) + + it('should prefer bearer token over basic token', function (done) { + var content = [ + 'registry=http://registry.foobar.eu/', + 'registry=http://registry.foobar.eu/', + '//registry.foobar.eu/:_authToken=bearerToken', + '//registry.foobar.eu/:_password=' + encodeBase64('foobar'), + '//registry.foobar.eu/:username=foobar', '' + ].join('\n') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + assert.deepEqual(getAuthToken('//registry.foobar.eu'), {token: 'bearerToken', type: 'Bearer'}) + done() + }) + }) + + it('"nerf darts" registry urls', function (done, undef) { + fs.writeFile(npmRcPath, '//contoso.pkgs.visualstudio.com/_packaging/MyFeed/npm/:_authToken=heider', function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + assert.deepEqual( + getAuthToken('https://contoso.pkgs.visualstudio.com/_packaging/MyFeed/npm/registry'), + {token: 'heider', type: 'Bearer'} + ) + done() + }) + }) + }) + + describe('basic token', function () { + it('should return undefined if password or username are missing', function (done, undef) { + var content = [ + 'registry=http://registry.foobar.eu/', + '//registry.foobar.eu/:_password=' + encodeBase64('foobar'), + '//registry.foobar.com/:username=foobar', '' + ].join('\n') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + assert.equal(getAuthToken('//registry.foobar.eu'), undef) + assert.equal(getAuthToken('//registry.foobar.com'), undef) + done() + }) + }) + + it('should return basic token if username and password are defined', function (done) { + var content = [ + 'registry=http://registry.foobar.eu/', + '//registry.foobar.eu/:_password=' + encodeBase64('foobar'), + '//registry.foobar.eu/:username=foobar', '' + ].join('\n') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + var token = getAuthToken() + assert.deepEqual(token, { + token: 'Zm9vYmFyOmZvb2Jhcg==', + type: 'Basic', + username: 'foobar', + password: 'foobar' + }) + assert.equal(decodeBase64(token.token), 'foobar:foobar') + done() + }) + }) + + it('should return basic token if registry url has port specified', function (done) { + var content = [ + 'registry=http://localhost:8770/', + // before the patch this token was selected. + '//localhost/:_authToken=ohno', + '//localhost:8770/:_password=' + encodeBase64('foobar'), + '//localhost:8770/:username=foobar', '' + ].join('\n') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + var token = getAuthToken() + assert.deepEqual(token, { + token: 'Zm9vYmFyOmZvb2Jhcg==', + type: 'Basic', + username: 'foobar', + password: 'foobar' + }) + assert.equal(decodeBase64(token.token), 'foobar:foobar') + done() + }) + }) + + it('should return password defined by reference to an environment variable (with curly braces)', function (done) { + var environmentVariable = '__REGISTRY_PASSWORD__' + var content = [ + 'registry=http://registry.foobar.cc/', + '//registry.foobar.cc/:username=username', + '//registry.foobar.cc/:_password=${' + environmentVariable + '}', '' + ].join('\n') + process.env[environmentVariable] = encodeBase64('password') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + var token = getAuthToken() + assert.deepEqual(token, { + type: 'Basic', + username: 'username', + password: 'password', + token: 'dXNlcm5hbWU6cGFzc3dvcmQ=' + }) + assert.equal(decodeBase64(token.token), 'username:password') + delete process.env[environmentVariable] + done() + }) + }) + + it('should return password defined by reference to an environment variable (without curly braces)', function (done) { + var environmentVariable = '__REGISTRY_PASSWORD__' + var content = [ + 'registry=http://registry.foobar.cc/', + '//registry.foobar.cc/:username=username', + '//registry.foobar.cc/:_password=$' + environmentVariable, '' + ].join('\n') + process.env[environmentVariable] = encodeBase64('password') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + var token = getAuthToken() + assert.deepEqual(token, { + type: 'Basic', + username: 'username', + password: 'password', + token: 'dXNlcm5hbWU6cGFzc3dvcmQ=' + }) + assert.equal(decodeBase64(token.token), 'username:password') + delete process.env[environmentVariable] + done() + }) + }) + + it('should try with and without a slash at the end of registry url', function (done) { + var content = [ + 'registry=http://registry.foobar.eu', + '//registry.foobar.eu:_password=' + encodeBase64('barbay'), + '//registry.foobar.eu:username=barbaz', '' + ].join('\n') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + var token = getAuthToken() + assert.deepEqual(token, { + token: 'YmFyYmF6OmJhcmJheQ==', + type: 'Basic', + password: 'barbay', + username: 'barbaz' + }) + assert.equal(decodeBase64(token.token), 'barbaz:barbay') + done() + }) + }) + + it('should fetch for the registry given (if defined)', function (done) { + var content = [ + '//registry.foobar.eu:_authToken=barbaz', + '//registry.blah.foo:_password=' + encodeBase64('barbay'), + '//registry.blah.foo:username=barbaz', + '//registry.last.thing:_authToken=yep', '' + ].join('\n') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + var token = getAuthToken('//registry.blah.foo') + assert.deepEqual(token, { + token: 'YmFyYmF6OmJhcmJheQ==', + type: 'Basic', + password: 'barbay', + username: 'barbaz' + }) + assert.equal(decodeBase64(token.token), 'barbaz:barbay') + done() + }) + }) + + it('recursively finds registries for deep url if option is set', function (done, undef) { + var opts = {recursive: true} + var content = [ + '//registry.blah.com/foo:_password=' + encodeBase64('barbay'), + '//registry.blah.com/foo:username=barbaz', + '//registry.blah.eu:username=barbaz', + '//registry.blah.eu:_password=' + encodeBase64('foobaz'), '' + ].join('\n') + + fs.writeFile(npmRcPath, content, function (err) { + var getAuthToken = requireUncached('../index') + assert(!err, err) + var token = getAuthToken('https://registry.blah.com/foo/bar/baz', opts) + assert.deepEqual(token, { + token: 'YmFyYmF6OmJhcmJheQ==', + type: 'Basic', + password: 'barbay', + username: 'barbaz' + }) + assert.equal(decodeBase64(token.token), 'barbaz:barbay') + token = getAuthToken('https://registry.blah.eu/foo/bar/baz', opts) + assert.deepEqual(token, { + token: 'YmFyYmF6OmZvb2Jheg==', + type: 'Basic', + password: 'foobaz', + username: 'barbaz' + }) + assert.equal(decodeBase64(token.token), 'barbaz:foobaz') + assert.equal(getAuthToken('//some.registry', opts), undef) + done() + }) + }) + }) +}) diff --git a/node_modules/registry-auth-token/test/registry-url.test.js b/node_modules/registry-auth-token/test/registry-url.test.js new file mode 100644 index 0000000..adb6951 --- /dev/null +++ b/node_modules/registry-auth-token/test/registry-url.test.js @@ -0,0 +1,64 @@ +var fs = require('fs') +var path = require('path') +var mocha = require('mocha') +var assert = require('assert') +var requireUncached = require('require-uncached') + +var npmRcPath = path.join(__dirname, '..', '.npmrc') +var afterEach = mocha.afterEach +var describe = mocha.describe +var it = mocha.it + +describe('registry-url', function () { + afterEach(function (done) { + fs.unlink(npmRcPath, function () { + done() + }) + }) + + it('should read global if no local is found', function () { + var getRegistryUrl = requireUncached('../registry-url') + getRegistryUrl() + }) + + it('should return default registry if no url is given for scope', function (done) { + fs.writeFile(npmRcPath, 'registry=https://registry.npmjs.org/', function (err) { + var getRegistryUrl = requireUncached('../registry-url') + assert(!err, err) + assert.equal(getRegistryUrl('@somescope'), 'https://registry.npmjs.org/') + done() + }) + }) + + it('should return registry url if url is given for scope ', function (done) { + fs.writeFile(npmRcPath, '@somescope:registry=https://some.registry/', function (err) { + var getRegistryUrl = requireUncached('../registry-url') + assert(!err, err) + assert.equal(getRegistryUrl('@somescope'), 'https://some.registry/') + done() + }) + }) + + it('should append trailing slash if not present', function (done) { + fs.writeFile(npmRcPath, '@somescope:registry=https://some.registry', function (err) { + var getRegistryUrl = requireUncached('../registry-url') + assert(!err, err) + assert.equal(getRegistryUrl('@somescope'), 'https://some.registry/') + done() + }) + }) + + it('should return configured global registry if given', function (done) { + var content = [ + 'registry=http://registry.foobar.eu/', + '@somescope:registry=https://some.url/', '' + ].join('\n') + + fs.writeFile(npmRcPath, content, function (err) { + var getRegistryUrl = requireUncached('../registry-url') + assert(!err, err) + assert.equal(getRegistryUrl(), 'http://registry.foobar.eu/') + done() + }) + }) +}) diff --git a/node_modules/registry-auth-token/yarn.lock b/node_modules/registry-auth-token/yarn.lock new file mode 100644 index 0000000..23f7b13 --- /dev/null +++ b/node_modules/registry-auth-token/yarn.lock @@ -0,0 +1,1512 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +abbrev@1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + +abbrev@1.0.x: + version "1.0.9" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" + +acorn-jsx@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" + dependencies: + acorn "^3.0.4" + +acorn@^3.0.4: + version "3.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" + +acorn@^5.2.1: + version "5.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.3.0.tgz#7446d39459c54fb49a80e6ee6478149b940ec822" + +ajv-keywords@^1.0.0: + version "1.5.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" + +ajv@^4.7.0: + version "4.11.8" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" + dependencies: + co "^4.6.0" + json-stable-stringify "^1.0.1" + +align-text@^0.1.1, align-text@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" + dependencies: + kind-of "^3.0.2" + longest "^1.0.1" + repeat-string "^1.5.2" + +amdefine@>=0.0.4: + version "1.0.1" + resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" + +ansi-escapes@^1.1.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + +argparse@^1.0.7: + version "1.0.9" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + dependencies: + sprintf-js "~1.0.2" + +array-union@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + dependencies: + array-uniq "^1.0.1" + +array-uniq@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + +array.prototype.find@^2.0.1: + version "2.0.4" + resolved "https://registry.yarnpkg.com/array.prototype.find/-/array.prototype.find-2.0.4.tgz#556a5c5362c08648323ddaeb9de9d14bc1864c90" + dependencies: + define-properties "^1.1.2" + es-abstract "^1.7.0" + +arrify@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + +async@1.x, async@^1.4.0: + version "1.5.2" + resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" + +babel-code-frame@^6.16.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" + dependencies: + chalk "^1.1.3" + esutils "^2.0.2" + js-tokens "^3.0.2" + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + +brace-expansion@^1.1.7: + version "1.1.8" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +browser-stdout@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" + +builtin-modules@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + +caller-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" + dependencies: + callsites "^0.2.0" + +callsites@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" + +camelcase@^1.0.2: + version "1.2.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" + +center-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" + dependencies: + align-text "^0.1.3" + lazy-cache "^1.0.3" + +chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +circular-json@^0.3.1: + version "0.3.3" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" + +cli-cursor@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" + dependencies: + restore-cursor "^1.0.1" + +cli-width@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + +cliui@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" + dependencies: + center-align "^0.1.1" + right-align "^0.1.1" + wordwrap "0.0.2" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + +commander@2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" + dependencies: + graceful-readlink ">= 1.0.0" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + +concat-stream@^1.5.2: + version "1.6.0" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" + dependencies: + inherits "^2.0.3" + readable-stream "^2.2.2" + typedarray "^0.0.6" + +contains-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + +d@1: + version "1.0.0" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" + dependencies: + es5-ext "^0.10.9" + +debug-log@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f" + +debug@2.6.8: + version "2.6.8" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" + dependencies: + ms "2.0.0" + +debug@^2.1.1, debug@^2.2.0, debug@^2.6.8: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + dependencies: + ms "2.0.0" + +decamelize@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + +deep-extend@~0.4.0: + version "0.4.2" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + +define-properties@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94" + dependencies: + foreach "^2.0.5" + object-keys "^1.0.8" + +deglob@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/deglob/-/deglob-2.1.0.tgz#4d44abe16ef32c779b4972bd141a80325029a14a" + dependencies: + find-root "^1.0.0" + glob "^7.0.5" + ignore "^3.0.9" + pkg-config "^1.1.0" + run-parallel "^1.1.2" + uniq "^1.0.1" + +del@^2.0.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" + dependencies: + globby "^5.0.0" + is-path-cwd "^1.0.0" + is-path-in-cwd "^1.0.0" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + rimraf "^2.2.8" + +diff@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" + +doctrine@1.5.0, doctrine@^1.2.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + +doctrine@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + dependencies: + esutils "^2.0.2" + +error-ex@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" + dependencies: + is-arrayish "^0.2.1" + +es-abstract@^1.7.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.10.0.tgz#1ecb36c197842a00d8ee4c2dfd8646bb97d60864" + dependencies: + es-to-primitive "^1.1.1" + function-bind "^1.1.1" + has "^1.0.1" + is-callable "^1.1.3" + is-regex "^1.0.4" + +es-to-primitive@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d" + dependencies: + is-callable "^1.1.1" + is-date-object "^1.0.1" + is-symbol "^1.0.1" + +es5-ext@^0.10.14, es5-ext@^0.10.35, es5-ext@^0.10.9, es5-ext@~0.10.14: + version "0.10.38" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.38.tgz#fa7d40d65bbc9bb8a67e1d3f9cc656a00530eed3" + dependencies: + es6-iterator "~2.0.3" + es6-symbol "~3.1.1" + +es6-iterator@^2.0.1, es6-iterator@~2.0.1, es6-iterator@~2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + dependencies: + d "1" + es5-ext "^0.10.35" + es6-symbol "^3.1.1" + +es6-map@^0.1.3: + version "0.1.5" + resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.5.tgz#9136e0503dcc06a301690f0bb14ff4e364e949f0" + dependencies: + d "1" + es5-ext "~0.10.14" + es6-iterator "~2.0.1" + es6-set "~0.1.5" + es6-symbol "~3.1.1" + event-emitter "~0.3.5" + +es6-set@~0.1.5: + version "0.1.5" + resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1" + dependencies: + d "1" + es5-ext "~0.10.14" + es6-iterator "~2.0.1" + es6-symbol "3.1.1" + event-emitter "~0.3.5" + +es6-symbol@3.1.1, es6-symbol@^3.1.1, es6-symbol@~3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" + dependencies: + d "1" + es5-ext "~0.10.14" + +es6-weak-map@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.2.tgz#5e3ab32251ffd1538a1f8e5ffa1357772f92d96f" + dependencies: + d "1" + es5-ext "^0.10.14" + es6-iterator "^2.0.1" + es6-symbol "^3.1.1" + +escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + +escodegen@1.8.x: + version "1.8.1" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.8.1.tgz#5a5b53af4693110bebb0867aa3430dd3b70a1018" + dependencies: + esprima "^2.7.1" + estraverse "^1.9.1" + esutils "^2.0.2" + optionator "^0.8.1" + optionalDependencies: + source-map "~0.2.0" + +escope@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" + dependencies: + es6-map "^0.1.3" + es6-weak-map "^2.0.1" + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-config-standard-jsx@4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/eslint-config-standard-jsx/-/eslint-config-standard-jsx-4.0.2.tgz#009e53c4ddb1e9ee70b4650ffe63a7f39f8836e1" + +eslint-config-standard@10.2.1: + version "10.2.1" + resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-10.2.1.tgz#c061e4d066f379dc17cd562c64e819b4dd454591" + +eslint-import-resolver-node@^0.2.0: + version "0.2.3" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.2.3.tgz#5add8106e8c928db2cba232bcd9efa846e3da16c" + dependencies: + debug "^2.2.0" + object-assign "^4.0.1" + resolve "^1.1.6" + +eslint-module-utils@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.1.1.tgz#abaec824177613b8a95b299639e1b6facf473449" + dependencies: + debug "^2.6.8" + pkg-dir "^1.0.0" + +eslint-plugin-import@~2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.2.0.tgz#72ba306fad305d67c4816348a4699a4229ac8b4e" + dependencies: + builtin-modules "^1.1.1" + contains-path "^0.1.0" + debug "^2.2.0" + doctrine "1.5.0" + eslint-import-resolver-node "^0.2.0" + eslint-module-utils "^2.0.0" + has "^1.0.1" + lodash.cond "^4.3.0" + minimatch "^3.0.3" + pkg-up "^1.0.0" + +eslint-plugin-node@~4.2.2: + version "4.2.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-4.2.3.tgz#c04390ab8dbcbb6887174023d6f3a72769e63b97" + dependencies: + ignore "^3.0.11" + minimatch "^3.0.2" + object-assign "^4.0.1" + resolve "^1.1.7" + semver "5.3.0" + +eslint-plugin-promise@~3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-3.5.0.tgz#78fbb6ffe047201627569e85a6c5373af2a68fca" + +eslint-plugin-react@~6.10.0: + version "6.10.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-6.10.3.tgz#c5435beb06774e12c7db2f6abaddcbf900cd3f78" + dependencies: + array.prototype.find "^2.0.1" + doctrine "^1.2.2" + has "^1.0.1" + jsx-ast-utils "^1.3.4" + object.assign "^4.0.4" + +eslint-plugin-standard@~3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-standard/-/eslint-plugin-standard-3.0.1.tgz#34d0c915b45edc6f010393c7eef3823b08565cf2" + +eslint@~3.19.0: + version "3.19.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc" + dependencies: + babel-code-frame "^6.16.0" + chalk "^1.1.3" + concat-stream "^1.5.2" + debug "^2.1.1" + doctrine "^2.0.0" + escope "^3.6.0" + espree "^3.4.0" + esquery "^1.0.0" + estraverse "^4.2.0" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + glob "^7.0.3" + globals "^9.14.0" + ignore "^3.2.0" + imurmurhash "^0.1.4" + inquirer "^0.12.0" + is-my-json-valid "^2.10.0" + is-resolvable "^1.0.0" + js-yaml "^3.5.1" + json-stable-stringify "^1.0.0" + levn "^0.3.0" + lodash "^4.0.0" + mkdirp "^0.5.0" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.1" + pluralize "^1.2.1" + progress "^1.1.8" + require-uncached "^1.0.2" + shelljs "^0.7.5" + strip-bom "^3.0.0" + strip-json-comments "~2.0.1" + table "^3.7.8" + text-table "~0.2.0" + user-home "^2.0.0" + +espree@^3.4.0: + version "3.5.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.2.tgz#756ada8b979e9dcfcdb30aad8d1a9304a905e1ca" + dependencies: + acorn "^5.2.1" + acorn-jsx "^3.0.0" + +esprima@2.7.x, esprima@^2.7.1: + version "2.7.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" + +esprima@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + +esquery@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" + dependencies: + estraverse "^4.0.0" + +esrecurse@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.0.tgz#fa9568d98d3823f9a41d91e902dcab9ea6e5b163" + dependencies: + estraverse "^4.1.0" + object-assign "^4.0.1" + +estraverse@^1.9.1: + version "1.9.3" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44" + +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + +esutils@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + +event-emitter@~0.3.5: + version "0.3.5" + resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" + dependencies: + d "1" + es5-ext "~0.10.14" + +exit-hook@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" + +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + +figures@^1.3.5: + version "1.7.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" + dependencies: + escape-string-regexp "^1.0.5" + object-assign "^4.1.0" + +file-entry-cache@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" + dependencies: + flat-cache "^1.2.1" + object-assign "^4.0.1" + +find-root@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" + +find-up@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + dependencies: + path-exists "^2.0.0" + pinkie-promise "^2.0.0" + +find-up@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + dependencies: + locate-path "^2.0.0" + +flat-cache@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" + dependencies: + circular-json "^0.3.1" + del "^2.0.2" + graceful-fs "^4.1.2" + write "^0.2.1" + +foreach@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + +function-bind@^1.0.2, function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + +generate-function@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74" + +generate-object-property@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" + dependencies: + is-property "^1.0.0" + +get-stdin@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398" + +glob@7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^5.0.15: + version "5.0.15" + resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" + dependencies: + inflight "^1.0.4" + inherits "2" + minimatch "2 || 3" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^7.0.0, glob@^7.0.3, glob@^7.0.5: + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^9.14.0: + version "9.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + +globby@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" + dependencies: + array-union "^1.0.1" + arrify "^1.0.0" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +graceful-fs@^4.1.2: + version "4.1.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + +"graceful-readlink@>= 1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" + +growl@1.9.2: + version "1.9.2" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" + +handlebars@^4.0.1: + version "4.0.11" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.11.tgz#630a35dfe0294bc281edae6ffc5d329fc7982dcc" + dependencies: + async "^1.4.0" + optimist "^0.6.1" + source-map "^0.4.4" + optionalDependencies: + uglify-js "^2.6" + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + dependencies: + ansi-regex "^2.0.0" + +has-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + +has-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" + +has@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" + dependencies: + function-bind "^1.0.2" + +he@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" + +ignore@^3.0.11, ignore@^3.0.9, ignore@^3.2.0: + version "3.3.7" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.3, inherits@~2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + +ini@~1.3.0: + version "1.3.5" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + +inquirer@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.12.0.tgz#1ef2bfd63504df0bc75785fff8c2c41df12f077e" + dependencies: + ansi-escapes "^1.1.0" + ansi-regex "^2.0.0" + chalk "^1.0.0" + cli-cursor "^1.0.1" + cli-width "^2.0.0" + figures "^1.3.5" + lodash "^4.3.0" + readline2 "^1.0.1" + run-async "^0.1.0" + rx-lite "^3.1.2" + string-width "^1.0.1" + strip-ansi "^3.0.0" + through "^2.3.6" + +interpret@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + +is-callable@^1.1.1, is-callable@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2" + +is-date-object@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + +is-my-json-valid@^2.10.0: + version "2.17.1" + resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.17.1.tgz#3da98914a70a22f0a8563ef1511a246c6fc55471" + dependencies: + generate-function "^2.0.0" + generate-object-property "^1.1.0" + jsonpointer "^4.0.0" + xtend "^4.0.0" + +is-path-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" + +is-path-in-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" + dependencies: + is-path-inside "^1.0.0" + +is-path-inside@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" + dependencies: + path-is-inside "^1.0.1" + +is-property@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" + +is-regex@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" + dependencies: + has "^1.0.1" + +is-resolvable@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" + +is-symbol@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" + +isarray@^1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + +istanbul@^0.4.2: + version "0.4.5" + resolved "https://registry.yarnpkg.com/istanbul/-/istanbul-0.4.5.tgz#65c7d73d4c4da84d4f3ac310b918fb0b8033733b" + dependencies: + abbrev "1.0.x" + async "1.x" + escodegen "1.8.x" + esprima "2.7.x" + glob "^5.0.15" + handlebars "^4.0.1" + js-yaml "3.x" + mkdirp "0.5.x" + nopt "3.x" + once "1.x" + resolve "1.1.x" + supports-color "^3.1.0" + which "^1.1.1" + wordwrap "^1.0.0" + +js-tokens@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + +js-yaml@3.x, js-yaml@^3.5.1: + version "3.10.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +json-parse-better-errors@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz#50183cd1b2d25275de069e9e71b467ac9eab973a" + +json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + dependencies: + jsonify "~0.0.0" + +json3@3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" + +jsonify@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + +jsonpointer@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" + +jsx-ast-utils@^1.3.4: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz#3867213e8dd79bf1e8f2300c0cfc1efb182c0df1" + +kind-of@^3.0.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + dependencies: + is-buffer "^1.1.5" + +lazy-cache@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" + +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +load-json-file@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" + dependencies: + graceful-fs "^4.1.2" + parse-json "^4.0.0" + pify "^3.0.0" + strip-bom "^3.0.0" + +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + +lodash._baseassign@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" + dependencies: + lodash._basecopy "^3.0.0" + lodash.keys "^3.0.0" + +lodash._basecopy@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" + +lodash._basecreate@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821" + +lodash._getnative@^3.0.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" + +lodash._isiterateecall@^3.0.0: + version "3.0.9" + resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" + +lodash.cond@^4.3.0: + version "4.5.2" + resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" + +lodash.create@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" + dependencies: + lodash._baseassign "^3.0.0" + lodash._basecreate "^3.0.0" + lodash._isiterateecall "^3.0.0" + +lodash.isarguments@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" + +lodash.isarray@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" + +lodash.keys@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" + dependencies: + lodash._getnative "^3.0.0" + lodash.isarguments "^3.0.0" + lodash.isarray "^3.0.0" + +lodash@^4.0.0, lodash@^4.3.0: + version "4.17.4" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" + +longest@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" + +"minimatch@2 || 3", minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + +minimist@^1.1.0, minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + +minimist@~0.0.1: + version "0.0.10" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" + +mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + dependencies: + minimist "0.0.8" + +mocha@^3.3.0: + version "3.5.3" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.5.3.tgz#1e0480fe36d2da5858d1eb6acc38418b26eaa20d" + dependencies: + browser-stdout "1.3.0" + commander "2.9.0" + debug "2.6.8" + diff "3.2.0" + escape-string-regexp "1.0.5" + glob "7.1.1" + growl "1.9.2" + he "1.1.1" + json3 "3.3.2" + lodash.create "3.1.1" + mkdirp "0.5.1" + supports-color "3.1.2" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + +mute-stream@0.0.5: + version "0.0.5" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + +nopt@3.x: + version "3.0.6" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" + dependencies: + abbrev "1" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + +object-assign@^4.0.1, object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + +object-keys@^1.0.11, object-keys@^1.0.8: + version "1.0.11" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d" + +object.assign@^4.0.4: + version "4.1.0" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" + dependencies: + define-properties "^1.1.2" + function-bind "^1.1.1" + has-symbols "^1.0.0" + object-keys "^1.0.11" + +once@1.x, once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + dependencies: + wrappy "1" + +onetime@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" + +optimist@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + dependencies: + minimist "~0.0.1" + wordwrap "~0.0.2" + +optionator@^0.8.1, optionator@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + +os-homedir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + +p-limit@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c" + dependencies: + p-try "^1.0.0" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + dependencies: + p-limit "^1.1.0" + +p-try@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + +parse-json@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + dependencies: + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + +path-exists@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + dependencies: + pinkie-promise "^2.0.0" + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + +path-is-inside@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + +path-parse@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" + +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + +pkg-conf@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/pkg-conf/-/pkg-conf-2.1.0.tgz#2126514ca6f2abfebd168596df18ba57867f0058" + dependencies: + find-up "^2.0.0" + load-json-file "^4.0.0" + +pkg-config@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/pkg-config/-/pkg-config-1.1.1.tgz#557ef22d73da3c8837107766c52eadabde298fe4" + dependencies: + debug-log "^1.0.0" + find-root "^1.0.0" + xtend "^4.0.1" + +pkg-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" + dependencies: + find-up "^1.0.0" + +pkg-up@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-1.0.0.tgz#3e08fb461525c4421624a33b9f7e6d0af5b05a26" + dependencies: + find-up "^1.0.0" + +pluralize@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + +process-nextick-args@~1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" + +progress@^1.1.8: + version "1.1.8" + resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" + +rc@^1.1.6: + version "1.2.4" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.4.tgz#a0f606caae2a3b862bbd0ef85482c0125b315fa3" + dependencies: + deep-extend "~0.4.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + +readable-stream@^2.2.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + safe-buffer "~5.1.1" + string_decoder "~1.0.3" + util-deprecate "~1.0.1" + +readline2@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/readline2/-/readline2-1.0.1.tgz#41059608ffc154757b715d9989d199ffbf372e35" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + mute-stream "0.0.5" + +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + dependencies: + resolve "^1.1.6" + +repeat-string@^1.5.2: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + +require-uncached@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" + dependencies: + caller-path "^0.1.0" + resolve-from "^1.0.0" + +resolve-from@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" + +resolve@1.1.x: + version "1.1.7" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + +resolve@^1.1.6, resolve@^1.1.7: + version "1.5.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" + dependencies: + path-parse "^1.0.5" + +restore-cursor@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" + dependencies: + exit-hook "^1.0.0" + onetime "^1.0.0" + +right-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" + dependencies: + align-text "^0.1.1" + +rimraf@^2.2.8: + version "2.6.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" + dependencies: + glob "^7.0.5" + +run-async@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" + dependencies: + once "^1.3.0" + +run-parallel@^1.1.2: + version "1.1.6" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.6.tgz#29003c9a2163e01e2d2dfc90575f2c6c1d61a039" + +rx-lite@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" + +safe-buffer@^5.0.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + +semver@5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" + +shelljs@^0.7.5: + version "0.7.8" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3" + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + +slice-ansi@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" + +source-map@^0.4.4: + version "0.4.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" + dependencies: + amdefine ">=0.0.4" + +source-map@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.2.0.tgz#dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d" + dependencies: + amdefine ">=0.0.4" + +source-map@~0.5.1: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + +standard-engine@~7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/standard-engine/-/standard-engine-7.0.0.tgz#ebb77b9c8fc2c8165ffa353bd91ba0dff41af690" + dependencies: + deglob "^2.1.0" + get-stdin "^5.0.1" + minimist "^1.1.0" + pkg-conf "^2.0.0" + +standard@^10.0.2: + version "10.0.3" + resolved "https://registry.yarnpkg.com/standard/-/standard-10.0.3.tgz#7869bcbf422bdeeaab689a1ffb1fea9677dd50ea" + dependencies: + eslint "~3.19.0" + eslint-config-standard "10.2.1" + eslint-config-standard-jsx "4.0.2" + eslint-plugin-import "~2.2.0" + eslint-plugin-node "~4.2.2" + eslint-plugin-promise "~3.5.0" + eslint-plugin-react "~6.10.0" + eslint-plugin-standard "~3.0.1" + standard-engine "~7.0.0" + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +string-width@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string_decoder@~1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + dependencies: + ansi-regex "^3.0.0" + +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + +supports-color@3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" + dependencies: + has-flag "^1.0.0" + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + +supports-color@^3.1.0: + version "3.2.3" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" + dependencies: + has-flag "^1.0.0" + +table@^3.7.8: + version "3.8.3" + resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f" + dependencies: + ajv "^4.7.0" + ajv-keywords "^1.0.0" + chalk "^1.1.1" + lodash "^4.0.0" + slice-ansi "0.0.4" + string-width "^2.0.0" + +text-table@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + +through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + dependencies: + prelude-ls "~1.1.2" + +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + +uglify-js@^2.6: + version "2.8.29" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" + dependencies: + source-map "~0.5.1" + yargs "~3.10.0" + optionalDependencies: + uglify-to-browserify "~1.0.0" + +uglify-to-browserify@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" + +uniq@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" + +user-home@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" + dependencies: + os-homedir "^1.0.0" + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + +which@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" + dependencies: + isexe "^2.0.0" + +window-size@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" + +wordwrap@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" + +wordwrap@^1.0.0, wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + +wordwrap@~0.0.2: + version "0.0.3" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + +write@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" + dependencies: + mkdirp "^0.5.1" + +xtend@^4.0.0, xtend@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" + +yargs@~3.10.0: + version "3.10.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" + dependencies: + camelcase "^1.0.2" + cliui "^2.1.0" + decamelize "^1.0.0" + window-size "0.1.0" diff --git a/node_modules/registry-url/index.js b/node_modules/registry-url/index.js new file mode 100644 index 0000000..5502a23 --- /dev/null +++ b/node_modules/registry-url/index.js @@ -0,0 +1,6 @@ +'use strict'; +module.exports = function (scope) { + var rc = require('rc')('npm', {registry: 'https://registry.npmjs.org/'}); + var url = rc[scope + ':registry'] || rc.registry; + return url.slice(-1) === '/' ? url : url + '/'; +}; diff --git a/node_modules/registry-url/license b/node_modules/registry-url/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/registry-url/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/registry-url/package.json b/node_modules/registry-url/package.json new file mode 100644 index 0000000..4831045 --- /dev/null +++ b/node_modules/registry-url/package.json @@ -0,0 +1,72 @@ +{ + "_from": "registry-url@^3.0.3", + "_id": "registry-url@3.1.0", + "_inBundle": false, + "_integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=", + "_location": "/registry-url", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "registry-url@^3.0.3", + "name": "registry-url", + "escapedName": "registry-url", + "rawSpec": "^3.0.3", + "saveSpec": null, + "fetchSpec": "^3.0.3" + }, + "_requiredBy": [ + "/package-json" + ], + "_resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", + "_shasum": "3d4ef870f73dde1d77f0cf9a381432444e174942", + "_spec": "registry-url@^3.0.3", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/package-json", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/registry-url/issues" + }, + "bundleDependencies": false, + "dependencies": { + "rc": "^1.0.1" + }, + "deprecated": false, + "description": "Get the set npm registry URL", + "devDependencies": { + "ava": "*", + "pify": "^2.3.0", + "require-uncached": "^1.0.2", + "xo": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/registry-url#readme", + "keywords": [ + "npm", + "conf", + "config", + "npmconf", + "registry", + "url", + "uri", + "scope" + ], + "license": "MIT", + "name": "registry-url", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/registry-url.git" + }, + "scripts": { + "test": "xo && ava --serial" + }, + "version": "3.1.0" +} diff --git a/node_modules/registry-url/readme.md b/node_modules/registry-url/readme.md new file mode 100644 index 0000000..6fc55bc --- /dev/null +++ b/node_modules/registry-url/readme.md @@ -0,0 +1,50 @@ +# registry-url [![Build Status](https://travis-ci.org/sindresorhus/registry-url.svg?branch=master)](https://travis-ci.org/sindresorhus/registry-url) + +> Get the set npm registry URL + +It's usually `https://registry.npmjs.org/`, but [configurable](https://www.npmjs.org/doc/misc/npm-config.html#registry). + +Use this if you do anything with the npm registry as users will expect it to use their configured registry. + + +## Install + +``` +$ npm install --save registry-url +``` + + +## Usage + +```ini +# .npmrc +registry = 'https://custom-registry.com/' +``` + +```js +const registryUrl = require('registry-url'); + +console.log(registryUrl()); +//=> 'https://custom-registry.com/' +``` + +It can also retrieve the registry URL associated with an [npm scope](https://docs.npmjs.com/misc/scope). + +```ini +# .npmrc +@myco:registry = 'https://custom-registry.com/' +``` + +```js +const registryUrl = require('registry-url'); + +console.log(registryUrl('@myco')); +//=> 'https://custom-registry.com/' +``` + +If the provided scope is not in the user's `.npmrc` file, then `registry-url` will check for the existence of `registry`, or if that's not set, fallback to the default npm registry. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/remove-trailing-separator/history.md b/node_modules/remove-trailing-separator/history.md new file mode 100644 index 0000000..e15e8a4 --- /dev/null +++ b/node_modules/remove-trailing-separator/history.md @@ -0,0 +1,17 @@ +## History + +### 1.1.0 - 16th Aug 2017 + +- [f4576e3](https://github.com/darsain/remove-trailing-separator/commit/f4576e3638c39b794998b533fffb27854dcbee01) Implement faster slash slicing + +### 1.0.2 - 07th Jun 2017 + +- [8e13ecb](https://github.com/darsain/remove-trailing-separator/commit/8e13ecbfd7b9f5fdf97c5d5ff923e4718b874e31) ES5 compatibility + +### 1.0.1 - 25th Sep 2016 + +- [b78606d](https://github.com/darsain/remove-trailing-separator/commit/af90b4e153a4527894741af6c7005acaeb78606d) Remove backslash only on win32 systems + +### 1.0.0 - 24th Sep 2016 + +Initial release. diff --git a/node_modules/remove-trailing-separator/index.js b/node_modules/remove-trailing-separator/index.js new file mode 100644 index 0000000..512306b --- /dev/null +++ b/node_modules/remove-trailing-separator/index.js @@ -0,0 +1,17 @@ +var isWin = process.platform === 'win32'; + +module.exports = function (str) { + var i = str.length - 1; + if (i < 2) { + return str; + } + while (isSeparator(str, i)) { + i--; + } + return str.substr(0, i + 1); +}; + +function isSeparator(str, i) { + var char = str[i]; + return i > 0 && (char === '/' || (isWin && char === '\\')); +} diff --git a/node_modules/remove-trailing-separator/license b/node_modules/remove-trailing-separator/license new file mode 100644 index 0000000..a169aff --- /dev/null +++ b/node_modules/remove-trailing-separator/license @@ -0,0 +1,3 @@ +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. \ No newline at end of file diff --git a/node_modules/remove-trailing-separator/package.json b/node_modules/remove-trailing-separator/package.json new file mode 100644 index 0000000..d6ae8b9 --- /dev/null +++ b/node_modules/remove-trailing-separator/package.json @@ -0,0 +1,64 @@ +{ + "_from": "remove-trailing-separator@^1.0.1", + "_id": "remove-trailing-separator@1.1.0", + "_inBundle": false, + "_integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "_location": "/remove-trailing-separator", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remove-trailing-separator@^1.0.1", + "name": "remove-trailing-separator", + "escapedName": "remove-trailing-separator", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/normalize-path" + ], + "_resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "_shasum": "c24bce2a283adad5bc3f58e0d48249b92379d8ef", + "_spec": "remove-trailing-separator@^1.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/normalize-path", + "author": { + "name": "darsain" + }, + "bugs": { + "url": "https://github.com/darsain/remove-trailing-separator/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Removes separators from the end of the string.", + "devDependencies": { + "ava": "^0.16.0", + "coveralls": "^2.11.14", + "nyc": "^8.3.0", + "xo": "^0.16.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/darsain/remove-trailing-separator#readme", + "keywords": [ + "remove", + "strip", + "trailing", + "separator" + ], + "license": "ISC", + "main": "index.js", + "name": "remove-trailing-separator", + "repository": { + "type": "git", + "url": "git+https://github.com/darsain/remove-trailing-separator.git" + }, + "scripts": { + "lint": "xo", + "pretest": "npm run lint", + "report": "nyc report --reporter=html", + "test": "nyc ava" + }, + "version": "1.1.0" +} diff --git a/node_modules/remove-trailing-separator/readme.md b/node_modules/remove-trailing-separator/readme.md new file mode 100644 index 0000000..747086a --- /dev/null +++ b/node_modules/remove-trailing-separator/readme.md @@ -0,0 +1,51 @@ +# remove-trailing-separator + +[![NPM version][npm-img]][npm-url] [![Build Status: Linux][travis-img]][travis-url] [![Build Status: Windows][appveyor-img]][appveyor-url] [![Coverage Status][coveralls-img]][coveralls-url] + +Removes all separators from the end of a string. + +## Install + +``` +npm install remove-trailing-separator +``` + +## Examples + +```js +const removeTrailingSeparator = require('remove-trailing-separator'); + +removeTrailingSeparator('/foo/bar/') // '/foo/bar' +removeTrailingSeparator('/foo/bar///') // '/foo/bar' + +// leaves only/last separator +removeTrailingSeparator('/') // '/' +removeTrailingSeparator('///') // '/' + +// returns empty string +removeTrailingSeparator('') // '' +``` + +## Notable backslash, or win32 separator behavior + +`\` is considered a separator only on WIN32 systems. All POSIX compliant systems +see backslash as a valid file name character, so it would break POSIX compliance +to remove it there. + +In practice, this means that this code will return different things depending on +what system it runs on: + +```js +removeTrailingSeparator('\\foo\\') +// UNIX => '\\foo\\' +// WIN32 => '\\foo' +``` + +[npm-url]: https://npmjs.org/package/remove-trailing-separator +[npm-img]: https://badge.fury.io/js/remove-trailing-separator.svg +[travis-url]: https://travis-ci.org/darsain/remove-trailing-separator +[travis-img]: https://travis-ci.org/darsain/remove-trailing-separator.svg?branch=master +[appveyor-url]: https://ci.appveyor.com/project/darsain/remove-trailing-separator/branch/master +[appveyor-img]: https://ci.appveyor.com/api/projects/status/wvg9a93rrq95n2xl/branch/master?svg=true +[coveralls-url]: https://coveralls.io/github/darsain/remove-trailing-separator?branch=master +[coveralls-img]: https://coveralls.io/repos/github/darsain/remove-trailing-separator/badge.svg?branch=master diff --git a/node_modules/repeat-element/LICENSE b/node_modules/repeat-element/LICENSE new file mode 100644 index 0000000..33754da --- /dev/null +++ b/node_modules/repeat-element/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 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/node_modules/repeat-element/README.md b/node_modules/repeat-element/README.md new file mode 100644 index 0000000..008e20e --- /dev/null +++ b/node_modules/repeat-element/README.md @@ -0,0 +1,71 @@ +# repeat-element [![NPM version](https://badge.fury.io/js/repeat-element.svg)](http://badge.fury.io/js/repeat-element) + +> Create an array by repeating the given value n times. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```bash +npm i repeat-element --save +``` + +## Usage + +```js +var repeat = require('repeat-element'); + +repeat('a', 5); +//=> ['a', 'a', 'a', 'a', 'a'] + +repeat('a', 1); +//=> ['a'] + +repeat('a', 0); +//=> [] + +repeat(null, 5) +//» [ null, null, null, null, null ] + +repeat({some: 'object'}, 5) +//» [ { some: 'object' }, +// { some: 'object' }, +// { some: 'object' }, +// { some: 'object' }, +// { some: 'object' } ] + +repeat(5, 5) +//» [ 5, 5, 5, 5, 5 ] +``` + +## Related projects + +[repeat-string](https://github.com/jonschlinkert/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string. + +## 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/repeat-element/issues) + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright (c) 2015 Jon Schlinkert +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on May 06, 2015._ diff --git a/node_modules/repeat-element/index.js b/node_modules/repeat-element/index.js new file mode 100644 index 0000000..0ad45ab --- /dev/null +++ b/node_modules/repeat-element/index.js @@ -0,0 +1,18 @@ +/*! + * repeat-element + * + * Copyright (c) 2015 Jon Schlinkert. + * Licensed under the MIT license. + */ + +'use strict'; + +module.exports = function repeat(ele, num) { + var arr = new Array(num); + + for (var i = 0; i < num; i++) { + arr[i] = ele; + } + + return arr; +}; diff --git a/node_modules/repeat-element/package.json b/node_modules/repeat-element/package.json new file mode 100644 index 0000000..6b983e4 --- /dev/null +++ b/node_modules/repeat-element/package.json @@ -0,0 +1,69 @@ +{ + "_from": "repeat-element@^1.1.2", + "_id": "repeat-element@1.1.2", + "_inBundle": false, + "_integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", + "_location": "/repeat-element", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "repeat-element@^1.1.2", + "name": "repeat-element", + "escapedName": "repeat-element", + "rawSpec": "^1.1.2", + "saveSpec": null, + "fetchSpec": "^1.1.2" + }, + "_requiredBy": [ + "/braces" + ], + "_resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "_shasum": "ef089a178d1483baae4d93eb98b4f9e4e11d990a", + "_spec": "repeat-element@^1.1.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/braces", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/repeat-element/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Create an array by repeating the given value n times.", + "devDependencies": { + "benchmarked": "^0.1.4", + "chalk": "^1.0.0", + "glob": "^5.0.5", + "minimist": "^1.1.1", + "mocha": "^2.2.4" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/repeat-element", + "keywords": [ + "array", + "element", + "repeat", + "string" + ], + "license": { + "type": "MIT", + "url": "https://github.com/jonschlinkert/repeat-element/blob/master/LICENSE" + }, + "main": "index.js", + "name": "repeat-element", + "repository": { + "type": "git", + "url": "git://github.com/jonschlinkert/repeat-element.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "1.1.2" +} diff --git a/node_modules/repeat-string/LICENSE b/node_modules/repeat-string/LICENSE new file mode 100644 index 0000000..39245ac --- /dev/null +++ b/node_modules/repeat-string/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2016, 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/node_modules/repeat-string/README.md b/node_modules/repeat-string/README.md new file mode 100644 index 0000000..aaa5e91 --- /dev/null +++ b/node_modules/repeat-string/README.md @@ -0,0 +1,136 @@ +# repeat-string [![NPM version](https://img.shields.io/npm/v/repeat-string.svg?style=flat)](https://www.npmjs.com/package/repeat-string) [![NPM monthly downloads](https://img.shields.io/npm/dm/repeat-string.svg?style=flat)](https://npmjs.org/package/repeat-string) [![NPM total downloads](https://img.shields.io/npm/dt/repeat-string.svg?style=flat)](https://npmjs.org/package/repeat-string) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/repeat-string.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/repeat-string) + +> Repeat the given string n times. Fastest implementation for repeating a string. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save repeat-string +``` + +## Usage + +### [repeat](index.js#L41) + +Repeat the given `string` the specified `number` of times. + +**Example:** + +**Example** + +```js +var repeat = require('repeat-string'); +repeat('A', 5); +//=> AAAAA +``` + +**Params** + +* `string` **{String}**: The string to repeat +* `number` **{Number}**: The number of times to repeat the string +* `returns` **{String}**: Repeated string + +## Benchmarks + +Repeat string is significantly faster than the native method (which is itself faster than [repeating](https://github.com/sindresorhus/repeating)): + +```sh +# 2x +repeat-string █████████████████████████ (26,953,977 ops/sec) +repeating █████████ (9,855,695 ops/sec) +native ██████████████████ (19,453,895 ops/sec) + +# 3x +repeat-string █████████████████████████ (19,445,252 ops/sec) +repeating ███████████ (8,661,565 ops/sec) +native ████████████████████ (16,020,598 ops/sec) + +# 10x +repeat-string █████████████████████████ (23,792,521 ops/sec) +repeating █████████ (8,571,332 ops/sec) +native ███████████████ (14,582,955 ops/sec) + +# 50x +repeat-string █████████████████████████ (23,640,179 ops/sec) +repeating █████ (5,505,509 ops/sec) +native ██████████ (10,085,557 ops/sec) + +# 250x +repeat-string █████████████████████████ (23,489,618 ops/sec) +repeating ████ (3,962,937 ops/sec) +native ████████ (7,724,892 ops/sec) + +# 2000x +repeat-string █████████████████████████ (20,315,172 ops/sec) +repeating ████ (3,297,079 ops/sec) +native ███████ (6,203,331 ops/sec) + +# 20000x +repeat-string █████████████████████████ (23,382,915 ops/sec) +repeating ███ (2,980,058 ops/sec) +native █████ (5,578,808 ops/sec) +``` + +**Run the benchmarks** + +Install dev dependencies: + +```sh +npm i -d && node benchmark +``` + +## About + +### Related projects + +[repeat-element](https://www.npmjs.com/package/repeat-element): Create an array by repeating the given value n times. | [homepage](https://github.com/jonschlinkert/repeat-element "Create an array by repeating the given value n times.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor**
    | +| --- | --- | +| 51 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [LinusU](https://github.com/LinusU) | +| 2 | [tbusser](https://github.com/tbusser) | +| 1 | [doowb](https://github.com/doowb) | +| 1 | [wooorm](https://github.com/wooorm) | + +### Building docs + +_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ + +To generate the readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm install -g verb verb-generate-readme && verb +``` + +### Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +### License + +Copyright © 2016, [Jon Schlinkert](http://github.com/jonschlinkert). +Released under the [MIT license](https://github.com/jonschlinkert/repeat-string/blob/master/LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on October 23, 2016._ \ No newline at end of file diff --git a/node_modules/repeat-string/index.js b/node_modules/repeat-string/index.js new file mode 100644 index 0000000..4459afd --- /dev/null +++ b/node_modules/repeat-string/index.js @@ -0,0 +1,70 @@ +/*! + * repeat-string + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +/** + * Results cache + */ + +var res = ''; +var cache; + +/** + * Expose `repeat` + */ + +module.exports = repeat; + +/** + * Repeat the given `string` the specified `number` + * of times. + * + * **Example:** + * + * ```js + * var repeat = require('repeat-string'); + * repeat('A', 5); + * //=> AAAAA + * ``` + * + * @param {String} `string` The string to repeat + * @param {Number} `number` The number of times to repeat the string + * @return {String} Repeated string + * @api public + */ + +function repeat(str, num) { + if (typeof str !== 'string') { + throw new TypeError('expected a string'); + } + + // cover common, quick use cases + if (num === 1) return str; + if (num === 2) return str + str; + + var max = str.length * num; + if (cache !== str || typeof cache === 'undefined') { + cache = str; + res = ''; + } else if (res.length >= max) { + return res.substr(0, max); + } + + while (max > res.length && num > 1) { + if (num & 1) { + res += str; + } + + num >>= 1; + str += str; + } + + res += str; + res = res.substr(0, max); + return res; +} diff --git a/node_modules/repeat-string/package.json b/node_modules/repeat-string/package.json new file mode 100644 index 0000000..d4606d6 --- /dev/null +++ b/node_modules/repeat-string/package.json @@ -0,0 +1,128 @@ +{ + "_from": "repeat-string@^1.5.2", + "_id": "repeat-string@1.6.1", + "_inBundle": false, + "_integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "_location": "/repeat-string", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "repeat-string@^1.5.2", + "name": "repeat-string", + "escapedName": "repeat-string", + "rawSpec": "^1.5.2", + "saveSpec": null, + "fetchSpec": "^1.5.2" + }, + "_requiredBy": [ + "/align-text" + ], + "_resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "_shasum": "8dcae470e1c88abc2d600fff4a776286da75e637", + "_spec": "repeat-string@^1.5.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/align-text", + "author": { + "name": "Jon Schlinkert", + "url": "http://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/repeat-string/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Brian Woodward", + "email": "brian.woodward@gmail.com", + "url": "https://github.com/doowb" + }, + { + "name": "Jon Schlinkert", + "email": "jon.schlinkert@sellside.com", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Linus Unnebäck", + "email": "linus@folkdatorn.se", + "url": "http://linus.unnebäck.se" + }, + { + "name": "Thijs Busser", + "email": "tbusser@gmail.com", + "url": "http://tbusser.net" + }, + { + "name": "Titus", + "email": "tituswormer@gmail.com", + "url": "wooorm.com" + } + ], + "deprecated": false, + "description": "Repeat the given string n times. Fastest implementation for repeating a string.", + "devDependencies": { + "ansi-cyan": "^0.1.1", + "benchmarked": "^0.2.5", + "gulp-format-md": "^0.1.11", + "isobject": "^2.1.0", + "mocha": "^3.1.2", + "repeating": "^3.0.0", + "text-table": "^0.2.0", + "yargs-parser": "^4.0.2" + }, + "engines": { + "node": ">=0.10" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/repeat-string", + "keywords": [ + "fast", + "fastest", + "fill", + "left", + "left-pad", + "multiple", + "pad", + "padding", + "repeat", + "repeating", + "repetition", + "right", + "right-pad", + "string", + "times" + ], + "license": "MIT", + "main": "index.js", + "name": "repeat-string", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/repeat-string.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "repeat-element" + ] + }, + "helpers": [ + "./benchmark/helper.js" + ], + "reflinks": [ + "verb" + ] + }, + "version": "1.6.1" +} diff --git a/node_modules/require_optional/.npmignore b/node_modules/require_optional/.npmignore new file mode 100644 index 0000000..e920c16 --- /dev/null +++ b/node_modules/require_optional/.npmignore @@ -0,0 +1,33 @@ +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +node_modules + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history diff --git a/node_modules/require_optional/.travis.yml b/node_modules/require_optional/.travis.yml new file mode 100644 index 0000000..72903c3 --- /dev/null +++ b/node_modules/require_optional/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - "0.10" + - "0.12" + - "4" + - "6" + - "7" + - "8" +sudo: false diff --git a/node_modules/require_optional/HISTORY.md b/node_modules/require_optional/HISTORY.md new file mode 100644 index 0000000..7bee02f --- /dev/null +++ b/node_modules/require_optional/HISTORY.md @@ -0,0 +1,7 @@ +1.0.1 03-02-2016 +================ +* Fix dependency resolution issue when a component in peerOptionalDependencies is installed at the level of the module declaring in peerOptionalDependencies. + +1.0.0 03-02-2016 +================ +* Initial release allowing us to optionally resolve dependencies in the package.json file under the peerOptionalDependencies tag. \ No newline at end of file diff --git a/node_modules/require_optional/LICENSE b/node_modules/require_optional/LICENSE new file mode 100644 index 0000000..8dada3e --- /dev/null +++ b/node_modules/require_optional/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/require_optional/README.md b/node_modules/require_optional/README.md new file mode 100644 index 0000000..c0323f0 --- /dev/null +++ b/node_modules/require_optional/README.md @@ -0,0 +1,2 @@ +# require_optional +Work around the problem that we do not have a optionalPeerDependencies concept in node.js making it a hassle to optionally include native modules diff --git a/node_modules/require_optional/index.js b/node_modules/require_optional/index.js new file mode 100644 index 0000000..3710319 --- /dev/null +++ b/node_modules/require_optional/index.js @@ -0,0 +1,128 @@ +var path = require('path'), + fs = require('fs'), + f = require('util').format, + resolveFrom = require('resolve-from'), + semver = require('semver'); + +var exists = fs.existsSync || path.existsSync; + +// Find the location of a package.json file near or above the given location +var find_package_json = function(location) { + var found = false; + + while(!found) { + if (exists(location + '/package.json')) { + found = location; + } else if (location !== '/') { + location = path.dirname(location); + } else { + return false; + } + } + + return location; +} + +// Find the package.json object of the module closest up the module call tree that contains name in that module's peerOptionalDependencies +var find_package_json_with_name = function(name) { + // Walk up the module call tree until we find a module containing name in its peerOptionalDependencies + var currentModule = module; + var found = false; + while (currentModule) { + // Check currentModule has a package.json + location = currentModule.filename; + var location = find_package_json(location) + if (!location) { + currentModule = currentModule.parent; + continue; + } + + // Read the package.json file + var object = JSON.parse(fs.readFileSync(f('%s/package.json', location))); + // Is the name defined by interal file references + var parts = name.split(/\//); + + // Check whether this package.json contains peerOptionalDependencies containing the name we're searching for + if (!object.peerOptionalDependencies || (object.peerOptionalDependencies && !object.peerOptionalDependencies[parts[0]])) { + currentModule = currentModule.parent; + continue; + } + found = true; + break; + } + + // Check whether name has been found in currentModule's peerOptionalDependencies + if (!found) { + throw new Error(f('no optional dependency [%s] defined in peerOptionalDependencies in any package.json', parts[0])); + } + + return { + object: object, + parts: parts + } +} + +var require_optional = function(name, options) { + options = options || {}; + options.strict = typeof options.strict == 'boolean' ? options.strict : true; + + var res = find_package_json_with_name(name) + var object = res.object; + var parts = res.parts; + + // Unpack the expected version + var expectedVersions = object.peerOptionalDependencies[parts[0]]; + // The resolved package + var moduleEntry = undefined; + // Module file + var moduleEntryFile = name; + + try { + // Validate if it's possible to read the module + moduleEntry = require(moduleEntryFile); + } catch(err) { + // Attempt to resolve in top level package + try { + // Get the module entry file + moduleEntryFile = resolveFrom(process.cwd(), name); + if(moduleEntryFile == null) return undefined; + // Attempt to resolve the module + moduleEntry = require(moduleEntryFile); + } catch(err) { + if(err.code === 'MODULE_NOT_FOUND') return undefined; + } + } + + // Resolve the location of the module's package.json file + var location = find_package_json(require.resolve(moduleEntryFile)); + if(!location) { + throw new Error('package.json can not be located'); + } + + // Read the module file + var dependentOnModule = JSON.parse(fs.readFileSync(f('%s/package.json', location))); + // Get the version + var version = dependentOnModule.version; + // Validate if the found module satisfies the version id + if(semver.satisfies(version, expectedVersions) == false + && options.strict) { + var error = new Error(f('optional dependency [%s] found but version [%s] did not satisfy constraint [%s]', parts[0], version, expectedVersions)); + error.code = 'OPTIONAL_MODULE_NOT_FOUND'; + throw error; + } + + // Satifies the module requirement + return moduleEntry; +} + +require_optional.exists = function(name) { + try { + var m = require_optional(name); + if(m === undefined) return false; + return true; + } catch(err) { + return false; + } +} + +module.exports = require_optional; diff --git a/node_modules/require_optional/package.json b/node_modules/require_optional/package.json new file mode 100644 index 0000000..e110fc7 --- /dev/null +++ b/node_modules/require_optional/package.json @@ -0,0 +1,67 @@ +{ + "_from": "require_optional@^1.0.1", + "_id": "require_optional@1.0.1", + "_inBundle": false, + "_integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", + "_location": "/require_optional", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "require_optional@^1.0.1", + "name": "require_optional", + "escapedName": "require_optional", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/mongodb-core" + ], + "_resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", + "_shasum": "4cf35a4247f64ca3df8c2ef208cc494b1ca8fc2e", + "_spec": "require_optional@^1.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/mongodb-core", + "author": { + "name": "Christian Kvalheim Amor" + }, + "bugs": { + "url": "https://github.com/christkv/require_optional/issues" + }, + "bundleDependencies": false, + "dependencies": { + "resolve-from": "^2.0.0", + "semver": "^5.1.0" + }, + "deprecated": false, + "description": "Allows you declare optionalPeerDependencies that can be satisfied by the top level module but ignored if they are not.", + "devDependencies": { + "bson": "0.4.21", + "co": "4.6.0", + "es6-promise": "^3.0.2", + "mocha": "^2.4.5" + }, + "homepage": "https://github.com/christkv/require_optional", + "keywords": [ + "optional", + "require", + "optionalPeerDependencies" + ], + "license": "Apache-2.0", + "main": "index.js", + "name": "require_optional", + "peerOptionalDependencies": { + "co": ">=5.6.0", + "es6-promise": "^3.0.2", + "es6-promise2": "^4.0.2", + "bson": "0.4.21" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/christkv/require_optional.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "1.0.1" +} diff --git a/node_modules/require_optional/test/nestedTest/index.js b/node_modules/require_optional/test/nestedTest/index.js new file mode 100644 index 0000000..76de2ab --- /dev/null +++ b/node_modules/require_optional/test/nestedTest/index.js @@ -0,0 +1,8 @@ +var require_optional = require('../../') + +function findPackage(packageName) { + var pkg = require_optional(packageName); + return pkg; +} + +module.exports.findPackage = findPackage diff --git a/node_modules/require_optional/test/nestedTest/package.json b/node_modules/require_optional/test/nestedTest/package.json new file mode 100644 index 0000000..4c456a6 --- /dev/null +++ b/node_modules/require_optional/test/nestedTest/package.json @@ -0,0 +1,11 @@ +{ + "name": "nestedtest", + "version": "1.0.0", + "description": "A dummy package that facilitates testing that require_optional correctly walks up the module call stack", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Sebastian Hallum Clarke", + "license": "ISC" +} diff --git a/node_modules/require_optional/test/require_optional_tests.js b/node_modules/require_optional/test/require_optional_tests.js new file mode 100644 index 0000000..c9cc2a3 --- /dev/null +++ b/node_modules/require_optional/test/require_optional_tests.js @@ -0,0 +1,59 @@ +var assert = require('assert'), + require_optional = require('../'), + nestedTest = require('./nestedTest'); + +describe('Require Optional', function() { + describe('top level require', function() { + it('should correctly require co library', function() { + var promise = require_optional('es6-promise'); + assert.ok(promise); + }); + + it('should fail to require es6-promise library', function() { + try { + require_optional('co'); + } catch(e) { + assert.equal('OPTIONAL_MODULE_NOT_FOUND', e.code); + return; + } + + assert.ok(false); + }); + + it('should ignore optional library not defined', function() { + assert.equal(undefined, require_optional('es6-promise2')); + }); + }); + + describe('internal module file require', function() { + it('should correctly require co library', function() { + var Long = require_optional('bson/lib/bson/long.js'); + assert.ok(Long); + }); + }); + + describe('top level resolve', function() { + it('should correctly use exists method', function() { + assert.equal(false, require_optional.exists('co')); + assert.equal(true, require_optional.exists('es6-promise')); + assert.equal(true, require_optional.exists('bson/lib/bson/long.js')); + assert.equal(false, require_optional.exists('es6-promise2')); + }); + }); + + describe('require_optional inside dependencies', function() { + it('should correctly walk up module call stack searching for peerOptionalDependencies', function() { + assert.ok(nestedTest.findPackage('bson')) + }); + it('should return null when a package is defined in top-level package.json but not installed', function() { + assert.equal(null, nestedTest.findPackage('es6-promise2')) + }); + it('should error when searching for an optional dependency that is not defined in any ancestor package.json', function() { + try { + nestedTest.findPackage('bison') + } catch (err) { + assert.equal(err.message, 'no optional dependency [bison] defined in peerOptionalDependencies in any package.json') + } + }) + }); +}); diff --git a/node_modules/resolve-from/index.js b/node_modules/resolve-from/index.js new file mode 100644 index 0000000..434159f --- /dev/null +++ b/node_modules/resolve-from/index.js @@ -0,0 +1,23 @@ +'use strict'; +var path = require('path'); +var Module = require('module'); + +module.exports = function (fromDir, moduleId) { + if (typeof fromDir !== 'string' || typeof moduleId !== 'string') { + throw new TypeError('Expected `fromDir` and `moduleId` to be a string'); + } + + fromDir = path.resolve(fromDir); + + var fromFile = path.join(fromDir, 'noop.js'); + + try { + return Module._resolveFilename(moduleId, { + id: fromFile, + filename: fromFile, + paths: Module._nodeModulePaths(fromDir) + }); + } catch (err) { + return null; + } +}; diff --git a/node_modules/resolve-from/license b/node_modules/resolve-from/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/resolve-from/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/resolve-from/package.json b/node_modules/resolve-from/package.json new file mode 100644 index 0000000..cc0d347 --- /dev/null +++ b/node_modules/resolve-from/package.json @@ -0,0 +1,66 @@ +{ + "_from": "resolve-from@^2.0.0", + "_id": "resolve-from@2.0.0", + "_inBundle": false, + "_integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=", + "_location": "/resolve-from", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "resolve-from@^2.0.0", + "name": "resolve-from", + "escapedName": "resolve-from", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/require_optional" + ], + "_resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", + "_shasum": "9480ab20e94ffa1d9e80a804c7ea147611966b57", + "_spec": "resolve-from@^2.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/require_optional", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/resolve-from/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Resolve the path of a module like require.resolve() but from a given path", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/resolve-from#readme", + "keywords": [ + "require", + "resolve", + "path", + "module", + "from", + "like", + "path" + ], + "license": "MIT", + "name": "resolve-from", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/resolve-from.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "2.0.0" +} diff --git a/node_modules/resolve-from/readme.md b/node_modules/resolve-from/readme.md new file mode 100644 index 0000000..bb4ca91 --- /dev/null +++ b/node_modules/resolve-from/readme.md @@ -0,0 +1,58 @@ +# resolve-from [![Build Status](https://travis-ci.org/sindresorhus/resolve-from.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-from) + +> Resolve the path of a module like [`require.resolve()`](http://nodejs.org/api/globals.html#globals_require_resolve) but from a given path + +Unlike `require.resolve()` it returns `null` instead of throwing when the module can't be found. + + +## Install + +``` +$ npm install --save resolve-from +``` + + +## Usage + +```js +const resolveFrom = require('resolve-from'); + +// there's a file at `./foo/bar.js` + +resolveFrom('foo', './bar'); +//=> '/Users/sindresorhus/dev/test/foo/bar.js' +``` + + +## API + +### resolveFrom(fromDir, moduleId) + +#### fromDir + +Type: `string` + +Directory to resolve from. + +#### moduleId + +Type: `string` + +What you would use in `require()`. + + +## Tip + +Create a partial using a bound function if you want to require from the same `fromDir` multiple times: + +```js +const resolveFromFoo = resolveFrom.bind(null, 'foo'); + +resolveFromFoo('./bar'); +resolveFromFoo('./baz'); +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/resolve-url/.jshintrc b/node_modules/resolve-url/.jshintrc new file mode 100644 index 0000000..aaf3358 --- /dev/null +++ b/node_modules/resolve-url/.jshintrc @@ -0,0 +1,44 @@ +{ + "bitwise": true, + "camelcase": true, + "curly": false, + "eqeqeq": true, + "es3": true, + "forin": true, + "immed": false, + "indent": false, + "latedef": "nofunc", + "newcap": false, + "noarg": true, + "noempty": true, + "nonew": false, + "plusplus": false, + "quotmark": false, + "undef": true, + "unused": "vars", + "strict": false, + "trailing": true, + "maxparams": 5, + "maxdepth": false, + "maxstatements": false, + "maxcomplexity": false, + "maxlen": 100, + + "asi": true, + "expr": true, + "globalstrict": true, + "smarttabs": true, + "sub": true, + + "node": true, + "browser": true, + "globals": { + "describe": false, + "it": false, + "before": false, + "beforeEach": false, + "after": false, + "afterEach": false, + "define": false + } +} diff --git a/node_modules/resolve-url/LICENSE b/node_modules/resolve-url/LICENSE new file mode 100644 index 0000000..0595be3 --- /dev/null +++ b/node_modules/resolve-url/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013 Simon Lydell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/resolve-url/bower.json b/node_modules/resolve-url/bower.json new file mode 100644 index 0000000..31aa6f4 --- /dev/null +++ b/node_modules/resolve-url/bower.json @@ -0,0 +1,15 @@ +{ + "name": "resolve-url", + "version": "0.2.1", + "description": "Like Node.js’ `path.resolve`/`url.resolve` for the browser.", + "authors": ["Simon Lydell"], + "license": "MIT", + "main": "resolve-url.js", + "keywords": [ + "resolve", + "url" + ], + "ignore": [ + ".*" + ] +} diff --git a/node_modules/resolve-url/changelog.md b/node_modules/resolve-url/changelog.md new file mode 100644 index 0000000..2a4a630 --- /dev/null +++ b/node_modules/resolve-url/changelog.md @@ -0,0 +1,15 @@ +### Version 0.2.1 (2014-02-25) ### + +- Fix edge case when (accidentally) supplying only one argument, and that + argument happens to be a falsy value such as `undefined` or `null`. + + +### Version 0.2.0 (2014-02-24) ### + +- Disallow passing 0 arguments. It’s weird and inconsistent between browsers. + (Backwards incompatible change.) + + +### Version 0.1.0 (2014-02-23) ### + +- Initial release. diff --git a/node_modules/resolve-url/component.json b/node_modules/resolve-url/component.json new file mode 100644 index 0000000..f37cf00 --- /dev/null +++ b/node_modules/resolve-url/component.json @@ -0,0 +1,15 @@ +{ + "name": "resolve-url", + "version": "0.2.1", + "license": "MIT", + "description": "Like Node.js’ `path.resolve`/`url.resolve` for the browser.", + "main": "resolve-url.js", + "repo": "lydell/resolve-url", + "keywords": [ + "resolve", + "url" + ], + "scripts": [ + "resolve-url.js" + ] +} diff --git a/node_modules/resolve-url/package.json b/node_modules/resolve-url/package.json new file mode 100644 index 0000000..79d5e8d --- /dev/null +++ b/node_modules/resolve-url/package.json @@ -0,0 +1,68 @@ +{ + "_from": "resolve-url@^0.2.1", + "_id": "resolve-url@0.2.1", + "_inBundle": false, + "_integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "_location": "/resolve-url", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "resolve-url@^0.2.1", + "name": "resolve-url", + "escapedName": "resolve-url", + "rawSpec": "^0.2.1", + "saveSpec": null, + "fetchSpec": "^0.2.1" + }, + "_requiredBy": [ + "/source-map-resolve" + ], + "_resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "_shasum": "2c637fe77c893afd2a663fe21aa9080068e2052a", + "_spec": "resolve-url@^0.2.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/source-map-resolve", + "author": { + "name": "Simon Lydell" + }, + "bugs": { + "url": "https://github.com/lydell/resolve-url/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Like Node.js’ `path.resolve`/`url.resolve` for the browser.", + "devDependencies": { + "jshint": "~2.4.3", + "tape": "~2.5.0", + "testling": "~1.6.0" + }, + "homepage": "https://github.com/lydell/resolve-url#readme", + "keywords": [ + "resolve", + "url" + ], + "license": "MIT", + "main": "resolve-url.js", + "name": "resolve-url", + "repository": { + "type": "git", + "url": "git+https://github.com/lydell/resolve-url.git" + }, + "scripts": { + "test": "jshint resolve-url.js test/ && testling -u" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "chrome/latest", + "firefox/latest", + "opera/12", + "opera/latest", + "safari/5", + "iphone/6", + "android-browser/4" + ] + }, + "version": "0.2.1" +} diff --git a/node_modules/resolve-url/readme.md b/node_modules/resolve-url/readme.md new file mode 100644 index 0000000..edfff73 --- /dev/null +++ b/node_modules/resolve-url/readme.md @@ -0,0 +1,83 @@ +Overview +======== + +[![browser support](https://ci.testling.com/lydell/resolve-url.png)](https://ci.testling.com/lydell/resolve-url) + +Like Node.js’ [`path.resolve`]/[`url.resolve`] for the browser. + +```js +var resolveUrl = require("resolve-url") + +window.location +// https://example.com/articles/resolving-urls/edit + +resolveUrl("remove") +// https://example.com/articles/resolving-urls/remove + +resolveUrl("/static/scripts/app.js") +// https://example.com/static/scripts/app.js + +// Imagine /static/scripts/app.js contains `//# sourceMappingURL=../source-maps/app.js.map` +resolveUrl("/static/scripts/app.js", "../source-maps/app.js.map") +// https://example.com/static/source-maps/app.js.map + +resolveUrl("/static/scripts/app.js", "../source-maps/app.js.map", "../coffee/app.coffee") +// https://example.com/static/coffee/app.coffee + +resolveUrl("//cdn.example.com/jquery.js") +// https://cdn.example.com/jquery.js + +resolveUrl("http://foo.org/") +// http://foo.org/ +``` + + +Installation +============ + +- `npm install resolve-url` +- `bower install resolve-url` +- `component install lydell/resolve-url` + +Works with CommonJS, AMD and browser globals, through UMD. + + +Usage +===== + +### `resolveUrl(...urls)` ### + +Pass one or more urls. Resolves the last one to an absolute url, using the +previous ones and `window.location`. + +It’s like starting out on `window.location`, and then clicking links with the +urls as `href` attributes in order, from left to right. + +Unlike Node.js’ [`path.resolve`], this function always goes through all of the +arguments, from left to right. `path.resolve` goes from right to left and only +in the worst case goes through them all. Should that matter. + +Actually, the function is _really_ like clicking a lot of links in series: An +actual `` gets its `href` attribute set for each url! This means that the +url resolution of the browser is used, which makes this module really +light-weight. + +Also note that this functions deals with urls, not paths, so in that respect it +has more in common with Node.js’ [`url.resolve`]. But the arguments are more +like [`path.resolve`]. + +[`path.resolve`]: http://nodejs.org/api/path.html#path_path_resolve_from_to +[`url.resolve`]: http://nodejs.org/api/url.html#url_url_resolve_from_to + + +Tests +===== + +Run `npm test`, which lints the code and then gives you a link to open in a +browser of choice (using `testling`). + + +License +======= + +[The X11 (“MIT”) License](LICENSE). diff --git a/node_modules/resolve-url/resolve-url.js b/node_modules/resolve-url/resolve-url.js new file mode 100644 index 0000000..19e8d04 --- /dev/null +++ b/node_modules/resolve-url/resolve-url.js @@ -0,0 +1,47 @@ +// Copyright 2014 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +void (function(root, factory) { + if (typeof define === "function" && define.amd) { + define(factory) + } else if (typeof exports === "object") { + module.exports = factory() + } else { + root.resolveUrl = factory() + } +}(this, function() { + + function resolveUrl(/* ...urls */) { + var numUrls = arguments.length + + if (numUrls === 0) { + throw new Error("resolveUrl requires at least one argument; got none.") + } + + var base = document.createElement("base") + base.href = arguments[0] + + if (numUrls === 1) { + return base.href + } + + var head = document.getElementsByTagName("head")[0] + head.insertBefore(base, head.firstChild) + + var a = document.createElement("a") + var resolved + + for (var index = 1; index < numUrls; index++) { + a.href = arguments[index] + resolved = a.href + base.href = resolved + } + + head.removeChild(base) + + return resolved + } + + return resolveUrl + +})); diff --git a/node_modules/resolve-url/test/resolve-url.js b/node_modules/resolve-url/test/resolve-url.js new file mode 100644 index 0000000..18532ed --- /dev/null +++ b/node_modules/resolve-url/test/resolve-url.js @@ -0,0 +1,70 @@ +// Copyright 2014 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +var test = require("tape") + +var resolveUrl = require("../") + +"use strict" + +test("resolveUrl", function(t) { + + t.plan(7) + + t.equal(typeof resolveUrl, "function", "is a function") + + t.equal( + resolveUrl("https://example.com/"), + "https://example.com/" + ) + + var loc = "https://example.com/articles/resolving-urls/edit" + + t.equal( + resolveUrl(loc, "remove"), + "https://example.com/articles/resolving-urls/remove" + ) + + t.equal( + resolveUrl(loc, "/static/scripts/app.js"), + "https://example.com/static/scripts/app.js" + ) + + t.equal( + resolveUrl(loc, "/static/scripts/app.js", "../source-maps/app.js.map"), + "https://example.com/static/source-maps/app.js.map" + ) + + t.equal( + resolveUrl(loc, "/static/scripts/app.js", "../source-maps/app.js.map", "../coffee/app.coffee"), + "https://example.com/static/coffee/app.coffee" + ) + + t.equal( + resolveUrl(loc, "//cdn.example.com/jquery.js"), + "https://cdn.example.com/jquery.js" + ) + +}) + +test("edge cases", function(t) { + + t.plan(4) + + t["throws"](resolveUrl, /at least one argument/, "throws with no arguments") + + var accidentallyUndefined + var result + t.doesNotThrow( + function() { result = resolveUrl(accidentallyUndefined) }, + "undefined is still an argument" + ) + t.ok(result.match(/\/undefined$/), "undefined is stringified") + + t.equal( + resolveUrl("http://foo.org/test", undefined, {}, ["a/b"], null), + "http://foo.org/a/null", + "arguments are stringified" + ) + +}) diff --git a/node_modules/resolve/.editorconfig b/node_modules/resolve/.editorconfig new file mode 100644 index 0000000..ac29ade --- /dev/null +++ b/node_modules/resolve/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 120 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/resolve/.eslintignore b/node_modules/resolve/.eslintignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/node_modules/resolve/.eslintignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/resolve/.eslintrc b/node_modules/resolve/.eslintrc new file mode 100644 index 0000000..9db19a4 --- /dev/null +++ b/node_modules/resolve/.eslintrc @@ -0,0 +1,30 @@ +{ + "extends": "@ljharb", + "root": true, + "rules": { + "array-bracket-newline": 0, + "array-element-newline": 0, + "indent": [2, 4], + "strict": 0, + "complexity": 0, + "consistent-return": 0, + "curly": 0, + "dot-notation": [2, { "allowKeywords": true }], + "func-name-matching": 0, + "func-style": 0, + "global-require": 0, + "id-length": [2, { "min": 1, "max": 30 }], + "max-nested-callbacks": 0, + "max-params": 0, + "max-statements-per-line": [2, { "max": 2 }], + "max-statements": 0, + "no-magic-numbers": 0, + "no-console": 0, + "no-shadow": 0, + "no-unused-vars": [2, { "vars": "all", "args": "none" }], + "no-use-before-define": 0, + "object-curly-newline": 0, + "operator-linebreak": [2, "before"], + "sort-keys": 0, + } +} diff --git a/node_modules/resolve/.travis.yml b/node_modules/resolve/.travis.yml new file mode 100644 index 0000000..099f694 --- /dev/null +++ b/node_modules/resolve/.travis.yml @@ -0,0 +1,173 @@ +language: node_js +os: + - linux +node_js: + - "8.8" + - "7.10" + - "6.11" + - "5.12" + - "4.8" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.10" + - "0.8" +before_install: + - 'nvm install-latest-npm' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "node" + env: PRETEST=true + - node_js: "8.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true diff --git a/node_modules/resolve/LICENSE b/node_modules/resolve/LICENSE new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/node_modules/resolve/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/resolve/appveyor.yml b/node_modules/resolve/appveyor.yml new file mode 100644 index 0000000..f54a1b6 --- /dev/null +++ b/node_modules/resolve/appveyor.yml @@ -0,0 +1,44 @@ +version: 1.0.{build} +skip_branch_with_pr: true +build: off + +environment: + matrix: + - nodejs_version: "7" + - nodejs_version: "6" + - nodejs_version: "5" + - nodejs_version: "4" + - nodejs_version: "3" + - nodejs_version: "2" + - nodejs_version: "1" + - nodejs_version: "0.12" + - nodejs_version: "0.10" + - nodejs_version: "0.8" + - nodejs_version: "0.6" +matrix: + # fast_finish: true + allow_failures: + - nodejs_version: "0.6" + +platform: + - x86 + - x64 + +# Install scripts. (runs after repo cloning) +install: + # Get the latest stable version of Node.js or io.js + - ps: Install-Product node $env:nodejs_version $env:platform + - IF %nodejs_version% EQU 0.6 npm -g install npm@1.3 + - IF %nodejs_version% EQU 0.8 npm -g install npm@2 + - set PATH=%APPDATA%\npm;%PATH% + #- IF %nodejs_version% NEQ 0.6 AND %nodejs_version% NEQ 0.8 npm -g install npm + # install modules + - npm install + +# Post-install test scripts. +test_script: + # Output useful info for debugging. + - node --version + - npm --version + # run tests + - npm run tests-only diff --git a/node_modules/resolve/example/async.js b/node_modules/resolve/example/async.js new file mode 100644 index 0000000..20e65dc --- /dev/null +++ b/node_modules/resolve/example/async.js @@ -0,0 +1,5 @@ +var resolve = require('../'); +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err); + else console.log(res); +}); diff --git a/node_modules/resolve/example/sync.js b/node_modules/resolve/example/sync.js new file mode 100644 index 0000000..54b2cc1 --- /dev/null +++ b/node_modules/resolve/example/sync.js @@ -0,0 +1,3 @@ +var resolve = require('../'); +var res = resolve.sync('tap', { basedir: __dirname }); +console.log(res); diff --git a/node_modules/resolve/index.js b/node_modules/resolve/index.js new file mode 100644 index 0000000..eb6ba89 --- /dev/null +++ b/node_modules/resolve/index.js @@ -0,0 +1,8 @@ +var core = require('./lib/core'); +var async = require('./lib/async'); +async.core = core; +async.isCore = function isCore(x) { return core[x]; }; +async.sync = require('./lib/sync'); + +exports = async; +module.exports = async; diff --git a/node_modules/resolve/lib/async.js b/node_modules/resolve/lib/async.js new file mode 100644 index 0000000..ef1bde7 --- /dev/null +++ b/node_modules/resolve/lib/async.js @@ -0,0 +1,203 @@ +var core = require('./core'); +var fs = require('fs'); +var path = require('path'); +var caller = require('./caller.js'); +var nodeModulesPaths = require('./node-modules-paths.js'); + +module.exports = function resolve(x, options, callback) { + var cb = callback; + var opts = options || {}; + if (typeof opts === 'function') { + cb = opts; + opts = {}; + } + if (typeof x !== 'string') { + var err = new TypeError('Path must be a string.'); + return process.nextTick(function () { + cb(err); + }); + } + + var isFile = opts.isFile || function (file, cb) { + fs.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }; + var readFile = opts.readFile || fs.readFile; + + var extensions = opts.extensions || ['.js']; + var y = opts.basedir || path.dirname(caller()); + + opts.paths = opts.paths || []; + + if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) { + var res = path.resolve(y, x); + if (x === '..' || x.slice(-1) === '/') res += '/'; + if (/\/$/.test(x) && res === y) { + loadAsDirectory(res, opts.package, onfile); + } else loadAsFile(res, opts.package, onfile); + } else loadNodeModules(x, y, function (err, n, pkg) { + if (err) cb(err); + else if (n) cb(null, n, pkg); + else if (core[x]) return cb(null, x); + else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + y + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + + function onfile(err, m, pkg) { + if (err) cb(err); + else if (m) cb(null, m, pkg); + else loadAsDirectory(res, function (err, d, pkg) { + if (err) cb(err); + else if (d) cb(null, d, pkg); + else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + y + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function loadAsFile(x, thePackage, callback) { + var loadAsFilePackage = thePackage; + var cb = callback; + if (typeof loadAsFilePackage === 'function') { + cb = loadAsFilePackage; + loadAsFilePackage = undefined; + } + + var exts = [''].concat(extensions); + load(exts, x, loadAsFilePackage); + + function load(exts, x, loadPackage) { + if (exts.length === 0) return cb(null, undefined, loadPackage); + var file = x + exts[0]; + + var pkg = loadPackage; + if (pkg) onpkg(null, pkg); + else loadpkg(path.dirname(file), onpkg); + + function onpkg(err, pkg_, dir) { + pkg = pkg_; + if (err) return cb(err); + if (dir && pkg && opts.pathFilter) { + var rfile = path.relative(dir, file); + var rel = rfile.slice(0, rfile.length - exts[0].length); + var r = opts.pathFilter(pkg, x, rel); + if (r) return load( + [''].concat(extensions.slice()), + path.resolve(dir, r), + pkg + ); + } + isFile(file, onex); + } + function onex(err, ex) { + if (err) return cb(err); + if (ex) return cb(null, file, pkg); + load(exts.slice(1), x, pkg); + } + } + } + + function loadpkg(dir, cb) { + if (dir === '' || dir === '/') return cb(null); + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { + return cb(null); + } + if (/[/\\]node_modules[/\\]*$/.test(dir)) return cb(null); + + var pkgfile = path.join(dir, 'package.json'); + isFile(pkgfile, function (err, ex) { + // on err, ex is false + if (!ex) return loadpkg(path.dirname(dir), cb); + + readFile(pkgfile, function (err, body) { + if (err) cb(err); + try { var pkg = JSON.parse(body); } catch (jsonErr) {} + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + cb(null, pkg, dir); + }); + }); + } + + function loadAsDirectory(x, loadAsDirectoryPackage, callback) { + var cb = callback; + var fpkg = loadAsDirectoryPackage; + if (typeof fpkg === 'function') { + cb = fpkg; + fpkg = opts.package; + } + + var pkgfile = path.join(x, 'package.json'); + isFile(pkgfile, function (err, ex) { + if (err) return cb(err); + if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb); + + readFile(pkgfile, function (err, body) { + if (err) return cb(err); + try { + var pkg = JSON.parse(body); + } catch (jsonErr) {} + + if (opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + + if (pkg.main) { + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb); + + var dir = path.resolve(x, pkg.main); + loadAsDirectory(dir, pkg, function (err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + loadAsFile(path.join(x, 'index'), pkg, cb); + }); + }); + return; + } + + loadAsFile(path.join(x, '/index'), pkg, cb); + }); + }); + } + + function processDirs(cb, dirs) { + if (dirs.length === 0) return cb(null, undefined); + var dir = dirs[0]; + + var file = path.join(dir, x); + loadAsFile(file, undefined, onfile); + + function onfile(err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + loadAsDirectory(path.join(dir, x), undefined, ondir); + } + + function ondir(err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + processDirs(cb, dirs.slice(1)); + } + } + function loadNodeModules(x, start, cb) { + processDirs(cb, nodeModulesPaths(start, opts)); + } +}; diff --git a/node_modules/resolve/lib/caller.js b/node_modules/resolve/lib/caller.js new file mode 100644 index 0000000..b14a280 --- /dev/null +++ b/node_modules/resolve/lib/caller.js @@ -0,0 +1,8 @@ +module.exports = function () { + // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi + var origPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = function (_, stack) { return stack; }; + var stack = (new Error()).stack; + Error.prepareStackTrace = origPrepareStackTrace; + return stack[2].getFileName(); +}; diff --git a/node_modules/resolve/lib/core.js b/node_modules/resolve/lib/core.js new file mode 100644 index 0000000..5386d4d --- /dev/null +++ b/node_modules/resolve/lib/core.js @@ -0,0 +1,34 @@ +var current = (process.versions && process.versions.node && process.versions.node.split('.')) || []; + +function versionIncluded(specifier) { + if (specifier === true) { return true; } + var parts = specifier.split(' '); + var op = parts[0]; + var versionParts = parts[1].split('.'); + + for (var i = 0; i < 3; ++i) { + var cur = Number(current[i] || 0); + var ver = Number(versionParts[i] || 0); + if (cur === ver) { + continue; // eslint-disable-line no-restricted-syntax, no-continue + } + if (op === '<') { + return cur < ver; + } else if (op === '>=') { + return cur >= ver; + } else { + return false; + } + } + return false; +} + +var data = require('./core.json'); + +var core = {}; +for (var mod in data) { // eslint-disable-line no-restricted-syntax + if (Object.prototype.hasOwnProperty.call(data, mod)) { + core[mod] = versionIncluded(data[mod]); + } +} +module.exports = core; diff --git a/node_modules/resolve/lib/core.json b/node_modules/resolve/lib/core.json new file mode 100644 index 0000000..668301f --- /dev/null +++ b/node_modules/resolve/lib/core.json @@ -0,0 +1,43 @@ +{ + "assert": true, + "buffer_ieee754": "< 0.9.7", + "buffer": true, + "child_process": true, + "cluster": true, + "console": true, + "constants": true, + "crypto": true, + "_debugger": "< 8", + "dgram": true, + "dns": true, + "domain": true, + "events": true, + "freelist": "< 6", + "fs": true, + "http": true, + "http2": ">= 8.8", + "https": true, + "_http_server": ">= 0.11", + "_linklist": "< 8", + "module": true, + "net": true, + "os": true, + "path": true, + "perf_hooks": ">= 8.5", + "process": ">= 1", + "punycode": true, + "querystring": true, + "readline": true, + "repl": true, + "stream": true, + "string_decoder": true, + "sys": true, + "timers": true, + "tls": true, + "tty": true, + "url": true, + "util": true, + "v8": ">= 1", + "vm": true, + "zlib": true +} diff --git a/node_modules/resolve/lib/node-modules-paths.js b/node_modules/resolve/lib/node-modules-paths.js new file mode 100644 index 0000000..a4bde6a --- /dev/null +++ b/node_modules/resolve/lib/node-modules-paths.js @@ -0,0 +1,45 @@ +var path = require('path'); +var fs = require('fs'); +var parse = path.parse || require('path-parse'); + +module.exports = function nodeModulesPaths(start, opts) { + var modules = opts && opts.moduleDirectory + ? [].concat(opts.moduleDirectory) + : ['node_modules']; + + // ensure that `start` is an absolute path at this point, + // resolving against the process' current working directory + var absoluteStart = path.resolve(start); + + if (opts && opts.preserveSymlinks === false) { + try { + absoluteStart = fs.realpathSync(absoluteStart); + } catch (err) { + if (err.code !== 'ENOENT') { + throw err; + } + } + } + + var prefix = '/'; + if (/^([A-Za-z]:)/.test(absoluteStart)) { + prefix = ''; + } else if (/^\\\\/.test(absoluteStart)) { + prefix = '\\\\'; + } + + var paths = [absoluteStart]; + var parsed = parse(absoluteStart); + while (parsed.dir !== paths[paths.length - 1]) { + paths.push(parsed.dir); + parsed = parse(parsed.dir); + } + + var dirs = paths.reduce(function (dirs, aPath) { + return dirs.concat(modules.map(function (moduleDir) { + return path.join(prefix, aPath, moduleDir); + })); + }, []); + + return opts && opts.paths ? dirs.concat(opts.paths) : dirs; +}; diff --git a/node_modules/resolve/lib/sync.js b/node_modules/resolve/lib/sync.js new file mode 100644 index 0000000..bc9e287 --- /dev/null +++ b/node_modules/resolve/lib/sync.js @@ -0,0 +1,93 @@ +var core = require('./core'); +var fs = require('fs'); +var path = require('path'); +var caller = require('./caller.js'); +var nodeModulesPaths = require('./node-modules-paths.js'); + +module.exports = function (x, options) { + if (typeof x !== 'string') { + throw new TypeError('Path must be a string.'); + } + var opts = options || {}; + var isFile = opts.isFile || function (file) { + try { + var stat = fs.statSync(file); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isFile() || stat.isFIFO(); + }; + var readFileSync = opts.readFileSync || fs.readFileSync; + + var extensions = opts.extensions || ['.js']; + var y = opts.basedir || path.dirname(caller()); + + opts.paths = opts.paths || []; + + if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) { + var res = path.resolve(y, x); + if (x === '..' || x.slice(-1) === '/') res += '/'; + var m = loadAsFileSync(res) || loadAsDirectorySync(res); + if (m) return m; + } else { + var n = loadNodeModulesSync(x, y); + if (n) return n; + } + + if (core[x]) return x; + + var err = new Error("Cannot find module '" + x + "' from '" + y + "'"); + err.code = 'MODULE_NOT_FOUND'; + throw err; + + function loadAsFileSync(x) { + if (isFile(x)) { + return x; + } + + for (var i = 0; i < extensions.length; i++) { + var file = x + extensions[i]; + if (isFile(file)) { + return file; + } + } + } + + function loadAsDirectorySync(x) { + var pkgfile = path.join(x, '/package.json'); + if (isFile(pkgfile)) { + try { + var body = readFileSync(pkgfile, 'UTF8'); + var pkg = JSON.parse(body); + + if (opts.packageFilter) { + pkg = opts.packageFilter(pkg, x); + } + + if (pkg.main) { + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + var m = loadAsFileSync(path.resolve(x, pkg.main)); + if (m) return m; + var n = loadAsDirectorySync(path.resolve(x, pkg.main)); + if (n) return n; + } + } catch (e) {} + } + + return loadAsFileSync(path.join(x, '/index')); + } + + function loadNodeModulesSync(x, start) { + var dirs = nodeModulesPaths(start, opts); + for (var i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + var m = loadAsFileSync(path.join(dir, '/', x)); + if (m) return m; + var n = loadAsDirectorySync(path.join(dir, '/', x)); + if (n) return n; + } + } +}; diff --git a/node_modules/resolve/package.json b/node_modules/resolve/package.json new file mode 100644 index 0000000..d0cc4b9 --- /dev/null +++ b/node_modules/resolve/package.json @@ -0,0 +1,69 @@ +{ + "_from": "resolve@^1.1.6", + "_id": "resolve@1.5.0", + "_inBundle": false, + "_integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", + "_location": "/resolve", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "resolve@^1.1.6", + "name": "resolve", + "escapedName": "resolve", + "rawSpec": "^1.1.6", + "saveSpec": null, + "fetchSpec": "^1.1.6" + }, + "_requiredBy": [ + "/pug-filters" + ], + "_resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", + "_shasum": "1f09acce796c9a762579f31b2c1cc4c3cddf9f36", + "_spec": "resolve@^1.1.6", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/pug-filters", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "bugs": { + "url": "https://github.com/browserify/node-resolve/issues" + }, + "bundleDependencies": false, + "dependencies": { + "path-parse": "^1.0.5" + }, + "deprecated": false, + "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", + "devDependencies": { + "@ljharb/eslint-config": "^12.2.1", + "eslint": "^4.9.0", + "object-keys": "^1.0.11", + "safe-publish-latest": "^1.1.1", + "tap": "0.4.13", + "tape": "^4.8.0" + }, + "homepage": "https://github.com/browserify/node-resolve#readme", + "keywords": [ + "resolve", + "require", + "node", + "module" + ], + "license": "MIT", + "main": "index.js", + "name": "resolve", + "repository": { + "type": "git", + "url": "git://github.com/browserify/node-resolve.git" + }, + "scripts": { + "lint": "eslint .", + "prepublish": "safe-publish-latest", + "pretest": "npm run lint", + "test": "npm run --silent tests-only", + "tests-only": "tape test/*.js" + }, + "version": "1.5.0" +} diff --git a/node_modules/resolve/readme.markdown b/node_modules/resolve/readme.markdown new file mode 100644 index 0000000..6000624 --- /dev/null +++ b/node_modules/resolve/readme.markdown @@ -0,0 +1,160 @@ +# resolve + +implements the [node `require.resolve()` +algorithm](https://nodejs.org/api/modules.html#modules_all_together) +such that you can `require.resolve()` on behalf of a file asynchronously and +synchronously + +[![build status](https://secure.travis-ci.org/browserify/node-resolve.png)](http://travis-ci.org/browserify/node-resolve) + +# example + +asynchronously resolve: + +``` js +var resolve = require('resolve'); +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err) + else console.log(res) +}); +``` + +``` +$ node example/async.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +synchronously resolve: + +``` js +var resolve = require('resolve'); +var res = resolve.sync('tap', { basedir: __dirname }); +console.log(res); +``` + +``` +$ node example/sync.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +# methods + +``` js +var resolve = require('resolve') +``` + +## resolve(id, opts={}, cb) + +Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.package - `package.json` data applicable to the module being loaded + +* opts.extensions - array of file extensions to search in order + +* opts.readFile - how to read files asynchronously + +* opts.isFile - function to asynchronously test whether a file exists + +* opts.packageFilter - transform the parsed package.json contents before looking +at the "main" field + +* opts.pathFilter(pkg, path, relativePath) - transform a path within a package + * pkg - package data + * path - the path being resolved + * relativePath - the path relative from the package.json location + * returns - a relative path that will be joined from the package.json location + +* opts.paths - require.paths array to use if nothing is found on the normal +node_modules recursive walk (probably don't use this) + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. +**Note:** this property is currently `true` by default but it will be changed to +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. + +default `opts` values: + +``` javascript +{ + paths: [], + basedir: __dirname, + extensions: [ '.js' ], + readFile: fs.readFile, + isFile: function (file, cb) { + fs.stat(file, function (err, stat) { + if (err && err.code === 'ENOENT') cb(null, false) + else if (err) cb(err) + else cb(null, stat.isFile()) + }); + }, + moduleDirectory: 'node_modules', + preserveSymlinks: true +} +``` + +## resolve.sync(id, opts) + +Synchronously resolve the module path string `id`, returning the result and +throwing an error when `id` can't be resolved. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.extensions - array of file extensions to search in order + +* opts.readFile - how to read files synchronously + +* opts.isFile - function to synchronously test whether a file exists + +* `opts.packageFilter(pkg, pkgfile)` - transform the parsed package.json +* contents before looking at the "main" field + +* opts.paths - require.paths array to use if nothing is found on the normal +node_modules recursive walk (probably don't use this) + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. +**Note:** this property is currently `true` by default but it will be changed to +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. + +default `opts` values: + +``` javascript +{ + paths: [], + basedir: __dirname, + extensions: [ '.js' ], + readFileSync: fs.readFileSync, + isFile: function (file) { + try { return fs.statSync(file).isFile() } + catch (e) { return false } + }, + moduleDirectory: 'node_modules', + preserveSymlinks: true +} +```` + +## resolve.isCore(pkg) + +Return whether a package is in core. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install resolve +``` + +# license + +MIT diff --git a/node_modules/resolve/test/core.js b/node_modules/resolve/test/core.js new file mode 100644 index 0000000..978c867 --- /dev/null +++ b/node_modules/resolve/test/core.js @@ -0,0 +1,36 @@ +var test = require('tape'); +var keys = require('object-keys'); +var resolve = require('../'); + +test('core modules', function (t) { + t.test('isCore()', function (st) { + st.ok(resolve.isCore('fs')); + st.ok(resolve.isCore('net')); + st.ok(resolve.isCore('http')); + + st.ok(!resolve.isCore('seq')); + st.ok(!resolve.isCore('../')); + st.end(); + }); + + t.test('core list', function (st) { + var cores = keys(resolve.core); + st.plan(cores.length); + + for (var i = 0; i < cores.length; ++i) { + var mod = cores[i]; + if (resolve.core[mod]) { + st.doesNotThrow( + function () { require(mod); }, // eslint-disable-line no-loop-func + 'requiring ' + mod + ' does not throw' + ); + } else { + st.skip(mod + ' not supported'); + } + } + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/resolve/test/dotdot.js b/node_modules/resolve/test/dotdot.js new file mode 100644 index 0000000..3080665 --- /dev/null +++ b/node_modules/resolve/test/dotdot.js @@ -0,0 +1,29 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('dotdot', function (t) { + t.plan(4); + var dir = path.join(__dirname, '/dotdot/abc'); + + resolve('..', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'dotdot/index.js')); + }); + + resolve('.', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, 'index.js')); + }); +}); + +test('dotdot sync', function (t) { + t.plan(2); + var dir = path.join(__dirname, '/dotdot/abc'); + + var a = resolve.sync('..', { basedir: dir }); + t.equal(a, path.join(__dirname, 'dotdot/index.js')); + + var b = resolve.sync('.', { basedir: dir }); + t.equal(b, path.join(dir, 'index.js')); +}); diff --git a/node_modules/resolve/test/dotdot/abc/index.js b/node_modules/resolve/test/dotdot/abc/index.js new file mode 100644 index 0000000..67f2534 --- /dev/null +++ b/node_modules/resolve/test/dotdot/abc/index.js @@ -0,0 +1,2 @@ +var x = require('..'); +console.log(x); diff --git a/node_modules/resolve/test/dotdot/index.js b/node_modules/resolve/test/dotdot/index.js new file mode 100644 index 0000000..643f9fc --- /dev/null +++ b/node_modules/resolve/test/dotdot/index.js @@ -0,0 +1 @@ +module.exports = 'whatever'; diff --git a/node_modules/resolve/test/faulty_basedir.js b/node_modules/resolve/test/faulty_basedir.js new file mode 100644 index 0000000..e20d937 --- /dev/null +++ b/node_modules/resolve/test/faulty_basedir.js @@ -0,0 +1,13 @@ +var test = require('tape'); +var resolve = require('../'); + +test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) { + t.plan(1); + + var resolverDir = 'C:\\a\\b\\c\\d'; + + resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(true, !!err); + }); + +}); diff --git a/node_modules/resolve/test/filter.js b/node_modules/resolve/test/filter.js new file mode 100644 index 0000000..51a753f --- /dev/null +++ b/node_modules/resolve/test/filter.js @@ -0,0 +1,19 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + t.plan(2); + var dir = path.join(__dirname, 'resolver'); + resolve('./baz', { + basedir: dir, + packageFilter: function (pkg) { + pkg.main = 'doom'; + return pkg; + } + }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'baz/doom.js')); + t.equal(pkg.main, 'doom'); + }); +}); diff --git a/node_modules/resolve/test/filter_sync.js b/node_modules/resolve/test/filter_sync.js new file mode 100644 index 0000000..fd4e97c --- /dev/null +++ b/node_modules/resolve/test/filter_sync.js @@ -0,0 +1,16 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + var dir = path.join(__dirname, 'resolver'); + var res = resolve.sync('./baz', { + basedir: dir, + packageFilter: function (pkg) { + pkg.main = 'doom'; + return pkg; + } + }); + t.equal(res, path.join(dir, 'baz/doom.js')); + t.end(); +}); diff --git a/node_modules/resolve/test/mock.js b/node_modules/resolve/test/mock.js new file mode 100644 index 0000000..a88059d --- /dev/null +++ b/node_modules/resolve/test/mock.js @@ -0,0 +1,143 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(8); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('mock from package', function (t) { + t.plan(8); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, file)); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[file]); + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg && pkg.main, 'bar'); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg && pkg.main, 'bar'); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('mock package', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + } + }; + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + t.equal(pkg && pkg.main, './baz.js'); + }); +}); + +test('mock package from package', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + } + }; + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + t.equal(pkg && pkg.main, './baz.js'); + }); +}); diff --git a/node_modules/resolve/test/mock_sync.js b/node_modules/resolve/test/mock_sync.js new file mode 100644 index 0000000..43af102 --- /dev/null +++ b/node_modules/resolve/test/mock_sync.js @@ -0,0 +1,67 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(4); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, file); + }, + readFileSync: function (file) { + return files[file]; + } + }; + } + + t.equal( + resolve.sync('./baz', opts('/foo/bar')), + path.resolve('/foo/bar/baz.js') + ); + + t.equal( + resolve.sync('./baz.js', opts('/foo/bar')), + path.resolve('/foo/bar/baz.js') + ); + + t.throws(function () { + resolve.sync('baz', opts('/foo/bar')); + }); + + t.throws(function () { + resolve.sync('../baz', opts('/foo/bar')); + }); +}); + +test('mock package', function (t) { + t.plan(1); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, file); + }, + readFileSync: function (file) { + return files[file]; + } + }; + } + + t.equal( + resolve.sync('bar', opts('/foo')), + path.resolve('/foo/node_modules/bar/baz.js') + ); +}); diff --git a/node_modules/resolve/test/module_dir.js b/node_modules/resolve/test/module_dir.js new file mode 100644 index 0000000..b50e5bb --- /dev/null +++ b/node_modules/resolve/test/module_dir.js @@ -0,0 +1,56 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('moduleDirectory strings', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'module_dir'); + var xopts = { + basedir: dir, + moduleDirectory: 'xmodules' + }; + resolve('aaa', xopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); + }); + + var yopts = { + basedir: dir, + moduleDirectory: 'ymodules' + }; + resolve('aaa', yopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); + }); +}); + +test('moduleDirectory array', function (t) { + t.plan(6); + var dir = path.join(__dirname, 'module_dir'); + var aopts = { + basedir: dir, + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] + }; + resolve('aaa', aopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); + }); + + var bopts = { + basedir: dir, + moduleDirectory: ['zmodules', 'ymodules', 'xmodules'] + }; + resolve('aaa', bopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); + }); + + var copts = { + basedir: dir, + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] + }; + resolve('bbb', copts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/zmodules/bbb/main.js')); + }); +}); diff --git a/node_modules/resolve/test/module_dir/xmodules/aaa/index.js b/node_modules/resolve/test/module_dir/xmodules/aaa/index.js new file mode 100644 index 0000000..dd7cf7b --- /dev/null +++ b/node_modules/resolve/test/module_dir/xmodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x * 100; }; diff --git a/node_modules/resolve/test/module_dir/ymodules/aaa/index.js b/node_modules/resolve/test/module_dir/ymodules/aaa/index.js new file mode 100644 index 0000000..ef2d4d4 --- /dev/null +++ b/node_modules/resolve/test/module_dir/ymodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x + 100; }; diff --git a/node_modules/resolve/test/module_dir/zmodules/bbb/main.js b/node_modules/resolve/test/module_dir/zmodules/bbb/main.js new file mode 100644 index 0000000..e8ba629 --- /dev/null +++ b/node_modules/resolve/test/module_dir/zmodules/bbb/main.js @@ -0,0 +1 @@ +module.exports = function (n) { return n * 111; }; diff --git a/node_modules/resolve/test/module_dir/zmodules/bbb/package.json b/node_modules/resolve/test/module_dir/zmodules/bbb/package.json new file mode 100644 index 0000000..c13b8cf --- /dev/null +++ b/node_modules/resolve/test/module_dir/zmodules/bbb/package.json @@ -0,0 +1,3 @@ +{ + "main": "main.js" +} diff --git a/node_modules/resolve/test/node-modules-paths.js b/node_modules/resolve/test/node-modules-paths.js new file mode 100644 index 0000000..a917f06 --- /dev/null +++ b/node_modules/resolve/test/node-modules-paths.js @@ -0,0 +1,93 @@ +var test = require('tape'); +var path = require('path'); +var parse = path.parse || require('path-parse'); +var keys = require('object-keys'); + +var nodeModulesPaths = require('../lib/node-modules-paths'); + +var verifyDirs = function verifyDirs(t, start, dirs, moduleDirectories, paths) { + var moduleDirs = [].concat(moduleDirectories || 'node_modules'); + + var foundModuleDirs = {}; + var uniqueDirs = {}; + var parsedDirs = {}; + for (var i = 0; i < dirs.length; ++i) { + var parsed = parse(dirs[i]); + if (!foundModuleDirs[parsed.base]) { foundModuleDirs[parsed.base] = 0; } + foundModuleDirs[parsed.base] += 1; + parsedDirs[parsed.dir] = true; + uniqueDirs[dirs[i]] = true; + } + t.equal(keys(parsedDirs).length >= start.split(path.sep).length, true, 'there are >= dirs than "start" has'); + var foundModuleDirNames = keys(foundModuleDirs); + t.deepEqual(foundModuleDirNames, moduleDirs.concat(paths || []), 'all desired module dirs were found'); + t.equal(keys(uniqueDirs).length, dirs.length, 'all dirs provided were unique'); + + var counts = {}; + for (var j = 0; j < foundModuleDirNames.length; ++j) { + counts[foundModuleDirs[j]] = true; + } + t.equal(keys(counts).length, 1, 'all found module directories had the same count'); +}; + +test('node-modules-paths', function (t) { + t.test('no options', function (t) { + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start); + + verifyDirs(t, start, dirs); + + t.end(); + }); + + t.test('empty options', function (t) { + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, {}); + + verifyDirs(t, start, dirs); + + t.end(); + }); + + t.test('with paths option', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var dirs = nodeModulesPaths(start, { paths: paths }); + + verifyDirs(t, start, dirs, null, paths); + + t.end(); + }); + + t.test('with moduleDirectory option', function (t) { + var start = path.join(__dirname, 'resolver'); + var moduleDirectory = 'not node modules'; + var dirs = nodeModulesPaths(start, { moduleDirectory: moduleDirectory }); + + verifyDirs(t, start, dirs, moduleDirectory); + + t.end(); + }); + + t.test('with 1 moduleDirectory and paths options', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var moduleDirectory = 'not node modules'; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectory }); + + verifyDirs(t, start, dirs, moduleDirectory, paths); + + t.end(); + }); + + t.test('with 1+ moduleDirectory and paths options', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var moduleDirectories = ['not node modules', 'other modules']; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + verifyDirs(t, start, dirs, moduleDirectories, paths); + + t.end(); + }); +}); diff --git a/node_modules/resolve/test/node_path.js b/node_modules/resolve/test/node_path.js new file mode 100644 index 0000000..38a7d7e --- /dev/null +++ b/node_modules/resolve/test/node_path.js @@ -0,0 +1,49 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('$NODE_PATH', function (t) { + t.plan(4); + + resolve('aaa', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname + }, function (err, res) { + t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js')); + }); + + resolve('bbb', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname + }, function (err, res) { + t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js')); + }); + + resolve('ccc', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname + }, function (err, res) { + t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js')); + }); + + // ensure that relative paths still resolve against the + // regular `node_modules` correctly + resolve('tap', { + paths: [ + 'node_path' + ], + basedir: 'node_path/x' + }, function (err, res) { + var root = require('tap/package.json').main; + t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root)); + }); +}); diff --git a/node_modules/resolve/test/node_path/x/aaa/index.js b/node_modules/resolve/test/node_path/x/aaa/index.js new file mode 100644 index 0000000..ad70d0b --- /dev/null +++ b/node_modules/resolve/test/node_path/x/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'A'; diff --git a/node_modules/resolve/test/node_path/x/ccc/index.js b/node_modules/resolve/test/node_path/x/ccc/index.js new file mode 100644 index 0000000..a64132e --- /dev/null +++ b/node_modules/resolve/test/node_path/x/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'C'; diff --git a/node_modules/resolve/test/node_path/y/bbb/index.js b/node_modules/resolve/test/node_path/y/bbb/index.js new file mode 100644 index 0000000..4d0f32e --- /dev/null +++ b/node_modules/resolve/test/node_path/y/bbb/index.js @@ -0,0 +1 @@ +module.exports = 'B'; diff --git a/node_modules/resolve/test/node_path/y/ccc/index.js b/node_modules/resolve/test/node_path/y/ccc/index.js new file mode 100644 index 0000000..793315e --- /dev/null +++ b/node_modules/resolve/test/node_path/y/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'CY'; diff --git a/node_modules/resolve/test/nonstring.js b/node_modules/resolve/test/nonstring.js new file mode 100644 index 0000000..ef63c40 --- /dev/null +++ b/node_modules/resolve/test/nonstring.js @@ -0,0 +1,9 @@ +var test = require('tape'); +var resolve = require('../'); + +test('nonstring', function (t) { + t.plan(1); + resolve(555, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/node_modules/resolve/test/pathfilter.js b/node_modules/resolve/test/pathfilter.js new file mode 100644 index 0000000..733045a --- /dev/null +++ b/node_modules/resolve/test/pathfilter.js @@ -0,0 +1,42 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('#62: deep module references and the pathFilter', function (t) { + t.plan(9); + + var resolverDir = path.join(__dirname, '/pathfilter/deep_ref'); + var pathFilter = function (pkg, x, remainder) { + t.equal(pkg.version, '1.2.3'); + t.equal(x, path.join(resolverDir, 'node_modules/deep/ref')); + t.equal(remainder, 'ref'); + return 'alt'; + }; + + resolve('deep/ref', { basedir: resolverDir }, function (err, res, pkg) { + if (err) t.fail(err); + + t.equal(pkg.version, '1.2.3'); + t.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); + }); + + resolve( + 'deep/deeper/ref', + { basedir: resolverDir }, + function (err, res, pkg) { + if (err) t.fail(err); + t.notEqual(pkg, undefined); + t.equal(pkg.version, '1.2.3'); + t.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); + } + ); + + resolve( + 'deep/ref', + { basedir: resolverDir, pathFilter: pathFilter }, + function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); + } + ); +}); diff --git a/node_modules/resolve/test/pathfilter/deep_ref/main.js b/node_modules/resolve/test/pathfilter/deep_ref/main.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/precedence.js b/node_modules/resolve/test/precedence.js new file mode 100644 index 0000000..2febb59 --- /dev/null +++ b/node_modules/resolve/test/precedence.js @@ -0,0 +1,23 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('precedence', function (t) { + t.plan(3); + var dir = path.join(__dirname, 'precedence/aaa'); + + resolve('./', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, 'index.js')); + t.equal(pkg.name, 'resolve'); + }); +}); + +test('./ should not load ${dir}.js', function (t) { // eslint-disable-line no-template-curly-in-string + t.plan(1); + var dir = path.join(__dirname, 'precedence/bbb'); + + resolve('./', { basedir: dir }, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/node_modules/resolve/test/precedence/aaa.js b/node_modules/resolve/test/precedence/aaa.js new file mode 100644 index 0000000..b83a3e7 --- /dev/null +++ b/node_modules/resolve/test/precedence/aaa.js @@ -0,0 +1 @@ +module.exports = 'wtf'; diff --git a/node_modules/resolve/test/precedence/aaa/index.js b/node_modules/resolve/test/precedence/aaa/index.js new file mode 100644 index 0000000..e0f8f6a --- /dev/null +++ b/node_modules/resolve/test/precedence/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'okok'; diff --git a/node_modules/resolve/test/precedence/aaa/main.js b/node_modules/resolve/test/precedence/aaa/main.js new file mode 100644 index 0000000..93542a9 --- /dev/null +++ b/node_modules/resolve/test/precedence/aaa/main.js @@ -0,0 +1 @@ +console.log(require('./')); diff --git a/node_modules/resolve/test/precedence/bbb.js b/node_modules/resolve/test/precedence/bbb.js new file mode 100644 index 0000000..2298f47 --- /dev/null +++ b/node_modules/resolve/test/precedence/bbb.js @@ -0,0 +1 @@ +module.exports = '>_<'; diff --git a/node_modules/resolve/test/precedence/bbb/main.js b/node_modules/resolve/test/precedence/bbb/main.js new file mode 100644 index 0000000..716b81d --- /dev/null +++ b/node_modules/resolve/test/precedence/bbb/main.js @@ -0,0 +1 @@ +console.log(require('./')); // should throw diff --git a/node_modules/resolve/test/resolver.js b/node_modules/resolve/test/resolver.js new file mode 100644 index 0000000..56641df --- /dev/null +++ b/node_modules/resolve/test/resolver.js @@ -0,0 +1,349 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('async foo', function (t) { + t.plan(10); + var dir = path.join(__dirname, 'resolver'); + + resolve('./foo', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.name, 'resolve'); + }); + + resolve('./foo.js', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.name, 'resolve'); + }); + + resolve('./foo', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.main, 'resolver'); + }); + + resolve('./foo.js', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg.main, 'resolver'); + }); + + resolve('foo', { basedir: dir }, function (err) { + t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('bar', function (t) { + t.plan(6); + var dir = path.join(__dirname, 'resolver'); + + resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir: dir + '/bar', 'package': { main: 'bar' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg, undefined); + }); +}); + +test('baz', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'resolver'); + + resolve('./baz', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'baz/quux.js')); + t.equal(pkg.main, 'quux.js'); + }); + + resolve('./baz', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'baz/quux.js')); + t.equal(pkg.main, 'quux.js'); + }); +}); + +test('biz', function (t) { + t.plan(24); + var dir = path.join(__dirname, 'resolver/biz/node_modules'); + + resolve('./grux', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg, undefined); + }); + + resolve('./grux', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg.main, 'biz'); + }); + + resolve('./garply', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('./garply', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('tiv', { basedir: dir + '/grux' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir: dir + '/grux', 'package': { main: 'grux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir: dir + '/garply' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir: dir + '/garply', 'package': { main: './lib' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('grux', { basedir: dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg, undefined); + }); + + resolve('grux', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg, undefined); + }); + + resolve('garply', { basedir: dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('garply', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); +}); + +test('quux', function (t) { + t.plan(2); + var dir = path.join(__dirname, 'resolver/quux'); + + resolve('./foo', { basedir: dir, 'package': { main: 'quux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo/index.js')); + t.equal(pkg.main, 'quux'); + }); +}); + +test('normalize', function (t) { + t.plan(2); + var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); + + resolve('../grux', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'index.js')); + t.equal(pkg, undefined); + }); +}); + +test('cup', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'resolver'); + + resolve('./cup', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'cup.coffee')); + }); + + resolve('./cup.coffee', { basedir: dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'cup.coffee')); + }); + + resolve('./cup', { basedir: dir, extensions: ['.js'] }, function (err, res) { + t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('mug', function (t) { + t.plan(3); + var dir = path.join(__dirname, 'resolver'); + + resolve('./mug', { basedir: dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'mug.js')); + }); + + resolve('./mug', { basedir: dir, extensions: ['.coffee', '.js'] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, '/mug.coffee')); + }); + + resolve('./mug', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { + t.equal(res, path.join(dir, '/mug.js')); + }); +}); + +test('other path', function (t) { + t.plan(6); + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'bar'); + var otherDir = path.join(resolverDir, 'other_path'); + + resolve('root', { basedir: dir, paths: [otherDir] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'other_path/root.js')); + }); + + resolve('lib/other-lib', { basedir: dir, paths: [otherDir] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'other_path/lib/other-lib.js')); + }); + + resolve('root', { basedir: dir }, function (err, res) { + t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('zzz', { basedir: dir, paths: [otherDir] }, function (err, res) { + t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('incorrect main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'incorrect_main'); + + resolve('./incorrect_main', { basedir: resolverDir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'index.js')); + }); +}); + +test('without basedir', function (t) { + t.plan(1); + + var dir = path.join(__dirname, 'resolver/without_basedir'); + var tester = require(path.join(dir, 'main.js')); + + tester(t, function (err, res, pkg) { + if (err) { + t.fail(err); + } else { + t.equal(res, path.join(dir, 'node_modules/mymodule.js')); + } + }); +}); + +test('#25: node modules with the same name as node stdlib modules', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver/punycode'); + + resolve('punycode', { basedir: resolverDir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'node_modules/punycode/index.js')); + }); +}); + +test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { + t.plan(2); + + var dir = path.join(__dirname, 'resolver'); + + resolve('./foo', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo.js')); + }); + + resolve('./foo/', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); +}); + +test('async: #121 - treating an existing file as a dir when no basedir', function (t) { + var testFile = path.basename(__filename); + + t.test('sanity check', function (st) { + st.plan(1); + resolve('./' + testFile, function (err, res, pkg) { + if (err) t.fail(err); + st.equal(res, __filename, 'sanity check'); + }); + }); + + t.test('with a fake directory', function (st) { + st.plan(4); + + resolve('./' + testFile + '/blah', function (err, res, pkg) { + st.ok(err, 'there is an error'); + st.notOk(res, 'no result'); + + st.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + st.equal( + err && err.message, + 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', + 'can not find nonexistent module' + ); + st.end(); + }); + }); + + t.end(); +}); + +test('async dot main', function (t) { + var start = new Date(); + t.plan(3); + resolve('./resolver/dot_main', function (err, ret) { + t.notOk(err); + t.equal(ret, path.join(__dirname, 'resolver/dot_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); + }); +}); + +test('async dot slash main', function (t) { + var start = new Date(); + t.plan(3); + resolve('./resolver/dot_slash_main', function (err, ret) { + t.notOk(err); + t.equal(ret, path.join(__dirname, 'resolver/dot_slash_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); + }); +}); diff --git a/node_modules/resolve/test/resolver/baz/doom.js b/node_modules/resolve/test/resolver/baz/doom.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/baz/package.json b/node_modules/resolve/test/resolver/baz/package.json new file mode 100644 index 0000000..c41e4db --- /dev/null +++ b/node_modules/resolve/test/resolver/baz/package.json @@ -0,0 +1,3 @@ +{ + "main": "quux.js" +} diff --git a/node_modules/resolve/test/resolver/baz/quux.js b/node_modules/resolve/test/resolver/baz/quux.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/node_modules/resolve/test/resolver/baz/quux.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/cup.coffee b/node_modules/resolve/test/resolver/cup.coffee new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/node_modules/resolve/test/resolver/cup.coffee @@ -0,0 +1 @@ + diff --git a/node_modules/resolve/test/resolver/dot_main/index.js b/node_modules/resolve/test/resolver/dot_main/index.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/node_modules/resolve/test/resolver/dot_main/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/dot_main/package.json b/node_modules/resolve/test/resolver/dot_main/package.json new file mode 100644 index 0000000..d7f4fc8 --- /dev/null +++ b/node_modules/resolve/test/resolver/dot_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "." +} diff --git a/node_modules/resolve/test/resolver/dot_slash_main/index.js b/node_modules/resolve/test/resolver/dot_slash_main/index.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/node_modules/resolve/test/resolver/dot_slash_main/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/dot_slash_main/package.json b/node_modules/resolve/test/resolver/dot_slash_main/package.json new file mode 100644 index 0000000..f51287b --- /dev/null +++ b/node_modules/resolve/test/resolver/dot_slash_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "./" +} diff --git a/node_modules/resolve/test/resolver/foo.js b/node_modules/resolve/test/resolver/foo.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/node_modules/resolve/test/resolver/foo.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/incorrect_main/index.js b/node_modules/resolve/test/resolver/incorrect_main/index.js new file mode 100644 index 0000000..bc1fb0a --- /dev/null +++ b/node_modules/resolve/test/resolver/incorrect_main/index.js @@ -0,0 +1,2 @@ +// this is the actual main file 'index.js', not 'wrong.js' like the package.json would indicate +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/incorrect_main/package.json b/node_modules/resolve/test/resolver/incorrect_main/package.json new file mode 100644 index 0000000..b718804 --- /dev/null +++ b/node_modules/resolve/test/resolver/incorrect_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "wrong.js" +} diff --git a/node_modules/resolve/test/resolver/mug.coffee b/node_modules/resolve/test/resolver/mug.coffee new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/mug.js b/node_modules/resolve/test/resolver/mug.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/other_path/lib/other-lib.js b/node_modules/resolve/test/resolver/other_path/lib/other-lib.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/other_path/root.js b/node_modules/resolve/test/resolver/other_path/root.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/quux/foo/index.js b/node_modules/resolve/test/resolver/quux/foo/index.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/node_modules/resolve/test/resolver/quux/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/same_names/foo.js b/node_modules/resolve/test/resolver/same_names/foo.js new file mode 100644 index 0000000..888cae3 --- /dev/null +++ b/node_modules/resolve/test/resolver/same_names/foo.js @@ -0,0 +1 @@ +module.exports = 42; diff --git a/node_modules/resolve/test/resolver/same_names/foo/index.js b/node_modules/resolve/test/resolver/same_names/foo/index.js new file mode 100644 index 0000000..bd816ea --- /dev/null +++ b/node_modules/resolve/test/resolver/same_names/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep b/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/resolve/test/resolver/without_basedir/main.js b/node_modules/resolve/test/resolver/without_basedir/main.js new file mode 100644 index 0000000..5b31975 --- /dev/null +++ b/node_modules/resolve/test/resolver/without_basedir/main.js @@ -0,0 +1,5 @@ +var resolve = require('../../../'); + +module.exports = function (t, cb) { + resolve('mymodule', null, cb); +}; diff --git a/node_modules/resolve/test/resolver_sync.js b/node_modules/resolve/test/resolver_sync.js new file mode 100644 index 0000000..8e33dca --- /dev/null +++ b/node_modules/resolve/test/resolver_sync.js @@ -0,0 +1,267 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('foo', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./foo', { basedir: dir }), + path.join(dir, 'foo.js') + ); + + t.equal( + resolve.sync('./foo.js', { basedir: dir }), + path.join(dir, 'foo.js') + ); + + t.throws(function () { + resolve.sync('foo', { basedir: dir }); + }); + + t.end(); +}); + +test('bar', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('foo', { basedir: path.join(dir, 'bar') }), + path.join(dir, 'bar/node_modules/foo/index.js') + ); + t.end(); +}); + +test('baz', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./baz', { basedir: dir }), + path.join(dir, 'baz/quux.js') + ); + t.end(); +}); + +test('biz', function (t) { + var dir = path.join(__dirname, 'resolver/biz/node_modules'); + t.equal( + resolve.sync('./grux', { basedir: dir }), + path.join(dir, 'grux/index.js') + ); + + t.equal( + resolve.sync('tiv', { basedir: path.join(dir, 'grux') }), + path.join(dir, 'tiv/index.js') + ); + + t.equal( + resolve.sync('grux', { basedir: path.join(dir, 'tiv') }), + path.join(dir, 'grux/index.js') + ); + t.end(); +}); + +test('normalize', function (t) { + var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); + t.equal( + resolve.sync('../grux', { basedir: dir }), + path.join(dir, 'index.js') + ); + t.end(); +}); + +test('cup', function (t) { + var dir = path.join(__dirname, 'resolver'); + t.equal( + resolve.sync('./cup', { + basedir: dir, + extensions: ['.js', '.coffee'] + }), + path.join(dir, 'cup.coffee') + ); + + t.equal( + resolve.sync('./cup.coffee', { basedir: dir }), + path.join(dir, 'cup.coffee') + ); + + t.throws(function () { + resolve.sync('./cup', { + basedir: dir, + extensions: ['.js'] + }); + }); + + t.end(); +}); + +test('mug', function (t) { + var dir = path.join(__dirname, 'resolver'); + t.equal( + resolve.sync('./mug', { basedir: dir }), + path.join(dir, 'mug.js') + ); + + t.equal( + resolve.sync('./mug', { + basedir: dir, + extensions: ['.coffee', '.js'] + }), + path.join(dir, 'mug.coffee') + ); + + t.equal( + resolve.sync('./mug', { + basedir: dir, + extensions: ['.js', '.coffee'] + }), + path.join(dir, 'mug.js') + ); + + t.end(); +}); + +test('other path', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'bar'); + var otherDir = path.join(resolverDir, 'other_path'); + + t.equal( + resolve.sync('root', { + basedir: dir, + paths: [otherDir] + }), + path.join(resolverDir, 'other_path/root.js') + ); + + t.equal( + resolve.sync('lib/other-lib', { + basedir: dir, + paths: [otherDir] + }), + path.join(resolverDir, 'other_path/lib/other-lib.js') + ); + + t.throws(function () { + resolve.sync('root', { basedir: dir }); + }); + + t.throws(function () { + resolve.sync('zzz', { + basedir: dir, + paths: [otherDir] + }); + }); + + t.end(); +}); + +test('incorrect main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'incorrect_main'); + + t.equal( + resolve.sync('./incorrect_main', { basedir: resolverDir }), + path.join(dir, 'index.js') + ); + + t.end(); +}); + +test('#25: node modules with the same name as node stdlib modules', function (t) { + var resolverDir = path.join(__dirname, 'resolver/punycode'); + + t.equal( + resolve.sync('punycode', { basedir: resolverDir }), + path.join(resolverDir, 'node_modules/punycode/index.js') + ); + + t.end(); +}); + +var stubStatSync = function stubStatSync(fn) { + var fs = require('fs'); + var statSync = fs.statSync; + try { + fs.statSync = function () { + throw new EvalError('Unknown Error'); + }; + return fn(); + } finally { + fs.statSync = statSync; + } +}; + +test('#79 - re-throw non ENOENT errors from stat', function (t) { + var dir = path.join(__dirname, 'resolver'); + + stubStatSync(function () { + t.throws(function () { + resolve.sync('foo', { basedir: dir }); + }, /Unknown Error/); + }); + + t.end(); +}); + +test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./foo', { basedir: path.join(dir, 'same_names') }), + path.join(dir, 'same_names/foo.js') + ); + t.equal( + resolve.sync('./foo/', { basedir: path.join(dir, 'same_names') }), + path.join(dir, 'same_names/foo/index.js') + ); + t.end(); +}); + +test('sync: #121 - treating an existing file as a dir when no basedir', function (t) { + var testFile = path.basename(__filename); + + t.test('sanity check', function (st) { + st.equal( + resolve.sync('./' + testFile), + __filename, + 'sanity check' + ); + st.end(); + }); + + t.test('with a fake directory', function (st) { + function run() { return resolve.sync('./' + testFile + '/blah'); } + + st.throws(run, 'throws an error'); + + try { + run(); + } catch (e) { + st.equal(e.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + st.equal( + e.message, + 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', + 'can not find nonexistent module' + ); + } + + st.end(); + }); + + t.end(); +}); + +test('sync dot main', function (t) { + var start = new Date(); + t.equal(resolve.sync('./resolver/dot_main'), path.join(__dirname, 'resolver/dot_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); +}); + +test('sync dot slash main', function (t) { + var start = new Date(); + t.equal(resolve.sync('./resolver/dot_slash_main'), path.join(__dirname, 'resolver/dot_slash_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); +}); diff --git a/node_modules/resolve/test/subdirs.js b/node_modules/resolve/test/subdirs.js new file mode 100644 index 0000000..b7b8450 --- /dev/null +++ b/node_modules/resolve/test/subdirs.js @@ -0,0 +1,13 @@ +var test = require('tape'); +var resolve = require('../'); +var path = require('path'); + +test('subdirs', function (t) { + t.plan(2); + + var dir = path.join(__dirname, '/subdirs'); + resolve('a/b/c/x.json', { basedir: dir }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(dir, 'node_modules/a/b/c/x.json')); + }); +}); diff --git a/node_modules/resolve/test/symlinks.js b/node_modules/resolve/test/symlinks.js new file mode 100644 index 0000000..544a023 --- /dev/null +++ b/node_modules/resolve/test/symlinks.js @@ -0,0 +1,54 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); +var resolve = require('../'); + +var symlinkDir = path.join(__dirname, 'resolver', 'symlinked', 'symlink'); +try { + fs.unlinkSync(symlinkDir); +} catch (err) {} +try { + fs.symlinkSync('./_/symlink_target', symlinkDir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, 'resolver', 'symlinked', '_', 'symlink_target') + '\\', symlinkDir, 'junction'); +} + +test('symlink', function (t) { + t.plan(1); + + resolve('foo', { basedir: symlinkDir, preserveSymlinks: false }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js')); + }); +}); + +test('sync symlink when preserveSymlinks = true', function (t) { + t.plan(4); + + resolve('foo', { basedir: symlinkDir }, function (err, res, pkg) { + t.ok(err, 'there is an error'); + t.notOk(res, 'no result'); + + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + t.equal( + err && err.message, + 'Cannot find module \'foo\' from \'' + symlinkDir + '\'', + 'can not find nonexistent module' + ); + }); +}); + +test('sync symlink', function (t) { + var start = new Date(); + t.equal(resolve.sync('foo', { basedir: symlinkDir, preserveSymlinks: false }), path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); +}); + +test('sync symlink when preserveSymlinks = true', function (t) { + t.throws(function () { + resolve.sync('foo', { basedir: symlinkDir }); + }, /Cannot find module 'foo'/); + t.end(); +}); diff --git a/node_modules/ret/LICENSE b/node_modules/ret/LICENSE new file mode 100644 index 0000000..b351ee8 --- /dev/null +++ b/node_modules/ret/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2011 by Roly Fentanes + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/ret/README.md b/node_modules/ret/README.md new file mode 100644 index 0000000..28563e1 --- /dev/null +++ b/node_modules/ret/README.md @@ -0,0 +1,183 @@ +# Regular Expression Tokenizer + +Tokenizes strings that represent a regular expressions. + +[![Build Status](https://secure.travis-ci.org/fent/ret.js.svg)](http://travis-ci.org/fent/ret.js) +[![Dependency Status](https://david-dm.org/fent/ret.js.svg)](https://david-dm.org/fent/ret.js) +[![codecov](https://codecov.io/gh/fent/ret.js/branch/master/graph/badge.svg)](https://codecov.io/gh/fent/ret.js) + +# Usage + +```js +var ret = require('ret'); + +var tokens = ret(/foo|bar/.source); +``` + +`tokens` will contain the following object + +```js +{ + "type": ret.types.ROOT + "options": [ + [ { "type": ret.types.CHAR, "value", 102 }, + { "type": ret.types.CHAR, "value", 111 }, + { "type": ret.types.CHAR, "value", 111 } ], + [ { "type": ret.types.CHAR, "value", 98 }, + { "type": ret.types.CHAR, "value", 97 }, + { "type": ret.types.CHAR, "value", 114 } ] + ] +} +``` + +# Token Types + +`ret.types` is a collection of the various token types exported by ret. + +### ROOT + +Only used in the root of the regexp. This is needed due to the posibility of the root containing a pipe `|` character. In that case, the token will have an `options` key that will be an array of arrays of tokens. If not, it will contain a `stack` key that is an array of tokens. + +```js +{ + "type": ret.types.ROOT, + "stack": [token1, token2...], +} +``` + +```js +{ + "type": ret.types.ROOT, + "options" [ + [token1, token2...], + [othertoken1, othertoken2...] + ... + ], +} +``` + +### GROUP + +Groups contain tokens that are inside of a parenthesis. If the group begins with `?` followed by another character, it's a special type of group. A ':' tells the group not to be remembered when `exec` is used. '=' means the previous token matches only if followed by this group, and '!' means the previous token matches only if NOT followed. + +Like root, it can contain an `options` key instead of `stack` if there is a pipe. + +```js +{ + "type": ret.types.GROUP, + "remember" true, + "followedBy": false, + "notFollowedBy": false, + "stack": [token1, token2...], +} +``` + +```js +{ + "type": ret.types.GROUP, + "remember" true, + "followedBy": false, + "notFollowedBy": false, + "options" [ + [token1, token2...], + [othertoken1, othertoken2...] + ... + ], +} +``` + +### POSITION + +`\b`, `\B`, `^`, and `$` specify positions in the regexp. + +```js +{ + "type": ret.types.POSITION, + "value": "^", +} +``` + +### SET + +Contains a key `set` specifying what tokens are allowed and a key `not` specifying if the set should be negated. A set can contain other sets, ranges, and characters. + +```js +{ + "type": ret.types.SET, + "set": [token1, token2...], + "not": false, +} +``` + +### RANGE + +Used in set tokens to specify a character range. `from` and `to` are character codes. + +```js +{ + "type": ret.types.RANGE, + "from": 97, + "to": 122, +} +``` + +### REPETITION + +```js +{ + "type": ret.types.REPETITION, + "min": 0, + "max": Infinity, + "value": token, +} +``` + +### REFERENCE + +References a group token. `value` is 1-9. + +```js +{ + "type": ret.types.REFERENCE, + "value": 1, +} +``` + +### CHAR + +Represents a single character token. `value` is the character code. This might seem a bit cluttering instead of concatenating characters together. But since repetition tokens only repeat the last token and not the last clause like the pipe, it's simpler to do it this way. + +```js +{ + "type": ret.types.CHAR, + "value": 123, +} +``` + +## Errors + +ret.js will throw errors if given a string with an invalid regular expression. All possible errors are + +* Invalid group. When a group with an immediate `?` character is followed by an invalid character. It can only be followed by `!`, `=`, or `:`. Example: `/(?_abc)/` +* Nothing to repeat. Thrown when a repetitional token is used as the first token in the current clause, as in right in the beginning of the regexp or group, or right after a pipe. Example: `/foo|?bar/`, `/{1,3}foo|bar/`, `/foo(+bar)/` +* Unmatched ). A group was not opened, but was closed. Example: `/hello)2u/` +* Unterminated group. A group was not closed. Example: `/(1(23)4/` +* Unterminated character class. A custom character set was not closed. Example: `/[abc/` + + +# Install + + npm install ret + + +# Tests + +Tests are written with [vows](http://vowsjs.org/) + +```bash +npm test +``` + +# License + +MIT diff --git a/node_modules/ret/lib/index.js b/node_modules/ret/lib/index.js new file mode 100644 index 0000000..0e151c3 --- /dev/null +++ b/node_modules/ret/lib/index.js @@ -0,0 +1,282 @@ +var util = require('./util'); +var types = require('./types'); +var sets = require('./sets'); +var positions = require('./positions'); + + +module.exports = function(regexpStr) { + var i = 0, l, c, + start = { type: types.ROOT, stack: []}, + + // Keep track of last clause/group and stack. + lastGroup = start, + last = start.stack, + groupStack = []; + + + var repeatErr = function(i) { + util.error(regexpStr, 'Nothing to repeat at column ' + (i - 1)); + }; + + // Decode a few escaped characters. + var str = util.strToChars(regexpStr); + l = str.length; + + // Iterate through each character in string. + while (i < l) { + c = str[i++]; + + switch (c) { + // Handle escaped characters, inclues a few sets. + case '\\': + c = str[i++]; + + switch (c) { + case 'b': + last.push(positions.wordBoundary()); + break; + + case 'B': + last.push(positions.nonWordBoundary()); + break; + + case 'w': + last.push(sets.words()); + break; + + case 'W': + last.push(sets.notWords()); + break; + + case 'd': + last.push(sets.ints()); + break; + + case 'D': + last.push(sets.notInts()); + break; + + case 's': + last.push(sets.whitespace()); + break; + + case 'S': + last.push(sets.notWhitespace()); + break; + + default: + // Check if c is integer. + // In which case it's a reference. + if (/\d/.test(c)) { + last.push({ type: types.REFERENCE, value: parseInt(c, 10) }); + + // Escaped character. + } else { + last.push({ type: types.CHAR, value: c.charCodeAt(0) }); + } + } + + break; + + + // Positionals. + case '^': + last.push(positions.begin()); + break; + + case '$': + last.push(positions.end()); + break; + + + // Handle custom sets. + case '[': + // Check if this class is 'anti' i.e. [^abc]. + var not; + if (str[i] === '^') { + not = true; + i++; + } else { + not = false; + } + + // Get all the characters in class. + var classTokens = util.tokenizeClass(str.slice(i), regexpStr); + + // Increase index by length of class. + i += classTokens[1]; + last.push({ + type: types.SET, + set: classTokens[0], + not: not, + }); + + break; + + + // Class of any character except \n. + case '.': + last.push(sets.anyChar()); + break; + + + // Push group onto stack. + case '(': + // Create group. + var group = { + type: types.GROUP, + stack: [], + remember: true, + }; + + c = str[i]; + + // If if this is a special kind of group. + if (c === '?') { + c = str[i + 1]; + i += 2; + + // Match if followed by. + if (c === '=') { + group.followedBy = true; + + // Match if not followed by. + } else if (c === '!') { + group.notFollowedBy = true; + + } else if (c !== ':') { + util.error(regexpStr, + 'Invalid group, character \'' + c + + '\' after \'?\' at column ' + (i - 1)); + } + + group.remember = false; + } + + // Insert subgroup into current group stack. + last.push(group); + + // Remember the current group for when the group closes. + groupStack.push(lastGroup); + + // Make this new group the current group. + lastGroup = group; + last = group.stack; + break; + + + // Pop group out of stack. + case ')': + if (groupStack.length === 0) { + util.error(regexpStr, 'Unmatched ) at column ' + (i - 1)); + } + lastGroup = groupStack.pop(); + + // Check if this group has a PIPE. + // To get back the correct last stack. + last = lastGroup.options ? + lastGroup.options[lastGroup.options.length - 1] : lastGroup.stack; + break; + + + // Use pipe character to give more choices. + case '|': + // Create array where options are if this is the first PIPE + // in this clause. + if (!lastGroup.options) { + lastGroup.options = [lastGroup.stack]; + delete lastGroup.stack; + } + + // Create a new stack and add to options for rest of clause. + var stack = []; + lastGroup.options.push(stack); + last = stack; + break; + + + // Repetition. + // For every repetition, remove last element from last stack + // then insert back a RANGE object. + // This design is chosen because there could be more than + // one repetition symbols in a regex i.e. `a?+{2,3}`. + case '{': + var rs = /^(\d+)(,(\d+)?)?\}/.exec(str.slice(i)), min, max; + if (rs !== null) { + if (last.length === 0) { + repeatErr(i); + } + min = parseInt(rs[1], 10); + max = rs[2] ? rs[3] ? parseInt(rs[3], 10) : Infinity : min; + i += rs[0].length; + + last.push({ + type: types.REPETITION, + min: min, + max: max, + value: last.pop(), + }); + } else { + last.push({ + type: types.CHAR, + value: 123, + }); + } + break; + + case '?': + if (last.length === 0) { + repeatErr(i); + } + last.push({ + type: types.REPETITION, + min: 0, + max: 1, + value: last.pop(), + }); + break; + + case '+': + if (last.length === 0) { + repeatErr(i); + } + last.push({ + type: types.REPETITION, + min: 1, + max: Infinity, + value: last.pop(), + }); + break; + + case '*': + if (last.length === 0) { + repeatErr(i); + } + last.push({ + type: types.REPETITION, + min: 0, + max: Infinity, + value: last.pop(), + }); + break; + + + // Default is a character that is not `\[](){}?+*^$`. + default: + last.push({ + type: types.CHAR, + value: c.charCodeAt(0), + }); + } + + } + + // Check if any groups have not been closed. + if (groupStack.length !== 0) { + util.error(regexpStr, 'Unterminated group'); + } + + return start; +}; + +module.exports.types = types; diff --git a/node_modules/ret/lib/positions.js b/node_modules/ret/lib/positions.js new file mode 100644 index 0000000..80677ee --- /dev/null +++ b/node_modules/ret/lib/positions.js @@ -0,0 +1,17 @@ +var types = require('./types'); + +exports.wordBoundary = function() { + return { type: types.POSITION, value: 'b' }; +}; + +exports.nonWordBoundary = function() { + return { type: types.POSITION, value: 'B' }; +}; + +exports.begin = function() { + return { type: types.POSITION, value: '^' }; +}; + +exports.end = function() { + return { type: types.POSITION, value: '$' }; +}; diff --git a/node_modules/ret/lib/sets.js b/node_modules/ret/lib/sets.js new file mode 100644 index 0000000..5fb6be5 --- /dev/null +++ b/node_modules/ret/lib/sets.js @@ -0,0 +1,82 @@ +var types = require('./types'); + +var INTS = function() { + return [{ type: types.RANGE , from: 48, to: 57 }]; +}; + +var WORDS = function() { + return [ + { type: types.CHAR, value: 95 }, + { type: types.RANGE, from: 97, to: 122 }, + { type: types.RANGE, from: 65, to: 90 } + ].concat(INTS()); +}; + +var WHITESPACE = function() { + return [ + { type: types.CHAR, value: 9 }, + { type: types.CHAR, value: 10 }, + { type: types.CHAR, value: 11 }, + { type: types.CHAR, value: 12 }, + { type: types.CHAR, value: 13 }, + { type: types.CHAR, value: 32 }, + { type: types.CHAR, value: 160 }, + { type: types.CHAR, value: 5760 }, + { type: types.CHAR, value: 6158 }, + { type: types.CHAR, value: 8192 }, + { type: types.CHAR, value: 8193 }, + { type: types.CHAR, value: 8194 }, + { type: types.CHAR, value: 8195 }, + { type: types.CHAR, value: 8196 }, + { type: types.CHAR, value: 8197 }, + { type: types.CHAR, value: 8198 }, + { type: types.CHAR, value: 8199 }, + { type: types.CHAR, value: 8200 }, + { type: types.CHAR, value: 8201 }, + { type: types.CHAR, value: 8202 }, + { type: types.CHAR, value: 8232 }, + { type: types.CHAR, value: 8233 }, + { type: types.CHAR, value: 8239 }, + { type: types.CHAR, value: 8287 }, + { type: types.CHAR, value: 12288 }, + { type: types.CHAR, value: 65279 } + ]; +}; + +var NOTANYCHAR = function() { + return [ + { type: types.CHAR, value: 10 }, + { type: types.CHAR, value: 13 }, + { type: types.CHAR, value: 8232 }, + { type: types.CHAR, value: 8233 }, + ]; +}; + +// Predefined class objects. +exports.words = function() { + return { type: types.SET, set: WORDS(), not: false }; +}; + +exports.notWords = function() { + return { type: types.SET, set: WORDS(), not: true }; +}; + +exports.ints = function() { + return { type: types.SET, set: INTS(), not: false }; +}; + +exports.notInts = function() { + return { type: types.SET, set: INTS(), not: true }; +}; + +exports.whitespace = function() { + return { type: types.SET, set: WHITESPACE(), not: false }; +}; + +exports.notWhitespace = function() { + return { type: types.SET, set: WHITESPACE(), not: true }; +}; + +exports.anyChar = function() { + return { type: types.SET, set: NOTANYCHAR(), not: true }; +}; diff --git a/node_modules/ret/lib/types.js b/node_modules/ret/lib/types.js new file mode 100644 index 0000000..9484145 --- /dev/null +++ b/node_modules/ret/lib/types.js @@ -0,0 +1,10 @@ +module.exports = { + ROOT : 0, + GROUP : 1, + POSITION : 2, + SET : 3, + RANGE : 4, + REPETITION : 5, + REFERENCE : 6, + CHAR : 7, +}; diff --git a/node_modules/ret/lib/util.js b/node_modules/ret/lib/util.js new file mode 100644 index 0000000..97d8cf5 --- /dev/null +++ b/node_modules/ret/lib/util.js @@ -0,0 +1,111 @@ +var types = require('./types'); +var sets = require('./sets'); + + +// All of these are private and only used by randexp. +// It's assumed that they will always be called with the correct input. + +var CTRL = '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?'; +var SLSH = { '0': 0, 't': 9, 'n': 10, 'v': 11, 'f': 12, 'r': 13 }; + +/** + * Finds character representations in str and convert all to + * their respective characters + * + * @param {String} str + * @return {String} + */ +exports.strToChars = function(str) { + /* jshint maxlen: false */ + var chars_regex = /(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z\[\\\]\^?])|([0tnvfr]))/g; + str = str.replace(chars_regex, function(s, b, lbs, a16, b16, c8, dctrl, eslsh) { + if (lbs) { + return s; + } + + var code = b ? 8 : + a16 ? parseInt(a16, 16) : + b16 ? parseInt(b16, 16) : + c8 ? parseInt(c8, 8) : + dctrl ? CTRL.indexOf(dctrl) : + SLSH[eslsh]; + + var c = String.fromCharCode(code); + + // Escape special regex characters. + if (/[\[\]{}\^$.|?*+()]/.test(c)) { + c = '\\' + c; + } + + return c; + }); + + return str; +}; + + +/** + * turns class into tokens + * reads str until it encounters a ] not preceeded by a \ + * + * @param {String} str + * @param {String} regexpStr + * @return {Array., Number>} + */ +exports.tokenizeClass = function(str, regexpStr) { + /* jshint maxlen: false */ + var tokens = []; + var regexp = /\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?(.)/g; + var rs, c; + + + while ((rs = regexp.exec(str)) != null) { + if (rs[1]) { + tokens.push(sets.words()); + + } else if (rs[2]) { + tokens.push(sets.ints()); + + } else if (rs[3]) { + tokens.push(sets.whitespace()); + + } else if (rs[4]) { + tokens.push(sets.notWords()); + + } else if (rs[5]) { + tokens.push(sets.notInts()); + + } else if (rs[6]) { + tokens.push(sets.notWhitespace()); + + } else if (rs[7]) { + tokens.push({ + type: types.RANGE, + from: (rs[8] || rs[9]).charCodeAt(0), + to: rs[10].charCodeAt(0), + }); + + } else if (c = rs[12]) { + tokens.push({ + type: types.CHAR, + value: c.charCodeAt(0), + }); + + } else { + return [tokens, regexp.lastIndex]; + } + } + + exports.error(regexpStr, 'Unterminated character class'); +}; + + +/** + * Shortcut to throw errors. + * + * @param {String} regexp + * @param {String} msg + */ +exports.error = function(regexp, msg) { + throw new SyntaxError('Invalid regular expression: /' + regexp + '/: ' + msg); +}; diff --git a/node_modules/ret/package.json b/node_modules/ret/package.json new file mode 100644 index 0000000..639c073 --- /dev/null +++ b/node_modules/ret/package.json @@ -0,0 +1,67 @@ +{ + "_from": "ret@~0.1.10", + "_id": "ret@0.1.15", + "_inBundle": false, + "_integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "_location": "/ret", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ret@~0.1.10", + "name": "ret", + "escapedName": "ret", + "rawSpec": "~0.1.10", + "saveSpec": null, + "fetchSpec": "~0.1.10" + }, + "_requiredBy": [ + "/safe-regex" + ], + "_resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "_shasum": "b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc", + "_spec": "ret@~0.1.10", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/safe-regex", + "author": { + "name": "Roly Fentanes", + "url": "https://github.com/fent" + }, + "bugs": { + "url": "https://github.com/fent/ret.js/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tokenizes a string that represents a regular expression.", + "devDependencies": { + "istanbul": "*", + "vows": "*" + }, + "directories": { + "lib": "./lib" + }, + "engines": { + "node": ">=0.12" + }, + "files": [ + "lib" + ], + "homepage": "https://github.com/fent/ret.js#readme", + "keywords": [ + "regex", + "regexp", + "regular expression", + "parser", + "tokenizer" + ], + "license": "MIT", + "main": "./lib/index.js", + "name": "ret", + "repository": { + "type": "git", + "url": "git://github.com/fent/ret.js.git" + }, + "scripts": { + "test": "istanbul cover vows -- --spec test/*-test.js" + }, + "version": "0.1.15" +} diff --git a/node_modules/right-align/LICENSE b/node_modules/right-align/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/node_modules/right-align/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 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/node_modules/right-align/README.md b/node_modules/right-align/README.md new file mode 100644 index 0000000..3abdfb3 --- /dev/null +++ b/node_modules/right-align/README.md @@ -0,0 +1,77 @@ +# right-align [![NPM version](https://badge.fury.io/js/right-align.svg)](http://badge.fury.io/js/right-align) + +> Right-align the text in a string. + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i right-align --save +``` + +## Usage + +```js +var rightAlign = require('right-align'); +rightAlign(string); +``` + +**Example** + +If used on the following: + +``` +Lorem ipsum dolor sit amet, +consectetur adipiscing +elit, sed do eiusmod tempor incididunt +ut labore et dolore +magna aliqua. Ut enim ad minim +veniam, quis +``` + +The result would be: + +``` + Lorem ipsum dolor sit amet, + consectetur adipiscing +elit, sed do eiusmod tempor incididunt + ut labore et dolore + magna aliqua. Ut enim ad minim + veniam, quis +``` + +## Related projects + +* [align-text](https://github.com/jonschlinkert/align-text): Align the text in a string. +* [center-align](https://github.com/jonschlinkert/center-align): Center-align the text in a string. +* [justify](https://github.com/bahamas10/node-justify): Left or right (or both) justify text using a custom width and character +* [repeat-string](https://github.com/jonschlinkert/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string. +* [repeat-element](https://github.com/jonschlinkert/repeat-element): Create an array by repeating the given value n times. +* [word-wrap](https://github.com/jonschlinkert/word-wrap): Wrap words to a specified length. + +## Running tests + +Install dev dependencies: + +```sh +$ 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/right-align/issues/new) + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 Jon Schlinkert +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 09, 2015._ diff --git a/node_modules/right-align/index.js b/node_modules/right-align/index.js new file mode 100644 index 0000000..ad54f5f --- /dev/null +++ b/node_modules/right-align/index.js @@ -0,0 +1,16 @@ +/*! + * right-align + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var align = require('align-text'); + +module.exports = function rightAlign(val) { + return align(val, function (len, longest) { + return longest - len; + }); +}; diff --git a/node_modules/right-align/package.json b/node_modules/right-align/package.json new file mode 100644 index 0000000..26dca32 --- /dev/null +++ b/node_modules/right-align/package.json @@ -0,0 +1,70 @@ +{ + "_from": "right-align@^0.1.1", + "_id": "right-align@0.1.3", + "_inBundle": false, + "_integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "_location": "/right-align", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "right-align@^0.1.1", + "name": "right-align", + "escapedName": "right-align", + "rawSpec": "^0.1.1", + "saveSpec": null, + "fetchSpec": "^0.1.1" + }, + "_requiredBy": [ + "/cliui" + ], + "_resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "_shasum": "61339b722fe6a3515689210d24e14c96148613ef", + "_spec": "right-align@^0.1.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/cliui", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/right-align/issues" + }, + "bundleDependencies": false, + "dependencies": { + "align-text": "^0.1.1" + }, + "deprecated": false, + "description": "Right-align the text in a string.", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/right-align", + "keywords": [ + "align", + "align-center", + "center", + "center-align", + "right", + "right-align", + "text", + "typography" + ], + "license": "MIT", + "main": "index.js", + "name": "right-align", + "repository": { + "type": "git", + "url": "git://github.com/jonschlinkert/right-align.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "0.1.3" +} diff --git a/node_modules/safe-buffer/.travis.yml b/node_modules/safe-buffer/.travis.yml new file mode 100644 index 0000000..7b20f28 --- /dev/null +++ b/node_modules/safe-buffer/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - 'node' + - '5' + - '4' + - '0.12' + - '0.10' diff --git a/node_modules/safe-buffer/LICENSE b/node_modules/safe-buffer/LICENSE new file mode 100644 index 0000000..0c068ce --- /dev/null +++ b/node_modules/safe-buffer/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/safe-buffer/README.md b/node_modules/safe-buffer/README.md new file mode 100644 index 0000000..e9a81af --- /dev/null +++ b/node_modules/safe-buffer/README.md @@ -0,0 +1,584 @@ +# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] + +[travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg +[travis-url]: https://travis-ci.org/feross/safe-buffer +[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg +[npm-url]: https://npmjs.org/package/safe-buffer +[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg +[downloads-url]: https://npmjs.org/package/safe-buffer +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg +[standard-url]: https://standardjs.com + +#### Safer Node.js Buffer API + +**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`, +`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.** + +**Uses the built-in implementation when available.** + +## install + +``` +npm install safe-buffer +``` + +## usage + +The goal of this package is to provide a safe replacement for the node.js `Buffer`. + +It's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to +the top of your node.js modules: + +```js +var Buffer = require('safe-buffer').Buffer + +// Existing buffer code will continue to work without issues: + +new Buffer('hey', 'utf8') +new Buffer([1, 2, 3], 'utf8') +new Buffer(obj) +new Buffer(16) // create an uninitialized buffer (potentially unsafe) + +// But you can use these new explicit APIs to make clear what you want: + +Buffer.from('hey', 'utf8') // convert from many types to a Buffer +Buffer.alloc(16) // create a zero-filled buffer (safe) +Buffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe) +``` + +## api + +### Class Method: Buffer.from(array) + + +* `array` {Array} + +Allocates a new `Buffer` using an `array` of octets. + +```js +const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]); + // creates a new Buffer containing ASCII bytes + // ['b','u','f','f','e','r'] +``` + +A `TypeError` will be thrown if `array` is not an `Array`. + +### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]]) + + +* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or + a `new ArrayBuffer()` +* `byteOffset` {Number} Default: `0` +* `length` {Number} Default: `arrayBuffer.length - byteOffset` + +When passed a reference to the `.buffer` property of a `TypedArray` instance, +the newly created `Buffer` will share the same allocated memory as the +TypedArray. + +```js +const arr = new Uint16Array(2); +arr[0] = 5000; +arr[1] = 4000; + +const buf = Buffer.from(arr.buffer); // shares the memory with arr; + +console.log(buf); + // Prints: + +// changing the TypedArray changes the Buffer also +arr[1] = 6000; + +console.log(buf); + // Prints: +``` + +The optional `byteOffset` and `length` arguments specify a memory range within +the `arrayBuffer` that will be shared by the `Buffer`. + +```js +const ab = new ArrayBuffer(10); +const buf = Buffer.from(ab, 0, 2); +console.log(buf.length); + // Prints: 2 +``` + +A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`. + +### Class Method: Buffer.from(buffer) + + +* `buffer` {Buffer} + +Copies the passed `buffer` data onto a new `Buffer` instance. + +```js +const buf1 = Buffer.from('buffer'); +const buf2 = Buffer.from(buf1); + +buf1[0] = 0x61; +console.log(buf1.toString()); + // 'auffer' +console.log(buf2.toString()); + // 'buffer' (copy is not changed) +``` + +A `TypeError` will be thrown if `buffer` is not a `Buffer`. + +### Class Method: Buffer.from(str[, encoding]) + + +* `str` {String} String to encode. +* `encoding` {String} Encoding to use, Default: `'utf8'` + +Creates a new `Buffer` containing the given JavaScript string `str`. If +provided, the `encoding` parameter identifies the character encoding. +If not provided, `encoding` defaults to `'utf8'`. + +```js +const buf1 = Buffer.from('this is a tést'); +console.log(buf1.toString()); + // prints: this is a tést +console.log(buf1.toString('ascii')); + // prints: this is a tC)st + +const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); +console.log(buf2.toString()); + // prints: this is a tést +``` + +A `TypeError` will be thrown if `str` is not a string. + +### Class Method: Buffer.alloc(size[, fill[, encoding]]) + + +* `size` {Number} +* `fill` {Value} Default: `undefined` +* `encoding` {String} Default: `utf8` + +Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the +`Buffer` will be *zero-filled*. + +```js +const buf = Buffer.alloc(5); +console.log(buf); + // +``` + +The `size` must be less than or equal to the value of +`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is +`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will +be created if a `size` less than or equal to 0 is specified. + +If `fill` is specified, the allocated `Buffer` will be initialized by calling +`buf.fill(fill)`. See [`buf.fill()`][] for more information. + +```js +const buf = Buffer.alloc(5, 'a'); +console.log(buf); + // +``` + +If both `fill` and `encoding` are specified, the allocated `Buffer` will be +initialized by calling `buf.fill(fill, encoding)`. For example: + +```js +const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); +console.log(buf); + // +``` + +Calling `Buffer.alloc(size)` can be significantly slower than the alternative +`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance +contents will *never contain sensitive data*. + +A `TypeError` will be thrown if `size` is not a number. + +### Class Method: Buffer.allocUnsafe(size) + + +* `size` {Number} + +Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must +be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit +architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is +thrown. A zero-length Buffer will be created if a `size` less than or equal to +0 is specified. + +The underlying memory for `Buffer` instances created in this way is *not +initialized*. The contents of the newly created `Buffer` are unknown and +*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such +`Buffer` instances to zeroes. + +```js +const buf = Buffer.allocUnsafe(5); +console.log(buf); + // + // (octets will be different, every time) +buf.fill(0); +console.log(buf); + // +``` + +A `TypeError` will be thrown if `size` is not a number. + +Note that the `Buffer` module pre-allocates an internal `Buffer` instance of +size `Buffer.poolSize` that is used as a pool for the fast allocation of new +`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated +`new Buffer(size)` constructor) only when `size` is less than or equal to +`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default +value of `Buffer.poolSize` is `8192` but can be modified. + +Use of this pre-allocated internal memory pool is a key difference between +calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. +Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer +pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal +Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The +difference is subtle but can be important when an application requires the +additional performance that `Buffer.allocUnsafe(size)` provides. + +### Class Method: Buffer.allocUnsafeSlow(size) + + +* `size` {Number} + +Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The +`size` must be less than or equal to the value of +`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is +`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will +be created if a `size` less than or equal to 0 is specified. + +The underlying memory for `Buffer` instances created in this way is *not +initialized*. The contents of the newly created `Buffer` are unknown and +*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such +`Buffer` instances to zeroes. + +When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, +allocations under 4KB are, by default, sliced from a single pre-allocated +`Buffer`. This allows applications to avoid the garbage collection overhead of +creating many individually allocated Buffers. This approach improves both +performance and memory usage by eliminating the need to track and cleanup as +many `Persistent` objects. + +However, in the case where a developer may need to retain a small chunk of +memory from a pool for an indeterminate amount of time, it may be appropriate +to create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then +copy out the relevant bits. + +```js +// need to keep around a few small chunks of memory +const store = []; + +socket.on('readable', () => { + const data = socket.read(); + // allocate for retained data + const sb = Buffer.allocUnsafeSlow(10); + // copy the data into the new allocation + data.copy(sb, 0, 0, 10); + store.push(sb); +}); +``` + +Use of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after* +a developer has observed undue memory retention in their applications. + +A `TypeError` will be thrown if `size` is not a number. + +### All the Rest + +The rest of the `Buffer` API is exactly the same as in node.js. +[See the docs](https://nodejs.org/api/buffer.html). + + +## Related links + +- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660) +- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4) + +## Why is `Buffer` unsafe? + +Today, the node.js `Buffer` constructor is overloaded to handle many different argument +types like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.), +`ArrayBuffer`, and also `Number`. + +The API is optimized for convenience: you can throw any type at it, and it will try to do +what you want. + +Because the Buffer constructor is so powerful, you often see code like this: + +```js +// Convert UTF-8 strings to hex +function toHex (str) { + return new Buffer(str).toString('hex') +} +``` + +***But what happens if `toHex` is called with a `Number` argument?*** + +### Remote Memory Disclosure + +If an attacker can make your program call the `Buffer` constructor with a `Number` +argument, then they can make it allocate uninitialized memory from the node.js process. +This could potentially disclose TLS private keys, user data, or database passwords. + +When the `Buffer` constructor is passed a `Number` argument, it returns an +**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like +this, you **MUST** overwrite the contents before returning it to the user. + +From the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size): + +> `new Buffer(size)` +> +> - `size` Number +> +> The underlying memory for `Buffer` instances created in this way is not initialized. +> **The contents of a newly created `Buffer` are unknown and could contain sensitive +> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes. + +(Emphasis our own.) + +Whenever the programmer intended to create an uninitialized `Buffer` you often see code +like this: + +```js +var buf = new Buffer(16) + +// Immediately overwrite the uninitialized buffer with data from another buffer +for (var i = 0; i < buf.length; i++) { + buf[i] = otherBuf[i] +} +``` + + +### Would this ever be a problem in real code? + +Yes. It's surprisingly common to forget to check the type of your variables in a +dynamically-typed language like JavaScript. + +Usually the consequences of assuming the wrong type is that your program crashes with an +uncaught exception. But the failure mode for forgetting to check the type of arguments to +the `Buffer` constructor is more catastrophic. + +Here's an example of a vulnerable service that takes a JSON payload and converts it to +hex: + +```js +// Take a JSON payload {str: "some string"} and convert it to hex +var server = http.createServer(function (req, res) { + var data = '' + req.setEncoding('utf8') + req.on('data', function (chunk) { + data += chunk + }) + req.on('end', function () { + var body = JSON.parse(data) + res.end(new Buffer(body.str).toString('hex')) + }) +}) + +server.listen(8080) +``` + +In this example, an http client just has to send: + +```json +{ + "str": 1000 +} +``` + +and it will get back 1,000 bytes of uninitialized memory from the server. + +This is a very serious bug. It's similar in severity to the +[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process +memory by remote attackers. + + +### Which real-world packages were vulnerable? + +#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht) + +[Mathias Buus](https://github.com/mafintosh) and I +([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages, +[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow +anyone on the internet to send a series of messages to a user of `bittorrent-dht` and get +them to reveal 20 bytes at a time of uninitialized memory from the node.js process. + +Here's +[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8) +that fixed it. We released a new fixed version, created a +[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all +vulnerable versions on npm so users will get a warning to upgrade to a newer version. + +#### [`ws`](https://www.npmjs.com/package/ws) + +That got us wondering if there were other vulnerable packages. Sure enough, within a short +period of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the +most popular WebSocket implementation in node.js. + +If certain APIs were called with `Number` parameters instead of `String` or `Buffer` as +expected, then uninitialized server memory would be disclosed to the remote peer. + +These were the vulnerable methods: + +```js +socket.send(number) +socket.ping(number) +socket.pong(number) +``` + +Here's a vulnerable socket server with some echo functionality: + +```js +server.on('connection', function (socket) { + socket.on('message', function (message) { + message = JSON.parse(message) + if (message.type === 'echo') { + socket.send(message.data) // send back the user's message + } + }) +}) +``` + +`socket.send(number)` called on the server, will disclose server memory. + +Here's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue +was fixed, with a more detailed explanation. Props to +[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the +[Node Security Project disclosure](https://nodesecurity.io/advisories/67). + + +### What's the solution? + +It's important that node.js offers a fast way to get memory otherwise performance-critical +applications would needlessly get a lot slower. + +But we need a better way to *signal our intent* as programmers. **When we want +uninitialized memory, we should request it explicitly.** + +Sensitive functionality should not be packed into a developer-friendly API that loosely +accepts many different types. This type of API encourages the lazy practice of passing +variables in without checking the type very carefully. + +#### A new API: `Buffer.allocUnsafe(number)` + +The functionality of creating buffers with uninitialized memory should be part of another +API. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that +frequently gets user input of all sorts of different types passed into it. + +```js +var buf = Buffer.allocUnsafe(16) // careful, uninitialized memory! + +// Immediately overwrite the uninitialized buffer with data from another buffer +for (var i = 0; i < buf.length; i++) { + buf[i] = otherBuf[i] +} +``` + + +### How do we fix node.js core? + +We sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as +`semver-major`) which defends against one case: + +```js +var str = 16 +new Buffer(str, 'utf8') +``` + +In this situation, it's implied that the programmer intended the first argument to be a +string, since they passed an encoding as a second argument. Today, node.js will allocate +uninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not +what the programmer intended. + +But this is only a partial solution, since if the programmer does `new Buffer(variable)` +(without an `encoding` parameter) there's no way to know what they intended. If `variable` +is sometimes a number, then uninitialized memory will sometimes be returned. + +### What's the real long-term fix? + +We could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when +we need uninitialized memory. But that would break 1000s of packages. + +~~We believe the best solution is to:~~ + +~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~ + +~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~ + +#### Update + +We now support adding three new APIs: + +- `Buffer.from(value)` - convert from any type to a buffer +- `Buffer.alloc(size)` - create a zero-filled buffer +- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size + +This solves the core problem that affected `ws` and `bittorrent-dht` which is +`Buffer(variable)` getting tricked into taking a number argument. + +This way, existing code continues working and the impact on the npm ecosystem will be +minimal. Over time, npm maintainers can migrate performance-critical code to use +`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`. + + +### Conclusion + +We think there's a serious design issue with the `Buffer` API as it exists today. It +promotes insecure software by putting high-risk functionality into a convenient API +with friendly "developer ergonomics". + +This wasn't merely a theoretical exercise because we found the issue in some of the +most popular npm packages. + +Fortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of +`buffer`. + +```js +var Buffer = require('safe-buffer').Buffer +``` + +Eventually, we hope that node.js core can switch to this new, safer behavior. We believe +the impact on the ecosystem would be minimal since it's not a breaking change. +Well-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while +older, insecure packages would magically become safe from this attack vector. + + +## links + +- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514) +- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67) +- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68) + + +## credit + +The original issues in `bittorrent-dht` +([disclosure](https://nodesecurity.io/advisories/68)) and +`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by +[Mathias Buus](https://github.com/mafintosh) and +[Feross Aboukhadijeh](http://feross.org/). + +Thanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues +and for his work running the [Node Security Project](https://nodesecurity.io/). + +Thanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and +auditing the code. + + +## license + +MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org) diff --git a/node_modules/safe-buffer/index.js b/node_modules/safe-buffer/index.js new file mode 100644 index 0000000..22438da --- /dev/null +++ b/node_modules/safe-buffer/index.js @@ -0,0 +1,62 @@ +/* eslint-disable node/no-deprecated-api */ +var buffer = require('buffer') +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} diff --git a/node_modules/safe-buffer/package.json b/node_modules/safe-buffer/package.json new file mode 100644 index 0000000..f005340 --- /dev/null +++ b/node_modules/safe-buffer/package.json @@ -0,0 +1,63 @@ +{ + "_from": "safe-buffer@5.1.1", + "_id": "safe-buffer@5.1.1", + "_inBundle": false, + "_integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "_location": "/safe-buffer", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "safe-buffer@5.1.1", + "name": "safe-buffer", + "escapedName": "safe-buffer", + "rawSpec": "5.1.1", + "saveSpec": null, + "fetchSpec": "5.1.1" + }, + "_requiredBy": [ + "/basic-auth", + "/serve-favicon" + ], + "_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "_shasum": "893312af69b2123def71f57889001671eeb2c853", + "_spec": "safe-buffer@5.1.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/basic-auth", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org" + }, + "bugs": { + "url": "https://github.com/feross/safe-buffer/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Safer Node.js Buffer API", + "devDependencies": { + "standard": "*", + "tape": "^4.0.0", + "zuul": "^3.0.0" + }, + "homepage": "https://github.com/feross/safe-buffer", + "keywords": [ + "buffer", + "buffer allocate", + "node security", + "safe", + "safe-buffer", + "security", + "uninitialized" + ], + "license": "MIT", + "main": "index.js", + "name": "safe-buffer", + "repository": { + "type": "git", + "url": "git://github.com/feross/safe-buffer.git" + }, + "scripts": { + "test": "standard && tape test.js" + }, + "version": "5.1.1" +} diff --git a/node_modules/safe-buffer/test.js b/node_modules/safe-buffer/test.js new file mode 100644 index 0000000..4925059 --- /dev/null +++ b/node_modules/safe-buffer/test.js @@ -0,0 +1,101 @@ +/* eslint-disable node/no-deprecated-api */ + +var test = require('tape') +var SafeBuffer = require('./').Buffer + +test('new SafeBuffer(value) works just like Buffer', function (t) { + t.deepEqual(new SafeBuffer('hey'), new Buffer('hey')) + t.deepEqual(new SafeBuffer('hey', 'utf8'), new Buffer('hey', 'utf8')) + t.deepEqual(new SafeBuffer('686579', 'hex'), new Buffer('686579', 'hex')) + t.deepEqual(new SafeBuffer([1, 2, 3]), new Buffer([1, 2, 3])) + t.deepEqual(new SafeBuffer(new Uint8Array([1, 2, 3])), new Buffer(new Uint8Array([1, 2, 3]))) + + t.equal(typeof SafeBuffer.isBuffer, 'function') + t.equal(SafeBuffer.isBuffer(new SafeBuffer('hey')), true) + t.equal(Buffer.isBuffer(new SafeBuffer('hey')), true) + t.notOk(SafeBuffer.isBuffer({})) + + t.end() +}) + +test('SafeBuffer.from(value) converts to a Buffer', function (t) { + t.deepEqual(SafeBuffer.from('hey'), new Buffer('hey')) + t.deepEqual(SafeBuffer.from('hey', 'utf8'), new Buffer('hey', 'utf8')) + t.deepEqual(SafeBuffer.from('686579', 'hex'), new Buffer('686579', 'hex')) + t.deepEqual(SafeBuffer.from([1, 2, 3]), new Buffer([1, 2, 3])) + t.deepEqual(SafeBuffer.from(new Uint8Array([1, 2, 3])), new Buffer(new Uint8Array([1, 2, 3]))) + + t.end() +}) + +test('SafeBuffer.alloc(number) returns zeroed-out memory', function (t) { + for (var i = 0; i < 10; i++) { + var expected1 = new Buffer(1000) + expected1.fill(0) + t.deepEqual(SafeBuffer.alloc(1000), expected1) + + var expected2 = new Buffer(1000 * 1000) + expected2.fill(0) + t.deepEqual(SafeBuffer.alloc(1000 * 1000), expected2) + } + t.end() +}) + +test('SafeBuffer.allocUnsafe(number)', function (t) { + var buf = SafeBuffer.allocUnsafe(100) // unitialized memory + t.equal(buf.length, 100) + t.equal(SafeBuffer.isBuffer(buf), true) + t.equal(Buffer.isBuffer(buf), true) + t.end() +}) + +test('SafeBuffer.from() throws with number types', function (t) { + t.plan(5) + t.throws(function () { + SafeBuffer.from(0) + }) + t.throws(function () { + SafeBuffer.from(-1) + }) + t.throws(function () { + SafeBuffer.from(NaN) + }) + t.throws(function () { + SafeBuffer.from(Infinity) + }) + t.throws(function () { + SafeBuffer.from(99) + }) +}) + +test('SafeBuffer.allocUnsafe() throws with non-number types', function (t) { + t.plan(4) + t.throws(function () { + SafeBuffer.allocUnsafe('hey') + }) + t.throws(function () { + SafeBuffer.allocUnsafe('hey', 'utf8') + }) + t.throws(function () { + SafeBuffer.allocUnsafe([1, 2, 3]) + }) + t.throws(function () { + SafeBuffer.allocUnsafe({}) + }) +}) + +test('SafeBuffer.alloc() throws with non-number types', function (t) { + t.plan(4) + t.throws(function () { + SafeBuffer.alloc('hey') + }) + t.throws(function () { + SafeBuffer.alloc('hey', 'utf8') + }) + t.throws(function () { + SafeBuffer.alloc([1, 2, 3]) + }) + t.throws(function () { + SafeBuffer.alloc({}) + }) +}) diff --git a/node_modules/safe-regex/.travis.yml b/node_modules/safe-regex/.travis.yml new file mode 100644 index 0000000..cc4dba2 --- /dev/null +++ b/node_modules/safe-regex/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/safe-regex/LICENSE b/node_modules/safe-regex/LICENSE new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/node_modules/safe-regex/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/safe-regex/example/safe.js b/node_modules/safe-regex/example/safe.js new file mode 100644 index 0000000..f486f59 --- /dev/null +++ b/node_modules/safe-regex/example/safe.js @@ -0,0 +1,3 @@ +var safe = require('../'); +var regex = process.argv.slice(2).join(' '); +console.log(safe(regex)); diff --git a/node_modules/safe-regex/index.js b/node_modules/safe-regex/index.js new file mode 100644 index 0000000..488f501 --- /dev/null +++ b/node_modules/safe-regex/index.js @@ -0,0 +1,43 @@ +var parse = require('ret'); +var types = parse.types; + +module.exports = function (re, opts) { + if (!opts) opts = {}; + var replimit = opts.limit === undefined ? 25 : opts.limit; + + if (isRegExp(re)) re = re.source; + else if (typeof re !== 'string') re = String(re); + + try { re = parse(re) } + catch (err) { return false } + + var reps = 0; + return (function walk (node, starHeight) { + if (node.type === types.REPETITION) { + starHeight ++; + reps ++; + if (starHeight > 1) return false; + if (reps > replimit) return false; + } + + if (node.options) { + for (var i = 0, len = node.options.length; i < len; i++) { + var ok = walk({ stack: node.options[i] }, starHeight); + if (!ok) return false; + } + } + var stack = node.stack || (node.value && node.value.stack); + if (!stack) return true; + + for (var i = 0; i < stack.length; i++) { + var ok = walk(stack[i], starHeight); + if (!ok) return false; + } + + return true; + })(re, 0); +}; + +function isRegExp (x) { + return {}.toString.call(x) === '[object RegExp]'; +} diff --git a/node_modules/safe-regex/package.json b/node_modules/safe-regex/package.json new file mode 100644 index 0000000..b71acf5 --- /dev/null +++ b/node_modules/safe-regex/package.json @@ -0,0 +1,74 @@ +{ + "_from": "safe-regex@^1.1.0", + "_id": "safe-regex@1.1.0", + "_inBundle": false, + "_integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "_location": "/safe-regex", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "safe-regex@^1.1.0", + "name": "safe-regex", + "escapedName": "safe-regex", + "rawSpec": "^1.1.0", + "saveSpec": null, + "fetchSpec": "^1.1.0" + }, + "_requiredBy": [ + "/regex-not", + "/to-regex" + ], + "_resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "_shasum": "40a3669f3b077d1e943d44629e157dd48023bf2e", + "_spec": "safe-regex@^1.1.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/to-regex", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "bugs": { + "url": "https://github.com/substack/safe-regex/issues" + }, + "bundleDependencies": false, + "dependencies": { + "ret": "~0.1.10" + }, + "deprecated": false, + "description": "detect possibly catastrophic, exponential-time regular expressions", + "devDependencies": { + "tape": "^3.5.0" + }, + "homepage": "https://github.com/substack/safe-regex", + "keywords": [ + "catastrophic", + "exponential", + "regex", + "safe", + "sandbox" + ], + "license": "MIT", + "main": "index.js", + "name": "safe-regex", + "repository": { + "type": "git", + "url": "git://github.com/substack/safe-regex.git" + }, + "scripts": { + "test": "tape test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8", + "ie/9", + "ie/10", + "firefox/latest", + "chrome/latest", + "opera/latest", + "safari/latest" + ] + }, + "version": "1.1.0" +} diff --git a/node_modules/safe-regex/readme.markdown b/node_modules/safe-regex/readme.markdown new file mode 100644 index 0000000..83673ac --- /dev/null +++ b/node_modules/safe-regex/readme.markdown @@ -0,0 +1,65 @@ +# safe-regex + +detect potentially +[catastrophic](http://regular-expressions.mobi/catastrophic.html) +[exponential-time](http://perlgeek.de/blog-en/perl-tips/in-search-of-an-exponetial-regexp.html) +regular expressions by limiting the +[star height](https://en.wikipedia.org/wiki/Star_height) to 1 + +WARNING: This module merely *seems* to work given all the catastrophic regular +expressions I could find scouring the internet, but I don't have enough of a +background in automata to be absolutely sure that this module will catch all +exponential-time cases. + +[![browser support](https://ci.testling.com/substack/safe-regex.png)](https://ci.testling.com/substack/safe-regex) + +[![build status](https://secure.travis-ci.org/substack/safe-regex.png)](http://travis-ci.org/substack/safe-regex) + +# example + +``` js +var safe = require('safe-regex'); +var regex = process.argv.slice(2).join(' '); +console.log(safe(regex)); +``` + +``` +$ node safe.js '(x+x+)+y' +false +$ node safe.js '(beep|boop)*' +true +$ node safe.js '(a+){10}' +false +$ node safe.js '\blocation\s*:[^:\n]+\b(Oakland|San Francisco)\b' +true +``` + +# methods + +``` js +var safe = require('safe-regex') +``` + +## var ok = safe(re, opts={}) + +Return a boolean `ok` whether or not the regex `re` is safe and not possibly +catastrophic. + +`re` can be a `RegExp` object or just a string. + +If the `re` is a string and is an invalid regex, returns `false`. + +* `opts.limit` - maximum number of allowed repetitions in the entire regex. +Default: `25`. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install safe-regex +``` + +# license + +MIT diff --git a/node_modules/safe-regex/test/regex.js b/node_modules/safe-regex/test/regex.js new file mode 100644 index 0000000..0bda850 --- /dev/null +++ b/node_modules/safe-regex/test/regex.js @@ -0,0 +1,50 @@ +var safe = require('../'); +var test = require('tape'); + +var good = [ + /\bOakland\b/, + /\b(Oakland|San Francisco)\b/i, + /^\d+1337\d+$/i, + /^\d+(1337|404)\d+$/i, + /^\d+(1337|404)*\d+$/i, + RegExp(Array(26).join('a?') + Array(26).join('a')), +]; + +test('safe regex', function (t) { + t.plan(good.length); + good.forEach(function (re) { + t.equal(safe(re), true); + }); +}); + + +var bad = [ + /^(a?){25}(a){25}$/, + RegExp(Array(27).join('a?') + Array(27).join('a')), + /(x+x+)+y/, + /foo|(x+x+)+y/, + /(a+){10}y/, + /(a+){2}y/, + /(.*){1,32000}[bc]/ +]; + +test('unsafe regex', function (t) { + t.plan(bad.length); + bad.forEach(function (re) { + t.equal(safe(re), false); + }); +}); + +var invalid = [ + '*Oakland*', + 'hey(yoo))', + 'abcde(?>hellow)', + '[abc' +]; + +test('invalid regex', function (t) { + t.plan(invalid.length); + invalid.forEach(function (re) { + t.equal(safe(re), false); + }); +}); diff --git a/node_modules/semver-diff/index.js b/node_modules/semver-diff/index.js new file mode 100644 index 0000000..92c9c97 --- /dev/null +++ b/node_modules/semver-diff/index.js @@ -0,0 +1,27 @@ +'use strict'; +var semver = require('semver'); + +module.exports = function (a, b) { + if (semver.gt(a, b)) { + return null; + } + + a = semver.parse(a); + b = semver.parse(b); + + for (var key in a) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (a[key] !== b[key]) { + return key; + } + } + + if (key === 'prerelease' || key === 'build') { + if (JSON.stringify(a[key]) !== JSON.stringify(b[key])) { + return key; + } + } + } + + return null; +}; diff --git a/node_modules/semver-diff/license b/node_modules/semver-diff/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/semver-diff/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/semver-diff/package.json b/node_modules/semver-diff/package.json new file mode 100644 index 0000000..402f307 --- /dev/null +++ b/node_modules/semver-diff/package.json @@ -0,0 +1,66 @@ +{ + "_from": "semver-diff@^2.0.0", + "_id": "semver-diff@2.1.0", + "_inBundle": false, + "_integrity": "sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=", + "_location": "/semver-diff", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "semver-diff@^2.0.0", + "name": "semver-diff", + "escapedName": "semver-diff", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/update-notifier" + ], + "_resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz", + "_shasum": "4bbb8437c8d37e4b0cf1a68fd726ec6d645d6d36", + "_spec": "semver-diff@^2.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/update-notifier", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/semver-diff/issues" + }, + "bundleDependencies": false, + "dependencies": { + "semver": "^5.0.3" + }, + "deprecated": false, + "description": "Get the diff type of two semver versions: 0.0.1 0.0.2 → patch", + "devDependencies": { + "mocha": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/semver-diff#readme", + "keywords": [ + "semver", + "version", + "semantic", + "diff", + "difference" + ], + "license": "MIT", + "name": "semver-diff", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/semver-diff.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "2.1.0" +} diff --git a/node_modules/semver-diff/readme.md b/node_modules/semver-diff/readme.md new file mode 100644 index 0000000..06a172f --- /dev/null +++ b/node_modules/semver-diff/readme.md @@ -0,0 +1,52 @@ +# semver-diff [![Build Status](https://travis-ci.org/sindresorhus/semver-diff.svg?branch=master)](https://travis-ci.org/sindresorhus/semver-diff) + +> Get the diff type of two [semver](https://github.com/isaacs/node-semver) versions: `0.0.1 0.0.2` → `patch` + + +## Install + +```sh +$ npm install --save semver-diff +``` + + +## Usage + +```js +var semverDiff = require('semver-diff'); + +semverDiff('1.1.1', '1.1.2'); +//=> 'patch' + +semverDiff('0.0.1', '1.0.0'); +//=> 'major' + +semverDiff('0.0.1', '0.1.0'); +//=> 'minor' + +semverDiff('0.0.1-foo', '0.0.1-foo.bar'); +//=> 'prerelease' + +semverDiff('0.1.0', '0.1.0+foo'); +//=> 'build' + +semverDiff('0.0.1', '0.0.1'); +//=> null + +semverDiff('0.0.2', '0.0.1'); +//=> null +``` + + +## API + +### semverDiff(versionA, versionB) + +Returns the difference type between two semver versions, or `null` if they're identical or the second one is lower than the first. + +Possible values: `'major'`, `'minor'`, `'patch'`, `'prerelease'`, `'build'`, `null`. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/semver/LICENSE b/node_modules/semver/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/semver/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/node_modules/semver/README.md b/node_modules/semver/README.md new file mode 100644 index 0000000..951c539 --- /dev/null +++ b/node_modules/semver/README.md @@ -0,0 +1,388 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Install + +```bash +npm install --save semver +```` + +## Usage + +As a node module: + +```js +const semver = require('semver') + +semver.valid('1.2.3') // '1.2.3' +semver.valid('a.b.c') // null +semver.clean(' =v1.2.3 ') // '1.2.3' +semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true +semver.gt('1.2.3', '9.8.7') // false +semver.lt('1.2.3', '9.8.7') // true +semver.valid(semver.coerce('v2')) // '2.0.0' +semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' +``` + +As a command-line utility: + +``` +$ semver -h + +SemVer 5.3.0 + +A JavaScript implementation of the http://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them. +``` + +## Versions + +A "version" is described by the `v2.0.0` specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +A `version range` is a set of `comparators` which specify versions +that satisfy the range. + +A `comparator` is composed of an `operator` and a `version`. The set +of primitive `operators` is: + +* `<` Less than +* `<=` Less than or equal to +* `>` Greater than +* `>=` Greater than or equal to +* `=` Equal. If no operator is specified, then equality is assumed, + so this operator is optional, but MAY be included. + +For example, the comparator `>=1.2.7` would match the versions +`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` +or `1.1.0`. + +Comparators can be joined by whitespace to form a `comparator set`, +which is satisfied by the **intersection** of all of the comparators +it includes. + +A range is composed of one or more comparator sets, joined by `||`. A +version matches a range if and only if every comparator in at least +one of the `||`-separated comparator sets is satisfied by the version. + +For example, the range `>=1.2.7 <1.3.0` would match the versions +`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, +or `1.1.0`. + +The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, +`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. + +### Prerelease Tags + +If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then +it will only be allowed to satisfy comparator sets if at least one +comparator with the same `[major, minor, patch]` tuple also has a +prerelease tag. + +For example, the range `>1.2.3-alpha.3` would be allowed to match the +version `1.2.3-alpha.7`, but it would *not* be satisfied by +`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater +than" `1.2.3-alpha.3` according to the SemVer sort rules. The version +range only accepts prerelease tags on the `1.2.3` version. The +version `3.4.5` *would* satisfy the range, because it does not have a +prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. + +The purpose for this behavior is twofold. First, prerelease versions +frequently are updated very quickly, and contain many breaking changes +that are (by the author's design) not yet fit for public consumption. +Therefore, by default, they are excluded from range matching +semantics. + +Second, a user who has opted into using a prerelease version has +clearly indicated the intent to use *that specific* set of +alpha/beta/rc versions. By including a prerelease tag in the range, +the user is indicating that they are aware of the risk. However, it +is still not appropriate to assume that they have opted into taking a +similar risk on the *next* set of prerelease versions. + +#### Prerelease Identifiers + +The method `.inc` takes an additional `identifier` string argument that +will append the value of the string as a prerelease identifier: + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta') +// '1.2.4-beta.0' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta +1.2.4-beta.0 +``` + +Which then can be used to increment further: + +```bash +$ semver 1.2.4-beta.0 -i prerelease +1.2.4-beta.1 +``` + +### Advanced Range Syntax + +Advanced range syntax desugars to primitive comparators in +deterministic ways. + +Advanced ranges may be combined in the same way as primitive +comparators using white space or `||`. + +#### Hyphen Ranges `X.Y.Z - A.B.C` + +Specifies an inclusive set. + +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` + +If a partial version is provided as the first version in the inclusive +range, then the missing pieces are replaced with zeroes. + +* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` + +If a partial version is provided as the second version in the +inclusive range, then all versions that start with the supplied parts +of the tuple are accepted, but nothing that would be greater than the +provided tuple parts. + +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0` + +#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` + +Any of `X`, `x`, or `*` may be used to "stand in" for one of the +numeric values in the `[major, minor, patch]` tuple. + +* `*` := `>=0.0.0` (Any version satisfies) +* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) + +A partial version range is treated as an X-Range, so the special +character is in fact optional. + +* `""` (empty string) := `*` := `>=0.0.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` + +#### Tilde Ranges `~1.2.3` `~1.2` `~1` + +Allows patch-level changes if a minor version is specified on the +comparator. Allows minor-level changes if not. + +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. + +#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` + +Allows changes that do not modify the left-most non-zero digit in the +`[major, minor, patch]` tuple. In other words, this allows patch and +minor updates for versions `1.0.0` and above, patch updates for +versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. + +Many authors treat a `0.x` version as if the `x` were the major +"breaking-change" indicator. + +Caret ranges are ideal when an author may make breaking changes +between `0.2.4` and `0.3.0` releases, which is a common practice. +However, it presumes that there will *not* be breaking changes between +`0.2.4` and `0.2.5`. It allows for changes that are presumed to be +additive (but non-breaking), according to commonly observed practices. + +* `^1.2.3` := `>=1.2.3 <2.0.0` +* `^0.2.3` := `>=0.2.3 <0.3.0` +* `^0.0.3` := `>=0.0.3 <0.0.4` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the + `0.0.3` version *only* will be allowed, if they are greater than or + equal to `beta`. So, `0.0.3-pr.2` would be allowed. + +When parsing caret ranges, a missing `patch` value desugars to the +number `0`, but will allow flexibility within that value, even if the +major and minor versions are both `0`. + +* `^1.2.x` := `>=1.2.0 <2.0.0` +* `^0.0.x` := `>=0.0.0 <0.1.0` +* `^0.0` := `>=0.0.0 <0.1.0` + +A missing `minor` and `patch` values will desugar to zero, but also +allow flexibility within those values, even if the major version is +zero. + +* `^1.x` := `>=1.0.0 <2.0.0` +* `^0.x` := `>=0.0.0 <1.0.0` + +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + +## Functions + +All methods and classes take a final `loose` boolean argument that, if +true, will be more forgiving about not-quite-valid semver strings. +The resulting output will always be 100% strict, of course. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* `valid(v)`: Return the parsed version, or null if it's not valid. +* `inc(v, release)`: Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, + `prepatch`, or `prerelease`), or null if it's not valid + * `premajor` in one call will bump the version up to the next major + version and down to a prerelease of that major version. + `preminor`, and `prepatch` work the same way. + * If called from a non-prerelease version, the `prerelease` will work the + same as `prepatch`. It increments the patch version, then makes a + prerelease. If the input version is already a prerelease it simply + increments it. +* `prerelease(v)`: Returns an array of prerelease components, or null + if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` +* `major(v)`: Return the major version number. +* `minor(v)`: Return the minor version number. +* `patch(v)`: Return the patch version number. +* `intersects(r1, r2, loose)`: Return true if the two supplied ranges + or comparators intersect. + +### Comparison + +* `gt(v1, v2)`: `v1 > v2` +* `gte(v1, v2)`: `v1 >= v2` +* `lt(v1, v2)`: `v1 < v2` +* `lte(v1, v2)`: `v1 <= v2` +* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, + even if they're not the exact same string. You already know how to + compare strings. +* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. +* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions + in descending order when passed to `Array.sort()`. +* `diff(v1, v2)`: Returns difference between two versions by the release type + (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), + or null if the versions are the same. + +### Comparators + +* `intersects(comparator)`: Return true if the comparators intersect + +### Ranges + +* `validRange(range)`: Return the valid range or null if it's not valid +* `satisfies(version, range)`: Return true if the version satisfies the + range. +* `maxSatisfying(versions, range)`: Return the highest version in the list + that satisfies the range, or `null` if none of them do. +* `minSatisfying(versions, range)`: Return the lowest version in the list + that satisfies the range, or `null` if none of them do. +* `gtr(version, range)`: Return `true` if version is greater than all the + versions possible in the range. +* `ltr(version, range)`: Return `true` if version is less than all the + versions possible in the range. +* `outside(version, range, hilo)`: Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) +* `intersects(range)`: Return true if any of the ranges comparators intersect + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so the version `1.2.10` would not be greater than the +range (because `2.0.1` satisfies, which is higher), nor less than the +range (since `1.2.8` satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. + +### Coercion + +* `coerce(version)`: Coerces a string to semver if possible + +This aims to provide a very forgiving translation of a non-semver +string to semver. It looks for the first digit in a string, and +consumes all remaining characters which satisfy at least a partial semver +(e.g., `1`, `1.2`, `1.2.3`) up to the max permitted length (256 characters). +Longer versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). +All surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes `3.4.0`). +Only text which lacks digits will fail coercion (`version one` is not valid). +The maximum length for any semver component considered for coercion is 16 characters; +longer components will be ignored (`10000000000000000.4.7.4` becomes `4.7.4`). +The maximum value for any semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; +higher value components are invalid (`9999999999999999.4.7.4` is likely invalid). diff --git a/node_modules/semver/bin/semver b/node_modules/semver/bin/semver new file mode 100755 index 0000000..dddbcdf --- /dev/null +++ b/node_modules/semver/bin/semver @@ -0,0 +1,143 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +var argv = process.argv.slice(2) + , versions = [] + , range = [] + , gt = [] + , lt = [] + , eq = [] + , inc = null + , version = require("../package.json").version + , loose = false + , coerce = false + , identifier = undefined + , semver = require("../semver") + , reverse = false + +main() + +function main () { + if (!argv.length) return help() + while (argv.length) { + var a = argv.shift() + var i = a.indexOf('=') + if (i !== -1) { + a = a.slice(0, i) + argv.unshift(a.slice(i + 1)) + } + switch (a) { + case "-rv": case "-rev": case "--rev": case "--reverse": + reverse = true + break + case "-l": case "--loose": + loose = true + break + case "-v": case "--version": + versions.push(argv.shift()) + break + case "-i": case "--inc": case "--increment": + switch (argv[0]) { + case "major": case "minor": case "patch": case "prerelease": + case "premajor": case "preminor": case "prepatch": + inc = argv.shift() + break + default: + inc = "patch" + break + } + break + case "--preid": + identifier = argv.shift() + break + case "-r": case "--range": + range.push(argv.shift()) + break + case "-c": case "--coerce": + coerce = true + break + case "-h": case "--help": case "-?": + return help() + default: + versions.push(a) + break + } + } + + versions = versions.map(function (v) { + return coerce ? (semver.coerce(v) || {version: v}).version : v + }).filter(function (v) { + return semver.valid(v) + }) + if (!versions.length) return fail() + if (inc && (versions.length !== 1 || range.length)) + return failInc() + + for (var i = 0, l = range.length; i < l ; i ++) { + versions = versions.filter(function (v) { + return semver.satisfies(v, range[i], loose) + }) + if (!versions.length) return fail() + } + return success(versions) +} + +function failInc () { + console.error("--inc can only be used on a single version with no range") + fail() +} + +function fail () { process.exit(1) } + +function success () { + var compare = reverse ? "rcompare" : "compare" + versions.sort(function (a, b) { + return semver[compare](a, b, loose) + }).map(function (v) { + return semver.clean(v, loose) + }).map(function (v) { + return inc ? semver.inc(v, inc, loose, identifier) : v + }).forEach(function (v,i,_) { console.log(v) }) +} + +function help () { + console.log(["SemVer " + version + ,"" + ,"A JavaScript implementation of the http://semver.org/ specification" + ,"Copyright Isaac Z. Schlueter" + ,"" + ,"Usage: semver [options] [ [...]]" + ,"Prints valid versions sorted by SemVer precedence" + ,"" + ,"Options:" + ,"-r --range " + ," Print versions that match the specified range." + ,"" + ,"-i --increment []" + ," Increment a version by the specified level. Level can" + ," be one of: major, minor, patch, premajor, preminor," + ," prepatch, or prerelease. Default level is 'patch'." + ," Only one version may be specified." + ,"" + ,"--preid " + ," Identifier to be used to prefix premajor, preminor," + ," prepatch or prerelease version increments." + ,"" + ,"-l --loose" + ," Interpret versions and ranges loosely" + ,"" + ,"-c --coerce" + ," Coerce a string into SemVer if possible" + ," (does not imply --loose)" + ,"" + ,"Program exits successfully if any valid version satisfies" + ,"all supplied ranges, and prints all satisfying versions." + ,"" + ,"If no satisfying versions are found, then exits failure." + ,"" + ,"Versions are printed in ascending order, so supplying" + ,"multiple versions to the utility will just sort them." + ].join("\n")) +} diff --git a/node_modules/semver/package.json b/node_modules/semver/package.json new file mode 100644 index 0000000..a1d08cc --- /dev/null +++ b/node_modules/semver/package.json @@ -0,0 +1,56 @@ +{ + "_from": "semver@^5.5.0", + "_id": "semver@5.5.0", + "_inBundle": false, + "_integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", + "_location": "/semver", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "semver@^5.5.0", + "name": "semver", + "escapedName": "semver", + "rawSpec": "^5.5.0", + "saveSpec": null, + "fetchSpec": "^5.5.0" + }, + "_requiredBy": [ + "/nodemon", + "/package-json", + "/semver-diff" + ], + "_resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "_shasum": "dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab", + "_spec": "semver@^5.5.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/nodemon", + "bin": { + "semver": "./bin/semver" + }, + "bugs": { + "url": "https://github.com/npm/node-semver/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "The semantic version parser used by npm.", + "devDependencies": { + "tap": "^10.7.0" + }, + "files": [ + "bin", + "range.bnf", + "semver.js" + ], + "homepage": "https://github.com/npm/node-semver#readme", + "license": "ISC", + "main": "semver.js", + "name": "semver", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/node-semver.git" + }, + "scripts": { + "test": "tap test/*.js --cov -J" + }, + "version": "5.5.0" +} diff --git a/node_modules/semver/range.bnf b/node_modules/semver/range.bnf new file mode 100644 index 0000000..d4c6ae0 --- /dev/null +++ b/node_modules/semver/range.bnf @@ -0,0 +1,16 @@ +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | [1-9] ( [0-9] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ diff --git a/node_modules/semver/semver.js b/node_modules/semver/semver.js new file mode 100644 index 0000000..9cf9f6e --- /dev/null +++ b/node_modules/semver/semver.js @@ -0,0 +1,1324 @@ +exports = module.exports = SemVer; + +// The debug function is excluded entirely from the minified version. +/* nomin */ var debug; +/* nomin */ if (typeof process === 'object' && + /* nomin */ process.env && + /* nomin */ process.env.NODE_DEBUG && + /* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG)) + /* nomin */ debug = function() { + /* nomin */ var args = Array.prototype.slice.call(arguments, 0); + /* nomin */ args.unshift('SEMVER'); + /* nomin */ console.log.apply(console, args); + /* nomin */ }; +/* nomin */ else + /* nomin */ debug = function() {}; + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0'; + +var MAX_LENGTH = 256; +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; + +// Max safe segment length for coercion. +var MAX_SAFE_COMPONENT_LENGTH = 16; + +// The actual regexps go on exports.re +var re = exports.re = []; +var src = exports.src = []; +var R = 0; + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +var NUMERICIDENTIFIER = R++; +src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'; +var NUMERICIDENTIFIERLOOSE = R++; +src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'; + + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +var NONNUMERICIDENTIFIER = R++; +src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; + + +// ## Main Version +// Three dot-separated numeric identifiers. + +var MAINVERSION = R++; +src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')'; + +var MAINVERSIONLOOSE = R++; +src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')'; + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +var PRERELEASEIDENTIFIER = R++; +src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + + '|' + src[NONNUMERICIDENTIFIER] + ')'; + +var PRERELEASEIDENTIFIERLOOSE = R++; +src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + + '|' + src[NONNUMERICIDENTIFIER] + ')'; + + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +var PRERELEASE = R++; +src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'; + +var PRERELEASELOOSE = R++; +src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'; + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +var BUILDIDENTIFIER = R++; +src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +var BUILD = R++; +src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))'; + + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +var FULL = R++; +var FULLPLAIN = 'v?' + src[MAINVERSION] + + src[PRERELEASE] + '?' + + src[BUILD] + '?'; + +src[FULL] = '^' + FULLPLAIN + '$'; + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + + src[PRERELEASELOOSE] + '?' + + src[BUILD] + '?'; + +var LOOSE = R++; +src[LOOSE] = '^' + LOOSEPLAIN + '$'; + +var GTLT = R++; +src[GTLT] = '((?:<|>)?=?)'; + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +var XRANGEIDENTIFIERLOOSE = R++; +src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'; +var XRANGEIDENTIFIER = R++; +src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'; + +var XRANGEPLAIN = R++; +src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:' + src[PRERELEASE] + ')?' + + src[BUILD] + '?' + + ')?)?'; + +var XRANGEPLAINLOOSE = R++; +src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[PRERELEASELOOSE] + ')?' + + src[BUILD] + '?' + + ')?)?'; + +var XRANGE = R++; +src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'; +var XRANGELOOSE = R++; +src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'; + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +var COERCE = R++; +src[COERCE] = '(?:^|[^\\d])' + + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:$|[^\\d])'; + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +var LONETILDE = R++; +src[LONETILDE] = '(?:~>?)'; + +var TILDETRIM = R++; +src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'; +re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g'); +var tildeTrimReplace = '$1~'; + +var TILDE = R++; +src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'; +var TILDELOOSE = R++; +src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'; + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +var LONECARET = R++; +src[LONECARET] = '(?:\\^)'; + +var CARETTRIM = R++; +src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'; +re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g'); +var caretTrimReplace = '$1^'; + +var CARET = R++; +src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'; +var CARETLOOSE = R++; +src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'; + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +var COMPARATORLOOSE = R++; +src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'; +var COMPARATOR = R++; +src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'; + + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +var COMPARATORTRIM = R++; +src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'; + +// this one has to use the /g flag +re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g'); +var comparatorTrimReplace = '$1$2$3'; + + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +var HYPHENRANGE = R++; +src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAIN] + ')' + + '\\s*$'; + +var HYPHENRANGELOOSE = R++; +src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s*$'; + +// Star ranges basically just allow anything at all. +var STAR = R++; +src[STAR] = '(<|>)?=?\\s*\\*'; + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]); + if (!re[i]) + re[i] = new RegExp(src[i]); +} + +exports.parse = parse; +function parse(version, loose) { + if (version instanceof SemVer) + return version; + + if (typeof version !== 'string') + return null; + + if (version.length > MAX_LENGTH) + return null; + + var r = loose ? re[LOOSE] : re[FULL]; + if (!r.test(version)) + return null; + + try { + return new SemVer(version, loose); + } catch (er) { + return null; + } +} + +exports.valid = valid; +function valid(version, loose) { + var v = parse(version, loose); + return v ? v.version : null; +} + + +exports.clean = clean; +function clean(version, loose) { + var s = parse(version.trim().replace(/^[=v]+/, ''), loose); + return s ? s.version : null; +} + +exports.SemVer = SemVer; + +function SemVer(version, loose) { + if (version instanceof SemVer) { + if (version.loose === loose) + return version; + else + version = version.version; + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version); + } + + if (version.length > MAX_LENGTH) + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + + if (!(this instanceof SemVer)) + return new SemVer(version, loose); + + debug('SemVer', version, loose); + this.loose = loose; + var m = version.trim().match(loose ? re[LOOSE] : re[FULL]); + + if (!m) + throw new TypeError('Invalid Version: ' + version); + + this.raw = version; + + // these are actually numbers + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) + throw new TypeError('Invalid major version') + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) + throw new TypeError('Invalid minor version') + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) + throw new TypeError('Invalid patch version') + + // numberify any prerelease numeric ids + if (!m[4]) + this.prerelease = []; + else + this.prerelease = m[4].split('.').map(function(id) { + if (/^[0-9]+$/.test(id)) { + var num = +id; + if (num >= 0 && num < MAX_SAFE_INTEGER) + return num; + } + return id; + }); + + this.build = m[5] ? m[5].split('.') : []; + this.format(); +} + +SemVer.prototype.format = function() { + this.version = this.major + '.' + this.minor + '.' + this.patch; + if (this.prerelease.length) + this.version += '-' + this.prerelease.join('.'); + return this.version; +}; + +SemVer.prototype.toString = function() { + return this.version; +}; + +SemVer.prototype.compare = function(other) { + debug('SemVer.compare', this.version, this.loose, other); + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + return this.compareMain(other) || this.comparePre(other); +}; + +SemVer.prototype.compareMain = function(other) { + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch); +}; + +SemVer.prototype.comparePre = function(other) { + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) + return -1; + else if (!this.prerelease.length && other.prerelease.length) + return 1; + else if (!this.prerelease.length && !other.prerelease.length) + return 0; + + var i = 0; + do { + var a = this.prerelease[i]; + var b = other.prerelease[i]; + debug('prerelease compare', i, a, b); + if (a === undefined && b === undefined) + return 0; + else if (b === undefined) + return 1; + else if (a === undefined) + return -1; + else if (a === b) + continue; + else + return compareIdentifiers(a, b); + } while (++i); +}; + +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function(release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc('pre', identifier); + break; + case 'preminor': + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc('pre', identifier); + break; + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0; + this.inc('patch', identifier); + this.inc('pre', identifier); + break; + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) + this.inc('patch', identifier); + this.inc('pre', identifier); + break; + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) + this.major++; + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break; + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) + this.minor++; + this.patch = 0; + this.prerelease = []; + break; + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) + this.patch++; + this.prerelease = []; + break; + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) + this.prerelease = [0]; + else { + var i = this.prerelease.length; + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++; + i = -2; + } + } + if (i === -1) // didn't increment anything + this.prerelease.push(0); + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) + this.prerelease = [identifier, 0]; + } else + this.prerelease = [identifier, 0]; + } + break; + + default: + throw new Error('invalid increment argument: ' + release); + } + this.format(); + this.raw = this.version; + return this; +}; + +exports.inc = inc; +function inc(version, release, loose, identifier) { + if (typeof(loose) === 'string') { + identifier = loose; + loose = undefined; + } + + try { + return new SemVer(version, loose).inc(release, identifier).version; + } catch (er) { + return null; + } +} + +exports.diff = diff; +function diff(version1, version2) { + if (eq(version1, version2)) { + return null; + } else { + var v1 = parse(version1); + var v2 = parse(version2); + if (v1.prerelease.length || v2.prerelease.length) { + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return 'pre'+key; + } + } + } + return 'prerelease'; + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return key; + } + } + } + } +} + +exports.compareIdentifiers = compareIdentifiers; + +var numeric = /^[0-9]+$/; +function compareIdentifiers(a, b) { + var anum = numeric.test(a); + var bnum = numeric.test(b); + + if (anum && bnum) { + a = +a; + b = +b; + } + + return (anum && !bnum) ? -1 : + (bnum && !anum) ? 1 : + a < b ? -1 : + a > b ? 1 : + 0; +} + +exports.rcompareIdentifiers = rcompareIdentifiers; +function rcompareIdentifiers(a, b) { + return compareIdentifiers(b, a); +} + +exports.major = major; +function major(a, loose) { + return new SemVer(a, loose).major; +} + +exports.minor = minor; +function minor(a, loose) { + return new SemVer(a, loose).minor; +} + +exports.patch = patch; +function patch(a, loose) { + return new SemVer(a, loose).patch; +} + +exports.compare = compare; +function compare(a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)); +} + +exports.compareLoose = compareLoose; +function compareLoose(a, b) { + return compare(a, b, true); +} + +exports.rcompare = rcompare; +function rcompare(a, b, loose) { + return compare(b, a, loose); +} + +exports.sort = sort; +function sort(list, loose) { + return list.sort(function(a, b) { + return exports.compare(a, b, loose); + }); +} + +exports.rsort = rsort; +function rsort(list, loose) { + return list.sort(function(a, b) { + return exports.rcompare(a, b, loose); + }); +} + +exports.gt = gt; +function gt(a, b, loose) { + return compare(a, b, loose) > 0; +} + +exports.lt = lt; +function lt(a, b, loose) { + return compare(a, b, loose) < 0; +} + +exports.eq = eq; +function eq(a, b, loose) { + return compare(a, b, loose) === 0; +} + +exports.neq = neq; +function neq(a, b, loose) { + return compare(a, b, loose) !== 0; +} + +exports.gte = gte; +function gte(a, b, loose) { + return compare(a, b, loose) >= 0; +} + +exports.lte = lte; +function lte(a, b, loose) { + return compare(a, b, loose) <= 0; +} + +exports.cmp = cmp; +function cmp(a, op, b, loose) { + var ret; + switch (op) { + case '===': + if (typeof a === 'object') a = a.version; + if (typeof b === 'object') b = b.version; + ret = a === b; + break; + case '!==': + if (typeof a === 'object') a = a.version; + if (typeof b === 'object') b = b.version; + ret = a !== b; + break; + case '': case '=': case '==': ret = eq(a, b, loose); break; + case '!=': ret = neq(a, b, loose); break; + case '>': ret = gt(a, b, loose); break; + case '>=': ret = gte(a, b, loose); break; + case '<': ret = lt(a, b, loose); break; + case '<=': ret = lte(a, b, loose); break; + default: throw new TypeError('Invalid operator: ' + op); + } + return ret; +} + +exports.Comparator = Comparator; +function Comparator(comp, loose) { + if (comp instanceof Comparator) { + if (comp.loose === loose) + return comp; + else + comp = comp.value; + } + + if (!(this instanceof Comparator)) + return new Comparator(comp, loose); + + debug('comparator', comp, loose); + this.loose = loose; + this.parse(comp); + + if (this.semver === ANY) + this.value = ''; + else + this.value = this.operator + this.semver.version; + + debug('comp', this); +} + +var ANY = {}; +Comparator.prototype.parse = function(comp) { + var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var m = comp.match(r); + + if (!m) + throw new TypeError('Invalid comparator: ' + comp); + + this.operator = m[1]; + if (this.operator === '=') + this.operator = ''; + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) + this.semver = ANY; + else + this.semver = new SemVer(m[2], this.loose); +}; + +Comparator.prototype.toString = function() { + return this.value; +}; + +Comparator.prototype.test = function(version) { + debug('Comparator.test', version, this.loose); + + if (this.semver === ANY) + return true; + + if (typeof version === 'string') + version = new SemVer(version, this.loose); + + return cmp(version, this.operator, this.semver, this.loose); +}; + +Comparator.prototype.intersects = function(comp, loose) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required'); + } + + var rangeTmp; + + if (this.operator === '') { + rangeTmp = new Range(comp.value, loose); + return satisfies(this.value, rangeTmp, loose); + } else if (comp.operator === '') { + rangeTmp = new Range(this.value, loose); + return satisfies(comp.semver, rangeTmp, loose); + } + + var sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>'); + var sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<'); + var sameSemVer = this.semver.version === comp.semver.version; + var differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<='); + var oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, loose) && + ((this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<')); + var oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, loose) && + ((this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>')); + + return sameDirectionIncreasing || sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || oppositeDirectionsGreaterThan; +}; + + +exports.Range = Range; +function Range(range, loose) { + if (range instanceof Range) { + if (range.loose === loose) { + return range; + } else { + return new Range(range.raw, loose); + } + } + + if (range instanceof Comparator) { + return new Range(range.value, loose); + } + + if (!(this instanceof Range)) + return new Range(range, loose); + + this.loose = loose; + + // First, split based on boolean or || + this.raw = range; + this.set = range.split(/\s*\|\|\s*/).map(function(range) { + return this.parseRange(range.trim()); + }, this).filter(function(c) { + // throw out any that are not relevant for whatever reason + return c.length; + }); + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + range); + } + + this.format(); +} + +Range.prototype.format = function() { + this.range = this.set.map(function(comps) { + return comps.join(' ').trim(); + }).join('||').trim(); + return this.range; +}; + +Range.prototype.toString = function() { + return this.range; +}; + +Range.prototype.parseRange = function(range) { + var loose = this.loose; + range = range.trim(); + debug('range', range, loose); + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]; + range = range.replace(hr, hyphenReplace); + debug('hyphen replace', range); + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace); + debug('comparator trim', range, re[COMPARATORTRIM]); + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[TILDETRIM], tildeTrimReplace); + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[CARETTRIM], caretTrimReplace); + + // normalize spaces + range = range.split(/\s+/).join(' '); + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var set = range.split(' ').map(function(comp) { + return parseComparator(comp, loose); + }).join(' ').split(/\s+/); + if (this.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function(comp) { + return !!comp.match(compRe); + }); + } + set = set.map(function(comp) { + return new Comparator(comp, loose); + }); + + return set; +}; + +Range.prototype.intersects = function(range, loose) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required'); + } + + return this.set.some(function(thisComparators) { + return thisComparators.every(function(thisComparator) { + return range.set.some(function(rangeComparators) { + return rangeComparators.every(function(rangeComparator) { + return thisComparator.intersects(rangeComparator, loose); + }); + }); + }); + }); +}; + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators; +function toComparators(range, loose) { + return new Range(range, loose).set.map(function(comp) { + return comp.map(function(c) { + return c.value; + }).join(' ').trim().split(' '); + }); +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator(comp, loose) { + debug('comp', comp); + comp = replaceCarets(comp, loose); + debug('caret', comp); + comp = replaceTildes(comp, loose); + debug('tildes', comp); + comp = replaceXRanges(comp, loose); + debug('xrange', comp); + comp = replaceStars(comp, loose); + debug('stars', comp); + return comp; +} + +function isX(id) { + return !id || id.toLowerCase() === 'x' || id === '*'; +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes(comp, loose) { + return comp.trim().split(/\s+/).map(function(comp) { + return replaceTilde(comp, loose); + }).join(' '); +} + +function replaceTilde(comp, loose) { + var r = loose ? re[TILDELOOSE] : re[TILDE]; + return comp.replace(r, function(_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr); + var ret; + + if (isX(M)) + ret = ''; + else if (isX(m)) + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + else if (isX(p)) + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + else if (pr) { + debug('replaceTilde pr', pr); + if (pr.charAt(0) !== '-') + pr = '-' + pr; + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + (+m + 1) + '.0'; + } else + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0'; + + debug('tilde return', ret); + return ret; + }); +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets(comp, loose) { + return comp.trim().split(/\s+/).map(function(comp) { + return replaceCaret(comp, loose); + }).join(' '); +} + +function replaceCaret(comp, loose) { + debug('caret', comp, loose); + var r = loose ? re[CARETLOOSE] : re[CARET]; + return comp.replace(r, function(_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr); + var ret; + + if (isX(M)) + ret = ''; + else if (isX(m)) + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + else if (isX(p)) { + if (M === '0') + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + else + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; + } else if (pr) { + debug('replaceCaret pr', pr); + if (pr.charAt(0) !== '-') + pr = '-' + pr; + if (M === '0') { + if (m === '0') + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + m + '.' + (+p + 1); + else + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + (+m + 1) + '.0'; + } else + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + (+M + 1) + '.0.0'; + } else { + debug('no pr'); + if (M === '0') { + if (m === '0') + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1); + else + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0'; + } else + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0'; + } + + debug('caret return', ret); + return ret; + }); +} + +function replaceXRanges(comp, loose) { + debug('replaceXRanges', comp, loose); + return comp.split(/\s+/).map(function(comp) { + return replaceXRange(comp, loose); + }).join(' '); +} + +function replaceXRange(comp, loose) { + comp = comp.trim(); + var r = loose ? re[XRANGELOOSE] : re[XRANGE]; + return comp.replace(r, function(ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr); + var xM = isX(M); + var xm = xM || isX(m); + var xp = xm || isX(p); + var anyX = xp; + + if (gtlt === '=' && anyX) + gtlt = ''; + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0'; + } else { + // nothing is forbidden + ret = '*'; + } + } else if (gtlt && anyX) { + // replace X with 0 + if (xm) + m = 0; + if (xp) + p = 0; + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>='; + if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else if (xp) { + m = +m + 1; + p = 0; + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<'; + if (xm) + M = +M + 1; + else + m = +m + 1; + } + + ret = gtlt + M + '.' + m + '.' + p; + } else if (xm) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + } else if (xp) { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + } + + debug('xRange return', ret); + + return ret; + }); +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars(comp, loose) { + debug('replaceStars', comp, loose); + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[STAR], ''); +} + +// This function is passed to string.replace(re[HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + + if (isX(fM)) + from = ''; + else if (isX(fm)) + from = '>=' + fM + '.0.0'; + else if (isX(fp)) + from = '>=' + fM + '.' + fm + '.0'; + else + from = '>=' + from; + + if (isX(tM)) + to = ''; + else if (isX(tm)) + to = '<' + (+tM + 1) + '.0.0'; + else if (isX(tp)) + to = '<' + tM + '.' + (+tm + 1) + '.0'; + else if (tpr) + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; + else + to = '<=' + to; + + return (from + ' ' + to).trim(); +} + + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function(version) { + if (!version) + return false; + + if (typeof version === 'string') + version = new SemVer(version, this.loose); + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version)) + return true; + } + return false; +}; + +function testSet(set, version) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) + return false; + } + + if (version.prerelease.length) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (var i = 0; i < set.length; i++) { + debug(set[i].semver); + if (set[i].semver === ANY) + continue; + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver; + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) + return true; + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false; + } + + return true; +} + +exports.satisfies = satisfies; +function satisfies(version, range, loose) { + try { + range = new Range(range, loose); + } catch (er) { + return false; + } + return range.test(version); +} + +exports.maxSatisfying = maxSatisfying; +function maxSatisfying(versions, range, loose) { + var max = null; + var maxSV = null; + try { + var rangeObj = new Range(range, loose); + } catch (er) { + return null; + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { // satisfies(v, range, loose) + if (!max || maxSV.compare(v) === -1) { // compare(max, v, true) + max = v; + maxSV = new SemVer(max, loose); + } + } + }) + return max; +} + +exports.minSatisfying = minSatisfying; +function minSatisfying(versions, range, loose) { + var min = null; + var minSV = null; + try { + var rangeObj = new Range(range, loose); + } catch (er) { + return null; + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { // satisfies(v, range, loose) + if (!min || minSV.compare(v) === 1) { // compare(min, v, true) + min = v; + minSV = new SemVer(min, loose); + } + } + }) + return min; +} + +exports.validRange = validRange; +function validRange(range, loose) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, loose).range || '*'; + } catch (er) { + return null; + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr; +function ltr(version, range, loose) { + return outside(version, range, '<', loose); +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr; +function gtr(version, range, loose) { + return outside(version, range, '>', loose); +} + +exports.outside = outside; +function outside(version, range, hilo, loose) { + version = new SemVer(version, loose); + range = new Range(range, loose); + + var gtfn, ltefn, ltfn, comp, ecomp; + switch (hilo) { + case '>': + gtfn = gt; + ltefn = lte; + ltfn = lt; + comp = '>'; + ecomp = '>='; + break; + case '<': + gtfn = lt; + ltefn = gte; + ltfn = gt; + comp = '<'; + ecomp = '<='; + break; + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, loose)) { + return false; + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i]; + + var high = null; + var low = null; + + comparators.forEach(function(comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator; + low = low || comparator; + if (gtfn(comparator.semver, high.semver, loose)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, loose)) { + low = comparator; + } + }); + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false; + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false; + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false; + } + } + return true; +} + +exports.prerelease = prerelease; +function prerelease(version, loose) { + var parsed = parse(version, loose); + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null; +} + +exports.intersects = intersects; +function intersects(r1, r2, loose) { + r1 = new Range(r1, loose) + r2 = new Range(r2, loose) + return r1.intersects(r2) +} + +exports.coerce = coerce; +function coerce(version) { + if (version instanceof SemVer) + return version; + + if (typeof version !== 'string') + return null; + + var match = version.match(re[COERCE]); + + if (match == null) + return null; + + return parse((match[1] || '0') + '.' + (match[2] || '0') + '.' + (match[3] || '0')); +} diff --git a/node_modules/send/HISTORY.md b/node_modules/send/HISTORY.md new file mode 100644 index 0000000..319aad8 --- /dev/null +++ b/node_modules/send/HISTORY.md @@ -0,0 +1,436 @@ +0.15.6 / 2017-09-22 +=================== + + * deps: debug@2.6.9 + * perf: improve `If-Match` token parsing + +0.15.5 / 2017-09-20 +=================== + + * deps: etag@~1.8.1 + - perf: replace regular expression with substring + * deps: fresh@0.5.2 + - Fix handling of modified headers with invalid dates + - perf: improve ETag match loop + - perf: improve `If-None-Match` token parsing + +0.15.4 / 2017-08-05 +=================== + + * deps: debug@2.6.8 + * deps: depd@~1.1.1 + - Remove unnecessary `Buffer` loading + * deps: http-errors@~1.6.2 + - deps: depd@1.1.1 + +0.15.3 / 2017-05-16 +=================== + + * deps: debug@2.6.7 + - deps: ms@2.0.0 + * deps: ms@2.0.0 + +0.15.2 / 2017-04-26 +=================== + + * deps: debug@2.6.4 + - Fix `DEBUG_MAX_ARRAY_LENGTH` + - deps: ms@0.7.3 + * deps: ms@1.0.0 + +0.15.1 / 2017-03-04 +=================== + + * Fix issue when `Date.parse` does not return `NaN` on invalid date + * Fix strict violation in broken environments + +0.15.0 / 2017-02-25 +=================== + + * Support `If-Match` and `If-Unmodified-Since` headers + * Add `res` and `path` arguments to `directory` event + * Remove usage of `res._headers` private field + - Improves compatibility with Node.js 8 nightly + * Send complete HTML document in redirect & error responses + * Set default CSP header in redirect & error responses + * Use `res.getHeaderNames()` when available + * Use `res.headersSent` when available + * deps: debug@2.6.1 + - Allow colors in workers + - Deprecated `DEBUG_FD` environment variable set to `3` or higher + - Fix error when running under React Native + - Use same color for same namespace + - deps: ms@0.7.2 + * deps: etag@~1.8.0 + * deps: fresh@0.5.0 + - Fix false detection of `no-cache` request directive + - Fix incorrect result when `If-None-Match` has both `*` and ETags + - Fix weak `ETag` matching to match spec + - perf: delay reading header values until needed + - perf: enable strict mode + - perf: hoist regular expressions + - perf: remove duplicate conditional + - perf: remove unnecessary boolean coercions + - perf: skip checking modified time if ETag check failed + - perf: skip parsing `If-None-Match` when no `ETag` header + - perf: use `Date.parse` instead of `new Date` + * deps: http-errors@~1.6.1 + - Make `message` property enumerable for `HttpError`s + - deps: setprototypeof@1.0.3 + +0.14.2 / 2017-01-23 +=================== + + * deps: http-errors@~1.5.1 + - deps: inherits@2.0.3 + - deps: setprototypeof@1.0.2 + - deps: statuses@'>= 1.3.1 < 2' + * deps: ms@0.7.2 + * deps: statuses@~1.3.1 + +0.14.1 / 2016-06-09 +=================== + + * Fix redirect error when `path` contains raw non-URL characters + * Fix redirect when `path` starts with multiple forward slashes + +0.14.0 / 2016-06-06 +=================== + + * Add `acceptRanges` option + * Add `cacheControl` option + * Attempt to combine multiple ranges into single range + * Correctly inherit from `Stream` class + * Fix `Content-Range` header in 416 responses when using `start`/`end` options + * Fix `Content-Range` header missing from default 416 responses + * Ignore non-byte `Range` headers + * deps: http-errors@~1.5.0 + - Add `HttpError` export, for `err instanceof createError.HttpError` + - Support new code `421 Misdirected Request` + - Use `setprototypeof` module to replace `__proto__` setting + - deps: inherits@2.0.1 + - deps: statuses@'>= 1.3.0 < 2' + - perf: enable strict mode + * deps: range-parser@~1.2.0 + - Fix incorrectly returning -1 when there is at least one valid range + - perf: remove internal function + * deps: statuses@~1.3.0 + - Add `421 Misdirected Request` + - perf: enable strict mode + * perf: remove argument reassignment + +0.13.2 / 2016-03-05 +=================== + + * Fix invalid `Content-Type` header when `send.mime.default_type` unset + +0.13.1 / 2016-01-16 +=================== + + * deps: depd@~1.1.0 + - Support web browser loading + - perf: enable strict mode + * deps: destroy@~1.0.4 + - perf: enable strict mode + * deps: escape-html@~1.0.3 + - perf: enable strict mode + - perf: optimize string replacement + - perf: use faster string coercion + * deps: range-parser@~1.0.3 + - perf: enable strict mode + +0.13.0 / 2015-06-16 +=================== + + * Allow Node.js HTTP server to set `Date` response header + * Fix incorrectly removing `Content-Location` on 304 response + * Improve the default redirect response headers + * Send appropriate headers on default error response + * Use `http-errors` for standard emitted errors + * Use `statuses` instead of `http` module for status messages + * deps: escape-html@1.0.2 + * deps: etag@~1.7.0 + - Improve stat performance by removing hashing + * deps: fresh@0.3.0 + - Add weak `ETag` matching support + * deps: on-finished@~2.3.0 + - Add defined behavior for HTTP `CONNECT` requests + - Add defined behavior for HTTP `Upgrade` requests + - deps: ee-first@1.1.1 + * perf: enable strict mode + * perf: remove unnecessary array allocations + +0.12.3 / 2015-05-13 +=================== + + * deps: debug@~2.2.0 + - deps: ms@0.7.1 + * deps: depd@~1.0.1 + * deps: etag@~1.6.0 + - Improve support for JXcore + - Support "fake" stats objects in environments without `fs` + * deps: ms@0.7.1 + - Prevent extraordinarily long inputs + * deps: on-finished@~2.2.1 + +0.12.2 / 2015-03-13 +=================== + + * Throw errors early for invalid `extensions` or `index` options + * deps: debug@~2.1.3 + - Fix high intensity foreground color for bold + - deps: ms@0.7.0 + +0.12.1 / 2015-02-17 +=================== + + * Fix regression sending zero-length files + +0.12.0 / 2015-02-16 +=================== + + * Always read the stat size from the file + * Fix mutating passed-in `options` + * deps: mime@1.3.4 + +0.11.1 / 2015-01-20 +=================== + + * Fix `root` path disclosure + +0.11.0 / 2015-01-05 +=================== + + * deps: debug@~2.1.1 + * deps: etag@~1.5.1 + - deps: crc@3.2.1 + * deps: ms@0.7.0 + - Add `milliseconds` + - Add `msecs` + - Add `secs` + - Add `mins` + - Add `hrs` + - Add `yrs` + * deps: on-finished@~2.2.0 + +0.10.1 / 2014-10-22 +=================== + + * deps: on-finished@~2.1.1 + - Fix handling of pipelined requests + +0.10.0 / 2014-10-15 +=================== + + * deps: debug@~2.1.0 + - Implement `DEBUG_FD` env variable support + * deps: depd@~1.0.0 + * deps: etag@~1.5.0 + - Improve string performance + - Slightly improve speed for weak ETags over 1KB + +0.9.3 / 2014-09-24 +================== + + * deps: etag@~1.4.0 + - Support "fake" stats objects + +0.9.2 / 2014-09-15 +================== + + * deps: depd@0.4.5 + * deps: etag@~1.3.1 + * deps: range-parser@~1.0.2 + +0.9.1 / 2014-09-07 +================== + + * deps: fresh@0.2.4 + +0.9.0 / 2014-09-07 +================== + + * Add `lastModified` option + * Use `etag` to generate `ETag` header + * deps: debug@~2.0.0 + +0.8.5 / 2014-09-04 +================== + + * Fix malicious path detection for empty string path + +0.8.4 / 2014-09-04 +================== + + * Fix a path traversal issue when using `root` + +0.8.3 / 2014-08-16 +================== + + * deps: destroy@1.0.3 + - renamed from dethroy + * deps: on-finished@2.1.0 + +0.8.2 / 2014-08-14 +================== + + * Work around `fd` leak in Node.js 0.10 for `fs.ReadStream` + * deps: dethroy@1.0.2 + +0.8.1 / 2014-08-05 +================== + + * Fix `extensions` behavior when file already has extension + +0.8.0 / 2014-08-05 +================== + + * Add `extensions` option + +0.7.4 / 2014-08-04 +================== + + * Fix serving index files without root dir + +0.7.3 / 2014-07-29 +================== + + * Fix incorrect 403 on Windows and Node.js 0.11 + +0.7.2 / 2014-07-27 +================== + + * deps: depd@0.4.4 + - Work-around v8 generating empty stack traces + +0.7.1 / 2014-07-26 +================== + + * deps: depd@0.4.3 + - Fix exception when global `Error.stackTraceLimit` is too low + +0.7.0 / 2014-07-20 +================== + + * Deprecate `hidden` option; use `dotfiles` option + * Add `dotfiles` option + * deps: debug@1.0.4 + * deps: depd@0.4.2 + - Add `TRACE_DEPRECATION` environment variable + - Remove non-standard grey color from color output + - Support `--no-deprecation` argument + - Support `--trace-deprecation` argument + +0.6.0 / 2014-07-11 +================== + + * Deprecate `from` option; use `root` option + * Deprecate `send.etag()` -- use `etag` in `options` + * Deprecate `send.hidden()` -- use `hidden` in `options` + * Deprecate `send.index()` -- use `index` in `options` + * Deprecate `send.maxage()` -- use `maxAge` in `options` + * Deprecate `send.root()` -- use `root` in `options` + * Cap `maxAge` value to 1 year + * deps: debug@1.0.3 + - Add support for multiple wildcards in namespaces + +0.5.0 / 2014-06-28 +================== + + * Accept string for `maxAge` (converted by `ms`) + * Add `headers` event + * Include link in default redirect response + * Use `EventEmitter.listenerCount` to count listeners + +0.4.3 / 2014-06-11 +================== + + * Do not throw un-catchable error on file open race condition + * Use `escape-html` for HTML escaping + * deps: debug@1.0.2 + - fix some debugging output colors on node.js 0.8 + * deps: finished@1.2.2 + * deps: fresh@0.2.2 + +0.4.2 / 2014-06-09 +================== + + * fix "event emitter leak" warnings + * deps: debug@1.0.1 + * deps: finished@1.2.1 + +0.4.1 / 2014-06-02 +================== + + * Send `max-age` in `Cache-Control` in correct format + +0.4.0 / 2014-05-27 +================== + + * Calculate ETag with md5 for reduced collisions + * Fix wrong behavior when index file matches directory + * Ignore stream errors after request ends + - Goodbye `EBADF, read` + * Skip directories in index file search + * deps: debug@0.8.1 + +0.3.0 / 2014-04-24 +================== + + * Fix sending files with dots without root set + * Coerce option types + * Accept API options in options object + * Set etags to "weak" + * Include file path in etag + * Make "Can't set headers after they are sent." catchable + * Send full entity-body for multi range requests + * Default directory access to 403 when index disabled + * Support multiple index paths + * Support "If-Range" header + * Control whether to generate etags + * deps: mime@1.2.11 + +0.2.0 / 2014-01-29 +================== + + * update range-parser and fresh + +0.1.4 / 2013-08-11 +================== + + * update fresh + +0.1.3 / 2013-07-08 +================== + + * Revert "Fix fd leak" + +0.1.2 / 2013-07-03 +================== + + * Fix fd leak + +0.1.0 / 2012-08-25 +================== + + * add options parameter to send() that is passed to fs.createReadStream() [kanongil] + +0.0.4 / 2012-08-16 +================== + + * allow custom "Accept-Ranges" definition + +0.0.3 / 2012-07-16 +================== + + * fix normalization of the root directory. Closes #3 + +0.0.2 / 2012-07-09 +================== + + * add passing of req explicitly for now (YUCK) + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/send/LICENSE b/node_modules/send/LICENSE new file mode 100644 index 0000000..4aa69e8 --- /dev/null +++ b/node_modules/send/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2012 TJ Holowaychuk +Copyright (c) 2014-2016 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/send/README.md b/node_modules/send/README.md new file mode 100644 index 0000000..0c8d11d --- /dev/null +++ b/node_modules/send/README.md @@ -0,0 +1,301 @@ +# send + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Linux Build][travis-image]][travis-url] +[![Windows Build][appveyor-image]][appveyor-url] +[![Test Coverage][coveralls-image]][coveralls-url] +[![Gratipay][gratipay-image]][gratipay-url] + +Send is a library for streaming files from the file system as a http response +supporting partial responses (Ranges), conditional-GET negotiation (If-Match, +If-Unmodified-Since, If-None-Match, If-Modified-Since), high test coverage, +and granular events which may be leveraged to take appropriate actions in your +application or framework. + +Looking to serve up entire folders mapped to URLs? Try [serve-static](https://www.npmjs.org/package/serve-static). + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```bash +$ npm install send +``` + +## API + + + +```js +var send = require('send') +``` + +### send(req, path, [options]) + +Create a new `SendStream` for the given path to send to a `res`. The `req` is +the Node.js HTTP request and the `path` is a urlencoded path to send (urlencoded, +not the actual file-system path). + +#### Options + +##### acceptRanges + +Enable or disable accepting ranged requests, defaults to true. +Disabling this will not send `Accept-Ranges` and ignore the contents +of the `Range` request header. + +##### cacheControl + +Enable or disable setting `Cache-Control` response header, defaults to +true. Disabling this will ignore the `maxAge` option. + +##### dotfiles + +Set how "dotfiles" are treated when encountered. A dotfile is a file +or directory that begins with a dot ("."). Note this check is done on +the path itself without checking if the path actually exists on the +disk. If `root` is specified, only the dotfiles above the root are +checked (i.e. the root itself can be within a dotfile when when set +to "deny"). + + - `'allow'` No special treatment for dotfiles. + - `'deny'` Send a 403 for any request for a dotfile. + - `'ignore'` Pretend like the dotfile does not exist and 404. + +The default value is _similar_ to `'ignore'`, with the exception that +this default will not ignore the files within a directory that begins +with a dot, for backward-compatibility. + +##### end + +Byte offset at which the stream ends, defaults to the length of the file +minus 1. The end is inclusive in the stream, meaning `end: 3` will include +the 4th byte in the stream. + +##### etag + +Enable or disable etag generation, defaults to true. + +##### extensions + +If a given file doesn't exist, try appending one of the given extensions, +in the given order. By default, this is disabled (set to `false`). An +example value that will serve extension-less HTML files: `['html', 'htm']`. +This is skipped if the requested file already has an extension. + +##### index + +By default send supports "index.html" files, to disable this +set `false` or to supply a new index pass a string or an array +in preferred order. + +##### lastModified + +Enable or disable `Last-Modified` header, defaults to true. Uses the file +system's last modified value. + +##### maxAge + +Provide a max-age in milliseconds for http caching, defaults to 0. +This can also be a string accepted by the +[ms](https://www.npmjs.org/package/ms#readme) module. + +##### root + +Serve files relative to `path`. + +##### start + +Byte offset at which the stream starts, defaults to 0. The start is inclusive, +meaning `start: 2` will include the 3rd byte in the stream. + +#### Events + +The `SendStream` is an event emitter and will emit the following events: + + - `error` an error occurred `(err)` + - `directory` a directory was requested `(res, path)` + - `file` a file was requested `(path, stat)` + - `headers` the headers are about to be set on a file `(res, path, stat)` + - `stream` file streaming has started `(stream)` + - `end` streaming has completed + +#### .pipe + +The `pipe` method is used to pipe the response into the Node.js HTTP response +object, typically `send(req, path, options).pipe(res)`. + +### .mime + +The `mime` export is the global instance of of the +[`mime` npm module](https://www.npmjs.com/package/mime). + +This is used to configure the MIME types that are associated with file extensions +as well as other options for how to resolve the MIME type of a file (like the +default type to use for an unknown file extension). + +## Error-handling + +By default when no `error` listeners are present an automatic response will be +made, otherwise you have full control over the response, aka you may show a 5xx +page etc. + +## Caching + +It does _not_ perform internal caching, you should use a reverse proxy cache +such as Varnish for this, or those fancy things called CDNs. If your +application is small enough that it would benefit from single-node memory +caching, it's small enough that it does not need caching at all ;). + +## Debugging + +To enable `debug()` instrumentation output export __DEBUG__: + +``` +$ DEBUG=send node app +``` + +## Running tests + +``` +$ npm install +$ npm test +``` + +## Examples + +### Small example + +```js +var http = require('http') +var parseUrl = require('parseurl') +var send = require('send') + +var server = http.createServer(function onRequest (req, res) { + send(req, parseUrl(req).pathname).pipe(res) +}) + +server.listen(3000) +``` + +### Custom file types + +```js +var http = require('http') +var parseUrl = require('parseurl') +var send = require('send') + +// Default unknown types to text/plain +send.mime.default_type = 'text/plain' + +// Add a custom type +send.mime.define({ + 'application/x-my-type': ['x-mt', 'x-mtt'] +}) + +var server = http.createServer(function onRequest (req, res) { + send(req, parseUrl(req).pathname).pipe(res) +}) + +server.listen(3000) +``` + +### Custom directory index view + +This is a example of serving up a structure of directories with a +custom function to render a listing of a directory. + +```js +var http = require('http') +var fs = require('fs') +var parseUrl = require('parseurl') +var send = require('send') + +// Transfer arbitrary files from within /www/example.com/public/* +// with a custom handler for directory listing +var server = http.createServer(function onRequest (req, res) { + send(req, parseUrl(req).pathname, {index: false, root: '/www/example.com/public'}) + .once('directory', directory) + .pipe(res) +}) + +server.listen(3000) + +// Custom directory handler +function directory (res, path) { + var stream = this + + // redirect to trailing slash for consistent url + if (!stream.hasTrailingSlash()) { + return stream.redirect(path) + } + + // get directory list + fs.readdir(path, function onReaddir (err, list) { + if (err) return stream.error(err) + + // render an index for the directory + res.setHeader('Content-Type', 'text/plain; charset=UTF-8') + res.end(list.join('\n') + '\n') + }) +} +``` + +### Serving from a root directory with custom error-handling + +```js +var http = require('http') +var parseUrl = require('parseurl') +var send = require('send') + +var server = http.createServer(function onRequest (req, res) { + // your custom error-handling logic: + function error (err) { + res.statusCode = err.status || 500 + res.end(err.message) + } + + // your custom headers + function headers (res, path, stat) { + // serve all files for download + res.setHeader('Content-Disposition', 'attachment') + } + + // your custom directory handling logic: + function redirect () { + res.statusCode = 301 + res.setHeader('Location', req.url + '/') + res.end('Redirecting to ' + req.url + '/') + } + + // transfer arbitrary files from within + // /www/example.com/public/* + send(req, parseUrl(req).pathname, {root: '/www/example.com/public'}) + .on('error', error) + .on('directory', redirect) + .on('headers', headers) + .pipe(res) +}) + +server.listen(3000) +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/send.svg +[npm-url]: https://npmjs.org/package/send +[travis-image]: https://img.shields.io/travis/pillarjs/send/master.svg?label=linux +[travis-url]: https://travis-ci.org/pillarjs/send +[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/send/master.svg?label=windows +[appveyor-url]: https://ci.appveyor.com/project/dougwilson/send +[coveralls-image]: https://img.shields.io/coveralls/pillarjs/send/master.svg +[coveralls-url]: https://coveralls.io/r/pillarjs/send?branch=master +[downloads-image]: https://img.shields.io/npm/dm/send.svg +[downloads-url]: https://npmjs.org/package/send +[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg +[gratipay-url]: https://www.gratipay.com/dougwilson/ diff --git a/node_modules/send/index.js b/node_modules/send/index.js new file mode 100644 index 0000000..e817ca5 --- /dev/null +++ b/node_modules/send/index.js @@ -0,0 +1,1103 @@ +/*! + * send + * Copyright(c) 2012 TJ Holowaychuk + * Copyright(c) 2014-2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var createError = require('http-errors') +var debug = require('debug')('send') +var deprecate = require('depd')('send') +var destroy = require('destroy') +var encodeUrl = require('encodeurl') +var escapeHtml = require('escape-html') +var etag = require('etag') +var EventEmitter = require('events').EventEmitter +var fresh = require('fresh') +var fs = require('fs') +var mime = require('mime') +var ms = require('ms') +var onFinished = require('on-finished') +var parseRange = require('range-parser') +var path = require('path') +var statuses = require('statuses') +var Stream = require('stream') +var util = require('util') + +/** + * Path function references. + * @private + */ + +var extname = path.extname +var join = path.join +var normalize = path.normalize +var resolve = path.resolve +var sep = path.sep + +/** + * Regular expression for identifying a bytes Range header. + * @private + */ + +var BYTES_RANGE_REGEXP = /^ *bytes=/ + +/** + * Maximum value allowed for the max age. + * @private + */ + +var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000 // 1 year + +/** + * Regular expression to match a path with a directory up component. + * @private + */ + +var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/ + +/** + * Module exports. + * @public + */ + +module.exports = send +module.exports.mime = mime + +/** + * Shim EventEmitter.listenerCount for node.js < 0.10 + */ + +/* istanbul ignore next */ +var listenerCount = EventEmitter.listenerCount || + function (emitter, type) { return emitter.listeners(type).length } + +/** + * Return a `SendStream` for `req` and `path`. + * + * @param {object} req + * @param {string} path + * @param {object} [options] + * @return {SendStream} + * @public + */ + +function send (req, path, options) { + return new SendStream(req, path, options) +} + +/** + * Initialize a `SendStream` with the given `path`. + * + * @param {Request} req + * @param {String} path + * @param {object} [options] + * @private + */ + +function SendStream (req, path, options) { + Stream.call(this) + + var opts = options || {} + + this.options = opts + this.path = path + this.req = req + + this._acceptRanges = opts.acceptRanges !== undefined + ? Boolean(opts.acceptRanges) + : true + + this._cacheControl = opts.cacheControl !== undefined + ? Boolean(opts.cacheControl) + : true + + this._etag = opts.etag !== undefined + ? Boolean(opts.etag) + : true + + this._dotfiles = opts.dotfiles !== undefined + ? opts.dotfiles + : 'ignore' + + if (this._dotfiles !== 'ignore' && this._dotfiles !== 'allow' && this._dotfiles !== 'deny') { + throw new TypeError('dotfiles option must be "allow", "deny", or "ignore"') + } + + this._hidden = Boolean(opts.hidden) + + if (opts.hidden !== undefined) { + deprecate('hidden: use dotfiles: \'' + (this._hidden ? 'allow' : 'ignore') + '\' instead') + } + + // legacy support + if (opts.dotfiles === undefined) { + this._dotfiles = undefined + } + + this._extensions = opts.extensions !== undefined + ? normalizeList(opts.extensions, 'extensions option') + : [] + + this._index = opts.index !== undefined + ? normalizeList(opts.index, 'index option') + : ['index.html'] + + this._lastModified = opts.lastModified !== undefined + ? Boolean(opts.lastModified) + : true + + this._maxage = opts.maxAge || opts.maxage + this._maxage = typeof this._maxage === 'string' + ? ms(this._maxage) + : Number(this._maxage) + this._maxage = !isNaN(this._maxage) + ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) + : 0 + + this._root = opts.root + ? resolve(opts.root) + : null + + if (!this._root && opts.from) { + this.from(opts.from) + } +} + +/** + * Inherits from `Stream`. + */ + +util.inherits(SendStream, Stream) + +/** + * Enable or disable etag generation. + * + * @param {Boolean} val + * @return {SendStream} + * @api public + */ + +SendStream.prototype.etag = deprecate.function(function etag (val) { + this._etag = Boolean(val) + debug('etag %s', this._etag) + return this +}, 'send.etag: pass etag as option') + +/** + * Enable or disable "hidden" (dot) files. + * + * @param {Boolean} path + * @return {SendStream} + * @api public + */ + +SendStream.prototype.hidden = deprecate.function(function hidden (val) { + this._hidden = Boolean(val) + this._dotfiles = undefined + debug('hidden %s', this._hidden) + return this +}, 'send.hidden: use dotfiles option') + +/** + * Set index `paths`, set to a falsy + * value to disable index support. + * + * @param {String|Boolean|Array} paths + * @return {SendStream} + * @api public + */ + +SendStream.prototype.index = deprecate.function(function index (paths) { + var index = !paths ? [] : normalizeList(paths, 'paths argument') + debug('index %o', paths) + this._index = index + return this +}, 'send.index: pass index as option') + +/** + * Set root `path`. + * + * @param {String} path + * @return {SendStream} + * @api public + */ + +SendStream.prototype.root = function root (path) { + this._root = resolve(String(path)) + debug('root %s', this._root) + return this +} + +SendStream.prototype.from = deprecate.function(SendStream.prototype.root, + 'send.from: pass root as option') + +SendStream.prototype.root = deprecate.function(SendStream.prototype.root, + 'send.root: pass root as option') + +/** + * Set max-age to `maxAge`. + * + * @param {Number} maxAge + * @return {SendStream} + * @api public + */ + +SendStream.prototype.maxage = deprecate.function(function maxage (maxAge) { + this._maxage = typeof maxAge === 'string' + ? ms(maxAge) + : Number(maxAge) + this._maxage = !isNaN(this._maxage) + ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) + : 0 + debug('max-age %d', this._maxage) + return this +}, 'send.maxage: pass maxAge as option') + +/** + * Emit error with `status`. + * + * @param {number} status + * @param {Error} [err] + * @private + */ + +SendStream.prototype.error = function error (status, err) { + // emit if listeners instead of responding + if (listenerCount(this, 'error') !== 0) { + return this.emit('error', createError(status, err, { + expose: false + })) + } + + var res = this.res + var msg = statuses[status] || String(status) + var doc = createHtmlDocument('Error', escapeHtml(msg)) + + // clear existing headers + clearHeaders(res) + + // add error headers + if (err && err.headers) { + setHeaders(res, err.headers) + } + + // send basic response + res.statusCode = status + res.setHeader('Content-Type', 'text/html; charset=UTF-8') + res.setHeader('Content-Length', Buffer.byteLength(doc)) + res.setHeader('Content-Security-Policy', "default-src 'self'") + res.setHeader('X-Content-Type-Options', 'nosniff') + res.end(doc) +} + +/** + * Check if the pathname ends with "/". + * + * @return {boolean} + * @private + */ + +SendStream.prototype.hasTrailingSlash = function hasTrailingSlash () { + return this.path[this.path.length - 1] === '/' +} + +/** + * Check if this is a conditional GET request. + * + * @return {Boolean} + * @api private + */ + +SendStream.prototype.isConditionalGET = function isConditionalGET () { + return this.req.headers['if-match'] || + this.req.headers['if-unmodified-since'] || + this.req.headers['if-none-match'] || + this.req.headers['if-modified-since'] +} + +/** + * Check if the request preconditions failed. + * + * @return {boolean} + * @private + */ + +SendStream.prototype.isPreconditionFailure = function isPreconditionFailure () { + var req = this.req + var res = this.res + + // if-match + var match = req.headers['if-match'] + if (match) { + var etag = res.getHeader('ETag') + return !etag || (match !== '*' && parseTokenList(match).every(function (match) { + return match !== etag && match !== 'W/' + etag && 'W/' + match !== etag + })) + } + + // if-unmodified-since + var unmodifiedSince = parseHttpDate(req.headers['if-unmodified-since']) + if (!isNaN(unmodifiedSince)) { + var lastModified = parseHttpDate(res.getHeader('Last-Modified')) + return isNaN(lastModified) || lastModified > unmodifiedSince + } + + return false +} + +/** + * Strip content-* header fields. + * + * @private + */ + +SendStream.prototype.removeContentHeaderFields = function removeContentHeaderFields () { + var res = this.res + var headers = getHeaderNames(res) + + for (var i = 0; i < headers.length; i++) { + var header = headers[i] + if (header.substr(0, 8) === 'content-' && header !== 'content-location') { + res.removeHeader(header) + } + } +} + +/** + * Respond with 304 not modified. + * + * @api private + */ + +SendStream.prototype.notModified = function notModified () { + var res = this.res + debug('not modified') + this.removeContentHeaderFields() + res.statusCode = 304 + res.end() +} + +/** + * Raise error that headers already sent. + * + * @api private + */ + +SendStream.prototype.headersAlreadySent = function headersAlreadySent () { + var err = new Error('Can\'t set headers after they are sent.') + debug('headers already sent') + this.error(500, err) +} + +/** + * Check if the request is cacheable, aka + * responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}). + * + * @return {Boolean} + * @api private + */ + +SendStream.prototype.isCachable = function isCachable () { + var statusCode = this.res.statusCode + return (statusCode >= 200 && statusCode < 300) || + statusCode === 304 +} + +/** + * Handle stat() error. + * + * @param {Error} error + * @private + */ + +SendStream.prototype.onStatError = function onStatError (error) { + switch (error.code) { + case 'ENAMETOOLONG': + case 'ENOENT': + case 'ENOTDIR': + this.error(404, error) + break + default: + this.error(500, error) + break + } +} + +/** + * Check if the cache is fresh. + * + * @return {Boolean} + * @api private + */ + +SendStream.prototype.isFresh = function isFresh () { + return fresh(this.req.headers, { + 'etag': this.res.getHeader('ETag'), + 'last-modified': this.res.getHeader('Last-Modified') + }) +} + +/** + * Check if the range is fresh. + * + * @return {Boolean} + * @api private + */ + +SendStream.prototype.isRangeFresh = function isRangeFresh () { + var ifRange = this.req.headers['if-range'] + + if (!ifRange) { + return true + } + + // if-range as etag + if (ifRange.indexOf('"') !== -1) { + var etag = this.res.getHeader('ETag') + return Boolean(etag && ifRange.indexOf(etag) !== -1) + } + + // if-range as modified date + var lastModified = this.res.getHeader('Last-Modified') + return parseHttpDate(lastModified) <= parseHttpDate(ifRange) +} + +/** + * Redirect to path. + * + * @param {string} path + * @private + */ + +SendStream.prototype.redirect = function redirect (path) { + var res = this.res + + if (listenerCount(this, 'directory') !== 0) { + this.emit('directory', res, path) + return + } + + if (this.hasTrailingSlash()) { + this.error(403) + return + } + + var loc = encodeUrl(collapseLeadingSlashes(this.path + '/')) + var doc = createHtmlDocument('Redirecting', 'Redirecting to ' + + escapeHtml(loc) + '') + + // redirect + res.statusCode = 301 + res.setHeader('Content-Type', 'text/html; charset=UTF-8') + res.setHeader('Content-Length', Buffer.byteLength(doc)) + res.setHeader('Content-Security-Policy', "default-src 'self'") + res.setHeader('X-Content-Type-Options', 'nosniff') + res.setHeader('Location', loc) + res.end(doc) +} + +/** + * Pipe to `res. + * + * @param {Stream} res + * @return {Stream} res + * @api public + */ + +SendStream.prototype.pipe = function pipe (res) { + // root path + var root = this._root + + // references + this.res = res + + // decode the path + var path = decode(this.path) + if (path === -1) { + this.error(400) + return res + } + + // null byte(s) + if (~path.indexOf('\0')) { + this.error(400) + return res + } + + var parts + if (root !== null) { + // malicious path + if (UP_PATH_REGEXP.test(normalize('.' + sep + path))) { + debug('malicious path "%s"', path) + this.error(403) + return res + } + + // join / normalize from optional root dir + path = normalize(join(root, path)) + root = normalize(root + sep) + + // explode path parts + parts = path.substr(root.length).split(sep) + } else { + // ".." is malicious without "root" + if (UP_PATH_REGEXP.test(path)) { + debug('malicious path "%s"', path) + this.error(403) + return res + } + + // explode path parts + parts = normalize(path).split(sep) + + // resolve the path + path = resolve(path) + } + + // dotfile handling + if (containsDotFile(parts)) { + var access = this._dotfiles + + // legacy support + if (access === undefined) { + access = parts[parts.length - 1][0] === '.' + ? (this._hidden ? 'allow' : 'ignore') + : 'allow' + } + + debug('%s dotfile "%s"', access, path) + switch (access) { + case 'allow': + break + case 'deny': + this.error(403) + return res + case 'ignore': + default: + this.error(404) + return res + } + } + + // index file support + if (this._index.length && this.hasTrailingSlash()) { + this.sendIndex(path) + return res + } + + this.sendFile(path) + return res +} + +/** + * Transfer `path`. + * + * @param {String} path + * @api public + */ + +SendStream.prototype.send = function send (path, stat) { + var len = stat.size + var options = this.options + var opts = {} + var res = this.res + var req = this.req + var ranges = req.headers.range + var offset = options.start || 0 + + if (headersSent(res)) { + // impossible to send now + this.headersAlreadySent() + return + } + + debug('pipe "%s"', path) + + // set header fields + this.setHeader(path, stat) + + // set content-type + this.type(path) + + // conditional GET support + if (this.isConditionalGET()) { + if (this.isPreconditionFailure()) { + this.error(412) + return + } + + if (this.isCachable() && this.isFresh()) { + this.notModified() + return + } + } + + // adjust len to start/end options + len = Math.max(0, len - offset) + if (options.end !== undefined) { + var bytes = options.end - offset + 1 + if (len > bytes) len = bytes + } + + // Range support + if (this._acceptRanges && BYTES_RANGE_REGEXP.test(ranges)) { + // parse + ranges = parseRange(len, ranges, { + combine: true + }) + + // If-Range support + if (!this.isRangeFresh()) { + debug('range stale') + ranges = -2 + } + + // unsatisfiable + if (ranges === -1) { + debug('range unsatisfiable') + + // Content-Range + res.setHeader('Content-Range', contentRange('bytes', len)) + + // 416 Requested Range Not Satisfiable + return this.error(416, { + headers: {'Content-Range': res.getHeader('Content-Range')} + }) + } + + // valid (syntactically invalid/multiple ranges are treated as a regular response) + if (ranges !== -2 && ranges.length === 1) { + debug('range %j', ranges) + + // Content-Range + res.statusCode = 206 + res.setHeader('Content-Range', contentRange('bytes', len, ranges[0])) + + // adjust for requested range + offset += ranges[0].start + len = ranges[0].end - ranges[0].start + 1 + } + } + + // clone options + for (var prop in options) { + opts[prop] = options[prop] + } + + // set read options + opts.start = offset + opts.end = Math.max(offset, offset + len - 1) + + // content-length + res.setHeader('Content-Length', len) + + // HEAD support + if (req.method === 'HEAD') { + res.end() + return + } + + this.stream(path, opts) +} + +/** + * Transfer file for `path`. + * + * @param {String} path + * @api private + */ +SendStream.prototype.sendFile = function sendFile (path) { + var i = 0 + var self = this + + debug('stat "%s"', path) + fs.stat(path, function onstat (err, stat) { + if (err && err.code === 'ENOENT' && !extname(path) && path[path.length - 1] !== sep) { + // not found, check extensions + return next(err) + } + if (err) return self.onStatError(err) + if (stat.isDirectory()) return self.redirect(path) + self.emit('file', path, stat) + self.send(path, stat) + }) + + function next (err) { + if (self._extensions.length <= i) { + return err + ? self.onStatError(err) + : self.error(404) + } + + var p = path + '.' + self._extensions[i++] + + debug('stat "%s"', p) + fs.stat(p, function (err, stat) { + if (err) return next(err) + if (stat.isDirectory()) return next() + self.emit('file', p, stat) + self.send(p, stat) + }) + } +} + +/** + * Transfer index for `path`. + * + * @param {String} path + * @api private + */ +SendStream.prototype.sendIndex = function sendIndex (path) { + var i = -1 + var self = this + + function next (err) { + if (++i >= self._index.length) { + if (err) return self.onStatError(err) + return self.error(404) + } + + var p = join(path, self._index[i]) + + debug('stat "%s"', p) + fs.stat(p, function (err, stat) { + if (err) return next(err) + if (stat.isDirectory()) return next() + self.emit('file', p, stat) + self.send(p, stat) + }) + } + + next() +} + +/** + * Stream `path` to the response. + * + * @param {String} path + * @param {Object} options + * @api private + */ + +SendStream.prototype.stream = function stream (path, options) { + // TODO: this is all lame, refactor meeee + var finished = false + var self = this + var res = this.res + + // pipe + var stream = fs.createReadStream(path, options) + this.emit('stream', stream) + stream.pipe(res) + + // response finished, done with the fd + onFinished(res, function onfinished () { + finished = true + destroy(stream) + }) + + // error handling code-smell + stream.on('error', function onerror (err) { + // request already finished + if (finished) return + + // clean up stream + finished = true + destroy(stream) + + // error + self.onStatError(err) + }) + + // end + stream.on('end', function onend () { + self.emit('end') + }) +} + +/** + * Set content-type based on `path` + * if it hasn't been explicitly set. + * + * @param {String} path + * @api private + */ + +SendStream.prototype.type = function type (path) { + var res = this.res + + if (res.getHeader('Content-Type')) return + + var type = mime.lookup(path) + + if (!type) { + debug('no content-type') + return + } + + var charset = mime.charsets.lookup(type) + + debug('content-type %s', type) + res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : '')) +} + +/** + * Set response header fields, most + * fields may be pre-defined. + * + * @param {String} path + * @param {Object} stat + * @api private + */ + +SendStream.prototype.setHeader = function setHeader (path, stat) { + var res = this.res + + this.emit('headers', res, path, stat) + + if (this._acceptRanges && !res.getHeader('Accept-Ranges')) { + debug('accept ranges') + res.setHeader('Accept-Ranges', 'bytes') + } + + if (this._cacheControl && !res.getHeader('Cache-Control')) { + var cacheControl = 'public, max-age=' + Math.floor(this._maxage / 1000) + debug('cache-control %s', cacheControl) + res.setHeader('Cache-Control', cacheControl) + } + + if (this._lastModified && !res.getHeader('Last-Modified')) { + var modified = stat.mtime.toUTCString() + debug('modified %s', modified) + res.setHeader('Last-Modified', modified) + } + + if (this._etag && !res.getHeader('ETag')) { + var val = etag(stat) + debug('etag %s', val) + res.setHeader('ETag', val) + } +} + +/** + * Clear all headers from a response. + * + * @param {object} res + * @private + */ + +function clearHeaders (res) { + var headers = getHeaderNames(res) + + for (var i = 0; i < headers.length; i++) { + res.removeHeader(headers[i]) + } +} + +/** + * Collapse all leading slashes into a single slash + * + * @param {string} str + * @private + */ +function collapseLeadingSlashes (str) { + for (var i = 0; i < str.length; i++) { + if (str[i] !== '/') { + break + } + } + + return i > 1 + ? '/' + str.substr(i) + : str +} + +/** + * Determine if path parts contain a dotfile. + * + * @api private + */ + +function containsDotFile (parts) { + for (var i = 0; i < parts.length; i++) { + if (parts[i][0] === '.') { + return true + } + } + + return false +} + +/** + * Create a Content-Range header. + * + * @param {string} type + * @param {number} size + * @param {array} [range] + */ + +function contentRange (type, size, range) { + return type + ' ' + (range ? range.start + '-' + range.end : '*') + '/' + size +} + +/** + * Create a minimal HTML document. + * + * @param {string} title + * @param {string} body + * @private + */ + +function createHtmlDocument (title, body) { + return '\n' + + '\n' + + '\n' + + '\n' + + '' + title + '\n' + + '\n' + + '\n' + + '
    ' + body + '
    \n' + + '\n' +} + +/** + * decodeURIComponent. + * + * Allows V8 to only deoptimize this fn instead of all + * of send(). + * + * @param {String} path + * @api private + */ + +function decode (path) { + try { + return decodeURIComponent(path) + } catch (err) { + return -1 + } +} + +/** + * Get the header names on a respnse. + * + * @param {object} res + * @returns {array[string]} + * @private + */ + +function getHeaderNames (res) { + return typeof res.getHeaderNames !== 'function' + ? Object.keys(res._headers || {}) + : res.getHeaderNames() +} + +/** + * Determine if the response headers have been sent. + * + * @param {object} res + * @returns {boolean} + * @private + */ + +function headersSent (res) { + return typeof res.headersSent !== 'boolean' + ? Boolean(res._header) + : res.headersSent +} + +/** + * Normalize the index option into an array. + * + * @param {boolean|string|array} val + * @param {string} name + * @private + */ + +function normalizeList (val, name) { + var list = [].concat(val || []) + + for (var i = 0; i < list.length; i++) { + if (typeof list[i] !== 'string') { + throw new TypeError(name + ' must be array of strings or false') + } + } + + return list +} + +/** + * Parse an HTTP Date into a number. + * + * @param {string} date + * @private + */ + +function parseHttpDate (date) { + var timestamp = date && Date.parse(date) + + return typeof timestamp === 'number' + ? timestamp + : NaN +} + +/** + * Parse a HTTP token list. + * + * @param {string} str + * @private + */ + +function parseTokenList (str) { + var end = 0 + var list = [] + var start = 0 + + // gather tokens + for (var i = 0, len = str.length; i < len; i++) { + switch (str.charCodeAt(i)) { + case 0x20: /* */ + if (start === end) { + start = end = i + 1 + } + break + case 0x2c: /* , */ + list.push(str.substring(start, end)) + start = end = i + 1 + break + default: + end = i + 1 + break + } + } + + // final token + list.push(str.substring(start, end)) + + return list +} + +/** + * Set an object of headers on a response. + * + * @param {object} res + * @param {object} headers + * @private + */ + +function setHeaders (res, headers) { + var keys = Object.keys(headers) + + for (var i = 0; i < keys.length; i++) { + var key = keys[i] + res.setHeader(key, headers[key]) + } +} diff --git a/node_modules/send/node_modules/statuses/HISTORY.md b/node_modules/send/node_modules/statuses/HISTORY.md new file mode 100644 index 0000000..3015a5f --- /dev/null +++ b/node_modules/send/node_modules/statuses/HISTORY.md @@ -0,0 +1,55 @@ +1.3.1 / 2016-11-11 +================== + + * Fix return type in JSDoc + +1.3.0 / 2016-05-17 +================== + + * Add `421 Misdirected Request` + * perf: enable strict mode + +1.2.1 / 2015-02-01 +================== + + * Fix message for status 451 + - `451 Unavailable For Legal Reasons` + +1.2.0 / 2014-09-28 +================== + + * Add `208 Already Repored` + * Add `226 IM Used` + * Add `306 (Unused)` + * Add `415 Unable For Legal Reasons` + * Add `508 Loop Detected` + +1.1.1 / 2014-09-24 +================== + + * Add missing 308 to `codes.json` + +1.1.0 / 2014-09-21 +================== + + * Add `codes.json` for universal support + +1.0.4 / 2014-08-20 +================== + + * Package cleanup + +1.0.3 / 2014-06-08 +================== + + * Add 308 to `.redirect` category + +1.0.2 / 2014-03-13 +================== + + * Add `.retry` category + +1.0.1 / 2014-03-12 +================== + + * Initial release diff --git a/node_modules/send/node_modules/statuses/LICENSE b/node_modules/send/node_modules/statuses/LICENSE new file mode 100644 index 0000000..82af4df --- /dev/null +++ b/node_modules/send/node_modules/statuses/LICENSE @@ -0,0 +1,23 @@ + +The MIT License (MIT) + +Copyright (c) 2014 Jonathan Ong me@jongleberry.com +Copyright (c) 2016 Douglas Christopher Wilson doug@somethingdoug.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/send/node_modules/statuses/README.md b/node_modules/send/node_modules/statuses/README.md new file mode 100644 index 0000000..2bf0756 --- /dev/null +++ b/node_modules/send/node_modules/statuses/README.md @@ -0,0 +1,103 @@ +# Statuses + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +HTTP status utility for node. + +## API + +```js +var status = require('statuses') +``` + +### var code = status(Integer || String) + +If `Integer` or `String` is a valid HTTP code or status message, then the appropriate `code` will be returned. Otherwise, an error will be thrown. + +```js +status(403) // => 403 +status('403') // => 403 +status('forbidden') // => 403 +status('Forbidden') // => 403 +status(306) // throws, as it's not supported by node.js +``` + +### status.codes + +Returns an array of all the status codes as `Integer`s. + +### var msg = status[code] + +Map of `code` to `status message`. `undefined` for invalid `code`s. + +```js +status[404] // => 'Not Found' +``` + +### var code = status[msg] + +Map of `status message` to `code`. `msg` can either be title-cased or lower-cased. `undefined` for invalid `status message`s. + +```js +status['not found'] // => 404 +status['Not Found'] // => 404 +``` + +### status.redirect[code] + +Returns `true` if a status code is a valid redirect status. + +```js +status.redirect[200] // => undefined +status.redirect[301] // => true +``` + +### status.empty[code] + +Returns `true` if a status code expects an empty body. + +```js +status.empty[200] // => undefined +status.empty[204] // => true +status.empty[304] // => true +``` + +### status.retry[code] + +Returns `true` if you should retry the rest. + +```js +status.retry[501] // => undefined +status.retry[503] // => true +``` + +## Adding Status Codes + +The status codes are primarily sourced from http://www.iana.org/assignments/http-status-codes/http-status-codes-1.csv. +Additionally, custom codes are added from http://en.wikipedia.org/wiki/List_of_HTTP_status_codes. +These are added manually in the `lib/*.json` files. +If you would like to add a status code, add it to the appropriate JSON file. + +To rebuild `codes.json`, run the following: + +```bash +# update src/iana.json +npm run fetch +# build codes.json +npm run build +``` + +[npm-image]: https://img.shields.io/npm/v/statuses.svg +[npm-url]: https://npmjs.org/package/statuses +[node-version-image]: https://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg +[node-version-url]: https://nodejs.org/en/download +[travis-image]: https://img.shields.io/travis/jshttp/statuses.svg +[travis-url]: https://travis-ci.org/jshttp/statuses +[coveralls-image]: https://img.shields.io/coveralls/jshttp/statuses.svg +[coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master +[downloads-image]: https://img.shields.io/npm/dm/statuses.svg +[downloads-url]: https://npmjs.org/package/statuses diff --git a/node_modules/send/node_modules/statuses/codes.json b/node_modules/send/node_modules/statuses/codes.json new file mode 100644 index 0000000..e765123 --- /dev/null +++ b/node_modules/send/node_modules/statuses/codes.json @@ -0,0 +1,65 @@ +{ + "100": "Continue", + "101": "Switching Protocols", + "102": "Processing", + "200": "OK", + "201": "Created", + "202": "Accepted", + "203": "Non-Authoritative Information", + "204": "No Content", + "205": "Reset Content", + "206": "Partial Content", + "207": "Multi-Status", + "208": "Already Reported", + "226": "IM Used", + "300": "Multiple Choices", + "301": "Moved Permanently", + "302": "Found", + "303": "See Other", + "304": "Not Modified", + "305": "Use Proxy", + "306": "(Unused)", + "307": "Temporary Redirect", + "308": "Permanent Redirect", + "400": "Bad Request", + "401": "Unauthorized", + "402": "Payment Required", + "403": "Forbidden", + "404": "Not Found", + "405": "Method Not Allowed", + "406": "Not Acceptable", + "407": "Proxy Authentication Required", + "408": "Request Timeout", + "409": "Conflict", + "410": "Gone", + "411": "Length Required", + "412": "Precondition Failed", + "413": "Payload Too Large", + "414": "URI Too Long", + "415": "Unsupported Media Type", + "416": "Range Not Satisfiable", + "417": "Expectation Failed", + "418": "I'm a teapot", + "421": "Misdirected Request", + "422": "Unprocessable Entity", + "423": "Locked", + "424": "Failed Dependency", + "425": "Unordered Collection", + "426": "Upgrade Required", + "428": "Precondition Required", + "429": "Too Many Requests", + "431": "Request Header Fields Too Large", + "451": "Unavailable For Legal Reasons", + "500": "Internal Server Error", + "501": "Not Implemented", + "502": "Bad Gateway", + "503": "Service Unavailable", + "504": "Gateway Timeout", + "505": "HTTP Version Not Supported", + "506": "Variant Also Negotiates", + "507": "Insufficient Storage", + "508": "Loop Detected", + "509": "Bandwidth Limit Exceeded", + "510": "Not Extended", + "511": "Network Authentication Required" +} \ No newline at end of file diff --git a/node_modules/send/node_modules/statuses/index.js b/node_modules/send/node_modules/statuses/index.js new file mode 100644 index 0000000..9f955c6 --- /dev/null +++ b/node_modules/send/node_modules/statuses/index.js @@ -0,0 +1,110 @@ +/*! + * statuses + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var codes = require('./codes.json') + +/** + * Module exports. + * @public + */ + +module.exports = status + +// array of status codes +status.codes = populateStatusesMap(status, codes) + +// status codes for redirects +status.redirect = { + 300: true, + 301: true, + 302: true, + 303: true, + 305: true, + 307: true, + 308: true +} + +// status codes for empty bodies +status.empty = { + 204: true, + 205: true, + 304: true +} + +// status codes for when you should retry the request +status.retry = { + 502: true, + 503: true, + 504: true +} + +/** + * Populate the statuses map for given codes. + * @private + */ + +function populateStatusesMap (statuses, codes) { + var arr = [] + + Object.keys(codes).forEach(function forEachCode (code) { + var message = codes[code] + var status = Number(code) + + // Populate properties + statuses[status] = message + statuses[message] = status + statuses[message.toLowerCase()] = status + + // Add to array + arr.push(status) + }) + + return arr +} + +/** + * Get the status code. + * + * Given a number, this will throw if it is not a known status + * code, otherwise the code will be returned. Given a string, + * the string will be parsed for a number and return the code + * if valid, otherwise will lookup the code assuming this is + * the status message. + * + * @param {string|number} code + * @returns {number} + * @public + */ + +function status (code) { + if (typeof code === 'number') { + if (!status[code]) throw new Error('invalid status code: ' + code) + return code + } + + if (typeof code !== 'string') { + throw new TypeError('code must be a number or string') + } + + // '403' + var n = parseInt(code, 10) + if (!isNaN(n)) { + if (!status[n]) throw new Error('invalid status code: ' + n) + return n + } + + n = status[code.toLowerCase()] + if (!n) throw new Error('invalid status message: "' + code + '"') + return n +} diff --git a/node_modules/send/node_modules/statuses/package.json b/node_modules/send/node_modules/statuses/package.json new file mode 100644 index 0000000..9c6d589 --- /dev/null +++ b/node_modules/send/node_modules/statuses/package.json @@ -0,0 +1,83 @@ +{ + "_from": "statuses@~1.3.1", + "_id": "statuses@1.3.1", + "_inBundle": false, + "_integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=", + "_location": "/send/statuses", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "statuses@~1.3.1", + "name": "statuses", + "escapedName": "statuses", + "rawSpec": "~1.3.1", + "saveSpec": null, + "fetchSpec": "~1.3.1" + }, + "_requiredBy": [ + "/send" + ], + "_resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "_shasum": "faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e", + "_spec": "statuses@~1.3.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/send", + "bugs": { + "url": "https://github.com/jshttp/statuses/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com" + } + ], + "deprecated": false, + "description": "HTTP status utility", + "devDependencies": { + "csv-parse": "1.1.7", + "eslint": "3.10.0", + "eslint-config-standard": "6.2.1", + "eslint-plugin-promise": "3.3.2", + "eslint-plugin-standard": "2.0.1", + "istanbul": "0.4.5", + "mocha": "1.21.5", + "stream-to-array": "2.3.0" + }, + "engines": { + "node": ">= 0.6" + }, + "files": [ + "HISTORY.md", + "index.js", + "codes.json", + "LICENSE" + ], + "homepage": "https://github.com/jshttp/statuses#readme", + "keywords": [ + "http", + "status", + "code" + ], + "license": "MIT", + "name": "statuses", + "repository": { + "type": "git", + "url": "git+https://github.com/jshttp/statuses.git" + }, + "scripts": { + "build": "node scripts/build.js", + "fetch": "node scripts/fetch.js", + "lint": "eslint .", + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "update": "npm run fetch && npm run build" + }, + "version": "1.3.1" +} diff --git a/node_modules/send/package.json b/node_modules/send/package.json new file mode 100644 index 0000000..3a125c3 --- /dev/null +++ b/node_modules/send/package.json @@ -0,0 +1,104 @@ +{ + "_from": "send@0.15.6", + "_id": "send@0.15.6", + "_inBundle": false, + "_integrity": "sha1-IPI6nJJbdiq4JwX+L52yUqzkfjQ=", + "_location": "/send", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "send@0.15.6", + "name": "send", + "escapedName": "send", + "rawSpec": "0.15.6", + "saveSpec": null, + "fetchSpec": "0.15.6" + }, + "_requiredBy": [ + "/express", + "/serve-static" + ], + "_resolved": "https://registry.npmjs.org/send/-/send-0.15.6.tgz", + "_shasum": "20f23a9c925b762ab82705fe2f9db252ace47e34", + "_spec": "send@0.15.6", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/express", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "bugs": { + "url": "https://github.com/pillarjs/send/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + { + "name": "James Wyatt Cready", + "email": "jcready@gmail.com" + }, + { + "name": "Jesús Leganés Combarro", + "email": "piranna@gmail.com" + } + ], + "dependencies": { + "debug": "2.6.9", + "depd": "~1.1.1", + "destroy": "~1.0.4", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.3.4", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.3.1" + }, + "deprecated": false, + "description": "Better streaming static file server with Range and conditional-GET support", + "devDependencies": { + "after": "0.8.2", + "eslint": "3.19.0", + "eslint-config-standard": "7.1.0", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-promise": "3.5.0", + "eslint-plugin-standard": "2.3.1", + "istanbul": "0.4.5", + "mocha": "2.5.3", + "supertest": "1.1.0" + }, + "engines": { + "node": ">= 0.8.0" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "index.js" + ], + "homepage": "https://github.com/pillarjs/send#readme", + "keywords": [ + "static", + "file", + "server" + ], + "license": "MIT", + "name": "send", + "repository": { + "type": "git", + "url": "git+https://github.com/pillarjs/send.git" + }, + "scripts": { + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --check-leaks --reporter spec --bail", + "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot" + }, + "version": "0.15.6" +} diff --git a/node_modules/serve-favicon/HISTORY.md b/node_modules/serve-favicon/HISTORY.md new file mode 100644 index 0000000..f2728f2 --- /dev/null +++ b/node_modules/serve-favicon/HISTORY.md @@ -0,0 +1,179 @@ +2.4.5 / 2017-09-26 +================== + + * deps: etag@~1.8.1 + - perf: replace regular expression with substring + * deps: fresh@0.5.2 + - Fix regression matching multiple ETags in `If-None-Match` + - perf: improve `If-None-Match` token parsing + +2.4.4 / 2017-09-11 +================== + + * deps: fresh@0.5.1 + - Fix handling of modified headers with invalid dates + - perf: improve ETag match loop + * deps: parseurl@~1.3.2 + - perf: reduce overhead for full URLs + - perf: unroll the "fast-path" `RegExp` + * deps: safe-buffer@5.1.1 + +2.4.3 / 2017-05-16 +================== + + * Use `safe-buffer` for improved Buffer API + * deps: ms@2.0.0 + +2.4.2 / 2017-03-24 +================== + + * deps: ms@1.0.0 + +2.4.1 / 2017-02-27 +================== + + * Remove usage of `res._headers` private field + * deps: fresh@0.5.0 + - Fix incorrect result when `If-None-Match` has both `*` and ETags + - Fix weak `ETag` matching to match spec + - perf: skip checking modified time if ETag check failed + - perf: skip parsing `If-None-Match` when no `ETag` header + - perf: use `Date.parse` instead of `new Date` + +2.4.0 / 2017-02-19 +================== + + * deps: etag@~1.8.0 + - Use SHA1 instead of MD5 for ETag hashing + - Works with FIPS 140-2 OpenSSL configuration + * deps: fresh@0.4.0 + - Fix false detection of `no-cache` request directive + - perf: enable strict mode + - perf: hoist regular expressions + - perf: remove duplicate conditional + - perf: remove unnecessary boolean coercions + * perf: simplify initial argument checking + +2.3.2 / 2016-11-16 +================== + + * deps: ms@0.7.2 + +2.3.1 / 2016-01-23 +================== + + * deps: parseurl@~1.3.1 + - perf: enable strict mode + +2.3.0 / 2015-06-13 +================== + + * Send non-chunked response for `OPTIONS` + * deps: etag@~1.7.0 + - Always include entity length in ETags for hash length extensions + - Generate non-Stats ETags using MD5 only (no longer CRC32) + - Remove base64 padding in ETags to shorten + * deps: fresh@0.3.0 + - Add weak `ETag` matching support + * perf: enable strict mode + * perf: remove argument reassignment + * perf: remove bitwise operations + +2.2.1 / 2015-05-14 +================== + + * deps: etag@~1.6.0 + - Improve support for JXcore + - Support "fake" stats objects in environments without `fs` + * deps: ms@0.7.1 + - Prevent extraordinarily long inputs + +2.2.0 / 2014-12-18 +================== + + * Support query string in the URL + * deps: etag@~1.5.1 + - deps: crc@3.2.1 + * deps: ms@0.7.0 + - Add `milliseconds` + - Add `msecs` + - Add `secs` + - Add `mins` + - Add `hrs` + - Add `yrs` + +2.1.7 / 2014-11-19 +================== + + * Avoid errors from enumerables on `Object.prototype` + +2.1.6 / 2014-10-16 +================== + + * deps: etag@~1.5.0 + +2.1.5 / 2014-09-24 +================== + + * deps: etag@~1.4.0 + +2.1.4 / 2014-09-15 +================== + + * Fix content headers being sent in 304 response + * deps: etag@~1.3.1 + - Improve ETag generation speed + +2.1.3 / 2014-09-07 +================== + + * deps: fresh@0.2.4 + +2.1.2 / 2014-09-05 +================== + + * deps: etag@~1.3.0 + - Improve ETag generation speed + +2.1.1 / 2014-08-25 +================== + + * Fix `ms` to be listed as a dependency + +2.1.0 / 2014-08-24 +================== + + * Accept string for `maxAge` (converted by `ms`) + * Use `etag` to generate `ETag` header + +2.0.1 / 2014-06-05 +================== + + * Reduce byte size of `ETag` header + +2.0.0 / 2014-05-02 +================== + + * `path` argument is required; there is no default icon. + * Accept `Buffer` of icon as first argument. + * Non-GET and HEAD requests are denied. + * Send valid max-age value + * Support conditional requests + * Support max-age=0 + * Support OPTIONS method + * Throw if `path` argument is directory. + +1.0.2 / 2014-03-16 +================== + + * Fixed content of default icon. + +1.0.1 / 2014-03-11 +================== + + * Fixed path to default icon. + +1.0.0 / 2014-02-15 +================== + + * Initial release diff --git a/node_modules/serve-favicon/LICENSE b/node_modules/serve-favicon/LICENSE new file mode 100644 index 0000000..c27eeac --- /dev/null +++ b/node_modules/serve-favicon/LICENSE @@ -0,0 +1,25 @@ +(The MIT License) + +Copyright (c) 2010 Sencha Inc. +Copyright (c) 2011 LearnBoost +Copyright (c) 2011 TJ Holowaychuk +Copyright (c) 2014-2017 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/serve-favicon/README.md b/node_modules/serve-favicon/README.md new file mode 100644 index 0000000..90cf24f --- /dev/null +++ b/node_modules/serve-favicon/README.md @@ -0,0 +1,139 @@ +# serve-favicon + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Linux Build][travis-image]][travis-url] +[![Windows Build][appveyor-image]][appveyor-url] +[![Test Coverage][coveralls-image]][coveralls-url] +[![Gratipay][gratipay-image]][gratipay-url] + +Node.js middleware for serving a favicon. + +A favicon is a visual cue that client software, like browsers, use to identify +a site. For an example and more information, please visit +[the Wikipedia article on favicons](https://en.wikipedia.org/wiki/Favicon). + +Why use this module? + + - User agents request `favicon.ico` frequently and indiscriminately, so you + may wish to exclude these requests from your logs by using this middleware + before your logger middleware. + - This module caches the icon in memory to improve performance by skipping + disk access. + - This module provides an `ETag` based on the contents of the icon, rather + than file system properties. + - This module will serve with the most compatible `Content-Type`. + +**Note** This module is exclusively for serving the "default, implicit favicon", +which is `GET /favicon.ico`. For additional vendor-specific icons that require +HTML markup, additional middleware is required to serve the relevant files, for +example [serve-static](https://npmjs.org/package/serve-static). + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install serve-favicon +``` + +## API + +### favicon(path, options) + +Create new middleware to serve a favicon from the given `path` to a favicon file. +`path` may also be a `Buffer` of the icon to serve. + +#### Options + +Serve favicon accepts these properties in the options object. + +##### maxAge + +The `cache-control` `max-age` directive in `ms`, defaulting to 1 year. This can +also be a string accepted by the [ms](https://www.npmjs.org/package/ms#readme) +module. + +## Examples + +Typically this middleware will come very early in your stack (maybe even first) +to avoid processing any other middleware if we already know the request is for +`/favicon.ico`. + +### express + +```javascript +var express = require('express') +var favicon = require('serve-favicon') +var path = require('path') + +var app = express() +app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))) + +// Add your routes here, etc. + +app.listen(3000) +``` + +### connect + +```javascript +var connect = require('connect') +var favicon = require('serve-favicon') +var path = require('path') + +var app = connect() +app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))) + +// Add your middleware here, etc. + +app.listen(3000) +``` + +### vanilla http server + +This middleware can be used anywhere, even outside express/connect. It takes +`req`, `res`, and `callback`. + +```javascript +var http = require('http') +var favicon = require('serve-favicon') +var finalhandler = require('finalhandler') +var path = require('path') + +var _favicon = favicon(path.join(__dirname, 'public', 'favicon.ico')) + +var server = http.createServer(function onRequest (req, res) { + var done = finalhandler(req, res) + + _favicon(req, res, function onNext (err) { + if (err) return done(err) + + // continue to process the request here, etc. + + res.statusCode = 404 + res.end('oops') + }) +}) + +server.listen(3000) +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/serve-favicon.svg +[npm-url]: https://npmjs.org/package/serve-favicon +[travis-image]: https://img.shields.io/travis/expressjs/serve-favicon/master.svg?label=linux +[travis-url]: https://travis-ci.org/expressjs/serve-favicon +[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/serve-favicon/master.svg?label=windows +[appveyor-url]: https://ci.appveyor.com/project/dougwilson/serve-favicon +[coveralls-image]: https://img.shields.io/coveralls/expressjs/serve-favicon.svg +[coveralls-url]: https://coveralls.io/r/expressjs/serve-favicon?branch=master +[downloads-image]: https://img.shields.io/npm/dm/serve-favicon.svg +[downloads-url]: https://npmjs.org/package/serve-favicon +[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg +[gratipay-url]: https://www.gratipay.com/dougwilson/ diff --git a/node_modules/serve-favicon/index.js b/node_modules/serve-favicon/index.js new file mode 100644 index 0000000..727013d --- /dev/null +++ b/node_modules/serve-favicon/index.js @@ -0,0 +1,211 @@ +/*! + * serve-favicon + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * Copyright(c) 2014-2017 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var Buffer = require('safe-buffer').Buffer +var etag = require('etag') +var fresh = require('fresh') +var fs = require('fs') +var ms = require('ms') +var parseUrl = require('parseurl') +var path = require('path') +var resolve = path.resolve + +/** + * Module exports. + * @public + */ + +module.exports = favicon + +/** + * Module variables. + * @private + */ + +var ONE_YEAR_MS = 60 * 60 * 24 * 365 * 1000 // 1 year + +/** + * Serves the favicon located by the given `path`. + * + * @public + * @param {String|Buffer} path + * @param {Object} [options] + * @return {Function} middleware + */ + +function favicon (path, options) { + var opts = options || {} + + var icon // favicon cache + var maxAge = calcMaxAge(opts.maxAge) + + if (!path) { + throw new TypeError('path to favicon.ico is required') + } + + if (Buffer.isBuffer(path)) { + icon = createIcon(Buffer.from(path), maxAge) + } else if (typeof path === 'string') { + path = resolveSync(path) + } else { + throw new TypeError('path to favicon.ico must be string or buffer') + } + + return function favicon (req, res, next) { + if (parseUrl(req).pathname !== '/favicon.ico') { + next() + return + } + + if (req.method !== 'GET' && req.method !== 'HEAD') { + res.statusCode = req.method === 'OPTIONS' ? 200 : 405 + res.setHeader('Allow', 'GET, HEAD, OPTIONS') + res.setHeader('Content-Length', '0') + res.end() + return + } + + if (icon) { + send(req, res, icon) + return + } + + fs.readFile(path, function (err, buf) { + if (err) return next(err) + icon = createIcon(buf, maxAge) + send(req, res, icon) + }) + } +} + +/** + * Calculate the max-age from a configured value. + * + * @private + * @param {string|number} val + * @return {number} + */ + +function calcMaxAge (val) { + var num = typeof val === 'string' + ? ms(val) + : val + + return num != null + ? Math.min(Math.max(0, num), ONE_YEAR_MS) + : ONE_YEAR_MS +} + +/** + * Create icon data from Buffer and max-age. + * + * @private + * @param {Buffer} buf + * @param {number} maxAge + * @return {object} + */ + +function createIcon (buf, maxAge) { + return { + body: buf, + headers: { + 'Cache-Control': 'public, max-age=' + Math.floor(maxAge / 1000), + 'ETag': etag(buf) + } + } +} + +/** + * Create EISDIR error. + * + * @private + * @param {string} path + * @return {Error} + */ + +function createIsDirError (path) { + var error = new Error('EISDIR, illegal operation on directory \'' + path + '\'') + error.code = 'EISDIR' + error.errno = 28 + error.path = path + error.syscall = 'open' + return error +} + +/** + * Determine if the cached representation is fresh. + * + * @param {object} req + * @param {object} res + * @return {boolean} + * @private + */ + +function isFresh (req, res) { + return fresh(req.headers, { + 'etag': res.getHeader('ETag'), + 'last-modified': res.getHeader('Last-Modified') + }) +} + +/** + * Resolve the path to icon. + * + * @param {string} iconPath + * @private + */ + +function resolveSync (iconPath) { + var path = resolve(iconPath) + var stat = fs.statSync(path) + + if (stat.isDirectory()) { + throw createIsDirError(path) + } + + return path +} + +/** + * Send icon data in response to a request. + * + * @private + * @param {IncomingMessage} req + * @param {OutgoingMessage} res + * @param {object} icon + */ + +function send (req, res, icon) { + // Set headers + var headers = icon.headers + var keys = Object.keys(headers) + for (var i = 0; i < keys.length; i++) { + var key = keys[i] + res.setHeader(key, headers[key]) + } + + // Validate freshness + if (isFresh(req, res)) { + res.statusCode = 304 + res.end() + return + } + + // Send icon + res.statusCode = 200 + res.setHeader('Content-Length', icon.body.length) + res.setHeader('Content-Type', 'image/x-icon') + res.end(icon.body) +} diff --git a/node_modules/serve-favicon/package.json b/node_modules/serve-favicon/package.json new file mode 100644 index 0000000..b1cd8cc --- /dev/null +++ b/node_modules/serve-favicon/package.json @@ -0,0 +1,82 @@ +{ + "_from": "serve-favicon@~2.4.5", + "_id": "serve-favicon@2.4.5", + "_inBundle": false, + "_integrity": "sha512-s7F8h2NrslMkG50KxvlGdj+ApSwaLex0vexuJ9iFf3GLTIp1ph/l1qZvRe9T9TJEYZgmq72ZwJ2VYiAEtChknw==", + "_location": "/serve-favicon", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "serve-favicon@~2.4.5", + "name": "serve-favicon", + "escapedName": "serve-favicon", + "rawSpec": "~2.4.5", + "saveSpec": null, + "fetchSpec": "~2.4.5" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/serve-favicon/-/serve-favicon-2.4.5.tgz", + "_shasum": "49d9a46863153a9240691c893d2b0e7d85d6d436", + "_spec": "serve-favicon@~2.4.5", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB", + "author": { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + "bugs": { + "url": "https://github.com/expressjs/serve-favicon/issues" + }, + "bundleDependencies": false, + "dependencies": { + "etag": "~1.8.1", + "fresh": "0.5.2", + "ms": "2.0.0", + "parseurl": "~1.3.2", + "safe-buffer": "5.1.1" + }, + "deprecated": false, + "description": "favicon serving middleware with caching", + "devDependencies": { + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.7.0", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-node": "5.1.1", + "eslint-plugin-promise": "3.5.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "mocha": "2.5.3", + "supertest": "1.1.0", + "temp-path": "1.0.0" + }, + "engines": { + "node": ">= 0.8.0" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "index.js" + ], + "homepage": "https://github.com/expressjs/serve-favicon#readme", + "keywords": [ + "express", + "favicon", + "middleware" + ], + "license": "MIT", + "name": "serve-favicon", + "repository": { + "type": "git", + "url": "git+https://github.com/expressjs/serve-favicon.git" + }, + "scripts": { + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/" + }, + "version": "2.4.5" +} diff --git a/node_modules/serve-static/HISTORY.md b/node_modules/serve-static/HISTORY.md new file mode 100644 index 0000000..544ba8e --- /dev/null +++ b/node_modules/serve-static/HISTORY.md @@ -0,0 +1,404 @@ +1.12.6 / 2017-09-22 +=================== + + * deps: send@0.15.6 + - deps: debug@2.6.9 + - perf: improve `If-Match` token parsing + * perf: improve slash collapsing + +1.12.5 / 2017-09-21 +=================== + + * deps: parseurl@~1.3.2 + - perf: reduce overhead for full URLs + - perf: unroll the "fast-path" `RegExp` + * deps: send@0.15.5 + - Fix handling of modified headers with invalid dates + - deps: etag@~1.8.1 + - deps: fresh@0.5.2 + +1.12.4 / 2017-08-05 +=================== + + * deps: send@0.15.4 + - deps: debug@2.6.8 + - deps: depd@~1.1.1 + - deps: http-errors@~1.6.2 + +1.12.3 / 2017-05-16 +=================== + + * deps: send@0.15.3 + - deps: debug@2.6.7 + +1.12.2 / 2017-04-26 +=================== + + * deps: send@0.15.2 + - deps: debug@2.6.4 + +1.12.1 / 2017-03-04 +=================== + + * deps: send@0.15.1 + - Fix issue when `Date.parse` does not return `NaN` on invalid date + - Fix strict violation in broken environments + +1.12.0 / 2017-02-25 +=================== + + * Send complete HTML document in redirect response + * Set default CSP header in redirect response + * deps: send@0.15.0 + - Fix false detection of `no-cache` request directive + - Fix incorrect result when `If-None-Match` has both `*` and ETags + - Fix weak `ETag` matching to match spec + - Remove usage of `res._headers` private field + - Support `If-Match` and `If-Unmodified-Since` headers + - Use `res.getHeaderNames()` when available + - Use `res.headersSent` when available + - deps: debug@2.6.1 + - deps: etag@~1.8.0 + - deps: fresh@0.5.0 + - deps: http-errors@~1.6.1 + +1.11.2 / 2017-01-23 +=================== + + * deps: send@0.14.2 + - deps: http-errors@~1.5.1 + - deps: ms@0.7.2 + - deps: statuses@~1.3.1 + +1.11.1 / 2016-06-10 +=================== + + * Fix redirect error when `req.url` contains raw non-URL characters + * deps: send@0.14.1 + +1.11.0 / 2016-06-07 +=================== + + * Use status code 301 for redirects + * deps: send@0.14.0 + - Add `acceptRanges` option + - Add `cacheControl` option + - Attempt to combine multiple ranges into single range + - Correctly inherit from `Stream` class + - Fix `Content-Range` header in 416 responses when using `start`/`end` options + - Fix `Content-Range` header missing from default 416 responses + - Ignore non-byte `Range` headers + - deps: http-errors@~1.5.0 + - deps: range-parser@~1.2.0 + - deps: statuses@~1.3.0 + - perf: remove argument reassignment + +1.10.3 / 2016-05-30 +=================== + + * deps: send@0.13.2 + - Fix invalid `Content-Type` header when `send.mime.default_type` unset + +1.10.2 / 2016-01-19 +=================== + + * deps: parseurl@~1.3.1 + - perf: enable strict mode + +1.10.1 / 2016-01-16 +=================== + + * deps: escape-html@~1.0.3 + - perf: enable strict mode + - perf: optimize string replacement + - perf: use faster string coercion + * deps: send@0.13.1 + - deps: depd@~1.1.0 + - deps: destroy@~1.0.4 + - deps: escape-html@~1.0.3 + - deps: range-parser@~1.0.3 + +1.10.0 / 2015-06-17 +=================== + + * Add `fallthrough` option + - Allows declaring this middleware is the final destination + - Provides better integration with Express patterns + * Fix reading options from options prototype + * Improve the default redirect response headers + * deps: escape-html@1.0.2 + * deps: send@0.13.0 + - Allow Node.js HTTP server to set `Date` response header + - Fix incorrectly removing `Content-Location` on 304 response + - Improve the default redirect response headers + - Send appropriate headers on default error response + - Use `http-errors` for standard emitted errors + - Use `statuses` instead of `http` module for status messages + - deps: escape-html@1.0.2 + - deps: etag@~1.7.0 + - deps: fresh@0.3.0 + - deps: on-finished@~2.3.0 + - perf: enable strict mode + - perf: remove unnecessary array allocations + * perf: enable strict mode + * perf: remove argument reassignment + +1.9.3 / 2015-05-14 +================== + + * deps: send@0.12.3 + - deps: debug@~2.2.0 + - deps: depd@~1.0.1 + - deps: etag@~1.6.0 + - deps: ms@0.7.1 + - deps: on-finished@~2.2.1 + +1.9.2 / 2015-03-14 +================== + + * deps: send@0.12.2 + - Throw errors early for invalid `extensions` or `index` options + - deps: debug@~2.1.3 + +1.9.1 / 2015-02-17 +================== + + * deps: send@0.12.1 + - Fix regression sending zero-length files + +1.9.0 / 2015-02-16 +================== + + * deps: send@0.12.0 + - Always read the stat size from the file + - Fix mutating passed-in `options` + - deps: mime@1.3.4 + +1.8.1 / 2015-01-20 +================== + + * Fix redirect loop in Node.js 0.11.14 + * deps: send@0.11.1 + - Fix root path disclosure + +1.8.0 / 2015-01-05 +================== + + * deps: send@0.11.0 + - deps: debug@~2.1.1 + - deps: etag@~1.5.1 + - deps: ms@0.7.0 + - deps: on-finished@~2.2.0 + +1.7.2 / 2015-01-02 +================== + + * Fix potential open redirect when mounted at root + +1.7.1 / 2014-10-22 +================== + + * deps: send@0.10.1 + - deps: on-finished@~2.1.1 + +1.7.0 / 2014-10-15 +================== + + * deps: send@0.10.0 + - deps: debug@~2.1.0 + - deps: depd@~1.0.0 + - deps: etag@~1.5.0 + +1.6.5 / 2015-02-04 +================== + + * Fix potential open redirect when mounted at root + - Back-ported from v1.7.2 + +1.6.4 / 2014-10-08 +================== + + * Fix redirect loop when index file serving disabled + +1.6.3 / 2014-09-24 +================== + + * deps: send@0.9.3 + - deps: etag@~1.4.0 + +1.6.2 / 2014-09-15 +================== + + * deps: send@0.9.2 + - deps: depd@0.4.5 + - deps: etag@~1.3.1 + - deps: range-parser@~1.0.2 + +1.6.1 / 2014-09-07 +================== + + * deps: send@0.9.1 + - deps: fresh@0.2.4 + +1.6.0 / 2014-09-07 +================== + + * deps: send@0.9.0 + - Add `lastModified` option + - Use `etag` to generate `ETag` header + - deps: debug@~2.0.0 + +1.5.4 / 2014-09-04 +================== + + * deps: send@0.8.5 + - Fix a path traversal issue when using `root` + - Fix malicious path detection for empty string path + +1.5.3 / 2014-08-17 +================== + + * deps: send@0.8.3 + +1.5.2 / 2014-08-14 +================== + + * deps: send@0.8.2 + - Work around `fd` leak in Node.js 0.10 for `fs.ReadStream` + +1.5.1 / 2014-08-09 +================== + + * Fix parsing of weird `req.originalUrl` values + * deps: parseurl@~1.3.0 + * deps: utils-merge@1.0.0 + +1.5.0 / 2014-08-05 +================== + + * deps: send@0.8.1 + - Add `extensions` option + +1.4.4 / 2014-08-04 +================== + + * deps: send@0.7.4 + - Fix serving index files without root dir + +1.4.3 / 2014-07-29 +================== + + * deps: send@0.7.3 + - Fix incorrect 403 on Windows and Node.js 0.11 + +1.4.2 / 2014-07-27 +================== + + * deps: send@0.7.2 + - deps: depd@0.4.4 + +1.4.1 / 2014-07-26 +================== + + * deps: send@0.7.1 + - deps: depd@0.4.3 + +1.4.0 / 2014-07-21 +================== + + * deps: parseurl@~1.2.0 + - Cache URLs based on original value + - Remove no-longer-needed URL mis-parse work-around + - Simplify the "fast-path" `RegExp` + * deps: send@0.7.0 + - Add `dotfiles` option + - deps: debug@1.0.4 + - deps: depd@0.4.2 + +1.3.2 / 2014-07-11 +================== + + * deps: send@0.6.0 + - Cap `maxAge` value to 1 year + - deps: debug@1.0.3 + +1.3.1 / 2014-07-09 +================== + + * deps: parseurl@~1.1.3 + - faster parsing of href-only URLs + +1.3.0 / 2014-06-28 +================== + + * Add `setHeaders` option + * Include HTML link in redirect response + * deps: send@0.5.0 + - Accept string for `maxAge` (converted by `ms`) + +1.2.3 / 2014-06-11 +================== + + * deps: send@0.4.3 + - Do not throw un-catchable error on file open race condition + - Use `escape-html` for HTML escaping + - deps: debug@1.0.2 + - deps: finished@1.2.2 + - deps: fresh@0.2.2 + +1.2.2 / 2014-06-09 +================== + + * deps: send@0.4.2 + - fix "event emitter leak" warnings + - deps: debug@1.0.1 + - deps: finished@1.2.1 + +1.2.1 / 2014-06-02 +================== + + * use `escape-html` for escaping + * deps: send@0.4.1 + - Send `max-age` in `Cache-Control` in correct format + +1.2.0 / 2014-05-29 +================== + + * deps: send@0.4.0 + - Calculate ETag with md5 for reduced collisions + - Fix wrong behavior when index file matches directory + - Ignore stream errors after request ends + - Skip directories in index file search + - deps: debug@0.8.1 + +1.1.0 / 2014-04-24 +================== + + * Accept options directly to `send` module + * deps: send@0.3.0 + +1.0.4 / 2014-04-07 +================== + + * Resolve relative paths at middleware setup + * Use parseurl to parse the URL from request + +1.0.3 / 2014-03-20 +================== + + * Do not rely on connect-like environments + +1.0.2 / 2014-03-06 +================== + + * deps: send@0.2.0 + +1.0.1 / 2014-03-05 +================== + + * Add mime export for back-compat + +1.0.0 / 2014-03-05 +================== + + * Genesis from `connect` diff --git a/node_modules/serve-static/LICENSE b/node_modules/serve-static/LICENSE new file mode 100644 index 0000000..cbe62e8 --- /dev/null +++ b/node_modules/serve-static/LICENSE @@ -0,0 +1,25 @@ +(The MIT License) + +Copyright (c) 2010 Sencha Inc. +Copyright (c) 2011 LearnBoost +Copyright (c) 2011 TJ Holowaychuk +Copyright (c) 2014-2016 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/serve-static/README.md b/node_modules/serve-static/README.md new file mode 100644 index 0000000..3dd5f48 --- /dev/null +++ b/node_modules/serve-static/README.md @@ -0,0 +1,253 @@ +# serve-static + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Linux Build][travis-image]][travis-url] +[![Windows Build][appveyor-image]][appveyor-url] +[![Test Coverage][coveralls-image]][coveralls-url] +[![Gratipay][gratipay-image]][gratipay-url] + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install serve-static +``` + +## API + + + +```js +var serveStatic = require('serve-static') +``` + +### serveStatic(root, options) + +Create a new middleware function to serve files from within a given root +directory. The file to serve will be determined by combining `req.url` +with the provided root directory. When a file is not found, instead of +sending a 404 response, this module will instead call `next()` to move on +to the next middleware, allowing for stacking and fall-backs. + +#### Options + +##### acceptRanges + +Enable or disable accepting ranged requests, defaults to true. +Disabling this will not send `Accept-Ranges` and ignore the contents +of the `Range` request header. + +##### cacheControl + +Enable or disable setting `Cache-Control` response header, defaults to +true. Disabling this will ignore the `maxAge` option. + +##### dotfiles + + Set how "dotfiles" are treated when encountered. A dotfile is a file +or directory that begins with a dot ("."). Note this check is done on +the path itself without checking if the path actually exists on the +disk. If `root` is specified, only the dotfiles above the root are +checked (i.e. the root itself can be within a dotfile when set +to "deny"). + + - `'allow'` No special treatment for dotfiles. + - `'deny'` Deny a request for a dotfile and 403/`next()`. + - `'ignore'` Pretend like the dotfile does not exist and 404/`next()`. + +The default value is similar to `'ignore'`, with the exception that this +default will not ignore the files within a directory that begins with a dot. + +##### etag + +Enable or disable etag generation, defaults to true. + +##### extensions + +Set file extension fallbacks. When set, if a file is not found, the given +extensions will be added to the file name and search for. The first that +exists will be served. Example: `['html', 'htm']`. + +The default value is `false`. + +##### fallthrough + +Set the middleware to have client errors fall-through as just unhandled +requests, otherwise forward a client error. The difference is that client +errors like a bad request or a request to a non-existent file will cause +this middleware to simply `next()` to your next middleware when this value +is `true`. When this value is `false`, these errors (even 404s), will invoke +`next(err)`. + +Typically `true` is desired such that multiple physical directories can be +mapped to the same web address or for routes to fill in non-existent files. + +The value `false` can be used if this middleware is mounted at a path that +is designed to be strictly a single file system directory, which allows for +short-circuiting 404s for less overhead. This middleware will also reply to +all methods. + +The default value is `true`. + +##### index + +By default this module will send "index.html" files in response to a request +on a directory. To disable this set `false` or to supply a new index pass a +string or an array in preferred order. + +##### lastModified + +Enable or disable `Last-Modified` header, defaults to true. Uses the file +system's last modified value. + +##### maxAge + +Provide a max-age in milliseconds for http caching, defaults to 0. This +can also be a string accepted by the [ms](https://www.npmjs.org/package/ms#readme) +module. + +##### redirect + +Redirect to trailing "/" when the pathname is a dir. Defaults to `true`. + +##### setHeaders + +Function to set custom headers on response. Alterations to the headers need to +occur synchronously. The function is called as `fn(res, path, stat)`, where +the arguments are: + + - `res` the response object + - `path` the file path that is being sent + - `stat` the stat object of the file that is being sent + +## Examples + +### Serve files with vanilla node.js http server + +```js +var finalhandler = require('finalhandler') +var http = require('http') +var serveStatic = require('serve-static') + +// Serve up public/ftp folder +var serve = serveStatic('public/ftp', {'index': ['index.html', 'index.htm']}) + +// Create server +var server = http.createServer(function onRequest (req, res) { + serve(req, res, finalhandler(req, res)) +}) + +// Listen +server.listen(3000) +``` + +### Serve all files as downloads + +```js +var contentDisposition = require('content-disposition') +var finalhandler = require('finalhandler') +var http = require('http') +var serveStatic = require('serve-static') + +// Serve up public/ftp folder +var serve = serveStatic('public/ftp', { + 'index': false, + 'setHeaders': setHeaders +}) + +// Set header to force download +function setHeaders (res, path) { + res.setHeader('Content-Disposition', contentDisposition(path)) +} + +// Create server +var server = http.createServer(function onRequest (req, res) { + serve(req, res, finalhandler(req, res)) +}) + +// Listen +server.listen(3000) +``` + +### Serving using express + +#### Simple + +This is a simple example of using Express. + +```js +var express = require('express') +var serveStatic = require('serve-static') + +var app = express() + +app.use(serveStatic('public/ftp', {'index': ['default.html', 'default.htm']})) +app.listen(3000) +``` + +#### Multiple roots + +This example shows a simple way to search through multiple directories. +Files are look for in `public-optimized/` first, then `public/` second as +a fallback. + +```js +var express = require('express') +var path = require('path') +var serveStatic = require('serve-static') + +var app = express() + +app.use(serveStatic(path.join(__dirname, 'public-optimized'))) +app.use(serveStatic(path.join(__dirname, 'public'))) +app.listen(3000) +``` + +#### Different settings for paths + +This example shows how to set a different max age depending on the served +file type. In this example, HTML files are not cached, while everything else +is for 1 day. + +```js +var express = require('express') +var path = require('path') +var serveStatic = require('serve-static') + +var app = express() + +app.use(serveStatic(path.join(__dirname, 'public'), { + maxAge: '1d', + setHeaders: setCustomCacheControl +})) + +app.listen(3000) + +function setCustomCacheControl (res, path) { + if (serveStatic.mime.lookup(path) === 'text/html') { + // Custom Cache-Control for HTML files + res.setHeader('Cache-Control', 'public, max-age=0') + } +} +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/serve-static.svg +[npm-url]: https://npmjs.org/package/serve-static +[travis-image]: https://img.shields.io/travis/expressjs/serve-static/master.svg?label=linux +[travis-url]: https://travis-ci.org/expressjs/serve-static +[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/serve-static/master.svg?label=windows +[appveyor-url]: https://ci.appveyor.com/project/dougwilson/serve-static +[coveralls-image]: https://img.shields.io/coveralls/expressjs/serve-static/master.svg +[coveralls-url]: https://coveralls.io/r/expressjs/serve-static +[downloads-image]: https://img.shields.io/npm/dm/serve-static.svg +[downloads-url]: https://npmjs.org/package/serve-static +[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg +[gratipay-url]: https://gratipay.com/dougwilson/ diff --git a/node_modules/serve-static/index.js b/node_modules/serve-static/index.js new file mode 100644 index 0000000..3f77391 --- /dev/null +++ b/node_modules/serve-static/index.js @@ -0,0 +1,209 @@ +/*! + * serve-static + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * Copyright(c) 2014-2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var encodeUrl = require('encodeurl') +var escapeHtml = require('escape-html') +var parseUrl = require('parseurl') +var resolve = require('path').resolve +var send = require('send') +var url = require('url') + +/** + * Module exports. + * @public + */ + +module.exports = serveStatic +module.exports.mime = send.mime + +/** + * @param {string} root + * @param {object} [options] + * @return {function} + * @public + */ + +function serveStatic (root, options) { + if (!root) { + throw new TypeError('root path required') + } + + if (typeof root !== 'string') { + throw new TypeError('root path must be a string') + } + + // copy options object + var opts = Object.create(options || null) + + // fall-though + var fallthrough = opts.fallthrough !== false + + // default redirect + var redirect = opts.redirect !== false + + // headers listener + var setHeaders = opts.setHeaders + + if (setHeaders && typeof setHeaders !== 'function') { + throw new TypeError('option setHeaders must be function') + } + + // setup options for send + opts.maxage = opts.maxage || opts.maxAge || 0 + opts.root = resolve(root) + + // construct directory listener + var onDirectory = redirect + ? createRedirectDirectoryListener() + : createNotFoundDirectoryListener() + + return function serveStatic (req, res, next) { + if (req.method !== 'GET' && req.method !== 'HEAD') { + if (fallthrough) { + return next() + } + + // method not allowed + res.statusCode = 405 + res.setHeader('Allow', 'GET, HEAD') + res.setHeader('Content-Length', '0') + res.end() + return + } + + var forwardError = !fallthrough + var originalUrl = parseUrl.original(req) + var path = parseUrl(req).pathname + + // make sure redirect occurs at mount + if (path === '/' && originalUrl.pathname.substr(-1) !== '/') { + path = '' + } + + // create send stream + var stream = send(req, path, opts) + + // add directory handler + stream.on('directory', onDirectory) + + // add headers listener + if (setHeaders) { + stream.on('headers', setHeaders) + } + + // add file listener for fallthrough + if (fallthrough) { + stream.on('file', function onFile () { + // once file is determined, always forward error + forwardError = true + }) + } + + // forward errors + stream.on('error', function error (err) { + if (forwardError || !(err.statusCode < 500)) { + next(err) + return + } + + next() + }) + + // pipe + stream.pipe(res) + } +} + +/** + * Collapse all leading slashes into a single slash + * @private + */ +function collapseLeadingSlashes (str) { + for (var i = 0; i < str.length; i++) { + if (str.charCodeAt(i) !== 0x2f /* / */) { + break + } + } + + return i > 1 + ? '/' + str.substr(i) + : str +} + + /** + * Create a minimal HTML document. + * + * @param {string} title + * @param {string} body + * @private + */ + +function createHtmlDocument (title, body) { + return '\n' + + '\n' + + '\n' + + '\n' + + '' + title + '\n' + + '\n' + + '\n' + + '
    ' + body + '
    \n' + + '\n' +} + +/** + * Create a directory listener that just 404s. + * @private + */ + +function createNotFoundDirectoryListener () { + return function notFound () { + this.error(404) + } +} + +/** + * Create a directory listener that performs a redirect. + * @private + */ + +function createRedirectDirectoryListener () { + return function redirect (res) { + if (this.hasTrailingSlash()) { + this.error(404) + return + } + + // get original URL + var originalUrl = parseUrl.original(this.req) + + // append trailing slash + originalUrl.path = null + originalUrl.pathname = collapseLeadingSlashes(originalUrl.pathname + '/') + + // reformat the URL + var loc = encodeUrl(url.format(originalUrl)) + var doc = createHtmlDocument('Redirecting', 'Redirecting to ' + + escapeHtml(loc) + '') + + // send redirect response + res.statusCode = 301 + res.setHeader('Content-Type', 'text/html; charset=UTF-8') + res.setHeader('Content-Length', Buffer.byteLength(doc)) + res.setHeader('Content-Security-Policy', "default-src 'self'") + res.setHeader('X-Content-Type-Options', 'nosniff') + res.setHeader('Location', loc) + res.end(doc) + } +} diff --git a/node_modules/serve-static/package.json b/node_modules/serve-static/package.json new file mode 100644 index 0000000..65913a9 --- /dev/null +++ b/node_modules/serve-static/package.json @@ -0,0 +1,75 @@ +{ + "_from": "serve-static@1.12.6", + "_id": "serve-static@1.12.6", + "_inBundle": false, + "_integrity": "sha1-uXN3P2NEmTTaVOW+ul4x2fQhFXc=", + "_location": "/serve-static", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "serve-static@1.12.6", + "name": "serve-static", + "escapedName": "serve-static", + "rawSpec": "1.12.6", + "saveSpec": null, + "fetchSpec": "1.12.6" + }, + "_requiredBy": [ + "/express" + ], + "_resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.12.6.tgz", + "_shasum": "b973773f63449934da54e5beba5e31d9f4211577", + "_spec": "serve-static@1.12.6", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/express", + "author": { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + "bugs": { + "url": "https://github.com/expressjs/serve-static/issues" + }, + "bundleDependencies": false, + "dependencies": { + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.15.6" + }, + "deprecated": false, + "description": "Serve static files", + "devDependencies": { + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.7.0", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-node": "5.1.1", + "eslint-plugin-promise": "3.5.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "mocha": "2.5.3", + "supertest": "1.1.0" + }, + "engines": { + "node": ">= 0.8.0" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "index.js" + ], + "homepage": "https://github.com/expressjs/serve-static#readme", + "license": "MIT", + "name": "serve-static", + "repository": { + "type": "git", + "url": "git+https://github.com/expressjs/serve-static.git" + }, + "scripts": { + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/" + }, + "version": "1.12.6" +} diff --git a/node_modules/set-immediate-shim/index.js b/node_modules/set-immediate-shim/index.js new file mode 100644 index 0000000..e690485 --- /dev/null +++ b/node_modules/set-immediate-shim/index.js @@ -0,0 +1,7 @@ +'use strict'; +module.exports = typeof setImmediate === 'function' ? setImmediate : + function setImmediate() { + var args = [].slice.apply(arguments); + args.splice(1, 0, 0); + setTimeout.apply(null, args); + }; diff --git a/node_modules/set-immediate-shim/package.json b/node_modules/set-immediate-shim/package.json new file mode 100644 index 0000000..a58d89b --- /dev/null +++ b/node_modules/set-immediate-shim/package.json @@ -0,0 +1,66 @@ +{ + "_from": "set-immediate-shim@^1.0.1", + "_id": "set-immediate-shim@1.0.1", + "_inBundle": false, + "_integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", + "_location": "/set-immediate-shim", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "set-immediate-shim@^1.0.1", + "name": "set-immediate-shim", + "escapedName": "set-immediate-shim", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/readdirp" + ], + "_resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "_shasum": "4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61", + "_spec": "set-immediate-shim@^1.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/readdirp", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/set-immediate-shim/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Simple setImmediate shim", + "devDependencies": { + "ava": "0.0.4", + "require-uncached": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/set-immediate-shim#readme", + "keywords": [ + "setImmediate", + "immediate", + "setTimeout", + "timeout", + "shim", + "polyfill", + "ponyfill" + ], + "license": "MIT", + "name": "set-immediate-shim", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/set-immediate-shim.git" + }, + "scripts": { + "test": "node test.js" + }, + "version": "1.0.1" +} diff --git a/node_modules/set-immediate-shim/readme.md b/node_modules/set-immediate-shim/readme.md new file mode 100644 index 0000000..4ec864f --- /dev/null +++ b/node_modules/set-immediate-shim/readme.md @@ -0,0 +1,31 @@ +# set-immediate-shim [![Build Status](https://travis-ci.org/sindresorhus/set-immediate-shim.svg?branch=master)](https://travis-ci.org/sindresorhus/set-immediate-shim) + +> Simple [`setImmediate`](https://developer.mozilla.org/en-US/docs/Web/API/Window.setImmediate) shim + + +## Install + +``` +$ npm install --save set-immediate-shim +``` + + +## Usage + +```js +var setImmediateShim = require('set-immediate-shim'); + +setImmediateShim(function () { + console.log('2'); +}); + +console.log('1'); + +//=> 1 +//=> 2 +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/set-value/LICENSE b/node_modules/set-value/LICENSE new file mode 100644 index 0000000..d734237 --- /dev/null +++ b/node_modules/set-value/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, 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/node_modules/set-value/README.md b/node_modules/set-value/README.md new file mode 100644 index 0000000..e336d74 --- /dev/null +++ b/node_modules/set-value/README.md @@ -0,0 +1,150 @@ +# set-value [![NPM version](https://img.shields.io/npm/v/set-value.svg?style=flat)](https://www.npmjs.com/package/set-value) [![NPM monthly downloads](https://img.shields.io/npm/dm/set-value.svg?style=flat)](https://npmjs.org/package/set-value) [![NPM total downloads](https://img.shields.io/npm/dt/set-value.svg?style=flat)](https://npmjs.org/package/set-value) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/set-value.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/set-value) + +> Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save set-value +``` + +## Usage + +```js +var set = require('set-value'); +set(object, prop, value); +``` + +### Params + +* `object` **{object}**: The object to set `value` on +* `prop` **{string}**: The property to set. Dot-notation may be used. +* `value` **{any}**: The value to set on `object[prop]` + +## Examples + +Updates and returns the given object: + +```js +var obj = {}; +set(obj, 'a.b.c', 'd'); +console.log(obj); +//=> { a: { b: { c: 'd' } } } +``` + +### Escaping + +**Escaping with backslashes** + +Prevent set-value from splitting on a dot by prefixing it with backslashes: + +```js +console.log(set({}, 'a\\.b.c', 'd')); +//=> { 'a.b': { c: 'd' } } + +console.log(set({}, 'a\\.b\\.c', 'd')); +//=> { 'a.b.c': 'd' } +``` + +**Escaping with double-quotes or single-quotes** + +Wrap double or single quotes around the string, or part of the string, that should not be split by set-value: + +```js +console.log(set({}, '"a.b".c', 'd')); +//=> { 'a.b': { c: 'd' } } + +console.log(set({}, "'a.b'.c", "d")); +//=> { 'a.b': { c: 'd' } } + +console.log(set({}, '"this/is/a/.file.path"', 'd')); +//=> { 'this/is/a/file.path': 'd' } +``` + +### Bracket support + +set-value does not split inside brackets or braces: + +```js +console.log(set({}, '[a.b].c', 'd')); +//=> { '[a.b]': { c: 'd' } } + +console.log(set({}, "(a.b).c", "d")); +//=> { '(a.b)': { c: 'd' } } + +console.log(set({}, ".c", "d")); +//=> { '': { c: 'd' } } + +console.log(set({}, "{a..b}.c", "d")); +//=> { '{a..b}': { c: 'd' } } +``` + +## History + +### v2.0.0 + +* Adds support for escaping with double or single quotes. See [escaping](#escaping) for examples. +* Will no longer split inside brackets or braces. See [bracket support](#bracket-support) for examples. + +If there are any regressions please create a [bug report](../../issues/new). Thanks! + +## About + +### Related projects + +* [assign-value](https://www.npmjs.com/package/assign-value): Assign a value or extend a deeply nested property of an object using object path… [more](https://github.com/jonschlinkert/assign-value) | [homepage](https://github.com/jonschlinkert/assign-value "Assign a value or extend a deeply nested property of an object using object path notation.") +* [get-value](https://www.npmjs.com/package/get-value): Use property paths (`a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value "Use property paths (`a.b.c`) to get a nested value from an object.") +* [has-value](https://www.npmjs.com/package/has-value): Returns true if a value exists, false if empty. Works with deeply nested values using… [more](https://github.com/jonschlinkert/has-value) | [homepage](https://github.com/jonschlinkert/has-value "Returns true if a value exists, false if empty. Works with deeply nested values using object paths.") +* [merge-value](https://www.npmjs.com/package/merge-value): Similar to assign-value but deeply merges object values or nested values using object path/dot notation. | [homepage](https://github.com/jonschlinkert/merge-value "Similar to assign-value but deeply merges object values or nested values using object path/dot notation.") +* [omit-value](https://www.npmjs.com/package/omit-value): Omit properties from an object or deeply nested property of an object using object path… [more](https://github.com/jonschlinkert/omit-value) | [homepage](https://github.com/jonschlinkert/omit-value "Omit properties from an object or deeply nested property of an object using object path notation.") +* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value "Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths.") +* [union-value](https://www.npmjs.com/package/union-value): Set an array of unique values as the property of an object. Supports setting deeply… [more](https://github.com/jonschlinkert/union-value) | [homepage](https://github.com/jonschlinkert/union-value "Set an array of unique values as the property of an object. Supports setting deeply nested properties using using object-paths/dot notation.") +* [unset-value](https://www.npmjs.com/package/unset-value): Delete nested properties from an object using dot notation. | [homepage](https://github.com/jonschlinkert/unset-value "Delete nested properties from an object using dot notation.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 59 | [jonschlinkert](https://github.com/jonschlinkert) | +| 1 | [vadimdemedes](https://github.com/vadimdemedes) | +| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 21, 2017._ \ No newline at end of file diff --git a/node_modules/set-value/index.js b/node_modules/set-value/index.js new file mode 100644 index 0000000..000a77e --- /dev/null +++ b/node_modules/set-value/index.js @@ -0,0 +1,51 @@ +/*! + * set-value + * + * Copyright (c) 2014-2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var split = require('split-string'); +var extend = require('extend-shallow'); +var isPlainObject = require('is-plain-object'); +var isObject = require('is-extendable'); + +module.exports = function(obj, prop, val) { + if (!isObject(obj)) { + return obj; + } + + if (Array.isArray(prop)) { + prop = [].concat.apply([], prop).join('.'); + } + + if (typeof prop !== 'string') { + return obj; + } + + var keys = split(prop, {sep: '.', brackets: true}); + var len = keys.length; + var idx = -1; + var current = obj; + + while (++idx < len) { + var key = keys[idx]; + if (idx !== len - 1) { + if (!isObject(current[key])) { + current[key] = {}; + } + current = current[key]; + continue; + } + + if (isPlainObject(current[key]) && isPlainObject(val)) { + current[key] = extend({}, current[key], val); + } else { + current[key] = val; + } + } + + return obj; +}; diff --git a/node_modules/set-value/node_modules/extend-shallow/LICENSE b/node_modules/set-value/node_modules/extend-shallow/LICENSE new file mode 100644 index 0000000..fa30c4c --- /dev/null +++ b/node_modules/set-value/node_modules/extend-shallow/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2015, 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/node_modules/set-value/node_modules/extend-shallow/README.md b/node_modules/set-value/node_modules/extend-shallow/README.md new file mode 100644 index 0000000..cdc45d4 --- /dev/null +++ b/node_modules/set-value/node_modules/extend-shallow/README.md @@ -0,0 +1,61 @@ +# extend-shallow [![NPM version](https://badge.fury.io/js/extend-shallow.svg)](http://badge.fury.io/js/extend-shallow) [![Build Status](https://travis-ci.org/jonschlinkert/extend-shallow.svg)](https://travis-ci.org/jonschlinkert/extend-shallow) + +> Extend an object with the properties of additional objects. node.js/javascript util. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i extend-shallow --save +``` + +## Usage + +```js +var extend = require('extend-shallow'); + +extend({a: 'b'}, {c: 'd'}) +//=> {a: 'b', c: 'd'} +``` + +Pass an empty object to shallow clone: + +```js +var obj = {}; +extend(obj, {a: 'b'}, {c: 'd'}) +//=> {a: 'b', c: 'd'} +``` + +## Related + +* [extend-shallow](https://github.com/jonschlinkert/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. +* [for-own](https://github.com/jonschlinkert/for-own): Iterate over the own enumerable properties of an object, and return an object with properties… [more](https://github.com/jonschlinkert/for-own) +* [for-in](https://github.com/jonschlinkert/for-in): Iterate over the own and inherited enumerable properties of an objecte, and return an object… [more](https://github.com/jonschlinkert/for-in) +* [is-plain-object](https://github.com/jonschlinkert/is-plain-object): Returns true if an object was created by the `Object` constructor. +* [isobject](https://github.com/jonschlinkert/isobject): Returns true if the value is an object and not an array or null. +* [kind-of](https://github.com/jonschlinkert/kind-of): Get the native type of a value. + +## Running tests + +Install dev dependencies: + +```sh +$ npm i -d && npm test +``` + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 Jon Schlinkert +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 29, 2015._ \ No newline at end of file diff --git a/node_modules/set-value/node_modules/extend-shallow/index.js b/node_modules/set-value/node_modules/extend-shallow/index.js new file mode 100644 index 0000000..92a067f --- /dev/null +++ b/node_modules/set-value/node_modules/extend-shallow/index.js @@ -0,0 +1,33 @@ +'use strict'; + +var isObject = require('is-extendable'); + +module.exports = function extend(o/*, objects*/) { + if (!isObject(o)) { o = {}; } + + var len = arguments.length; + for (var i = 1; i < len; i++) { + var obj = arguments[i]; + + if (isObject(obj)) { + assign(o, obj); + } + } + return o; +}; + +function assign(a, b) { + for (var key in b) { + if (hasOwn(b, key)) { + a[key] = b[key]; + } + } +} + +/** + * Returns true if the given `key` is an own property of `obj`. + */ + +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} diff --git a/node_modules/set-value/node_modules/extend-shallow/package.json b/node_modules/set-value/node_modules/extend-shallow/package.json new file mode 100644 index 0000000..4a3a9fc --- /dev/null +++ b/node_modules/set-value/node_modules/extend-shallow/package.json @@ -0,0 +1,87 @@ +{ + "_from": "extend-shallow@^2.0.1", + "_id": "extend-shallow@2.0.1", + "_inBundle": false, + "_integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "_location": "/set-value/extend-shallow", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "extend-shallow@^2.0.1", + "name": "extend-shallow", + "escapedName": "extend-shallow", + "rawSpec": "^2.0.1", + "saveSpec": null, + "fetchSpec": "^2.0.1" + }, + "_requiredBy": [ + "/set-value" + ], + "_resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "_shasum": "51af7d614ad9a9f610ea1bafbb989d6b1c56890f", + "_spec": "extend-shallow@^2.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/set-value", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/extend-shallow/issues" + }, + "bundleDependencies": false, + "dependencies": { + "is-extendable": "^0.1.0" + }, + "deprecated": false, + "description": "Extend an object with the properties of additional objects. node.js/javascript util.", + "devDependencies": { + "array-slice": "^0.2.3", + "benchmarked": "^0.1.4", + "chalk": "^1.0.0", + "for-own": "^0.1.3", + "glob": "^5.0.12", + "is-plain-object": "^2.0.1", + "kind-of": "^2.0.0", + "minimist": "^1.1.1", + "mocha": "^2.2.5", + "should": "^7.0.1" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/extend-shallow", + "keywords": [ + "assign", + "extend", + "javascript", + "js", + "keys", + "merge", + "obj", + "object", + "prop", + "properties", + "property", + "props", + "shallow", + "util", + "utility", + "utils", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "extend-shallow", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/extend-shallow.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "2.0.1" +} diff --git a/node_modules/set-value/package.json b/node_modules/set-value/package.json new file mode 100644 index 0000000..fa18db1 --- /dev/null +++ b/node_modules/set-value/package.json @@ -0,0 +1,120 @@ +{ + "_from": "set-value@^2.0.0", + "_id": "set-value@2.0.0", + "_inBundle": false, + "_integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "_location": "/set-value", + "_phantomChildren": { + "is-extendable": "0.1.1" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "set-value@^2.0.0", + "name": "set-value", + "escapedName": "set-value", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/cache-base" + ], + "_resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "_shasum": "71ae4a88f0feefbbf52d1ea604f3fb315ebb6274", + "_spec": "set-value@^2.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/cache-base", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/set-value/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "url": "https://github.com/wtgtybhertgeghgtwtg" + }, + { + "name": "Vadim Demedes", + "url": "https://vadimdemedes.com" + } + ], + "dependencies": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "deprecated": false, + "description": "Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths.", + "devDependencies": { + "gulp-format-md": "^0.1.12", + "mocha": "^3.4.2" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/set-value", + "keywords": [ + "get", + "has", + "hasown", + "key", + "keys", + "nested", + "notation", + "object", + "prop", + "properties", + "property", + "props", + "set", + "value", + "values" + ], + "license": "MIT", + "main": "index.js", + "name": "set-value", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/set-value.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "assign-value", + "get-value", + "has-value", + "merge-value", + "omit-value", + "set-value", + "union-value", + "unset-value" + ] + }, + "lint": { + "reflinks": true + } + }, + "version": "2.0.0" +} diff --git a/node_modules/setprototypeof/LICENSE b/node_modules/setprototypeof/LICENSE new file mode 100644 index 0000000..61afa2f --- /dev/null +++ b/node_modules/setprototypeof/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2015, Wes Todd + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/setprototypeof/README.md b/node_modules/setprototypeof/README.md new file mode 100644 index 0000000..01d7947 --- /dev/null +++ b/node_modules/setprototypeof/README.md @@ -0,0 +1,21 @@ +# Polyfill for `Object.setPrototypeOf` + +A simple cross platform implementation to set the prototype of an instianted object. Supports all modern browsers and at least back to IE8. + +## Usage: + +``` +$ npm install --save setprototypeof +``` + +```javascript +var setPrototypeOf = require('setprototypeof'); + +var obj = {}; +setPrototypeOf(obj, { + foo: function() { + return 'bar'; + } +}); +obj.foo(); // bar +``` diff --git a/node_modules/setprototypeof/index.js b/node_modules/setprototypeof/index.js new file mode 100644 index 0000000..93ea417 --- /dev/null +++ b/node_modules/setprototypeof/index.js @@ -0,0 +1,15 @@ +module.exports = Object.setPrototypeOf || ({__proto__:[]} instanceof Array ? setProtoOf : mixinProperties); + +function setProtoOf(obj, proto) { + obj.__proto__ = proto; + return obj; +} + +function mixinProperties(obj, proto) { + for (var prop in proto) { + if (!obj.hasOwnProperty(prop)) { + obj[prop] = proto[prop]; + } + } + return obj; +} diff --git a/node_modules/setprototypeof/package.json b/node_modules/setprototypeof/package.json new file mode 100644 index 0000000..d28e4d1 --- /dev/null +++ b/node_modules/setprototypeof/package.json @@ -0,0 +1,52 @@ +{ + "_from": "setprototypeof@1.0.3", + "_id": "setprototypeof@1.0.3", + "_inBundle": false, + "_integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=", + "_location": "/setprototypeof", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "setprototypeof@1.0.3", + "name": "setprototypeof", + "escapedName": "setprototypeof", + "rawSpec": "1.0.3", + "saveSpec": null, + "fetchSpec": "1.0.3" + }, + "_requiredBy": [ + "/express", + "/http-errors" + ], + "_resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", + "_shasum": "66567e37043eeb4f04d91bd658c0cbefb55b8e04", + "_spec": "setprototypeof@1.0.3", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/http-errors", + "author": { + "name": "Wes Todd" + }, + "bugs": { + "url": "https://github.com/wesleytodd/setprototypeof/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "A small polyfill for Object.setprototypeof", + "homepage": "https://github.com/wesleytodd/setprototypeof", + "keywords": [ + "polyfill", + "object", + "setprototypeof" + ], + "license": "ISC", + "main": "index.js", + "name": "setprototypeof", + "repository": { + "type": "git", + "url": "git+https://github.com/wesleytodd/setprototypeof.git" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "version": "1.0.3" +} diff --git a/node_modules/shebang-command/index.js b/node_modules/shebang-command/index.js new file mode 100644 index 0000000..2de70b0 --- /dev/null +++ b/node_modules/shebang-command/index.js @@ -0,0 +1,19 @@ +'use strict'; +var shebangRegex = require('shebang-regex'); + +module.exports = function (str) { + var match = str.match(shebangRegex); + + if (!match) { + return null; + } + + var arr = match[0].replace(/#! ?/, '').split(' '); + var bin = arr[0].split('/').pop(); + var arg = arr[1]; + + return (bin === 'env' ? + arg : + bin + (arg ? ' ' + arg : '') + ); +}; diff --git a/node_modules/shebang-command/license b/node_modules/shebang-command/license new file mode 100644 index 0000000..0f8cf79 --- /dev/null +++ b/node_modules/shebang-command/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Kevin Martensson (github.com/kevva) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/shebang-command/package.json b/node_modules/shebang-command/package.json new file mode 100644 index 0000000..5dbfd30 --- /dev/null +++ b/node_modules/shebang-command/package.json @@ -0,0 +1,71 @@ +{ + "_from": "shebang-command@^1.2.0", + "_id": "shebang-command@1.2.0", + "_inBundle": false, + "_integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "_location": "/shebang-command", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "shebang-command@^1.2.0", + "name": "shebang-command", + "escapedName": "shebang-command", + "rawSpec": "^1.2.0", + "saveSpec": null, + "fetchSpec": "^1.2.0" + }, + "_requiredBy": [ + "/cross-spawn" + ], + "_resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "_shasum": "44aac65b695b03398968c39f363fee5deafdf1ea", + "_spec": "shebang-command@^1.2.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/cross-spawn", + "author": { + "name": "Kevin Martensson", + "email": "kevinmartensson@gmail.com", + "url": "github.com/kevva" + }, + "bugs": { + "url": "https://github.com/kevva/shebang-command/issues" + }, + "bundleDependencies": false, + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "deprecated": false, + "description": "Get the command from a shebang", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/kevva/shebang-command#readme", + "keywords": [ + "cmd", + "command", + "parse", + "shebang" + ], + "license": "MIT", + "name": "shebang-command", + "repository": { + "type": "git", + "url": "git+https://github.com/kevva/shebang-command.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.2.0", + "xo": { + "ignores": [ + "test.js" + ] + } +} diff --git a/node_modules/shebang-command/readme.md b/node_modules/shebang-command/readme.md new file mode 100644 index 0000000..16b0be4 --- /dev/null +++ b/node_modules/shebang-command/readme.md @@ -0,0 +1,39 @@ +# shebang-command [![Build Status](https://travis-ci.org/kevva/shebang-command.svg?branch=master)](https://travis-ci.org/kevva/shebang-command) + +> Get the command from a shebang + + +## Install + +``` +$ npm install --save shebang-command +``` + + +## Usage + +```js +const shebangCommand = require('shebang-command'); + +shebangCommand('#!/usr/bin/env node'); +//=> 'node' + +shebangCommand('#!/bin/bash'); +//=> 'bash' +``` + + +## API + +### shebangCommand(string) + +#### string + +Type: `string` + +String containing a shebang. + + +## License + +MIT © [Kevin Martensson](http://github.com/kevva) diff --git a/node_modules/shebang-regex/index.js b/node_modules/shebang-regex/index.js new file mode 100644 index 0000000..d052d2e --- /dev/null +++ b/node_modules/shebang-regex/index.js @@ -0,0 +1,2 @@ +'use strict'; +module.exports = /^#!.*/; diff --git a/node_modules/shebang-regex/license b/node_modules/shebang-regex/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/shebang-regex/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/shebang-regex/package.json b/node_modules/shebang-regex/package.json new file mode 100644 index 0000000..6e5cc08 --- /dev/null +++ b/node_modules/shebang-regex/package.json @@ -0,0 +1,64 @@ +{ + "_from": "shebang-regex@^1.0.0", + "_id": "shebang-regex@1.0.0", + "_inBundle": false, + "_integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "_location": "/shebang-regex", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "shebang-regex@^1.0.0", + "name": "shebang-regex", + "escapedName": "shebang-regex", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/shebang-command" + ], + "_resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "_shasum": "da42f49740c0b42db2ca9728571cb190c98efea3", + "_spec": "shebang-regex@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/shebang-command", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/shebang-regex/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Regular expression for matching a shebang", + "devDependencies": { + "ava": "0.0.4" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/shebang-regex#readme", + "keywords": [ + "re", + "regex", + "regexp", + "shebang", + "match", + "test" + ], + "license": "MIT", + "name": "shebang-regex", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/shebang-regex.git" + }, + "scripts": { + "test": "node test.js" + }, + "version": "1.0.0" +} diff --git a/node_modules/shebang-regex/readme.md b/node_modules/shebang-regex/readme.md new file mode 100644 index 0000000..ef75e51 --- /dev/null +++ b/node_modules/shebang-regex/readme.md @@ -0,0 +1,29 @@ +# shebang-regex [![Build Status](https://travis-ci.org/sindresorhus/shebang-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/shebang-regex) + +> Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) + + +## Install + +``` +$ npm install --save shebang-regex +``` + + +## Usage + +```js +var shebangRegex = require('shebang-regex'); +var str = '#!/usr/bin/env node\nconsole.log("unicorns");'; + +shebangRegex.test(str); +//=> true + +shebangRegex.exec(str)[0]; +//=> '#!/usr/bin/env node' +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/signal-exit/CHANGELOG.md b/node_modules/signal-exit/CHANGELOG.md new file mode 100644 index 0000000..e2f70d2 --- /dev/null +++ b/node_modules/signal-exit/CHANGELOG.md @@ -0,0 +1,27 @@ +# Change Log + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + + +## [3.0.1](https://github.com/tapjs/signal-exit/compare/v3.0.0...v3.0.1) (2016-09-08) + + +### Bug Fixes + +* do not listen on SIGBUS, SIGFPE, SIGSEGV and SIGILL ([#40](https://github.com/tapjs/signal-exit/issues/40)) ([5b105fb](https://github.com/tapjs/signal-exit/commit/5b105fb)) + + + + +# [3.0.0](https://github.com/tapjs/signal-exit/compare/v2.1.2...v3.0.0) (2016-06-13) + + +### Bug Fixes + +* get our test suite running on Windows ([#23](https://github.com/tapjs/signal-exit/issues/23)) ([6f3eda8](https://github.com/tapjs/signal-exit/commit/6f3eda8)) +* hooking SIGPROF was interfering with profilers see [#21](https://github.com/tapjs/signal-exit/issues/21) ([#24](https://github.com/tapjs/signal-exit/issues/24)) ([1248a4c](https://github.com/tapjs/signal-exit/commit/1248a4c)) + + +### BREAKING CHANGES + +* signal-exit no longer wires into SIGPROF diff --git a/node_modules/signal-exit/LICENSE.txt b/node_modules/signal-exit/LICENSE.txt new file mode 100644 index 0000000..eead04a --- /dev/null +++ b/node_modules/signal-exit/LICENSE.txt @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) 2015, Contributors + +Permission to use, copy, modify, and/or distribute this software +for any purpose with or without fee is hereby granted, provided +that the above copyright notice and this permission notice +appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE +LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/signal-exit/README.md b/node_modules/signal-exit/README.md new file mode 100644 index 0000000..8ebccab --- /dev/null +++ b/node_modules/signal-exit/README.md @@ -0,0 +1,40 @@ +# signal-exit + +[![Build Status](https://travis-ci.org/tapjs/signal-exit.png)](https://travis-ci.org/tapjs/signal-exit) +[![Coverage](https://coveralls.io/repos/tapjs/signal-exit/badge.svg?branch=master)](https://coveralls.io/r/tapjs/signal-exit?branch=master) +[![NPM version](https://img.shields.io/npm/v/signal-exit.svg)](https://www.npmjs.com/package/signal-exit) +[![Windows Tests](https://img.shields.io/appveyor/ci/bcoe/signal-exit/master.svg?label=Windows%20Tests)](https://ci.appveyor.com/project/bcoe/signal-exit) +[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version) + +When you want to fire an event no matter how a process exits: + +* reaching the end of execution. +* explicitly having `process.exit(code)` called. +* having `process.kill(pid, sig)` called. +* receiving a fatal signal from outside the process + +Use `signal-exit`. + +```js +var onExit = require('signal-exit') + +onExit(function (code, signal) { + console.log('process exited!') +}) +``` + +## API + +`var remove = onExit(function (code, signal) {}, options)` + +The return value of the function is a function that will remove the +handler. + +Note that the function *only* fires for signals if the signal would +cause the proces to exit. That is, there are no other listeners, and +it is a fatal signal. + +## Options + +* `alwaysLast`: Run this handler after any other signal or exit + handlers. This causes `process.emit` to be monkeypatched. diff --git a/node_modules/signal-exit/index.js b/node_modules/signal-exit/index.js new file mode 100644 index 0000000..337f691 --- /dev/null +++ b/node_modules/signal-exit/index.js @@ -0,0 +1,157 @@ +// Note: since nyc uses this module to output coverage, any lines +// that are in the direct sync flow of nyc's outputCoverage are +// ignored, since we can never get coverage for them. +var assert = require('assert') +var signals = require('./signals.js') + +var EE = require('events') +/* istanbul ignore if */ +if (typeof EE !== 'function') { + EE = EE.EventEmitter +} + +var emitter +if (process.__signal_exit_emitter__) { + emitter = process.__signal_exit_emitter__ +} else { + emitter = process.__signal_exit_emitter__ = new EE() + emitter.count = 0 + emitter.emitted = {} +} + +// Because this emitter is a global, we have to check to see if a +// previous version of this library failed to enable infinite listeners. +// I know what you're about to say. But literally everything about +// signal-exit is a compromise with evil. Get used to it. +if (!emitter.infinite) { + emitter.setMaxListeners(Infinity) + emitter.infinite = true +} + +module.exports = function (cb, opts) { + assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler') + + if (loaded === false) { + load() + } + + var ev = 'exit' + if (opts && opts.alwaysLast) { + ev = 'afterexit' + } + + var remove = function () { + emitter.removeListener(ev, cb) + if (emitter.listeners('exit').length === 0 && + emitter.listeners('afterexit').length === 0) { + unload() + } + } + emitter.on(ev, cb) + + return remove +} + +module.exports.unload = unload +function unload () { + if (!loaded) { + return + } + loaded = false + + signals.forEach(function (sig) { + try { + process.removeListener(sig, sigListeners[sig]) + } catch (er) {} + }) + process.emit = originalProcessEmit + process.reallyExit = originalProcessReallyExit + emitter.count -= 1 +} + +function emit (event, code, signal) { + if (emitter.emitted[event]) { + return + } + emitter.emitted[event] = true + emitter.emit(event, code, signal) +} + +// { : , ... } +var sigListeners = {} +signals.forEach(function (sig) { + sigListeners[sig] = function listener () { + // If there are no other listeners, an exit is coming! + // Simplest way: remove us and then re-send the signal. + // We know that this will kill the process, so we can + // safely emit now. + var listeners = process.listeners(sig) + if (listeners.length === emitter.count) { + unload() + emit('exit', null, sig) + /* istanbul ignore next */ + emit('afterexit', null, sig) + /* istanbul ignore next */ + process.kill(process.pid, sig) + } + } +}) + +module.exports.signals = function () { + return signals +} + +module.exports.load = load + +var loaded = false + +function load () { + if (loaded) { + return + } + loaded = true + + // This is the number of onSignalExit's that are in play. + // It's important so that we can count the correct number of + // listeners on signals, and don't wait for the other one to + // handle it instead of us. + emitter.count += 1 + + signals = signals.filter(function (sig) { + try { + process.on(sig, sigListeners[sig]) + return true + } catch (er) { + return false + } + }) + + process.emit = processEmit + process.reallyExit = processReallyExit +} + +var originalProcessReallyExit = process.reallyExit +function processReallyExit (code) { + process.exitCode = code || 0 + emit('exit', process.exitCode, null) + /* istanbul ignore next */ + emit('afterexit', process.exitCode, null) + /* istanbul ignore next */ + originalProcessReallyExit.call(process, process.exitCode) +} + +var originalProcessEmit = process.emit +function processEmit (ev, arg) { + if (ev === 'exit') { + if (arg !== undefined) { + process.exitCode = arg + } + var ret = originalProcessEmit.apply(this, arguments) + emit('exit', process.exitCode, null) + /* istanbul ignore next */ + emit('afterexit', process.exitCode, null) + return ret + } else { + return originalProcessEmit.apply(this, arguments) + } +} diff --git a/node_modules/signal-exit/package.json b/node_modules/signal-exit/package.json new file mode 100644 index 0000000..5d88dee --- /dev/null +++ b/node_modules/signal-exit/package.json @@ -0,0 +1,67 @@ +{ + "_from": "signal-exit@^3.0.0", + "_id": "signal-exit@3.0.2", + "_inBundle": false, + "_integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "_location": "/signal-exit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "signal-exit@^3.0.0", + "name": "signal-exit", + "escapedName": "signal-exit", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/execa", + "/write-file-atomic" + ], + "_resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "_shasum": "b5fdc08f1287ea1178628e415e25132b73646c6d", + "_spec": "signal-exit@^3.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/execa", + "author": { + "name": "Ben Coe", + "email": "ben@npmjs.com" + }, + "bugs": { + "url": "https://github.com/tapjs/signal-exit/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "when you want to fire an event no matter how a process exits.", + "devDependencies": { + "chai": "^3.5.0", + "coveralls": "^2.11.10", + "nyc": "^8.1.0", + "standard": "^7.1.2", + "standard-version": "^2.3.0", + "tap": "^8.0.1" + }, + "files": [ + "index.js", + "signals.js" + ], + "homepage": "https://github.com/tapjs/signal-exit", + "keywords": [ + "signal", + "exit" + ], + "license": "ISC", + "main": "index.js", + "name": "signal-exit", + "repository": { + "type": "git", + "url": "git+https://github.com/tapjs/signal-exit.git" + }, + "scripts": { + "coverage": "nyc report --reporter=text-lcov | coveralls", + "pretest": "standard", + "release": "standard-version", + "test": "tap --timeout=240 ./test/*.js --cov" + }, + "version": "3.0.2" +} diff --git a/node_modules/signal-exit/signals.js b/node_modules/signal-exit/signals.js new file mode 100644 index 0000000..3bd67a8 --- /dev/null +++ b/node_modules/signal-exit/signals.js @@ -0,0 +1,53 @@ +// This is not the set of all possible signals. +// +// It IS, however, the set of all signals that trigger +// an exit on either Linux or BSD systems. Linux is a +// superset of the signal names supported on BSD, and +// the unknown signals just fail to register, so we can +// catch that easily enough. +// +// Don't bother with SIGKILL. It's uncatchable, which +// means that we can't fire any callbacks anyway. +// +// If a user does happen to register a handler on a non- +// fatal signal like SIGWINCH or something, and then +// exit, it'll end up firing `process.emit('exit')`, so +// the handler will be fired anyway. +// +// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised +// artificially, inherently leave the process in a +// state from which it is not safe to try and enter JS +// listeners. +module.exports = [ + 'SIGABRT', + 'SIGALRM', + 'SIGHUP', + 'SIGINT', + 'SIGTERM' +] + +if (process.platform !== 'win32') { + module.exports.push( + 'SIGVTALRM', + 'SIGXCPU', + 'SIGXFSZ', + 'SIGUSR2', + 'SIGTRAP', + 'SIGSYS', + 'SIGQUIT', + 'SIGIOT' + // should detect profiler and enable/disable accordingly. + // see #21 + // 'SIGPROF' + ) +} + +if (process.platform === 'linux') { + module.exports.push( + 'SIGIO', + 'SIGPOLL', + 'SIGPWR', + 'SIGSTKFLT', + 'SIGUNUSED' + ) +} diff --git a/node_modules/sliced/History.md b/node_modules/sliced/History.md new file mode 100644 index 0000000..e45cefe --- /dev/null +++ b/node_modules/sliced/History.md @@ -0,0 +1,41 @@ + +1.0.1 / 2015-07-14 +================== + + * fixed; missing file introduced in 4f5cea1 + +1.0.0 / 2015-07-12 +================== + + * Remove unnecessary files from npm package - #6 via joaquimserafim + * updated readme stats + +0.0.5 / 2013-02-05 +================== + + * optimization: remove use of arguments [jkroso](https://github.com/jkroso) + * add scripts to component.json [jkroso](https://github.com/jkroso) + * tests; remove time for travis + +0.0.4 / 2013-01-07 +================== + + * added component.json #1 [jkroso](https://github.com/jkroso) + * reversed array loop #1 [jkroso](https://github.com/jkroso) + * remove fn params + +0.0.3 / 2012-09-29 +================== + + * faster with negative start args + +0.0.2 / 2012-09-29 +================== + + * support full [].slice semantics + +0.0.1 / 2012-09-29 +=================== + + * initial release + diff --git a/node_modules/sliced/LICENSE b/node_modules/sliced/LICENSE new file mode 100644 index 0000000..38c529d --- /dev/null +++ b/node_modules/sliced/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2012 [Aaron Heckmann](aaron.heckmann+github@gmail.com) + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/sliced/README.md b/node_modules/sliced/README.md new file mode 100644 index 0000000..b6ff85e --- /dev/null +++ b/node_modules/sliced/README.md @@ -0,0 +1,62 @@ +#sliced +========== + +A faster alternative to `[].slice.call(arguments)`. + +[![Build Status](https://secure.travis-ci.org/aheckmann/sliced.png)](http://travis-ci.org/aheckmann/sliced) + +Example output from [benchmark.js](https://github.com/bestiejs/benchmark.js) + + Array.prototype.slice.call x 1,401,820 ops/sec ±2.16% (90 runs sampled) + [].slice.call x 1,313,116 ops/sec ±2.04% (96 runs sampled) + cached slice.call x 10,297,910 ops/sec ±1.81% (96 runs sampled) + sliced x 19,906,019 ops/sec ±1.23% (89 runs sampled) + fastest is sliced + + Array.prototype.slice.call(arguments, 1) x 1,373,238 ops/sec ±1.84% (95 runs sampled) + [].slice.call(arguments, 1) x 1,395,336 ops/sec ±1.36% (93 runs sampled) + cached slice.call(arguments, 1) x 9,926,018 ops/sec ±1.67% (92 runs sampled) + sliced(arguments, 1) x 20,747,990 ops/sec ±1.16% (93 runs sampled) + fastest is sliced(arguments, 1) + + Array.prototype.slice.call(arguments, -1) x 1,319,908 ops/sec ±2.12% (91 runs sampled) + [].slice.call(arguments, -1) x 1,336,170 ops/sec ±1.33% (97 runs sampled) + cached slice.call(arguments, -1) x 10,078,718 ops/sec ±1.21% (98 runs sampled) + sliced(arguments, -1) x 20,471,474 ops/sec ±1.81% (92 runs sampled) + fastest is sliced(arguments, -1) + + Array.prototype.slice.call(arguments, -2, -10) x 1,369,246 ops/sec ±1.68% (97 runs sampled) + [].slice.call(arguments, -2, -10) x 1,387,935 ops/sec ±1.70% (95 runs sampled) + cached slice.call(arguments, -2, -10) x 9,593,428 ops/sec ±1.23% (97 runs sampled) + sliced(arguments, -2, -10) x 23,178,931 ops/sec ±1.70% (92 runs sampled) + fastest is sliced(arguments, -2, -10) + + Array.prototype.slice.call(arguments, -2, -1) x 1,441,300 ops/sec ±1.26% (98 runs sampled) + [].slice.call(arguments, -2, -1) x 1,410,326 ops/sec ±1.96% (93 runs sampled) + cached slice.call(arguments, -2, -1) x 9,854,419 ops/sec ±1.02% (97 runs sampled) + sliced(arguments, -2, -1) x 22,550,801 ops/sec ±1.86% (91 runs sampled) + fastest is sliced(arguments, -2, -1) + +_Benchmark [source](https://github.com/aheckmann/sliced/blob/master/bench.js)._ + +##Usage + +`sliced` accepts the same arguments as `Array#slice` so you can easily swap it out. + +```js +function zing () { + var slow = [].slice.call(arguments, 1, 8); + var args = slice(arguments, 1, 8); + + var slow = Array.prototype.slice.call(arguments); + var args = slice(arguments); + // etc +} +``` + +## install + + npm install sliced + + +[LICENSE](https://github.com/aheckmann/sliced/blob/master/LICENSE) diff --git a/node_modules/sliced/index.js b/node_modules/sliced/index.js new file mode 100644 index 0000000..d88c85b --- /dev/null +++ b/node_modules/sliced/index.js @@ -0,0 +1,33 @@ + +/** + * An Array.prototype.slice.call(arguments) alternative + * + * @param {Object} args something with a length + * @param {Number} slice + * @param {Number} sliceEnd + * @api public + */ + +module.exports = function (args, slice, sliceEnd) { + var ret = []; + var len = args.length; + + if (0 === len) return ret; + + var start = slice < 0 + ? Math.max(0, slice + len) + : slice || 0; + + if (sliceEnd !== undefined) { + len = sliceEnd < 0 + ? sliceEnd + len + : sliceEnd + } + + while (len-- > start) { + ret[len - start] = args[len]; + } + + return ret; +} + diff --git a/node_modules/sliced/package.json b/node_modules/sliced/package.json new file mode 100644 index 0000000..5b949cc --- /dev/null +++ b/node_modules/sliced/package.json @@ -0,0 +1,62 @@ +{ + "_from": "sliced@1.0.1", + "_id": "sliced@1.0.1", + "_inBundle": false, + "_integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=", + "_location": "/sliced", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "sliced@1.0.1", + "name": "sliced", + "escapedName": "sliced", + "rawSpec": "1.0.1", + "saveSpec": null, + "fetchSpec": "1.0.1" + }, + "_requiredBy": [ + "/mongoose" + ], + "_resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", + "_shasum": "0b3a662b5d04c3177b1926bea82b03f837a2ef41", + "_spec": "sliced@1.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/mongoose", + "author": { + "name": "Aaron Heckmann", + "email": "aaron.heckmann+github@gmail.com" + }, + "bugs": { + "url": "https://github.com/aheckmann/sliced/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "A faster Node.js alternative to Array.prototype.slice.call(arguments)", + "devDependencies": { + "benchmark": "~1.0.0", + "mocha": "1.5.0" + }, + "files": [ + "LICENSE", + "README.md", + "index.js" + ], + "homepage": "https://github.com/aheckmann/sliced#readme", + "keywords": [ + "arguments", + "slice", + "array" + ], + "license": "MIT", + "main": "index.js", + "name": "sliced", + "repository": { + "type": "git", + "url": "git://github.com/aheckmann/sliced.git" + }, + "scripts": { + "test": "make test" + }, + "version": "1.0.1" +} diff --git a/node_modules/snapdragon-node/LICENSE b/node_modules/snapdragon-node/LICENSE new file mode 100644 index 0000000..9a1c856 --- /dev/null +++ b/node_modules/snapdragon-node/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017, 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/node_modules/snapdragon-node/README.md b/node_modules/snapdragon-node/README.md new file mode 100644 index 0000000..2300a3c --- /dev/null +++ b/node_modules/snapdragon-node/README.md @@ -0,0 +1,453 @@ +# snapdragon-node [![NPM version](https://img.shields.io/npm/v/snapdragon-node.svg?style=flat)](https://www.npmjs.com/package/snapdragon-node) [![NPM monthly downloads](https://img.shields.io/npm/dm/snapdragon-node.svg?style=flat)](https://npmjs.org/package/snapdragon-node) [![NPM total downloads](https://img.shields.io/npm/dt/snapdragon-node.svg?style=flat)](https://npmjs.org/package/snapdragon-node) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/snapdragon-node.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/snapdragon-node) + +> Snapdragon utility for creating a new AST node in custom code, such as plugins. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save snapdragon-node +``` + +## Usage + +With [snapdragon](https://github.com/jonschlinkert/snapdragon) v0.9.0 and higher you can use `this.node()` to create a new `Node`, whenever it makes sense. + +```js +var Node = require('snapdragon-node'); +var Snapdragon = require('snapdragon'); +var snapdragon = new Snapdragon(); + +// example usage inside a parser visitor function +snapdragon.parser.set('foo', function() { + // get the current "start" position + var pos = this.position(); + + // returns the match if regex matches the substring + // at the current position on `parser.input` + var match = this.match(/foo/); + if (match) { + // call "pos" on the node, to set the start and end + // positions, and return the node to push it onto the AST + // (snapdragon will push the node onto the correct + // nodes array, based on the stack) + return pos(new Node({type: 'bar', val: match[0]})); + } +}); +``` + +## API + +### [Node](index.js#L22) + +Create a new AST `Node` with the given `val` and `type`. + +**Params** + +* `val` **{String|Object}**: Pass a matched substring, or an object to merge onto the node. +* `type` **{String}**: The node type to use when `val` is a string. +* `returns` **{Object}**: node instance + +**Example** + +```js +var node = new Node('*', 'Star'); +var node = new Node({type: 'star', val: '*'}); +``` + +### [.isNode](index.js#L61) + +Returns true if the given value is a node. + +**Params** + +* `node` **{Object}** +* `returns` **{Boolean}** + +**Example** + +```js +var Node = require('snapdragon-node'); +var node = new Node({type: 'foo'}); +console.log(Node.isNode(node)); //=> true +console.log(Node.isNode({})); //=> false +``` + +### [.define](index.js#L80) + +Define a non-enumberable property on the node instance. Useful for adding properties that shouldn't be extended or visible during debugging. + +**Params** + +* `name` **{String}** +* `val` **{any}** +* `returns` **{Object}**: returns the node instance + +**Example** + +```js +var node = new Node(); +node.define('foo', 'something non-enumerable'); +``` + +### [.isEmpty](index.js#L100) + +Returns true if `node.val` is an empty string, or `node.nodes` does not contain any non-empty text nodes. + +**Params** + +* `fn` **{Function}**: (optional) Filter function that is called on `node` and/or child nodes. `isEmpty` will return false immediately when the filter function returns false on any nodes. +* `returns` **{Boolean}** + +**Example** + +```js +var node = new Node({type: 'text'}); +node.isEmpty(); //=> true +node.val = 'foo'; +node.isEmpty(); //=> false +``` + +### [.push](index.js#L118) + +Given node `foo` and node `bar`, push node `bar` onto `foo.nodes`, and set `foo` as `bar.parent`. + +**Params** + +* `node` **{Object}** +* `returns` **{Number}**: Returns the length of `node.nodes` + +**Example** + +```js +var foo = new Node({type: 'foo'}); +var bar = new Node({type: 'bar'}); +foo.push(bar); +``` + +### [.unshift](index.js#L140) + +Given node `foo` and node `bar`, unshift node `bar` onto `foo.nodes`, and set `foo` as `bar.parent`. + +**Params** + +* `node` **{Object}** +* `returns` **{Number}**: Returns the length of `node.nodes` + +**Example** + +```js +var foo = new Node({type: 'foo'}); +var bar = new Node({type: 'bar'}); +foo.unshift(bar); +``` + +### [.pop](index.js#L167) + +Pop a node from `node.nodes`. + +* `returns` **{Number}**: Returns the popped `node` + +**Example** + +```js +var node = new Node({type: 'foo'}); +node.push(new Node({type: 'a'})); +node.push(new Node({type: 'b'})); +node.push(new Node({type: 'c'})); +node.push(new Node({type: 'd'})); +console.log(node.nodes.length); +//=> 4 +node.pop(); +console.log(node.nodes.length); +//=> 3 +``` + +### [.shift](index.js#L190) + +Shift a node from `node.nodes`. + +* `returns` **{Object}**: Returns the shifted `node` + +**Example** + +```js +var node = new Node({type: 'foo'}); +node.push(new Node({type: 'a'})); +node.push(new Node({type: 'b'})); +node.push(new Node({type: 'c'})); +node.push(new Node({type: 'd'})); +console.log(node.nodes.length); +//=> 4 +node.shift(); +console.log(node.nodes.length); +//=> 3 +``` + +### [.remove](index.js#L205) + +Remove `node` from `node.nodes`. + +**Params** + +* `node` **{Object}** +* `returns` **{Object}**: Returns the removed node. + +**Example** + +```js +node.remove(childNode); +``` + +### [.find](index.js#L231) + +Get the first child node from `node.nodes` that matches the given `type`. If `type` is a number, the child node at that index is returned. + +**Params** + +* `type` **{String}** +* `returns` **{Object}**: Returns a child node or undefined. + +**Example** + +```js +var child = node.find(1); //<= index of the node to get +var child = node.find('foo'); //<= node.type of a child node +var child = node.find(/^(foo|bar)$/); //<= regex to match node.type +var child = node.find(['foo', 'bar']); //<= array of node.type(s) +``` + +### [.isType](index.js#L249) + +Return true if the node is the given `type`. + +**Params** + +* `type` **{String}** +* `returns` **{Boolean}** + +**Example** + +```js +var node = new Node({type: 'bar'}); +cosole.log(node.isType('foo')); // false +cosole.log(node.isType(/^(foo|bar)$/)); // true +cosole.log(node.isType(['foo', 'bar'])); // true +``` + +### [.hasType](index.js#L270) + +Return true if the `node.nodes` has the given `type`. + +**Params** + +* `type` **{String}** +* `returns` **{Boolean}** + +**Example** + +```js +var foo = new Node({type: 'foo'}); +var bar = new Node({type: 'bar'}); +foo.push(bar); + +cosole.log(foo.hasType('qux')); // false +cosole.log(foo.hasType(/^(qux|bar)$/)); // true +cosole.log(foo.hasType(['qux', 'bar'])); // true +``` + +* `returns` **{Array}** + +**Example** + +```js +var foo = new Node({type: 'foo'}); +var bar = new Node({type: 'bar'}); +var baz = new Node({type: 'baz'}); +foo.push(bar); +foo.push(baz); + +console.log(bar.siblings.length) // 2 +console.log(baz.siblings.length) // 2 +``` + +* `returns` **{Number}** + +**Example** + +```js +var foo = new Node({type: 'foo'}); +var bar = new Node({type: 'bar'}); +var baz = new Node({type: 'baz'}); +var qux = new Node({type: 'qux'}); +foo.push(bar); +foo.push(baz); +foo.unshift(qux); + +console.log(bar.index) // 1 +console.log(baz.index) // 2 +console.log(qux.index) // 0 +``` + +* `returns` **{Object}** + +**Example** + +```js +var foo = new Node({type: 'foo'}); +var bar = new Node({type: 'bar'}); +var baz = new Node({type: 'baz'}); +foo.push(bar); +foo.push(baz); + +console.log(baz.prev.type) // 'bar' +``` + +* `returns` **{Object}** + +**Example** + +```js +var foo = new Node({type: 'foo'}); +var bar = new Node({type: 'bar'}); +var baz = new Node({type: 'baz'}); +foo.push(bar); +foo.push(baz); + +console.log(bar.siblings.length) // 2 +console.log(baz.siblings.length) // 2 +``` + +* `returns` **{Object}**: The first node, or undefiend + +**Example** + +```js +var foo = new Node({type: 'foo'}); +var bar = new Node({type: 'bar'}); +var baz = new Node({type: 'baz'}); +var qux = new Node({type: 'qux'}); +foo.push(bar); +foo.push(baz); +foo.push(qux); + +console.log(foo.first.type) // 'bar' +``` + +* `returns` **{Object}**: The last node, or undefiend + +**Example** + +```js +var foo = new Node({type: 'foo'}); +var bar = new Node({type: 'bar'}); +var baz = new Node({type: 'baz'}); +var qux = new Node({type: 'qux'}); +foo.push(bar); +foo.push(baz); +foo.push(qux); + +console.log(foo.last.type) // 'qux' +``` + +* `returns` **{Object}**: The last node, or undefiend + +**Example** + +```js +var foo = new Node({type: 'foo'}); +var bar = new Node({type: 'bar'}); +var baz = new Node({type: 'baz'}); +var qux = new Node({type: 'qux'}); +foo.push(bar); +foo.push(baz); +foo.push(qux); + +console.log(foo.last.type) // 'qux' +``` + +## Release history + +Changelog entries are classified using the following labels from [keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog): + +* `added`: for new features +* `changed`: for changes in existing functionality +* `deprecated`: for once-stable features removed in upcoming releases +* `removed`: for deprecated features removed in this release +* `fixed`: for any bug fixes + +Custom labels used in this changelog: + +* `dependencies`: bumps dependencies +* `housekeeping`: code re-organization, minor edits, or other changes that don't fit in one of the other categories. + +### [2.0.0] - 2017-05-01 + +**Changed** + +* `.unshiftNode` was renamed to [.unshift](#unshift) +* `.pushNode` was renamed to [.push](#push) +* `.getNode` was renamed to [.find](#find) + +**Added** + +* [.isNode](#isNode) +* [.isEmpty](#isEmpty) +* [.pop](#pop) +* [.shift](#shift) +* [.remove](#remove) + +### [0.1.0] + +First release. + +## About + +### Related projects + +* [breakdance](https://www.npmjs.com/package/breakdance): Breakdance is a node.js library for converting HTML to markdown. Highly pluggable, flexible and easy… [more](http://breakdance.io) | [homepage](http://breakdance.io "Breakdance is a node.js library for converting HTML to markdown. Highly pluggable, flexible and easy to use. It's time for your markup to get down.") +* [snapdragon-capture](https://www.npmjs.com/package/snapdragon-capture): Snapdragon plugin that adds a capture method to the parser instance. | [homepage](https://github.com/jonschlinkert/snapdragon-capture "Snapdragon plugin that adds a capture method to the parser instance.") +* [snapdragon-cheerio](https://www.npmjs.com/package/snapdragon-cheerio): Snapdragon plugin for converting a cheerio AST to a snapdragon AST. | [homepage](https://github.com/jonschlinkert/snapdragon-cheerio "Snapdragon plugin for converting a cheerio AST to a snapdragon AST.") +* [snapdragon-util](https://www.npmjs.com/package/snapdragon-util): Utilities for the snapdragon parser/compiler. | [homepage](https://github.com/jonschlinkert/snapdragon-util "Utilities for the snapdragon parser/compiler.") +* [snapdragon](https://www.npmjs.com/package/snapdragon): Easy-to-use plugin system for creating powerful, fast and versatile parsers and compilers, with built-in source-map… [more](https://github.com/jonschlinkert/snapdragon) | [homepage](https://github.com/jonschlinkert/snapdragon "Easy-to-use plugin system for creating powerful, fast and versatile parsers and compilers, with built-in source-map support.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 25, 2017._ \ No newline at end of file diff --git a/node_modules/snapdragon-node/index.js b/node_modules/snapdragon-node/index.js new file mode 100644 index 0000000..0f66ff5 --- /dev/null +++ b/node_modules/snapdragon-node/index.js @@ -0,0 +1,492 @@ +'use strict'; + +var isObject = require('isobject'); +var define = require('define-property'); +var utils = require('snapdragon-util'); +var ownNames; + +/** + * Create a new AST `Node` with the given `val` and `type`. + * + * ```js + * var node = new Node('*', 'Star'); + * var node = new Node({type: 'star', val: '*'}); + * ``` + * @name Node + * @param {String|Object} `val` Pass a matched substring, or an object to merge onto the node. + * @param {String} `type` The node type to use when `val` is a string. + * @return {Object} node instance + * @api public + */ + +function Node(val, type, parent) { + if (typeof type !== 'string') { + parent = type; + type = null; + } + + define(this, 'parent', parent); + define(this, 'isNode', true); + define(this, 'expect', null); + + if (typeof type !== 'string' && isObject(val)) { + lazyKeys(); + var keys = Object.keys(val); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (ownNames.indexOf(key) === -1) { + this[key] = val[key]; + } + } + } else { + this.type = type; + this.val = val; + } +} + +/** + * Returns true if the given value is a node. + * + * ```js + * var Node = require('snapdragon-node'); + * var node = new Node({type: 'foo'}); + * console.log(Node.isNode(node)); //=> true + * console.log(Node.isNode({})); //=> false + * ``` + * @param {Object} `node` + * @returns {Boolean} + * @api public + */ + +Node.isNode = function(node) { + return utils.isNode(node); +}; + +/** + * Define a non-enumberable property on the node instance. + * Useful for adding properties that shouldn't be extended + * or visible during debugging. + * + * ```js + * var node = new Node(); + * node.define('foo', 'something non-enumerable'); + * ``` + * @param {String} `name` + * @param {any} `val` + * @return {Object} returns the node instance + * @api public + */ + +Node.prototype.define = function(name, val) { + define(this, name, val); + return this; +}; + +/** + * Returns true if `node.val` is an empty string, or `node.nodes` does + * not contain any non-empty text nodes. + * + * ```js + * var node = new Node({type: 'text'}); + * node.isEmpty(); //=> true + * node.val = 'foo'; + * node.isEmpty(); //=> false + * ``` + * @param {Function} `fn` (optional) Filter function that is called on `node` and/or child nodes. `isEmpty` will return false immediately when the filter function returns false on any nodes. + * @return {Boolean} + * @api public + */ + +Node.prototype.isEmpty = function(fn) { + return utils.isEmpty(this, fn); +}; + +/** + * Given node `foo` and node `bar`, push node `bar` onto `foo.nodes`, and + * set `foo` as `bar.parent`. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * foo.push(bar); + * ``` + * @param {Object} `node` + * @return {Number} Returns the length of `node.nodes` + * @api public + */ + +Node.prototype.push = function(node) { + assert(Node.isNode(node), 'expected node to be an instance of Node'); + define(node, 'parent', this); + + this.nodes = this.nodes || []; + return this.nodes.push(node); +}; + +/** + * Given node `foo` and node `bar`, unshift node `bar` onto `foo.nodes`, and + * set `foo` as `bar.parent`. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * foo.unshift(bar); + * ``` + * @param {Object} `node` + * @return {Number} Returns the length of `node.nodes` + * @api public + */ + +Node.prototype.unshift = function(node) { + assert(Node.isNode(node), 'expected node to be an instance of Node'); + define(node, 'parent', this); + + this.nodes = this.nodes || []; + return this.nodes.unshift(node); +}; + +/** + * Pop a node from `node.nodes`. + * + * ```js + * var node = new Node({type: 'foo'}); + * node.push(new Node({type: 'a'})); + * node.push(new Node({type: 'b'})); + * node.push(new Node({type: 'c'})); + * node.push(new Node({type: 'd'})); + * console.log(node.nodes.length); + * //=> 4 + * node.pop(); + * console.log(node.nodes.length); + * //=> 3 + * ``` + * @return {Number} Returns the popped `node` + * @api public + */ + +Node.prototype.pop = function() { + return this.nodes && this.nodes.pop(); +}; + +/** + * Shift a node from `node.nodes`. + * + * ```js + * var node = new Node({type: 'foo'}); + * node.push(new Node({type: 'a'})); + * node.push(new Node({type: 'b'})); + * node.push(new Node({type: 'c'})); + * node.push(new Node({type: 'd'})); + * console.log(node.nodes.length); + * //=> 4 + * node.shift(); + * console.log(node.nodes.length); + * //=> 3 + * ``` + * @return {Object} Returns the shifted `node` + * @api public + */ + +Node.prototype.shift = function() { + return this.nodes && this.nodes.shift(); +}; + +/** + * Remove `node` from `node.nodes`. + * + * ```js + * node.remove(childNode); + * ``` + * @param {Object} `node` + * @return {Object} Returns the removed node. + * @api public + */ + +Node.prototype.remove = function(node) { + assert(Node.isNode(node), 'expected node to be an instance of Node'); + this.nodes = this.nodes || []; + var idx = node.index; + if (idx !== -1) { + node.index = -1; + return this.nodes.splice(idx, 1); + } + return null; +}; + +/** + * Get the first child node from `node.nodes` that matches the given `type`. + * If `type` is a number, the child node at that index is returned. + * + * ```js + * var child = node.find(1); //<= index of the node to get + * var child = node.find('foo'); //<= node.type of a child node + * var child = node.find(/^(foo|bar)$/); //<= regex to match node.type + * var child = node.find(['foo', 'bar']); //<= array of node.type(s) + * ``` + * @param {String} `type` + * @return {Object} Returns a child node or undefined. + * @api public + */ + +Node.prototype.find = function(type) { + return utils.findNode(this.nodes, type); +}; + +/** + * Return true if the node is the given `type`. + * + * ```js + * var node = new Node({type: 'bar'}); + * cosole.log(node.isType('foo')); // false + * cosole.log(node.isType(/^(foo|bar)$/)); // true + * cosole.log(node.isType(['foo', 'bar'])); // true + * ``` + * @param {String} `type` + * @return {Boolean} + * @api public + */ + +Node.prototype.isType = function(type) { + return utils.isType(this, type); +}; + +/** + * Return true if the `node.nodes` has the given `type`. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * foo.push(bar); + * + * cosole.log(foo.hasType('qux')); // false + * cosole.log(foo.hasType(/^(qux|bar)$/)); // true + * cosole.log(foo.hasType(['qux', 'bar'])); // true + * ``` + * @param {String} `type` + * @return {Boolean} + * @api public + */ + +Node.prototype.hasType = function(type) { + return utils.hasType(this, type); +}; + +/** + * Get the siblings array, or `null` if it doesn't exist. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * var baz = new Node({type: 'baz'}); + * foo.push(bar); + * foo.push(baz); + * + * console.log(bar.siblings.length) // 2 + * console.log(baz.siblings.length) // 2 + * ``` + * @return {Array} + * @api public + */ + +Object.defineProperty(Node.prototype, 'siblings', { + set: function() { + throw new Error('node.siblings is a getter and cannot be defined'); + }, + get: function() { + return this.parent ? this.parent.nodes : null; + } +}); + +/** + * Get the node's current index from `node.parent.nodes`. + * This should always be correct, even when the parent adds nodes. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * var baz = new Node({type: 'baz'}); + * var qux = new Node({type: 'qux'}); + * foo.push(bar); + * foo.push(baz); + * foo.unshift(qux); + * + * console.log(bar.index) // 1 + * console.log(baz.index) // 2 + * console.log(qux.index) // 0 + * ``` + * @return {Number} + * @api public + */ + +Object.defineProperty(Node.prototype, 'index', { + set: function(index) { + define(this, 'idx', index); + }, + get: function() { + if (!Array.isArray(this.siblings)) { + return -1; + } + var tok = this.idx !== -1 ? this.siblings[this.idx] : null; + if (tok !== this) { + this.idx = this.siblings.indexOf(this); + } + return this.idx; + } +}); + +/** + * Get the previous node from the siblings array or `null`. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * var baz = new Node({type: 'baz'}); + * foo.push(bar); + * foo.push(baz); + * + * console.log(baz.prev.type) // 'bar' + * ``` + * @return {Object} + * @api public + */ + +Object.defineProperty(Node.prototype, 'prev', { + set: function() { + throw new Error('node.prev is a getter and cannot be defined'); + }, + get: function() { + if (Array.isArray(this.siblings)) { + return this.siblings[this.index - 1] || this.parent.prev; + } + return null; + } +}); + +/** + * Get the siblings array, or `null` if it doesn't exist. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * var baz = new Node({type: 'baz'}); + * foo.push(bar); + * foo.push(baz); + * + * console.log(bar.siblings.length) // 2 + * console.log(baz.siblings.length) // 2 + * ``` + * @return {Object} + * @api public + */ + +Object.defineProperty(Node.prototype, 'next', { + set: function() { + throw new Error('node.next is a getter and cannot be defined'); + }, + get: function() { + if (Array.isArray(this.siblings)) { + return this.siblings[this.index + 1] || this.parent.next; + } + return null; + } +}); + +/** + * Get the first node from `node.nodes`. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * var baz = new Node({type: 'baz'}); + * var qux = new Node({type: 'qux'}); + * foo.push(bar); + * foo.push(baz); + * foo.push(qux); + * + * console.log(foo.first.type) // 'bar' + * ``` + * @return {Object} The first node, or undefiend + * @api public + */ + +Object.defineProperty(Node.prototype, 'first', { + get: function() { + return this.nodes ? this.nodes[0] : null; + } +}); + +/** + * Get the last node from `node.nodes`. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * var baz = new Node({type: 'baz'}); + * var qux = new Node({type: 'qux'}); + * foo.push(bar); + * foo.push(baz); + * foo.push(qux); + * + * console.log(foo.last.type) // 'qux' + * ``` + * @return {Object} The last node, or undefiend + * @api public + */ + +Object.defineProperty(Node.prototype, 'last', { + get: function() { + return this.nodes ? utils.last(this.nodes) : null; + } +}); + +/** + * Get the last node from `node.nodes`. + * + * ```js + * var foo = new Node({type: 'foo'}); + * var bar = new Node({type: 'bar'}); + * var baz = new Node({type: 'baz'}); + * var qux = new Node({type: 'qux'}); + * foo.push(bar); + * foo.push(baz); + * foo.push(qux); + * + * console.log(foo.last.type) // 'qux' + * ``` + * @return {Object} The last node, or undefiend + * @api public + */ + +Object.defineProperty(Node.prototype, 'scope', { + get: function() { + if (this.isScope !== true) { + return this.parent ? this.parent.scope : this; + } + return this; + } +}); + +/** + * Get own property names from Node prototype, but only the + * first time `Node` is instantiated + */ + +function lazyKeys() { + if (!ownNames) { + ownNames = Object.getOwnPropertyNames(Node.prototype); + } +} + +/** + * Simplified assertion. Throws an error is `val` is falsey. + */ + +function assert(val, message) { + if (!val) throw new Error(message); +} + +/** + * Expose `Node` + */ + +exports = module.exports = Node; diff --git a/node_modules/snapdragon-node/node_modules/define-property/LICENSE b/node_modules/snapdragon-node/node_modules/define-property/LICENSE new file mode 100644 index 0000000..ec85897 --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/define-property/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 2017, 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/node_modules/snapdragon-node/node_modules/define-property/README.md b/node_modules/snapdragon-node/node_modules/define-property/README.md new file mode 100644 index 0000000..2f1af05 --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/define-property/README.md @@ -0,0 +1,95 @@ +# define-property [![NPM version](https://img.shields.io/npm/v/define-property.svg?style=flat)](https://www.npmjs.com/package/define-property) [![NPM monthly downloads](https://img.shields.io/npm/dm/define-property.svg?style=flat)](https://npmjs.org/package/define-property) [![NPM total downloads](https://img.shields.io/npm/dt/define-property.svg?style=flat)](https://npmjs.org/package/define-property) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/define-property.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/define-property) + +> Define a non-enumerable property on an object. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save define-property +``` + +Install with [yarn](https://yarnpkg.com): + +```sh +$ yarn add define-property +``` + +## Usage + +**Params** + +* `obj`: The object on which to define the property. +* `prop`: The name of the property to be defined or modified. +* `descriptor`: The descriptor for the property being defined or modified. + +```js +var define = require('define-property'); +var obj = {}; +define(obj, 'foo', function(val) { + return val.toUpperCase(); +}); + +console.log(obj); +//=> {} + +console.log(obj.foo('bar')); +//=> 'BAR' +``` + +**get/set** + +```js +define(obj, 'foo', { + get: function() {}, + set: function() {} +}); +``` + +## About + +### Related projects + +* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target… [more](https://github.com/jonschlinkert/assign-deep) | [homepage](https://github.com/jonschlinkert/assign-deep "Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target (first) object.") +* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.") +* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep "Recursively merge values in a javascript object.") +* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 20, 2017._ \ No newline at end of file diff --git a/node_modules/snapdragon-node/node_modules/define-property/index.js b/node_modules/snapdragon-node/node_modules/define-property/index.js new file mode 100644 index 0000000..27c19eb --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/define-property/index.js @@ -0,0 +1,31 @@ +/*! + * define-property + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var isDescriptor = require('is-descriptor'); + +module.exports = function defineProperty(obj, prop, val) { + if (typeof obj !== 'object' && typeof obj !== 'function') { + throw new TypeError('expected an object or function.'); + } + + if (typeof prop !== 'string') { + throw new TypeError('expected `prop` to be a string.'); + } + + if (isDescriptor(val) && ('set' in val || 'get' in val)) { + return Object.defineProperty(obj, prop, val); + } + + return Object.defineProperty(obj, prop, { + configurable: true, + enumerable: false, + writable: true, + value: val + }); +}; diff --git a/node_modules/snapdragon-node/node_modules/define-property/package.json b/node_modules/snapdragon-node/node_modules/define-property/package.json new file mode 100644 index 0000000..5b4e879 --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/define-property/package.json @@ -0,0 +1,93 @@ +{ + "_from": "define-property@^1.0.0", + "_id": "define-property@1.0.0", + "_inBundle": false, + "_integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "_location": "/snapdragon-node/define-property", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "define-property@^1.0.0", + "name": "define-property", + "escapedName": "define-property", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/snapdragon-node" + ], + "_resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "_shasum": "769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6", + "_spec": "define-property@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/snapdragon-node", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/define-property/issues" + }, + "bundleDependencies": false, + "dependencies": { + "is-descriptor": "^1.0.0" + }, + "deprecated": false, + "description": "Define a non-enumerable property on an object.", + "devDependencies": { + "gulp-format-md": "^0.1.12", + "mocha": "^3.2.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/define-property", + "keywords": [ + "define", + "define-property", + "enumerable", + "key", + "non", + "non-enumerable", + "object", + "prop", + "property", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "define-property", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/define-property.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "extend-shallow", + "merge-deep", + "assign-deep", + "mixin-deep" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + }, + "version": "1.0.0" +} diff --git a/node_modules/snapdragon-node/package.json b/node_modules/snapdragon-node/package.json new file mode 100644 index 0000000..8886e81 --- /dev/null +++ b/node_modules/snapdragon-node/package.json @@ -0,0 +1,109 @@ +{ + "_from": "snapdragon-node@^2.0.1", + "_id": "snapdragon-node@2.1.1", + "_inBundle": false, + "_integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "_location": "/snapdragon-node", + "_phantomChildren": { + "is-descriptor": "1.0.2" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "snapdragon-node@^2.0.1", + "name": "snapdragon-node", + "escapedName": "snapdragon-node", + "rawSpec": "^2.0.1", + "saveSpec": null, + "fetchSpec": "^2.0.1" + }, + "_requiredBy": [ + "/braces" + ], + "_resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "_shasum": "6c175f86ff14bdb0724563e8f3c1b021a286853b", + "_spec": "snapdragon-node@^2.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/braces", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/snapdragon-node/issues" + }, + "bundleDependencies": false, + "dependencies": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "deprecated": false, + "description": "Snapdragon utility for creating a new AST node in custom code, such as plugins.", + "devDependencies": { + "gulp": "^3.9.1", + "gulp-eslint": "^4.0.0", + "gulp-format-md": "^0.1.12", + "gulp-istanbul": "^1.1.2", + "gulp-mocha": "^3.0.1", + "mocha": "^3.4.2", + "snapdragon": "^0.11.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/snapdragon-node", + "keywords": [ + "ast", + "compile", + "compiler", + "convert", + "node", + "parse", + "parser", + "plugin", + "render", + "snapdragon", + "snapdragonplugin", + "token", + "transform" + ], + "license": "MIT", + "main": "index.js", + "name": "snapdragon-node", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/snapdragon-node.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "breakdance", + "snapdragon", + "snapdragon-capture", + "snapdragon-cheerio", + "snapdragon-util" + ] + }, + "reflinks": [ + "verb", + "verb-generate-readme" + ], + "lint": { + "reflinks": true + } + }, + "version": "2.1.1" +} diff --git a/node_modules/snapdragon-util/LICENSE b/node_modules/snapdragon-util/LICENSE new file mode 100644 index 0000000..9a1c856 --- /dev/null +++ b/node_modules/snapdragon-util/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017, 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/node_modules/snapdragon-util/README.md b/node_modules/snapdragon-util/README.md new file mode 100644 index 0000000..b654e02 --- /dev/null +++ b/node_modules/snapdragon-util/README.md @@ -0,0 +1,807 @@ +# snapdragon-util [![NPM version](https://img.shields.io/npm/v/snapdragon-util.svg?style=flat)](https://www.npmjs.com/package/snapdragon-util) [![NPM monthly downloads](https://img.shields.io/npm/dm/snapdragon-util.svg?style=flat)](https://npmjs.org/package/snapdragon-util) [![NPM total downloads](https://img.shields.io/npm/dt/snapdragon-util.svg?style=flat)](https://npmjs.org/package/snapdragon-util) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/snapdragon-util.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/snapdragon-util) + +> Utilities for the snapdragon parser/compiler. + +
    +Table of Contents + +- [Install](#install) +- [Usage](#usage) +- [API](#api) +- [Release history](#release-history) + * [[3.0.0] - 2017-05-01](#300---2017-05-01) + * [[0.1.0]](#010) +- [About](#about) + +
    + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save snapdragon-util +``` + +Install with [yarn](https://yarnpkg.com): + +```sh +$ yarn add snapdragon-util +``` + +## Usage + +```js +var util = require('snapdragon-util'); +``` + +## API + +### [.isNode](index.js#L21) + +Returns true if the given value is a node. + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{Boolean}** + +**Example** + +```js +var Node = require('snapdragon-node'); +var node = new Node({type: 'foo'}); +console.log(utils.isNode(node)); //=> true +console.log(utils.isNode({})); //=> false +``` + +### [.noop](index.js#L37) + +Emit an empty string for the given `node`. + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{undefined}** + +**Example** + +```js +// do nothing for beginning-of-string +snapdragon.compiler.set('bos', utils.noop); +``` + +### [.identity](index.js#L53) + +Appdend `node.val` to `compiler.output`, exactly as it was created by the parser. + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{undefined}** + +**Example** + +```js +snapdragon.compiler.set('text', utils.identity); +``` + +### [.append](index.js#L76) + +Previously named `.emit`, this method appends the given `val` to `compiler.output` for the given node. Useful when you know what value should be appended advance, regardless of the actual value of `node.val`. + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{Function}**: Returns a compiler middleware function. + +**Example** + +```js +snapdragon.compiler + .set('i', function(node) { + this.mapVisit(node); + }) + .set('i.open', utils.append('')) + .set('i.close', utils.append('')) +``` + +### [.toNoop](index.js#L99) + +Used in compiler middleware, this onverts an AST node into an empty `text` node and deletes `node.nodes` if it exists. The advantage of this method is that, as opposed to completely removing the node, indices will not need to be re-calculated in sibling nodes, and nothing is appended to the output. + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `nodes` **{Array}**: Optionally pass a new `nodes` value, to replace the existing `node.nodes` array. + +**Example** + +```js +utils.toNoop(node); +// convert `node.nodes` to the given value instead of deleting it +utils.toNoop(node, []); +``` + +### [.visit](index.js#L128) + +Visit `node` with the given `fn`. The built-in `.visit` method in snapdragon automatically calls registered compilers, this allows you to pass a visitor function. + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `fn` **{Function}** +* `returns` **{Object}**: returns the node after recursively visiting all child nodes. + +**Example** + +```js +snapdragon.compiler.set('i', function(node) { + utils.visit(node, function(childNode) { + // do stuff with "childNode" + return childNode; + }); +}); +``` + +### [.mapVisit](index.js#L155) + +Map [visit](#visit) the given `fn` over `node.nodes`. This is called by [visit](#visit), use this method if you do not want `fn` to be called on the first node. + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `options` **{Object}** +* `fn` **{Function}** +* `returns` **{Object}**: returns the node + +**Example** + +```js +snapdragon.compiler.set('i', function(node) { + utils.mapVisit(node, function(childNode) { + // do stuff with "childNode" + return childNode; + }); +}); +``` + +### [.addOpen](index.js#L194) + +Unshift an `*.open` node onto `node.nodes`. + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `Node` **{Function}**: (required) Node constructor function from [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node). +* `filter` **{Function}**: Optionaly specify a filter function to exclude the node. +* `returns` **{Object}**: Returns the created opening node. + +**Example** + +```js +var Node = require('snapdragon-node'); +snapdragon.parser.set('brace', function(node) { + var match = this.match(/^{/); + if (match) { + var parent = new Node({type: 'brace'}); + utils.addOpen(parent, Node); + console.log(parent.nodes[0]): + // { type: 'brace.open', val: '' }; + + // push the parent "brace" node onto the stack + this.push(parent); + + // return the parent node, so it's also added to the AST + return brace; + } +}); +``` + +### [.addClose](index.js#L244) + +Push a `*.close` node onto `node.nodes`. + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `Node` **{Function}**: (required) Node constructor function from [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node). +* `filter` **{Function}**: Optionaly specify a filter function to exclude the node. +* `returns` **{Object}**: Returns the created closing node. + +**Example** + +```js +var Node = require('snapdragon-node'); +snapdragon.parser.set('brace', function(node) { + var match = this.match(/^}/); + if (match) { + var parent = this.parent(); + if (parent.type !== 'brace') { + throw new Error('missing opening: ' + '}'); + } + + utils.addClose(parent, Node); + console.log(parent.nodes[parent.nodes.length - 1]): + // { type: 'brace.close', val: '' }; + + // no need to return a node, since the parent + // was already added to the AST + return; + } +}); +``` + +### [.wrapNodes](index.js#L274) + +Wraps the given `node` with `*.open` and `*.close` nodes. + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `Node` **{Function}**: (required) Node constructor function from [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node). +* `filter` **{Function}**: Optionaly specify a filter function to exclude the node. +* `returns` **{Object}**: Returns the node + +### [.pushNode](index.js#L299) + +Push the given `node` onto `parent.nodes`, and set `parent` as `node.parent. + +**Params** + +* `parent` **{Object}** +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{Object}**: Returns the child node + +**Example** + +```js +var parent = new Node({type: 'foo'}); +var node = new Node({type: 'bar'}); +utils.pushNode(parent, node); +console.log(parent.nodes[0].type) // 'bar' +console.log(node.parent.type) // 'foo' +``` + +### [.unshiftNode](index.js#L325) + +Unshift `node` onto `parent.nodes`, and set `parent` as `node.parent. + +**Params** + +* `parent` **{Object}** +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{undefined}** + +**Example** + +```js +var parent = new Node({type: 'foo'}); +var node = new Node({type: 'bar'}); +utils.unshiftNode(parent, node); +console.log(parent.nodes[0].type) // 'bar' +console.log(node.parent.type) // 'foo' +``` + +### [.popNode](index.js#L354) + +Pop the last `node` off of `parent.nodes`. The advantage of using this method is that it checks for `node.nodes` and works with any version of `snapdragon-node`. + +**Params** + +* `parent` **{Object}** +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{Number|Undefined}**: Returns the length of `node.nodes` or undefined. + +**Example** + +```js +var parent = new Node({type: 'foo'}); +utils.pushNode(parent, new Node({type: 'foo'})); +utils.pushNode(parent, new Node({type: 'bar'})); +utils.pushNode(parent, new Node({type: 'baz'})); +console.log(parent.nodes.length); //=> 3 +utils.popNode(parent); +console.log(parent.nodes.length); //=> 2 +``` + +### [.shiftNode](index.js#L382) + +Shift the first `node` off of `parent.nodes`. The advantage of using this method is that it checks for `node.nodes` and works with any version of `snapdragon-node`. + +**Params** + +* `parent` **{Object}** +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{Number|Undefined}**: Returns the length of `node.nodes` or undefined. + +**Example** + +```js +var parent = new Node({type: 'foo'}); +utils.pushNode(parent, new Node({type: 'foo'})); +utils.pushNode(parent, new Node({type: 'bar'})); +utils.pushNode(parent, new Node({type: 'baz'})); +console.log(parent.nodes.length); //=> 3 +utils.shiftNode(parent); +console.log(parent.nodes.length); //=> 2 +``` + +### [.removeNode](index.js#L409) + +Remove the specified `node` from `parent.nodes`. + +**Params** + +* `parent` **{Object}** +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{Object|undefined}**: Returns the removed node, if successful, or undefined if it does not exist on `parent.nodes`. + +**Example** + +```js +var parent = new Node({type: 'abc'}); +var foo = new Node({type: 'foo'}); +utils.pushNode(parent, foo); +utils.pushNode(parent, new Node({type: 'bar'})); +utils.pushNode(parent, new Node({type: 'baz'})); +console.log(parent.nodes.length); //=> 3 +utils.removeNode(parent, foo); +console.log(parent.nodes.length); //=> 2 +``` + +### [.isType](index.js#L443) + +Returns true if `node.type` matches the given `type`. Throws a `TypeError` if `node` is not an instance of `Node`. + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `type` **{String}** +* `returns` **{Boolean}** + +**Example** + +```js +var Node = require('snapdragon-node'); +var node = new Node({type: 'foo'}); +console.log(utils.isType(node, 'foo')); // false +console.log(utils.isType(node, 'bar')); // true +``` + +### [.hasType](index.js#L486) + +Returns true if the given `node` has the given `type` in `node.nodes`. Throws a `TypeError` if `node` is not an instance of `Node`. + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `type` **{String}** +* `returns` **{Boolean}** + +**Example** + +```js +var Node = require('snapdragon-node'); +var node = new Node({ + type: 'foo', + nodes: [ + new Node({type: 'bar'}), + new Node({type: 'baz'}) + ] +}); +console.log(utils.hasType(node, 'xyz')); // false +console.log(utils.hasType(node, 'baz')); // true +``` + +### [.firstOfType](index.js#L519) + +Returns the first node from `node.nodes` of the given `type` + +**Params** + +* `nodes` **{Array}** +* `type` **{String}** +* `returns` **{Object|undefined}**: Returns the first matching node or undefined. + +**Example** + +```js +var node = new Node({ + type: 'foo', + nodes: [ + new Node({type: 'text', val: 'abc'}), + new Node({type: 'text', val: 'xyz'}) + ] +}); + +var textNode = utils.firstOfType(node.nodes, 'text'); +console.log(textNode.val); +//=> 'abc' +``` + +### [.findNode](index.js#L556) + +Returns the node at the specified index, or the first node of the given `type` from `node.nodes`. + +**Params** + +* `nodes` **{Array}** +* `type` **{String|Number}**: Node type or index. +* `returns` **{Object}**: Returns a node or undefined. + +**Example** + +```js +var node = new Node({ + type: 'foo', + nodes: [ + new Node({type: 'text', val: 'abc'}), + new Node({type: 'text', val: 'xyz'}) + ] +}); + +var nodeOne = utils.findNode(node.nodes, 'text'); +console.log(nodeOne.val); +//=> 'abc' + +var nodeTwo = utils.findNode(node.nodes, 1); +console.log(nodeTwo.val); +//=> 'xyz' +``` + +### [.isOpen](index.js#L584) + +Returns true if the given node is an "*.open" node. + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{Boolean}** + +**Example** + +```js +var Node = require('snapdragon-node'); +var brace = new Node({type: 'brace'}); +var open = new Node({type: 'brace.open'}); +var close = new Node({type: 'brace.close'}); + +console.log(utils.isOpen(brace)); // false +console.log(utils.isOpen(open)); // true +console.log(utils.isOpen(close)); // false +``` + +### [.isClose](index.js#L607) + +Returns true if the given node is a "*.close" node. + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{Boolean}** + +**Example** + +```js +var Node = require('snapdragon-node'); +var brace = new Node({type: 'brace'}); +var open = new Node({type: 'brace.open'}); +var close = new Node({type: 'brace.close'}); + +console.log(utils.isClose(brace)); // false +console.log(utils.isClose(open)); // false +console.log(utils.isClose(close)); // true +``` + +### [.hasOpen](index.js#L633) + +Returns true if `node.nodes` **has** an `.open` node + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{Boolean}** + +**Example** + +```js +var Node = require('snapdragon-node'); +var brace = new Node({ + type: 'brace', + nodes: [] +}); + +var open = new Node({type: 'brace.open'}); +console.log(utils.hasOpen(brace)); // false + +brace.pushNode(open); +console.log(utils.hasOpen(brace)); // true +``` + +### [.hasClose](index.js#L663) + +Returns true if `node.nodes` **has** a `.close` node + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{Boolean}** + +**Example** + +```js +var Node = require('snapdragon-node'); +var brace = new Node({ + type: 'brace', + nodes: [] +}); + +var close = new Node({type: 'brace.close'}); +console.log(utils.hasClose(brace)); // false + +brace.pushNode(close); +console.log(utils.hasClose(brace)); // true +``` + +### [.hasOpenAndClose](index.js#L697) + +Returns true if `node.nodes` has both `.open` and `.close` nodes + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{Boolean}** + +**Example** + +```js +var Node = require('snapdragon-node'); +var brace = new Node({ + type: 'brace', + nodes: [] +}); + +var open = new Node({type: 'brace.open'}); +var close = new Node({type: 'brace.close'}); +console.log(utils.hasOpen(brace)); // false +console.log(utils.hasClose(brace)); // false + +brace.pushNode(open); +brace.pushNode(close); +console.log(utils.hasOpen(brace)); // true +console.log(utils.hasClose(brace)); // true +``` + +### [.addType](index.js#L719) + +Push the given `node` onto the `state.inside` array for the given type. This array is used as a specialized "stack" for only the given `node.type`. + +**Params** + +* `state` **{Object}**: The `compiler.state` object or custom state object. +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{Array}**: Returns the `state.inside` stack for the given type. + +**Example** + +```js +var state = { inside: {}}; +var node = new Node({type: 'brace'}); +utils.addType(state, node); +console.log(state.inside); +//=> { brace: [{type: 'brace'}] } +``` + +### [.removeType](index.js#L759) + +Remove the given `node` from the `state.inside` array for the given type. This array is used as a specialized "stack" for only the given `node.type`. + +**Params** + +* `state` **{Object}**: The `compiler.state` object or custom state object. +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `returns` **{Array}**: Returns the `state.inside` stack for the given type. + +**Example** + +```js +var state = { inside: {}}; +var node = new Node({type: 'brace'}); +utils.addType(state, node); +console.log(state.inside); +//=> { brace: [{type: 'brace'}] } +utils.removeType(state, node); +//=> { brace: [] } +``` + +### [.isEmpty](index.js#L788) + +Returns true if `node.val` is an empty string, or `node.nodes` does not contain any non-empty text nodes. + +**Params** + +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `fn` **{Function}** +* `returns` **{Boolean}** + +**Example** + +```js +var node = new Node({type: 'text'}); +utils.isEmpty(node); //=> true +node.val = 'foo'; +utils.isEmpty(node); //=> false +``` + +### [.isInsideType](index.js#L833) + +Returns true if the `state.inside` stack for the given type exists and has one or more nodes on it. + +**Params** + +* `state` **{Object}** +* `type` **{String}** +* `returns` **{Boolean}** + +**Example** + +```js +var state = { inside: {}}; +var node = new Node({type: 'brace'}); +console.log(utils.isInsideType(state, 'brace')); //=> false +utils.addType(state, node); +console.log(utils.isInsideType(state, 'brace')); //=> true +utils.removeType(state, node); +console.log(utils.isInsideType(state, 'brace')); //=> false +``` + +### [.isInside](index.js#L867) + +Returns true if `node` is either a child or grand-child of the given `type`, or `state.inside[type]` is a non-empty array. + +**Params** + +* `state` **{Object}**: Either the `compiler.state` object, if it exists, or a user-supplied state object. +* `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node) +* `type` **{String}**: The `node.type` to check for. +* `returns` **{Boolean}** + +**Example** + +```js +var state = { inside: {}}; +var node = new Node({type: 'brace'}); +var open = new Node({type: 'brace.open'}); +console.log(utils.isInside(state, open, 'brace')); //=> false +utils.pushNode(node, open); +console.log(utils.isInside(state, open, 'brace')); //=> true +``` + +### [.last](index.js#L915) + +Get the last `n` element from the given `array`. Used for getting +a node from `node.nodes.` + +**Params** + +* `array` **{Array}** +* `n` **{Number}** +* `returns` **{undefined}** + +### [.arrayify](index.js#L935) + +Cast the given `val` to an array. + +**Params** + +* `val` **{any}** +* `returns` **{Array}** + +**Example** + +```js +console.log(utils.arraify('')); +//=> [] +console.log(utils.arraify('foo')); +//=> ['foo'] +console.log(utils.arraify(['foo'])); +//=> ['foo'] +``` + +### [.stringify](index.js#L948) + +Convert the given `val` to a string by joining with `,`. Useful +for creating a cheerio/CSS/DOM-style selector from a list of strings. + +**Params** + +* `val` **{any}** +* `returns` **{Array}** + +### [.trim](index.js#L961) + +Ensure that the given value is a string and call `.trim()` on it, +or return an empty string. + +**Params** + +* `str` **{String}** +* `returns` **{String}** + +## Release history + +Changelog entries are classified using the following labels from [keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog): + +* `added`: for new features +* `changed`: for changes in existing functionality +* `deprecated`: for once-stable features removed in upcoming releases +* `removed`: for deprecated features removed in this release +* `fixed`: for any bug fixes + +Custom labels used in this changelog: + +* `dependencies`: bumps dependencies +* `housekeeping`: code re-organization, minor edits, or other changes that don't fit in one of the other categories. + +### [3.0.0] - 2017-05-01 + +**Changed** + +* `.emit` was renamed to [.append](#append) +* `.addNode` was renamed to [.pushNode](#pushNode) +* `.getNode` was renamed to [.findNode](#findNode) +* `.isEmptyNodes` was renamed to [.isEmpty](#isEmpty): also now works with `node.nodes` and/or `node.val` + +**Added** + +* [.identity](#identity) +* [.removeNode](#removeNode) +* [.shiftNode](#shiftNode) +* [.popNode](#popNode) + +### [0.1.0] + +First release. + +## About + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 01, 2017._ \ No newline at end of file diff --git a/node_modules/snapdragon-util/index.js b/node_modules/snapdragon-util/index.js new file mode 100644 index 0000000..68a030e --- /dev/null +++ b/node_modules/snapdragon-util/index.js @@ -0,0 +1,1019 @@ +'use strict'; + +var typeOf = require('kind-of'); +var utils = module.exports; + +/** + * Returns true if the given value is a node. + * + * ```js + * var Node = require('snapdragon-node'); + * var node = new Node({type: 'foo'}); + * console.log(utils.isNode(node)); //=> true + * console.log(utils.isNode({})); //=> false + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @returns {Boolean} + * @api public + */ + +utils.isNode = function(node) { + return typeOf(node) === 'object' && node.isNode === true; +}; + +/** + * Emit an empty string for the given `node`. + * + * ```js + * // do nothing for beginning-of-string + * snapdragon.compiler.set('bos', utils.noop); + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @returns {undefined} + * @api public + */ + +utils.noop = function(node) { + append(this, '', node); +}; + +/** + * Appdend `node.val` to `compiler.output`, exactly as it was created + * by the parser. + * + * ```js + * snapdragon.compiler.set('text', utils.identity); + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @returns {undefined} + * @api public + */ + +utils.identity = function(node) { + append(this, node.val, node); +}; + +/** + * Previously named `.emit`, this method appends the given `val` + * to `compiler.output` for the given node. Useful when you know + * what value should be appended advance, regardless of the actual + * value of `node.val`. + * + * ```js + * snapdragon.compiler + * .set('i', function(node) { + * this.mapVisit(node); + * }) + * .set('i.open', utils.append('')) + * .set('i.close', utils.append('')) + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @returns {Function} Returns a compiler middleware function. + * @api public + */ + +utils.append = function(val) { + return function(node) { + append(this, val, node); + }; +}; + +/** + * Used in compiler middleware, this onverts an AST node into + * an empty `text` node and deletes `node.nodes` if it exists. + * The advantage of this method is that, as opposed to completely + * removing the node, indices will not need to be re-calculated + * in sibling nodes, and nothing is appended to the output. + * + * ```js + * utils.toNoop(node); + * // convert `node.nodes` to the given value instead of deleting it + * utils.toNoop(node, []); + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {Array} `nodes` Optionally pass a new `nodes` value, to replace the existing `node.nodes` array. + * @api public + */ + +utils.toNoop = function(node, nodes) { + if (nodes) { + node.nodes = nodes; + } else { + delete node.nodes; + node.type = 'text'; + node.val = ''; + } +}; + +/** + * Visit `node` with the given `fn`. The built-in `.visit` method in snapdragon + * automatically calls registered compilers, this allows you to pass a visitor + * function. + * + * ```js + * snapdragon.compiler.set('i', function(node) { + * utils.visit(node, function(childNode) { + * // do stuff with "childNode" + * return childNode; + * }); + * }); + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {Function} `fn` + * @return {Object} returns the node after recursively visiting all child nodes. + * @api public + */ + +utils.visit = function(node, fn) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isFunction(fn), 'expected a visitor function'); + fn(node); + return node.nodes ? utils.mapVisit(node, fn) : node; +}; + +/** + * Map [visit](#visit) the given `fn` over `node.nodes`. This is called by + * [visit](#visit), use this method if you do not want `fn` to be called on + * the first node. + * + * ```js + * snapdragon.compiler.set('i', function(node) { + * utils.mapVisit(node, function(childNode) { + * // do stuff with "childNode" + * return childNode; + * }); + * }); + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {Object} `options` + * @param {Function} `fn` + * @return {Object} returns the node + * @api public + */ + +utils.mapVisit = function(node, fn) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isArray(node.nodes), 'expected node.nodes to be an array'); + assert(isFunction(fn), 'expected a visitor function'); + + for (var i = 0; i < node.nodes.length; i++) { + utils.visit(node.nodes[i], fn); + } + return node; +}; + +/** + * Unshift an `*.open` node onto `node.nodes`. + * + * ```js + * var Node = require('snapdragon-node'); + * snapdragon.parser.set('brace', function(node) { + * var match = this.match(/^{/); + * if (match) { + * var parent = new Node({type: 'brace'}); + * utils.addOpen(parent, Node); + * console.log(parent.nodes[0]): + * // { type: 'brace.open', val: '' }; + * + * // push the parent "brace" node onto the stack + * this.push(parent); + * + * // return the parent node, so it's also added to the AST + * return brace; + * } + * }); + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {Function} `Node` (required) Node constructor function from [snapdragon-node][]. + * @param {Function} `filter` Optionaly specify a filter function to exclude the node. + * @return {Object} Returns the created opening node. + * @api public + */ + +utils.addOpen = function(node, Node, val, filter) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isFunction(Node), 'expected Node to be a constructor function'); + + if (typeof val === 'function') { + filter = val; + val = ''; + } + + if (typeof filter === 'function' && !filter(node)) return; + var open = new Node({ type: node.type + '.open', val: val}); + var unshift = node.unshift || node.unshiftNode; + if (typeof unshift === 'function') { + unshift.call(node, open); + } else { + utils.unshiftNode(node, open); + } + return open; +}; + +/** + * Push a `*.close` node onto `node.nodes`. + * + * ```js + * var Node = require('snapdragon-node'); + * snapdragon.parser.set('brace', function(node) { + * var match = this.match(/^}/); + * if (match) { + * var parent = this.parent(); + * if (parent.type !== 'brace') { + * throw new Error('missing opening: ' + '}'); + * } + * + * utils.addClose(parent, Node); + * console.log(parent.nodes[parent.nodes.length - 1]): + * // { type: 'brace.close', val: '' }; + * + * // no need to return a node, since the parent + * // was already added to the AST + * return; + * } + * }); + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {Function} `Node` (required) Node constructor function from [snapdragon-node][]. + * @param {Function} `filter` Optionaly specify a filter function to exclude the node. + * @return {Object} Returns the created closing node. + * @api public + */ + +utils.addClose = function(node, Node, val, filter) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isFunction(Node), 'expected Node to be a constructor function'); + + if (typeof val === 'function') { + filter = val; + val = ''; + } + + if (typeof filter === 'function' && !filter(node)) return; + var close = new Node({ type: node.type + '.close', val: val}); + var push = node.push || node.pushNode; + if (typeof push === 'function') { + push.call(node, close); + } else { + utils.pushNode(node, close); + } + return close; +}; + +/** + * Wraps the given `node` with `*.open` and `*.close` nodes. + * + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {Function} `Node` (required) Node constructor function from [snapdragon-node][]. + * @param {Function} `filter` Optionaly specify a filter function to exclude the node. + * @return {Object} Returns the node + * @api public + */ + +utils.wrapNodes = function(node, Node, filter) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isFunction(Node), 'expected Node to be a constructor function'); + + utils.addOpen(node, Node, filter); + utils.addClose(node, Node, filter); + return node; +}; + +/** + * Push the given `node` onto `parent.nodes`, and set `parent` as `node.parent. + * + * ```js + * var parent = new Node({type: 'foo'}); + * var node = new Node({type: 'bar'}); + * utils.pushNode(parent, node); + * console.log(parent.nodes[0].type) // 'bar' + * console.log(node.parent.type) // 'foo' + * ``` + * @param {Object} `parent` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Object} Returns the child node + * @api public + */ + +utils.pushNode = function(parent, node) { + assert(utils.isNode(parent), 'expected parent node to be an instance of Node'); + assert(utils.isNode(node), 'expected node to be an instance of Node'); + + node.define('parent', parent); + parent.nodes = parent.nodes || []; + parent.nodes.push(node); + return node; +}; + +/** + * Unshift `node` onto `parent.nodes`, and set `parent` as `node.parent. + * + * ```js + * var parent = new Node({type: 'foo'}); + * var node = new Node({type: 'bar'}); + * utils.unshiftNode(parent, node); + * console.log(parent.nodes[0].type) // 'bar' + * console.log(node.parent.type) // 'foo' + * ``` + * @param {Object} `parent` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {undefined} + * @api public + */ + +utils.unshiftNode = function(parent, node) { + assert(utils.isNode(parent), 'expected parent node to be an instance of Node'); + assert(utils.isNode(node), 'expected node to be an instance of Node'); + + node.define('parent', parent); + parent.nodes = parent.nodes || []; + parent.nodes.unshift(node); +}; + +/** + * Pop the last `node` off of `parent.nodes`. The advantage of + * using this method is that it checks for `node.nodes` and works + * with any version of `snapdragon-node`. + * + * ```js + * var parent = new Node({type: 'foo'}); + * utils.pushNode(parent, new Node({type: 'foo'})); + * utils.pushNode(parent, new Node({type: 'bar'})); + * utils.pushNode(parent, new Node({type: 'baz'})); + * console.log(parent.nodes.length); //=> 3 + * utils.popNode(parent); + * console.log(parent.nodes.length); //=> 2 + * ``` + * @param {Object} `parent` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Number|Undefined} Returns the length of `node.nodes` or undefined. + * @api public + */ + +utils.popNode = function(node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + if (typeof node.pop === 'function') { + return node.pop(); + } + return node.nodes && node.nodes.pop(); +}; + +/** + * Shift the first `node` off of `parent.nodes`. The advantage of + * using this method is that it checks for `node.nodes` and works + * with any version of `snapdragon-node`. + * + * ```js + * var parent = new Node({type: 'foo'}); + * utils.pushNode(parent, new Node({type: 'foo'})); + * utils.pushNode(parent, new Node({type: 'bar'})); + * utils.pushNode(parent, new Node({type: 'baz'})); + * console.log(parent.nodes.length); //=> 3 + * utils.shiftNode(parent); + * console.log(parent.nodes.length); //=> 2 + * ``` + * @param {Object} `parent` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Number|Undefined} Returns the length of `node.nodes` or undefined. + * @api public + */ + +utils.shiftNode = function(node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + if (typeof node.shift === 'function') { + return node.shift(); + } + return node.nodes && node.nodes.shift(); +}; + +/** + * Remove the specified `node` from `parent.nodes`. + * + * ```js + * var parent = new Node({type: 'abc'}); + * var foo = new Node({type: 'foo'}); + * utils.pushNode(parent, foo); + * utils.pushNode(parent, new Node({type: 'bar'})); + * utils.pushNode(parent, new Node({type: 'baz'})); + * console.log(parent.nodes.length); //=> 3 + * utils.removeNode(parent, foo); + * console.log(parent.nodes.length); //=> 2 + * ``` + * @param {Object} `parent` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Object|undefined} Returns the removed node, if successful, or undefined if it does not exist on `parent.nodes`. + * @api public + */ + +utils.removeNode = function(parent, node) { + assert(utils.isNode(parent), 'expected parent.node to be an instance of Node'); + assert(utils.isNode(node), 'expected node to be an instance of Node'); + + if (!parent.nodes) { + return null; + } + + if (typeof parent.remove === 'function') { + return parent.remove(node); + } + + var idx = parent.nodes.indexOf(node); + if (idx !== -1) { + return parent.nodes.splice(idx, 1); + } +}; + +/** + * Returns true if `node.type` matches the given `type`. Throws a + * `TypeError` if `node` is not an instance of `Node`. + * + * ```js + * var Node = require('snapdragon-node'); + * var node = new Node({type: 'foo'}); + * console.log(utils.isType(node, 'foo')); // false + * console.log(utils.isType(node, 'bar')); // true + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {String} `type` + * @return {Boolean} + * @api public + */ + +utils.isType = function(node, type) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + switch (typeOf(type)) { + case 'array': + var types = type.slice(); + for (var i = 0; i < types.length; i++) { + if (utils.isType(node, types[i])) { + return true; + } + } + return false; + case 'string': + return node.type === type; + case 'regexp': + return type.test(node.type); + default: { + throw new TypeError('expected "type" to be an array, string or regexp'); + } + } +}; + +/** + * Returns true if the given `node` has the given `type` in `node.nodes`. + * Throws a `TypeError` if `node` is not an instance of `Node`. + * + * ```js + * var Node = require('snapdragon-node'); + * var node = new Node({ + * type: 'foo', + * nodes: [ + * new Node({type: 'bar'}), + * new Node({type: 'baz'}) + * ] + * }); + * console.log(utils.hasType(node, 'xyz')); // false + * console.log(utils.hasType(node, 'baz')); // true + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {String} `type` + * @return {Boolean} + * @api public + */ + +utils.hasType = function(node, type) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + if (!Array.isArray(node.nodes)) return false; + for (var i = 0; i < node.nodes.length; i++) { + if (utils.isType(node.nodes[i], type)) { + return true; + } + } + return false; +}; + +/** + * Returns the first node from `node.nodes` of the given `type` + * + * ```js + * var node = new Node({ + * type: 'foo', + * nodes: [ + * new Node({type: 'text', val: 'abc'}), + * new Node({type: 'text', val: 'xyz'}) + * ] + * }); + * + * var textNode = utils.firstOfType(node.nodes, 'text'); + * console.log(textNode.val); + * //=> 'abc' + * ``` + * @param {Array} `nodes` + * @param {String} `type` + * @return {Object|undefined} Returns the first matching node or undefined. + * @api public + */ + +utils.firstOfType = function(nodes, type) { + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + if (utils.isType(node, type)) { + return node; + } + } +}; + +/** + * Returns the node at the specified index, or the first node of the + * given `type` from `node.nodes`. + * + * ```js + * var node = new Node({ + * type: 'foo', + * nodes: [ + * new Node({type: 'text', val: 'abc'}), + * new Node({type: 'text', val: 'xyz'}) + * ] + * }); + * + * var nodeOne = utils.findNode(node.nodes, 'text'); + * console.log(nodeOne.val); + * //=> 'abc' + * + * var nodeTwo = utils.findNode(node.nodes, 1); + * console.log(nodeTwo.val); + * //=> 'xyz' + * ``` + * + * @param {Array} `nodes` + * @param {String|Number} `type` Node type or index. + * @return {Object} Returns a node or undefined. + * @api public + */ + +utils.findNode = function(nodes, type) { + if (!Array.isArray(nodes)) { + return null; + } + if (typeof type === 'number') { + return nodes[type]; + } + return utils.firstOfType(nodes, type); +}; + +/** + * Returns true if the given node is an "*.open" node. + * + * ```js + * var Node = require('snapdragon-node'); + * var brace = new Node({type: 'brace'}); + * var open = new Node({type: 'brace.open'}); + * var close = new Node({type: 'brace.close'}); + * + * console.log(utils.isOpen(brace)); // false + * console.log(utils.isOpen(open)); // true + * console.log(utils.isOpen(close)); // false + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Boolean} + * @api public + */ + +utils.isOpen = function(node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + return node.type.slice(-5) === '.open'; +}; + +/** + * Returns true if the given node is a "*.close" node. + * + * ```js + * var Node = require('snapdragon-node'); + * var brace = new Node({type: 'brace'}); + * var open = new Node({type: 'brace.open'}); + * var close = new Node({type: 'brace.close'}); + * + * console.log(utils.isClose(brace)); // false + * console.log(utils.isClose(open)); // false + * console.log(utils.isClose(close)); // true + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Boolean} + * @api public + */ + +utils.isClose = function(node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + return node.type.slice(-6) === '.close'; +}; + +/** + * Returns true if `node.nodes` **has** an `.open` node + * + * ```js + * var Node = require('snapdragon-node'); + * var brace = new Node({ + * type: 'brace', + * nodes: [] + * }); + * + * var open = new Node({type: 'brace.open'}); + * console.log(utils.hasOpen(brace)); // false + * + * brace.pushNode(open); + * console.log(utils.hasOpen(brace)); // true + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Boolean} + * @api public + */ + +utils.hasOpen = function(node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + var first = node.first || node.nodes ? node.nodes[0] : null; + if (utils.isNode(first)) { + return first.type === node.type + '.open'; + } + return false; +}; + +/** + * Returns true if `node.nodes` **has** a `.close` node + * + * ```js + * var Node = require('snapdragon-node'); + * var brace = new Node({ + * type: 'brace', + * nodes: [] + * }); + * + * var close = new Node({type: 'brace.close'}); + * console.log(utils.hasClose(brace)); // false + * + * brace.pushNode(close); + * console.log(utils.hasClose(brace)); // true + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Boolean} + * @api public + */ + +utils.hasClose = function(node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + var last = node.last || node.nodes ? node.nodes[node.nodes.length - 1] : null; + if (utils.isNode(last)) { + return last.type === node.type + '.close'; + } + return false; +}; + +/** + * Returns true if `node.nodes` has both `.open` and `.close` nodes + * + * ```js + * var Node = require('snapdragon-node'); + * var brace = new Node({ + * type: 'brace', + * nodes: [] + * }); + * + * var open = new Node({type: 'brace.open'}); + * var close = new Node({type: 'brace.close'}); + * console.log(utils.hasOpen(brace)); // false + * console.log(utils.hasClose(brace)); // false + * + * brace.pushNode(open); + * brace.pushNode(close); + * console.log(utils.hasOpen(brace)); // true + * console.log(utils.hasClose(brace)); // true + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Boolean} + * @api public + */ + +utils.hasOpenAndClose = function(node) { + return utils.hasOpen(node) && utils.hasClose(node); +}; + +/** + * Push the given `node` onto the `state.inside` array for the + * given type. This array is used as a specialized "stack" for + * only the given `node.type`. + * + * ```js + * var state = { inside: {}}; + * var node = new Node({type: 'brace'}); + * utils.addType(state, node); + * console.log(state.inside); + * //=> { brace: [{type: 'brace'}] } + * ``` + * @param {Object} `state` The `compiler.state` object or custom state object. + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Array} Returns the `state.inside` stack for the given type. + * @api public + */ + +utils.addType = function(state, node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isObject(state), 'expected state to be an object'); + + var type = node.parent + ? node.parent.type + : node.type.replace(/\.open$/, ''); + + if (!state.hasOwnProperty('inside')) { + state.inside = {}; + } + if (!state.inside.hasOwnProperty(type)) { + state.inside[type] = []; + } + + var arr = state.inside[type]; + arr.push(node); + return arr; +}; + +/** + * Remove the given `node` from the `state.inside` array for the + * given type. This array is used as a specialized "stack" for + * only the given `node.type`. + * + * ```js + * var state = { inside: {}}; + * var node = new Node({type: 'brace'}); + * utils.addType(state, node); + * console.log(state.inside); + * //=> { brace: [{type: 'brace'}] } + * utils.removeType(state, node); + * //=> { brace: [] } + * ``` + * @param {Object} `state` The `compiler.state` object or custom state object. + * @param {Object} `node` Instance of [snapdragon-node][] + * @return {Array} Returns the `state.inside` stack for the given type. + * @api public + */ + +utils.removeType = function(state, node) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isObject(state), 'expected state to be an object'); + + var type = node.parent + ? node.parent.type + : node.type.replace(/\.close$/, ''); + + if (state.inside.hasOwnProperty(type)) { + return state.inside[type].pop(); + } +}; + +/** + * Returns true if `node.val` is an empty string, or `node.nodes` does + * not contain any non-empty text nodes. + * + * ```js + * var node = new Node({type: 'text'}); + * utils.isEmpty(node); //=> true + * node.val = 'foo'; + * utils.isEmpty(node); //=> false + * ``` + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {Function} `fn` + * @return {Boolean} + * @api public + */ + +utils.isEmpty = function(node, fn) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + + if (!Array.isArray(node.nodes)) { + if (node.type !== 'text') { + return true; + } + if (typeof fn === 'function') { + return fn(node, node.parent); + } + return !utils.trim(node.val); + } + + for (var i = 0; i < node.nodes.length; i++) { + var child = node.nodes[i]; + if (utils.isOpen(child) || utils.isClose(child)) { + continue; + } + if (!utils.isEmpty(child, fn)) { + return false; + } + } + + return true; +}; + +/** + * Returns true if the `state.inside` stack for the given type exists + * and has one or more nodes on it. + * + * ```js + * var state = { inside: {}}; + * var node = new Node({type: 'brace'}); + * console.log(utils.isInsideType(state, 'brace')); //=> false + * utils.addType(state, node); + * console.log(utils.isInsideType(state, 'brace')); //=> true + * utils.removeType(state, node); + * console.log(utils.isInsideType(state, 'brace')); //=> false + * ``` + * @param {Object} `state` + * @param {String} `type` + * @return {Boolean} + * @api public + */ + +utils.isInsideType = function(state, type) { + assert(isObject(state), 'expected state to be an object'); + assert(isString(type), 'expected type to be a string'); + + if (!state.hasOwnProperty('inside')) { + return false; + } + + if (!state.inside.hasOwnProperty(type)) { + return false; + } + + return state.inside[type].length > 0; +}; + +/** + * Returns true if `node` is either a child or grand-child of the given `type`, + * or `state.inside[type]` is a non-empty array. + * + * ```js + * var state = { inside: {}}; + * var node = new Node({type: 'brace'}); + * var open = new Node({type: 'brace.open'}); + * console.log(utils.isInside(state, open, 'brace')); //=> false + * utils.pushNode(node, open); + * console.log(utils.isInside(state, open, 'brace')); //=> true + * ``` + * @param {Object} `state` Either the `compiler.state` object, if it exists, or a user-supplied state object. + * @param {Object} `node` Instance of [snapdragon-node][] + * @param {String} `type` The `node.type` to check for. + * @return {Boolean} + * @api public + */ + +utils.isInside = function(state, node, type) { + assert(utils.isNode(node), 'expected node to be an instance of Node'); + assert(isObject(state), 'expected state to be an object'); + + if (Array.isArray(type)) { + for (var i = 0; i < type.length; i++) { + if (utils.isInside(state, node, type[i])) { + return true; + } + } + return false; + } + + var parent = node.parent; + if (typeof type === 'string') { + return (parent && parent.type === type) || utils.isInsideType(state, type); + } + + if (typeOf(type) === 'regexp') { + if (parent && parent.type && type.test(parent.type)) { + return true; + } + + var keys = Object.keys(state.inside); + var len = keys.length; + var idx = -1; + while (++idx < len) { + var key = keys[idx]; + var val = state.inside[key]; + + if (Array.isArray(val) && val.length !== 0 && type.test(key)) { + return true; + } + } + } + return false; +}; + +/** + * Get the last `n` element from the given `array`. Used for getting + * a node from `node.nodes.` + * + * @param {Array} `array` + * @param {Number} `n` + * @return {undefined} + * @api public + */ + +utils.last = function(arr, n) { + return arr[arr.length - (n || 1)]; +}; + +/** + * Cast the given `val` to an array. + * + * ```js + * console.log(utils.arrayify('')); + * //=> [] + * console.log(utils.arrayify('foo')); + * //=> ['foo'] + * console.log(utils.arrayify(['foo'])); + * //=> ['foo'] + * ``` + * @param {any} `val` + * @return {Array} + * @api public + */ + +utils.arrayify = function(val) { + if (typeof val === 'string' && val !== '') { + return [val]; + } + if (!Array.isArray(val)) { + return []; + } + return val; +}; + +/** + * Convert the given `val` to a string by joining with `,`. Useful + * for creating a cheerio/CSS/DOM-style selector from a list of strings. + * + * @param {any} `val` + * @return {Array} + * @api public + */ + +utils.stringify = function(val) { + return utils.arrayify(val).join(','); +}; + +/** + * Ensure that the given value is a string and call `.trim()` on it, + * or return an empty string. + * + * @param {String} `str` + * @return {String} + * @api public + */ + +utils.trim = function(str) { + return typeof str === 'string' ? str.trim() : ''; +}; + +/** + * Return true if val is an object + */ + +function isObject(val) { + return typeOf(val) === 'object'; +} + +/** + * Return true if val is a string + */ + +function isString(val) { + return typeof val === 'string'; +} + +/** + * Return true if val is a function + */ + +function isFunction(val) { + return typeof val === 'function'; +} + +/** + * Return true if val is an array + */ + +function isArray(val) { + return Array.isArray(val); +} + +/** + * Shim to ensure the `.append` methods work with any version of snapdragon + */ + +function append(compiler, val, node) { + if (typeof compiler.append !== 'function') { + return compiler.emit(val, node); + } + return compiler.append(val, node); +} + +/** + * Simplified assertion. Throws an error is `val` is falsey. + */ + +function assert(val, message) { + if (!val) throw new Error(message); +} diff --git a/node_modules/snapdragon-util/package.json b/node_modules/snapdragon-util/package.json new file mode 100644 index 0000000..e9e424b --- /dev/null +++ b/node_modules/snapdragon-util/package.json @@ -0,0 +1,96 @@ +{ + "_from": "snapdragon-util@^3.0.1", + "_id": "snapdragon-util@3.0.1", + "_inBundle": false, + "_integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "_location": "/snapdragon-util", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "snapdragon-util@^3.0.1", + "name": "snapdragon-util", + "escapedName": "snapdragon-util", + "rawSpec": "^3.0.1", + "saveSpec": null, + "fetchSpec": "^3.0.1" + }, + "_requiredBy": [ + "/snapdragon-node" + ], + "_resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "_shasum": "f956479486f2acd79700693f6f7b805e45ab56e2", + "_spec": "snapdragon-util@^3.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/snapdragon-node", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/snapdragon-util/issues" + }, + "bundleDependencies": false, + "dependencies": { + "kind-of": "^3.2.0" + }, + "deprecated": false, + "description": "Utilities for the snapdragon parser/compiler.", + "devDependencies": { + "define-property": "^1.0.0", + "gulp": "^3.9.1", + "gulp-eslint": "^3.0.1", + "gulp-format-md": "^0.1.12", + "gulp-istanbul": "^1.1.1", + "gulp-mocha": "^3.0.0", + "isobject": "^3.0.0", + "mocha": "^3.3.0", + "snapdragon": "^0.11.0", + "snapdragon-node": "^1.0.6" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/snapdragon-util", + "keywords": [ + "capture", + "compile", + "compiler", + "convert", + "match", + "parse", + "parser", + "plugin", + "render", + "snapdragon", + "snapdragonplugin", + "transform", + "util" + ], + "license": "MIT", + "main": "index.js", + "name": "snapdragon-util", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/snapdragon-util.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": "collapsible", + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + }, + "version": "3.0.1" +} diff --git a/node_modules/snapdragon/LICENSE b/node_modules/snapdragon/LICENSE new file mode 100644 index 0000000..1e49edf --- /dev/null +++ b/node_modules/snapdragon/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-2016, 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/node_modules/snapdragon/README.md b/node_modules/snapdragon/README.md new file mode 100644 index 0000000..4006e10 --- /dev/null +++ b/node_modules/snapdragon/README.md @@ -0,0 +1,321 @@ +# snapdragon [![NPM version](https://img.shields.io/npm/v/snapdragon.svg?style=flat)](https://www.npmjs.com/package/snapdragon) [![NPM downloads](https://img.shields.io/npm/dm/snapdragon.svg?style=flat)](https://npmjs.org/package/snapdragon) [![Build Status](https://img.shields.io/travis/jonschlinkert/snapdragon.svg?style=flat)](https://travis-ci.org/jonschlinkert/snapdragon) + +> Fast, pluggable and easy-to-use parser-renderer factory. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save snapdragon +``` + +Created by [jonschlinkert](https://github.com/jonschlinkert) and [doowb](https://github.com/doowb). + +**Features** + +* Bootstrap your own parser, get sourcemap support for free +* All parsing and compiling is handled by simple, reusable middleware functions +* Inspired by the parsers in [pug](http://jade-lang.com) and [css](https://github.com/reworkcss/css). + +## History + +### v0.5.0 + +**Breaking changes** + +Substantial breaking changes were made in v0.5.0! Most of these changes are part of a larger refactor that will be finished in 0.6.0, including the introduction of a `Lexer` class. + +* Renderer was renamed to `Compiler` +* the `.render` method was renamed to `.compile` +* Many other smaller changes. A more detailed overview will be provided in 0.6.0. If you don't have to time review code, I recommend you wait for the 0.6.0 release. + +## Usage examples + +```js +var Snapdragon = require('snapdragon'); +var snapdragon = new Snapdragon(); +``` + +**Parse** + +```js +var ast = snapdragon.parser('some string', options) + // parser middleware that can be called by other middleware + .set('foo', function () {}) + // parser middleware, runs immediately in the order defined + .use(bar()) + .use(baz()) +``` + +**Render** + +```js +// pass the `ast` from the parse method +var res = snapdragon.compiler(ast) + // compiler middleware, called when the name of the middleware + // matches the `node.type` (defined in a parser middleware) + .set('bar', function () {}) + .set('baz', function () {}) + .compile() +``` + +See the [examples](./examples/). + +## Getting started + +**Parsers** + +Parsers are middleware functions used for parsing a string into an ast node. + +```js +var ast = snapdragon.parser(str, options) + .use(function() { + var pos = this.position(); + var m = this.match(/^\./); + if (!m) return; + return pos({ + // `type` specifies the compiler to use + type: 'dot', + val: m[0] + }); + }) +``` + +**AST node** + +When the parser finds a match, `pos()` is called, pushing a token for that node onto the ast that looks something like: + +```js +{ type: 'dot', + val: '.', + position: + { start: { lineno: 1, column: 1 }, + end: { lineno: 1, column: 2 } }} +``` + +**Renderers** + +Renderers are _named_ middleware functions that visit over an array of ast nodes to compile a string. + +```js +var res = snapdragon.compiler(ast) + .set('dot', function (node) { + console.log(node.val) + //=> '.' + return this.emit(node.val); + }) +``` + +**Source maps** + +If you want source map support, make sure to emit the position as well. + +```js +var res = snapdragon.compiler(ast) + .set('dot', function (node) { + return this.emit(node.val, node.position); + }) +``` + +## Docs + +### Parser middleware + +A parser middleware is a function that returns an abject called a `token`. This token is pushed onto the AST as a node. + +**Example token** + +```js +{ type: 'dot', + val: '.', + position: + { start: { lineno: 1, column: 1 }, + end: { lineno: 1, column: 2 } }} +``` + +**Example parser middleware** + +Match a single `.` in a string: + +1. Get the starting position by calling `this.position()` +2. pass a regex for matching a single dot to the `.match` method +3. if **no match** is found, return `undefined` +4. if a **match** is found, `pos()` is called, which returns a token with: + - `type`: the name of the [compiler] to use + - `val`: The actual value captured by the regex. In this case, a `.`. Note that you can capture and return whatever will be needed by the corresponding [compiler]. + - The ending position: automatically calculated by adding the length of the first capture group to the starting position. + +## Renderer middleware + +Renderers are run when the name of the compiler middleware matches the `type` defined on an ast `node` (which is defined in a parser). + +**Example** + +Exercise: Parse a dot, then compile it as an escaped dot. + +```js +var ast = snapdragon.parser('.') + .use(function () { + var pos = this.position(); + var m = this.match(/^\./); + if (!m) return; + return pos({ + // define the `type` of compiler to use + type: 'dot', + val: m[0] + }) + }) + +var result = snapdragon.compiler(ast) + .set('dot', function (node) { + return this.emit('\\' + node.val); + }) + .compile() + +console.log(result.output); +//=> '\.' +``` + +## API + +### [Parser](lib/parser.js#L19) + +Create a new `Parser` with the given `input` and `options`. + +**Params** + +* `input` **{String}** +* `options` **{Object}** + +### [.define](lib/parser.js#L103) + +Define a non-enumberable property on the `Parser` instance. + +**Example** + +```js +parser.define('foo', 'bar'); +``` + +**Params** + +* `key` **{String}**: propery name +* `val` **{any}**: property value +* `returns` **{Object}**: Returns the Parser instance for chaining. + +Set parser `name` with the given `fn` + +**Params** + +* `name` **{String}** +* `fn` **{Function}** + +Get parser `name` + +**Params** + +* `name` **{String}** + +Push a `token` onto the `type` stack. + +**Params** + +* `type` **{String}** +* `returns` **{Object}** `token` + +Pop a token off of the `type` stack + +**Params** + +* `type` **{String}** +* `returns` **{Object}**: Returns a token + +Return true if inside a `stack` node. Types are `braces`, `parens` or `brackets`. + +**Params** + +* `type` **{String}** +* `returns` **{Boolean}** + +**Example** + +```js +parser.isType(node, 'brace'); +``` + +**Params** + +* `node` **{Object}** +* `type` **{String}** +* `returns` **{Boolean}** + +### [.define](lib/compiler.js#L71) + +Define a non-enumberable property on the `Compiler` instance. + +**Example** + +```js +compiler.define('foo', 'bar'); +``` + +**Params** + +* `key` **{String}**: propery name +* `val` **{any}**: property value +* `returns` **{Object}**: Returns the Compiler instance for chaining. + +## About + +### Related projects + +* [braces](https://www.npmjs.com/package/braces): Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces… [more](https://github.com/jonschlinkert/braces) | [homepage](https://github.com/jonschlinkert/braces "Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces specification.") +* [expand-brackets](https://www.npmjs.com/package/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns. | [homepage](https://github.com/jonschlinkert/expand-brackets "Expand POSIX bracket expressions (character classes) in glob patterns.") +* [extglob](https://www.npmjs.com/package/extglob): Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to… [more](https://github.com/jonschlinkert/extglob) | [homepage](https://github.com/jonschlinkert/extglob "Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to glob patterns.") +* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor**
    | +| --- | --- | +| 106 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [doowb](https://github.com/doowb) | + +### Building docs + +_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ + +To generate the readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm install -g verb verb-generate-readme && verb +``` + +### Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +### License + +Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT license](https://github.com/jonschlinkert/snapdragon/blob/master/LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 10, 2016._ \ No newline at end of file diff --git a/node_modules/snapdragon/index.js b/node_modules/snapdragon/index.js new file mode 100644 index 0000000..235b464 --- /dev/null +++ b/node_modules/snapdragon/index.js @@ -0,0 +1,174 @@ +'use strict'; + +var Base = require('base'); +var define = require('define-property'); +var Compiler = require('./lib/compiler'); +var Parser = require('./lib/parser'); +var utils = require('./lib/utils'); +var regexCache = {}; +var cache = {}; + +/** + * Create a new instance of `Snapdragon` with the given `options`. + * + * ```js + * var snapdragon = new Snapdragon(); + * ``` + * + * @param {Object} `options` + * @api public + */ + +function Snapdragon(options) { + Base.call(this, null, options); + this.options = utils.extend({source: 'string'}, this.options); + this.compiler = new Compiler(this.options); + this.parser = new Parser(this.options); + + Object.defineProperty(this, 'compilers', { + get: function() { + return this.compiler.compilers; + } + }); + + Object.defineProperty(this, 'parsers', { + get: function() { + return this.parser.parsers; + } + }); + + Object.defineProperty(this, 'regex', { + get: function() { + return this.parser.regex; + } + }); +} + +/** + * Inherit Base + */ + +Base.extend(Snapdragon); + +/** + * Add a parser to `snapdragon.parsers` for capturing the given `type` using + * the specified regex or parser function. A function is useful if you need + * to customize how the token is created and/or have access to the parser + * instance to check options, etc. + * + * ```js + * snapdragon + * .capture('slash', /^\//) + * .capture('dot', function() { + * var pos = this.position(); + * var m = this.match(/^\./); + * if (!m) return; + * return pos({ + * type: 'dot', + * val: m[0] + * }); + * }); + * ``` + * @param {String} `type` + * @param {RegExp|Function} `regex` + * @return {Object} Returns the parser instance for chaining + * @api public + */ + +Snapdragon.prototype.capture = function() { + return this.parser.capture.apply(this.parser, arguments); +}; + +/** + * Register a plugin `fn`. + * + * ```js + * var snapdragon = new Snapdgragon([options]); + * snapdragon.use(function() { + * console.log(this); //<= snapdragon instance + * console.log(this.parser); //<= parser instance + * console.log(this.compiler); //<= compiler instance + * }); + * ``` + * @param {Object} `fn` + * @api public + */ + +Snapdragon.prototype.use = function(fn) { + fn.call(this, this); + return this; +}; + +/** + * Parse the given `str`. + * + * ```js + * var snapdragon = new Snapdgragon([options]); + * // register parsers + * snapdragon.parser.use(function() {}); + * + * // parse + * var ast = snapdragon.parse('foo/bar'); + * console.log(ast); + * ``` + * @param {String} `str` + * @param {Object} `options` Set `options.sourcemap` to true to enable source maps. + * @return {Object} Returns an AST. + * @api public + */ + +Snapdragon.prototype.parse = function(str, options) { + this.options = utils.extend({}, this.options, options); + var parsed = this.parser.parse(str, this.options); + + // add non-enumerable parser reference + define(parsed, 'parser', this.parser); + return parsed; +}; + +/** + * Compile the given `AST`. + * + * ```js + * var snapdragon = new Snapdgragon([options]); + * // register plugins + * snapdragon.use(function() {}); + * // register parser plugins + * snapdragon.parser.use(function() {}); + * // register compiler plugins + * snapdragon.compiler.use(function() {}); + * + * // parse + * var ast = snapdragon.parse('foo/bar'); + * + * // compile + * var res = snapdragon.compile(ast); + * console.log(res.output); + * ``` + * @param {Object} `ast` + * @param {Object} `options` + * @return {Object} Returns an object with an `output` property with the rendered string. + * @api public + */ + +Snapdragon.prototype.compile = function(ast, options) { + this.options = utils.extend({}, this.options, options); + var compiled = this.compiler.compile(ast, this.options); + + // add non-enumerable compiler reference + define(compiled, 'compiler', this.compiler); + return compiled; +}; + +/** + * Expose `Snapdragon` + */ + +module.exports = Snapdragon; + +/** + * Expose `Parser` and `Compiler` + */ + +module.exports.Compiler = Compiler; +module.exports.Parser = Parser; diff --git a/node_modules/snapdragon/lib/compiler.js b/node_modules/snapdragon/lib/compiler.js new file mode 100644 index 0000000..0ce9d21 --- /dev/null +++ b/node_modules/snapdragon/lib/compiler.js @@ -0,0 +1,177 @@ +'use strict'; + +var use = require('use'); +var define = require('define-property'); +var debug = require('debug')('snapdragon:compiler'); +var utils = require('./utils'); + +/** + * Create a new `Compiler` with the given `options`. + * @param {Object} `options` + */ + +function Compiler(options, state) { + debug('initializing', __filename); + this.options = utils.extend({source: 'string'}, options); + this.state = state || {}; + this.compilers = {}; + this.output = ''; + this.set('eos', function(node) { + return this.emit(node.val, node); + }); + this.set('noop', function(node) { + return this.emit(node.val, node); + }); + this.set('bos', function(node) { + return this.emit(node.val, node); + }); + use(this); +} + +/** + * Prototype methods + */ + +Compiler.prototype = { + + /** + * Throw an error message with details including the cursor position. + * @param {String} `msg` Message to use in the Error. + */ + + error: function(msg, node) { + var pos = node.position || {start: {column: 0}}; + var message = this.options.source + ' column:' + pos.start.column + ': ' + msg; + + var err = new Error(message); + err.reason = msg; + err.column = pos.start.column; + err.source = this.pattern; + + if (this.options.silent) { + this.errors.push(err); + } else { + throw err; + } + }, + + /** + * Define a non-enumberable property on the `Compiler` instance. + * + * ```js + * compiler.define('foo', 'bar'); + * ``` + * @name .define + * @param {String} `key` propery name + * @param {any} `val` property value + * @return {Object} Returns the Compiler instance for chaining. + * @api public + */ + + define: function(key, val) { + define(this, key, val); + return this; + }, + + /** + * Emit `node.val` + */ + + emit: function(str, node) { + this.output += str; + return str; + }, + + /** + * Add a compiler `fn` with the given `name` + */ + + set: function(name, fn) { + this.compilers[name] = fn; + return this; + }, + + /** + * Get compiler `name`. + */ + + get: function(name) { + return this.compilers[name]; + }, + + /** + * Get the previous AST node. + */ + + prev: function(n) { + return this.ast.nodes[this.idx - (n || 1)] || { type: 'bos', val: '' }; + }, + + /** + * Get the next AST node. + */ + + next: function(n) { + return this.ast.nodes[this.idx + (n || 1)] || { type: 'eos', val: '' }; + }, + + /** + * Visit `node`. + */ + + visit: function(node, nodes, i) { + var fn = this.compilers[node.type]; + this.idx = i; + + if (typeof fn !== 'function') { + throw this.error('compiler "' + node.type + '" is not registered', node); + } + return fn.call(this, node, nodes, i); + }, + + /** + * Map visit over array of `nodes`. + */ + + mapVisit: function(nodes) { + if (!Array.isArray(nodes)) { + throw new TypeError('expected an array'); + } + var len = nodes.length; + var idx = -1; + while (++idx < len) { + this.visit(nodes[idx], nodes, idx); + } + return this; + }, + + /** + * Compile `ast`. + */ + + compile: function(ast, options) { + var opts = utils.extend({}, this.options, options); + this.ast = ast; + this.parsingErrors = this.ast.errors; + this.output = ''; + + // source map support + if (opts.sourcemap) { + var sourcemaps = require('./source-maps'); + sourcemaps(this); + this.mapVisit(this.ast.nodes); + this.applySourceMaps(); + this.map = opts.sourcemap === 'generator' ? this.map : this.map.toJSON(); + return this; + } + + this.mapVisit(this.ast.nodes); + return this; + } +}; + +/** + * Expose `Compiler` + */ + +module.exports = Compiler; diff --git a/node_modules/snapdragon/lib/parser.js b/node_modules/snapdragon/lib/parser.js new file mode 100644 index 0000000..a5a9b31 --- /dev/null +++ b/node_modules/snapdragon/lib/parser.js @@ -0,0 +1,533 @@ +'use strict'; + +var use = require('use'); +var util = require('util'); +var Cache = require('map-cache'); +var define = require('define-property'); +var debug = require('debug')('snapdragon:parser'); +var Position = require('./position'); +var utils = require('./utils'); + +/** + * Create a new `Parser` with the given `input` and `options`. + * @param {String} `input` + * @param {Object} `options` + * @api public + */ + +function Parser(options) { + debug('initializing', __filename); + this.options = utils.extend({source: 'string'}, options); + this.init(this.options); + use(this); +} + +/** + * Prototype methods + */ + +Parser.prototype = { + constructor: Parser, + + init: function(options) { + this.orig = ''; + this.input = ''; + this.parsed = ''; + + this.column = 1; + this.line = 1; + + this.regex = new Cache(); + this.errors = this.errors || []; + this.parsers = this.parsers || {}; + this.types = this.types || []; + this.sets = this.sets || {}; + this.fns = this.fns || []; + this.currentType = 'root'; + + var pos = this.position(); + this.bos = pos({type: 'bos', val: ''}); + + this.ast = { + type: 'root', + errors: this.errors, + nodes: [this.bos] + }; + + define(this.bos, 'parent', this.ast); + this.nodes = [this.ast]; + + this.count = 0; + this.setCount = 0; + this.stack = []; + }, + + /** + * Throw a formatted error with the cursor column and `msg`. + * @param {String} `msg` Message to use in the Error. + */ + + error: function(msg, node) { + var pos = node.position || {start: {column: 0, line: 0}}; + var line = pos.start.line; + var column = pos.start.column; + var source = this.options.source; + + var message = source + ' : ' + msg; + var err = new Error(message); + err.source = source; + err.reason = msg; + err.pos = pos; + + if (this.options.silent) { + this.errors.push(err); + } else { + throw err; + } + }, + + /** + * Define a non-enumberable property on the `Parser` instance. + * + * ```js + * parser.define('foo', 'bar'); + * ``` + * @name .define + * @param {String} `key` propery name + * @param {any} `val` property value + * @return {Object} Returns the Parser instance for chaining. + * @api public + */ + + define: function(key, val) { + define(this, key, val); + return this; + }, + + /** + * Mark position and patch `node.position`. + */ + + position: function() { + var start = { line: this.line, column: this.column }; + var self = this; + + return function(node) { + define(node, 'position', new Position(start, self)); + return node; + }; + }, + + /** + * Set parser `name` with the given `fn` + * @param {String} `name` + * @param {Function} `fn` + * @api public + */ + + set: function(type, fn) { + if (this.types.indexOf(type) === -1) { + this.types.push(type); + } + this.parsers[type] = fn.bind(this); + return this; + }, + + /** + * Get parser `name` + * @param {String} `name` + * @api public + */ + + get: function(name) { + return this.parsers[name]; + }, + + /** + * Push a `token` onto the `type` stack. + * + * @param {String} `type` + * @return {Object} `token` + * @api public + */ + + push: function(type, token) { + this.sets[type] = this.sets[type] || []; + this.count++; + this.stack.push(token); + return this.sets[type].push(token); + }, + + /** + * Pop a token off of the `type` stack + * @param {String} `type` + * @returns {Object} Returns a token + * @api public + */ + + pop: function(type) { + this.sets[type] = this.sets[type] || []; + this.count--; + this.stack.pop(); + return this.sets[type].pop(); + }, + + /** + * Return true if inside a `stack` node. Types are `braces`, `parens` or `brackets`. + * + * @param {String} `type` + * @return {Boolean} + * @api public + */ + + isInside: function(type) { + this.sets[type] = this.sets[type] || []; + return this.sets[type].length > 0; + }, + + /** + * Return true if `node` is the given `type`. + * + * ```js + * parser.isType(node, 'brace'); + * ``` + * @param {Object} `node` + * @param {String} `type` + * @return {Boolean} + * @api public + */ + + isType: function(node, type) { + return node && node.type === type; + }, + + /** + * Get the previous AST node + * @return {Object} + */ + + prev: function(n) { + return this.stack.length > 0 + ? utils.last(this.stack, n) + : utils.last(this.nodes, n); + }, + + /** + * Update line and column based on `str`. + */ + + consume: function(len) { + this.input = this.input.substr(len); + }, + + /** + * Update column based on `str`. + */ + + updatePosition: function(str, len) { + var lines = str.match(/\n/g); + if (lines) this.line += lines.length; + var i = str.lastIndexOf('\n'); + this.column = ~i ? len - i : this.column + len; + this.parsed += str; + this.consume(len); + }, + + /** + * Match `regex`, return captures, and update the cursor position by `match[0]` length. + * @param {RegExp} `regex` + * @return {Object} + */ + + match: function(regex) { + var m = regex.exec(this.input); + if (m) { + this.updatePosition(m[0], m[0].length); + return m; + } + }, + + /** + * Capture `type` with the given regex. + * @param {String} `type` + * @param {RegExp} `regex` + * @return {Function} + */ + + capture: function(type, regex) { + if (typeof regex === 'function') { + return this.set.apply(this, arguments); + } + + this.regex.set(type, regex); + this.set(type, function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(regex); + if (!m || !m[0]) return; + + var prev = this.prev(); + var node = pos({ + type: type, + val: m[0], + parsed: parsed, + rest: this.input + }); + + if (m[1]) { + node.inner = m[1]; + } + + define(node, 'inside', this.stack.length > 0); + define(node, 'parent', prev); + prev.nodes.push(node); + }.bind(this)); + return this; + }, + + /** + * Create a parser with open and close for parens, + * brackets or braces + */ + + capturePair: function(type, openRegex, closeRegex, fn) { + this.sets[type] = this.sets[type] || []; + + /** + * Open + */ + + this.set(type + '.open', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(openRegex); + if (!m || !m[0]) return; + + var val = m[0]; + this.setCount++; + this.specialChars = true; + var open = pos({ + type: type + '.open', + val: val, + rest: this.input + }); + + if (typeof m[1] !== 'undefined') { + open.inner = m[1]; + } + + var prev = this.prev(); + var node = pos({ + type: type, + nodes: [open] + }); + + define(node, 'rest', this.input); + define(node, 'parsed', parsed); + define(node, 'prefix', m[1]); + define(node, 'parent', prev); + define(open, 'parent', node); + + if (typeof fn === 'function') { + fn.call(this, open, node); + } + + this.push(type, node); + prev.nodes.push(node); + }); + + /** + * Close + */ + + this.set(type + '.close', function() { + var pos = this.position(); + var m = this.match(closeRegex); + if (!m || !m[0]) return; + + var parent = this.pop(type); + var node = pos({ + type: type + '.close', + rest: this.input, + suffix: m[1], + val: m[0] + }); + + if (!this.isType(parent, type)) { + if (this.options.strict) { + throw new Error('missing opening "' + type + '"'); + } + + this.setCount--; + node.escaped = true; + return node; + } + + if (node.suffix === '\\') { + parent.escaped = true; + node.escaped = true; + } + + parent.nodes.push(node); + define(node, 'parent', parent); + }); + + return this; + }, + + /** + * Capture end-of-string + */ + + eos: function() { + var pos = this.position(); + if (this.input) return; + var prev = this.prev(); + + while (prev.type !== 'root' && !prev.visited) { + if (this.options.strict === true) { + throw new SyntaxError('invalid syntax:' + util.inspect(prev, null, 2)); + } + + if (!hasDelims(prev)) { + prev.parent.escaped = true; + prev.escaped = true; + } + + visit(prev, function(node) { + if (!hasDelims(node.parent)) { + node.parent.escaped = true; + node.escaped = true; + } + }); + + prev = prev.parent; + } + + var tok = pos({ + type: 'eos', + val: this.append || '' + }); + + define(tok, 'parent', this.ast); + return tok; + }, + + /** + * Run parsers to advance the cursor position + */ + + next: function() { + var parsed = this.parsed; + var len = this.types.length; + var idx = -1; + var tok; + + while (++idx < len) { + if ((tok = this.parsers[this.types[idx]].call(this))) { + define(tok, 'rest', this.input); + define(tok, 'parsed', parsed); + this.last = tok; + return tok; + } + } + }, + + /** + * Parse the given string. + * @return {Array} + */ + + parse: function(input) { + if (typeof input !== 'string') { + throw new TypeError('expected a string'); + } + + this.init(this.options); + this.orig = input; + this.input = input; + var self = this; + + function parse() { + // check input before calling `.next()` + input = self.input; + + // get the next AST ndoe + var node = self.next(); + if (node) { + var prev = self.prev(); + if (prev) { + define(node, 'parent', prev); + if (prev.nodes) { + prev.nodes.push(node); + } + } + + if (self.sets.hasOwnProperty(prev.type)) { + self.currentType = prev.type; + } + } + + // if we got here but input is not changed, throw an error + if (self.input && input === self.input) { + throw new Error('no parsers registered for: "' + self.input.slice(0, 5) + '"'); + } + } + + while (this.input) parse(); + if (this.stack.length && this.options.strict) { + var node = this.stack.pop(); + throw this.error('missing opening ' + node.type + ': "' + this.orig + '"'); + } + + var eos = this.eos(); + var tok = this.prev(); + if (tok.type !== 'eos') { + this.ast.nodes.push(eos); + } + + return this.ast; + } +}; + +/** + * Visit `node` with the given `fn` + */ + +function visit(node, fn) { + if (!node.visited) { + define(node, 'visited', true); + return node.nodes ? mapVisit(node.nodes, fn) : fn(node); + } + return node; +} + +/** + * Map visit over array of `nodes`. + */ + +function mapVisit(nodes, fn) { + var len = nodes.length; + var idx = -1; + while (++idx < len) { + visit(nodes[idx], fn); + } +} + +function hasOpen(node) { + return node.nodes && node.nodes[0].type === (node.type + '.open'); +} + +function hasClose(node) { + return node.nodes && utils.last(node.nodes).type === (node.type + '.close'); +} + +function hasDelims(node) { + return hasOpen(node) && hasClose(node); +} + +/** + * Expose `Parser` + */ + +module.exports = Parser; diff --git a/node_modules/snapdragon/lib/position.js b/node_modules/snapdragon/lib/position.js new file mode 100644 index 0000000..c859696 --- /dev/null +++ b/node_modules/snapdragon/lib/position.js @@ -0,0 +1,14 @@ +'use strict'; + +var define = require('define-property'); + +/** + * Store position for a node + */ + +module.exports = function Position(start, parser) { + this.start = start; + this.end = { line: parser.line, column: parser.column }; + define(this, 'content', parser.orig); + define(this, 'source', parser.options.source); +}; diff --git a/node_modules/snapdragon/lib/source-maps.js b/node_modules/snapdragon/lib/source-maps.js new file mode 100644 index 0000000..d8e638b --- /dev/null +++ b/node_modules/snapdragon/lib/source-maps.js @@ -0,0 +1,145 @@ +'use strict'; + +var fs = require('fs'); +var path = require('path'); +var define = require('define-property'); +var utils = require('./utils'); + +/** + * Expose `mixin()`. + * This code is based on `source-maps-support.js` in reworkcss/css + * https://github.com/reworkcss/css/blob/master/lib/stringify/source-map-support.js + * Copyright (c) 2012 TJ Holowaychuk + */ + +module.exports = mixin; + +/** + * Mixin source map support into `compiler`. + * + * @param {Object} `compiler` + * @api public + */ + +function mixin(compiler) { + define(compiler, '_comment', compiler.comment); + compiler.map = new utils.SourceMap.SourceMapGenerator(); + compiler.position = { line: 1, column: 1 }; + compiler.content = {}; + compiler.files = {}; + + for (var key in exports) { + define(compiler, key, exports[key]); + } +} + +/** + * Update position. + * + * @param {String} str + */ + +exports.updatePosition = function(str) { + var lines = str.match(/\n/g); + if (lines) this.position.line += lines.length; + var i = str.lastIndexOf('\n'); + this.position.column = ~i ? str.length - i : this.position.column + str.length; +}; + +/** + * Emit `str` with `position`. + * + * @param {String} str + * @param {Object} [pos] + * @return {String} + */ + +exports.emit = function(str, node) { + var position = node.position || {}; + var source = position.source; + if (source) { + if (position.filepath) { + source = utils.unixify(position.filepath); + } + + this.map.addMapping({ + source: source, + generated: { + line: this.position.line, + column: Math.max(this.position.column - 1, 0) + }, + original: { + line: position.start.line, + column: position.start.column - 1 + } + }); + + if (position.content) { + this.addContent(source, position); + } + if (position.filepath) { + this.addFile(source, position); + } + + this.updatePosition(str); + this.output += str; + } + return str; +}; + +/** + * Adds a file to the source map output if it has not already been added + * @param {String} `file` + * @param {Object} `pos` + */ + +exports.addFile = function(file, position) { + if (typeof position.content !== 'string') return; + if (Object.prototype.hasOwnProperty.call(this.files, file)) return; + this.files[file] = position.content; +}; + +/** + * Adds a content source to the source map output if it has not already been added + * @param {String} `source` + * @param {Object} `position` + */ + +exports.addContent = function(source, position) { + if (typeof position.content !== 'string') return; + if (Object.prototype.hasOwnProperty.call(this.content, source)) return; + this.map.setSourceContent(source, position.content); +}; + +/** + * Applies any original source maps to the output and embeds the source file + * contents in the source map. + */ + +exports.applySourceMaps = function() { + Object.keys(this.files).forEach(function(file) { + var content = this.files[file]; + this.map.setSourceContent(file, content); + + if (this.options.inputSourcemaps === true) { + var originalMap = utils.sourceMapResolve.resolveSync(content, file, fs.readFileSync); + if (originalMap) { + var map = new utils.SourceMap.SourceMapConsumer(originalMap.map); + var relativeTo = originalMap.sourcesRelativeTo; + this.map.applySourceMap(map, file, utils.unixify(path.dirname(relativeTo))); + } + } + }, this); +}; + +/** + * Process comments, drops sourceMap comments. + * @param {Object} node + */ + +exports.comment = function(node) { + if (/^# sourceMappingURL=/.test(node.comment)) { + return this.emit('', node.position); + } + return this._comment(node); +}; diff --git a/node_modules/snapdragon/lib/utils.js b/node_modules/snapdragon/lib/utils.js new file mode 100644 index 0000000..33f07e1 --- /dev/null +++ b/node_modules/snapdragon/lib/utils.js @@ -0,0 +1,48 @@ +'use strict'; + +/** + * Module dependencies + */ + +exports.extend = require('extend-shallow'); +exports.SourceMap = require('source-map'); +exports.sourceMapResolve = require('source-map-resolve'); + +/** + * Convert backslash in the given string to forward slashes + */ + +exports.unixify = function(fp) { + return fp.split(/\\+/).join('/'); +}; + +/** + * Return true if `val` is a non-empty string + * + * @param {String} `str` + * @return {Boolean} + */ + +exports.isString = function(str) { + return str && typeof str === 'string'; +}; + +/** + * Cast `val` to an array + * @return {Array} + */ + +exports.arrayify = function(val) { + if (typeof val === 'string') return [val]; + return val ? (Array.isArray(val) ? val : [val]) : []; +}; + +/** + * Get the last `n` element from the given `array` + * @param {Array} `array` + * @return {*} + */ + +exports.last = function(arr, n) { + return arr[arr.length - (n || 1)]; +}; diff --git a/node_modules/snapdragon/node_modules/define-property/LICENSE b/node_modules/snapdragon/node_modules/define-property/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/node_modules/snapdragon/node_modules/define-property/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 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/node_modules/snapdragon/node_modules/define-property/README.md b/node_modules/snapdragon/node_modules/define-property/README.md new file mode 100644 index 0000000..8cac698 --- /dev/null +++ b/node_modules/snapdragon/node_modules/define-property/README.md @@ -0,0 +1,77 @@ +# define-property [![NPM version](https://badge.fury.io/js/define-property.svg)](http://badge.fury.io/js/define-property) + +> Define a non-enumerable property on an object. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i define-property --save +``` + +## Usage + +**Params** + +* `obj`: The object on which to define the property. +* `prop`: The name of the property to be defined or modified. +* `descriptor`: The descriptor for the property being defined or modified. + +```js +var define = require('define-property'); +var obj = {}; +define(obj, 'foo', function(val) { + return val.toUpperCase(); +}); + +console.log(obj); +//=> {} + +console.log(obj.foo('bar')); +//=> 'BAR' +``` + +**get/set** + +```js +define(obj, 'foo', { + get: function() {}, + set: function() {} +}); +``` + +## Related projects + +* [delegate-object](https://www.npmjs.com/package/delegate-object): Copy properties from an object to another object, where properties with function values will be… [more](https://www.npmjs.com/package/delegate-object) | [homepage](https://github.com/doowb/delegate-object) +* [forward-object](https://www.npmjs.com/package/forward-object): Copy properties from an object to another object, where properties with function values will be… [more](https://www.npmjs.com/package/forward-object) | [homepage](https://github.com/doowb/forward-object) +* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep) +* [mixin-object](https://www.npmjs.com/package/mixin-object): Mixin the own and inherited properties of other objects onto the first object. Pass an… [more](https://www.npmjs.com/package/mixin-object) | [homepage](https://github.com/jonschlinkert/mixin-object) + +## Running tests + +Install dev dependencies: + +```sh +$ 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/define-property/issues/new). + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 Jon Schlinkert +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 31, 2015._ diff --git a/node_modules/snapdragon/node_modules/define-property/index.js b/node_modules/snapdragon/node_modules/define-property/index.js new file mode 100644 index 0000000..3e0e5e1 --- /dev/null +++ b/node_modules/snapdragon/node_modules/define-property/index.js @@ -0,0 +1,31 @@ +/*! + * define-property + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var isDescriptor = require('is-descriptor'); + +module.exports = function defineProperty(obj, prop, val) { + if (typeof obj !== 'object' && typeof obj !== 'function') { + throw new TypeError('expected an object or function.'); + } + + if (typeof prop !== 'string') { + throw new TypeError('expected `prop` to be a string.'); + } + + if (isDescriptor(val) && ('set' in val || 'get' in val)) { + return Object.defineProperty(obj, prop, val); + } + + return Object.defineProperty(obj, prop, { + configurable: true, + enumerable: false, + writable: true, + value: val + }); +}; diff --git a/node_modules/snapdragon/node_modules/define-property/package.json b/node_modules/snapdragon/node_modules/define-property/package.json new file mode 100644 index 0000000..7b3a41b --- /dev/null +++ b/node_modules/snapdragon/node_modules/define-property/package.json @@ -0,0 +1,82 @@ +{ + "_from": "define-property@^0.2.5", + "_id": "define-property@0.2.5", + "_inBundle": false, + "_integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "_location": "/snapdragon/define-property", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "define-property@^0.2.5", + "name": "define-property", + "escapedName": "define-property", + "rawSpec": "^0.2.5", + "saveSpec": null, + "fetchSpec": "^0.2.5" + }, + "_requiredBy": [ + "/snapdragon" + ], + "_resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "_shasum": "c35b1ef918ec3c990f9a5bc57be04aacec5c8116", + "_spec": "define-property@^0.2.5", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/snapdragon", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/define-property/issues" + }, + "bundleDependencies": false, + "dependencies": { + "is-descriptor": "^0.1.0" + }, + "deprecated": false, + "description": "Define a non-enumerable property on an object.", + "devDependencies": { + "mocha": "*", + "should": "^7.0.4" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/define-property", + "keywords": [ + "define", + "define-property", + "enumerable", + "key", + "non", + "non-enumerable", + "object", + "prop", + "property", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "define-property", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/define-property.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "mixin-deep", + "mixin-object", + "delegate-object", + "forward-object" + ] + } + }, + "version": "0.2.5" +} diff --git a/node_modules/snapdragon/node_modules/extend-shallow/LICENSE b/node_modules/snapdragon/node_modules/extend-shallow/LICENSE new file mode 100644 index 0000000..fa30c4c --- /dev/null +++ b/node_modules/snapdragon/node_modules/extend-shallow/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2015, 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/node_modules/snapdragon/node_modules/extend-shallow/README.md b/node_modules/snapdragon/node_modules/extend-shallow/README.md new file mode 100644 index 0000000..cdc45d4 --- /dev/null +++ b/node_modules/snapdragon/node_modules/extend-shallow/README.md @@ -0,0 +1,61 @@ +# extend-shallow [![NPM version](https://badge.fury.io/js/extend-shallow.svg)](http://badge.fury.io/js/extend-shallow) [![Build Status](https://travis-ci.org/jonschlinkert/extend-shallow.svg)](https://travis-ci.org/jonschlinkert/extend-shallow) + +> Extend an object with the properties of additional objects. node.js/javascript util. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i extend-shallow --save +``` + +## Usage + +```js +var extend = require('extend-shallow'); + +extend({a: 'b'}, {c: 'd'}) +//=> {a: 'b', c: 'd'} +``` + +Pass an empty object to shallow clone: + +```js +var obj = {}; +extend(obj, {a: 'b'}, {c: 'd'}) +//=> {a: 'b', c: 'd'} +``` + +## Related + +* [extend-shallow](https://github.com/jonschlinkert/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. +* [for-own](https://github.com/jonschlinkert/for-own): Iterate over the own enumerable properties of an object, and return an object with properties… [more](https://github.com/jonschlinkert/for-own) +* [for-in](https://github.com/jonschlinkert/for-in): Iterate over the own and inherited enumerable properties of an objecte, and return an object… [more](https://github.com/jonschlinkert/for-in) +* [is-plain-object](https://github.com/jonschlinkert/is-plain-object): Returns true if an object was created by the `Object` constructor. +* [isobject](https://github.com/jonschlinkert/isobject): Returns true if the value is an object and not an array or null. +* [kind-of](https://github.com/jonschlinkert/kind-of): Get the native type of a value. + +## Running tests + +Install dev dependencies: + +```sh +$ npm i -d && npm test +``` + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 Jon Schlinkert +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 29, 2015._ \ No newline at end of file diff --git a/node_modules/snapdragon/node_modules/extend-shallow/index.js b/node_modules/snapdragon/node_modules/extend-shallow/index.js new file mode 100644 index 0000000..92a067f --- /dev/null +++ b/node_modules/snapdragon/node_modules/extend-shallow/index.js @@ -0,0 +1,33 @@ +'use strict'; + +var isObject = require('is-extendable'); + +module.exports = function extend(o/*, objects*/) { + if (!isObject(o)) { o = {}; } + + var len = arguments.length; + for (var i = 1; i < len; i++) { + var obj = arguments[i]; + + if (isObject(obj)) { + assign(o, obj); + } + } + return o; +}; + +function assign(a, b) { + for (var key in b) { + if (hasOwn(b, key)) { + a[key] = b[key]; + } + } +} + +/** + * Returns true if the given `key` is an own property of `obj`. + */ + +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} diff --git a/node_modules/snapdragon/node_modules/extend-shallow/package.json b/node_modules/snapdragon/node_modules/extend-shallow/package.json new file mode 100644 index 0000000..ebdc825 --- /dev/null +++ b/node_modules/snapdragon/node_modules/extend-shallow/package.json @@ -0,0 +1,87 @@ +{ + "_from": "extend-shallow@^2.0.1", + "_id": "extend-shallow@2.0.1", + "_inBundle": false, + "_integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "_location": "/snapdragon/extend-shallow", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "extend-shallow@^2.0.1", + "name": "extend-shallow", + "escapedName": "extend-shallow", + "rawSpec": "^2.0.1", + "saveSpec": null, + "fetchSpec": "^2.0.1" + }, + "_requiredBy": [ + "/snapdragon" + ], + "_resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "_shasum": "51af7d614ad9a9f610ea1bafbb989d6b1c56890f", + "_spec": "extend-shallow@^2.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/snapdragon", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/extend-shallow/issues" + }, + "bundleDependencies": false, + "dependencies": { + "is-extendable": "^0.1.0" + }, + "deprecated": false, + "description": "Extend an object with the properties of additional objects. node.js/javascript util.", + "devDependencies": { + "array-slice": "^0.2.3", + "benchmarked": "^0.1.4", + "chalk": "^1.0.0", + "for-own": "^0.1.3", + "glob": "^5.0.12", + "is-plain-object": "^2.0.1", + "kind-of": "^2.0.0", + "minimist": "^1.1.1", + "mocha": "^2.2.5", + "should": "^7.0.1" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/extend-shallow", + "keywords": [ + "assign", + "extend", + "javascript", + "js", + "keys", + "merge", + "obj", + "object", + "prop", + "properties", + "property", + "props", + "shallow", + "util", + "utility", + "utils", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "extend-shallow", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/extend-shallow.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "2.0.1" +} diff --git a/node_modules/snapdragon/node_modules/is-accessor-descriptor/LICENSE b/node_modules/snapdragon/node_modules/is-accessor-descriptor/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-accessor-descriptor/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 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/node_modules/snapdragon/node_modules/is-accessor-descriptor/README.md b/node_modules/snapdragon/node_modules/is-accessor-descriptor/README.md new file mode 100644 index 0000000..3743fe6 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-accessor-descriptor/README.md @@ -0,0 +1,123 @@ +# is-accessor-descriptor [![NPM version](https://img.shields.io/npm/v/is-accessor-descriptor.svg)](https://www.npmjs.com/package/is-accessor-descriptor) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-accessor-descriptor.svg)](https://travis-ci.org/jonschlinkert/is-accessor-descriptor) + +> Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. + +- [Install](#install) +- [Usage](#usage) +- [Examples](#examples) +- [API](#api) +- [Related projects](#related-projects) +- [Running tests](#running-tests) +- [Contributing](#contributing) +- [Author](#author) +- [License](#license) + +_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm i is-accessor-descriptor --save +``` + +## Usage + +```js +var isAccessor = require('is-accessor-descriptor'); + +isAccessor({get: function() {}}); +//=> true +``` + +You may also pass an object and property name to check if the property is an accessor: + +```js +isAccessor(foo, 'bar'); +``` + +## Examples + +`false` when not an object + +```js +isAccessor('a') +isAccessor(null) +isAccessor([]) +//=> false +``` + +`true` when the object has valid properties + +and the properties all have the correct JavaScript types: + +```js +isAccessor({get: noop, set: noop}) +isAccessor({get: noop}) +isAccessor({set: noop}) +//=> true +``` + +`false` when the object has invalid properties + +```js +isAccessor({get: noop, set: noop, bar: 'baz'}) +isAccessor({get: noop, writable: true}) +isAccessor({get: noop, value: true}) +//=> false +``` + +`false` when an accessor is not a function + +```js +isAccessor({get: noop, set: 'baz'}) +isAccessor({get: 'foo', set: noop}) +isAccessor({get: 'foo', bar: 'baz'}) +isAccessor({get: 'foo', set: 'baz'}) +//=> false +``` + +`false` when a value is not the correct type + +```js +isAccessor({get: noop, set: noop, enumerable: 'foo'}) +isAccessor({set: noop, configurable: 'foo'}) +isAccessor({get: noop, configurable: 'foo'}) +//=> false +``` + +## Related projects + +* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor) +* [is-data-descriptor](https://www.npmjs.com/package/is-data-descriptor): Returns true if a value has the characteristics of a valid JavaScript data descriptor. | [homepage](https://github.com/jonschlinkert/is-data-descriptor) +* [is-descriptor](https://www.npmjs.com/package/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://www.npmjs.com/package/is-descriptor) | [homepage](https://github.com/jonschlinkert/is-descriptor) +* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject) + +## Running tests + +Install dev dependencies: + +```sh +$ 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-accessor-descriptor/issues/new). + +## Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert) +Released under the MIT license. + +*** + +_This file was generated by [verb](https://github.com/verbose/verb) on December 28, 2015._ \ No newline at end of file diff --git a/node_modules/snapdragon/node_modules/is-accessor-descriptor/index.js b/node_modules/snapdragon/node_modules/is-accessor-descriptor/index.js new file mode 100644 index 0000000..2ca4af8 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-accessor-descriptor/index.js @@ -0,0 +1,69 @@ +/*! + * is-accessor-descriptor + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var typeOf = require('kind-of'); + +// accessor descriptor properties +var accessor = { + get: 'function', + set: 'function', + configurable: 'boolean', + enumerable: 'boolean' +}; + +function isAccessorDescriptor(obj, prop) { + if (typeof prop === 'string') { + var val = Object.getOwnPropertyDescriptor(obj, prop); + return typeof val !== 'undefined'; + } + + if (typeOf(obj) !== 'object') { + return false; + } + + if (has(obj, 'value') || has(obj, 'writable')) { + return false; + } + + if (!has(obj, 'get') || typeof obj.get !== 'function') { + return false; + } + + // tldr: it's valid to have "set" be undefined + // "set" might be undefined if `Object.getOwnPropertyDescriptor` + // was used to get the value, and only `get` was defined by the user + if (has(obj, 'set') && typeof obj[key] !== 'function' && typeof obj[key] !== 'undefined') { + return false; + } + + for (var key in obj) { + if (!accessor.hasOwnProperty(key)) { + continue; + } + + if (typeOf(obj[key]) === accessor[key]) { + continue; + } + + if (typeof obj[key] !== 'undefined') { + return false; + } + } + return true; +} + +function has(obj, key) { + return {}.hasOwnProperty.call(obj, key); +} + +/** + * Expose `isAccessorDescriptor` + */ + +module.exports = isAccessorDescriptor; diff --git a/node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/LICENSE b/node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/LICENSE new file mode 100644 index 0000000..d734237 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, 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/node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/README.md b/node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/README.md new file mode 100644 index 0000000..6a9df36 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/README.md @@ -0,0 +1,261 @@ +# kind-of [![NPM version](https://img.shields.io/npm/v/kind-of.svg?style=flat)](https://www.npmjs.com/package/kind-of) [![NPM monthly downloads](https://img.shields.io/npm/dm/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![NPM total downloads](https://img.shields.io/npm/dt/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/kind-of.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/kind-of) + +> Get the native type of a value. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save kind-of +``` + +## Install + +Install with [bower](https://bower.io/) + +```sh +$ bower install kind-of --save +``` + +## Usage + +> es5, browser and es6 ready + +```js +var kindOf = require('kind-of'); + +kindOf(undefined); +//=> 'undefined' + +kindOf(null); +//=> 'null' + +kindOf(true); +//=> 'boolean' + +kindOf(false); +//=> 'boolean' + +kindOf(new Boolean(true)); +//=> 'boolean' + +kindOf(new Buffer('')); +//=> 'buffer' + +kindOf(42); +//=> 'number' + +kindOf(new Number(42)); +//=> 'number' + +kindOf('str'); +//=> 'string' + +kindOf(new String('str')); +//=> 'string' + +kindOf(arguments); +//=> 'arguments' + +kindOf({}); +//=> 'object' + +kindOf(Object.create(null)); +//=> 'object' + +kindOf(new Test()); +//=> 'object' + +kindOf(new Date()); +//=> 'date' + +kindOf([]); +//=> 'array' + +kindOf([1, 2, 3]); +//=> 'array' + +kindOf(new Array()); +//=> 'array' + +kindOf(/foo/); +//=> 'regexp' + +kindOf(new RegExp('foo')); +//=> 'regexp' + +kindOf(function () {}); +//=> 'function' + +kindOf(function * () {}); +//=> 'function' + +kindOf(new Function()); +//=> 'function' + +kindOf(new Map()); +//=> 'map' + +kindOf(new WeakMap()); +//=> 'weakmap' + +kindOf(new Set()); +//=> 'set' + +kindOf(new WeakSet()); +//=> 'weakset' + +kindOf(Symbol('str')); +//=> 'symbol' + +kindOf(new Int8Array()); +//=> 'int8array' + +kindOf(new Uint8Array()); +//=> 'uint8array' + +kindOf(new Uint8ClampedArray()); +//=> 'uint8clampedarray' + +kindOf(new Int16Array()); +//=> 'int16array' + +kindOf(new Uint16Array()); +//=> 'uint16array' + +kindOf(new Int32Array()); +//=> 'int32array' + +kindOf(new Uint32Array()); +//=> 'uint32array' + +kindOf(new Float32Array()); +//=> 'float32array' + +kindOf(new Float64Array()); +//=> 'float64array' +``` + +## Benchmarks + +Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of). +Note that performaces is slower for es6 features `Map`, `WeakMap`, `Set` and `WeakSet`. + +```bash +#1: array + current x 23,329,397 ops/sec ±0.82% (94 runs sampled) + lib-type-of x 4,170,273 ops/sec ±0.55% (94 runs sampled) + lib-typeof x 9,686,935 ops/sec ±0.59% (98 runs sampled) + +#2: boolean + current x 27,197,115 ops/sec ±0.85% (94 runs sampled) + lib-type-of x 3,145,791 ops/sec ±0.73% (97 runs sampled) + lib-typeof x 9,199,562 ops/sec ±0.44% (99 runs sampled) + +#3: date + current x 20,190,117 ops/sec ±0.86% (92 runs sampled) + lib-type-of x 5,166,970 ops/sec ±0.74% (94 runs sampled) + lib-typeof x 9,610,821 ops/sec ±0.50% (96 runs sampled) + +#4: function + current x 23,855,460 ops/sec ±0.60% (97 runs sampled) + lib-type-of x 5,667,740 ops/sec ±0.54% (100 runs sampled) + lib-typeof x 10,010,644 ops/sec ±0.44% (100 runs sampled) + +#5: null + current x 27,061,047 ops/sec ±0.97% (96 runs sampled) + lib-type-of x 13,965,573 ops/sec ±0.62% (97 runs sampled) + lib-typeof x 8,460,194 ops/sec ±0.61% (97 runs sampled) + +#6: number + current x 25,075,682 ops/sec ±0.53% (99 runs sampled) + lib-type-of x 2,266,405 ops/sec ±0.41% (98 runs sampled) + lib-typeof x 9,821,481 ops/sec ±0.45% (99 runs sampled) + +#7: object + current x 3,348,980 ops/sec ±0.49% (99 runs sampled) + lib-type-of x 3,245,138 ops/sec ±0.60% (94 runs sampled) + lib-typeof x 9,262,952 ops/sec ±0.59% (99 runs sampled) + +#8: regex + current x 21,284,827 ops/sec ±0.72% (96 runs sampled) + lib-type-of x 4,689,241 ops/sec ±0.43% (100 runs sampled) + lib-typeof x 8,957,593 ops/sec ±0.62% (98 runs sampled) + +#9: string + current x 25,379,234 ops/sec ±0.58% (96 runs sampled) + lib-type-of x 3,635,148 ops/sec ±0.76% (93 runs sampled) + lib-typeof x 9,494,134 ops/sec ±0.49% (98 runs sampled) + +#10: undef + current x 27,459,221 ops/sec ±1.01% (93 runs sampled) + lib-type-of x 14,360,433 ops/sec ±0.52% (99 runs sampled) + lib-typeof x 23,202,868 ops/sec ±0.59% (94 runs sampled) + +``` + +## Optimizations + +In 7 out of 8 cases, this library is 2x-10x faster than other top libraries included in the benchmarks. There are a few things that lead to this performance advantage, none of them hard and fast rules, but all of them simple and repeatable in almost any code library: + +1. Optimize around the fastest and most common use cases first. Of course, this will change from project-to-project, but I took some time to understand how and why `typeof` checks were being used in my own libraries and other libraries I use a lot. +2. Optimize around bottlenecks - In other words, the order in which conditionals are implemented is significant, because each check is only as fast as the failing checks that came before it. Here, the biggest bottleneck by far is checking for plain objects (an object that was created by the `Object` constructor). I opted to make this check happen by process of elimination rather than brute force up front (e.g. by using something like `val.constructor.name`), so that every other type check would not be penalized it. +3. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'` + +## About + +### Related projects + +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number "Returns true if the value is a number. comprehensive tests.") +* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 59 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [miguelmota](https://github.com/miguelmota) | +| 1 | [dtothefp](https://github.com/dtothefp) | +| 1 | [ksheedlo](https://github.com/ksheedlo) | +| 1 | [pdehaan](https://github.com/pdehaan) | +| 1 | [laggingreflex](https://github.com/laggingreflex) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 16, 2017._ \ No newline at end of file diff --git a/node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js b/node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js new file mode 100644 index 0000000..b52c291 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js @@ -0,0 +1,116 @@ +var isBuffer = require('is-buffer'); +var toString = Object.prototype.toString; + +/** + * Get the native `typeof` a value. + * + * @param {*} `val` + * @return {*} Native javascript type + */ + +module.exports = function kindOf(val) { + // primitivies + if (typeof val === 'undefined') { + return 'undefined'; + } + if (val === null) { + return 'null'; + } + if (val === true || val === false || val instanceof Boolean) { + return 'boolean'; + } + if (typeof val === 'string' || val instanceof String) { + return 'string'; + } + if (typeof val === 'number' || val instanceof Number) { + return 'number'; + } + + // functions + if (typeof val === 'function' || val instanceof Function) { + return 'function'; + } + + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; + } + + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } + + // other objects + var type = toString.call(val); + + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + if (type === '[object Error]') { + return 'error'; + } + + // buffer + if (isBuffer(val)) { + return 'buffer'; + } + + // es6: Map, WeakMap, Set, WeakSet + if (type === '[object Set]') { + return 'set'; + } + if (type === '[object WeakSet]') { + return 'weakset'; + } + if (type === '[object Map]') { + return 'map'; + } + if (type === '[object WeakMap]') { + return 'weakmap'; + } + if (type === '[object Symbol]') { + return 'symbol'; + } + + // typed arrays + if (type === '[object Int8Array]') { + return 'int8array'; + } + if (type === '[object Uint8Array]') { + return 'uint8array'; + } + if (type === '[object Uint8ClampedArray]') { + return 'uint8clampedarray'; + } + if (type === '[object Int16Array]') { + return 'int16array'; + } + if (type === '[object Uint16Array]') { + return 'uint16array'; + } + if (type === '[object Int32Array]') { + return 'int32array'; + } + if (type === '[object Uint32Array]') { + return 'uint32array'; + } + if (type === '[object Float32Array]') { + return 'float32array'; + } + if (type === '[object Float64Array]') { + return 'float64array'; + } + + // must be a plain object + return 'object'; +}; diff --git a/node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/package.json b/node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/package.json new file mode 100644 index 0000000..b051d06 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of/package.json @@ -0,0 +1,139 @@ +{ + "_from": "kind-of@^3.0.2", + "_id": "kind-of@3.2.2", + "_inBundle": false, + "_integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "_location": "/snapdragon/is-accessor-descriptor/kind-of", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "kind-of@^3.0.2", + "name": "kind-of", + "escapedName": "kind-of", + "rawSpec": "^3.0.2", + "saveSpec": null, + "fetchSpec": "^3.0.2" + }, + "_requiredBy": [ + "/snapdragon/is-accessor-descriptor" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "_shasum": "31ea21a734bab9bbb0f32466d893aea51e4a3c64", + "_spec": "kind-of@^3.0.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/snapdragon/node_modules/is-accessor-descriptor", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/kind-of/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "David Fox-Powell", + "url": "https://dtothefp.github.io/me" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Ken Sheedlo", + "url": "kensheedlo.com" + }, + { + "name": "laggingreflex", + "url": "https://github.com/laggingreflex" + }, + { + "name": "Miguel Mota", + "url": "https://miguelmota.com" + }, + { + "name": "Peter deHaan", + "url": "http://about.me/peterdehaan" + } + ], + "dependencies": { + "is-buffer": "^1.1.5" + }, + "deprecated": false, + "description": "Get the native type of a value.", + "devDependencies": { + "ansi-bold": "^0.1.1", + "benchmarked": "^1.0.0", + "browserify": "^14.3.0", + "glob": "^7.1.1", + "gulp-format-md": "^0.1.12", + "mocha": "^3.3.0", + "type-of": "^2.0.1", + "typeof": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/kind-of", + "keywords": [ + "arguments", + "array", + "boolean", + "check", + "date", + "function", + "is", + "is-type", + "is-type-of", + "kind", + "kind-of", + "number", + "object", + "of", + "regexp", + "string", + "test", + "type", + "type-of", + "typeof", + "types" + ], + "license": "MIT", + "main": "index.js", + "name": "kind-of", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/kind-of.git" + }, + "scripts": { + "prepublish": "browserify -o browser.js -e index.js -s index --bare", + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-glob", + "is-number", + "is-primitive" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb" + ] + }, + "version": "3.2.2" +} diff --git a/node_modules/snapdragon/node_modules/is-accessor-descriptor/package.json b/node_modules/snapdragon/node_modules/is-accessor-descriptor/package.json new file mode 100644 index 0000000..d50d598 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-accessor-descriptor/package.json @@ -0,0 +1,94 @@ +{ + "_from": "is-accessor-descriptor@^0.1.6", + "_id": "is-accessor-descriptor@0.1.6", + "_inBundle": false, + "_integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "_location": "/snapdragon/is-accessor-descriptor", + "_phantomChildren": { + "is-buffer": "1.1.6" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-accessor-descriptor@^0.1.6", + "name": "is-accessor-descriptor", + "escapedName": "is-accessor-descriptor", + "rawSpec": "^0.1.6", + "saveSpec": null, + "fetchSpec": "^0.1.6" + }, + "_requiredBy": [ + "/snapdragon/is-descriptor" + ], + "_resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "_shasum": "a9e12cb3ae8d876727eeef3843f8a0897b5c98d6", + "_spec": "is-accessor-descriptor@^0.1.6", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/snapdragon/node_modules/is-descriptor", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-accessor-descriptor/issues" + }, + "bundleDependencies": false, + "dependencies": { + "kind-of": "^3.0.2" + }, + "deprecated": false, + "description": "Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/is-accessor-descriptor", + "keywords": [ + "accessor", + "check", + "data", + "descriptor", + "get", + "getter", + "is", + "keys", + "object", + "properties", + "property", + "set", + "setter", + "type", + "valid", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "is-accessor-descriptor", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/is-accessor-descriptor.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-accessor-descriptor", + "is-data-descriptor", + "is-descriptor", + "isobject" + ] + }, + "plugins": [ + "gulp-format-md" + ], + "layout": "default" + }, + "version": "0.1.6" +} diff --git a/node_modules/snapdragon/node_modules/is-data-descriptor/LICENSE b/node_modules/snapdragon/node_modules/is-data-descriptor/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-data-descriptor/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 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/node_modules/snapdragon/node_modules/is-data-descriptor/README.md b/node_modules/snapdragon/node_modules/is-data-descriptor/README.md new file mode 100644 index 0000000..41e1643 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-data-descriptor/README.md @@ -0,0 +1,128 @@ +# is-data-descriptor [![NPM version](https://img.shields.io/npm/v/is-data-descriptor.svg)](https://www.npmjs.com/package/is-data-descriptor) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-data-descriptor.svg)](https://travis-ci.org/jonschlinkert/is-data-descriptor) + +> Returns true if a value has the characteristics of a valid JavaScript data descriptor. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm i is-data-descriptor --save +``` + +## Usage + +```js +var isDataDesc = require('is-data-descriptor'); +``` + +## Examples + +`true` when the descriptor has valid properties with valid values. + +```js +// `value` can be anything +isDataDesc({value: 'foo'}) +isDataDesc({value: function() {}}) +isDataDesc({value: true}) +//=> true +``` + +`false` when not an object + +```js +isDataDesc('a') +//=> false +isDataDesc(null) +//=> false +isDataDesc([]) +//=> false +``` + +`false` when the object has invalid properties + +```js +isDataDesc({value: 'foo', bar: 'baz'}) +//=> false +isDataDesc({value: 'foo', bar: 'baz'}) +//=> false +isDataDesc({value: 'foo', get: function(){}}) +//=> false +isDataDesc({get: function(){}, value: 'foo'}) +//=> false +``` + +`false` when a value is not the correct type + +```js +isDataDesc({value: 'foo', enumerable: 'foo'}) +//=> false +isDataDesc({value: 'foo', configurable: 'foo'}) +//=> false +isDataDesc({value: 'foo', writable: 'foo'}) +//=> false +``` + +## Valid properties + +The only valid data descriptor properties are the following: + +* `configurable` (required) +* `enumerable` (required) +* `value` (optional) +* `writable` (optional) + +To be a valid data descriptor, either `value` or `writable` must be defined. + +**Invalid properties** + +A descriptor may have additional _invalid_ properties (an error will **not** be thrown). + +```js +var foo = {}; + +Object.defineProperty(foo, 'bar', { + enumerable: true, + whatever: 'blah', // invalid, but doesn't cause an error + get: function() { + return 'baz'; + } +}); + +console.log(foo.bar); +//=> 'baz' +``` + +## Related projects + +* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor) +* [is-descriptor](https://www.npmjs.com/package/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://www.npmjs.com/package/is-descriptor) | [homepage](https://github.com/jonschlinkert/is-descriptor) +* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject) + +## Running tests + +Install dev dependencies: + +```sh +$ 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-data-descriptor/issues/new). + +## Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert) +Released under the MIT license. + +*** + +_This file was generated by [verb](https://github.com/verbose/verb) on December 28, 2015._ \ No newline at end of file diff --git a/node_modules/snapdragon/node_modules/is-data-descriptor/index.js b/node_modules/snapdragon/node_modules/is-data-descriptor/index.js new file mode 100644 index 0000000..d4d09c9 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-data-descriptor/index.js @@ -0,0 +1,55 @@ +/*! + * is-data-descriptor + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var typeOf = require('kind-of'); + +// data descriptor properties +var data = { + configurable: 'boolean', + enumerable: 'boolean', + writable: 'boolean' +}; + +function isDataDescriptor(obj, prop) { + if (typeOf(obj) !== 'object') { + return false; + } + + if (typeof prop === 'string') { + var val = Object.getOwnPropertyDescriptor(obj, prop); + return typeof val !== 'undefined'; + } + + if (!('value' in obj) && !('writable' in obj)) { + return false; + } + + for (var key in obj) { + if (key === 'value') continue; + + if (!data.hasOwnProperty(key)) { + continue; + } + + if (typeOf(obj[key]) === data[key]) { + continue; + } + + if (typeof obj[key] !== 'undefined') { + return false; + } + } + return true; +} + +/** + * Expose `isDataDescriptor` + */ + +module.exports = isDataDescriptor; diff --git a/node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/LICENSE b/node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/LICENSE new file mode 100644 index 0000000..d734237 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, 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/node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/README.md b/node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/README.md new file mode 100644 index 0000000..6a9df36 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/README.md @@ -0,0 +1,261 @@ +# kind-of [![NPM version](https://img.shields.io/npm/v/kind-of.svg?style=flat)](https://www.npmjs.com/package/kind-of) [![NPM monthly downloads](https://img.shields.io/npm/dm/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![NPM total downloads](https://img.shields.io/npm/dt/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/kind-of.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/kind-of) + +> Get the native type of a value. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save kind-of +``` + +## Install + +Install with [bower](https://bower.io/) + +```sh +$ bower install kind-of --save +``` + +## Usage + +> es5, browser and es6 ready + +```js +var kindOf = require('kind-of'); + +kindOf(undefined); +//=> 'undefined' + +kindOf(null); +//=> 'null' + +kindOf(true); +//=> 'boolean' + +kindOf(false); +//=> 'boolean' + +kindOf(new Boolean(true)); +//=> 'boolean' + +kindOf(new Buffer('')); +//=> 'buffer' + +kindOf(42); +//=> 'number' + +kindOf(new Number(42)); +//=> 'number' + +kindOf('str'); +//=> 'string' + +kindOf(new String('str')); +//=> 'string' + +kindOf(arguments); +//=> 'arguments' + +kindOf({}); +//=> 'object' + +kindOf(Object.create(null)); +//=> 'object' + +kindOf(new Test()); +//=> 'object' + +kindOf(new Date()); +//=> 'date' + +kindOf([]); +//=> 'array' + +kindOf([1, 2, 3]); +//=> 'array' + +kindOf(new Array()); +//=> 'array' + +kindOf(/foo/); +//=> 'regexp' + +kindOf(new RegExp('foo')); +//=> 'regexp' + +kindOf(function () {}); +//=> 'function' + +kindOf(function * () {}); +//=> 'function' + +kindOf(new Function()); +//=> 'function' + +kindOf(new Map()); +//=> 'map' + +kindOf(new WeakMap()); +//=> 'weakmap' + +kindOf(new Set()); +//=> 'set' + +kindOf(new WeakSet()); +//=> 'weakset' + +kindOf(Symbol('str')); +//=> 'symbol' + +kindOf(new Int8Array()); +//=> 'int8array' + +kindOf(new Uint8Array()); +//=> 'uint8array' + +kindOf(new Uint8ClampedArray()); +//=> 'uint8clampedarray' + +kindOf(new Int16Array()); +//=> 'int16array' + +kindOf(new Uint16Array()); +//=> 'uint16array' + +kindOf(new Int32Array()); +//=> 'int32array' + +kindOf(new Uint32Array()); +//=> 'uint32array' + +kindOf(new Float32Array()); +//=> 'float32array' + +kindOf(new Float64Array()); +//=> 'float64array' +``` + +## Benchmarks + +Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of). +Note that performaces is slower for es6 features `Map`, `WeakMap`, `Set` and `WeakSet`. + +```bash +#1: array + current x 23,329,397 ops/sec ±0.82% (94 runs sampled) + lib-type-of x 4,170,273 ops/sec ±0.55% (94 runs sampled) + lib-typeof x 9,686,935 ops/sec ±0.59% (98 runs sampled) + +#2: boolean + current x 27,197,115 ops/sec ±0.85% (94 runs sampled) + lib-type-of x 3,145,791 ops/sec ±0.73% (97 runs sampled) + lib-typeof x 9,199,562 ops/sec ±0.44% (99 runs sampled) + +#3: date + current x 20,190,117 ops/sec ±0.86% (92 runs sampled) + lib-type-of x 5,166,970 ops/sec ±0.74% (94 runs sampled) + lib-typeof x 9,610,821 ops/sec ±0.50% (96 runs sampled) + +#4: function + current x 23,855,460 ops/sec ±0.60% (97 runs sampled) + lib-type-of x 5,667,740 ops/sec ±0.54% (100 runs sampled) + lib-typeof x 10,010,644 ops/sec ±0.44% (100 runs sampled) + +#5: null + current x 27,061,047 ops/sec ±0.97% (96 runs sampled) + lib-type-of x 13,965,573 ops/sec ±0.62% (97 runs sampled) + lib-typeof x 8,460,194 ops/sec ±0.61% (97 runs sampled) + +#6: number + current x 25,075,682 ops/sec ±0.53% (99 runs sampled) + lib-type-of x 2,266,405 ops/sec ±0.41% (98 runs sampled) + lib-typeof x 9,821,481 ops/sec ±0.45% (99 runs sampled) + +#7: object + current x 3,348,980 ops/sec ±0.49% (99 runs sampled) + lib-type-of x 3,245,138 ops/sec ±0.60% (94 runs sampled) + lib-typeof x 9,262,952 ops/sec ±0.59% (99 runs sampled) + +#8: regex + current x 21,284,827 ops/sec ±0.72% (96 runs sampled) + lib-type-of x 4,689,241 ops/sec ±0.43% (100 runs sampled) + lib-typeof x 8,957,593 ops/sec ±0.62% (98 runs sampled) + +#9: string + current x 25,379,234 ops/sec ±0.58% (96 runs sampled) + lib-type-of x 3,635,148 ops/sec ±0.76% (93 runs sampled) + lib-typeof x 9,494,134 ops/sec ±0.49% (98 runs sampled) + +#10: undef + current x 27,459,221 ops/sec ±1.01% (93 runs sampled) + lib-type-of x 14,360,433 ops/sec ±0.52% (99 runs sampled) + lib-typeof x 23,202,868 ops/sec ±0.59% (94 runs sampled) + +``` + +## Optimizations + +In 7 out of 8 cases, this library is 2x-10x faster than other top libraries included in the benchmarks. There are a few things that lead to this performance advantage, none of them hard and fast rules, but all of them simple and repeatable in almost any code library: + +1. Optimize around the fastest and most common use cases first. Of course, this will change from project-to-project, but I took some time to understand how and why `typeof` checks were being used in my own libraries and other libraries I use a lot. +2. Optimize around bottlenecks - In other words, the order in which conditionals are implemented is significant, because each check is only as fast as the failing checks that came before it. Here, the biggest bottleneck by far is checking for plain objects (an object that was created by the `Object` constructor). I opted to make this check happen by process of elimination rather than brute force up front (e.g. by using something like `val.constructor.name`), so that every other type check would not be penalized it. +3. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'` + +## About + +### Related projects + +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number "Returns true if the value is a number. comprehensive tests.") +* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 59 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [miguelmota](https://github.com/miguelmota) | +| 1 | [dtothefp](https://github.com/dtothefp) | +| 1 | [ksheedlo](https://github.com/ksheedlo) | +| 1 | [pdehaan](https://github.com/pdehaan) | +| 1 | [laggingreflex](https://github.com/laggingreflex) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 16, 2017._ \ No newline at end of file diff --git a/node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/index.js b/node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/index.js new file mode 100644 index 0000000..b52c291 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/index.js @@ -0,0 +1,116 @@ +var isBuffer = require('is-buffer'); +var toString = Object.prototype.toString; + +/** + * Get the native `typeof` a value. + * + * @param {*} `val` + * @return {*} Native javascript type + */ + +module.exports = function kindOf(val) { + // primitivies + if (typeof val === 'undefined') { + return 'undefined'; + } + if (val === null) { + return 'null'; + } + if (val === true || val === false || val instanceof Boolean) { + return 'boolean'; + } + if (typeof val === 'string' || val instanceof String) { + return 'string'; + } + if (typeof val === 'number' || val instanceof Number) { + return 'number'; + } + + // functions + if (typeof val === 'function' || val instanceof Function) { + return 'function'; + } + + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; + } + + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } + + // other objects + var type = toString.call(val); + + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + if (type === '[object Error]') { + return 'error'; + } + + // buffer + if (isBuffer(val)) { + return 'buffer'; + } + + // es6: Map, WeakMap, Set, WeakSet + if (type === '[object Set]') { + return 'set'; + } + if (type === '[object WeakSet]') { + return 'weakset'; + } + if (type === '[object Map]') { + return 'map'; + } + if (type === '[object WeakMap]') { + return 'weakmap'; + } + if (type === '[object Symbol]') { + return 'symbol'; + } + + // typed arrays + if (type === '[object Int8Array]') { + return 'int8array'; + } + if (type === '[object Uint8Array]') { + return 'uint8array'; + } + if (type === '[object Uint8ClampedArray]') { + return 'uint8clampedarray'; + } + if (type === '[object Int16Array]') { + return 'int16array'; + } + if (type === '[object Uint16Array]') { + return 'uint16array'; + } + if (type === '[object Int32Array]') { + return 'int32array'; + } + if (type === '[object Uint32Array]') { + return 'uint32array'; + } + if (type === '[object Float32Array]') { + return 'float32array'; + } + if (type === '[object Float64Array]') { + return 'float64array'; + } + + // must be a plain object + return 'object'; +}; diff --git a/node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/package.json b/node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/package.json new file mode 100644 index 0000000..968917b --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of/package.json @@ -0,0 +1,139 @@ +{ + "_from": "kind-of@^3.0.2", + "_id": "kind-of@3.2.2", + "_inBundle": false, + "_integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "_location": "/snapdragon/is-data-descriptor/kind-of", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "kind-of@^3.0.2", + "name": "kind-of", + "escapedName": "kind-of", + "rawSpec": "^3.0.2", + "saveSpec": null, + "fetchSpec": "^3.0.2" + }, + "_requiredBy": [ + "/snapdragon/is-data-descriptor" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "_shasum": "31ea21a734bab9bbb0f32466d893aea51e4a3c64", + "_spec": "kind-of@^3.0.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/snapdragon/node_modules/is-data-descriptor", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/kind-of/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "David Fox-Powell", + "url": "https://dtothefp.github.io/me" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Ken Sheedlo", + "url": "kensheedlo.com" + }, + { + "name": "laggingreflex", + "url": "https://github.com/laggingreflex" + }, + { + "name": "Miguel Mota", + "url": "https://miguelmota.com" + }, + { + "name": "Peter deHaan", + "url": "http://about.me/peterdehaan" + } + ], + "dependencies": { + "is-buffer": "^1.1.5" + }, + "deprecated": false, + "description": "Get the native type of a value.", + "devDependencies": { + "ansi-bold": "^0.1.1", + "benchmarked": "^1.0.0", + "browserify": "^14.3.0", + "glob": "^7.1.1", + "gulp-format-md": "^0.1.12", + "mocha": "^3.3.0", + "type-of": "^2.0.1", + "typeof": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/kind-of", + "keywords": [ + "arguments", + "array", + "boolean", + "check", + "date", + "function", + "is", + "is-type", + "is-type-of", + "kind", + "kind-of", + "number", + "object", + "of", + "regexp", + "string", + "test", + "type", + "type-of", + "typeof", + "types" + ], + "license": "MIT", + "main": "index.js", + "name": "kind-of", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/kind-of.git" + }, + "scripts": { + "prepublish": "browserify -o browser.js -e index.js -s index --bare", + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-glob", + "is-number", + "is-primitive" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb" + ] + }, + "version": "3.2.2" +} diff --git a/node_modules/snapdragon/node_modules/is-data-descriptor/package.json b/node_modules/snapdragon/node_modules/is-data-descriptor/package.json new file mode 100644 index 0000000..0537297 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-data-descriptor/package.json @@ -0,0 +1,93 @@ +{ + "_from": "is-data-descriptor@^0.1.4", + "_id": "is-data-descriptor@0.1.4", + "_inBundle": false, + "_integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "_location": "/snapdragon/is-data-descriptor", + "_phantomChildren": { + "is-buffer": "1.1.6" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-data-descriptor@^0.1.4", + "name": "is-data-descriptor", + "escapedName": "is-data-descriptor", + "rawSpec": "^0.1.4", + "saveSpec": null, + "fetchSpec": "^0.1.4" + }, + "_requiredBy": [ + "/snapdragon/is-descriptor" + ], + "_resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "_shasum": "0b5ee648388e2c860282e793f1856fec3f301b56", + "_spec": "is-data-descriptor@^0.1.4", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/snapdragon/node_modules/is-descriptor", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-data-descriptor/issues" + }, + "bundleDependencies": false, + "dependencies": { + "kind-of": "^3.0.2" + }, + "deprecated": false, + "description": "Returns true if a value has the characteristics of a valid JavaScript data descriptor.", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/is-data-descriptor", + "keywords": [ + "accessor", + "check", + "data", + "descriptor", + "get", + "getter", + "is", + "keys", + "object", + "properties", + "property", + "set", + "setter", + "type", + "valid", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "is-data-descriptor", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/is-data-descriptor.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-accessor-descriptor", + "is-data-descriptor", + "is-descriptor", + "isobject" + ] + }, + "plugins": [ + "gulp-format-md" + ] + }, + "version": "0.1.4" +} diff --git a/node_modules/snapdragon/node_modules/is-descriptor/LICENSE b/node_modules/snapdragon/node_modules/is-descriptor/LICENSE new file mode 100644 index 0000000..c0d7f13 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-descriptor/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-2017, 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. \ No newline at end of file diff --git a/node_modules/snapdragon/node_modules/is-descriptor/README.md b/node_modules/snapdragon/node_modules/is-descriptor/README.md new file mode 100644 index 0000000..658e533 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-descriptor/README.md @@ -0,0 +1,193 @@ +# is-descriptor [![NPM version](https://img.shields.io/npm/v/is-descriptor.svg?style=flat)](https://www.npmjs.com/package/is-descriptor) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-descriptor.svg?style=flat)](https://npmjs.org/package/is-descriptor) [![NPM total downloads](https://img.shields.io/npm/dt/is-descriptor.svg?style=flat)](https://npmjs.org/package/is-descriptor) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-descriptor.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-descriptor) + +> Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-descriptor +``` + +## Usage + +```js +var isDescriptor = require('is-descriptor'); + +isDescriptor({value: 'foo'}) +//=> true +isDescriptor({get: function(){}, set: function(){}}) +//=> true +isDescriptor({get: 'foo', set: function(){}}) +//=> false +``` + +You may also check for a descriptor by passing an object as the first argument and property name (`string`) as the second argument. + +```js +var obj = {}; +obj.foo = 'abc'; + +Object.defineProperty(obj, 'bar', { + value: 'xyz' +}); + +isDescriptor(obj, 'foo'); +//=> true +isDescriptor(obj, 'bar'); +//=> true +``` + +## Examples + +### value type + +`false` when not an object + +```js +isDescriptor('a'); +//=> false +isDescriptor(null); +//=> false +isDescriptor([]); +//=> false +``` + +### data descriptor + +`true` when the object has valid properties with valid values. + +```js +isDescriptor({value: 'foo'}); +//=> true +isDescriptor({value: noop}); +//=> true +``` + +`false` when the object has invalid properties + +```js +isDescriptor({value: 'foo', bar: 'baz'}); +//=> false +isDescriptor({value: 'foo', bar: 'baz'}); +//=> false +isDescriptor({value: 'foo', get: noop}); +//=> false +isDescriptor({get: noop, value: noop}); +//=> false +``` + +`false` when a value is not the correct type + +```js +isDescriptor({value: 'foo', enumerable: 'foo'}); +//=> false +isDescriptor({value: 'foo', configurable: 'foo'}); +//=> false +isDescriptor({value: 'foo', writable: 'foo'}); +//=> false +``` + +### accessor descriptor + +`true` when the object has valid properties with valid values. + +```js +isDescriptor({get: noop, set: noop}); +//=> true +isDescriptor({get: noop}); +//=> true +isDescriptor({set: noop}); +//=> true +``` + +`false` when the object has invalid properties + +```js +isDescriptor({get: noop, set: noop, bar: 'baz'}); +//=> false +isDescriptor({get: noop, writable: true}); +//=> false +isDescriptor({get: noop, value: true}); +//=> false +``` + +`false` when an accessor is not a function + +```js +isDescriptor({get: noop, set: 'baz'}); +//=> false +isDescriptor({get: 'foo', set: noop}); +//=> false +isDescriptor({get: 'foo', bar: 'baz'}); +//=> false +isDescriptor({get: 'foo', set: 'baz'}); +//=> false +``` + +`false` when a value is not the correct type + +```js +isDescriptor({get: noop, set: noop, enumerable: 'foo'}); +//=> false +isDescriptor({set: noop, configurable: 'foo'}); +//=> false +isDescriptor({get: noop, configurable: 'foo'}); +//=> false +``` + +## About + +### Related projects + +* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor "Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.") +* [is-data-descriptor](https://www.npmjs.com/package/is-data-descriptor): Returns true if a value has the characteristics of a valid JavaScript data descriptor. | [homepage](https://github.com/jonschlinkert/is-data-descriptor "Returns true if a value has the characteristics of a valid JavaScript data descriptor.") +* [is-descriptor](https://www.npmjs.com/package/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://github.com/jonschlinkert/is-descriptor) | [homepage](https://github.com/jonschlinkert/is-descriptor "Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.") +* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 24 | [jonschlinkert](https://github.com/jonschlinkert) | +| 1 | [doowb](https://github.com/doowb) | +| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 22, 2017._ \ No newline at end of file diff --git a/node_modules/snapdragon/node_modules/is-descriptor/index.js b/node_modules/snapdragon/node_modules/is-descriptor/index.js new file mode 100644 index 0000000..c9b91d7 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-descriptor/index.js @@ -0,0 +1,22 @@ +/*! + * is-descriptor + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var typeOf = require('kind-of'); +var isAccessor = require('is-accessor-descriptor'); +var isData = require('is-data-descriptor'); + +module.exports = function isDescriptor(obj, key) { + if (typeOf(obj) !== 'object') { + return false; + } + if ('get' in obj) { + return isAccessor(obj, key); + } + return isData(obj, key); +}; diff --git a/node_modules/snapdragon/node_modules/is-descriptor/package.json b/node_modules/snapdragon/node_modules/is-descriptor/package.json new file mode 100644 index 0000000..e61ce16 --- /dev/null +++ b/node_modules/snapdragon/node_modules/is-descriptor/package.json @@ -0,0 +1,114 @@ +{ + "_from": "is-descriptor@^0.1.0", + "_id": "is-descriptor@0.1.6", + "_inBundle": false, + "_integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "_location": "/snapdragon/is-descriptor", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-descriptor@^0.1.0", + "name": "is-descriptor", + "escapedName": "is-descriptor", + "rawSpec": "^0.1.0", + "saveSpec": null, + "fetchSpec": "^0.1.0" + }, + "_requiredBy": [ + "/snapdragon/define-property" + ], + "_resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "_shasum": "366d8240dde487ca51823b1ab9f07a10a78251ca", + "_spec": "is-descriptor@^0.1.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/snapdragon/node_modules/define-property", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-descriptor/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Brian Woodward", + "url": "https://twitter.com/doowb" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "url": "https://github.com/wtgtybhertgeghgtwtg" + } + ], + "dependencies": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "deprecated": false, + "description": "Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.", + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.4.2" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/is-descriptor", + "keywords": [ + "accessor", + "check", + "data", + "descriptor", + "get", + "getter", + "is", + "keys", + "object", + "properties", + "property", + "set", + "setter", + "type", + "valid", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "is-descriptor", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/is-descriptor.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-accessor-descriptor", + "is-data-descriptor", + "is-descriptor", + "isobject" + ] + }, + "plugins": [ + "gulp-format-md" + ], + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "lint": { + "reflinks": true + } + }, + "version": "0.1.6" +} diff --git a/node_modules/snapdragon/node_modules/kind-of/LICENSE b/node_modules/snapdragon/node_modules/kind-of/LICENSE new file mode 100644 index 0000000..3f2eca1 --- /dev/null +++ b/node_modules/snapdragon/node_modules/kind-of/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, 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/node_modules/snapdragon/node_modules/kind-of/README.md b/node_modules/snapdragon/node_modules/kind-of/README.md new file mode 100644 index 0000000..170bf30 --- /dev/null +++ b/node_modules/snapdragon/node_modules/kind-of/README.md @@ -0,0 +1,342 @@ +# kind-of [![NPM version](https://img.shields.io/npm/v/kind-of.svg?style=flat)](https://www.npmjs.com/package/kind-of) [![NPM monthly downloads](https://img.shields.io/npm/dm/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![NPM total downloads](https://img.shields.io/npm/dt/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/kind-of.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/kind-of) + +> Get the native type of a value. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save kind-of +``` + +Install with [bower](https://bower.io/) + +```sh +$ bower install kind-of --save +``` + +## Why use this? + +1. [it's fast](#benchmarks) | [optimizations](#optimizations) +2. [better type checking](#better-type-checking) + +## Usage + +> es5, browser and es6 ready + +```js +var kindOf = require('kind-of'); + +kindOf(undefined); +//=> 'undefined' + +kindOf(null); +//=> 'null' + +kindOf(true); +//=> 'boolean' + +kindOf(false); +//=> 'boolean' + +kindOf(new Boolean(true)); +//=> 'boolean' + +kindOf(new Buffer('')); +//=> 'buffer' + +kindOf(42); +//=> 'number' + +kindOf(new Number(42)); +//=> 'number' + +kindOf('str'); +//=> 'string' + +kindOf(new String('str')); +//=> 'string' + +kindOf(arguments); +//=> 'arguments' + +kindOf({}); +//=> 'object' + +kindOf(Object.create(null)); +//=> 'object' + +kindOf(new Test()); +//=> 'object' + +kindOf(new Date()); +//=> 'date' + +kindOf([]); +//=> 'array' + +kindOf([1, 2, 3]); +//=> 'array' + +kindOf(new Array()); +//=> 'array' + +kindOf(/foo/); +//=> 'regexp' + +kindOf(new RegExp('foo')); +//=> 'regexp' + +kindOf(function () {}); +//=> 'function' + +kindOf(function * () {}); +//=> 'function' + +kindOf(new Function()); +//=> 'function' + +kindOf(new Map()); +//=> 'map' + +kindOf(new WeakMap()); +//=> 'weakmap' + +kindOf(new Set()); +//=> 'set' + +kindOf(new WeakSet()); +//=> 'weakset' + +kindOf(Symbol('str')); +//=> 'symbol' + +kindOf(new Int8Array()); +//=> 'int8array' + +kindOf(new Uint8Array()); +//=> 'uint8array' + +kindOf(new Uint8ClampedArray()); +//=> 'uint8clampedarray' + +kindOf(new Int16Array()); +//=> 'int16array' + +kindOf(new Uint16Array()); +//=> 'uint16array' + +kindOf(new Int32Array()); +//=> 'int32array' + +kindOf(new Uint32Array()); +//=> 'uint32array' + +kindOf(new Float32Array()); +//=> 'float32array' + +kindOf(new Float64Array()); +//=> 'float64array' +``` + +## Release history + +### v4.0.0 + +**Added** + +* `promise` support + +### v5.0.0 + +**Added** + +* `Set Iterator` and `Map Iterator` support + +**Fixed** + +* Now returns `generatorfunction` for generator functions + +## Benchmarks + +Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of). +Note that performaces is slower for es6 features `Map`, `WeakMap`, `Set` and `WeakSet`. + +```bash +#1: array + current x 23,329,397 ops/sec ±0.82% (94 runs sampled) + lib-type-of x 4,170,273 ops/sec ±0.55% (94 runs sampled) + lib-typeof x 9,686,935 ops/sec ±0.59% (98 runs sampled) + +#2: boolean + current x 27,197,115 ops/sec ±0.85% (94 runs sampled) + lib-type-of x 3,145,791 ops/sec ±0.73% (97 runs sampled) + lib-typeof x 9,199,562 ops/sec ±0.44% (99 runs sampled) + +#3: date + current x 20,190,117 ops/sec ±0.86% (92 runs sampled) + lib-type-of x 5,166,970 ops/sec ±0.74% (94 runs sampled) + lib-typeof x 9,610,821 ops/sec ±0.50% (96 runs sampled) + +#4: function + current x 23,855,460 ops/sec ±0.60% (97 runs sampled) + lib-type-of x 5,667,740 ops/sec ±0.54% (100 runs sampled) + lib-typeof x 10,010,644 ops/sec ±0.44% (100 runs sampled) + +#5: null + current x 27,061,047 ops/sec ±0.97% (96 runs sampled) + lib-type-of x 13,965,573 ops/sec ±0.62% (97 runs sampled) + lib-typeof x 8,460,194 ops/sec ±0.61% (97 runs sampled) + +#6: number + current x 25,075,682 ops/sec ±0.53% (99 runs sampled) + lib-type-of x 2,266,405 ops/sec ±0.41% (98 runs sampled) + lib-typeof x 9,821,481 ops/sec ±0.45% (99 runs sampled) + +#7: object + current x 3,348,980 ops/sec ±0.49% (99 runs sampled) + lib-type-of x 3,245,138 ops/sec ±0.60% (94 runs sampled) + lib-typeof x 9,262,952 ops/sec ±0.59% (99 runs sampled) + +#8: regex + current x 21,284,827 ops/sec ±0.72% (96 runs sampled) + lib-type-of x 4,689,241 ops/sec ±0.43% (100 runs sampled) + lib-typeof x 8,957,593 ops/sec ±0.62% (98 runs sampled) + +#9: string + current x 25,379,234 ops/sec ±0.58% (96 runs sampled) + lib-type-of x 3,635,148 ops/sec ±0.76% (93 runs sampled) + lib-typeof x 9,494,134 ops/sec ±0.49% (98 runs sampled) + +#10: undef + current x 27,459,221 ops/sec ±1.01% (93 runs sampled) + lib-type-of x 14,360,433 ops/sec ±0.52% (99 runs sampled) + lib-typeof x 23,202,868 ops/sec ±0.59% (94 runs sampled) + +``` + +## Optimizations + +In 7 out of 8 cases, this library is 2x-10x faster than other top libraries included in the benchmarks. There are a few things that lead to this performance advantage, none of them hard and fast rules, but all of them simple and repeatable in almost any code library: + +1. Optimize around the fastest and most common use cases first. Of course, this will change from project-to-project, but I took some time to understand how and why `typeof` checks were being used in my own libraries and other libraries I use a lot. +2. Optimize around bottlenecks - In other words, the order in which conditionals are implemented is significant, because each check is only as fast as the failing checks that came before it. Here, the biggest bottleneck by far is checking for plain objects (an object that was created by the `Object` constructor). I opted to make this check happen by process of elimination rather than brute force up front (e.g. by using something like `val.constructor.name`), so that every other type check would not be penalized it. +3. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'` +4. There is no reason to make the code in a microlib as terse as possible, just to win points for making it shorter. It's always better to favor performant code over terse code. You will always only be using a single `require()` statement to use the library anyway, regardless of how the code is written. + +## Better type checking + +kind-of is more correct than other type checking libs I've looked at. For example, here are some differing results from other popular libs: + +### [typeof](https://github.com/CodingFu/typeof) lib + +Incorrectly tests instances of custom constructors (pretty common): + +```js +var typeOf = require('typeof'); +function Test() {} +console.log(typeOf(new Test())); +//=> 'test' +``` + +Returns `object` instead of `arguments`: + +```js +function foo() { + console.log(typeOf(arguments)) //=> 'object' +} +foo(); +``` + +### [type-of](https://github.com/ForbesLindesay/type-of) lib + +Incorrectly returns `object` for generator functions, buffers, `Map`, `Set`, `WeakMap` and `WeakSet`: + +```js +function * foo() {} +console.log(typeOf(foo)); +//=> 'object' +console.log(typeOf(new Buffer(''))); +//=> 'object' +console.log(typeOf(new Map())); +//=> 'object' +console.log(typeOf(new Set())); +//=> 'object' +console.log(typeOf(new WeakMap())); +//=> 'object' +console.log(typeOf(new WeakSet())); +//=> 'object' +``` + +## About + +
    +Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
    + +
    +Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
    + +
    +Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
    + +### Related projects + +You might also be interested in these projects: + +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number "Returns true if the value is a number. comprehensive tests.") +* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 82 | [jonschlinkert](https://github.com/jonschlinkert) | +| 3 | [aretecode](https://github.com/aretecode) | +| 2 | [miguelmota](https://github.com/miguelmota) | +| 1 | [dtothefp](https://github.com/dtothefp) | +| 1 | [ksheedlo](https://github.com/ksheedlo) | +| 1 | [pdehaan](https://github.com/pdehaan) | +| 1 | [laggingreflex](https://github.com/laggingreflex) | +| 1 | [charlike](https://github.com/charlike) | + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on October 13, 2017._ \ No newline at end of file diff --git a/node_modules/snapdragon/node_modules/kind-of/index.js b/node_modules/snapdragon/node_modules/kind-of/index.js new file mode 100644 index 0000000..fc5cde9 --- /dev/null +++ b/node_modules/snapdragon/node_modules/kind-of/index.js @@ -0,0 +1,147 @@ +var toString = Object.prototype.toString; + +/** + * Get the native `typeof` a value. + * + * @param {*} `val` + * @return {*} Native javascript type + */ + +module.exports = function kindOf(val) { + var type = typeof val; + + // primitivies + if (type === 'undefined') { + return 'undefined'; + } + if (val === null) { + return 'null'; + } + if (val === true || val === false || val instanceof Boolean) { + return 'boolean'; + } + if (type === 'string' || val instanceof String) { + return 'string'; + } + if (type === 'number' || val instanceof Number) { + return 'number'; + } + + // functions + if (type === 'function' || val instanceof Function) { + if (typeof val.constructor.name !== 'undefined' && val.constructor.name.slice(0, 9) === 'Generator') { + return 'generatorfunction'; + } + return 'function'; + } + + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; + } + + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } + + // other objects + type = toString.call(val); + + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + if (type === '[object Error]') { + return 'error'; + } + if (type === '[object Promise]') { + return 'promise'; + } + + // buffer + if (isBuffer(val)) { + return 'buffer'; + } + + // es6: Map, WeakMap, Set, WeakSet + if (type === '[object Set]') { + return 'set'; + } + if (type === '[object WeakSet]') { + return 'weakset'; + } + if (type === '[object Map]') { + return 'map'; + } + if (type === '[object WeakMap]') { + return 'weakmap'; + } + if (type === '[object Symbol]') { + return 'symbol'; + } + + if (type === '[object Map Iterator]') { + return 'mapiterator'; + } + if (type === '[object Set Iterator]') { + return 'setiterator'; + } + if (type === '[object String Iterator]') { + return 'stringiterator'; + } + if (type === '[object Array Iterator]') { + return 'arrayiterator'; + } + + // typed arrays + if (type === '[object Int8Array]') { + return 'int8array'; + } + if (type === '[object Uint8Array]') { + return 'uint8array'; + } + if (type === '[object Uint8ClampedArray]') { + return 'uint8clampedarray'; + } + if (type === '[object Int16Array]') { + return 'int16array'; + } + if (type === '[object Uint16Array]') { + return 'uint16array'; + } + if (type === '[object Int32Array]') { + return 'int32array'; + } + if (type === '[object Uint32Array]') { + return 'uint32array'; + } + if (type === '[object Float32Array]') { + return 'float32array'; + } + if (type === '[object Float64Array]') { + return 'float64array'; + } + + // must be a plain object + return 'object'; +}; + +/** + * If you need to support Safari 5-7 (8-10 yr-old browser), + * take a look at https://github.com/feross/is-buffer + */ + +function isBuffer(val) { + return val.constructor + && typeof val.constructor.isBuffer === 'function' + && val.constructor.isBuffer(val); +} diff --git a/node_modules/snapdragon/node_modules/kind-of/package.json b/node_modules/snapdragon/node_modules/kind-of/package.json new file mode 100644 index 0000000..7c92ff1 --- /dev/null +++ b/node_modules/snapdragon/node_modules/kind-of/package.json @@ -0,0 +1,146 @@ +{ + "_from": "kind-of@^5.0.0", + "_id": "kind-of@5.1.0", + "_inBundle": false, + "_integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "_location": "/snapdragon/kind-of", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "kind-of@^5.0.0", + "name": "kind-of", + "escapedName": "kind-of", + "rawSpec": "^5.0.0", + "saveSpec": null, + "fetchSpec": "^5.0.0" + }, + "_requiredBy": [ + "/snapdragon/is-descriptor" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "_shasum": "729c91e2d857b7a419a1f9aa65685c4c33f5845d", + "_spec": "kind-of@^5.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/snapdragon/node_modules/is-descriptor", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/kind-of/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "David Fox-Powell", + "url": "https://dtothefp.github.io/me" + }, + { + "name": "James", + "url": "https://twitter.com/aretecode" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Ken Sheedlo", + "url": "kensheedlo.com" + }, + { + "name": "laggingreflex", + "url": "https://github.com/laggingreflex" + }, + { + "name": "Miguel Mota", + "url": "https://miguelmota.com" + }, + { + "name": "Peter deHaan", + "url": "http://about.me/peterdehaan" + }, + { + "name": "tunnckoCore", + "url": "https://i.am.charlike.online" + } + ], + "deprecated": false, + "description": "Get the native type of a value.", + "devDependencies": { + "ansi-bold": "^0.1.1", + "benchmarked": "^1.1.1", + "browserify": "^14.4.0", + "gulp-format-md": "^0.1.12", + "matched": "^0.4.4", + "mocha": "^3.4.2", + "type-of": "^2.0.1", + "typeof": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/kind-of", + "keywords": [ + "arguments", + "array", + "boolean", + "check", + "date", + "function", + "is", + "is-type", + "is-type-of", + "kind", + "kind-of", + "number", + "object", + "of", + "regexp", + "string", + "test", + "type", + "type-of", + "typeof", + "types" + ], + "license": "MIT", + "main": "index.js", + "name": "kind-of", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/kind-of.git" + }, + "scripts": { + "prepublish": "browserify -o browser.js -e index.js -s index --bare", + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-glob", + "is-number", + "is-primitive" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "type-of", + "typeof", + "verb" + ] + }, + "version": "5.1.0" +} diff --git a/node_modules/snapdragon/node_modules/source-map/CHANGELOG.md b/node_modules/snapdragon/node_modules/source-map/CHANGELOG.md new file mode 100644 index 0000000..3a8c066 --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/CHANGELOG.md @@ -0,0 +1,301 @@ +# Change Log + +## 0.5.6 + +* Fix for regression when people were using numbers as names in source maps. See + #236. + +## 0.5.5 + +* Fix "regression" of unsupported, implementation behavior that half the world + happens to have come to depend on. See #235. + +* Fix regression involving function hoisting in SpiderMonkey. See #233. + +## 0.5.4 + +* Large performance improvements to source-map serialization. See #228 and #229. + +## 0.5.3 + +* Do not include unnecessary distribution files. See + commit ef7006f8d1647e0a83fdc60f04f5a7ca54886f86. + +## 0.5.2 + +* Include browser distributions of the library in package.json's `files`. See + issue #212. + +## 0.5.1 + +* Fix latent bugs in IndexedSourceMapConsumer.prototype._parseMappings. See + ff05274becc9e6e1295ed60f3ea090d31d843379. + +## 0.5.0 + +* Node 0.8 is no longer supported. + +* Use webpack instead of dryice for bundling. + +* Big speedups serializing source maps. See pull request #203. + +* Fix a bug with `SourceMapConsumer.prototype.sourceContentFor` and sources that + explicitly start with the source root. See issue #199. + +## 0.4.4 + +* Fix an issue where using a `SourceMapGenerator` after having created a + `SourceMapConsumer` from it via `SourceMapConsumer.fromSourceMap` failed. See + issue #191. + +* Fix an issue with where `SourceMapGenerator` would mistakenly consider + different mappings as duplicates of each other and avoid generating them. See + issue #192. + +## 0.4.3 + +* A very large number of performance improvements, particularly when parsing + source maps. Collectively about 75% of time shaved off of the source map + parsing benchmark! + +* Fix a bug in `SourceMapConsumer.prototype.allGeneratedPositionsFor` and fuzzy + searching in the presence of a column option. See issue #177. + +* Fix a bug with joining a source and its source root when the source is above + the root. See issue #182. + +* Add the `SourceMapConsumer.prototype.hasContentsOfAllSources` method to + determine when all sources' contents are inlined into the source map. See + issue #190. + +## 0.4.2 + +* Add an `.npmignore` file so that the benchmarks aren't pulled down by + dependent projects. Issue #169. + +* Add an optional `column` argument to + `SourceMapConsumer.prototype.allGeneratedPositionsFor` and better handle lines + with no mappings. Issues #172 and #173. + +## 0.4.1 + +* Fix accidentally defining a global variable. #170. + +## 0.4.0 + +* The default direction for fuzzy searching was changed back to its original + direction. See #164. + +* There is now a `bias` option you can supply to `SourceMapConsumer` to control + the fuzzy searching direction. See #167. + +* About an 8% speed up in parsing source maps. See #159. + +* Added a benchmark for parsing and generating source maps. + +## 0.3.0 + +* Change the default direction that searching for positions fuzzes when there is + not an exact match. See #154. + +* Support for environments using json2.js for JSON serialization. See #156. + +## 0.2.0 + +* Support for consuming "indexed" source maps which do not have any remote + sections. See pull request #127. This introduces a minor backwards + incompatibility if you are monkey patching `SourceMapConsumer.prototype` + methods. + +## 0.1.43 + +* Performance improvements for `SourceMapGenerator` and `SourceNode`. See issue + #148 for some discussion and issues #150, #151, and #152 for implementations. + +## 0.1.42 + +* Fix an issue where `SourceNode`s from different versions of the source-map + library couldn't be used in conjunction with each other. See issue #142. + +## 0.1.41 + +* Fix a bug with getting the source content of relative sources with a "./" + prefix. See issue #145 and [Bug 1090768](bugzil.la/1090768). + +* Add the `SourceMapConsumer.prototype.computeColumnSpans` method to compute the + column span of each mapping. + +* Add the `SourceMapConsumer.prototype.allGeneratedPositionsFor` method to find + all generated positions associated with a given original source and line. + +## 0.1.40 + +* Performance improvements for parsing source maps in SourceMapConsumer. + +## 0.1.39 + +* Fix a bug where setting a source's contents to null before any source content + had been set before threw a TypeError. See issue #131. + +## 0.1.38 + +* Fix a bug where finding relative paths from an empty path were creating + absolute paths. See issue #129. + +## 0.1.37 + +* Fix a bug where if the source root was an empty string, relative source paths + would turn into absolute source paths. Issue #124. + +## 0.1.36 + +* Allow the `names` mapping property to be an empty string. Issue #121. + +## 0.1.35 + +* A third optional parameter was added to `SourceNode.fromStringWithSourceMap` + to specify a path that relative sources in the second parameter should be + relative to. Issue #105. + +* If no file property is given to a `SourceMapGenerator`, then the resulting + source map will no longer have a `null` file property. The property will + simply not exist. Issue #104. + +* Fixed a bug where consecutive newlines were ignored in `SourceNode`s. + Issue #116. + +## 0.1.34 + +* Make `SourceNode` work with windows style ("\r\n") newlines. Issue #103. + +* Fix bug involving source contents and the + `SourceMapGenerator.prototype.applySourceMap`. Issue #100. + +## 0.1.33 + +* Fix some edge cases surrounding path joining and URL resolution. + +* Add a third parameter for relative path to + `SourceMapGenerator.prototype.applySourceMap`. + +* Fix issues with mappings and EOLs. + +## 0.1.32 + +* Fixed a bug where SourceMapConsumer couldn't handle negative relative columns + (issue 92). + +* Fixed test runner to actually report number of failed tests as its process + exit code. + +* Fixed a typo when reporting bad mappings (issue 87). + +## 0.1.31 + +* Delay parsing the mappings in SourceMapConsumer until queried for a source + location. + +* Support Sass source maps (which at the time of writing deviate from the spec + in small ways) in SourceMapConsumer. + +## 0.1.30 + +* Do not join source root with a source, when the source is a data URI. + +* Extend the test runner to allow running single specific test files at a time. + +* Performance improvements in `SourceNode.prototype.walk` and + `SourceMapConsumer.prototype.eachMapping`. + +* Source map browser builds will now work inside Workers. + +* Better error messages when attempting to add an invalid mapping to a + `SourceMapGenerator`. + +## 0.1.29 + +* Allow duplicate entries in the `names` and `sources` arrays of source maps + (usually from TypeScript) we are parsing. Fixes github issue 72. + +## 0.1.28 + +* Skip duplicate mappings when creating source maps from SourceNode; github + issue 75. + +## 0.1.27 + +* Don't throw an error when the `file` property is missing in SourceMapConsumer, + we don't use it anyway. + +## 0.1.26 + +* Fix SourceNode.fromStringWithSourceMap for empty maps. Fixes github issue 70. + +## 0.1.25 + +* Make compatible with browserify + +## 0.1.24 + +* Fix issue with absolute paths and `file://` URIs. See + https://bugzilla.mozilla.org/show_bug.cgi?id=885597 + +## 0.1.23 + +* Fix issue with absolute paths and sourcesContent, github issue 64. + +## 0.1.22 + +* Ignore duplicate mappings in SourceMapGenerator. Fixes github issue 21. + +## 0.1.21 + +* Fixed handling of sources that start with a slash so that they are relative to + the source root's host. + +## 0.1.20 + +* Fixed github issue #43: absolute URLs aren't joined with the source root + anymore. + +## 0.1.19 + +* Using Travis CI to run tests. + +## 0.1.18 + +* Fixed a bug in the handling of sourceRoot. + +## 0.1.17 + +* Added SourceNode.fromStringWithSourceMap. + +## 0.1.16 + +* Added missing documentation. + +* Fixed the generating of empty mappings in SourceNode. + +## 0.1.15 + +* Added SourceMapGenerator.applySourceMap. + +## 0.1.14 + +* The sourceRoot is now handled consistently. + +## 0.1.13 + +* Added SourceMapGenerator.fromSourceMap. + +## 0.1.12 + +* SourceNode now generates empty mappings too. + +## 0.1.11 + +* Added name support to SourceNode. + +## 0.1.10 + +* Added sourcesContent support to the customer and generator. diff --git a/node_modules/snapdragon/node_modules/source-map/LICENSE b/node_modules/snapdragon/node_modules/source-map/LICENSE new file mode 100644 index 0000000..ed1b7cf --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/LICENSE @@ -0,0 +1,28 @@ + +Copyright (c) 2009-2011, Mozilla Foundation and contributors +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 names of the Mozilla Foundation nor the names of project + 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 HOLDER 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. diff --git a/node_modules/snapdragon/node_modules/source-map/README.md b/node_modules/snapdragon/node_modules/source-map/README.md new file mode 100644 index 0000000..3281339 --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/README.md @@ -0,0 +1,729 @@ +# 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 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", "utf8")); +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/node_modules/snapdragon/node_modules/source-map/dist/source-map.debug.js b/node_modules/snapdragon/node_modules/source-map/dist/source-map.debug.js new file mode 100644 index 0000000..b5ab638 --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/dist/source-map.debug.js @@ -0,0 +1,3091 @@ +(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) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!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 = Object.create(null); + } + 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) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + 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 next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + 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 consecutive 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; + + var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); + }()); + + function identity (s) { + return s; + } + + /** + * 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) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; + } + exports.toSetString = supportsNullProto ? identity : toSetString; + + function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; + } + exports.fromSetString = supportsNullProto ? identity : fromSetString; + + function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; + } + + /** + * 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); + var has = Object.prototype.hasOwnProperty; + var hasNativeMap = typeof Map !== "undefined"; + + /** + * 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 = hasNativeMap ? new Map() : Object.create(null); + } + + /** + * 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 hasNativeMap ? this._set.size : 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 = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } + }; + + /** + * Is the given string a member of this set? + * + * @param String aStr + */ + ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } + }; + + /** + * What is the index of the given string in the array? + * + * @param String aStr + */ + ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, 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 + .map(String) + // 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.map(String), 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 accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // 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[remainingLinesIndex]; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = 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[remainingLinesIndex]; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + 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.splice(remainingLinesIndex).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;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay91bml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uIiwid2VicGFjazovLy93ZWJwYWNrL2Jvb3RzdHJhcCBlNDczOGZjNzJhN2IyMzAzOTg4OSIsIndlYnBhY2s6Ly8vLi9zb3VyY2UtbWFwLmpzIiwid2VicGFjazovLy8uL2xpYi9zb3VyY2UtbWFwLWdlbmVyYXRvci5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LXZscS5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LmpzIiwid2VicGFjazovLy8uL2xpYi91dGlsLmpzIiwid2VicGFjazovLy8uL2xpYi9hcnJheS1zZXQuanMiLCJ3ZWJwYWNrOi8vLy4vbGliL21hcHBpbmctbGlzdC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvc291cmNlLW1hcC1jb25zdW1lci5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmluYXJ5LXNlYXJjaC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvcXVpY2stc29ydC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvc291cmNlLW5vZGUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsQ0FBQztBQUNELE87QUNWQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQSx1QkFBZTtBQUNmO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOzs7QUFHQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBOzs7Ozs7O0FDdENBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Ozs7Ozs7QUNQQSxpQkFBZ0Isb0JBQW9CO0FBQ3BDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQSxNQUFLO0FBQ0w7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7QUFDTDtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7QUFDTDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxVQUFTO0FBQ1Q7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUEsTUFBSztBQUNMO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxRQUFPO0FBQ1A7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0EsMkNBQTBDLFNBQVM7QUFDbkQ7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxxQkFBb0I7QUFDcEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxNQUFLO0FBQ0w7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBOzs7Ozs7O0FDL1pBLGlCQUFnQixvQkFBb0I7QUFDcEM7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLDREQUEyRDtBQUMzRCxxQkFBb0I7QUFDcEI7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxJQUFHOztBQUVIO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsSUFBRzs7QUFFSDtBQUNBO0FBQ0E7Ozs7Ozs7QUMzSUEsaUJBQWdCLG9CQUFvQjtBQUNwQztBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsaUJBQWdCO0FBQ2hCLGlCQUFnQjs7QUFFaEIsb0JBQW1CO0FBQ25CLHFCQUFvQjs7QUFFcEIsaUJBQWdCO0FBQ2hCLGlCQUFnQjs7QUFFaEIsaUJBQWdCO0FBQ2hCLGtCQUFpQjs7QUFFakI7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7Ozs7Ozs7QUNsRUEsaUJBQWdCLG9CQUFvQjtBQUNwQztBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsSUFBRztBQUNIO0FBQ0EsSUFBRztBQUNIO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0EsK0NBQThDLFFBQVE7QUFDdEQ7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMO0FBQ0EsTUFBSztBQUNMO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFFBQU87QUFDUDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxFQUFDOztBQUVEO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBLDRCQUEyQixRQUFRO0FBQ25DO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7Ozs7Ozs7QUNoYUEsaUJBQWdCLG9CQUFvQjtBQUNwQztBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsdUNBQXNDLFNBQVM7QUFDL0M7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7QUFDTDtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsSUFBRztBQUNIO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxJQUFHO0FBQ0g7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7Ozs7OztBQ3hIQSxpQkFBZ0Isb0JBQW9CO0FBQ3BDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsaUJBQWdCO0FBQ2hCOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLElBQUc7QUFDSDtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7Ozs7OztBQzlFQSxpQkFBZ0Isb0JBQW9CO0FBQ3BDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSx1REFBc0Q7QUFDdEQ7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQSxFQUFDOztBQUVEO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsRUFBQzs7QUFFRDtBQUNBO0FBQ0E7QUFDQSxvQkFBbUI7QUFDbkI7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7QUFDTDs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFlBQVc7O0FBRVg7QUFDQTtBQUNBLFFBQU87QUFDUDs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsWUFBVzs7QUFFWDtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsNEJBQTJCLE1BQU07QUFDakM7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSx1REFBc0Q7QUFDdEQ7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7O0FBRUw7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBLHVEQUFzRCxZQUFZO0FBQ2xFO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7QUFDTDtBQUNBLEVBQUM7O0FBRUQ7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0Esb0NBQW1DO0FBQ25DO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSwwQkFBeUIsY0FBYztBQUN2QztBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLFVBQVM7QUFDVDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0Esd0JBQXVCLHdDQUF3QztBQUMvRDs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsZ0RBQStDLG1CQUFtQixFQUFFO0FBQ3BFOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGtCQUFpQixvQkFBb0I7QUFDckM7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLDhCQUE2QixNQUFNO0FBQ25DO0FBQ0EsUUFBTztBQUNQO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsdURBQXNEO0FBQ3REOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxRQUFPO0FBQ1A7QUFDQTtBQUNBLElBQUc7QUFDSDs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLG9CQUFtQiwyQkFBMkI7QUFDOUMsc0JBQXFCLCtDQUErQztBQUNwRTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsRUFBQzs7QUFFRDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsUUFBTztBQUNQOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7QUFDTDs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0Esb0JBQW1CLDJCQUEyQjtBQUM5Qzs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxvQkFBbUIsMkJBQTJCO0FBQzlDOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLG9CQUFtQiwyQkFBMkI7QUFDOUM7QUFDQTtBQUNBLHNCQUFxQiw0QkFBNEI7QUFDakQ7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBOzs7Ozs7O0FDempDQSxpQkFBZ0Isb0JBQW9CO0FBQ3BDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxNQUFLO0FBQ0w7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7Ozs7OztBQzlHQSxpQkFBZ0Isb0JBQW9CO0FBQ3BDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLFlBQVcsTUFBTTtBQUNqQjtBQUNBLFlBQVcsT0FBTztBQUNsQjtBQUNBLFlBQVcsT0FBTztBQUNsQjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxZQUFXLE9BQU87QUFDbEI7QUFDQSxZQUFXLE9BQU87QUFDbEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxZQUFXLE1BQU07QUFDakI7QUFDQSxZQUFXLFNBQVM7QUFDcEI7QUFDQSxZQUFXLE9BQU87QUFDbEI7QUFDQSxZQUFXLE9BQU87QUFDbEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLG9CQUFtQixPQUFPO0FBQzFCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxZQUFXLE1BQU07QUFDakI7QUFDQSxZQUFXLFNBQVM7QUFDcEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7Ozs7OztBQ2pIQSxpQkFBZ0Isb0JBQW9CO0FBQ3BDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFVBQVM7QUFDVDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxNQUFLOztBQUVMOztBQUVBO0FBQ0E7QUFDQTtBQUNBLFFBQU87QUFDUDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxrQ0FBaUMsUUFBUTtBQUN6QztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSw4Q0FBNkMsU0FBUztBQUN0RDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxxQkFBb0I7QUFDcEI7QUFDQTtBQUNBLHVDQUFzQztBQUN0QztBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxnQkFBZSxXQUFXO0FBQzFCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxnREFBK0MsU0FBUztBQUN4RDtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBLDBDQUF5QyxTQUFTO0FBQ2xEO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsSUFBRztBQUNIO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsWUFBVztBQUNYO0FBQ0E7QUFDQTtBQUNBLFlBQVc7QUFDWDtBQUNBLFVBQVM7QUFDVDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxNQUFLO0FBQ0w7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFFBQU87QUFDUDtBQUNBO0FBQ0E7QUFDQSw2Q0FBNEMsY0FBYztBQUMxRDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFVBQVM7QUFDVDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsY0FBYTtBQUNiO0FBQ0E7QUFDQTtBQUNBLGNBQWE7QUFDYjtBQUNBLFlBQVc7QUFDWDtBQUNBLFFBQU87QUFDUDtBQUNBO0FBQ0E7QUFDQSxJQUFHO0FBQ0g7QUFDQTtBQUNBLElBQUc7O0FBRUgsV0FBVTtBQUNWOztBQUVBIiwiZmlsZSI6InNvdXJjZS1tYXAuZGVidWcuanMiLCJzb3VyY2VzQ29udGVudCI6WyIoZnVuY3Rpb24gd2VicGFja1VuaXZlcnNhbE1vZHVsZURlZmluaXRpb24ocm9vdCwgZmFjdG9yeSkge1xuXHRpZih0eXBlb2YgZXhwb3J0cyA9PT0gJ29iamVjdCcgJiYgdHlwZW9mIG1vZHVsZSA9PT0gJ29iamVjdCcpXG5cdFx0bW9kdWxlLmV4cG9ydHMgPSBmYWN0b3J5KCk7XG5cdGVsc2UgaWYodHlwZW9mIGRlZmluZSA9PT0gJ2Z1bmN0aW9uJyAmJiBkZWZpbmUuYW1kKVxuXHRcdGRlZmluZShbXSwgZmFjdG9yeSk7XG5cdGVsc2UgaWYodHlwZW9mIGV4cG9ydHMgPT09ICdvYmplY3QnKVxuXHRcdGV4cG9ydHNbXCJzb3VyY2VNYXBcIl0gPSBmYWN0b3J5KCk7XG5cdGVsc2Vcblx0XHRyb290W1wic291cmNlTWFwXCJdID0gZmFjdG9yeSgpO1xufSkodGhpcywgZnVuY3Rpb24oKSB7XG5yZXR1cm4gXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHdlYnBhY2svdW5pdmVyc2FsTW9kdWxlRGVmaW5pdGlvbiIsIiBcdC8vIFRoZSBtb2R1bGUgY2FjaGVcbiBcdHZhciBpbnN0YWxsZWRNb2R1bGVzID0ge307XG5cbiBcdC8vIFRoZSByZXF1aXJlIGZ1bmN0aW9uXG4gXHRmdW5jdGlvbiBfX3dlYnBhY2tfcmVxdWlyZV9fKG1vZHVsZUlkKSB7XG5cbiBcdFx0Ly8gQ2hlY2sgaWYgbW9kdWxlIGlzIGluIGNhY2hlXG4gXHRcdGlmKGluc3RhbGxlZE1vZHVsZXNbbW9kdWxlSWRdKVxuIFx0XHRcdHJldHVybiBpbnN0YWxsZWRNb2R1bGVzW21vZHVsZUlkXS5leHBvcnRzO1xuXG4gXHRcdC8vIENyZWF0ZSBhIG5ldyBtb2R1bGUgKGFuZCBwdXQgaXQgaW50byB0aGUgY2FjaGUpXG4gXHRcdHZhciBtb2R1bGUgPSBpbnN0YWxsZWRNb2R1bGVzW21vZHVsZUlkXSA9IHtcbiBcdFx0XHRleHBvcnRzOiB7fSxcbiBcdFx0XHRpZDogbW9kdWxlSWQsXG4gXHRcdFx0bG9hZGVkOiBmYWxzZVxuIFx0XHR9O1xuXG4gXHRcdC8vIEV4ZWN1dGUgdGhlIG1vZHVsZSBmdW5jdGlvblxuIFx0XHRtb2R1bGVzW21vZHVsZUlkXS5jYWxsKG1vZHVsZS5leHBvcnRzLCBtb2R1bGUsIG1vZHVsZS5leHBvcnRzLCBfX3dlYnBhY2tfcmVxdWlyZV9fKTtcblxuIFx0XHQvLyBGbGFnIHRoZSBtb2R1bGUgYXMgbG9hZGVkXG4gXHRcdG1vZHVsZS5sb2FkZWQgPSB0cnVlO1xuXG4gXHRcdC8vIFJldHVybiB0aGUgZXhwb3J0cyBvZiB0aGUgbW9kdWxlXG4gXHRcdHJldHVybiBtb2R1bGUuZXhwb3J0cztcbiBcdH1cblxuXG4gXHQvLyBleHBvc2UgdGhlIG1vZHVsZXMgb2JqZWN0IChfX3dlYnBhY2tfbW9kdWxlc19fKVxuIFx0X193ZWJwYWNrX3JlcXVpcmVfXy5tID0gbW9kdWxlcztcblxuIFx0Ly8gZXhwb3NlIHRoZSBtb2R1bGUgY2FjaGVcbiBcdF9fd2VicGFja19yZXF1aXJlX18uYyA9IGluc3RhbGxlZE1vZHVsZXM7XG5cbiBcdC8vIF9fd2VicGFja19wdWJsaWNfcGF0aF9fXG4gXHRfX3dlYnBhY2tfcmVxdWlyZV9fLnAgPSBcIlwiO1xuXG4gXHQvLyBMb2FkIGVudHJ5IG1vZHVsZSBhbmQgcmV0dXJuIGV4cG9ydHNcbiBcdHJldHVybiBfX3dlYnBhY2tfcmVxdWlyZV9fKDApO1xuXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHdlYnBhY2svYm9vdHN0cmFwIGU0NzM4ZmM3MmE3YjIzMDM5ODg5IiwiLypcbiAqIENvcHlyaWdodCAyMDA5LTIwMTEgTW96aWxsYSBGb3VuZGF0aW9uIGFuZCBjb250cmlidXRvcnNcbiAqIExpY2Vuc2VkIHVuZGVyIHRoZSBOZXcgQlNEIGxpY2Vuc2UuIFNlZSBMSUNFTlNFLnR4dCBvcjpcbiAqIGh0dHA6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMy1DbGF1c2VcbiAqL1xuZXhwb3J0cy5Tb3VyY2VNYXBHZW5lcmF0b3IgPSByZXF1aXJlKCcuL2xpYi9zb3VyY2UtbWFwLWdlbmVyYXRvcicpLlNvdXJjZU1hcEdlbmVyYXRvcjtcbmV4cG9ydHMuU291cmNlTWFwQ29uc3VtZXIgPSByZXF1aXJlKCcuL2xpYi9zb3VyY2UtbWFwLWNvbnN1bWVyJykuU291cmNlTWFwQ29uc3VtZXI7XG5leHBvcnRzLlNvdXJjZU5vZGUgPSByZXF1aXJlKCcuL2xpYi9zb3VyY2Utbm9kZScpLlNvdXJjZU5vZGU7XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL3NvdXJjZS1tYXAuanNcbi8vIG1vZHVsZSBpZCA9IDBcbi8vIG1vZHVsZSBjaHVua3MgPSAwIiwiLyogLSotIE1vZGU6IGpzOyBqcy1pbmRlbnQtbGV2ZWw6IDI7IC0qLSAqL1xuLypcbiAqIENvcHlyaWdodCAyMDExIE1vemlsbGEgRm91bmRhdGlvbiBhbmQgY29udHJpYnV0b3JzXG4gKiBMaWNlbnNlZCB1bmRlciB0aGUgTmV3IEJTRCBsaWNlbnNlLiBTZWUgTElDRU5TRSBvcjpcbiAqIGh0dHA6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMy1DbGF1c2VcbiAqL1xuXG52YXIgYmFzZTY0VkxRID0gcmVxdWlyZSgnLi9iYXNlNjQtdmxxJyk7XG52YXIgdXRpbCA9IHJlcXVpcmUoJy4vdXRpbCcpO1xudmFyIEFycmF5U2V0ID0gcmVxdWlyZSgnLi9hcnJheS1zZXQnKS5BcnJheVNldDtcbnZhciBNYXBwaW5nTGlzdCA9IHJlcXVpcmUoJy4vbWFwcGluZy1saXN0JykuTWFwcGluZ0xpc3Q7XG5cbi8qKlxuICogQW4gaW5zdGFuY2Ugb2YgdGhlIFNvdXJjZU1hcEdlbmVyYXRvciByZXByZXNlbnRzIGEgc291cmNlIG1hcCB3aGljaCBpc1xuICogYmVpbmcgYnVpbHQgaW5jcmVtZW50YWxseS4gWW91IG1heSBwYXNzIGFuIG9iamVjdCB3aXRoIHRoZSBmb2xsb3dpbmdcbiAqIHByb3BlcnRpZXM6XG4gKlxuICogICAtIGZpbGU6IFRoZSBmaWxlbmFtZSBvZiB0aGUgZ2VuZXJhdGVkIHNvdXJjZS5cbiAqICAgLSBzb3VyY2VSb290OiBBIHJvb3QgZm9yIGFsbCByZWxhdGl2ZSBVUkxzIGluIHRoaXMgc291cmNlIG1hcC5cbiAqL1xuZnVuY3Rpb24gU291cmNlTWFwR2VuZXJhdG9yKGFBcmdzKSB7XG4gIGlmICghYUFyZ3MpIHtcbiAgICBhQXJncyA9IHt9O1xuICB9XG4gIHRoaXMuX2ZpbGUgPSB1dGlsLmdldEFyZyhhQXJncywgJ2ZpbGUnLCBudWxsKTtcbiAgdGhpcy5fc291cmNlUm9vdCA9IHV0aWwuZ2V0QXJnKGFBcmdzLCAnc291cmNlUm9vdCcsIG51bGwpO1xuICB0aGlzLl9za2lwVmFsaWRhdGlvbiA9IHV0aWwuZ2V0QXJnKGFBcmdzLCAnc2tpcFZhbGlkYXRpb24nLCBmYWxzZSk7XG4gIHRoaXMuX3NvdXJjZXMgPSBuZXcgQXJyYXlTZXQoKTtcbiAgdGhpcy5fbmFtZXMgPSBuZXcgQXJyYXlTZXQoKTtcbiAgdGhpcy5fbWFwcGluZ3MgPSBuZXcgTWFwcGluZ0xpc3QoKTtcbiAgdGhpcy5fc291cmNlc0NvbnRlbnRzID0gbnVsbDtcbn1cblxuU291cmNlTWFwR2VuZXJhdG9yLnByb3RvdHlwZS5fdmVyc2lvbiA9IDM7XG5cbi8qKlxuICogQ3JlYXRlcyBhIG5ldyBTb3VyY2VNYXBHZW5lcmF0b3IgYmFzZWQgb24gYSBTb3VyY2VNYXBDb25zdW1lclxuICpcbiAqIEBwYXJhbSBhU291cmNlTWFwQ29uc3VtZXIgVGhlIFNvdXJjZU1hcC5cbiAqL1xuU291cmNlTWFwR2VuZXJhdG9yLmZyb21Tb3VyY2VNYXAgPVxuICBmdW5jdGlvbiBTb3VyY2VNYXBHZW5lcmF0b3JfZnJvbVNvdXJjZU1hcChhU291cmNlTWFwQ29uc3VtZXIpIHtcbiAgICB2YXIgc291cmNlUm9vdCA9IGFTb3VyY2VNYXBDb25zdW1lci5zb3VyY2VSb290O1xuICAgIHZhciBnZW5lcmF0b3IgPSBuZXcgU291cmNlTWFwR2VuZXJhdG9yKHtcbiAgICAgIGZpbGU6IGFTb3VyY2VNYXBDb25zdW1lci5maWxlLFxuICAgICAgc291cmNlUm9vdDogc291cmNlUm9vdFxuICAgIH0pO1xuICAgIGFTb3VyY2VNYXBDb25zdW1lci5lYWNoTWFwcGluZyhmdW5jdGlvbiAobWFwcGluZykge1xuICAgICAgdmFyIG5ld01hcHBpbmcgPSB7XG4gICAgICAgIGdlbmVyYXRlZDoge1xuICAgICAgICAgIGxpbmU6IG1hcHBpbmcuZ2VuZXJhdGVkTGluZSxcbiAgICAgICAgICBjb2x1bW46IG1hcHBpbmcuZ2VuZXJhdGVkQ29sdW1uXG4gICAgICAgIH1cbiAgICAgIH07XG5cbiAgICAgIGlmIChtYXBwaW5nLnNvdXJjZSAhPSBudWxsKSB7XG4gICAgICAgIG5ld01hcHBpbmcuc291cmNlID0gbWFwcGluZy5zb3VyY2U7XG4gICAgICAgIGlmIChzb3VyY2VSb290ICE9IG51bGwpIHtcbiAgICAgICAgICBuZXdNYXBwaW5nLnNvdXJjZSA9IHV0aWwucmVsYXRpdmUoc291cmNlUm9vdCwgbmV3TWFwcGluZy5zb3VyY2UpO1xuICAgICAgICB9XG5cbiAgICAgICAgbmV3TWFwcGluZy5vcmlnaW5hbCA9IHtcbiAgICAgICAgICBsaW5lOiBtYXBwaW5nLm9yaWdpbmFsTGluZSxcbiAgICAgICAgICBjb2x1bW46IG1hcHBpbmcub3JpZ2luYWxDb2x1bW5cbiAgICAgICAgfTtcblxuICAgICAgICBpZiAobWFwcGluZy5uYW1lICE9IG51bGwpIHtcbiAgICAgICAgICBuZXdNYXBwaW5nLm5hbWUgPSBtYXBwaW5nLm5hbWU7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgZ2VuZXJhdG9yLmFkZE1hcHBpbmcobmV3TWFwcGluZyk7XG4gICAgfSk7XG4gICAgYVNvdXJjZU1hcENvbnN1bWVyLnNvdXJjZXMuZm9yRWFjaChmdW5jdGlvbiAoc291cmNlRmlsZSkge1xuICAgICAgdmFyIGNvbnRlbnQgPSBhU291cmNlTWFwQ29uc3VtZXIuc291cmNlQ29udGVudEZvcihzb3VyY2VGaWxlKTtcbiAgICAgIGlmIChjb250ZW50ICE9IG51bGwpIHtcbiAgICAgICAgZ2VuZXJhdG9yLnNldFNvdXJjZUNvbnRlbnQoc291cmNlRmlsZSwgY29udGVudCk7XG4gICAgICB9XG4gICAgfSk7XG4gICAgcmV0dXJuIGdlbmVyYXRvcjtcbiAgfTtcblxuLyoqXG4gKiBBZGQgYSBzaW5nbGUgbWFwcGluZyBmcm9tIG9yaWdpbmFsIHNvdXJjZSBsaW5lIGFuZCBjb2x1bW4gdG8gdGhlIGdlbmVyYXRlZFxuICogc291cmNlJ3MgbGluZSBhbmQgY29sdW1uIGZvciB0aGlzIHNvdXJjZSBtYXAgYmVpbmcgY3JlYXRlZC4gVGhlIG1hcHBpbmdcbiAqIG9iamVjdCBzaG91bGQgaGF2ZSB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIGdlbmVyYXRlZDogQW4gb2JqZWN0IHdpdGggdGhlIGdlbmVyYXRlZCBsaW5lIGFuZCBjb2x1bW4gcG9zaXRpb25zLlxuICogICAtIG9yaWdpbmFsOiBBbiBvYmplY3Qgd2l0aCB0aGUgb3JpZ2luYWwgbGluZSBhbmQgY29sdW1uIHBvc2l0aW9ucy5cbiAqICAgLSBzb3VyY2U6IFRoZSBvcmlnaW5hbCBzb3VyY2UgZmlsZSAocmVsYXRpdmUgdG8gdGhlIHNvdXJjZVJvb3QpLlxuICogICAtIG5hbWU6IEFuIG9wdGlvbmFsIG9yaWdpbmFsIHRva2VuIG5hbWUgZm9yIHRoaXMgbWFwcGluZy5cbiAqL1xuU291cmNlTWFwR2VuZXJhdG9yLnByb3RvdHlwZS5hZGRNYXBwaW5nID1cbiAgZnVuY3Rpb24gU291cmNlTWFwR2VuZXJhdG9yX2FkZE1hcHBpbmcoYUFyZ3MpIHtcbiAgICB2YXIgZ2VuZXJhdGVkID0gdXRpbC5nZXRBcmcoYUFyZ3MsICdnZW5lcmF0ZWQnKTtcbiAgICB2YXIgb3JpZ2luYWwgPSB1dGlsLmdldEFyZyhhQXJncywgJ29yaWdpbmFsJywgbnVsbCk7XG4gICAgdmFyIHNvdXJjZSA9IHV0aWwuZ2V0QXJnKGFBcmdzLCAnc291cmNlJywgbnVsbCk7XG4gICAgdmFyIG5hbWUgPSB1dGlsLmdldEFyZyhhQXJncywgJ25hbWUnLCBudWxsKTtcblxuICAgIGlmICghdGhpcy5fc2tpcFZhbGlkYXRpb24pIHtcbiAgICAgIHRoaXMuX3ZhbGlkYXRlTWFwcGluZyhnZW5lcmF0ZWQsIG9yaWdpbmFsLCBzb3VyY2UsIG5hbWUpO1xuICAgIH1cblxuICAgIGlmIChzb3VyY2UgIT0gbnVsbCkge1xuICAgICAgc291cmNlID0gU3RyaW5nKHNvdXJjZSk7XG4gICAgICBpZiAoIXRoaXMuX3NvdXJjZXMuaGFzKHNvdXJjZSkpIHtcbiAgICAgICAgdGhpcy5fc291cmNlcy5hZGQoc291cmNlKTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICBpZiAobmFtZSAhPSBudWxsKSB7XG4gICAgICBuYW1lID0gU3RyaW5nKG5hbWUpO1xuICAgICAgaWYgKCF0aGlzLl9uYW1lcy5oYXMobmFtZSkpIHtcbiAgICAgICAgdGhpcy5fbmFtZXMuYWRkKG5hbWUpO1xuICAgICAgfVxuICAgIH1cblxuICAgIHRoaXMuX21hcHBpbmdzLmFkZCh7XG4gICAgICBnZW5lcmF0ZWRMaW5lOiBnZW5lcmF0ZWQubGluZSxcbiAgICAgIGdlbmVyYXRlZENvbHVtbjogZ2VuZXJhdGVkLmNvbHVtbixcbiAgICAgIG9yaWdpbmFsTGluZTogb3JpZ2luYWwgIT0gbnVsbCAmJiBvcmlnaW5hbC5saW5lLFxuICAgICAgb3JpZ2luYWxDb2x1bW46IG9yaWdpbmFsICE9IG51bGwgJiYgb3JpZ2luYWwuY29sdW1uLFxuICAgICAgc291cmNlOiBzb3VyY2UsXG4gICAgICBuYW1lOiBuYW1lXG4gICAgfSk7XG4gIH07XG5cbi8qKlxuICogU2V0IHRoZSBzb3VyY2UgY29udGVudCBmb3IgYSBzb3VyY2UgZmlsZS5cbiAqL1xuU291cmNlTWFwR2VuZXJhdG9yLnByb3RvdHlwZS5zZXRTb3VyY2VDb250ZW50ID1cbiAgZnVuY3Rpb24gU291cmNlTWFwR2VuZXJhdG9yX3NldFNvdXJjZUNvbnRlbnQoYVNvdXJjZUZpbGUsIGFTb3VyY2VDb250ZW50KSB7XG4gICAgdmFyIHNvdXJjZSA9IGFTb3VyY2VGaWxlO1xuICAgIGlmICh0aGlzLl9zb3VyY2VSb290ICE9IG51bGwpIHtcbiAgICAgIHNvdXJjZSA9IHV0aWwucmVsYXRpdmUodGhpcy5fc291cmNlUm9vdCwgc291cmNlKTtcbiAgICB9XG5cbiAgICBpZiAoYVNvdXJjZUNvbnRlbnQgIT0gbnVsbCkge1xuICAgICAgLy8gQWRkIHRoZSBzb3VyY2UgY29udGVudCB0byB0aGUgX3NvdXJjZXNDb250ZW50cyBtYXAuXG4gICAgICAvLyBDcmVhdGUgYSBuZXcgX3NvdXJjZXNDb250ZW50cyBtYXAgaWYgdGhlIHByb3BlcnR5IGlzIG51bGwuXG4gICAgICBpZiAoIXRoaXMuX3NvdXJjZXNDb250ZW50cykge1xuICAgICAgICB0aGlzLl9zb3VyY2VzQ29udGVudHMgPSBPYmplY3QuY3JlYXRlKG51bGwpO1xuICAgICAgfVxuICAgICAgdGhpcy5fc291cmNlc0NvbnRlbnRzW3V0aWwudG9TZXRTdHJpbmcoc291cmNlKV0gPSBhU291cmNlQ29udGVudDtcbiAgICB9IGVsc2UgaWYgKHRoaXMuX3NvdXJjZXNDb250ZW50cykge1xuICAgICAgLy8gUmVtb3ZlIHRoZSBzb3VyY2UgZmlsZSBmcm9tIHRoZSBfc291cmNlc0NvbnRlbnRzIG1hcC5cbiAgICAgIC8vIElmIHRoZSBfc291cmNlc0NvbnRlbnRzIG1hcCBpcyBlbXB0eSwgc2V0IHRoZSBwcm9wZXJ0eSB0byBudWxsLlxuICAgICAgZGVsZXRlIHRoaXMuX3NvdXJjZXNDb250ZW50c1t1dGlsLnRvU2V0U3RyaW5nKHNvdXJjZSldO1xuICAgICAgaWYgKE9iamVjdC5rZXlzKHRoaXMuX3NvdXJjZXNDb250ZW50cykubGVuZ3RoID09PSAwKSB7XG4gICAgICAgIHRoaXMuX3NvdXJjZXNDb250ZW50cyA9IG51bGw7XG4gICAgICB9XG4gICAgfVxuICB9O1xuXG4vKipcbiAqIEFwcGxpZXMgdGhlIG1hcHBpbmdzIG9mIGEgc3ViLXNvdXJjZS1tYXAgZm9yIGEgc3BlY2lmaWMgc291cmNlIGZpbGUgdG8gdGhlXG4gKiBzb3VyY2UgbWFwIGJlaW5nIGdlbmVyYXRlZC4gRWFjaCBtYXBwaW5nIHRvIHRoZSBzdXBwbGllZCBzb3VyY2UgZmlsZSBpc1xuICogcmV3cml0dGVuIHVzaW5nIHRoZSBzdXBwbGllZCBzb3VyY2UgbWFwLiBOb3RlOiBUaGUgcmVzb2x1dGlvbiBmb3IgdGhlXG4gKiByZXN1bHRpbmcgbWFwcGluZ3MgaXMgdGhlIG1pbmltaXVtIG9mIHRoaXMgbWFwIGFuZCB0aGUgc3VwcGxpZWQgbWFwLlxuICpcbiAqIEBwYXJhbSBhU291cmNlTWFwQ29uc3VtZXIgVGhlIHNvdXJjZSBtYXAgdG8gYmUgYXBwbGllZC5cbiAqIEBwYXJhbSBhU291cmNlRmlsZSBPcHRpb25hbC4gVGhlIGZpbGVuYW1lIG9mIHRoZSBzb3VyY2UgZmlsZS5cbiAqICAgICAgICBJZiBvbWl0dGVkLCBTb3VyY2VNYXBDb25zdW1lcidzIGZpbGUgcHJvcGVydHkgd2lsbCBiZSB1c2VkLlxuICogQHBhcmFtIGFTb3VyY2VNYXBQYXRoIE9wdGlvbmFsLiBUaGUgZGlybmFtZSBvZiB0aGUgcGF0aCB0byB0aGUgc291cmNlIG1hcFxuICogICAgICAgIHRvIGJlIGFwcGxpZWQuIElmIHJlbGF0aXZlLCBpdCBpcyByZWxhdGl2ZSB0byB0aGUgU291cmNlTWFwQ29uc3VtZXIuXG4gKiAgICAgICAgVGhpcyBwYXJhbWV0ZXIgaXMgbmVlZGVkIHdoZW4gdGhlIHR3byBzb3VyY2UgbWFwcyBhcmVuJ3QgaW4gdGhlIHNhbWVcbiAqICAgICAgICBkaXJlY3RvcnksIGFuZCB0aGUgc291cmNlIG1hcCB0byBiZSBhcHBsaWVkIGNvbnRhaW5zIHJlbGF0aXZlIHNvdXJjZVxuICogICAgICAgIHBhdGhzLiBJZiBzbywgdGhvc2UgcmVsYXRpdmUgc291cmNlIHBhdGhzIG5lZWQgdG8gYmUgcmV3cml0dGVuXG4gKiAgICAgICAgcmVsYXRpdmUgdG8gdGhlIFNvdXJjZU1hcEdlbmVyYXRvci5cbiAqL1xuU291cmNlTWFwR2VuZXJhdG9yLnByb3RvdHlwZS5hcHBseVNvdXJjZU1hcCA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcEdlbmVyYXRvcl9hcHBseVNvdXJjZU1hcChhU291cmNlTWFwQ29uc3VtZXIsIGFTb3VyY2VGaWxlLCBhU291cmNlTWFwUGF0aCkge1xuICAgIHZhciBzb3VyY2VGaWxlID0gYVNvdXJjZUZpbGU7XG4gICAgLy8gSWYgYVNvdXJjZUZpbGUgaXMgb21pdHRlZCwgd2Ugd2lsbCB1c2UgdGhlIGZpbGUgcHJvcGVydHkgb2YgdGhlIFNvdXJjZU1hcFxuICAgIGlmIChhU291cmNlRmlsZSA9PSBudWxsKSB7XG4gICAgICBpZiAoYVNvdXJjZU1hcENvbnN1bWVyLmZpbGUgPT0gbnVsbCkge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXG4gICAgICAgICAgJ1NvdXJjZU1hcEdlbmVyYXRvci5wcm90b3R5cGUuYXBwbHlTb3VyY2VNYXAgcmVxdWlyZXMgZWl0aGVyIGFuIGV4cGxpY2l0IHNvdXJjZSBmaWxlLCAnICtcbiAgICAgICAgICAnb3IgdGhlIHNvdXJjZSBtYXBcXCdzIFwiZmlsZVwiIHByb3BlcnR5LiBCb3RoIHdlcmUgb21pdHRlZC4nXG4gICAgICAgICk7XG4gICAgICB9XG4gICAgICBzb3VyY2VGaWxlID0gYVNvdXJjZU1hcENvbnN1bWVyLmZpbGU7XG4gICAgfVxuICAgIHZhciBzb3VyY2VSb290ID0gdGhpcy5fc291cmNlUm9vdDtcbiAgICAvLyBNYWtlIFwic291cmNlRmlsZVwiIHJlbGF0aXZlIGlmIGFuIGFic29sdXRlIFVybCBpcyBwYXNzZWQuXG4gICAgaWYgKHNvdXJjZVJvb3QgIT0gbnVsbCkge1xuICAgICAgc291cmNlRmlsZSA9IHV0aWwucmVsYXRpdmUoc291cmNlUm9vdCwgc291cmNlRmlsZSk7XG4gICAgfVxuICAgIC8vIEFwcGx5aW5nIHRoZSBTb3VyY2VNYXAgY2FuIGFkZCBhbmQgcmVtb3ZlIGl0ZW1zIGZyb20gdGhlIHNvdXJjZXMgYW5kXG4gICAgLy8gdGhlIG5hbWVzIGFycmF5LlxuICAgIHZhciBuZXdTb3VyY2VzID0gbmV3IEFycmF5U2V0KCk7XG4gICAgdmFyIG5ld05hbWVzID0gbmV3IEFycmF5U2V0KCk7XG5cbiAgICAvLyBGaW5kIG1hcHBpbmdzIGZvciB0aGUgXCJzb3VyY2VGaWxlXCJcbiAgICB0aGlzLl9tYXBwaW5ncy51bnNvcnRlZEZvckVhY2goZnVuY3Rpb24gKG1hcHBpbmcpIHtcbiAgICAgIGlmIChtYXBwaW5nLnNvdXJjZSA9PT0gc291cmNlRmlsZSAmJiBtYXBwaW5nLm9yaWdpbmFsTGluZSAhPSBudWxsKSB7XG4gICAgICAgIC8vIENoZWNrIGlmIGl0IGNhbiBiZSBtYXBwZWQgYnkgdGhlIHNvdXJjZSBtYXAsIHRoZW4gdXBkYXRlIHRoZSBtYXBwaW5nLlxuICAgICAgICB2YXIgb3JpZ2luYWwgPSBhU291cmNlTWFwQ29uc3VtZXIub3JpZ2luYWxQb3NpdGlvbkZvcih7XG4gICAgICAgICAgbGluZTogbWFwcGluZy5vcmlnaW5hbExpbmUsXG4gICAgICAgICAgY29sdW1uOiBtYXBwaW5nLm9yaWdpbmFsQ29sdW1uXG4gICAgICAgIH0pO1xuICAgICAgICBpZiAob3JpZ2luYWwuc291cmNlICE9IG51bGwpIHtcbiAgICAgICAgICAvLyBDb3B5IG1hcHBpbmdcbiAgICAgICAgICBtYXBwaW5nLnNvdXJjZSA9IG9yaWdpbmFsLnNvdXJjZTtcbiAgICAgICAgICBpZiAoYVNvdXJjZU1hcFBhdGggIT0gbnVsbCkge1xuICAgICAgICAgICAgbWFwcGluZy5zb3VyY2UgPSB1dGlsLmpvaW4oYVNvdXJjZU1hcFBhdGgsIG1hcHBpbmcuc291cmNlKVxuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoc291cmNlUm9vdCAhPSBudWxsKSB7XG4gICAgICAgICAgICBtYXBwaW5nLnNvdXJjZSA9IHV0aWwucmVsYXRpdmUoc291cmNlUm9vdCwgbWFwcGluZy5zb3VyY2UpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBtYXBwaW5nLm9yaWdpbmFsTGluZSA9IG9yaWdpbmFsLmxpbmU7XG4gICAgICAgICAgbWFwcGluZy5vcmlnaW5hbENvbHVtbiA9IG9yaWdpbmFsLmNvbHVtbjtcbiAgICAgICAgICBpZiAob3JpZ2luYWwubmFtZSAhPSBudWxsKSB7XG4gICAgICAgICAgICBtYXBwaW5nLm5hbWUgPSBvcmlnaW5hbC5uYW1lO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICB2YXIgc291cmNlID0gbWFwcGluZy5zb3VyY2U7XG4gICAgICBpZiAoc291cmNlICE9IG51bGwgJiYgIW5ld1NvdXJjZXMuaGFzKHNvdXJjZSkpIHtcbiAgICAgICAgbmV3U291cmNlcy5hZGQoc291cmNlKTtcbiAgICAgIH1cblxuICAgICAgdmFyIG5hbWUgPSBtYXBwaW5nLm5hbWU7XG4gICAgICBpZiAobmFtZSAhPSBudWxsICYmICFuZXdOYW1lcy5oYXMobmFtZSkpIHtcbiAgICAgICAgbmV3TmFtZXMuYWRkKG5hbWUpO1xuICAgICAgfVxuXG4gICAgfSwgdGhpcyk7XG4gICAgdGhpcy5fc291cmNlcyA9IG5ld1NvdXJjZXM7XG4gICAgdGhpcy5fbmFtZXMgPSBuZXdOYW1lcztcblxuICAgIC8vIENvcHkgc291cmNlc0NvbnRlbnRzIG9mIGFwcGxpZWQgbWFwLlxuICAgIGFTb3VyY2VNYXBDb25zdW1lci5zb3VyY2VzLmZvckVhY2goZnVuY3Rpb24gKHNvdXJjZUZpbGUpIHtcbiAgICAgIHZhciBjb250ZW50ID0gYVNvdXJjZU1hcENvbnN1bWVyLnNvdXJjZUNvbnRlbnRGb3Ioc291cmNlRmlsZSk7XG4gICAgICBpZiAoY29udGVudCAhPSBudWxsKSB7XG4gICAgICAgIGlmIChhU291cmNlTWFwUGF0aCAhPSBudWxsKSB7XG4gICAgICAgICAgc291cmNlRmlsZSA9IHV0aWwuam9pbihhU291cmNlTWFwUGF0aCwgc291cmNlRmlsZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHNvdXJjZVJvb3QgIT0gbnVsbCkge1xuICAgICAgICAgIHNvdXJjZUZpbGUgPSB1dGlsLnJlbGF0aXZlKHNvdXJjZVJvb3QsIHNvdXJjZUZpbGUpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMuc2V0U291cmNlQ29udGVudChzb3VyY2VGaWxlLCBjb250ZW50KTtcbiAgICAgIH1cbiAgICB9LCB0aGlzKTtcbiAgfTtcblxuLyoqXG4gKiBBIG1hcHBpbmcgY2FuIGhhdmUgb25lIG9mIHRoZSB0aHJlZSBsZXZlbHMgb2YgZGF0YTpcbiAqXG4gKiAgIDEuIEp1c3QgdGhlIGdlbmVyYXRlZCBwb3NpdGlvbi5cbiAqICAgMi4gVGhlIEdlbmVyYXRlZCBwb3NpdGlvbiwgb3JpZ2luYWwgcG9zaXRpb24sIGFuZCBvcmlnaW5hbCBzb3VyY2UuXG4gKiAgIDMuIEdlbmVyYXRlZCBhbmQgb3JpZ2luYWwgcG9zaXRpb24sIG9yaWdpbmFsIHNvdXJjZSwgYXMgd2VsbCBhcyBhIG5hbWVcbiAqICAgICAgdG9rZW4uXG4gKlxuICogVG8gbWFpbnRhaW4gY29uc2lzdGVuY3ksIHdlIHZhbGlkYXRlIHRoYXQgYW55IG5ldyBtYXBwaW5nIGJlaW5nIGFkZGVkIGZhbGxzXG4gKiBpbiB0byBvbmUgb2YgdGhlc2UgY2F0ZWdvcmllcy5cbiAqL1xuU291cmNlTWFwR2VuZXJhdG9yLnByb3RvdHlwZS5fdmFsaWRhdGVNYXBwaW5nID1cbiAgZnVuY3Rpb24gU291cmNlTWFwR2VuZXJhdG9yX3ZhbGlkYXRlTWFwcGluZyhhR2VuZXJhdGVkLCBhT3JpZ2luYWwsIGFTb3VyY2UsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYU5hbWUpIHtcbiAgICAvLyBXaGVuIGFPcmlnaW5hbCBpcyB0cnV0aHkgYnV0IGhhcyBlbXB0eSB2YWx1ZXMgZm9yIC5saW5lIGFuZCAuY29sdW1uLFxuICAgIC8vIGl0IGlzIG1vc3QgbGlrZWx5IGEgcHJvZ3JhbW1lciBlcnJvci4gSW4gdGhpcyBjYXNlIHdlIHRocm93IGEgdmVyeVxuICAgIC8vIHNwZWNpZmljIGVycm9yIG1lc3NhZ2UgdG8gdHJ5IHRvIGd1aWRlIHRoZW0gdGhlIHJpZ2h0IHdheS5cbiAgICAvLyBGb3IgZXhhbXBsZTogaHR0cHM6Ly9naXRodWIuY29tL1BvbHltZXIvcG9seW1lci1idW5kbGVyL3B1bGwvNTE5XG4gICAgaWYgKGFPcmlnaW5hbCAmJiB0eXBlb2YgYU9yaWdpbmFsLmxpbmUgIT09ICdudW1iZXInICYmIHR5cGVvZiBhT3JpZ2luYWwuY29sdW1uICE9PSAnbnVtYmVyJykge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXG4gICAgICAgICAgICAnb3JpZ2luYWwubGluZSBhbmQgb3JpZ2luYWwuY29sdW1uIGFyZSBub3QgbnVtYmVycyAtLSB5b3UgcHJvYmFibHkgbWVhbnQgdG8gb21pdCAnICtcbiAgICAgICAgICAgICd0aGUgb3JpZ2luYWwgbWFwcGluZyBlbnRpcmVseSBhbmQgb25seSBtYXAgdGhlIGdlbmVyYXRlZCBwb3NpdGlvbi4gSWYgc28sIHBhc3MgJyArXG4gICAgICAgICAgICAnbnVsbCBmb3IgdGhlIG9yaWdpbmFsIG1hcHBpbmcgaW5zdGVhZCBvZiBhbiBvYmplY3Qgd2l0aCBlbXB0eSBvciBudWxsIHZhbHVlcy4nXG4gICAgICAgICk7XG4gICAgfVxuXG4gICAgaWYgKGFHZW5lcmF0ZWQgJiYgJ2xpbmUnIGluIGFHZW5lcmF0ZWQgJiYgJ2NvbHVtbicgaW4gYUdlbmVyYXRlZFxuICAgICAgICAmJiBhR2VuZXJhdGVkLmxpbmUgPiAwICYmIGFHZW5lcmF0ZWQuY29sdW1uID49IDBcbiAgICAgICAgJiYgIWFPcmlnaW5hbCAmJiAhYVNvdXJjZSAmJiAhYU5hbWUpIHtcbiAgICAgIC8vIENhc2UgMS5cbiAgICAgIHJldHVybjtcbiAgICB9XG4gICAgZWxzZSBpZiAoYUdlbmVyYXRlZCAmJiAnbGluZScgaW4gYUdlbmVyYXRlZCAmJiAnY29sdW1uJyBpbiBhR2VuZXJhdGVkXG4gICAgICAgICAgICAgJiYgYU9yaWdpbmFsICYmICdsaW5lJyBpbiBhT3JpZ2luYWwgJiYgJ2NvbHVtbicgaW4gYU9yaWdpbmFsXG4gICAgICAgICAgICAgJiYgYUdlbmVyYXRlZC5saW5lID4gMCAmJiBhR2VuZXJhdGVkLmNvbHVtbiA+PSAwXG4gICAgICAgICAgICAgJiYgYU9yaWdpbmFsLmxpbmUgPiAwICYmIGFPcmlnaW5hbC5jb2x1bW4gPj0gMFxuICAgICAgICAgICAgICYmIGFTb3VyY2UpIHtcbiAgICAgIC8vIENhc2VzIDIgYW5kIDMuXG4gICAgICByZXR1cm47XG4gICAgfVxuICAgIGVsc2Uge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKCdJbnZhbGlkIG1hcHBpbmc6ICcgKyBKU09OLnN0cmluZ2lmeSh7XG4gICAgICAgIGdlbmVyYXRlZDogYUdlbmVyYXRlZCxcbiAgICAgICAgc291cmNlOiBhU291cmNlLFxuICAgICAgICBvcmlnaW5hbDogYU9yaWdpbmFsLFxuICAgICAgICBuYW1lOiBhTmFtZVxuICAgICAgfSkpO1xuICAgIH1cbiAgfTtcblxuLyoqXG4gKiBTZXJpYWxpemUgdGhlIGFjY3VtdWxhdGVkIG1hcHBpbmdzIGluIHRvIHRoZSBzdHJlYW0gb2YgYmFzZSA2NCBWTFFzXG4gKiBzcGVjaWZpZWQgYnkgdGhlIHNvdXJjZSBtYXAgZm9ybWF0LlxuICovXG5Tb3VyY2VNYXBHZW5lcmF0b3IucHJvdG90eXBlLl9zZXJpYWxpemVNYXBwaW5ncyA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcEdlbmVyYXRvcl9zZXJpYWxpemVNYXBwaW5ncygpIHtcbiAgICB2YXIgcHJldmlvdXNHZW5lcmF0ZWRDb2x1bW4gPSAwO1xuICAgIHZhciBwcmV2aW91c0dlbmVyYXRlZExpbmUgPSAxO1xuICAgIHZhciBwcmV2aW91c09yaWdpbmFsQ29sdW1uID0gMDtcbiAgICB2YXIgcHJldmlvdXNPcmlnaW5hbExpbmUgPSAwO1xuICAgIHZhciBwcmV2aW91c05hbWUgPSAwO1xuICAgIHZhciBwcmV2aW91c1NvdXJjZSA9IDA7XG4gICAgdmFyIHJlc3VsdCA9ICcnO1xuICAgIHZhciBuZXh0O1xuICAgIHZhciBtYXBwaW5nO1xuICAgIHZhciBuYW1lSWR4O1xuICAgIHZhciBzb3VyY2VJZHg7XG5cbiAgICB2YXIgbWFwcGluZ3MgPSB0aGlzLl9tYXBwaW5ncy50b0FycmF5KCk7XG4gICAgZm9yICh2YXIgaSA9IDAsIGxlbiA9IG1hcHBpbmdzLmxlbmd0aDsgaSA8IGxlbjsgaSsrKSB7XG4gICAgICBtYXBwaW5nID0gbWFwcGluZ3NbaV07XG4gICAgICBuZXh0ID0gJydcblxuICAgICAgaWYgKG1hcHBpbmcuZ2VuZXJhdGVkTGluZSAhPT0gcHJldmlvdXNHZW5lcmF0ZWRMaW5lKSB7XG4gICAgICAgIHByZXZpb3VzR2VuZXJhdGVkQ29sdW1uID0gMDtcbiAgICAgICAgd2hpbGUgKG1hcHBpbmcuZ2VuZXJhdGVkTGluZSAhPT0gcHJldmlvdXNHZW5lcmF0ZWRMaW5lKSB7XG4gICAgICAgICAgbmV4dCArPSAnOyc7XG4gICAgICAgICAgcHJldmlvdXNHZW5lcmF0ZWRMaW5lKys7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIGVsc2Uge1xuICAgICAgICBpZiAoaSA+IDApIHtcbiAgICAgICAgICBpZiAoIXV0aWwuY29tcGFyZUJ5R2VuZXJhdGVkUG9zaXRpb25zSW5mbGF0ZWQobWFwcGluZywgbWFwcGluZ3NbaSAtIDFdKSkge1xuICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgfVxuICAgICAgICAgIG5leHQgKz0gJywnO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIG5leHQgKz0gYmFzZTY0VkxRLmVuY29kZShtYXBwaW5nLmdlbmVyYXRlZENvbHVtblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBwcmV2aW91c0dlbmVyYXRlZENvbHVtbik7XG4gICAgICBwcmV2aW91c0dlbmVyYXRlZENvbHVtbiA9IG1hcHBpbmcuZ2VuZXJhdGVkQ29sdW1uO1xuXG4gICAgICBpZiAobWFwcGluZy5zb3VyY2UgIT0gbnVsbCkge1xuICAgICAgICBzb3VyY2VJZHggPSB0aGlzLl9zb3VyY2VzLmluZGV4T2YobWFwcGluZy5zb3VyY2UpO1xuICAgICAgICBuZXh0ICs9IGJhc2U2NFZMUS5lbmNvZGUoc291cmNlSWR4IC0gcHJldmlvdXNTb3VyY2UpO1xuICAgICAgICBwcmV2aW91c1NvdXJjZSA9IHNvdXJjZUlkeDtcblxuICAgICAgICAvLyBsaW5lcyBhcmUgc3RvcmVkIDAtYmFzZWQgaW4gU291cmNlTWFwIHNwZWMgdmVyc2lvbiAzXG4gICAgICAgIG5leHQgKz0gYmFzZTY0VkxRLmVuY29kZShtYXBwaW5nLm9yaWdpbmFsTGluZSAtIDFcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBwcmV2aW91c09yaWdpbmFsTGluZSk7XG4gICAgICAgIHByZXZpb3VzT3JpZ2luYWxMaW5lID0gbWFwcGluZy5vcmlnaW5hbExpbmUgLSAxO1xuXG4gICAgICAgIG5leHQgKz0gYmFzZTY0VkxRLmVuY29kZShtYXBwaW5nLm9yaWdpbmFsQ29sdW1uXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gcHJldmlvdXNPcmlnaW5hbENvbHVtbik7XG4gICAgICAgIHByZXZpb3VzT3JpZ2luYWxDb2x1bW4gPSBtYXBwaW5nLm9yaWdpbmFsQ29sdW1uO1xuXG4gICAgICAgIGlmIChtYXBwaW5nLm5hbWUgIT0gbnVsbCkge1xuICAgICAgICAgIG5hbWVJZHggPSB0aGlzLl9uYW1lcy5pbmRleE9mKG1hcHBpbmcubmFtZSk7XG4gICAgICAgICAgbmV4dCArPSBiYXNlNjRWTFEuZW5jb2RlKG5hbWVJZHggLSBwcmV2aW91c05hbWUpO1xuICAgICAgICAgIHByZXZpb3VzTmFtZSA9IG5hbWVJZHg7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgcmVzdWx0ICs9IG5leHQ7XG4gICAgfVxuXG4gICAgcmV0dXJuIHJlc3VsdDtcbiAgfTtcblxuU291cmNlTWFwR2VuZXJhdG9yLnByb3RvdHlwZS5fZ2VuZXJhdGVTb3VyY2VzQ29udGVudCA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcEdlbmVyYXRvcl9nZW5lcmF0ZVNvdXJjZXNDb250ZW50KGFTb3VyY2VzLCBhU291cmNlUm9vdCkge1xuICAgIHJldHVybiBhU291cmNlcy5tYXAoZnVuY3Rpb24gKHNvdXJjZSkge1xuICAgICAgaWYgKCF0aGlzLl9zb3VyY2VzQ29udGVudHMpIHtcbiAgICAgICAgcmV0dXJuIG51bGw7XG4gICAgICB9XG4gICAgICBpZiAoYVNvdXJjZVJvb3QgIT0gbnVsbCkge1xuICAgICAgICBzb3VyY2UgPSB1dGlsLnJlbGF0aXZlKGFTb3VyY2VSb290LCBzb3VyY2UpO1xuICAgICAgfVxuICAgICAgdmFyIGtleSA9IHV0aWwudG9TZXRTdHJpbmcoc291cmNlKTtcbiAgICAgIHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwodGhpcy5fc291cmNlc0NvbnRlbnRzLCBrZXkpXG4gICAgICAgID8gdGhpcy5fc291cmNlc0NvbnRlbnRzW2tleV1cbiAgICAgICAgOiBudWxsO1xuICAgIH0sIHRoaXMpO1xuICB9O1xuXG4vKipcbiAqIEV4dGVybmFsaXplIHRoZSBzb3VyY2UgbWFwLlxuICovXG5Tb3VyY2VNYXBHZW5lcmF0b3IucHJvdG90eXBlLnRvSlNPTiA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcEdlbmVyYXRvcl90b0pTT04oKSB7XG4gICAgdmFyIG1hcCA9IHtcbiAgICAgIHZlcnNpb246IHRoaXMuX3ZlcnNpb24sXG4gICAgICBzb3VyY2VzOiB0aGlzLl9zb3VyY2VzLnRvQXJyYXkoKSxcbiAgICAgIG5hbWVzOiB0aGlzLl9uYW1lcy50b0FycmF5KCksXG4gICAgICBtYXBwaW5nczogdGhpcy5fc2VyaWFsaXplTWFwcGluZ3MoKVxuICAgIH07XG4gICAgaWYgKHRoaXMuX2ZpbGUgIT0gbnVsbCkge1xuICAgICAgbWFwLmZpbGUgPSB0aGlzLl9maWxlO1xuICAgIH1cbiAgICBpZiAodGhpcy5fc291cmNlUm9vdCAhPSBudWxsKSB7XG4gICAgICBtYXAuc291cmNlUm9vdCA9IHRoaXMuX3NvdXJjZVJvb3Q7XG4gICAgfVxuICAgIGlmICh0aGlzLl9zb3VyY2VzQ29udGVudHMpIHtcbiAgICAgIG1hcC5zb3VyY2VzQ29udGVudCA9IHRoaXMuX2dlbmVyYXRlU291cmNlc0NvbnRlbnQobWFwLnNvdXJjZXMsIG1hcC5zb3VyY2VSb290KTtcbiAgICB9XG5cbiAgICByZXR1cm4gbWFwO1xuICB9O1xuXG4vKipcbiAqIFJlbmRlciB0aGUgc291cmNlIG1hcCBiZWluZyBnZW5lcmF0ZWQgdG8gYSBzdHJpbmcuXG4gKi9cblNvdXJjZU1hcEdlbmVyYXRvci5wcm90b3R5cGUudG9TdHJpbmcgPVxuICBmdW5jdGlvbiBTb3VyY2VNYXBHZW5lcmF0b3JfdG9TdHJpbmcoKSB7XG4gICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHRoaXMudG9KU09OKCkpO1xuICB9O1xuXG5leHBvcnRzLlNvdXJjZU1hcEdlbmVyYXRvciA9IFNvdXJjZU1hcEdlbmVyYXRvcjtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbGliL3NvdXJjZS1tYXAtZ2VuZXJhdG9yLmpzXG4vLyBtb2R1bGUgaWQgPSAxXG4vLyBtb2R1bGUgY2h1bmtzID0gMCIsIi8qIC0qLSBNb2RlOiBqczsganMtaW5kZW50LWxldmVsOiAyOyAtKi0gKi9cbi8qXG4gKiBDb3B5cmlnaHQgMjAxMSBNb3ppbGxhIEZvdW5kYXRpb24gYW5kIGNvbnRyaWJ1dG9yc1xuICogTGljZW5zZWQgdW5kZXIgdGhlIE5ldyBCU0QgbGljZW5zZS4gU2VlIExJQ0VOU0Ugb3I6XG4gKiBodHRwOi8vb3BlbnNvdXJjZS5vcmcvbGljZW5zZXMvQlNELTMtQ2xhdXNlXG4gKlxuICogQmFzZWQgb24gdGhlIEJhc2UgNjQgVkxRIGltcGxlbWVudGF0aW9uIGluIENsb3N1cmUgQ29tcGlsZXI6XG4gKiBodHRwczovL2NvZGUuZ29vZ2xlLmNvbS9wL2Nsb3N1cmUtY29tcGlsZXIvc291cmNlL2Jyb3dzZS90cnVuay9zcmMvY29tL2dvb2dsZS9kZWJ1Z2dpbmcvc291cmNlbWFwL0Jhc2U2NFZMUS5qYXZhXG4gKlxuICogQ29weXJpZ2h0IDIwMTEgVGhlIENsb3N1cmUgQ29tcGlsZXIgQXV0aG9ycy4gQWxsIHJpZ2h0cyByZXNlcnZlZC5cbiAqIFJlZGlzdHJpYnV0aW9uIGFuZCB1c2UgaW4gc291cmNlIGFuZCBiaW5hcnkgZm9ybXMsIHdpdGggb3Igd2l0aG91dFxuICogbW9kaWZpY2F0aW9uLCBhcmUgcGVybWl0dGVkIHByb3ZpZGVkIHRoYXQgdGhlIGZvbGxvd2luZyBjb25kaXRpb25zIGFyZVxuICogbWV0OlxuICpcbiAqICAqIFJlZGlzdHJpYnV0aW9ucyBvZiBzb3VyY2UgY29kZSBtdXN0IHJldGFpbiB0aGUgYWJvdmUgY29weXJpZ2h0XG4gKiAgICBub3RpY2UsIHRoaXMgbGlzdCBvZiBjb25kaXRpb25zIGFuZCB0aGUgZm9sbG93aW5nIGRpc2NsYWltZXIuXG4gKiAgKiBSZWRpc3RyaWJ1dGlvbnMgaW4gYmluYXJ5IGZvcm0gbXVzdCByZXByb2R1Y2UgdGhlIGFib3ZlXG4gKiAgICBjb3B5cmlnaHQgbm90aWNlLCB0aGlzIGxpc3Qgb2YgY29uZGl0aW9ucyBhbmQgdGhlIGZvbGxvd2luZ1xuICogICAgZGlzY2xhaW1lciBpbiB0aGUgZG9jdW1lbnRhdGlvbiBhbmQvb3Igb3RoZXIgbWF0ZXJpYWxzIHByb3ZpZGVkXG4gKiAgICB3aXRoIHRoZSBkaXN0cmlidXRpb24uXG4gKiAgKiBOZWl0aGVyIHRoZSBuYW1lIG9mIEdvb2dsZSBJbmMuIG5vciB0aGUgbmFtZXMgb2YgaXRzXG4gKiAgICBjb250cmlidXRvcnMgbWF5IGJlIHVzZWQgdG8gZW5kb3JzZSBvciBwcm9tb3RlIHByb2R1Y3RzIGRlcml2ZWRcbiAqICAgIGZyb20gdGhpcyBzb2Z0d2FyZSB3aXRob3V0IHNwZWNpZmljIHByaW9yIHdyaXR0ZW4gcGVybWlzc2lvbi5cbiAqXG4gKiBUSElTIFNPRlRXQVJFIElTIFBST1ZJREVEIEJZIFRIRSBDT1BZUklHSFQgSE9MREVSUyBBTkQgQ09OVFJJQlVUT1JTXG4gKiBcIkFTIElTXCIgQU5EIEFOWSBFWFBSRVNTIE9SIElNUExJRUQgV0FSUkFOVElFUywgSU5DTFVESU5HLCBCVVQgTk9UXG4gKiBMSU1JVEVEIFRPLCBUSEUgSU1QTElFRCBXQVJSQU5USUVTIE9GIE1FUkNIQU5UQUJJTElUWSBBTkQgRklUTkVTUyBGT1JcbiAqIEEgUEFSVElDVUxBUiBQVVJQT1NFIEFSRSBESVNDTEFJTUVELiBJTiBOTyBFVkVOVCBTSEFMTCBUSEUgQ09QWVJJR0hUXG4gKiBPV05FUiBPUiBDT05UUklCVVRPUlMgQkUgTElBQkxFIEZPUiBBTlkgRElSRUNULCBJTkRJUkVDVCwgSU5DSURFTlRBTCxcbiAqIFNQRUNJQUwsIEVYRU1QTEFSWSwgT1IgQ09OU0VRVUVOVElBTCBEQU1BR0VTIChJTkNMVURJTkcsIEJVVCBOT1RcbiAqIExJTUlURUQgVE8sIFBST0NVUkVNRU5UIE9GIFNVQlNUSVRVVEUgR09PRFMgT1IgU0VSVklDRVM7IExPU1MgT0YgVVNFLFxuICogREFUQSwgT1IgUFJPRklUUzsgT1IgQlVTSU5FU1MgSU5URVJSVVBUSU9OKSBIT1dFVkVSIENBVVNFRCBBTkQgT04gQU5ZXG4gKiBUSEVPUlkgT0YgTElBQklMSVRZLCBXSEVUSEVSIElOIENPTlRSQUNULCBTVFJJQ1QgTElBQklMSVRZLCBPUiBUT1JUXG4gKiAoSU5DTFVESU5HIE5FR0xJR0VOQ0UgT1IgT1RIRVJXSVNFKSBBUklTSU5HIElOIEFOWSBXQVkgT1VUIE9GIFRIRSBVU0VcbiAqIE9GIFRISVMgU09GVFdBUkUsIEVWRU4gSUYgQURWSVNFRCBPRiBUSEUgUE9TU0lCSUxJVFkgT0YgU1VDSCBEQU1BR0UuXG4gKi9cblxudmFyIGJhc2U2NCA9IHJlcXVpcmUoJy4vYmFzZTY0Jyk7XG5cbi8vIEEgc2luZ2xlIGJhc2UgNjQgZGlnaXQgY2FuIGNvbnRhaW4gNiBiaXRzIG9mIGRhdGEuIEZvciB0aGUgYmFzZSA2NCB2YXJpYWJsZVxuLy8gbGVuZ3RoIHF1YW50aXRpZXMgd2UgdXNlIGluIHRoZSBzb3VyY2UgbWFwIHNwZWMsIHRoZSBmaXJzdCBiaXQgaXMgdGhlIHNpZ24sXG4vLyB0aGUgbmV4dCBmb3VyIGJpdHMgYXJlIHRoZSBhY3R1YWwgdmFsdWUsIGFuZCB0aGUgNnRoIGJpdCBpcyB0aGVcbi8vIGNvbnRpbnVhdGlvbiBiaXQuIFRoZSBjb250aW51YXRpb24gYml0IHRlbGxzIHVzIHdoZXRoZXIgdGhlcmUgYXJlIG1vcmVcbi8vIGRpZ2l0cyBpbiB0aGlzIHZhbHVlIGZvbGxvd2luZyB0aGlzIGRpZ2l0LlxuLy9cbi8vICAgQ29udGludWF0aW9uXG4vLyAgIHwgICAgU2lnblxuLy8gICB8ICAgIHxcbi8vICAgViAgICBWXG4vLyAgIDEwMTAxMVxuXG52YXIgVkxRX0JBU0VfU0hJRlQgPSA1O1xuXG4vLyBiaW5hcnk6IDEwMDAwMFxudmFyIFZMUV9CQVNFID0gMSA8PCBWTFFfQkFTRV9TSElGVDtcblxuLy8gYmluYXJ5OiAwMTExMTFcbnZhciBWTFFfQkFTRV9NQVNLID0gVkxRX0JBU0UgLSAxO1xuXG4vLyBiaW5hcnk6IDEwMDAwMFxudmFyIFZMUV9DT05USU5VQVRJT05fQklUID0gVkxRX0JBU0U7XG5cbi8qKlxuICogQ29udmVydHMgZnJvbSBhIHR3by1jb21wbGVtZW50IHZhbHVlIHRvIGEgdmFsdWUgd2hlcmUgdGhlIHNpZ24gYml0IGlzXG4gKiBwbGFjZWQgaW4gdGhlIGxlYXN0IHNpZ25pZmljYW50IGJpdC4gIEZvciBleGFtcGxlLCBhcyBkZWNpbWFsczpcbiAqICAgMSBiZWNvbWVzIDIgKDEwIGJpbmFyeSksIC0xIGJlY29tZXMgMyAoMTEgYmluYXJ5KVxuICogICAyIGJlY29tZXMgNCAoMTAwIGJpbmFyeSksIC0yIGJlY29tZXMgNSAoMTAxIGJpbmFyeSlcbiAqL1xuZnVuY3Rpb24gdG9WTFFTaWduZWQoYVZhbHVlKSB7XG4gIHJldHVybiBhVmFsdWUgPCAwXG4gICAgPyAoKC1hVmFsdWUpIDw8IDEpICsgMVxuICAgIDogKGFWYWx1ZSA8PCAxKSArIDA7XG59XG5cbi8qKlxuICogQ29udmVydHMgdG8gYSB0d28tY29tcGxlbWVudCB2YWx1ZSBmcm9tIGEgdmFsdWUgd2hlcmUgdGhlIHNpZ24gYml0IGlzXG4gKiBwbGFjZWQgaW4gdGhlIGxlYXN0IHNpZ25pZmljYW50IGJpdC4gIEZvciBleGFtcGxlLCBhcyBkZWNpbWFsczpcbiAqICAgMiAoMTAgYmluYXJ5KSBiZWNvbWVzIDEsIDMgKDExIGJpbmFyeSkgYmVjb21lcyAtMVxuICogICA0ICgxMDAgYmluYXJ5KSBiZWNvbWVzIDIsIDUgKDEwMSBiaW5hcnkpIGJlY29tZXMgLTJcbiAqL1xuZnVuY3Rpb24gZnJvbVZMUVNpZ25lZChhVmFsdWUpIHtcbiAgdmFyIGlzTmVnYXRpdmUgPSAoYVZhbHVlICYgMSkgPT09IDE7XG4gIHZhciBzaGlmdGVkID0gYVZhbHVlID4+IDE7XG4gIHJldHVybiBpc05lZ2F0aXZlXG4gICAgPyAtc2hpZnRlZFxuICAgIDogc2hpZnRlZDtcbn1cblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBiYXNlIDY0IFZMUSBlbmNvZGVkIHZhbHVlLlxuICovXG5leHBvcnRzLmVuY29kZSA9IGZ1bmN0aW9uIGJhc2U2NFZMUV9lbmNvZGUoYVZhbHVlKSB7XG4gIHZhciBlbmNvZGVkID0gXCJcIjtcbiAgdmFyIGRpZ2l0O1xuXG4gIHZhciB2bHEgPSB0b1ZMUVNpZ25lZChhVmFsdWUpO1xuXG4gIGRvIHtcbiAgICBkaWdpdCA9IHZscSAmIFZMUV9CQVNFX01BU0s7XG4gICAgdmxxID4+Pj0gVkxRX0JBU0VfU0hJRlQ7XG4gICAgaWYgKHZscSA+IDApIHtcbiAgICAgIC8vIFRoZXJlIGFyZSBzdGlsbCBtb3JlIGRpZ2l0cyBpbiB0aGlzIHZhbHVlLCBzbyB3ZSBtdXN0IG1ha2Ugc3VyZSB0aGVcbiAgICAgIC8vIGNvbnRpbnVhdGlvbiBiaXQgaXMgbWFya2VkLlxuICAgICAgZGlnaXQgfD0gVkxRX0NPTlRJTlVBVElPTl9CSVQ7XG4gICAgfVxuICAgIGVuY29kZWQgKz0gYmFzZTY0LmVuY29kZShkaWdpdCk7XG4gIH0gd2hpbGUgKHZscSA+IDApO1xuXG4gIHJldHVybiBlbmNvZGVkO1xufTtcblxuLyoqXG4gKiBEZWNvZGVzIHRoZSBuZXh0IGJhc2UgNjQgVkxRIHZhbHVlIGZyb20gdGhlIGdpdmVuIHN0cmluZyBhbmQgcmV0dXJucyB0aGVcbiAqIHZhbHVlIGFuZCB0aGUgcmVzdCBvZiB0aGUgc3RyaW5nIHZpYSB0aGUgb3V0IHBhcmFtZXRlci5cbiAqL1xuZXhwb3J0cy5kZWNvZGUgPSBmdW5jdGlvbiBiYXNlNjRWTFFfZGVjb2RlKGFTdHIsIGFJbmRleCwgYU91dFBhcmFtKSB7XG4gIHZhciBzdHJMZW4gPSBhU3RyLmxlbmd0aDtcbiAgdmFyIHJlc3VsdCA9IDA7XG4gIHZhciBzaGlmdCA9IDA7XG4gIHZhciBjb250aW51YXRpb24sIGRpZ2l0O1xuXG4gIGRvIHtcbiAgICBpZiAoYUluZGV4ID49IHN0ckxlbikge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKFwiRXhwZWN0ZWQgbW9yZSBkaWdpdHMgaW4gYmFzZSA2NCBWTFEgdmFsdWUuXCIpO1xuICAgIH1cblxuICAgIGRpZ2l0ID0gYmFzZTY0LmRlY29kZShhU3RyLmNoYXJDb2RlQXQoYUluZGV4KyspKTtcbiAgICBpZiAoZGlnaXQgPT09IC0xKSB7XG4gICAgICB0aHJvdyBuZXcgRXJyb3IoXCJJbnZhbGlkIGJhc2U2NCBkaWdpdDogXCIgKyBhU3RyLmNoYXJBdChhSW5kZXggLSAxKSk7XG4gICAgfVxuXG4gICAgY29udGludWF0aW9uID0gISEoZGlnaXQgJiBWTFFfQ09OVElOVUFUSU9OX0JJVCk7XG4gICAgZGlnaXQgJj0gVkxRX0JBU0VfTUFTSztcbiAgICByZXN1bHQgPSByZXN1bHQgKyAoZGlnaXQgPDwgc2hpZnQpO1xuICAgIHNoaWZ0ICs9IFZMUV9CQVNFX1NISUZUO1xuICB9IHdoaWxlIChjb250aW51YXRpb24pO1xuXG4gIGFPdXRQYXJhbS52YWx1ZSA9IGZyb21WTFFTaWduZWQocmVzdWx0KTtcbiAgYU91dFBhcmFtLnJlc3QgPSBhSW5kZXg7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvYmFzZTY0LXZscS5qc1xuLy8gbW9kdWxlIGlkID0gMlxuLy8gbW9kdWxlIGNodW5rcyA9IDAiLCIvKiAtKi0gTW9kZToganM7IGpzLWluZGVudC1sZXZlbDogMjsgLSotICovXG4vKlxuICogQ29weXJpZ2h0IDIwMTEgTW96aWxsYSBGb3VuZGF0aW9uIGFuZCBjb250cmlidXRvcnNcbiAqIExpY2Vuc2VkIHVuZGVyIHRoZSBOZXcgQlNEIGxpY2Vuc2UuIFNlZSBMSUNFTlNFIG9yOlxuICogaHR0cDovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0zLUNsYXVzZVxuICovXG5cbnZhciBpbnRUb0NoYXJNYXAgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLycuc3BsaXQoJycpO1xuXG4vKipcbiAqIEVuY29kZSBhbiBpbnRlZ2VyIGluIHRoZSByYW5nZSBvZiAwIHRvIDYzIHRvIGEgc2luZ2xlIGJhc2UgNjQgZGlnaXQuXG4gKi9cbmV4cG9ydHMuZW5jb2RlID0gZnVuY3Rpb24gKG51bWJlcikge1xuICBpZiAoMCA8PSBudW1iZXIgJiYgbnVtYmVyIDwgaW50VG9DaGFyTWFwLmxlbmd0aCkge1xuICAgIHJldHVybiBpbnRUb0NoYXJNYXBbbnVtYmVyXTtcbiAgfVxuICB0aHJvdyBuZXcgVHlwZUVycm9yKFwiTXVzdCBiZSBiZXR3ZWVuIDAgYW5kIDYzOiBcIiArIG51bWJlcik7XG59O1xuXG4vKipcbiAqIERlY29kZSBhIHNpbmdsZSBiYXNlIDY0IGNoYXJhY3RlciBjb2RlIGRpZ2l0IHRvIGFuIGludGVnZXIuIFJldHVybnMgLTEgb25cbiAqIGZhaWx1cmUuXG4gKi9cbmV4cG9ydHMuZGVjb2RlID0gZnVuY3Rpb24gKGNoYXJDb2RlKSB7XG4gIHZhciBiaWdBID0gNjU7ICAgICAvLyAnQSdcbiAgdmFyIGJpZ1ogPSA5MDsgICAgIC8vICdaJ1xuXG4gIHZhciBsaXR0bGVBID0gOTc7ICAvLyAnYSdcbiAgdmFyIGxpdHRsZVogPSAxMjI7IC8vICd6J1xuXG4gIHZhciB6ZXJvID0gNDg7ICAgICAvLyAnMCdcbiAgdmFyIG5pbmUgPSA1NzsgICAgIC8vICc5J1xuXG4gIHZhciBwbHVzID0gNDM7ICAgICAvLyAnKydcbiAgdmFyIHNsYXNoID0gNDc7ICAgIC8vICcvJ1xuXG4gIHZhciBsaXR0bGVPZmZzZXQgPSAyNjtcbiAgdmFyIG51bWJlck9mZnNldCA9IDUyO1xuXG4gIC8vIDAgLSAyNTogQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVpcbiAgaWYgKGJpZ0EgPD0gY2hhckNvZGUgJiYgY2hhckNvZGUgPD0gYmlnWikge1xuICAgIHJldHVybiAoY2hhckNvZGUgLSBiaWdBKTtcbiAgfVxuXG4gIC8vIDI2IC0gNTE6IGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6XG4gIGlmIChsaXR0bGVBIDw9IGNoYXJDb2RlICYmIGNoYXJDb2RlIDw9IGxpdHRsZVopIHtcbiAgICByZXR1cm4gKGNoYXJDb2RlIC0gbGl0dGxlQSArIGxpdHRsZU9mZnNldCk7XG4gIH1cblxuICAvLyA1MiAtIDYxOiAwMTIzNDU2Nzg5XG4gIGlmICh6ZXJvIDw9IGNoYXJDb2RlICYmIGNoYXJDb2RlIDw9IG5pbmUpIHtcbiAgICByZXR1cm4gKGNoYXJDb2RlIC0gemVybyArIG51bWJlck9mZnNldCk7XG4gIH1cblxuICAvLyA2MjogK1xuICBpZiAoY2hhckNvZGUgPT0gcGx1cykge1xuICAgIHJldHVybiA2MjtcbiAgfVxuXG4gIC8vIDYzOiAvXG4gIGlmIChjaGFyQ29kZSA9PSBzbGFzaCkge1xuICAgIHJldHVybiA2MztcbiAgfVxuXG4gIC8vIEludmFsaWQgYmFzZTY0IGRpZ2l0LlxuICByZXR1cm4gLTE7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvYmFzZTY0LmpzXG4vLyBtb2R1bGUgaWQgPSAzXG4vLyBtb2R1bGUgY2h1bmtzID0gMCIsIi8qIC0qLSBNb2RlOiBqczsganMtaW5kZW50LWxldmVsOiAyOyAtKi0gKi9cbi8qXG4gKiBDb3B5cmlnaHQgMjAxMSBNb3ppbGxhIEZvdW5kYXRpb24gYW5kIGNvbnRyaWJ1dG9yc1xuICogTGljZW5zZWQgdW5kZXIgdGhlIE5ldyBCU0QgbGljZW5zZS4gU2VlIExJQ0VOU0Ugb3I6XG4gKiBodHRwOi8vb3BlbnNvdXJjZS5vcmcvbGljZW5zZXMvQlNELTMtQ2xhdXNlXG4gKi9cblxuLyoqXG4gKiBUaGlzIGlzIGEgaGVscGVyIGZ1bmN0aW9uIGZvciBnZXR0aW5nIHZhbHVlcyBmcm9tIHBhcmFtZXRlci9vcHRpb25zXG4gKiBvYmplY3RzLlxuICpcbiAqIEBwYXJhbSBhcmdzIFRoZSBvYmplY3Qgd2UgYXJlIGV4dHJhY3RpbmcgdmFsdWVzIGZyb21cbiAqIEBwYXJhbSBuYW1lIFRoZSBuYW1lIG9mIHRoZSBwcm9wZXJ0eSB3ZSBhcmUgZ2V0dGluZy5cbiAqIEBwYXJhbSBkZWZhdWx0VmFsdWUgQW4gb3B0aW9uYWwgdmFsdWUgdG8gcmV0dXJuIGlmIHRoZSBwcm9wZXJ0eSBpcyBtaXNzaW5nXG4gKiBmcm9tIHRoZSBvYmplY3QuIElmIHRoaXMgaXMgbm90IHNwZWNpZmllZCBhbmQgdGhlIHByb3BlcnR5IGlzIG1pc3NpbmcsIGFuXG4gKiBlcnJvciB3aWxsIGJlIHRocm93bi5cbiAqL1xuZnVuY3Rpb24gZ2V0QXJnKGFBcmdzLCBhTmFtZSwgYURlZmF1bHRWYWx1ZSkge1xuICBpZiAoYU5hbWUgaW4gYUFyZ3MpIHtcbiAgICByZXR1cm4gYUFyZ3NbYU5hbWVdO1xuICB9IGVsc2UgaWYgKGFyZ3VtZW50cy5sZW5ndGggPT09IDMpIHtcbiAgICByZXR1cm4gYURlZmF1bHRWYWx1ZTtcbiAgfSBlbHNlIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoJ1wiJyArIGFOYW1lICsgJ1wiIGlzIGEgcmVxdWlyZWQgYXJndW1lbnQuJyk7XG4gIH1cbn1cbmV4cG9ydHMuZ2V0QXJnID0gZ2V0QXJnO1xuXG52YXIgdXJsUmVnZXhwID0gL14oPzooW1xcdytcXC0uXSspOik/XFwvXFwvKD86KFxcdys6XFx3KylAKT8oW1xcdy5dKikoPzo6KFxcZCspKT8oXFxTKikkLztcbnZhciBkYXRhVXJsUmVnZXhwID0gL15kYXRhOi4rXFwsLiskLztcblxuZnVuY3Rpb24gdXJsUGFyc2UoYVVybCkge1xuICB2YXIgbWF0Y2ggPSBhVXJsLm1hdGNoKHVybFJlZ2V4cCk7XG4gIGlmICghbWF0Y2gpIHtcbiAgICByZXR1cm4gbnVsbDtcbiAgfVxuICByZXR1cm4ge1xuICAgIHNjaGVtZTogbWF0Y2hbMV0sXG4gICAgYXV0aDogbWF0Y2hbMl0sXG4gICAgaG9zdDogbWF0Y2hbM10sXG4gICAgcG9ydDogbWF0Y2hbNF0sXG4gICAgcGF0aDogbWF0Y2hbNV1cbiAgfTtcbn1cbmV4cG9ydHMudXJsUGFyc2UgPSB1cmxQYXJzZTtcblxuZnVuY3Rpb24gdXJsR2VuZXJhdGUoYVBhcnNlZFVybCkge1xuICB2YXIgdXJsID0gJyc7XG4gIGlmIChhUGFyc2VkVXJsLnNjaGVtZSkge1xuICAgIHVybCArPSBhUGFyc2VkVXJsLnNjaGVtZSArICc6JztcbiAgfVxuICB1cmwgKz0gJy8vJztcbiAgaWYgKGFQYXJzZWRVcmwuYXV0aCkge1xuICAgIHVybCArPSBhUGFyc2VkVXJsLmF1dGggKyAnQCc7XG4gIH1cbiAgaWYgKGFQYXJzZWRVcmwuaG9zdCkge1xuICAgIHVybCArPSBhUGFyc2VkVXJsLmhvc3Q7XG4gIH1cbiAgaWYgKGFQYXJzZWRVcmwucG9ydCkge1xuICAgIHVybCArPSBcIjpcIiArIGFQYXJzZWRVcmwucG9ydFxuICB9XG4gIGlmIChhUGFyc2VkVXJsLnBhdGgpIHtcbiAgICB1cmwgKz0gYVBhcnNlZFVybC5wYXRoO1xuICB9XG4gIHJldHVybiB1cmw7XG59XG5leHBvcnRzLnVybEdlbmVyYXRlID0gdXJsR2VuZXJhdGU7XG5cbi8qKlxuICogTm9ybWFsaXplcyBhIHBhdGgsIG9yIHRoZSBwYXRoIHBvcnRpb24gb2YgYSBVUkw6XG4gKlxuICogLSBSZXBsYWNlcyBjb25zZWN1dGl2ZSBzbGFzaGVzIHdpdGggb25lIHNsYXNoLlxuICogLSBSZW1vdmVzIHVubmVjZXNzYXJ5ICcuJyBwYXJ0cy5cbiAqIC0gUmVtb3ZlcyB1bm5lY2Vzc2FyeSAnPGRpcj4vLi4nIHBhcnRzLlxuICpcbiAqIEJhc2VkIG9uIGNvZGUgaW4gdGhlIE5vZGUuanMgJ3BhdGgnIGNvcmUgbW9kdWxlLlxuICpcbiAqIEBwYXJhbSBhUGF0aCBUaGUgcGF0aCBvciB1cmwgdG8gbm9ybWFsaXplLlxuICovXG5mdW5jdGlvbiBub3JtYWxpemUoYVBhdGgpIHtcbiAgdmFyIHBhdGggPSBhUGF0aDtcbiAgdmFyIHVybCA9IHVybFBhcnNlKGFQYXRoKTtcbiAgaWYgKHVybCkge1xuICAgIGlmICghdXJsLnBhdGgpIHtcbiAgICAgIHJldHVybiBhUGF0aDtcbiAgICB9XG4gICAgcGF0aCA9IHVybC5wYXRoO1xuICB9XG4gIHZhciBpc0Fic29sdXRlID0gZXhwb3J0cy5pc0Fic29sdXRlKHBhdGgpO1xuXG4gIHZhciBwYXJ0cyA9IHBhdGguc3BsaXQoL1xcLysvKTtcbiAgZm9yICh2YXIgcGFydCwgdXAgPSAwLCBpID0gcGFydHMubGVuZ3RoIC0gMTsgaSA+PSAwOyBpLS0pIHtcbiAgICBwYXJ0ID0gcGFydHNbaV07XG4gICAgaWYgKHBhcnQgPT09ICcuJykge1xuICAgICAgcGFydHMuc3BsaWNlKGksIDEpO1xuICAgIH0gZWxzZSBpZiAocGFydCA9PT0gJy4uJykge1xuICAgICAgdXArKztcbiAgICB9IGVsc2UgaWYgKHVwID4gMCkge1xuICAgICAgaWYgKHBhcnQgPT09ICcnKSB7XG4gICAgICAgIC8vIFRoZSBmaXJzdCBwYXJ0IGlzIGJsYW5rIGlmIHRoZSBwYXRoIGlzIGFic29sdXRlLiBUcnlpbmcgdG8gZ29cbiAgICAgICAgLy8gYWJvdmUgdGhlIHJvb3QgaXMgYSBuby1vcC4gVGhlcmVmb3JlIHdlIGNhbiByZW1vdmUgYWxsICcuLicgcGFydHNcbiAgICAgICAgLy8gZGlyZWN0bHkgYWZ0ZXIgdGhlIHJvb3QuXG4gICAgICAgIHBhcnRzLnNwbGljZShpICsgMSwgdXApO1xuICAgICAgICB1cCA9IDA7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBwYXJ0cy5zcGxpY2UoaSwgMik7XG4gICAgICAgIHVwLS07XG4gICAgICB9XG4gICAgfVxuICB9XG4gIHBhdGggPSBwYXJ0cy5qb2luKCcvJyk7XG5cbiAgaWYgKHBhdGggPT09ICcnKSB7XG4gICAgcGF0aCA9IGlzQWJzb2x1dGUgPyAnLycgOiAnLic7XG4gIH1cblxuICBpZiAodXJsKSB7XG4gICAgdXJsLnBhdGggPSBwYXRoO1xuICAgIHJldHVybiB1cmxHZW5lcmF0ZSh1cmwpO1xuICB9XG4gIHJldHVybiBwYXRoO1xufVxuZXhwb3J0cy5ub3JtYWxpemUgPSBub3JtYWxpemU7XG5cbi8qKlxuICogSm9pbnMgdHdvIHBhdGhzL1VSTHMuXG4gKlxuICogQHBhcmFtIGFSb290IFRoZSByb290IHBhdGggb3IgVVJMLlxuICogQHBhcmFtIGFQYXRoIFRoZSBwYXRoIG9yIFVSTCB0byBiZSBqb2luZWQgd2l0aCB0aGUgcm9vdC5cbiAqXG4gKiAtIElmIGFQYXRoIGlzIGEgVVJMIG9yIGEgZGF0YSBVUkksIGFQYXRoIGlzIHJldHVybmVkLCB1bmxlc3MgYVBhdGggaXMgYVxuICogICBzY2hlbWUtcmVsYXRpdmUgVVJMOiBUaGVuIHRoZSBzY2hlbWUgb2YgYVJvb3QsIGlmIGFueSwgaXMgcHJlcGVuZGVkXG4gKiAgIGZpcnN0LlxuICogLSBPdGhlcndpc2UgYVBhdGggaXMgYSBwYXRoLiBJZiBhUm9vdCBpcyBhIFVSTCwgdGhlbiBpdHMgcGF0aCBwb3J0aW9uXG4gKiAgIGlzIHVwZGF0ZWQgd2l0aCB0aGUgcmVzdWx0IGFuZCBhUm9vdCBpcyByZXR1cm5lZC4gT3RoZXJ3aXNlIHRoZSByZXN1bHRcbiAqICAgaXMgcmV0dXJuZWQuXG4gKiAgIC0gSWYgYVBhdGggaXMgYWJzb2x1dGUsIHRoZSByZXN1bHQgaXMgYVBhdGguXG4gKiAgIC0gT3RoZXJ3aXNlIHRoZSB0d28gcGF0aHMgYXJlIGpvaW5lZCB3aXRoIGEgc2xhc2guXG4gKiAtIEpvaW5pbmcgZm9yIGV4YW1wbGUgJ2h0dHA6Ly8nIGFuZCAnd3d3LmV4YW1wbGUuY29tJyBpcyBhbHNvIHN1cHBvcnRlZC5cbiAqL1xuZnVuY3Rpb24gam9pbihhUm9vdCwgYVBhdGgpIHtcbiAgaWYgKGFSb290ID09PSBcIlwiKSB7XG4gICAgYVJvb3QgPSBcIi5cIjtcbiAgfVxuICBpZiAoYVBhdGggPT09IFwiXCIpIHtcbiAgICBhUGF0aCA9IFwiLlwiO1xuICB9XG4gIHZhciBhUGF0aFVybCA9IHVybFBhcnNlKGFQYXRoKTtcbiAgdmFyIGFSb290VXJsID0gdXJsUGFyc2UoYVJvb3QpO1xuICBpZiAoYVJvb3RVcmwpIHtcbiAgICBhUm9vdCA9IGFSb290VXJsLnBhdGggfHwgJy8nO1xuICB9XG5cbiAgLy8gYGpvaW4oZm9vLCAnLy93d3cuZXhhbXBsZS5vcmcnKWBcbiAgaWYgKGFQYXRoVXJsICYmICFhUGF0aFVybC5zY2hlbWUpIHtcbiAgICBpZiAoYVJvb3RVcmwpIHtcbiAgICAgIGFQYXRoVXJsLnNjaGVtZSA9IGFSb290VXJsLnNjaGVtZTtcbiAgICB9XG4gICAgcmV0dXJuIHVybEdlbmVyYXRlKGFQYXRoVXJsKTtcbiAgfVxuXG4gIGlmIChhUGF0aFVybCB8fCBhUGF0aC5tYXRjaChkYXRhVXJsUmVnZXhwKSkge1xuICAgIHJldHVybiBhUGF0aDtcbiAgfVxuXG4gIC8vIGBqb2luKCdodHRwOi8vJywgJ3d3dy5leGFtcGxlLmNvbScpYFxuICBpZiAoYVJvb3RVcmwgJiYgIWFSb290VXJsLmhvc3QgJiYgIWFSb290VXJsLnBhdGgpIHtcbiAgICBhUm9vdFVybC5ob3N0ID0gYVBhdGg7XG4gICAgcmV0dXJuIHVybEdlbmVyYXRlKGFSb290VXJsKTtcbiAgfVxuXG4gIHZhciBqb2luZWQgPSBhUGF0aC5jaGFyQXQoMCkgPT09ICcvJ1xuICAgID8gYVBhdGhcbiAgICA6IG5vcm1hbGl6ZShhUm9vdC5yZXBsYWNlKC9cXC8rJC8sICcnKSArICcvJyArIGFQYXRoKTtcblxuICBpZiAoYVJvb3RVcmwpIHtcbiAgICBhUm9vdFVybC5wYXRoID0gam9pbmVkO1xuICAgIHJldHVybiB1cmxHZW5lcmF0ZShhUm9vdFVybCk7XG4gIH1cbiAgcmV0dXJuIGpvaW5lZDtcbn1cbmV4cG9ydHMuam9pbiA9IGpvaW47XG5cbmV4cG9ydHMuaXNBYnNvbHV0ZSA9IGZ1bmN0aW9uIChhUGF0aCkge1xuICByZXR1cm4gYVBhdGguY2hhckF0KDApID09PSAnLycgfHwgISFhUGF0aC5tYXRjaCh1cmxSZWdleHApO1xufTtcblxuLyoqXG4gKiBNYWtlIGEgcGF0aCByZWxhdGl2ZSB0byBhIFVSTCBvciBhbm90aGVyIHBhdGguXG4gKlxuICogQHBhcmFtIGFSb290IFRoZSByb290IHBhdGggb3IgVVJMLlxuICogQHBhcmFtIGFQYXRoIFRoZSBwYXRoIG9yIFVSTCB0byBiZSBtYWRlIHJlbGF0aXZlIHRvIGFSb290LlxuICovXG5mdW5jdGlvbiByZWxhdGl2ZShhUm9vdCwgYVBhdGgpIHtcbiAgaWYgKGFSb290ID09PSBcIlwiKSB7XG4gICAgYVJvb3QgPSBcIi5cIjtcbiAgfVxuXG4gIGFSb290ID0gYVJvb3QucmVwbGFjZSgvXFwvJC8sICcnKTtcblxuICAvLyBJdCBpcyBwb3NzaWJsZSBmb3IgdGhlIHBhdGggdG8gYmUgYWJvdmUgdGhlIHJvb3QuIEluIHRoaXMgY2FzZSwgc2ltcGx5XG4gIC8vIGNoZWNraW5nIHdoZXRoZXIgdGhlIHJvb3QgaXMgYSBwcmVmaXggb2YgdGhlIHBhdGggd29uJ3Qgd29yay4gSW5zdGVhZCwgd2VcbiAgLy8gbmVlZCB0byByZW1vdmUgY29tcG9uZW50cyBmcm9tIHRoZSByb290IG9uZSBieSBvbmUsIHVudGlsIGVpdGhlciB3ZSBmaW5kXG4gIC8vIGEgcHJlZml4IHRoYXQgZml0cywgb3Igd2UgcnVuIG91dCBvZiBjb21wb25lbnRzIHRvIHJlbW92ZS5cbiAgdmFyIGxldmVsID0gMDtcbiAgd2hpbGUgKGFQYXRoLmluZGV4T2YoYVJvb3QgKyAnLycpICE9PSAwKSB7XG4gICAgdmFyIGluZGV4ID0gYVJvb3QubGFzdEluZGV4T2YoXCIvXCIpO1xuICAgIGlmIChpbmRleCA8IDApIHtcbiAgICAgIHJldHVybiBhUGF0aDtcbiAgICB9XG5cbiAgICAvLyBJZiB0aGUgb25seSBwYXJ0IG9mIHRoZSByb290IHRoYXQgaXMgbGVmdCBpcyB0aGUgc2NoZW1lIChpLmUuIGh0dHA6Ly8sXG4gICAgLy8gZmlsZTovLy8sIGV0Yy4pLCBvbmUgb3IgbW9yZSBzbGFzaGVzICgvKSwgb3Igc2ltcGx5IG5vdGhpbmcgYXQgYWxsLCB3ZVxuICAgIC8vIGhhdmUgZXhoYXVzdGVkIGFsbCBjb21wb25lbnRzLCBzbyB0aGUgcGF0aCBpcyBub3QgcmVsYXRpdmUgdG8gdGhlIHJvb3QuXG4gICAgYVJvb3QgPSBhUm9vdC5zbGljZSgwLCBpbmRleCk7XG4gICAgaWYgKGFSb290Lm1hdGNoKC9eKFteXFwvXSs6XFwvKT9cXC8qJC8pKSB7XG4gICAgICByZXR1cm4gYVBhdGg7XG4gICAgfVxuXG4gICAgKytsZXZlbDtcbiAgfVxuXG4gIC8vIE1ha2Ugc3VyZSB3ZSBhZGQgYSBcIi4uL1wiIGZvciBlYWNoIGNvbXBvbmVudCB3ZSByZW1vdmVkIGZyb20gdGhlIHJvb3QuXG4gIHJldHVybiBBcnJheShsZXZlbCArIDEpLmpvaW4oXCIuLi9cIikgKyBhUGF0aC5zdWJzdHIoYVJvb3QubGVuZ3RoICsgMSk7XG59XG5leHBvcnRzLnJlbGF0aXZlID0gcmVsYXRpdmU7XG5cbnZhciBzdXBwb3J0c051bGxQcm90byA9IChmdW5jdGlvbiAoKSB7XG4gIHZhciBvYmogPSBPYmplY3QuY3JlYXRlKG51bGwpO1xuICByZXR1cm4gISgnX19wcm90b19fJyBpbiBvYmopO1xufSgpKTtcblxuZnVuY3Rpb24gaWRlbnRpdHkgKHMpIHtcbiAgcmV0dXJuIHM7XG59XG5cbi8qKlxuICogQmVjYXVzZSBiZWhhdmlvciBnb2VzIHdhY2t5IHdoZW4geW91IHNldCBgX19wcm90b19fYCBvbiBvYmplY3RzLCB3ZVxuICogaGF2ZSB0byBwcmVmaXggYWxsIHRoZSBzdHJpbmdzIGluIG91ciBzZXQgd2l0aCBhbiBhcmJpdHJhcnkgY2hhcmFjdGVyLlxuICpcbiAqIFNlZSBodHRwczovL2dpdGh1Yi5jb20vbW96aWxsYS9zb3VyY2UtbWFwL3B1bGwvMzEgYW5kXG4gKiBodHRwczovL2dpdGh1Yi5jb20vbW96aWxsYS9zb3VyY2UtbWFwL2lzc3Vlcy8zMFxuICpcbiAqIEBwYXJhbSBTdHJpbmcgYVN0clxuICovXG5mdW5jdGlvbiB0b1NldFN0cmluZyhhU3RyKSB7XG4gIGlmIChpc1Byb3RvU3RyaW5nKGFTdHIpKSB7XG4gICAgcmV0dXJuICckJyArIGFTdHI7XG4gIH1cblxuICByZXR1cm4gYVN0cjtcbn1cbmV4cG9ydHMudG9TZXRTdHJpbmcgPSBzdXBwb3J0c051bGxQcm90byA/IGlkZW50aXR5IDogdG9TZXRTdHJpbmc7XG5cbmZ1bmN0aW9uIGZyb21TZXRTdHJpbmcoYVN0cikge1xuICBpZiAoaXNQcm90b1N0cmluZyhhU3RyKSkge1xuICAgIHJldHVybiBhU3RyLnNsaWNlKDEpO1xuICB9XG5cbiAgcmV0dXJuIGFTdHI7XG59XG5leHBvcnRzLmZyb21TZXRTdHJpbmcgPSBzdXBwb3J0c051bGxQcm90byA/IGlkZW50aXR5IDogZnJvbVNldFN0cmluZztcblxuZnVuY3Rpb24gaXNQcm90b1N0cmluZyhzKSB7XG4gIGlmICghcykge1xuICAgIHJldHVybiBmYWxzZTtcbiAgfVxuXG4gIHZhciBsZW5ndGggPSBzLmxlbmd0aDtcblxuICBpZiAobGVuZ3RoIDwgOSAvKiBcIl9fcHJvdG9fX1wiLmxlbmd0aCAqLykge1xuICAgIHJldHVybiBmYWxzZTtcbiAgfVxuXG4gIGlmIChzLmNoYXJDb2RlQXQobGVuZ3RoIC0gMSkgIT09IDk1ICAvKiAnXycgKi8gfHxcbiAgICAgIHMuY2hhckNvZGVBdChsZW5ndGggLSAyKSAhPT0gOTUgIC8qICdfJyAqLyB8fFxuICAgICAgcy5jaGFyQ29kZUF0KGxlbmd0aCAtIDMpICE9PSAxMTEgLyogJ28nICovIHx8XG4gICAgICBzLmNoYXJDb2RlQXQobGVuZ3RoIC0gNCkgIT09IDExNiAvKiAndCcgKi8gfHxcbiAgICAgIHMuY2hhckNvZGVBdChsZW5ndGggLSA1KSAhPT0gMTExIC8qICdvJyAqLyB8fFxuICAgICAgcy5jaGFyQ29kZUF0KGxlbmd0aCAtIDYpICE9PSAxMTQgLyogJ3InICovIHx8XG4gICAgICBzLmNoYXJDb2RlQXQobGVuZ3RoIC0gNykgIT09IDExMiAvKiAncCcgKi8gfHxcbiAgICAgIHMuY2hhckNvZGVBdChsZW5ndGggLSA4KSAhPT0gOTUgIC8qICdfJyAqLyB8fFxuICAgICAgcy5jaGFyQ29kZUF0KGxlbmd0aCAtIDkpICE9PSA5NSAgLyogJ18nICovKSB7XG4gICAgcmV0dXJuIGZhbHNlO1xuICB9XG5cbiAgZm9yICh2YXIgaSA9IGxlbmd0aCAtIDEwOyBpID49IDA7IGktLSkge1xuICAgIGlmIChzLmNoYXJDb2RlQXQoaSkgIT09IDM2IC8qICckJyAqLykge1xuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cbiAgfVxuXG4gIHJldHVybiB0cnVlO1xufVxuXG4vKipcbiAqIENvbXBhcmF0b3IgYmV0d2VlbiB0d28gbWFwcGluZ3Mgd2hlcmUgdGhlIG9yaWdpbmFsIHBvc2l0aW9ucyBhcmUgY29tcGFyZWQuXG4gKlxuICogT3B0aW9uYWxseSBwYXNzIGluIGB0cnVlYCBhcyBgb25seUNvbXBhcmVHZW5lcmF0ZWRgIHRvIGNvbnNpZGVyIHR3b1xuICogbWFwcGluZ3Mgd2l0aCB0aGUgc2FtZSBvcmlnaW5hbCBzb3VyY2UvbGluZS9jb2x1bW4sIGJ1dCBkaWZmZXJlbnQgZ2VuZXJhdGVkXG4gKiBsaW5lIGFuZCBjb2x1bW4gdGhlIHNhbWUuIFVzZWZ1bCB3aGVuIHNlYXJjaGluZyBmb3IgYSBtYXBwaW5nIHdpdGggYVxuICogc3R1YmJlZCBvdXQgbWFwcGluZy5cbiAqL1xuZnVuY3Rpb24gY29tcGFyZUJ5T3JpZ2luYWxQb3NpdGlvbnMobWFwcGluZ0EsIG1hcHBpbmdCLCBvbmx5Q29tcGFyZU9yaWdpbmFsKSB7XG4gIHZhciBjbXAgPSBtYXBwaW5nQS5zb3VyY2UgLSBtYXBwaW5nQi5zb3VyY2U7XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgY21wID0gbWFwcGluZ0Eub3JpZ2luYWxMaW5lIC0gbWFwcGluZ0Iub3JpZ2luYWxMaW5lO1xuICBpZiAoY21wICE9PSAwKSB7XG4gICAgcmV0dXJuIGNtcDtcbiAgfVxuXG4gIGNtcCA9IG1hcHBpbmdBLm9yaWdpbmFsQ29sdW1uIC0gbWFwcGluZ0Iub3JpZ2luYWxDb2x1bW47XG4gIGlmIChjbXAgIT09IDAgfHwgb25seUNvbXBhcmVPcmlnaW5hbCkge1xuICAgIHJldHVybiBjbXA7XG4gIH1cblxuICBjbXAgPSBtYXBwaW5nQS5nZW5lcmF0ZWRDb2x1bW4gLSBtYXBwaW5nQi5nZW5lcmF0ZWRDb2x1bW47XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgY21wID0gbWFwcGluZ0EuZ2VuZXJhdGVkTGluZSAtIG1hcHBpbmdCLmdlbmVyYXRlZExpbmU7XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgcmV0dXJuIG1hcHBpbmdBLm5hbWUgLSBtYXBwaW5nQi5uYW1lO1xufVxuZXhwb3J0cy5jb21wYXJlQnlPcmlnaW5hbFBvc2l0aW9ucyA9IGNvbXBhcmVCeU9yaWdpbmFsUG9zaXRpb25zO1xuXG4vKipcbiAqIENvbXBhcmF0b3IgYmV0d2VlbiB0d28gbWFwcGluZ3Mgd2l0aCBkZWZsYXRlZCBzb3VyY2UgYW5kIG5hbWUgaW5kaWNlcyB3aGVyZVxuICogdGhlIGdlbmVyYXRlZCBwb3NpdGlvbnMgYXJlIGNvbXBhcmVkLlxuICpcbiAqIE9wdGlvbmFsbHkgcGFzcyBpbiBgdHJ1ZWAgYXMgYG9ubHlDb21wYXJlR2VuZXJhdGVkYCB0byBjb25zaWRlciB0d29cbiAqIG1hcHBpbmdzIHdpdGggdGhlIHNhbWUgZ2VuZXJhdGVkIGxpbmUgYW5kIGNvbHVtbiwgYnV0IGRpZmZlcmVudFxuICogc291cmNlL25hbWUvb3JpZ2luYWwgbGluZSBhbmQgY29sdW1uIHRoZSBzYW1lLiBVc2VmdWwgd2hlbiBzZWFyY2hpbmcgZm9yIGFcbiAqIG1hcHBpbmcgd2l0aCBhIHN0dWJiZWQgb3V0IG1hcHBpbmcuXG4gKi9cbmZ1bmN0aW9uIGNvbXBhcmVCeUdlbmVyYXRlZFBvc2l0aW9uc0RlZmxhdGVkKG1hcHBpbmdBLCBtYXBwaW5nQiwgb25seUNvbXBhcmVHZW5lcmF0ZWQpIHtcbiAgdmFyIGNtcCA9IG1hcHBpbmdBLmdlbmVyYXRlZExpbmUgLSBtYXBwaW5nQi5nZW5lcmF0ZWRMaW5lO1xuICBpZiAoY21wICE9PSAwKSB7XG4gICAgcmV0dXJuIGNtcDtcbiAgfVxuXG4gIGNtcCA9IG1hcHBpbmdBLmdlbmVyYXRlZENvbHVtbiAtIG1hcHBpbmdCLmdlbmVyYXRlZENvbHVtbjtcbiAgaWYgKGNtcCAhPT0gMCB8fCBvbmx5Q29tcGFyZUdlbmVyYXRlZCkge1xuICAgIHJldHVybiBjbXA7XG4gIH1cblxuICBjbXAgPSBtYXBwaW5nQS5zb3VyY2UgLSBtYXBwaW5nQi5zb3VyY2U7XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgY21wID0gbWFwcGluZ0Eub3JpZ2luYWxMaW5lIC0gbWFwcGluZ0Iub3JpZ2luYWxMaW5lO1xuICBpZiAoY21wICE9PSAwKSB7XG4gICAgcmV0dXJuIGNtcDtcbiAgfVxuXG4gIGNtcCA9IG1hcHBpbmdBLm9yaWdpbmFsQ29sdW1uIC0gbWFwcGluZ0Iub3JpZ2luYWxDb2x1bW47XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgcmV0dXJuIG1hcHBpbmdBLm5hbWUgLSBtYXBwaW5nQi5uYW1lO1xufVxuZXhwb3J0cy5jb21wYXJlQnlHZW5lcmF0ZWRQb3NpdGlvbnNEZWZsYXRlZCA9IGNvbXBhcmVCeUdlbmVyYXRlZFBvc2l0aW9uc0RlZmxhdGVkO1xuXG5mdW5jdGlvbiBzdHJjbXAoYVN0cjEsIGFTdHIyKSB7XG4gIGlmIChhU3RyMSA9PT0gYVN0cjIpIHtcbiAgICByZXR1cm4gMDtcbiAgfVxuXG4gIGlmIChhU3RyMSA+IGFTdHIyKSB7XG4gICAgcmV0dXJuIDE7XG4gIH1cblxuICByZXR1cm4gLTE7XG59XG5cbi8qKlxuICogQ29tcGFyYXRvciBiZXR3ZWVuIHR3byBtYXBwaW5ncyB3aXRoIGluZmxhdGVkIHNvdXJjZSBhbmQgbmFtZSBzdHJpbmdzIHdoZXJlXG4gKiB0aGUgZ2VuZXJhdGVkIHBvc2l0aW9ucyBhcmUgY29tcGFyZWQuXG4gKi9cbmZ1bmN0aW9uIGNvbXBhcmVCeUdlbmVyYXRlZFBvc2l0aW9uc0luZmxhdGVkKG1hcHBpbmdBLCBtYXBwaW5nQikge1xuICB2YXIgY21wID0gbWFwcGluZ0EuZ2VuZXJhdGVkTGluZSAtIG1hcHBpbmdCLmdlbmVyYXRlZExpbmU7XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgY21wID0gbWFwcGluZ0EuZ2VuZXJhdGVkQ29sdW1uIC0gbWFwcGluZ0IuZ2VuZXJhdGVkQ29sdW1uO1xuICBpZiAoY21wICE9PSAwKSB7XG4gICAgcmV0dXJuIGNtcDtcbiAgfVxuXG4gIGNtcCA9IHN0cmNtcChtYXBwaW5nQS5zb3VyY2UsIG1hcHBpbmdCLnNvdXJjZSk7XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgY21wID0gbWFwcGluZ0Eub3JpZ2luYWxMaW5lIC0gbWFwcGluZ0Iub3JpZ2luYWxMaW5lO1xuICBpZiAoY21wICE9PSAwKSB7XG4gICAgcmV0dXJuIGNtcDtcbiAgfVxuXG4gIGNtcCA9IG1hcHBpbmdBLm9yaWdpbmFsQ29sdW1uIC0gbWFwcGluZ0Iub3JpZ2luYWxDb2x1bW47XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgcmV0dXJuIHN0cmNtcChtYXBwaW5nQS5uYW1lLCBtYXBwaW5nQi5uYW1lKTtcbn1cbmV4cG9ydHMuY29tcGFyZUJ5R2VuZXJhdGVkUG9zaXRpb25zSW5mbGF0ZWQgPSBjb21wYXJlQnlHZW5lcmF0ZWRQb3NpdGlvbnNJbmZsYXRlZDtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbGliL3V0aWwuanNcbi8vIG1vZHVsZSBpZCA9IDRcbi8vIG1vZHVsZSBjaHVua3MgPSAwIiwiLyogLSotIE1vZGU6IGpzOyBqcy1pbmRlbnQtbGV2ZWw6IDI7IC0qLSAqL1xuLypcbiAqIENvcHlyaWdodCAyMDExIE1vemlsbGEgRm91bmRhdGlvbiBhbmQgY29udHJpYnV0b3JzXG4gKiBMaWNlbnNlZCB1bmRlciB0aGUgTmV3IEJTRCBsaWNlbnNlLiBTZWUgTElDRU5TRSBvcjpcbiAqIGh0dHA6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMy1DbGF1c2VcbiAqL1xuXG52YXIgdXRpbCA9IHJlcXVpcmUoJy4vdXRpbCcpO1xudmFyIGhhcyA9IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHk7XG52YXIgaGFzTmF0aXZlTWFwID0gdHlwZW9mIE1hcCAhPT0gXCJ1bmRlZmluZWRcIjtcblxuLyoqXG4gKiBBIGRhdGEgc3RydWN0dXJlIHdoaWNoIGlzIGEgY29tYmluYXRpb24gb2YgYW4gYXJyYXkgYW5kIGEgc2V0LiBBZGRpbmcgYSBuZXdcbiAqIG1lbWJlciBpcyBPKDEpLCB0ZXN0aW5nIGZvciBtZW1iZXJzaGlwIGlzIE8oMSksIGFuZCBmaW5kaW5nIHRoZSBpbmRleCBvZiBhblxuICogZWxlbWVudCBpcyBPKDEpLiBSZW1vdmluZyBlbGVtZW50cyBmcm9tIHRoZSBzZXQgaXMgbm90IHN1cHBvcnRlZC4gT25seVxuICogc3RyaW5ncyBhcmUgc3VwcG9ydGVkIGZvciBtZW1iZXJzaGlwLlxuICovXG5mdW5jdGlvbiBBcnJheVNldCgpIHtcbiAgdGhpcy5fYXJyYXkgPSBbXTtcbiAgdGhpcy5fc2V0ID0gaGFzTmF0aXZlTWFwID8gbmV3IE1hcCgpIDogT2JqZWN0LmNyZWF0ZShudWxsKTtcbn1cblxuLyoqXG4gKiBTdGF0aWMgbWV0aG9kIGZvciBjcmVhdGluZyBBcnJheVNldCBpbnN0YW5jZXMgZnJvbSBhbiBleGlzdGluZyBhcnJheS5cbiAqL1xuQXJyYXlTZXQuZnJvbUFycmF5ID0gZnVuY3Rpb24gQXJyYXlTZXRfZnJvbUFycmF5KGFBcnJheSwgYUFsbG93RHVwbGljYXRlcykge1xuICB2YXIgc2V0ID0gbmV3IEFycmF5U2V0KCk7XG4gIGZvciAodmFyIGkgPSAwLCBsZW4gPSBhQXJyYXkubGVuZ3RoOyBpIDwgbGVuOyBpKyspIHtcbiAgICBzZXQuYWRkKGFBcnJheVtpXSwgYUFsbG93RHVwbGljYXRlcyk7XG4gIH1cbiAgcmV0dXJuIHNldDtcbn07XG5cbi8qKlxuICogUmV0dXJuIGhvdyBtYW55IHVuaXF1ZSBpdGVtcyBhcmUgaW4gdGhpcyBBcnJheVNldC4gSWYgZHVwbGljYXRlcyBoYXZlIGJlZW5cbiAqIGFkZGVkLCB0aGFuIHRob3NlIGRvIG5vdCBjb3VudCB0b3dhcmRzIHRoZSBzaXplLlxuICpcbiAqIEByZXR1cm5zIE51bWJlclxuICovXG5BcnJheVNldC5wcm90b3R5cGUuc2l6ZSA9IGZ1bmN0aW9uIEFycmF5U2V0X3NpemUoKSB7XG4gIHJldHVybiBoYXNOYXRpdmVNYXAgPyB0aGlzLl9zZXQuc2l6ZSA6IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzKHRoaXMuX3NldCkubGVuZ3RoO1xufTtcblxuLyoqXG4gKiBBZGQgdGhlIGdpdmVuIHN0cmluZyB0byB0aGlzIHNldC5cbiAqXG4gKiBAcGFyYW0gU3RyaW5nIGFTdHJcbiAqL1xuQXJyYXlTZXQucHJvdG90eXBlLmFkZCA9IGZ1bmN0aW9uIEFycmF5U2V0X2FkZChhU3RyLCBhQWxsb3dEdXBsaWNhdGVzKSB7XG4gIHZhciBzU3RyID0gaGFzTmF0aXZlTWFwID8gYVN0ciA6IHV0aWwudG9TZXRTdHJpbmcoYVN0cik7XG4gIHZhciBpc0R1cGxpY2F0ZSA9IGhhc05hdGl2ZU1hcCA/IHRoaXMuaGFzKGFTdHIpIDogaGFzLmNhbGwodGhpcy5fc2V0LCBzU3RyKTtcbiAgdmFyIGlkeCA9IHRoaXMuX2FycmF5Lmxlbmd0aDtcbiAgaWYgKCFpc0R1cGxpY2F0ZSB8fCBhQWxsb3dEdXBsaWNhdGVzKSB7XG4gICAgdGhpcy5fYXJyYXkucHVzaChhU3RyKTtcbiAgfVxuICBpZiAoIWlzRHVwbGljYXRlKSB7XG4gICAgaWYgKGhhc05hdGl2ZU1hcCkge1xuICAgICAgdGhpcy5fc2V0LnNldChhU3RyLCBpZHgpO1xuICAgIH0gZWxzZSB7XG4gICAgICB0aGlzLl9zZXRbc1N0cl0gPSBpZHg7XG4gICAgfVxuICB9XG59O1xuXG4vKipcbiAqIElzIHRoZSBnaXZlbiBzdHJpbmcgYSBtZW1iZXIgb2YgdGhpcyBzZXQ/XG4gKlxuICogQHBhcmFtIFN0cmluZyBhU3RyXG4gKi9cbkFycmF5U2V0LnByb3RvdHlwZS5oYXMgPSBmdW5jdGlvbiBBcnJheVNldF9oYXMoYVN0cikge1xuICBpZiAoaGFzTmF0aXZlTWFwKSB7XG4gICAgcmV0dXJuIHRoaXMuX3NldC5oYXMoYVN0cik7XG4gIH0gZWxzZSB7XG4gICAgdmFyIHNTdHIgPSB1dGlsLnRvU2V0U3RyaW5nKGFTdHIpO1xuICAgIHJldHVybiBoYXMuY2FsbCh0aGlzLl9zZXQsIHNTdHIpO1xuICB9XG59O1xuXG4vKipcbiAqIFdoYXQgaXMgdGhlIGluZGV4IG9mIHRoZSBnaXZlbiBzdHJpbmcgaW4gdGhlIGFycmF5P1xuICpcbiAqIEBwYXJhbSBTdHJpbmcgYVN0clxuICovXG5BcnJheVNldC5wcm90b3R5cGUuaW5kZXhPZiA9IGZ1bmN0aW9uIEFycmF5U2V0X2luZGV4T2YoYVN0cikge1xuICBpZiAoaGFzTmF0aXZlTWFwKSB7XG4gICAgdmFyIGlkeCA9IHRoaXMuX3NldC5nZXQoYVN0cik7XG4gICAgaWYgKGlkeCA+PSAwKSB7XG4gICAgICAgIHJldHVybiBpZHg7XG4gICAgfVxuICB9IGVsc2Uge1xuICAgIHZhciBzU3RyID0gdXRpbC50b1NldFN0cmluZyhhU3RyKTtcbiAgICBpZiAoaGFzLmNhbGwodGhpcy5fc2V0LCBzU3RyKSkge1xuICAgICAgcmV0dXJuIHRoaXMuX3NldFtzU3RyXTtcbiAgICB9XG4gIH1cblxuICB0aHJvdyBuZXcgRXJyb3IoJ1wiJyArIGFTdHIgKyAnXCIgaXMgbm90IGluIHRoZSBzZXQuJyk7XG59O1xuXG4vKipcbiAqIFdoYXQgaXMgdGhlIGVsZW1lbnQgYXQgdGhlIGdpdmVuIGluZGV4P1xuICpcbiAqIEBwYXJhbSBOdW1iZXIgYUlkeFxuICovXG5BcnJheVNldC5wcm90b3R5cGUuYXQgPSBmdW5jdGlvbiBBcnJheVNldF9hdChhSWR4KSB7XG4gIGlmIChhSWR4ID49IDAgJiYgYUlkeCA8IHRoaXMuX2FycmF5Lmxlbmd0aCkge1xuICAgIHJldHVybiB0aGlzLl9hcnJheVthSWR4XTtcbiAgfVxuICB0aHJvdyBuZXcgRXJyb3IoJ05vIGVsZW1lbnQgaW5kZXhlZCBieSAnICsgYUlkeCk7XG59O1xuXG4vKipcbiAqIFJldHVybnMgdGhlIGFycmF5IHJlcHJlc2VudGF0aW9uIG9mIHRoaXMgc2V0ICh3aGljaCBoYXMgdGhlIHByb3BlciBpbmRpY2VzXG4gKiBpbmRpY2F0ZWQgYnkgaW5kZXhPZikuIE5vdGUgdGhhdCB0aGlzIGlzIGEgY29weSBvZiB0aGUgaW50ZXJuYWwgYXJyYXkgdXNlZFxuICogZm9yIHN0b3JpbmcgdGhlIG1lbWJlcnMgc28gdGhhdCBubyBvbmUgY2FuIG1lc3Mgd2l0aCBpbnRlcm5hbCBzdGF0ZS5cbiAqL1xuQXJyYXlTZXQucHJvdG90eXBlLnRvQXJyYXkgPSBmdW5jdGlvbiBBcnJheVNldF90b0FycmF5KCkge1xuICByZXR1cm4gdGhpcy5fYXJyYXkuc2xpY2UoKTtcbn07XG5cbmV4cG9ydHMuQXJyYXlTZXQgPSBBcnJheVNldDtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbGliL2FycmF5LXNldC5qc1xuLy8gbW9kdWxlIGlkID0gNVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiLCIvKiAtKi0gTW9kZToganM7IGpzLWluZGVudC1sZXZlbDogMjsgLSotICovXG4vKlxuICogQ29weXJpZ2h0IDIwMTQgTW96aWxsYSBGb3VuZGF0aW9uIGFuZCBjb250cmlidXRvcnNcbiAqIExpY2Vuc2VkIHVuZGVyIHRoZSBOZXcgQlNEIGxpY2Vuc2UuIFNlZSBMSUNFTlNFIG9yOlxuICogaHR0cDovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0zLUNsYXVzZVxuICovXG5cbnZhciB1dGlsID0gcmVxdWlyZSgnLi91dGlsJyk7XG5cbi8qKlxuICogRGV0ZXJtaW5lIHdoZXRoZXIgbWFwcGluZ0IgaXMgYWZ0ZXIgbWFwcGluZ0Egd2l0aCByZXNwZWN0IHRvIGdlbmVyYXRlZFxuICogcG9zaXRpb24uXG4gKi9cbmZ1bmN0aW9uIGdlbmVyYXRlZFBvc2l0aW9uQWZ0ZXIobWFwcGluZ0EsIG1hcHBpbmdCKSB7XG4gIC8vIE9wdGltaXplZCBmb3IgbW9zdCBjb21tb24gY2FzZVxuICB2YXIgbGluZUEgPSBtYXBwaW5nQS5nZW5lcmF0ZWRMaW5lO1xuICB2YXIgbGluZUIgPSBtYXBwaW5nQi5nZW5lcmF0ZWRMaW5lO1xuICB2YXIgY29sdW1uQSA9IG1hcHBpbmdBLmdlbmVyYXRlZENvbHVtbjtcbiAgdmFyIGNvbHVtbkIgPSBtYXBwaW5nQi5nZW5lcmF0ZWRDb2x1bW47XG4gIHJldHVybiBsaW5lQiA+IGxpbmVBIHx8IGxpbmVCID09IGxpbmVBICYmIGNvbHVtbkIgPj0gY29sdW1uQSB8fFxuICAgICAgICAgdXRpbC5jb21wYXJlQnlHZW5lcmF0ZWRQb3NpdGlvbnNJbmZsYXRlZChtYXBwaW5nQSwgbWFwcGluZ0IpIDw9IDA7XG59XG5cbi8qKlxuICogQSBkYXRhIHN0cnVjdHVyZSB0byBwcm92aWRlIGEgc29ydGVkIHZpZXcgb2YgYWNjdW11bGF0ZWQgbWFwcGluZ3MgaW4gYVxuICogcGVyZm9ybWFuY2UgY29uc2Npb3VzIG1hbm5lci4gSXQgdHJhZGVzIGEgbmVnbGliYWJsZSBvdmVyaGVhZCBpbiBnZW5lcmFsXG4gKiBjYXNlIGZvciBhIGxhcmdlIHNwZWVkdXAgaW4gY2FzZSBvZiBtYXBwaW5ncyBiZWluZyBhZGRlZCBpbiBvcmRlci5cbiAqL1xuZnVuY3Rpb24gTWFwcGluZ0xpc3QoKSB7XG4gIHRoaXMuX2FycmF5ID0gW107XG4gIHRoaXMuX3NvcnRlZCA9IHRydWU7XG4gIC8vIFNlcnZlcyBhcyBpbmZpbXVtXG4gIHRoaXMuX2xhc3QgPSB7Z2VuZXJhdGVkTGluZTogLTEsIGdlbmVyYXRlZENvbHVtbjogMH07XG59XG5cbi8qKlxuICogSXRlcmF0ZSB0aHJvdWdoIGludGVybmFsIGl0ZW1zLiBUaGlzIG1ldGhvZCB0YWtlcyB0aGUgc2FtZSBhcmd1bWVudHMgdGhhdFxuICogYEFycmF5LnByb3RvdHlwZS5mb3JFYWNoYCB0YWtlcy5cbiAqXG4gKiBOT1RFOiBUaGUgb3JkZXIgb2YgdGhlIG1hcHBpbmdzIGlzIE5PVCBndWFyYW50ZWVkLlxuICovXG5NYXBwaW5nTGlzdC5wcm90b3R5cGUudW5zb3J0ZWRGb3JFYWNoID1cbiAgZnVuY3Rpb24gTWFwcGluZ0xpc3RfZm9yRWFjaChhQ2FsbGJhY2ssIGFUaGlzQXJnKSB7XG4gICAgdGhpcy5fYXJyYXkuZm9yRWFjaChhQ2FsbGJhY2ssIGFUaGlzQXJnKTtcbiAgfTtcblxuLyoqXG4gKiBBZGQgdGhlIGdpdmVuIHNvdXJjZSBtYXBwaW5nLlxuICpcbiAqIEBwYXJhbSBPYmplY3QgYU1hcHBpbmdcbiAqL1xuTWFwcGluZ0xpc3QucHJvdG90eXBlLmFkZCA9IGZ1bmN0aW9uIE1hcHBpbmdMaXN0X2FkZChhTWFwcGluZykge1xuICBpZiAoZ2VuZXJhdGVkUG9zaXRpb25BZnRlcih0aGlzLl9sYXN0LCBhTWFwcGluZykpIHtcbiAgICB0aGlzLl9sYXN0ID0gYU1hcHBpbmc7XG4gICAgdGhpcy5fYXJyYXkucHVzaChhTWFwcGluZyk7XG4gIH0gZWxzZSB7XG4gICAgdGhpcy5fc29ydGVkID0gZmFsc2U7XG4gICAgdGhpcy5fYXJyYXkucHVzaChhTWFwcGluZyk7XG4gIH1cbn07XG5cbi8qKlxuICogUmV0dXJucyB0aGUgZmxhdCwgc29ydGVkIGFycmF5IG9mIG1hcHBpbmdzLiBUaGUgbWFwcGluZ3MgYXJlIHNvcnRlZCBieVxuICogZ2VuZXJhdGVkIHBvc2l0aW9uLlxuICpcbiAqIFdBUk5JTkc6IFRoaXMgbWV0aG9kIHJldHVybnMgaW50ZXJuYWwgZGF0YSB3aXRob3V0IGNvcHlpbmcsIGZvclxuICogcGVyZm9ybWFuY2UuIFRoZSByZXR1cm4gdmFsdWUgbXVzdCBOT1QgYmUgbXV0YXRlZCwgYW5kIHNob3VsZCBiZSB0cmVhdGVkIGFzXG4gKiBhbiBpbW11dGFibGUgYm9ycm93LiBJZiB5b3Ugd2FudCB0byB0YWtlIG93bmVyc2hpcCwgeW91IG11c3QgbWFrZSB5b3VyIG93blxuICogY29weS5cbiAqL1xuTWFwcGluZ0xpc3QucHJvdG90eXBlLnRvQXJyYXkgPSBmdW5jdGlvbiBNYXBwaW5nTGlzdF90b0FycmF5KCkge1xuICBpZiAoIXRoaXMuX3NvcnRlZCkge1xuICAgIHRoaXMuX2FycmF5LnNvcnQodXRpbC5jb21wYXJlQnlHZW5lcmF0ZWRQb3NpdGlvbnNJbmZsYXRlZCk7XG4gICAgdGhpcy5fc29ydGVkID0gdHJ1ZTtcbiAgfVxuICByZXR1cm4gdGhpcy5fYXJyYXk7XG59O1xuXG5leHBvcnRzLk1hcHBpbmdMaXN0ID0gTWFwcGluZ0xpc3Q7XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL2xpYi9tYXBwaW5nLWxpc3QuanNcbi8vIG1vZHVsZSBpZCA9IDZcbi8vIG1vZHVsZSBjaHVua3MgPSAwIiwiLyogLSotIE1vZGU6IGpzOyBqcy1pbmRlbnQtbGV2ZWw6IDI7IC0qLSAqL1xuLypcbiAqIENvcHlyaWdodCAyMDExIE1vemlsbGEgRm91bmRhdGlvbiBhbmQgY29udHJpYnV0b3JzXG4gKiBMaWNlbnNlZCB1bmRlciB0aGUgTmV3IEJTRCBsaWNlbnNlLiBTZWUgTElDRU5TRSBvcjpcbiAqIGh0dHA6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMy1DbGF1c2VcbiAqL1xuXG52YXIgdXRpbCA9IHJlcXVpcmUoJy4vdXRpbCcpO1xudmFyIGJpbmFyeVNlYXJjaCA9IHJlcXVpcmUoJy4vYmluYXJ5LXNlYXJjaCcpO1xudmFyIEFycmF5U2V0ID0gcmVxdWlyZSgnLi9hcnJheS1zZXQnKS5BcnJheVNldDtcbnZhciBiYXNlNjRWTFEgPSByZXF1aXJlKCcuL2Jhc2U2NC12bHEnKTtcbnZhciBxdWlja1NvcnQgPSByZXF1aXJlKCcuL3F1aWNrLXNvcnQnKS5xdWlja1NvcnQ7XG5cbmZ1bmN0aW9uIFNvdXJjZU1hcENvbnN1bWVyKGFTb3VyY2VNYXApIHtcbiAgdmFyIHNvdXJjZU1hcCA9IGFTb3VyY2VNYXA7XG4gIGlmICh0eXBlb2YgYVNvdXJjZU1hcCA9PT0gJ3N0cmluZycpIHtcbiAgICBzb3VyY2VNYXAgPSBKU09OLnBhcnNlKGFTb3VyY2VNYXAucmVwbGFjZSgvXlxcKVxcXVxcfScvLCAnJykpO1xuICB9XG5cbiAgcmV0dXJuIHNvdXJjZU1hcC5zZWN0aW9ucyAhPSBudWxsXG4gICAgPyBuZXcgSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyKHNvdXJjZU1hcClcbiAgICA6IG5ldyBCYXNpY1NvdXJjZU1hcENvbnN1bWVyKHNvdXJjZU1hcCk7XG59XG5cblNvdXJjZU1hcENvbnN1bWVyLmZyb21Tb3VyY2VNYXAgPSBmdW5jdGlvbihhU291cmNlTWFwKSB7XG4gIHJldHVybiBCYXNpY1NvdXJjZU1hcENvbnN1bWVyLmZyb21Tb3VyY2VNYXAoYVNvdXJjZU1hcCk7XG59XG5cbi8qKlxuICogVGhlIHZlcnNpb24gb2YgdGhlIHNvdXJjZSBtYXBwaW5nIHNwZWMgdGhhdCB3ZSBhcmUgY29uc3VtaW5nLlxuICovXG5Tb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuX3ZlcnNpb24gPSAzO1xuXG4vLyBgX19nZW5lcmF0ZWRNYXBwaW5nc2AgYW5kIGBfX29yaWdpbmFsTWFwcGluZ3NgIGFyZSBhcnJheXMgdGhhdCBob2xkIHRoZVxuLy8gcGFyc2VkIG1hcHBpbmcgY29vcmRpbmF0ZXMgZnJvbSB0aGUgc291cmNlIG1hcCdzIFwibWFwcGluZ3NcIiBhdHRyaWJ1dGUuIFRoZXlcbi8vIGFyZSBsYXppbHkgaW5zdGFudGlhdGVkLCBhY2Nlc3NlZCB2aWEgdGhlIGBfZ2VuZXJhdGVkTWFwcGluZ3NgIGFuZFxuLy8gYF9vcmlnaW5hbE1hcHBpbmdzYCBnZXR0ZXJzIHJlc3BlY3RpdmVseSwgYW5kIHdlIG9ubHkgcGFyc2UgdGhlIG1hcHBpbmdzXG4vLyBhbmQgY3JlYXRlIHRoZXNlIGFycmF5cyBvbmNlIHF1ZXJpZWQgZm9yIGEgc291cmNlIGxvY2F0aW9uLiBXZSBqdW1wIHRocm91Z2hcbi8vIHRoZXNlIGhvb3BzIGJlY2F1c2UgdGhlcmUgY2FuIGJlIG1hbnkgdGhvdXNhbmRzIG9mIG1hcHBpbmdzLCBhbmQgcGFyc2luZ1xuLy8gdGhlbSBpcyBleHBlbnNpdmUsIHNvIHdlIG9ubHkgd2FudCB0byBkbyBpdCBpZiB3ZSBtdXN0LlxuLy9cbi8vIEVhY2ggb2JqZWN0IGluIHRoZSBhcnJheXMgaXMgb2YgdGhlIGZvcm06XG4vL1xuLy8gICAgIHtcbi8vICAgICAgIGdlbmVyYXRlZExpbmU6IFRoZSBsaW5lIG51bWJlciBpbiB0aGUgZ2VuZXJhdGVkIGNvZGUsXG4vLyAgICAgICBnZW5lcmF0ZWRDb2x1bW46IFRoZSBjb2x1bW4gbnVtYmVyIGluIHRoZSBnZW5lcmF0ZWQgY29kZSxcbi8vICAgICAgIHNvdXJjZTogVGhlIHBhdGggdG8gdGhlIG9yaWdpbmFsIHNvdXJjZSBmaWxlIHRoYXQgZ2VuZXJhdGVkIHRoaXNcbi8vICAgICAgICAgICAgICAgY2h1bmsgb2YgY29kZSxcbi8vICAgICAgIG9yaWdpbmFsTGluZTogVGhlIGxpbmUgbnVtYmVyIGluIHRoZSBvcmlnaW5hbCBzb3VyY2UgdGhhdFxuLy8gICAgICAgICAgICAgICAgICAgICBjb3JyZXNwb25kcyB0byB0aGlzIGNodW5rIG9mIGdlbmVyYXRlZCBjb2RlLFxuLy8gICAgICAgb3JpZ2luYWxDb2x1bW46IFRoZSBjb2x1bW4gbnVtYmVyIGluIHRoZSBvcmlnaW5hbCBzb3VyY2UgdGhhdFxuLy8gICAgICAgICAgICAgICAgICAgICAgIGNvcnJlc3BvbmRzIHRvIHRoaXMgY2h1bmsgb2YgZ2VuZXJhdGVkIGNvZGUsXG4vLyAgICAgICBuYW1lOiBUaGUgbmFtZSBvZiB0aGUgb3JpZ2luYWwgc3ltYm9sIHdoaWNoIGdlbmVyYXRlZCB0aGlzIGNodW5rIG9mXG4vLyAgICAgICAgICAgICBjb2RlLlxuLy8gICAgIH1cbi8vXG4vLyBBbGwgcHJvcGVydGllcyBleGNlcHQgZm9yIGBnZW5lcmF0ZWRMaW5lYCBhbmQgYGdlbmVyYXRlZENvbHVtbmAgY2FuIGJlXG4vLyBgbnVsbGAuXG4vL1xuLy8gYF9nZW5lcmF0ZWRNYXBwaW5nc2AgaXMgb3JkZXJlZCBieSB0aGUgZ2VuZXJhdGVkIHBvc2l0aW9ucy5cbi8vXG4vLyBgX29yaWdpbmFsTWFwcGluZ3NgIGlzIG9yZGVyZWQgYnkgdGhlIG9yaWdpbmFsIHBvc2l0aW9ucy5cblxuU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlLl9fZ2VuZXJhdGVkTWFwcGluZ3MgPSBudWxsO1xuT2JqZWN0LmRlZmluZVByb3BlcnR5KFNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZSwgJ19nZW5lcmF0ZWRNYXBwaW5ncycsIHtcbiAgZ2V0OiBmdW5jdGlvbiAoKSB7XG4gICAgaWYgKCF0aGlzLl9fZ2VuZXJhdGVkTWFwcGluZ3MpIHtcbiAgICAgIHRoaXMuX3BhcnNlTWFwcGluZ3ModGhpcy5fbWFwcGluZ3MsIHRoaXMuc291cmNlUm9vdCk7XG4gICAgfVxuXG4gICAgcmV0dXJuIHRoaXMuX19nZW5lcmF0ZWRNYXBwaW5ncztcbiAgfVxufSk7XG5cblNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5fX29yaWdpbmFsTWFwcGluZ3MgPSBudWxsO1xuT2JqZWN0LmRlZmluZVByb3BlcnR5KFNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZSwgJ19vcmlnaW5hbE1hcHBpbmdzJywge1xuICBnZXQ6IGZ1bmN0aW9uICgpIHtcbiAgICBpZiAoIXRoaXMuX19vcmlnaW5hbE1hcHBpbmdzKSB7XG4gICAgICB0aGlzLl9wYXJzZU1hcHBpbmdzKHRoaXMuX21hcHBpbmdzLCB0aGlzLnNvdXJjZVJvb3QpO1xuICAgIH1cblxuICAgIHJldHVybiB0aGlzLl9fb3JpZ2luYWxNYXBwaW5ncztcbiAgfVxufSk7XG5cblNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5fY2hhcklzTWFwcGluZ1NlcGFyYXRvciA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcENvbnN1bWVyX2NoYXJJc01hcHBpbmdTZXBhcmF0b3IoYVN0ciwgaW5kZXgpIHtcbiAgICB2YXIgYyA9IGFTdHIuY2hhckF0KGluZGV4KTtcbiAgICByZXR1cm4gYyA9PT0gXCI7XCIgfHwgYyA9PT0gXCIsXCI7XG4gIH07XG5cbi8qKlxuICogUGFyc2UgdGhlIG1hcHBpbmdzIGluIGEgc3RyaW5nIGluIHRvIGEgZGF0YSBzdHJ1Y3R1cmUgd2hpY2ggd2UgY2FuIGVhc2lseVxuICogcXVlcnkgKHRoZSBvcmRlcmVkIGFycmF5cyBpbiB0aGUgYHRoaXMuX19nZW5lcmF0ZWRNYXBwaW5nc2AgYW5kXG4gKiBgdGhpcy5fX29yaWdpbmFsTWFwcGluZ3NgIHByb3BlcnRpZXMpLlxuICovXG5Tb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuX3BhcnNlTWFwcGluZ3MgPVxuICBmdW5jdGlvbiBTb3VyY2VNYXBDb25zdW1lcl9wYXJzZU1hcHBpbmdzKGFTdHIsIGFTb3VyY2VSb290KSB7XG4gICAgdGhyb3cgbmV3IEVycm9yKFwiU3ViY2xhc3NlcyBtdXN0IGltcGxlbWVudCBfcGFyc2VNYXBwaW5nc1wiKTtcbiAgfTtcblxuU291cmNlTWFwQ29uc3VtZXIuR0VORVJBVEVEX09SREVSID0gMTtcblNvdXJjZU1hcENvbnN1bWVyLk9SSUdJTkFMX09SREVSID0gMjtcblxuU291cmNlTWFwQ29uc3VtZXIuR1JFQVRFU1RfTE9XRVJfQk9VTkQgPSAxO1xuU291cmNlTWFwQ29uc3VtZXIuTEVBU1RfVVBQRVJfQk9VTkQgPSAyO1xuXG4vKipcbiAqIEl0ZXJhdGUgb3ZlciBlYWNoIG1hcHBpbmcgYmV0d2VlbiBhbiBvcmlnaW5hbCBzb3VyY2UvbGluZS9jb2x1bW4gYW5kIGFcbiAqIGdlbmVyYXRlZCBsaW5lL2NvbHVtbiBpbiB0aGlzIHNvdXJjZSBtYXAuXG4gKlxuICogQHBhcmFtIEZ1bmN0aW9uIGFDYWxsYmFja1xuICogICAgICAgIFRoZSBmdW5jdGlvbiB0aGF0IGlzIGNhbGxlZCB3aXRoIGVhY2ggbWFwcGluZy5cbiAqIEBwYXJhbSBPYmplY3QgYUNvbnRleHRcbiAqICAgICAgICBPcHRpb25hbC4gSWYgc3BlY2lmaWVkLCB0aGlzIG9iamVjdCB3aWxsIGJlIHRoZSB2YWx1ZSBvZiBgdGhpc2AgZXZlcnlcbiAqICAgICAgICB0aW1lIHRoYXQgYGFDYWxsYmFja2AgaXMgY2FsbGVkLlxuICogQHBhcmFtIGFPcmRlclxuICogICAgICAgIEVpdGhlciBgU291cmNlTWFwQ29uc3VtZXIuR0VORVJBVEVEX09SREVSYCBvclxuICogICAgICAgIGBTb3VyY2VNYXBDb25zdW1lci5PUklHSU5BTF9PUkRFUmAuIFNwZWNpZmllcyB3aGV0aGVyIHlvdSB3YW50IHRvXG4gKiAgICAgICAgaXRlcmF0ZSBvdmVyIHRoZSBtYXBwaW5ncyBzb3J0ZWQgYnkgdGhlIGdlbmVyYXRlZCBmaWxlJ3MgbGluZS9jb2x1bW5cbiAqICAgICAgICBvcmRlciBvciB0aGUgb3JpZ2luYWwncyBzb3VyY2UvbGluZS9jb2x1bW4gb3JkZXIsIHJlc3BlY3RpdmVseS4gRGVmYXVsdHMgdG9cbiAqICAgICAgICBgU291cmNlTWFwQ29uc3VtZXIuR0VORVJBVEVEX09SREVSYC5cbiAqL1xuU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlLmVhY2hNYXBwaW5nID1cbiAgZnVuY3Rpb24gU291cmNlTWFwQ29uc3VtZXJfZWFjaE1hcHBpbmcoYUNhbGxiYWNrLCBhQ29udGV4dCwgYU9yZGVyKSB7XG4gICAgdmFyIGNvbnRleHQgPSBhQ29udGV4dCB8fCBudWxsO1xuICAgIHZhciBvcmRlciA9IGFPcmRlciB8fCBTb3VyY2VNYXBDb25zdW1lci5HRU5FUkFURURfT1JERVI7XG5cbiAgICB2YXIgbWFwcGluZ3M7XG4gICAgc3dpdGNoIChvcmRlcikge1xuICAgIGNhc2UgU291cmNlTWFwQ29uc3VtZXIuR0VORVJBVEVEX09SREVSOlxuICAgICAgbWFwcGluZ3MgPSB0aGlzLl9nZW5lcmF0ZWRNYXBwaW5ncztcbiAgICAgIGJyZWFrO1xuICAgIGNhc2UgU291cmNlTWFwQ29uc3VtZXIuT1JJR0lOQUxfT1JERVI6XG4gICAgICBtYXBwaW5ncyA9IHRoaXMuX29yaWdpbmFsTWFwcGluZ3M7XG4gICAgICBicmVhaztcbiAgICBkZWZhdWx0OlxuICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVW5rbm93biBvcmRlciBvZiBpdGVyYXRpb24uXCIpO1xuICAgIH1cblxuICAgIHZhciBzb3VyY2VSb290ID0gdGhpcy5zb3VyY2VSb290O1xuICAgIG1hcHBpbmdzLm1hcChmdW5jdGlvbiAobWFwcGluZykge1xuICAgICAgdmFyIHNvdXJjZSA9IG1hcHBpbmcuc291cmNlID09PSBudWxsID8gbnVsbCA6IHRoaXMuX3NvdXJjZXMuYXQobWFwcGluZy5zb3VyY2UpO1xuICAgICAgaWYgKHNvdXJjZSAhPSBudWxsICYmIHNvdXJjZVJvb3QgIT0gbnVsbCkge1xuICAgICAgICBzb3VyY2UgPSB1dGlsLmpvaW4oc291cmNlUm9vdCwgc291cmNlKTtcbiAgICAgIH1cbiAgICAgIHJldHVybiB7XG4gICAgICAgIHNvdXJjZTogc291cmNlLFxuICAgICAgICBnZW5lcmF0ZWRMaW5lOiBtYXBwaW5nLmdlbmVyYXRlZExpbmUsXG4gICAgICAgIGdlbmVyYXRlZENvbHVtbjogbWFwcGluZy5nZW5lcmF0ZWRDb2x1bW4sXG4gICAgICAgIG9yaWdpbmFsTGluZTogbWFwcGluZy5vcmlnaW5hbExpbmUsXG4gICAgICAgIG9yaWdpbmFsQ29sdW1uOiBtYXBwaW5nLm9yaWdpbmFsQ29sdW1uLFxuICAgICAgICBuYW1lOiBtYXBwaW5nLm5hbWUgPT09IG51bGwgPyBudWxsIDogdGhpcy5fbmFtZXMuYXQobWFwcGluZy5uYW1lKVxuICAgICAgfTtcbiAgICB9LCB0aGlzKS5mb3JFYWNoKGFDYWxsYmFjaywgY29udGV4dCk7XG4gIH07XG5cbi8qKlxuICogUmV0dXJucyBhbGwgZ2VuZXJhdGVkIGxpbmUgYW5kIGNvbHVtbiBpbmZvcm1hdGlvbiBmb3IgdGhlIG9yaWdpbmFsIHNvdXJjZSxcbiAqIGxpbmUsIGFuZCBjb2x1bW4gcHJvdmlkZWQuIElmIG5vIGNvbHVtbiBpcyBwcm92aWRlZCwgcmV0dXJucyBhbGwgbWFwcGluZ3NcbiAqIGNvcnJlc3BvbmRpbmcgdG8gYSBlaXRoZXIgdGhlIGxpbmUgd2UgYXJlIHNlYXJjaGluZyBmb3Igb3IgdGhlIG5leHRcbiAqIGNsb3Nlc3QgbGluZSB0aGF0IGhhcyBhbnkgbWFwcGluZ3MuIE90aGVyd2lzZSwgcmV0dXJucyBhbGwgbWFwcGluZ3NcbiAqIGNvcnJlc3BvbmRpbmcgdG8gdGhlIGdpdmVuIGxpbmUgYW5kIGVpdGhlciB0aGUgY29sdW1uIHdlIGFyZSBzZWFyY2hpbmcgZm9yXG4gKiBvciB0aGUgbmV4dCBjbG9zZXN0IGNvbHVtbiB0aGF0IGhhcyBhbnkgb2Zmc2V0cy5cbiAqXG4gKiBUaGUgb25seSBhcmd1bWVudCBpcyBhbiBvYmplY3Qgd2l0aCB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIHNvdXJjZTogVGhlIGZpbGVuYW1lIG9mIHRoZSBvcmlnaW5hbCBzb3VyY2UuXG4gKiAgIC0gbGluZTogVGhlIGxpbmUgbnVtYmVyIGluIHRoZSBvcmlnaW5hbCBzb3VyY2UuXG4gKiAgIC0gY29sdW1uOiBPcHRpb25hbC4gdGhlIGNvbHVtbiBudW1iZXIgaW4gdGhlIG9yaWdpbmFsIHNvdXJjZS5cbiAqXG4gKiBhbmQgYW4gYXJyYXkgb2Ygb2JqZWN0cyBpcyByZXR1cm5lZCwgZWFjaCB3aXRoIHRoZSBmb2xsb3dpbmcgcHJvcGVydGllczpcbiAqXG4gKiAgIC0gbGluZTogVGhlIGxpbmUgbnVtYmVyIGluIHRoZSBnZW5lcmF0ZWQgc291cmNlLCBvciBudWxsLlxuICogICAtIGNvbHVtbjogVGhlIGNvbHVtbiBudW1iZXIgaW4gdGhlIGdlbmVyYXRlZCBzb3VyY2UsIG9yIG51bGwuXG4gKi9cblNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5hbGxHZW5lcmF0ZWRQb3NpdGlvbnNGb3IgPVxuICBmdW5jdGlvbiBTb3VyY2VNYXBDb25zdW1lcl9hbGxHZW5lcmF0ZWRQb3NpdGlvbnNGb3IoYUFyZ3MpIHtcbiAgICB2YXIgbGluZSA9IHV0aWwuZ2V0QXJnKGFBcmdzLCAnbGluZScpO1xuXG4gICAgLy8gV2hlbiB0aGVyZSBpcyBubyBleGFjdCBtYXRjaCwgQmFzaWNTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuX2ZpbmRNYXBwaW5nXG4gICAgLy8gcmV0dXJucyB0aGUgaW5kZXggb2YgdGhlIGNsb3Nlc3QgbWFwcGluZyBsZXNzIHRoYW4gdGhlIG5lZWRsZS4gQnlcbiAgICAvLyBzZXR0aW5nIG5lZWRsZS5vcmlnaW5hbENvbHVtbiB0byAwLCB3ZSB0aHVzIGZpbmQgdGhlIGxhc3QgbWFwcGluZyBmb3JcbiAgICAvLyB0aGUgZ2l2ZW4gbGluZSwgcHJvdmlkZWQgc3VjaCBhIG1hcHBpbmcgZXhpc3RzLlxuICAgIHZhciBuZWVkbGUgPSB7XG4gICAgICBzb3VyY2U6IHV0aWwuZ2V0QXJnKGFBcmdzLCAnc291cmNlJyksXG4gICAgICBvcmlnaW5hbExpbmU6IGxpbmUsXG4gICAgICBvcmlnaW5hbENvbHVtbjogdXRpbC5nZXRBcmcoYUFyZ3MsICdjb2x1bW4nLCAwKVxuICAgIH07XG5cbiAgICBpZiAodGhpcy5zb3VyY2VSb290ICE9IG51bGwpIHtcbiAgICAgIG5lZWRsZS5zb3VyY2UgPSB1dGlsLnJlbGF0aXZlKHRoaXMuc291cmNlUm9vdCwgbmVlZGxlLnNvdXJjZSk7XG4gICAgfVxuICAgIGlmICghdGhpcy5fc291cmNlcy5oYXMobmVlZGxlLnNvdXJjZSkpIHtcbiAgICAgIHJldHVybiBbXTtcbiAgICB9XG4gICAgbmVlZGxlLnNvdXJjZSA9IHRoaXMuX3NvdXJjZXMuaW5kZXhPZihuZWVkbGUuc291cmNlKTtcblxuICAgIHZhciBtYXBwaW5ncyA9IFtdO1xuXG4gICAgdmFyIGluZGV4ID0gdGhpcy5fZmluZE1hcHBpbmcobmVlZGxlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX29yaWdpbmFsTWFwcGluZ3MsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJvcmlnaW5hbExpbmVcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm9yaWdpbmFsQ29sdW1uXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXRpbC5jb21wYXJlQnlPcmlnaW5hbFBvc2l0aW9ucyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaW5hcnlTZWFyY2guTEVBU1RfVVBQRVJfQk9VTkQpO1xuICAgIGlmIChpbmRleCA+PSAwKSB7XG4gICAgICB2YXIgbWFwcGluZyA9IHRoaXMuX29yaWdpbmFsTWFwcGluZ3NbaW5kZXhdO1xuXG4gICAgICBpZiAoYUFyZ3MuY29sdW1uID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgdmFyIG9yaWdpbmFsTGluZSA9IG1hcHBpbmcub3JpZ2luYWxMaW5lO1xuXG4gICAgICAgIC8vIEl0ZXJhdGUgdW50aWwgZWl0aGVyIHdlIHJ1biBvdXQgb2YgbWFwcGluZ3MsIG9yIHdlIHJ1biBpbnRvXG4gICAgICAgIC8vIGEgbWFwcGluZyBmb3IgYSBkaWZmZXJlbnQgbGluZSB0aGFuIHRoZSBvbmUgd2UgZm91bmQuIFNpbmNlXG4gICAgICAgIC8vIG1hcHBpbmdzIGFyZSBzb3J0ZWQsIHRoaXMgaXMgZ3VhcmFudGVlZCB0byBmaW5kIGFsbCBtYXBwaW5ncyBmb3JcbiAgICAgICAgLy8gdGhlIGxpbmUgd2UgZm91bmQuXG4gICAgICAgIHdoaWxlIChtYXBwaW5nICYmIG1hcHBpbmcub3JpZ2luYWxMaW5lID09PSBvcmlnaW5hbExpbmUpIHtcbiAgICAgICAgICBtYXBwaW5ncy5wdXNoKHtcbiAgICAgICAgICAgIGxpbmU6IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdnZW5lcmF0ZWRMaW5lJywgbnVsbCksXG4gICAgICAgICAgICBjb2x1bW46IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdnZW5lcmF0ZWRDb2x1bW4nLCBudWxsKSxcbiAgICAgICAgICAgIGxhc3RDb2x1bW46IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdsYXN0R2VuZXJhdGVkQ29sdW1uJywgbnVsbClcbiAgICAgICAgICB9KTtcblxuICAgICAgICAgIG1hcHBpbmcgPSB0aGlzLl9vcmlnaW5hbE1hcHBpbmdzWysraW5kZXhdO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICB2YXIgb3JpZ2luYWxDb2x1bW4gPSBtYXBwaW5nLm9yaWdpbmFsQ29sdW1uO1xuXG4gICAgICAgIC8vIEl0ZXJhdGUgdW50aWwgZWl0aGVyIHdlIHJ1biBvdXQgb2YgbWFwcGluZ3MsIG9yIHdlIHJ1biBpbnRvXG4gICAgICAgIC8vIGEgbWFwcGluZyBmb3IgYSBkaWZmZXJlbnQgbGluZSB0aGFuIHRoZSBvbmUgd2Ugd2VyZSBzZWFyY2hpbmcgZm9yLlxuICAgICAgICAvLyBTaW5jZSBtYXBwaW5ncyBhcmUgc29ydGVkLCB0aGlzIGlzIGd1YXJhbnRlZWQgdG8gZmluZCBhbGwgbWFwcGluZ3MgZm9yXG4gICAgICAgIC8vIHRoZSBsaW5lIHdlIGFyZSBzZWFyY2hpbmcgZm9yLlxuICAgICAgICB3aGlsZSAobWFwcGluZyAmJlxuICAgICAgICAgICAgICAgbWFwcGluZy5vcmlnaW5hbExpbmUgPT09IGxpbmUgJiZcbiAgICAgICAgICAgICAgIG1hcHBpbmcub3JpZ2luYWxDb2x1bW4gPT0gb3JpZ2luYWxDb2x1bW4pIHtcbiAgICAgICAgICBtYXBwaW5ncy5wdXNoKHtcbiAgICAgICAgICAgIGxpbmU6IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdnZW5lcmF0ZWRMaW5lJywgbnVsbCksXG4gICAgICAgICAgICBjb2x1bW46IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdnZW5lcmF0ZWRDb2x1bW4nLCBudWxsKSxcbiAgICAgICAgICAgIGxhc3RDb2x1bW46IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdsYXN0R2VuZXJhdGVkQ29sdW1uJywgbnVsbClcbiAgICAgICAgICB9KTtcblxuICAgICAgICAgIG1hcHBpbmcgPSB0aGlzLl9vcmlnaW5hbE1hcHBpbmdzWysraW5kZXhdO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgcmV0dXJuIG1hcHBpbmdzO1xuICB9O1xuXG5leHBvcnRzLlNvdXJjZU1hcENvbnN1bWVyID0gU291cmNlTWFwQ29uc3VtZXI7XG5cbi8qKlxuICogQSBCYXNpY1NvdXJjZU1hcENvbnN1bWVyIGluc3RhbmNlIHJlcHJlc2VudHMgYSBwYXJzZWQgc291cmNlIG1hcCB3aGljaCB3ZSBjYW5cbiAqIHF1ZXJ5IGZvciBpbmZvcm1hdGlvbiBhYm91dCB0aGUgb3JpZ2luYWwgZmlsZSBwb3NpdGlvbnMgYnkgZ2l2aW5nIGl0IGEgZmlsZVxuICogcG9zaXRpb24gaW4gdGhlIGdlbmVyYXRlZCBzb3VyY2UuXG4gKlxuICogVGhlIG9ubHkgcGFyYW1ldGVyIGlzIHRoZSByYXcgc291cmNlIG1hcCAoZWl0aGVyIGFzIGEgSlNPTiBzdHJpbmcsIG9yXG4gKiBhbHJlYWR5IHBhcnNlZCB0byBhbiBvYmplY3QpLiBBY2NvcmRpbmcgdG8gdGhlIHNwZWMsIHNvdXJjZSBtYXBzIGhhdmUgdGhlXG4gKiBmb2xsb3dpbmcgYXR0cmlidXRlczpcbiAqXG4gKiAgIC0gdmVyc2lvbjogV2hpY2ggdmVyc2lvbiBvZiB0aGUgc291cmNlIG1hcCBzcGVjIHRoaXMgbWFwIGlzIGZvbGxvd2luZy5cbiAqICAgLSBzb3VyY2VzOiBBbiBhcnJheSBvZiBVUkxzIHRvIHRoZSBvcmlnaW5hbCBzb3VyY2UgZmlsZXMuXG4gKiAgIC0gbmFtZXM6IEFuIGFycmF5IG9mIGlkZW50aWZpZXJzIHdoaWNoIGNhbiBiZSByZWZlcnJlbmNlZCBieSBpbmRpdmlkdWFsIG1hcHBpbmdzLlxuICogICAtIHNvdXJjZVJvb3Q6IE9wdGlvbmFsLiBUaGUgVVJMIHJvb3QgZnJvbSB3aGljaCBhbGwgc291cmNlcyBhcmUgcmVsYXRpdmUuXG4gKiAgIC0gc291cmNlc0NvbnRlbnQ6IE9wdGlvbmFsLiBBbiBhcnJheSBvZiBjb250ZW50cyBvZiB0aGUgb3JpZ2luYWwgc291cmNlIGZpbGVzLlxuICogICAtIG1hcHBpbmdzOiBBIHN0cmluZyBvZiBiYXNlNjQgVkxRcyB3aGljaCBjb250YWluIHRoZSBhY3R1YWwgbWFwcGluZ3MuXG4gKiAgIC0gZmlsZTogT3B0aW9uYWwuIFRoZSBnZW5lcmF0ZWQgZmlsZSB0aGlzIHNvdXJjZSBtYXAgaXMgYXNzb2NpYXRlZCB3aXRoLlxuICpcbiAqIEhlcmUgaXMgYW4gZXhhbXBsZSBzb3VyY2UgbWFwLCB0YWtlbiBmcm9tIHRoZSBzb3VyY2UgbWFwIHNwZWNbMF06XG4gKlxuICogICAgIHtcbiAqICAgICAgIHZlcnNpb24gOiAzLFxuICogICAgICAgZmlsZTogXCJvdXQuanNcIixcbiAqICAgICAgIHNvdXJjZVJvb3QgOiBcIlwiLFxuICogICAgICAgc291cmNlczogW1wiZm9vLmpzXCIsIFwiYmFyLmpzXCJdLFxuICogICAgICAgbmFtZXM6IFtcInNyY1wiLCBcIm1hcHNcIiwgXCJhcmVcIiwgXCJmdW5cIl0sXG4gKiAgICAgICBtYXBwaW5nczogXCJBQSxBQjs7QUJDREU7XCJcbiAqICAgICB9XG4gKlxuICogWzBdOiBodHRwczovL2RvY3MuZ29vZ2xlLmNvbS9kb2N1bWVudC9kLzFVMVJHQWVoUXdSeXBVVG92RjFLUmxwaU9GemUwYi1fMmdjNmZBSDBLWTBrL2VkaXQ/cGxpPTEjXG4gKi9cbmZ1bmN0aW9uIEJhc2ljU291cmNlTWFwQ29uc3VtZXIoYVNvdXJjZU1hcCkge1xuICB2YXIgc291cmNlTWFwID0gYVNvdXJjZU1hcDtcbiAgaWYgKHR5cGVvZiBhU291cmNlTWFwID09PSAnc3RyaW5nJykge1xuICAgIHNvdXJjZU1hcCA9IEpTT04ucGFyc2UoYVNvdXJjZU1hcC5yZXBsYWNlKC9eXFwpXFxdXFx9Jy8sICcnKSk7XG4gIH1cblxuICB2YXIgdmVyc2lvbiA9IHV0aWwuZ2V0QXJnKHNvdXJjZU1hcCwgJ3ZlcnNpb24nKTtcbiAgdmFyIHNvdXJjZXMgPSB1dGlsLmdldEFyZyhzb3VyY2VNYXAsICdzb3VyY2VzJyk7XG4gIC8vIFNhc3MgMy4zIGxlYXZlcyBvdXQgdGhlICduYW1lcycgYXJyYXksIHNvIHdlIGRldmlhdGUgZnJvbSB0aGUgc3BlYyAod2hpY2hcbiAgLy8gcmVxdWlyZXMgdGhlIGFycmF5KSB0byBwbGF5IG5pY2UgaGVyZS5cbiAgdmFyIG5hbWVzID0gdXRpbC5nZXRBcmcoc291cmNlTWFwLCAnbmFtZXMnLCBbXSk7XG4gIHZhciBzb3VyY2VSb290ID0gdXRpbC5nZXRBcmcoc291cmNlTWFwLCAnc291cmNlUm9vdCcsIG51bGwpO1xuICB2YXIgc291cmNlc0NvbnRlbnQgPSB1dGlsLmdldEFyZyhzb3VyY2VNYXAsICdzb3VyY2VzQ29udGVudCcsIG51bGwpO1xuICB2YXIgbWFwcGluZ3MgPSB1dGlsLmdldEFyZyhzb3VyY2VNYXAsICdtYXBwaW5ncycpO1xuICB2YXIgZmlsZSA9IHV0aWwuZ2V0QXJnKHNvdXJjZU1hcCwgJ2ZpbGUnLCBudWxsKTtcblxuICAvLyBPbmNlIGFnYWluLCBTYXNzIGRldmlhdGVzIGZyb20gdGhlIHNwZWMgYW5kIHN1cHBsaWVzIHRoZSB2ZXJzaW9uIGFzIGFcbiAgLy8gc3RyaW5nIHJhdGhlciB0aGFuIGEgbnVtYmVyLCBzbyB3ZSB1c2UgbG9vc2UgZXF1YWxpdHkgY2hlY2tpbmcgaGVyZS5cbiAgaWYgKHZlcnNpb24gIT0gdGhpcy5fdmVyc2lvbikge1xuICAgIHRocm93IG5ldyBFcnJvcignVW5zdXBwb3J0ZWQgdmVyc2lvbjogJyArIHZlcnNpb24pO1xuICB9XG5cbiAgc291cmNlcyA9IHNvdXJjZXNcbiAgICAubWFwKFN0cmluZylcbiAgICAvLyBTb21lIHNvdXJjZSBtYXBzIHByb2R1Y2UgcmVsYXRpdmUgc291cmNlIHBhdGhzIGxpa2UgXCIuL2Zvby5qc1wiIGluc3RlYWQgb2ZcbiAgICAvLyBcImZvby5qc1wiLiAgTm9ybWFsaXplIHRoZXNlIGZpcnN0IHNvIHRoYXQgZnV0dXJlIGNvbXBhcmlzb25zIHdpbGwgc3VjY2VlZC5cbiAgICAvLyBTZWUgYnVnemlsLmxhLzEwOTA3NjguXG4gICAgLm1hcCh1dGlsLm5vcm1hbGl6ZSlcbiAgICAvLyBBbHdheXMgZW5zdXJlIHRoYXQgYWJzb2x1dGUgc291cmNlcyBhcmUgaW50ZXJuYWxseSBzdG9yZWQgcmVsYXRpdmUgdG9cbiAgICAvLyB0aGUgc291cmNlIHJvb3QsIGlmIHRoZSBzb3VyY2Ugcm9vdCBpcyBhYnNvbHV0ZS4gTm90IGRvaW5nIHRoaXMgd291bGRcbiAgICAvLyBiZSBwYXJ0aWN1bGFybHkgcHJvYmxlbWF0aWMgd2hlbiB0aGUgc291cmNlIHJvb3QgaXMgYSBwcmVmaXggb2YgdGhlXG4gICAgLy8gc291cmNlICh2YWxpZCwgYnV0IHdoeT8/KS4gU2VlIGdpdGh1YiBpc3N1ZSAjMTk5IGFuZCBidWd6aWwubGEvMTE4ODk4Mi5cbiAgICAubWFwKGZ1bmN0aW9uIChzb3VyY2UpIHtcbiAgICAgIHJldHVybiBzb3VyY2VSb290ICYmIHV0aWwuaXNBYnNvbHV0ZShzb3VyY2VSb290KSAmJiB1dGlsLmlzQWJzb2x1dGUoc291cmNlKVxuICAgICAgICA/IHV0aWwucmVsYXRpdmUoc291cmNlUm9vdCwgc291cmNlKVxuICAgICAgICA6IHNvdXJjZTtcbiAgICB9KTtcblxuICAvLyBQYXNzIGB0cnVlYCBiZWxvdyB0byBhbGxvdyBkdXBsaWNhdGUgbmFtZXMgYW5kIHNvdXJjZXMuIFdoaWxlIHNvdXJjZSBtYXBzXG4gIC8vIGFyZSBpbnRlbmRlZCB0byBiZSBjb21wcmVzc2VkIGFuZCBkZWR1cGxpY2F0ZWQsIHRoZSBUeXBlU2NyaXB0IGNvbXBpbGVyXG4gIC8vIHNvbWV0aW1lcyBnZW5lcmF0ZXMgc291cmNlIG1hcHMgd2l0aCBkdXBsaWNhdGVzIGluIHRoZW0uIFNlZSBHaXRodWIgaXNzdWVcbiAgLy8gIzcyIGFuZCBidWd6aWwubGEvODg5NDkyLlxuICB0aGlzLl9uYW1lcyA9IEFycmF5U2V0LmZyb21BcnJheShuYW1lcy5tYXAoU3RyaW5nKSwgdHJ1ZSk7XG4gIHRoaXMuX3NvdXJjZXMgPSBBcnJheVNldC5mcm9tQXJyYXkoc291cmNlcywgdHJ1ZSk7XG5cbiAgdGhpcy5zb3VyY2VSb290ID0gc291cmNlUm9vdDtcbiAgdGhpcy5zb3VyY2VzQ29udGVudCA9IHNvdXJjZXNDb250ZW50O1xuICB0aGlzLl9tYXBwaW5ncyA9IG1hcHBpbmdzO1xuICB0aGlzLmZpbGUgPSBmaWxlO1xufVxuXG5CYXNpY1NvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZSA9IE9iamVjdC5jcmVhdGUoU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlKTtcbkJhc2ljU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlLmNvbnN1bWVyID0gU291cmNlTWFwQ29uc3VtZXI7XG5cbi8qKlxuICogQ3JlYXRlIGEgQmFzaWNTb3VyY2VNYXBDb25zdW1lciBmcm9tIGEgU291cmNlTWFwR2VuZXJhdG9yLlxuICpcbiAqIEBwYXJhbSBTb3VyY2VNYXBHZW5lcmF0b3IgYVNvdXJjZU1hcFxuICogICAgICAgIFRoZSBzb3VyY2UgbWFwIHRoYXQgd2lsbCBiZSBjb25zdW1lZC5cbiAqIEByZXR1cm5zIEJhc2ljU291cmNlTWFwQ29uc3VtZXJcbiAqL1xuQmFzaWNTb3VyY2VNYXBDb25zdW1lci5mcm9tU291cmNlTWFwID1cbiAgZnVuY3Rpb24gU291cmNlTWFwQ29uc3VtZXJfZnJvbVNvdXJjZU1hcChhU291cmNlTWFwKSB7XG4gICAgdmFyIHNtYyA9IE9iamVjdC5jcmVhdGUoQmFzaWNTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUpO1xuXG4gICAgdmFyIG5hbWVzID0gc21jLl9uYW1lcyA9IEFycmF5U2V0LmZyb21BcnJheShhU291cmNlTWFwLl9uYW1lcy50b0FycmF5KCksIHRydWUpO1xuICAgIHZhciBzb3VyY2VzID0gc21jLl9zb3VyY2VzID0gQXJyYXlTZXQuZnJvbUFycmF5KGFTb3VyY2VNYXAuX3NvdXJjZXMudG9BcnJheSgpLCB0cnVlKTtcbiAgICBzbWMuc291cmNlUm9vdCA9IGFTb3VyY2VNYXAuX3NvdXJjZVJvb3Q7XG4gICAgc21jLnNvdXJjZXNDb250ZW50ID0gYVNvdXJjZU1hcC5fZ2VuZXJhdGVTb3VyY2VzQ29udGVudChzbWMuX3NvdXJjZXMudG9BcnJheSgpLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc21jLnNvdXJjZVJvb3QpO1xuICAgIHNtYy5maWxlID0gYVNvdXJjZU1hcC5fZmlsZTtcblxuICAgIC8vIEJlY2F1c2Ugd2UgYXJlIG1vZGlmeWluZyB0aGUgZW50cmllcyAoYnkgY29udmVydGluZyBzdHJpbmcgc291cmNlcyBhbmRcbiAgICAvLyBuYW1lcyB0byBpbmRpY2VzIGludG8gdGhlIHNvdXJjZXMgYW5kIG5hbWVzIEFycmF5U2V0cyksIHdlIGhhdmUgdG8gbWFrZVxuICAgIC8vIGEgY29weSBvZiB0aGUgZW50cnkgb3IgZWxzZSBiYWQgdGhpbmdzIGhhcHBlbi4gU2hhcmVkIG11dGFibGUgc3RhdGVcbiAgICAvLyBzdHJpa2VzIGFnYWluISBTZWUgZ2l0aHViIGlzc3VlICMxOTEuXG5cbiAgICB2YXIgZ2VuZXJhdGVkTWFwcGluZ3MgPSBhU291cmNlTWFwLl9tYXBwaW5ncy50b0FycmF5KCkuc2xpY2UoKTtcbiAgICB2YXIgZGVzdEdlbmVyYXRlZE1hcHBpbmdzID0gc21jLl9fZ2VuZXJhdGVkTWFwcGluZ3MgPSBbXTtcbiAgICB2YXIgZGVzdE9yaWdpbmFsTWFwcGluZ3MgPSBzbWMuX19vcmlnaW5hbE1hcHBpbmdzID0gW107XG5cbiAgICBmb3IgKHZhciBpID0gMCwgbGVuZ3RoID0gZ2VuZXJhdGVkTWFwcGluZ3MubGVuZ3RoOyBpIDwgbGVuZ3RoOyBpKyspIHtcbiAgICAgIHZhciBzcmNNYXBwaW5nID0gZ2VuZXJhdGVkTWFwcGluZ3NbaV07XG4gICAgICB2YXIgZGVzdE1hcHBpbmcgPSBuZXcgTWFwcGluZztcbiAgICAgIGRlc3RNYXBwaW5nLmdlbmVyYXRlZExpbmUgPSBzcmNNYXBwaW5nLmdlbmVyYXRlZExpbmU7XG4gICAgICBkZXN0TWFwcGluZy5nZW5lcmF0ZWRDb2x1bW4gPSBzcmNNYXBwaW5nLmdlbmVyYXRlZENvbHVtbjtcblxuICAgICAgaWYgKHNyY01hcHBpbmcuc291cmNlKSB7XG4gICAgICAgIGRlc3RNYXBwaW5nLnNvdXJjZSA9IHNvdXJjZXMuaW5kZXhPZihzcmNNYXBwaW5nLnNvdXJjZSk7XG4gICAgICAgIGRlc3RNYXBwaW5nLm9yaWdpbmFsTGluZSA9IHNyY01hcHBpbmcub3JpZ2luYWxMaW5lO1xuICAgICAgICBkZXN0TWFwcGluZy5vcmlnaW5hbENvbHVtbiA9IHNyY01hcHBpbmcub3JpZ2luYWxDb2x1bW47XG5cbiAgICAgICAgaWYgKHNyY01hcHBpbmcubmFtZSkge1xuICAgICAgICAgIGRlc3RNYXBwaW5nLm5hbWUgPSBuYW1lcy5pbmRleE9mKHNyY01hcHBpbmcubmFtZSk7XG4gICAgICAgIH1cblxuICAgICAgICBkZXN0T3JpZ2luYWxNYXBwaW5ncy5wdXNoKGRlc3RNYXBwaW5nKTtcbiAgICAgIH1cblxuICAgICAgZGVzdEdlbmVyYXRlZE1hcHBpbmdzLnB1c2goZGVzdE1hcHBpbmcpO1xuICAgIH1cblxuICAgIHF1aWNrU29ydChzbWMuX19vcmlnaW5hbE1hcHBpbmdzLCB1dGlsLmNvbXBhcmVCeU9yaWdpbmFsUG9zaXRpb25zKTtcblxuICAgIHJldHVybiBzbWM7XG4gIH07XG5cbi8qKlxuICogVGhlIHZlcnNpb24gb2YgdGhlIHNvdXJjZSBtYXBwaW5nIHNwZWMgdGhhdCB3ZSBhcmUgY29uc3VtaW5nLlxuICovXG5CYXNpY1NvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5fdmVyc2lvbiA9IDM7XG5cbi8qKlxuICogVGhlIGxpc3Qgb2Ygb3JpZ2luYWwgc291cmNlcy5cbiAqL1xuT2JqZWN0LmRlZmluZVByb3BlcnR5KEJhc2ljU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlLCAnc291cmNlcycsIHtcbiAgZ2V0OiBmdW5jdGlvbiAoKSB7XG4gICAgcmV0dXJuIHRoaXMuX3NvdXJjZXMudG9BcnJheSgpLm1hcChmdW5jdGlvbiAocykge1xuICAgICAgcmV0dXJuIHRoaXMuc291cmNlUm9vdCAhPSBudWxsID8gdXRpbC5qb2luKHRoaXMuc291cmNlUm9vdCwgcykgOiBzO1xuICAgIH0sIHRoaXMpO1xuICB9XG59KTtcblxuLyoqXG4gKiBQcm92aWRlIHRoZSBKSVQgd2l0aCBhIG5pY2Ugc2hhcGUgLyBoaWRkZW4gY2xhc3MuXG4gKi9cbmZ1bmN0aW9uIE1hcHBpbmcoKSB7XG4gIHRoaXMuZ2VuZXJhdGVkTGluZSA9IDA7XG4gIHRoaXMuZ2VuZXJhdGVkQ29sdW1uID0gMDtcbiAgdGhpcy5zb3VyY2UgPSBudWxsO1xuICB0aGlzLm9yaWdpbmFsTGluZSA9IG51bGw7XG4gIHRoaXMub3JpZ2luYWxDb2x1bW4gPSBudWxsO1xuICB0aGlzLm5hbWUgPSBudWxsO1xufVxuXG4vKipcbiAqIFBhcnNlIHRoZSBtYXBwaW5ncyBpbiBhIHN0cmluZyBpbiB0byBhIGRhdGEgc3RydWN0dXJlIHdoaWNoIHdlIGNhbiBlYXNpbHlcbiAqIHF1ZXJ5ICh0aGUgb3JkZXJlZCBhcnJheXMgaW4gdGhlIGB0aGlzLl9fZ2VuZXJhdGVkTWFwcGluZ3NgIGFuZFxuICogYHRoaXMuX19vcmlnaW5hbE1hcHBpbmdzYCBwcm9wZXJ0aWVzKS5cbiAqL1xuQmFzaWNTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuX3BhcnNlTWFwcGluZ3MgPVxuICBmdW5jdGlvbiBTb3VyY2VNYXBDb25zdW1lcl9wYXJzZU1hcHBpbmdzKGFTdHIsIGFTb3VyY2VSb290KSB7XG4gICAgdmFyIGdlbmVyYXRlZExpbmUgPSAxO1xuICAgIHZhciBwcmV2aW91c0dlbmVyYXRlZENvbHVtbiA9IDA7XG4gICAgdmFyIHByZXZpb3VzT3JpZ2luYWxMaW5lID0gMDtcbiAgICB2YXIgcHJldmlvdXNPcmlnaW5hbENvbHVtbiA9IDA7XG4gICAgdmFyIHByZXZpb3VzU291cmNlID0gMDtcbiAgICB2YXIgcHJldmlvdXNOYW1lID0gMDtcbiAgICB2YXIgbGVuZ3RoID0gYVN0ci5sZW5ndGg7XG4gICAgdmFyIGluZGV4ID0gMDtcbiAgICB2YXIgY2FjaGVkU2VnbWVudHMgPSB7fTtcbiAgICB2YXIgdGVtcCA9IHt9O1xuICAgIHZhciBvcmlnaW5hbE1hcHBpbmdzID0gW107XG4gICAgdmFyIGdlbmVyYXRlZE1hcHBpbmdzID0gW107XG4gICAgdmFyIG1hcHBpbmcsIHN0ciwgc2VnbWVudCwgZW5kLCB2YWx1ZTtcblxuICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgaWYgKGFTdHIuY2hhckF0KGluZGV4KSA9PT0gJzsnKSB7XG4gICAgICAgIGdlbmVyYXRlZExpbmUrKztcbiAgICAgICAgaW5kZXgrKztcbiAgICAgICAgcHJldmlvdXNHZW5lcmF0ZWRDb2x1bW4gPSAwO1xuICAgICAgfVxuICAgICAgZWxzZSBpZiAoYVN0ci5jaGFyQXQoaW5kZXgpID09PSAnLCcpIHtcbiAgICAgICAgaW5kZXgrKztcbiAgICAgIH1cbiAgICAgIGVsc2Uge1xuICAgICAgICBtYXBwaW5nID0gbmV3IE1hcHBpbmcoKTtcbiAgICAgICAgbWFwcGluZy5nZW5lcmF0ZWRMaW5lID0gZ2VuZXJhdGVkTGluZTtcblxuICAgICAgICAvLyBCZWNhdXNlIGVhY2ggb2Zmc2V0IGlzIGVuY29kZWQgcmVsYXRpdmUgdG8gdGhlIHByZXZpb3VzIG9uZSxcbiAgICAgICAgLy8gbWFueSBzZWdtZW50cyBvZnRlbiBoYXZlIHRoZSBzYW1lIGVuY29kaW5nLiBXZSBjYW4gZXhwbG9pdCB0aGlzXG4gICAgICAgIC8vIGZhY3QgYnkgY2FjaGluZyB0aGUgcGFyc2VkIHZhcmlhYmxlIGxlbmd0aCBmaWVsZHMgb2YgZWFjaCBzZWdtZW50LFxuICAgICAgICAvLyBhbGxvd2luZyB1cyB0byBhdm9pZCBhIHNlY29uZCBwYXJzZSBpZiB3ZSBlbmNvdW50ZXIgdGhlIHNhbWVcbiAgICAgICAgLy8gc2VnbWVudCBhZ2Fpbi5cbiAgICAgICAgZm9yIChlbmQgPSBpbmRleDsgZW5kIDwgbGVuZ3RoOyBlbmQrKykge1xuICAgICAgICAgIGlmICh0aGlzLl9jaGFySXNNYXBwaW5nU2VwYXJhdG9yKGFTdHIsIGVuZCkpIHtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBzdHIgPSBhU3RyLnNsaWNlKGluZGV4LCBlbmQpO1xuXG4gICAgICAgIHNlZ21lbnQgPSBjYWNoZWRTZWdtZW50c1tzdHJdO1xuICAgICAgICBpZiAoc2VnbWVudCkge1xuICAgICAgICAgIGluZGV4ICs9IHN0ci5sZW5ndGg7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgc2VnbWVudCA9IFtdO1xuICAgICAgICAgIHdoaWxlIChpbmRleCA8IGVuZCkge1xuICAgICAgICAgICAgYmFzZTY0VkxRLmRlY29kZShhU3RyLCBpbmRleCwgdGVtcCk7XG4gICAgICAgICAgICB2YWx1ZSA9IHRlbXAudmFsdWU7XG4gICAgICAgICAgICBpbmRleCA9IHRlbXAucmVzdDtcbiAgICAgICAgICAgIHNlZ21lbnQucHVzaCh2YWx1ZSk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHNlZ21lbnQubGVuZ3RoID09PSAyKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ZvdW5kIGEgc291cmNlLCBidXQgbm8gbGluZSBhbmQgY29sdW1uJyk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHNlZ21lbnQubGVuZ3RoID09PSAzKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ZvdW5kIGEgc291cmNlIGFuZCBsaW5lLCBidXQgbm8gY29sdW1uJyk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgY2FjaGVkU2VnbWVudHNbc3RyXSA9IHNlZ21lbnQ7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBHZW5lcmF0ZWQgY29sdW1uLlxuICAgICAgICBtYXBwaW5nLmdlbmVyYXRlZENvbHVtbiA9IHByZXZpb3VzR2VuZXJhdGVkQ29sdW1uICsgc2VnbWVudFswXTtcbiAgICAgICAgcHJldmlvdXNHZW5lcmF0ZWRDb2x1bW4gPSBtYXBwaW5nLmdlbmVyYXRlZENvbHVtbjtcblxuICAgICAgICBpZiAoc2VnbWVudC5sZW5ndGggPiAxKSB7XG4gICAgICAgICAgLy8gT3JpZ2luYWwgc291cmNlLlxuICAgICAgICAgIG1hcHBpbmcuc291cmNlID0gcHJldmlvdXNTb3VyY2UgKyBzZWdtZW50WzFdO1xuICAgICAgICAgIHByZXZpb3VzU291cmNlICs9IHNlZ21lbnRbMV07XG5cbiAgICAgICAgICAvLyBPcmlnaW5hbCBsaW5lLlxuICAgICAgICAgIG1hcHBpbmcub3JpZ2luYWxMaW5lID0gcHJldmlvdXNPcmlnaW5hbExpbmUgKyBzZWdtZW50WzJdO1xuICAgICAgICAgIHByZXZpb3VzT3JpZ2luYWxMaW5lID0gbWFwcGluZy5vcmlnaW5hbExpbmU7XG4gICAgICAgICAgLy8gTGluZXMgYXJlIHN0b3JlZCAwLWJhc2VkXG4gICAgICAgICAgbWFwcGluZy5vcmlnaW5hbExpbmUgKz0gMTtcblxuICAgICAgICAgIC8vIE9yaWdpbmFsIGNvbHVtbi5cbiAgICAgICAgICBtYXBwaW5nLm9yaWdpbmFsQ29sdW1uID0gcHJldmlvdXNPcmlnaW5hbENvbHVtbiArIHNlZ21lbnRbM107XG4gICAgICAgICAgcHJldmlvdXNPcmlnaW5hbENvbHVtbiA9IG1hcHBpbmcub3JpZ2luYWxDb2x1bW47XG5cbiAgICAgICAgICBpZiAoc2VnbWVudC5sZW5ndGggPiA0KSB7XG4gICAgICAgICAgICAvLyBPcmlnaW5hbCBuYW1lLlxuICAgICAgICAgICAgbWFwcGluZy5uYW1lID0gcHJldmlvdXNOYW1lICsgc2VnbWVudFs0XTtcbiAgICAgICAgICAgIHByZXZpb3VzTmFtZSArPSBzZWdtZW50WzRdO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGdlbmVyYXRlZE1hcHBpbmdzLnB1c2gobWFwcGluZyk7XG4gICAgICAgIGlmICh0eXBlb2YgbWFwcGluZy5vcmlnaW5hbExpbmUgPT09ICdudW1iZXInKSB7XG4gICAgICAgICAgb3JpZ2luYWxNYXBwaW5ncy5wdXNoKG1hcHBpbmcpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgcXVpY2tTb3J0KGdlbmVyYXRlZE1hcHBpbmdzLCB1dGlsLmNvbXBhcmVCeUdlbmVyYXRlZFBvc2l0aW9uc0RlZmxhdGVkKTtcbiAgICB0aGlzLl9fZ2VuZXJhdGVkTWFwcGluZ3MgPSBnZW5lcmF0ZWRNYXBwaW5ncztcblxuICAgIHF1aWNrU29ydChvcmlnaW5hbE1hcHBpbmdzLCB1dGlsLmNvbXBhcmVCeU9yaWdpbmFsUG9zaXRpb25zKTtcbiAgICB0aGlzLl9fb3JpZ2luYWxNYXBwaW5ncyA9IG9yaWdpbmFsTWFwcGluZ3M7XG4gIH07XG5cbi8qKlxuICogRmluZCB0aGUgbWFwcGluZyB0aGF0IGJlc3QgbWF0Y2hlcyB0aGUgaHlwb3RoZXRpY2FsIFwibmVlZGxlXCIgbWFwcGluZyB0aGF0XG4gKiB3ZSBhcmUgc2VhcmNoaW5nIGZvciBpbiB0aGUgZ2l2ZW4gXCJoYXlzdGFja1wiIG9mIG1hcHBpbmdzLlxuICovXG5CYXNpY1NvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5fZmluZE1hcHBpbmcgPVxuICBmdW5jdGlvbiBTb3VyY2VNYXBDb25zdW1lcl9maW5kTWFwcGluZyhhTmVlZGxlLCBhTWFwcGluZ3MsIGFMaW5lTmFtZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYUNvbHVtbk5hbWUsIGFDb21wYXJhdG9yLCBhQmlhcykge1xuICAgIC8vIFRvIHJldHVybiB0aGUgcG9zaXRpb24gd2UgYXJlIHNlYXJjaGluZyBmb3IsIHdlIG11c3QgZmlyc3QgZmluZCB0aGVcbiAgICAvLyBtYXBwaW5nIGZvciB0aGUgZ2l2ZW4gcG9zaXRpb24gYW5kIHRoZW4gcmV0dXJuIHRoZSBvcHBvc2l0ZSBwb3NpdGlvbiBpdFxuICAgIC8vIHBvaW50cyB0by4gQmVjYXVzZSB0aGUgbWFwcGluZ3MgYXJlIHNvcnRlZCwgd2UgY2FuIHVzZSBiaW5hcnkgc2VhcmNoIHRvXG4gICAgLy8gZmluZCB0aGUgYmVzdCBtYXBwaW5nLlxuXG4gICAgaWYgKGFOZWVkbGVbYUxpbmVOYW1lXSA8PSAwKSB7XG4gICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdMaW5lIG11c3QgYmUgZ3JlYXRlciB0aGFuIG9yIGVxdWFsIHRvIDEsIGdvdCAnXG4gICAgICAgICAgICAgICAgICAgICAgICAgICsgYU5lZWRsZVthTGluZU5hbWVdKTtcbiAgICB9XG4gICAgaWYgKGFOZWVkbGVbYUNvbHVtbk5hbWVdIDwgMCkge1xuICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQ29sdW1uIG11c3QgYmUgZ3JlYXRlciB0aGFuIG9yIGVxdWFsIHRvIDAsIGdvdCAnXG4gICAgICAgICAgICAgICAgICAgICAgICAgICsgYU5lZWRsZVthQ29sdW1uTmFtZV0pO1xuICAgIH1cblxuICAgIHJldHVybiBiaW5hcnlTZWFyY2guc2VhcmNoKGFOZWVkbGUsIGFNYXBwaW5ncywgYUNvbXBhcmF0b3IsIGFCaWFzKTtcbiAgfTtcblxuLyoqXG4gKiBDb21wdXRlIHRoZSBsYXN0IGNvbHVtbiBmb3IgZWFjaCBnZW5lcmF0ZWQgbWFwcGluZy4gVGhlIGxhc3QgY29sdW1uIGlzXG4gKiBpbmNsdXNpdmUuXG4gKi9cbkJhc2ljU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlLmNvbXB1dGVDb2x1bW5TcGFucyA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcENvbnN1bWVyX2NvbXB1dGVDb2x1bW5TcGFucygpIHtcbiAgICBmb3IgKHZhciBpbmRleCA9IDA7IGluZGV4IDwgdGhpcy5fZ2VuZXJhdGVkTWFwcGluZ3MubGVuZ3RoOyArK2luZGV4KSB7XG4gICAgICB2YXIgbWFwcGluZyA9IHRoaXMuX2dlbmVyYXRlZE1hcHBpbmdzW2luZGV4XTtcblxuICAgICAgLy8gTWFwcGluZ3MgZG8gbm90IGNvbnRhaW4gYSBmaWVsZCBmb3IgdGhlIGxhc3QgZ2VuZXJhdGVkIGNvbHVtbnQuIFdlXG4gICAgICAvLyBjYW4gY29tZSB1cCB3aXRoIGFuIG9wdGltaXN0aWMgZXN0aW1hdGUsIGhvd2V2ZXIsIGJ5IGFzc3VtaW5nIHRoYXRcbiAgICAgIC8vIG1hcHBpbmdzIGFyZSBjb250aWd1b3VzIChpLmUuIGdpdmVuIHR3byBjb25zZWN1dGl2ZSBtYXBwaW5ncywgdGhlXG4gICAgICAvLyBmaXJzdCBtYXBwaW5nIGVuZHMgd2hlcmUgdGhlIHNlY29uZCBvbmUgc3RhcnRzKS5cbiAgICAgIGlmIChpbmRleCArIDEgPCB0aGlzLl9nZW5lcmF0ZWRNYXBwaW5ncy5sZW5ndGgpIHtcbiAgICAgICAgdmFyIG5leHRNYXBwaW5nID0gdGhpcy5fZ2VuZXJhdGVkTWFwcGluZ3NbaW5kZXggKyAxXTtcblxuICAgICAgICBpZiAobWFwcGluZy5nZW5lcmF0ZWRMaW5lID09PSBuZXh0TWFwcGluZy5nZW5lcmF0ZWRMaW5lKSB7XG4gICAgICAgICAgbWFwcGluZy5sYXN0R2VuZXJhdGVkQ29sdW1uID0gbmV4dE1hcHBpbmcuZ2VuZXJhdGVkQ29sdW1uIC0gMTtcbiAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICAvLyBUaGUgbGFzdCBtYXBwaW5nIGZvciBlYWNoIGxpbmUgc3BhbnMgdGhlIGVudGlyZSBsaW5lLlxuICAgICAgbWFwcGluZy5sYXN0R2VuZXJhdGVkQ29sdW1uID0gSW5maW5pdHk7XG4gICAgfVxuICB9O1xuXG4vKipcbiAqIFJldHVybnMgdGhlIG9yaWdpbmFsIHNvdXJjZSwgbGluZSwgYW5kIGNvbHVtbiBpbmZvcm1hdGlvbiBmb3IgdGhlIGdlbmVyYXRlZFxuICogc291cmNlJ3MgbGluZSBhbmQgY29sdW1uIHBvc2l0aW9ucyBwcm92aWRlZC4gVGhlIG9ubHkgYXJndW1lbnQgaXMgYW4gb2JqZWN0XG4gKiB3aXRoIHRoZSBmb2xsb3dpbmcgcHJvcGVydGllczpcbiAqXG4gKiAgIC0gbGluZTogVGhlIGxpbmUgbnVtYmVyIGluIHRoZSBnZW5lcmF0ZWQgc291cmNlLlxuICogICAtIGNvbHVtbjogVGhlIGNvbHVtbiBudW1iZXIgaW4gdGhlIGdlbmVyYXRlZCBzb3VyY2UuXG4gKiAgIC0gYmlhczogRWl0aGVyICdTb3VyY2VNYXBDb25zdW1lci5HUkVBVEVTVF9MT1dFUl9CT1VORCcgb3JcbiAqICAgICAnU291cmNlTWFwQ29uc3VtZXIuTEVBU1RfVVBQRVJfQk9VTkQnLiBTcGVjaWZpZXMgd2hldGhlciB0byByZXR1cm4gdGhlXG4gKiAgICAgY2xvc2VzdCBlbGVtZW50IHRoYXQgaXMgc21hbGxlciB0aGFuIG9yIGdyZWF0ZXIgdGhhbiB0aGUgb25lIHdlIGFyZVxuICogICAgIHNlYXJjaGluZyBmb3IsIHJlc3BlY3RpdmVseSwgaWYgdGhlIGV4YWN0IGVsZW1lbnQgY2Fubm90IGJlIGZvdW5kLlxuICogICAgIERlZmF1bHRzIHRvICdTb3VyY2VNYXBDb25zdW1lci5HUkVBVEVTVF9MT1dFUl9CT1VORCcuXG4gKlxuICogYW5kIGFuIG9iamVjdCBpcyByZXR1cm5lZCB3aXRoIHRoZSBmb2xsb3dpbmcgcHJvcGVydGllczpcbiAqXG4gKiAgIC0gc291cmNlOiBUaGUgb3JpZ2luYWwgc291cmNlIGZpbGUsIG9yIG51bGwuXG4gKiAgIC0gbGluZTogVGhlIGxpbmUgbnVtYmVyIGluIHRoZSBvcmlnaW5hbCBzb3VyY2UsIG9yIG51bGwuXG4gKiAgIC0gY29sdW1uOiBUaGUgY29sdW1uIG51bWJlciBpbiB0aGUgb3JpZ2luYWwgc291cmNlLCBvciBudWxsLlxuICogICAtIG5hbWU6IFRoZSBvcmlnaW5hbCBpZGVudGlmaWVyLCBvciBudWxsLlxuICovXG5CYXNpY1NvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5vcmlnaW5hbFBvc2l0aW9uRm9yID1cbiAgZnVuY3Rpb24gU291cmNlTWFwQ29uc3VtZXJfb3JpZ2luYWxQb3NpdGlvbkZvcihhQXJncykge1xuICAgIHZhciBuZWVkbGUgPSB7XG4gICAgICBnZW5lcmF0ZWRMaW5lOiB1dGlsLmdldEFyZyhhQXJncywgJ2xpbmUnKSxcbiAgICAgIGdlbmVyYXRlZENvbHVtbjogdXRpbC5nZXRBcmcoYUFyZ3MsICdjb2x1bW4nKVxuICAgIH07XG5cbiAgICB2YXIgaW5kZXggPSB0aGlzLl9maW5kTWFwcGluZyhcbiAgICAgIG5lZWRsZSxcbiAgICAgIHRoaXMuX2dlbmVyYXRlZE1hcHBpbmdzLFxuICAgICAgXCJnZW5lcmF0ZWRMaW5lXCIsXG4gICAgICBcImdlbmVyYXRlZENvbHVtblwiLFxuICAgICAgdXRpbC5jb21wYXJlQnlHZW5lcmF0ZWRQb3NpdGlvbnNEZWZsYXRlZCxcbiAgICAgIHV0aWwuZ2V0QXJnKGFBcmdzLCAnYmlhcycsIFNvdXJjZU1hcENvbnN1bWVyLkdSRUFURVNUX0xPV0VSX0JPVU5EKVxuICAgICk7XG5cbiAgICBpZiAoaW5kZXggPj0gMCkge1xuICAgICAgdmFyIG1hcHBpbmcgPSB0aGlzLl9nZW5lcmF0ZWRNYXBwaW5nc1tpbmRleF07XG5cbiAgICAgIGlmIChtYXBwaW5nLmdlbmVyYXRlZExpbmUgPT09IG5lZWRsZS5nZW5lcmF0ZWRMaW5lKSB7XG4gICAgICAgIHZhciBzb3VyY2UgPSB1dGlsLmdldEFyZyhtYXBwaW5nLCAnc291cmNlJywgbnVsbCk7XG4gICAgICAgIGlmIChzb3VyY2UgIT09IG51bGwpIHtcbiAgICAgICAgICBzb3VyY2UgPSB0aGlzLl9zb3VyY2VzLmF0KHNvdXJjZSk7XG4gICAgICAgICAgaWYgKHRoaXMuc291cmNlUm9vdCAhPSBudWxsKSB7XG4gICAgICAgICAgICBzb3VyY2UgPSB1dGlsLmpvaW4odGhpcy5zb3VyY2VSb290LCBzb3VyY2UpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB2YXIgbmFtZSA9IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICduYW1lJywgbnVsbCk7XG4gICAgICAgIGlmIChuYW1lICE9PSBudWxsKSB7XG4gICAgICAgICAgbmFtZSA9IHRoaXMuX25hbWVzLmF0KG5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgc291cmNlOiBzb3VyY2UsXG4gICAgICAgICAgbGluZTogdXRpbC5nZXRBcmcobWFwcGluZywgJ29yaWdpbmFsTGluZScsIG51bGwpLFxuICAgICAgICAgIGNvbHVtbjogdXRpbC5nZXRBcmcobWFwcGluZywgJ29yaWdpbmFsQ29sdW1uJywgbnVsbCksXG4gICAgICAgICAgbmFtZTogbmFtZVxuICAgICAgICB9O1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiB7XG4gICAgICBzb3VyY2U6IG51bGwsXG4gICAgICBsaW5lOiBudWxsLFxuICAgICAgY29sdW1uOiBudWxsLFxuICAgICAgbmFtZTogbnVsbFxuICAgIH07XG4gIH07XG5cbi8qKlxuICogUmV0dXJuIHRydWUgaWYgd2UgaGF2ZSB0aGUgc291cmNlIGNvbnRlbnQgZm9yIGV2ZXJ5IHNvdXJjZSBpbiB0aGUgc291cmNlXG4gKiBtYXAsIGZhbHNlIG90aGVyd2lzZS5cbiAqL1xuQmFzaWNTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuaGFzQ29udGVudHNPZkFsbFNvdXJjZXMgPVxuICBmdW5jdGlvbiBCYXNpY1NvdXJjZU1hcENvbnN1bWVyX2hhc0NvbnRlbnRzT2ZBbGxTb3VyY2VzKCkge1xuICAgIGlmICghdGhpcy5zb3VyY2VzQ29udGVudCkge1xuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cbiAgICByZXR1cm4gdGhpcy5zb3VyY2VzQ29udGVudC5sZW5ndGggPj0gdGhpcy5fc291cmNlcy5zaXplKCkgJiZcbiAgICAgICF0aGlzLnNvdXJjZXNDb250ZW50LnNvbWUoZnVuY3Rpb24gKHNjKSB7IHJldHVybiBzYyA9PSBudWxsOyB9KTtcbiAgfTtcblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBvcmlnaW5hbCBzb3VyY2UgY29udGVudC4gVGhlIG9ubHkgYXJndW1lbnQgaXMgdGhlIHVybCBvZiB0aGVcbiAqIG9yaWdpbmFsIHNvdXJjZSBmaWxlLiBSZXR1cm5zIG51bGwgaWYgbm8gb3JpZ2luYWwgc291cmNlIGNvbnRlbnQgaXNcbiAqIGF2YWlsYWJsZS5cbiAqL1xuQmFzaWNTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuc291cmNlQ29udGVudEZvciA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcENvbnN1bWVyX3NvdXJjZUNvbnRlbnRGb3IoYVNvdXJjZSwgbnVsbE9uTWlzc2luZykge1xuICAgIGlmICghdGhpcy5zb3VyY2VzQ29udGVudCkge1xuICAgICAgcmV0dXJuIG51bGw7XG4gICAgfVxuXG4gICAgaWYgKHRoaXMuc291cmNlUm9vdCAhPSBudWxsKSB7XG4gICAgICBhU291cmNlID0gdXRpbC5yZWxhdGl2ZSh0aGlzLnNvdXJjZVJvb3QsIGFTb3VyY2UpO1xuICAgIH1cblxuICAgIGlmICh0aGlzLl9zb3VyY2VzLmhhcyhhU291cmNlKSkge1xuICAgICAgcmV0dXJuIHRoaXMuc291cmNlc0NvbnRlbnRbdGhpcy5fc291cmNlcy5pbmRleE9mKGFTb3VyY2UpXTtcbiAgICB9XG5cbiAgICB2YXIgdXJsO1xuICAgIGlmICh0aGlzLnNvdXJjZVJvb3QgIT0gbnVsbFxuICAgICAgICAmJiAodXJsID0gdXRpbC51cmxQYXJzZSh0aGlzLnNvdXJjZVJvb3QpKSkge1xuICAgICAgLy8gWFhYOiBmaWxlOi8vIFVSSXMgYW5kIGFic29sdXRlIHBhdGhzIGxlYWQgdG8gdW5leHBlY3RlZCBiZWhhdmlvciBmb3JcbiAgICAgIC8vIG1hbnkgdXNlcnMuIFdlIGNhbiBoZWxwIHRoZW0gb3V0IHdoZW4gdGhleSBleHBlY3QgZmlsZTovLyBVUklzIHRvXG4gICAgICAvLyBiZWhhdmUgbGlrZSBpdCB3b3VsZCBpZiB0aGV5IHdlcmUgcnVubmluZyBhIGxvY2FsIEhUVFAgc2VydmVyLiBTZWVcbiAgICAgIC8vIGh0dHBzOi8vYnVnemlsbGEubW96aWxsYS5vcmcvc2hvd19idWcuY2dpP2lkPTg4NTU5Ny5cbiAgICAgIHZhciBmaWxlVXJpQWJzUGF0aCA9IGFTb3VyY2UucmVwbGFjZSgvXmZpbGU6XFwvXFwvLywgXCJcIik7XG4gICAgICBpZiAodXJsLnNjaGVtZSA9PSBcImZpbGVcIlxuICAgICAgICAgICYmIHRoaXMuX3NvdXJjZXMuaGFzKGZpbGVVcmlBYnNQYXRoKSkge1xuICAgICAgICByZXR1cm4gdGhpcy5zb3VyY2VzQ29udGVudFt0aGlzLl9zb3VyY2VzLmluZGV4T2YoZmlsZVVyaUFic1BhdGgpXVxuICAgICAgfVxuXG4gICAgICBpZiAoKCF1cmwucGF0aCB8fCB1cmwucGF0aCA9PSBcIi9cIilcbiAgICAgICAgICAmJiB0aGlzLl9zb3VyY2VzLmhhcyhcIi9cIiArIGFTb3VyY2UpKSB7XG4gICAgICAgIHJldHVybiB0aGlzLnNvdXJjZXNDb250ZW50W3RoaXMuX3NvdXJjZXMuaW5kZXhPZihcIi9cIiArIGFTb3VyY2UpXTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICAvLyBUaGlzIGZ1bmN0aW9uIGlzIHVzZWQgcmVjdXJzaXZlbHkgZnJvbVxuICAgIC8vIEluZGV4ZWRTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuc291cmNlQ29udGVudEZvci4gSW4gdGhhdCBjYXNlLCB3ZVxuICAgIC8vIGRvbid0IHdhbnQgdG8gdGhyb3cgaWYgd2UgY2FuJ3QgZmluZCB0aGUgc291cmNlIC0gd2UganVzdCB3YW50IHRvXG4gICAgLy8gcmV0dXJuIG51bGwsIHNvIHdlIHByb3ZpZGUgYSBmbGFnIHRvIGV4aXQgZ3JhY2VmdWxseS5cbiAgICBpZiAobnVsbE9uTWlzc2luZykge1xuICAgICAgcmV0dXJuIG51bGw7XG4gICAgfVxuICAgIGVsc2Uge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKCdcIicgKyBhU291cmNlICsgJ1wiIGlzIG5vdCBpbiB0aGUgU291cmNlTWFwLicpO1xuICAgIH1cbiAgfTtcblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBnZW5lcmF0ZWQgbGluZSBhbmQgY29sdW1uIGluZm9ybWF0aW9uIGZvciB0aGUgb3JpZ2luYWwgc291cmNlLFxuICogbGluZSwgYW5kIGNvbHVtbiBwb3NpdGlvbnMgcHJvdmlkZWQuIFRoZSBvbmx5IGFyZ3VtZW50IGlzIGFuIG9iamVjdCB3aXRoXG4gKiB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIHNvdXJjZTogVGhlIGZpbGVuYW1lIG9mIHRoZSBvcmlnaW5hbCBzb3VyY2UuXG4gKiAgIC0gbGluZTogVGhlIGxpbmUgbnVtYmVyIGluIHRoZSBvcmlnaW5hbCBzb3VyY2UuXG4gKiAgIC0gY29sdW1uOiBUaGUgY29sdW1uIG51bWJlciBpbiB0aGUgb3JpZ2luYWwgc291cmNlLlxuICogICAtIGJpYXM6IEVpdGhlciAnU291cmNlTWFwQ29uc3VtZXIuR1JFQVRFU1RfTE9XRVJfQk9VTkQnIG9yXG4gKiAgICAgJ1NvdXJjZU1hcENvbnN1bWVyLkxFQVNUX1VQUEVSX0JPVU5EJy4gU3BlY2lmaWVzIHdoZXRoZXIgdG8gcmV0dXJuIHRoZVxuICogICAgIGNsb3Nlc3QgZWxlbWVudCB0aGF0IGlzIHNtYWxsZXIgdGhhbiBvciBncmVhdGVyIHRoYW4gdGhlIG9uZSB3ZSBhcmVcbiAqICAgICBzZWFyY2hpbmcgZm9yLCByZXNwZWN0aXZlbHksIGlmIHRoZSBleGFjdCBlbGVtZW50IGNhbm5vdCBiZSBmb3VuZC5cbiAqICAgICBEZWZhdWx0cyB0byAnU291cmNlTWFwQ29uc3VtZXIuR1JFQVRFU1RfTE9XRVJfQk9VTkQnLlxuICpcbiAqIGFuZCBhbiBvYmplY3QgaXMgcmV0dXJuZWQgd2l0aCB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIGxpbmU6IFRoZSBsaW5lIG51bWJlciBpbiB0aGUgZ2VuZXJhdGVkIHNvdXJjZSwgb3IgbnVsbC5cbiAqICAgLSBjb2x1bW46IFRoZSBjb2x1bW4gbnVtYmVyIGluIHRoZSBnZW5lcmF0ZWQgc291cmNlLCBvciBudWxsLlxuICovXG5CYXNpY1NvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5nZW5lcmF0ZWRQb3NpdGlvbkZvciA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcENvbnN1bWVyX2dlbmVyYXRlZFBvc2l0aW9uRm9yKGFBcmdzKSB7XG4gICAgdmFyIHNvdXJjZSA9IHV0aWwuZ2V0QXJnKGFBcmdzLCAnc291cmNlJyk7XG4gICAgaWYgKHRoaXMuc291cmNlUm9vdCAhPSBudWxsKSB7XG4gICAgICBzb3VyY2UgPSB1dGlsLnJlbGF0aXZlKHRoaXMuc291cmNlUm9vdCwgc291cmNlKTtcbiAgICB9XG4gICAgaWYgKCF0aGlzLl9zb3VyY2VzLmhhcyhzb3VyY2UpKSB7XG4gICAgICByZXR1cm4ge1xuICAgICAgICBsaW5lOiBudWxsLFxuICAgICAgICBjb2x1bW46IG51bGwsXG4gICAgICAgIGxhc3RDb2x1bW46IG51bGxcbiAgICAgIH07XG4gICAgfVxuICAgIHNvdXJjZSA9IHRoaXMuX3NvdXJjZXMuaW5kZXhPZihzb3VyY2UpO1xuXG4gICAgdmFyIG5lZWRsZSA9IHtcbiAgICAgIHNvdXJjZTogc291cmNlLFxuICAgICAgb3JpZ2luYWxMaW5lOiB1dGlsLmdldEFyZyhhQXJncywgJ2xpbmUnKSxcbiAgICAgIG9yaWdpbmFsQ29sdW1uOiB1dGlsLmdldEFyZyhhQXJncywgJ2NvbHVtbicpXG4gICAgfTtcblxuICAgIHZhciBpbmRleCA9IHRoaXMuX2ZpbmRNYXBwaW5nKFxuICAgICAgbmVlZGxlLFxuICAgICAgdGhpcy5fb3JpZ2luYWxNYXBwaW5ncyxcbiAgICAgIFwib3JpZ2luYWxMaW5lXCIsXG4gICAgICBcIm9yaWdpbmFsQ29sdW1uXCIsXG4gICAgICB1dGlsLmNvbXBhcmVCeU9yaWdpbmFsUG9zaXRpb25zLFxuICAgICAgdXRpbC5nZXRBcmcoYUFyZ3MsICdiaWFzJywgU291cmNlTWFwQ29uc3VtZXIuR1JFQVRFU1RfTE9XRVJfQk9VTkQpXG4gICAgKTtcblxuICAgIGlmIChpbmRleCA+PSAwKSB7XG4gICAgICB2YXIgbWFwcGluZyA9IHRoaXMuX29yaWdpbmFsTWFwcGluZ3NbaW5kZXhdO1xuXG4gICAgICBpZiAobWFwcGluZy5zb3VyY2UgPT09IG5lZWRsZS5zb3VyY2UpIHtcbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICBsaW5lOiB1dGlsLmdldEFyZyhtYXBwaW5nLCAnZ2VuZXJhdGVkTGluZScsIG51bGwpLFxuICAgICAgICAgIGNvbHVtbjogdXRpbC5nZXRBcmcobWFwcGluZywgJ2dlbmVyYXRlZENvbHVtbicsIG51bGwpLFxuICAgICAgICAgIGxhc3RDb2x1bW46IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdsYXN0R2VuZXJhdGVkQ29sdW1uJywgbnVsbClcbiAgICAgICAgfTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4ge1xuICAgICAgbGluZTogbnVsbCxcbiAgICAgIGNvbHVtbjogbnVsbCxcbiAgICAgIGxhc3RDb2x1bW46IG51bGxcbiAgICB9O1xuICB9O1xuXG5leHBvcnRzLkJhc2ljU291cmNlTWFwQ29uc3VtZXIgPSBCYXNpY1NvdXJjZU1hcENvbnN1bWVyO1xuXG4vKipcbiAqIEFuIEluZGV4ZWRTb3VyY2VNYXBDb25zdW1lciBpbnN0YW5jZSByZXByZXNlbnRzIGEgcGFyc2VkIHNvdXJjZSBtYXAgd2hpY2hcbiAqIHdlIGNhbiBxdWVyeSBmb3IgaW5mb3JtYXRpb24uIEl0IGRpZmZlcnMgZnJvbSBCYXNpY1NvdXJjZU1hcENvbnN1bWVyIGluXG4gKiB0aGF0IGl0IHRha2VzIFwiaW5kZXhlZFwiIHNvdXJjZSBtYXBzIChpLmUuIG9uZXMgd2l0aCBhIFwic2VjdGlvbnNcIiBmaWVsZCkgYXNcbiAqIGlucHV0LlxuICpcbiAqIFRoZSBvbmx5IHBhcmFtZXRlciBpcyBhIHJhdyBzb3VyY2UgbWFwIChlaXRoZXIgYXMgYSBKU09OIHN0cmluZywgb3IgYWxyZWFkeVxuICogcGFyc2VkIHRvIGFuIG9iamVjdCkuIEFjY29yZGluZyB0byB0aGUgc3BlYyBmb3IgaW5kZXhlZCBzb3VyY2UgbWFwcywgdGhleVxuICogaGF2ZSB0aGUgZm9sbG93aW5nIGF0dHJpYnV0ZXM6XG4gKlxuICogICAtIHZlcnNpb246IFdoaWNoIHZlcnNpb24gb2YgdGhlIHNvdXJjZSBtYXAgc3BlYyB0aGlzIG1hcCBpcyBmb2xsb3dpbmcuXG4gKiAgIC0gZmlsZTogT3B0aW9uYWwuIFRoZSBnZW5lcmF0ZWQgZmlsZSB0aGlzIHNvdXJjZSBtYXAgaXMgYXNzb2NpYXRlZCB3aXRoLlxuICogICAtIHNlY3Rpb25zOiBBIGxpc3Qgb2Ygc2VjdGlvbiBkZWZpbml0aW9ucy5cbiAqXG4gKiBFYWNoIHZhbHVlIHVuZGVyIHRoZSBcInNlY3Rpb25zXCIgZmllbGQgaGFzIHR3byBmaWVsZHM6XG4gKiAgIC0gb2Zmc2V0OiBUaGUgb2Zmc2V0IGludG8gdGhlIG9yaWdpbmFsIHNwZWNpZmllZCBhdCB3aGljaCB0aGlzIHNlY3Rpb25cbiAqICAgICAgIGJlZ2lucyB0byBhcHBseSwgZGVmaW5lZCBhcyBhbiBvYmplY3Qgd2l0aCBhIFwibGluZVwiIGFuZCBcImNvbHVtblwiXG4gKiAgICAgICBmaWVsZC5cbiAqICAgLSBtYXA6IEEgc291cmNlIG1hcCBkZWZpbml0aW9uLiBUaGlzIHNvdXJjZSBtYXAgY291bGQgYWxzbyBiZSBpbmRleGVkLFxuICogICAgICAgYnV0IGRvZXNuJ3QgaGF2ZSB0byBiZS5cbiAqXG4gKiBJbnN0ZWFkIG9mIHRoZSBcIm1hcFwiIGZpZWxkLCBpdCdzIGFsc28gcG9zc2libGUgdG8gaGF2ZSBhIFwidXJsXCIgZmllbGRcbiAqIHNwZWNpZnlpbmcgYSBVUkwgdG8gcmV0cmlldmUgYSBzb3VyY2UgbWFwIGZyb20sIGJ1dCB0aGF0J3MgY3VycmVudGx5XG4gKiB1bnN1cHBvcnRlZC5cbiAqXG4gKiBIZXJlJ3MgYW4gZXhhbXBsZSBzb3VyY2UgbWFwLCB0YWtlbiBmcm9tIHRoZSBzb3VyY2UgbWFwIHNwZWNbMF0sIGJ1dFxuICogbW9kaWZpZWQgdG8gb21pdCBhIHNlY3Rpb24gd2hpY2ggdXNlcyB0aGUgXCJ1cmxcIiBmaWVsZC5cbiAqXG4gKiAge1xuICogICAgdmVyc2lvbiA6IDMsXG4gKiAgICBmaWxlOiBcImFwcC5qc1wiLFxuICogICAgc2VjdGlvbnM6IFt7XG4gKiAgICAgIG9mZnNldDoge2xpbmU6MTAwLCBjb2x1bW46MTB9LFxuICogICAgICBtYXA6IHtcbiAqICAgICAgICB2ZXJzaW9uIDogMyxcbiAqICAgICAgICBmaWxlOiBcInNlY3Rpb24uanNcIixcbiAqICAgICAgICBzb3VyY2VzOiBbXCJmb28uanNcIiwgXCJiYXIuanNcIl0sXG4gKiAgICAgICAgbmFtZXM6IFtcInNyY1wiLCBcIm1hcHNcIiwgXCJhcmVcIiwgXCJmdW5cIl0sXG4gKiAgICAgICAgbWFwcGluZ3M6IFwiQUFBQSxFOztBQkNERTtcIlxuICogICAgICB9XG4gKiAgICB9XSxcbiAqICB9XG4gKlxuICogWzBdOiBodHRwczovL2RvY3MuZ29vZ2xlLmNvbS9kb2N1bWVudC9kLzFVMVJHQWVoUXdSeXBVVG92RjFLUmxwaU9GemUwYi1fMmdjNmZBSDBLWTBrL2VkaXQjaGVhZGluZz1oLjUzNWVzM3hlcHJndFxuICovXG5mdW5jdGlvbiBJbmRleGVkU291cmNlTWFwQ29uc3VtZXIoYVNvdXJjZU1hcCkge1xuICB2YXIgc291cmNlTWFwID0gYVNvdXJjZU1hcDtcbiAgaWYgKHR5cGVvZiBhU291cmNlTWFwID09PSAnc3RyaW5nJykge1xuICAgIHNvdXJjZU1hcCA9IEpTT04ucGFyc2UoYVNvdXJjZU1hcC5yZXBsYWNlKC9eXFwpXFxdXFx9Jy8sICcnKSk7XG4gIH1cblxuICB2YXIgdmVyc2lvbiA9IHV0aWwuZ2V0QXJnKHNvdXJjZU1hcCwgJ3ZlcnNpb24nKTtcbiAgdmFyIHNlY3Rpb25zID0gdXRpbC5nZXRBcmcoc291cmNlTWFwLCAnc2VjdGlvbnMnKTtcblxuICBpZiAodmVyc2lvbiAhPSB0aGlzLl92ZXJzaW9uKSB7XG4gICAgdGhyb3cgbmV3IEVycm9yKCdVbnN1cHBvcnRlZCB2ZXJzaW9uOiAnICsgdmVyc2lvbik7XG4gIH1cblxuICB0aGlzLl9zb3VyY2VzID0gbmV3IEFycmF5U2V0KCk7XG4gIHRoaXMuX25hbWVzID0gbmV3IEFycmF5U2V0KCk7XG5cbiAgdmFyIGxhc3RPZmZzZXQgPSB7XG4gICAgbGluZTogLTEsXG4gICAgY29sdW1uOiAwXG4gIH07XG4gIHRoaXMuX3NlY3Rpb25zID0gc2VjdGlvbnMubWFwKGZ1bmN0aW9uIChzKSB7XG4gICAgaWYgKHMudXJsKSB7XG4gICAgICAvLyBUaGUgdXJsIGZpZWxkIHdpbGwgcmVxdWlyZSBzdXBwb3J0IGZvciBhc3luY2hyb25pY2l0eS5cbiAgICAgIC8vIFNlZSBodHRwczovL2dpdGh1Yi5jb20vbW96aWxsYS9zb3VyY2UtbWFwL2lzc3Vlcy8xNlxuICAgICAgdGhyb3cgbmV3IEVycm9yKCdTdXBwb3J0IGZvciB1cmwgZmllbGQgaW4gc2VjdGlvbnMgbm90IGltcGxlbWVudGVkLicpO1xuICAgIH1cbiAgICB2YXIgb2Zmc2V0ID0gdXRpbC5nZXRBcmcocywgJ29mZnNldCcpO1xuICAgIHZhciBvZmZzZXRMaW5lID0gdXRpbC5nZXRBcmcob2Zmc2V0LCAnbGluZScpO1xuICAgIHZhciBvZmZzZXRDb2x1bW4gPSB1dGlsLmdldEFyZyhvZmZzZXQsICdjb2x1bW4nKTtcblxuICAgIGlmIChvZmZzZXRMaW5lIDwgbGFzdE9mZnNldC5saW5lIHx8XG4gICAgICAgIChvZmZzZXRMaW5lID09PSBsYXN0T2Zmc2V0LmxpbmUgJiYgb2Zmc2V0Q29sdW1uIDwgbGFzdE9mZnNldC5jb2x1bW4pKSB7XG4gICAgICB0aHJvdyBuZXcgRXJyb3IoJ1NlY3Rpb24gb2Zmc2V0cyBtdXN0IGJlIG9yZGVyZWQgYW5kIG5vbi1vdmVybGFwcGluZy4nKTtcbiAgICB9XG4gICAgbGFzdE9mZnNldCA9IG9mZnNldDtcblxuICAgIHJldHVybiB7XG4gICAgICBnZW5lcmF0ZWRPZmZzZXQ6IHtcbiAgICAgICAgLy8gVGhlIG9mZnNldCBmaWVsZHMgYXJlIDAtYmFzZWQsIGJ1dCB3ZSB1c2UgMS1iYXNlZCBpbmRpY2VzIHdoZW5cbiAgICAgICAgLy8gZW5jb2RpbmcvZGVjb2RpbmcgZnJvbSBWTFEuXG4gICAgICAgIGdlbmVyYXRlZExpbmU6IG9mZnNldExpbmUgKyAxLFxuICAgICAgICBnZW5lcmF0ZWRDb2x1bW46IG9mZnNldENvbHVtbiArIDFcbiAgICAgIH0sXG4gICAgICBjb25zdW1lcjogbmV3IFNvdXJjZU1hcENvbnN1bWVyKHV0aWwuZ2V0QXJnKHMsICdtYXAnKSlcbiAgICB9XG4gIH0pO1xufVxuXG5JbmRleGVkU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUpO1xuSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5jb25zdHJ1Y3RvciA9IFNvdXJjZU1hcENvbnN1bWVyO1xuXG4vKipcbiAqIFRoZSB2ZXJzaW9uIG9mIHRoZSBzb3VyY2UgbWFwcGluZyBzcGVjIHRoYXQgd2UgYXJlIGNvbnN1bWluZy5cbiAqL1xuSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5fdmVyc2lvbiA9IDM7XG5cbi8qKlxuICogVGhlIGxpc3Qgb2Ygb3JpZ2luYWwgc291cmNlcy5cbiAqL1xuT2JqZWN0LmRlZmluZVByb3BlcnR5KEluZGV4ZWRTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUsICdzb3VyY2VzJywge1xuICBnZXQ6IGZ1bmN0aW9uICgpIHtcbiAgICB2YXIgc291cmNlcyA9IFtdO1xuICAgIGZvciAodmFyIGkgPSAwOyBpIDwgdGhpcy5fc2VjdGlvbnMubGVuZ3RoOyBpKyspIHtcbiAgICAgIGZvciAodmFyIGogPSAwOyBqIDwgdGhpcy5fc2VjdGlvbnNbaV0uY29uc3VtZXIuc291cmNlcy5sZW5ndGg7IGorKykge1xuICAgICAgICBzb3VyY2VzLnB1c2godGhpcy5fc2VjdGlvbnNbaV0uY29uc3VtZXIuc291cmNlc1tqXSk7XG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiBzb3VyY2VzO1xuICB9XG59KTtcblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBvcmlnaW5hbCBzb3VyY2UsIGxpbmUsIGFuZCBjb2x1bW4gaW5mb3JtYXRpb24gZm9yIHRoZSBnZW5lcmF0ZWRcbiAqIHNvdXJjZSdzIGxpbmUgYW5kIGNvbHVtbiBwb3NpdGlvbnMgcHJvdmlkZWQuIFRoZSBvbmx5IGFyZ3VtZW50IGlzIGFuIG9iamVjdFxuICogd2l0aCB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIGxpbmU6IFRoZSBsaW5lIG51bWJlciBpbiB0aGUgZ2VuZXJhdGVkIHNvdXJjZS5cbiAqICAgLSBjb2x1bW46IFRoZSBjb2x1bW4gbnVtYmVyIGluIHRoZSBnZW5lcmF0ZWQgc291cmNlLlxuICpcbiAqIGFuZCBhbiBvYmplY3QgaXMgcmV0dXJuZWQgd2l0aCB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIHNvdXJjZTogVGhlIG9yaWdpbmFsIHNvdXJjZSBmaWxlLCBvciBudWxsLlxuICogICAtIGxpbmU6IFRoZSBsaW5lIG51bWJlciBpbiB0aGUgb3JpZ2luYWwgc291cmNlLCBvciBudWxsLlxuICogICAtIGNvbHVtbjogVGhlIGNvbHVtbiBudW1iZXIgaW4gdGhlIG9yaWdpbmFsIHNvdXJjZSwgb3IgbnVsbC5cbiAqICAgLSBuYW1lOiBUaGUgb3JpZ2luYWwgaWRlbnRpZmllciwgb3IgbnVsbC5cbiAqL1xuSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5vcmlnaW5hbFBvc2l0aW9uRm9yID1cbiAgZnVuY3Rpb24gSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyX29yaWdpbmFsUG9zaXRpb25Gb3IoYUFyZ3MpIHtcbiAgICB2YXIgbmVlZGxlID0ge1xuICAgICAgZ2VuZXJhdGVkTGluZTogdXRpbC5nZXRBcmcoYUFyZ3MsICdsaW5lJyksXG4gICAgICBnZW5lcmF0ZWRDb2x1bW46IHV0aWwuZ2V0QXJnKGFBcmdzLCAnY29sdW1uJylcbiAgICB9O1xuXG4gICAgLy8gRmluZCB0aGUgc2VjdGlvbiBjb250YWluaW5nIHRoZSBnZW5lcmF0ZWQgcG9zaXRpb24gd2UncmUgdHJ5aW5nIHRvIG1hcFxuICAgIC8vIHRvIGFuIG9yaWdpbmFsIHBvc2l0aW9uLlxuICAgIHZhciBzZWN0aW9uSW5kZXggPSBiaW5hcnlTZWFyY2guc2VhcmNoKG5lZWRsZSwgdGhpcy5fc2VjdGlvbnMsXG4gICAgICBmdW5jdGlvbihuZWVkbGUsIHNlY3Rpb24pIHtcbiAgICAgICAgdmFyIGNtcCA9IG5lZWRsZS5nZW5lcmF0ZWRMaW5lIC0gc2VjdGlvbi5nZW5lcmF0ZWRPZmZzZXQuZ2VuZXJhdGVkTGluZTtcbiAgICAgICAgaWYgKGNtcCkge1xuICAgICAgICAgIHJldHVybiBjbXA7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gKG5lZWRsZS5nZW5lcmF0ZWRDb2x1bW4gLVxuICAgICAgICAgICAgICAgIHNlY3Rpb24uZ2VuZXJhdGVkT2Zmc2V0LmdlbmVyYXRlZENvbHVtbik7XG4gICAgICB9KTtcbiAgICB2YXIgc2VjdGlvbiA9IHRoaXMuX3NlY3Rpb25zW3NlY3Rpb25JbmRleF07XG5cbiAgICBpZiAoIXNlY3Rpb24pIHtcbiAgICAgIHJldHVybiB7XG4gICAgICAgIHNvdXJjZTogbnVsbCxcbiAgICAgICAgbGluZTogbnVsbCxcbiAgICAgICAgY29sdW1uOiBudWxsLFxuICAgICAgICBuYW1lOiBudWxsXG4gICAgICB9O1xuICAgIH1cblxuICAgIHJldHVybiBzZWN0aW9uLmNvbnN1bWVyLm9yaWdpbmFsUG9zaXRpb25Gb3Ioe1xuICAgICAgbGluZTogbmVlZGxlLmdlbmVyYXRlZExpbmUgLVxuICAgICAgICAoc2VjdGlvbi5nZW5lcmF0ZWRPZmZzZXQuZ2VuZXJhdGVkTGluZSAtIDEpLFxuICAgICAgY29sdW1uOiBuZWVkbGUuZ2VuZXJhdGVkQ29sdW1uIC1cbiAgICAgICAgKHNlY3Rpb24uZ2VuZXJhdGVkT2Zmc2V0LmdlbmVyYXRlZExpbmUgPT09IG5lZWRsZS5nZW5lcmF0ZWRMaW5lXG4gICAgICAgICA/IHNlY3Rpb24uZ2VuZXJhdGVkT2Zmc2V0LmdlbmVyYXRlZENvbHVtbiAtIDFcbiAgICAgICAgIDogMCksXG4gICAgICBiaWFzOiBhQXJncy5iaWFzXG4gICAgfSk7XG4gIH07XG5cbi8qKlxuICogUmV0dXJuIHRydWUgaWYgd2UgaGF2ZSB0aGUgc291cmNlIGNvbnRlbnQgZm9yIGV2ZXJ5IHNvdXJjZSBpbiB0aGUgc291cmNlXG4gKiBtYXAsIGZhbHNlIG90aGVyd2lzZS5cbiAqL1xuSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5oYXNDb250ZW50c09mQWxsU291cmNlcyA9XG4gIGZ1bmN0aW9uIEluZGV4ZWRTb3VyY2VNYXBDb25zdW1lcl9oYXNDb250ZW50c09mQWxsU291cmNlcygpIHtcbiAgICByZXR1cm4gdGhpcy5fc2VjdGlvbnMuZXZlcnkoZnVuY3Rpb24gKHMpIHtcbiAgICAgIHJldHVybiBzLmNvbnN1bWVyLmhhc0NvbnRlbnRzT2ZBbGxTb3VyY2VzKCk7XG4gICAgfSk7XG4gIH07XG5cbi8qKlxuICogUmV0dXJucyB0aGUgb3JpZ2luYWwgc291cmNlIGNvbnRlbnQuIFRoZSBvbmx5IGFyZ3VtZW50IGlzIHRoZSB1cmwgb2YgdGhlXG4gKiBvcmlnaW5hbCBzb3VyY2UgZmlsZS4gUmV0dXJucyBudWxsIGlmIG5vIG9yaWdpbmFsIHNvdXJjZSBjb250ZW50IGlzXG4gKiBhdmFpbGFibGUuXG4gKi9cbkluZGV4ZWRTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuc291cmNlQ29udGVudEZvciA9XG4gIGZ1bmN0aW9uIEluZGV4ZWRTb3VyY2VNYXBDb25zdW1lcl9zb3VyY2VDb250ZW50Rm9yKGFTb3VyY2UsIG51bGxPbk1pc3NpbmcpIHtcbiAgICBmb3IgKHZhciBpID0gMDsgaSA8IHRoaXMuX3NlY3Rpb25zLmxlbmd0aDsgaSsrKSB7XG4gICAgICB2YXIgc2VjdGlvbiA9IHRoaXMuX3NlY3Rpb25zW2ldO1xuXG4gICAgICB2YXIgY29udGVudCA9IHNlY3Rpb24uY29uc3VtZXIuc291cmNlQ29udGVudEZvcihhU291cmNlLCB0cnVlKTtcbiAgICAgIGlmIChjb250ZW50KSB7XG4gICAgICAgIHJldHVybiBjb250ZW50O1xuICAgICAgfVxuICAgIH1cbiAgICBpZiAobnVsbE9uTWlzc2luZykge1xuICAgICAgcmV0dXJuIG51bGw7XG4gICAgfVxuICAgIGVsc2Uge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKCdcIicgKyBhU291cmNlICsgJ1wiIGlzIG5vdCBpbiB0aGUgU291cmNlTWFwLicpO1xuICAgIH1cbiAgfTtcblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBnZW5lcmF0ZWQgbGluZSBhbmQgY29sdW1uIGluZm9ybWF0aW9uIGZvciB0aGUgb3JpZ2luYWwgc291cmNlLFxuICogbGluZSwgYW5kIGNvbHVtbiBwb3NpdGlvbnMgcHJvdmlkZWQuIFRoZSBvbmx5IGFyZ3VtZW50IGlzIGFuIG9iamVjdCB3aXRoXG4gKiB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIHNvdXJjZTogVGhlIGZpbGVuYW1lIG9mIHRoZSBvcmlnaW5hbCBzb3VyY2UuXG4gKiAgIC0gbGluZTogVGhlIGxpbmUgbnVtYmVyIGluIHRoZSBvcmlnaW5hbCBzb3VyY2UuXG4gKiAgIC0gY29sdW1uOiBUaGUgY29sdW1uIG51bWJlciBpbiB0aGUgb3JpZ2luYWwgc291cmNlLlxuICpcbiAqIGFuZCBhbiBvYmplY3QgaXMgcmV0dXJuZWQgd2l0aCB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIGxpbmU6IFRoZSBsaW5lIG51bWJlciBpbiB0aGUgZ2VuZXJhdGVkIHNvdXJjZSwgb3IgbnVsbC5cbiAqICAgLSBjb2x1bW46IFRoZSBjb2x1bW4gbnVtYmVyIGluIHRoZSBnZW5lcmF0ZWQgc291cmNlLCBvciBudWxsLlxuICovXG5JbmRleGVkU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlLmdlbmVyYXRlZFBvc2l0aW9uRm9yID1cbiAgZnVuY3Rpb24gSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyX2dlbmVyYXRlZFBvc2l0aW9uRm9yKGFBcmdzKSB7XG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCB0aGlzLl9zZWN0aW9ucy5sZW5ndGg7IGkrKykge1xuICAgICAgdmFyIHNlY3Rpb24gPSB0aGlzLl9zZWN0aW9uc1tpXTtcblxuICAgICAgLy8gT25seSBjb25zaWRlciB0aGlzIHNlY3Rpb24gaWYgdGhlIHJlcXVlc3RlZCBzb3VyY2UgaXMgaW4gdGhlIGxpc3Qgb2ZcbiAgICAgIC8vIHNvdXJjZXMgb2YgdGhlIGNvbnN1bWVyLlxuICAgICAgaWYgKHNlY3Rpb24uY29uc3VtZXIuc291cmNlcy5pbmRleE9mKHV0aWwuZ2V0QXJnKGFBcmdzLCAnc291cmNlJykpID09PSAtMSkge1xuICAgICAgICBjb250aW51ZTtcbiAgICAgIH1cbiAgICAgIHZhciBnZW5lcmF0ZWRQb3NpdGlvbiA9IHNlY3Rpb24uY29uc3VtZXIuZ2VuZXJhdGVkUG9zaXRpb25Gb3IoYUFyZ3MpO1xuICAgICAgaWYgKGdlbmVyYXRlZFBvc2l0aW9uKSB7XG4gICAgICAgIHZhciByZXQgPSB7XG4gICAgICAgICAgbGluZTogZ2VuZXJhdGVkUG9zaXRpb24ubGluZSArXG4gICAgICAgICAgICAoc2VjdGlvbi5nZW5lcmF0ZWRPZmZzZXQuZ2VuZXJhdGVkTGluZSAtIDEpLFxuICAgICAgICAgIGNvbHVtbjogZ2VuZXJhdGVkUG9zaXRpb24uY29sdW1uICtcbiAgICAgICAgICAgIChzZWN0aW9uLmdlbmVyYXRlZE9mZnNldC5nZW5lcmF0ZWRMaW5lID09PSBnZW5lcmF0ZWRQb3NpdGlvbi5saW5lXG4gICAgICAgICAgICAgPyBzZWN0aW9uLmdlbmVyYXRlZE9mZnNldC5nZW5lcmF0ZWRDb2x1bW4gLSAxXG4gICAgICAgICAgICAgOiAwKVxuICAgICAgICB9O1xuICAgICAgICByZXR1cm4gcmV0O1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiB7XG4gICAgICBsaW5lOiBudWxsLFxuICAgICAgY29sdW1uOiBudWxsXG4gICAgfTtcbiAgfTtcblxuLyoqXG4gKiBQYXJzZSB0aGUgbWFwcGluZ3MgaW4gYSBzdHJpbmcgaW4gdG8gYSBkYXRhIHN0cnVjdHVyZSB3aGljaCB3ZSBjYW4gZWFzaWx5XG4gKiBxdWVyeSAodGhlIG9yZGVyZWQgYXJyYXlzIGluIHRoZSBgdGhpcy5fX2dlbmVyYXRlZE1hcHBpbmdzYCBhbmRcbiAqIGB0aGlzLl9fb3JpZ2luYWxNYXBwaW5nc2AgcHJvcGVydGllcykuXG4gKi9cbkluZGV4ZWRTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuX3BhcnNlTWFwcGluZ3MgPVxuICBmdW5jdGlvbiBJbmRleGVkU291cmNlTWFwQ29uc3VtZXJfcGFyc2VNYXBwaW5ncyhhU3RyLCBhU291cmNlUm9vdCkge1xuICAgIHRoaXMuX19nZW5lcmF0ZWRNYXBwaW5ncyA9IFtdO1xuICAgIHRoaXMuX19vcmlnaW5hbE1hcHBpbmdzID0gW107XG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCB0aGlzLl9zZWN0aW9ucy5sZW5ndGg7IGkrKykge1xuICAgICAgdmFyIHNlY3Rpb24gPSB0aGlzLl9zZWN0aW9uc1tpXTtcbiAgICAgIHZhciBzZWN0aW9uTWFwcGluZ3MgPSBzZWN0aW9uLmNvbnN1bWVyLl9nZW5lcmF0ZWRNYXBwaW5ncztcbiAgICAgIGZvciAodmFyIGogPSAwOyBqIDwgc2VjdGlvbk1hcHBpbmdzLmxlbmd0aDsgaisrKSB7XG4gICAgICAgIHZhciBtYXBwaW5nID0gc2VjdGlvbk1hcHBpbmdzW2pdO1xuXG4gICAgICAgIHZhciBzb3VyY2UgPSBzZWN0aW9uLmNvbnN1bWVyLl9zb3VyY2VzLmF0KG1hcHBpbmcuc291cmNlKTtcbiAgICAgICAgaWYgKHNlY3Rpb24uY29uc3VtZXIuc291cmNlUm9vdCAhPT0gbnVsbCkge1xuICAgICAgICAgIHNvdXJjZSA9IHV0aWwuam9pbihzZWN0aW9uLmNvbnN1bWVyLnNvdXJjZVJvb3QsIHNvdXJjZSk7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5fc291cmNlcy5hZGQoc291cmNlKTtcbiAgICAgICAgc291cmNlID0gdGhpcy5fc291cmNlcy5pbmRleE9mKHNvdXJjZSk7XG5cbiAgICAgICAgdmFyIG5hbWUgPSBzZWN0aW9uLmNvbnN1bWVyLl9uYW1lcy5hdChtYXBwaW5nLm5hbWUpO1xuICAgICAgICB0aGlzLl9uYW1lcy5hZGQobmFtZSk7XG4gICAgICAgIG5hbWUgPSB0aGlzLl9uYW1lcy5pbmRleE9mKG5hbWUpO1xuXG4gICAgICAgIC8vIFRoZSBtYXBwaW5ncyBjb21pbmcgZnJvbSB0aGUgY29uc3VtZXIgZm9yIHRoZSBzZWN0aW9uIGhhdmVcbiAgICAgICAgLy8gZ2VuZXJhdGVkIHBvc2l0aW9ucyByZWxhdGl2ZSB0byB0aGUgc3RhcnQgb2YgdGhlIHNlY3Rpb24sIHNvIHdlXG4gICAgICAgIC8vIG5lZWQgdG8gb2Zmc2V0IHRoZW0gdG8gYmUgcmVsYXRpdmUgdG8gdGhlIHN0YXJ0IG9mIHRoZSBjb25jYXRlbmF0ZWRcbiAgICAgICAgLy8gZ2VuZXJhdGVkIGZpbGUuXG4gICAgICAgIHZhciBhZGp1c3RlZE1hcHBpbmcgPSB7XG4gICAgICAgICAgc291cmNlOiBzb3VyY2UsXG4gICAgICAgICAgZ2VuZXJhdGVkTGluZTogbWFwcGluZy5nZW5lcmF0ZWRMaW5lICtcbiAgICAgICAgICAgIChzZWN0aW9uLmdlbmVyYXRlZE9mZnNldC5nZW5lcmF0ZWRMaW5lIC0gMSksXG4gICAgICAgICAgZ2VuZXJhdGVkQ29sdW1uOiBtYXBwaW5nLmdlbmVyYXRlZENvbHVtbiArXG4gICAgICAgICAgICAoc2VjdGlvbi5nZW5lcmF0ZWRPZmZzZXQuZ2VuZXJhdGVkTGluZSA9PT0gbWFwcGluZy5nZW5lcmF0ZWRMaW5lXG4gICAgICAgICAgICA/IHNlY3Rpb24uZ2VuZXJhdGVkT2Zmc2V0LmdlbmVyYXRlZENvbHVtbiAtIDFcbiAgICAgICAgICAgIDogMCksXG4gICAgICAgICAgb3JpZ2luYWxMaW5lOiBtYXBwaW5nLm9yaWdpbmFsTGluZSxcbiAgICAgICAgICBvcmlnaW5hbENvbHVtbjogbWFwcGluZy5vcmlnaW5hbENvbHVtbixcbiAgICAgICAgICBuYW1lOiBuYW1lXG4gICAgICAgIH07XG5cbiAgICAgICAgdGhpcy5fX2dlbmVyYXRlZE1hcHBpbmdzLnB1c2goYWRqdXN0ZWRNYXBwaW5nKTtcbiAgICAgICAgaWYgKHR5cGVvZiBhZGp1c3RlZE1hcHBpbmcub3JpZ2luYWxMaW5lID09PSAnbnVtYmVyJykge1xuICAgICAgICAgIHRoaXMuX19vcmlnaW5hbE1hcHBpbmdzLnB1c2goYWRqdXN0ZWRNYXBwaW5nKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cblxuICAgIHF1aWNrU29ydCh0aGlzLl9fZ2VuZXJhdGVkTWFwcGluZ3MsIHV0aWwuY29tcGFyZUJ5R2VuZXJhdGVkUG9zaXRpb25zRGVmbGF0ZWQpO1xuICAgIHF1aWNrU29ydCh0aGlzLl9fb3JpZ2luYWxNYXBwaW5ncywgdXRpbC5jb21wYXJlQnlPcmlnaW5hbFBvc2l0aW9ucyk7XG4gIH07XG5cbmV4cG9ydHMuSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyID0gSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvc291cmNlLW1hcC1jb25zdW1lci5qc1xuLy8gbW9kdWxlIGlkID0gN1xuLy8gbW9kdWxlIGNodW5rcyA9IDAiLCIvKiAtKi0gTW9kZToganM7IGpzLWluZGVudC1sZXZlbDogMjsgLSotICovXG4vKlxuICogQ29weXJpZ2h0IDIwMTEgTW96aWxsYSBGb3VuZGF0aW9uIGFuZCBjb250cmlidXRvcnNcbiAqIExpY2Vuc2VkIHVuZGVyIHRoZSBOZXcgQlNEIGxpY2Vuc2UuIFNlZSBMSUNFTlNFIG9yOlxuICogaHR0cDovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0zLUNsYXVzZVxuICovXG5cbmV4cG9ydHMuR1JFQVRFU1RfTE9XRVJfQk9VTkQgPSAxO1xuZXhwb3J0cy5MRUFTVF9VUFBFUl9CT1VORCA9IDI7XG5cbi8qKlxuICogUmVjdXJzaXZlIGltcGxlbWVudGF0aW9uIG9mIGJpbmFyeSBzZWFyY2guXG4gKlxuICogQHBhcmFtIGFMb3cgSW5kaWNlcyBoZXJlIGFuZCBsb3dlciBkbyBub3QgY29udGFpbiB0aGUgbmVlZGxlLlxuICogQHBhcmFtIGFIaWdoIEluZGljZXMgaGVyZSBhbmQgaGlnaGVyIGRvIG5vdCBjb250YWluIHRoZSBuZWVkbGUuXG4gKiBAcGFyYW0gYU5lZWRsZSBUaGUgZWxlbWVudCBiZWluZyBzZWFyY2hlZCBmb3IuXG4gKiBAcGFyYW0gYUhheXN0YWNrIFRoZSBub24tZW1wdHkgYXJyYXkgYmVpbmcgc2VhcmNoZWQuXG4gKiBAcGFyYW0gYUNvbXBhcmUgRnVuY3Rpb24gd2hpY2ggdGFrZXMgdHdvIGVsZW1lbnRzIGFuZCByZXR1cm5zIC0xLCAwLCBvciAxLlxuICogQHBhcmFtIGFCaWFzIEVpdGhlciAnYmluYXJ5U2VhcmNoLkdSRUFURVNUX0xPV0VSX0JPVU5EJyBvclxuICogICAgICdiaW5hcnlTZWFyY2guTEVBU1RfVVBQRVJfQk9VTkQnLiBTcGVjaWZpZXMgd2hldGhlciB0byByZXR1cm4gdGhlXG4gKiAgICAgY2xvc2VzdCBlbGVtZW50IHRoYXQgaXMgc21hbGxlciB0aGFuIG9yIGdyZWF0ZXIgdGhhbiB0aGUgb25lIHdlIGFyZVxuICogICAgIHNlYXJjaGluZyBmb3IsIHJlc3BlY3RpdmVseSwgaWYgdGhlIGV4YWN0IGVsZW1lbnQgY2Fubm90IGJlIGZvdW5kLlxuICovXG5mdW5jdGlvbiByZWN1cnNpdmVTZWFyY2goYUxvdywgYUhpZ2gsIGFOZWVkbGUsIGFIYXlzdGFjaywgYUNvbXBhcmUsIGFCaWFzKSB7XG4gIC8vIFRoaXMgZnVuY3Rpb24gdGVybWluYXRlcyB3aGVuIG9uZSBvZiB0aGUgZm9sbG93aW5nIGlzIHRydWU6XG4gIC8vXG4gIC8vICAgMS4gV2UgZmluZCB0aGUgZXhhY3QgZWxlbWVudCB3ZSBhcmUgbG9va2luZyBmb3IuXG4gIC8vXG4gIC8vICAgMi4gV2UgZGlkIG5vdCBmaW5kIHRoZSBleGFjdCBlbGVtZW50LCBidXQgd2UgY2FuIHJldHVybiB0aGUgaW5kZXggb2ZcbiAgLy8gICAgICB0aGUgbmV4dC1jbG9zZXN0IGVsZW1lbnQuXG4gIC8vXG4gIC8vICAgMy4gV2UgZGlkIG5vdCBmaW5kIHRoZSBleGFjdCBlbGVtZW50LCBhbmQgdGhlcmUgaXMgbm8gbmV4dC1jbG9zZXN0XG4gIC8vICAgICAgZWxlbWVudCB0aGFuIHRoZSBvbmUgd2UgYXJlIHNlYXJjaGluZyBmb3IsIHNvIHdlIHJldHVybiAtMS5cbiAgdmFyIG1pZCA9IE1hdGguZmxvb3IoKGFIaWdoIC0gYUxvdykgLyAyKSArIGFMb3c7XG4gIHZhciBjbXAgPSBhQ29tcGFyZShhTmVlZGxlLCBhSGF5c3RhY2tbbWlkXSwgdHJ1ZSk7XG4gIGlmIChjbXAgPT09IDApIHtcbiAgICAvLyBGb3VuZCB0aGUgZWxlbWVudCB3ZSBhcmUgbG9va2luZyBmb3IuXG4gICAgcmV0dXJuIG1pZDtcbiAgfVxuICBlbHNlIGlmIChjbXAgPiAwKSB7XG4gICAgLy8gT3VyIG5lZWRsZSBpcyBncmVhdGVyIHRoYW4gYUhheXN0YWNrW21pZF0uXG4gICAgaWYgKGFIaWdoIC0gbWlkID4gMSkge1xuICAgICAgLy8gVGhlIGVsZW1lbnQgaXMgaW4gdGhlIHVwcGVyIGhhbGYuXG4gICAgICByZXR1cm4gcmVjdXJzaXZlU2VhcmNoKG1pZCwgYUhpZ2gsIGFOZWVkbGUsIGFIYXlzdGFjaywgYUNvbXBhcmUsIGFCaWFzKTtcbiAgICB9XG5cbiAgICAvLyBUaGUgZXhhY3QgbmVlZGxlIGVsZW1lbnQgd2FzIG5vdCBmb3VuZCBpbiB0aGlzIGhheXN0YWNrLiBEZXRlcm1pbmUgaWZcbiAgICAvLyB3ZSBhcmUgaW4gdGVybWluYXRpb24gY2FzZSAoMykgb3IgKDIpIGFuZCByZXR1cm4gdGhlIGFwcHJvcHJpYXRlIHRoaW5nLlxuICAgIGlmIChhQmlhcyA9PSBleHBvcnRzLkxFQVNUX1VQUEVSX0JPVU5EKSB7XG4gICAgICByZXR1cm4gYUhpZ2ggPCBhSGF5c3RhY2subGVuZ3RoID8gYUhpZ2ggOiAtMTtcbiAgICB9IGVsc2Uge1xuICAgICAgcmV0dXJuIG1pZDtcbiAgICB9XG4gIH1cbiAgZWxzZSB7XG4gICAgLy8gT3VyIG5lZWRsZSBpcyBsZXNzIHRoYW4gYUhheXN0YWNrW21pZF0uXG4gICAgaWYgKG1pZCAtIGFMb3cgPiAxKSB7XG4gICAgICAvLyBUaGUgZWxlbWVudCBpcyBpbiB0aGUgbG93ZXIgaGFsZi5cbiAgICAgIHJldHVybiByZWN1cnNpdmVTZWFyY2goYUxvdywgbWlkLCBhTmVlZGxlLCBhSGF5c3RhY2ssIGFDb21wYXJlLCBhQmlhcyk7XG4gICAgfVxuXG4gICAgLy8gd2UgYXJlIGluIHRlcm1pbmF0aW9uIGNhc2UgKDMpIG9yICgyKSBhbmQgcmV0dXJuIHRoZSBhcHByb3ByaWF0ZSB0aGluZy5cbiAgICBpZiAoYUJpYXMgPT0gZXhwb3J0cy5MRUFTVF9VUFBFUl9CT1VORCkge1xuICAgICAgcmV0dXJuIG1pZDtcbiAgICB9IGVsc2Uge1xuICAgICAgcmV0dXJuIGFMb3cgPCAwID8gLTEgOiBhTG93O1xuICAgIH1cbiAgfVxufVxuXG4vKipcbiAqIFRoaXMgaXMgYW4gaW1wbGVtZW50YXRpb24gb2YgYmluYXJ5IHNlYXJjaCB3aGljaCB3aWxsIGFsd2F5cyB0cnkgYW5kIHJldHVyblxuICogdGhlIGluZGV4IG9mIHRoZSBjbG9zZXN0IGVsZW1lbnQgaWYgdGhlcmUgaXMgbm8gZXhhY3QgaGl0LiBUaGlzIGlzIGJlY2F1c2VcbiAqIG1hcHBpbmdzIGJldHdlZW4gb3JpZ2luYWwgYW5kIGdlbmVyYXRlZCBsaW5lL2NvbCBwYWlycyBhcmUgc2luZ2xlIHBvaW50cyxcbiAqIGFuZCB0aGVyZSBpcyBhbiBpbXBsaWNpdCByZWdpb24gYmV0d2VlbiBlYWNoIG9mIHRoZW0sIHNvIGEgbWlzcyBqdXN0IG1lYW5zXG4gKiB0aGF0IHlvdSBhcmVuJ3Qgb24gdGhlIHZlcnkgc3RhcnQgb2YgYSByZWdpb24uXG4gKlxuICogQHBhcmFtIGFOZWVkbGUgVGhlIGVsZW1lbnQgeW91IGFyZSBsb29raW5nIGZvci5cbiAqIEBwYXJhbSBhSGF5c3RhY2sgVGhlIGFycmF5IHRoYXQgaXMgYmVpbmcgc2VhcmNoZWQuXG4gKiBAcGFyYW0gYUNvbXBhcmUgQSBmdW5jdGlvbiB3aGljaCB0YWtlcyB0aGUgbmVlZGxlIGFuZCBhbiBlbGVtZW50IGluIHRoZVxuICogICAgIGFycmF5IGFuZCByZXR1cm5zIC0xLCAwLCBvciAxIGRlcGVuZGluZyBvbiB3aGV0aGVyIHRoZSBuZWVkbGUgaXMgbGVzc1xuICogICAgIHRoYW4sIGVxdWFsIHRvLCBvciBncmVhdGVyIHRoYW4gdGhlIGVsZW1lbnQsIHJlc3BlY3RpdmVseS5cbiAqIEBwYXJhbSBhQmlhcyBFaXRoZXIgJ2JpbmFyeVNlYXJjaC5HUkVBVEVTVF9MT1dFUl9CT1VORCcgb3JcbiAqICAgICAnYmluYXJ5U2VhcmNoLkxFQVNUX1VQUEVSX0JPVU5EJy4gU3BlY2lmaWVzIHdoZXRoZXIgdG8gcmV0dXJuIHRoZVxuICogICAgIGNsb3Nlc3QgZWxlbWVudCB0aGF0IGlzIHNtYWxsZXIgdGhhbiBvciBncmVhdGVyIHRoYW4gdGhlIG9uZSB3ZSBhcmVcbiAqICAgICBzZWFyY2hpbmcgZm9yLCByZXNwZWN0aXZlbHksIGlmIHRoZSBleGFjdCBlbGVtZW50IGNhbm5vdCBiZSBmb3VuZC5cbiAqICAgICBEZWZhdWx0cyB0byAnYmluYXJ5U2VhcmNoLkdSRUFURVNUX0xPV0VSX0JPVU5EJy5cbiAqL1xuZXhwb3J0cy5zZWFyY2ggPSBmdW5jdGlvbiBzZWFyY2goYU5lZWRsZSwgYUhheXN0YWNrLCBhQ29tcGFyZSwgYUJpYXMpIHtcbiAgaWYgKGFIYXlzdGFjay5sZW5ndGggPT09IDApIHtcbiAgICByZXR1cm4gLTE7XG4gIH1cblxuICB2YXIgaW5kZXggPSByZWN1cnNpdmVTZWFyY2goLTEsIGFIYXlzdGFjay5sZW5ndGgsIGFOZWVkbGUsIGFIYXlzdGFjayxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFDb21wYXJlLCBhQmlhcyB8fCBleHBvcnRzLkdSRUFURVNUX0xPV0VSX0JPVU5EKTtcbiAgaWYgKGluZGV4IDwgMCkge1xuICAgIHJldHVybiAtMTtcbiAgfVxuXG4gIC8vIFdlIGhhdmUgZm91bmQgZWl0aGVyIHRoZSBleGFjdCBlbGVtZW50LCBvciB0aGUgbmV4dC1jbG9zZXN0IGVsZW1lbnQgdGhhblxuICAvLyB0aGUgb25lIHdlIGFyZSBzZWFyY2hpbmcgZm9yLiBIb3dldmVyLCB0aGVyZSBtYXkgYmUgbW9yZSB0aGFuIG9uZSBzdWNoXG4gIC8vIGVsZW1lbnQuIE1ha2Ugc3VyZSB3ZSBhbHdheXMgcmV0dXJuIHRoZSBzbWFsbGVzdCBvZiB0aGVzZS5cbiAgd2hpbGUgKGluZGV4IC0gMSA+PSAwKSB7XG4gICAgaWYgKGFDb21wYXJlKGFIYXlzdGFja1tpbmRleF0sIGFIYXlzdGFja1tpbmRleCAtIDFdLCB0cnVlKSAhPT0gMCkge1xuICAgICAgYnJlYWs7XG4gICAgfVxuICAgIC0taW5kZXg7XG4gIH1cblxuICByZXR1cm4gaW5kZXg7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvYmluYXJ5LXNlYXJjaC5qc1xuLy8gbW9kdWxlIGlkID0gOFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiLCIvKiAtKi0gTW9kZToganM7IGpzLWluZGVudC1sZXZlbDogMjsgLSotICovXG4vKlxuICogQ29weXJpZ2h0IDIwMTEgTW96aWxsYSBGb3VuZGF0aW9uIGFuZCBjb250cmlidXRvcnNcbiAqIExpY2Vuc2VkIHVuZGVyIHRoZSBOZXcgQlNEIGxpY2Vuc2UuIFNlZSBMSUNFTlNFIG9yOlxuICogaHR0cDovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0zLUNsYXVzZVxuICovXG5cbi8vIEl0IHR1cm5zIG91dCB0aGF0IHNvbWUgKG1vc3Q/KSBKYXZhU2NyaXB0IGVuZ2luZXMgZG9uJ3Qgc2VsZi1ob3N0XG4vLyBgQXJyYXkucHJvdG90eXBlLnNvcnRgLiBUaGlzIG1ha2VzIHNlbnNlIGJlY2F1c2UgQysrIHdpbGwgbGlrZWx5IHJlbWFpblxuLy8gZmFzdGVyIHRoYW4gSlMgd2hlbiBkb2luZyByYXcgQ1BVLWludGVuc2l2ZSBzb3J0aW5nLiBIb3dldmVyLCB3aGVuIHVzaW5nIGFcbi8vIGN1c3RvbSBjb21wYXJhdG9yIGZ1bmN0aW9uLCBjYWxsaW5nIGJhY2sgYW5kIGZvcnRoIGJldHdlZW4gdGhlIFZNJ3MgQysrIGFuZFxuLy8gSklUJ2QgSlMgaXMgcmF0aGVyIHNsb3cgKmFuZCogbG9zZXMgSklUIHR5cGUgaW5mb3JtYXRpb24sIHJlc3VsdGluZyBpblxuLy8gd29yc2UgZ2VuZXJhdGVkIGNvZGUgZm9yIHRoZSBjb21wYXJhdG9yIGZ1bmN0aW9uIHRoYW4gd291bGQgYmUgb3B0aW1hbC4gSW5cbi8vIGZhY3QsIHdoZW4gc29ydGluZyB3aXRoIGEgY29tcGFyYXRvciwgdGhlc2UgY29zdHMgb3V0d2VpZ2ggdGhlIGJlbmVmaXRzIG9mXG4vLyBzb3J0aW5nIGluIEMrKy4gQnkgdXNpbmcgb3VyIG93biBKUy1pbXBsZW1lbnRlZCBRdWljayBTb3J0IChiZWxvdyksIHdlIGdldFxuLy8gYSB+MzUwMG1zIG1lYW4gc3BlZWQtdXAgaW4gYGJlbmNoL2JlbmNoLmh0bWxgLlxuXG4vKipcbiAqIFN3YXAgdGhlIGVsZW1lbnRzIGluZGV4ZWQgYnkgYHhgIGFuZCBgeWAgaW4gdGhlIGFycmF5IGBhcnlgLlxuICpcbiAqIEBwYXJhbSB7QXJyYXl9IGFyeVxuICogICAgICAgIFRoZSBhcnJheS5cbiAqIEBwYXJhbSB7TnVtYmVyfSB4XG4gKiAgICAgICAgVGhlIGluZGV4IG9mIHRoZSBmaXJzdCBpdGVtLlxuICogQHBhcmFtIHtOdW1iZXJ9IHlcbiAqICAgICAgICBUaGUgaW5kZXggb2YgdGhlIHNlY29uZCBpdGVtLlxuICovXG5mdW5jdGlvbiBzd2FwKGFyeSwgeCwgeSkge1xuICB2YXIgdGVtcCA9IGFyeVt4XTtcbiAgYXJ5W3hdID0gYXJ5W3ldO1xuICBhcnlbeV0gPSB0ZW1wO1xufVxuXG4vKipcbiAqIFJldHVybnMgYSByYW5kb20gaW50ZWdlciB3aXRoaW4gdGhlIHJhbmdlIGBsb3cgLi4gaGlnaGAgaW5jbHVzaXZlLlxuICpcbiAqIEBwYXJhbSB7TnVtYmVyfSBsb3dcbiAqICAgICAgICBUaGUgbG93ZXIgYm91bmQgb24gdGhlIHJhbmdlLlxuICogQHBhcmFtIHtOdW1iZXJ9IGhpZ2hcbiAqICAgICAgICBUaGUgdXBwZXIgYm91bmQgb24gdGhlIHJhbmdlLlxuICovXG5mdW5jdGlvbiByYW5kb21JbnRJblJhbmdlKGxvdywgaGlnaCkge1xuICByZXR1cm4gTWF0aC5yb3VuZChsb3cgKyAoTWF0aC5yYW5kb20oKSAqIChoaWdoIC0gbG93KSkpO1xufVxuXG4vKipcbiAqIFRoZSBRdWljayBTb3J0IGFsZ29yaXRobS5cbiAqXG4gKiBAcGFyYW0ge0FycmF5fSBhcnlcbiAqICAgICAgICBBbiBhcnJheSB0byBzb3J0LlxuICogQHBhcmFtIHtmdW5jdGlvbn0gY29tcGFyYXRvclxuICogICAgICAgIEZ1bmN0aW9uIHRvIHVzZSB0byBjb21wYXJlIHR3byBpdGVtcy5cbiAqIEBwYXJhbSB7TnVtYmVyfSBwXG4gKiAgICAgICAgU3RhcnQgaW5kZXggb2YgdGhlIGFycmF5XG4gKiBAcGFyYW0ge051bWJlcn0gclxuICogICAgICAgIEVuZCBpbmRleCBvZiB0aGUgYXJyYXlcbiAqL1xuZnVuY3Rpb24gZG9RdWlja1NvcnQoYXJ5LCBjb21wYXJhdG9yLCBwLCByKSB7XG4gIC8vIElmIG91ciBsb3dlciBib3VuZCBpcyBsZXNzIHRoYW4gb3VyIHVwcGVyIGJvdW5kLCB3ZSAoMSkgcGFydGl0aW9uIHRoZVxuICAvLyBhcnJheSBpbnRvIHR3byBwaWVjZXMgYW5kICgyKSByZWN1cnNlIG9uIGVhY2ggaGFsZi4gSWYgaXQgaXMgbm90LCB0aGlzIGlzXG4gIC8vIHRoZSBlbXB0eSBhcnJheSBhbmQgb3VyIGJhc2UgY2FzZS5cblxuICBpZiAocCA8IHIpIHtcbiAgICAvLyAoMSkgUGFydGl0aW9uaW5nLlxuICAgIC8vXG4gICAgLy8gVGhlIHBhcnRpdGlvbmluZyBjaG9vc2VzIGEgcGl2b3QgYmV0d2VlbiBgcGAgYW5kIGByYCBhbmQgbW92ZXMgYWxsXG4gICAgLy8gZWxlbWVudHMgdGhhdCBhcmUgbGVzcyB0aGFuIG9yIGVxdWFsIHRvIHRoZSBwaXZvdCB0byB0aGUgYmVmb3JlIGl0LCBhbmRcbiAgICAvLyBhbGwgdGhlIGVsZW1lbnRzIHRoYXQgYXJlIGdyZWF0ZXIgdGhhbiBpdCBhZnRlciBpdC4gVGhlIGVmZmVjdCBpcyB0aGF0XG4gICAgLy8gb25jZSBwYXJ0aXRpb24gaXMgZG9uZSwgdGhlIHBpdm90IGlzIGluIHRoZSBleGFjdCBwbGFjZSBpdCB3aWxsIGJlIHdoZW5cbiAgICAvLyB0aGUgYXJyYXkgaXMgcHV0IGluIHNvcnRlZCBvcmRlciwgYW5kIGl0IHdpbGwgbm90IG5lZWQgdG8gYmUgbW92ZWRcbiAgICAvLyBhZ2Fpbi4gVGhpcyBydW5zIGluIE8obikgdGltZS5cblxuICAgIC8vIEFsd2F5cyBjaG9vc2UgYSByYW5kb20gcGl2b3Qgc28gdGhhdCBhbiBpbnB1dCBhcnJheSB3aGljaCBpcyByZXZlcnNlXG4gICAgLy8gc29ydGVkIGRvZXMgbm90IGNhdXNlIE8obl4yKSBydW5uaW5nIHRpbWUuXG4gICAgdmFyIHBpdm90SW5kZXggPSByYW5kb21JbnRJblJhbmdlKHAsIHIpO1xuICAgIHZhciBpID0gcCAtIDE7XG5cbiAgICBzd2FwKGFyeSwgcGl2b3RJbmRleCwgcik7XG4gICAgdmFyIHBpdm90ID0gYXJ5W3JdO1xuXG4gICAgLy8gSW1tZWRpYXRlbHkgYWZ0ZXIgYGpgIGlzIGluY3JlbWVudGVkIGluIHRoaXMgbG9vcCwgdGhlIGZvbGxvd2luZyBob2xkXG4gICAgLy8gdHJ1ZTpcbiAgICAvL1xuICAgIC8vICAgKiBFdmVyeSBlbGVtZW50IGluIGBhcnlbcCAuLiBpXWAgaXMgbGVzcyB0aGFuIG9yIGVxdWFsIHRvIHRoZSBwaXZvdC5cbiAgICAvL1xuICAgIC8vICAgKiBFdmVyeSBlbGVtZW50IGluIGBhcnlbaSsxIC4uIGotMV1gIGlzIGdyZWF0ZXIgdGhhbiB0aGUgcGl2b3QuXG4gICAgZm9yICh2YXIgaiA9IHA7IGogPCByOyBqKyspIHtcbiAgICAgIGlmIChjb21wYXJhdG9yKGFyeVtqXSwgcGl2b3QpIDw9IDApIHtcbiAgICAgICAgaSArPSAxO1xuICAgICAgICBzd2FwKGFyeSwgaSwgaik7XG4gICAgICB9XG4gICAgfVxuXG4gICAgc3dhcChhcnksIGkgKyAxLCBqKTtcbiAgICB2YXIgcSA9IGkgKyAxO1xuXG4gICAgLy8gKDIpIFJlY3Vyc2Ugb24gZWFjaCBoYWxmLlxuXG4gICAgZG9RdWlja1NvcnQoYXJ5LCBjb21wYXJhdG9yLCBwLCBxIC0gMSk7XG4gICAgZG9RdWlja1NvcnQoYXJ5LCBjb21wYXJhdG9yLCBxICsgMSwgcik7XG4gIH1cbn1cblxuLyoqXG4gKiBTb3J0IHRoZSBnaXZlbiBhcnJheSBpbi1wbGFjZSB3aXRoIHRoZSBnaXZlbiBjb21wYXJhdG9yIGZ1bmN0aW9uLlxuICpcbiAqIEBwYXJhbSB7QXJyYXl9IGFyeVxuICogICAgICAgIEFuIGFycmF5IHRvIHNvcnQuXG4gKiBAcGFyYW0ge2Z1bmN0aW9ufSBjb21wYXJhdG9yXG4gKiAgICAgICAgRnVuY3Rpb24gdG8gdXNlIHRvIGNvbXBhcmUgdHdvIGl0ZW1zLlxuICovXG5leHBvcnRzLnF1aWNrU29ydCA9IGZ1bmN0aW9uIChhcnksIGNvbXBhcmF0b3IpIHtcbiAgZG9RdWlja1NvcnQoYXJ5LCBjb21wYXJhdG9yLCAwLCBhcnkubGVuZ3RoIC0gMSk7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvcXVpY2stc29ydC5qc1xuLy8gbW9kdWxlIGlkID0gOVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiLCIvKiAtKi0gTW9kZToganM7IGpzLWluZGVudC1sZXZlbDogMjsgLSotICovXG4vKlxuICogQ29weXJpZ2h0IDIwMTEgTW96aWxsYSBGb3VuZGF0aW9uIGFuZCBjb250cmlidXRvcnNcbiAqIExpY2Vuc2VkIHVuZGVyIHRoZSBOZXcgQlNEIGxpY2Vuc2UuIFNlZSBMSUNFTlNFIG9yOlxuICogaHR0cDovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0zLUNsYXVzZVxuICovXG5cbnZhciBTb3VyY2VNYXBHZW5lcmF0b3IgPSByZXF1aXJlKCcuL3NvdXJjZS1tYXAtZ2VuZXJhdG9yJykuU291cmNlTWFwR2VuZXJhdG9yO1xudmFyIHV0aWwgPSByZXF1aXJlKCcuL3V0aWwnKTtcblxuLy8gTWF0Y2hlcyBhIFdpbmRvd3Mtc3R5bGUgYFxcclxcbmAgbmV3bGluZSBvciBhIGBcXG5gIG5ld2xpbmUgdXNlZCBieSBhbGwgb3RoZXJcbi8vIG9wZXJhdGluZyBzeXN0ZW1zIHRoZXNlIGRheXMgKGNhcHR1cmluZyB0aGUgcmVzdWx0KS5cbnZhciBSRUdFWF9ORVdMSU5FID0gLyhcXHI/XFxuKS87XG5cbi8vIE5ld2xpbmUgY2hhcmFjdGVyIGNvZGUgZm9yIGNoYXJDb2RlQXQoKSBjb21wYXJpc29uc1xudmFyIE5FV0xJTkVfQ09ERSA9IDEwO1xuXG4vLyBQcml2YXRlIHN5bWJvbCBmb3IgaWRlbnRpZnlpbmcgYFNvdXJjZU5vZGVgcyB3aGVuIG11bHRpcGxlIHZlcnNpb25zIG9mXG4vLyB0aGUgc291cmNlLW1hcCBsaWJyYXJ5IGFyZSBsb2FkZWQuIFRoaXMgTVVTVCBOT1QgQ0hBTkdFIGFjcm9zc1xuLy8gdmVyc2lvbnMhXG52YXIgaXNTb3VyY2VOb2RlID0gXCIkJCRpc1NvdXJjZU5vZGUkJCRcIjtcblxuLyoqXG4gKiBTb3VyY2VOb2RlcyBwcm92aWRlIGEgd2F5IHRvIGFic3RyYWN0IG92ZXIgaW50ZXJwb2xhdGluZy9jb25jYXRlbmF0aW5nXG4gKiBzbmlwcGV0cyBvZiBnZW5lcmF0ZWQgSmF2YVNjcmlwdCBzb3VyY2UgY29kZSB3aGlsZSBtYWludGFpbmluZyB0aGUgbGluZSBhbmRcbiAqIGNvbHVtbiBpbmZvcm1hdGlvbiBhc3NvY2lhdGVkIHdpdGggdGhlIG9yaWdpbmFsIHNvdXJjZSBjb2RlLlxuICpcbiAqIEBwYXJhbSBhTGluZSBUaGUgb3JpZ2luYWwgbGluZSBudW1iZXIuXG4gKiBAcGFyYW0gYUNvbHVtbiBUaGUgb3JpZ2luYWwgY29sdW1uIG51bWJlci5cbiAqIEBwYXJhbSBhU291cmNlIFRoZSBvcmlnaW5hbCBzb3VyY2UncyBmaWxlbmFtZS5cbiAqIEBwYXJhbSBhQ2h1bmtzIE9wdGlvbmFsLiBBbiBhcnJheSBvZiBzdHJpbmdzIHdoaWNoIGFyZSBzbmlwcGV0cyBvZlxuICogICAgICAgIGdlbmVyYXRlZCBKUywgb3Igb3RoZXIgU291cmNlTm9kZXMuXG4gKiBAcGFyYW0gYU5hbWUgVGhlIG9yaWdpbmFsIGlkZW50aWZpZXIuXG4gKi9cbmZ1bmN0aW9uIFNvdXJjZU5vZGUoYUxpbmUsIGFDb2x1bW4sIGFTb3VyY2UsIGFDaHVua3MsIGFOYW1lKSB7XG4gIHRoaXMuY2hpbGRyZW4gPSBbXTtcbiAgdGhpcy5zb3VyY2VDb250ZW50cyA9IHt9O1xuICB0aGlzLmxpbmUgPSBhTGluZSA9PSBudWxsID8gbnVsbCA6IGFMaW5lO1xuICB0aGlzLmNvbHVtbiA9IGFDb2x1bW4gPT0gbnVsbCA/IG51bGwgOiBhQ29sdW1uO1xuICB0aGlzLnNvdXJjZSA9IGFTb3VyY2UgPT0gbnVsbCA/IG51bGwgOiBhU291cmNlO1xuICB0aGlzLm5hbWUgPSBhTmFtZSA9PSBudWxsID8gbnVsbCA6IGFOYW1lO1xuICB0aGlzW2lzU291cmNlTm9kZV0gPSB0cnVlO1xuICBpZiAoYUNodW5rcyAhPSBudWxsKSB0aGlzLmFkZChhQ2h1bmtzKTtcbn1cblxuLyoqXG4gKiBDcmVhdGVzIGEgU291cmNlTm9kZSBmcm9tIGdlbmVyYXRlZCBjb2RlIGFuZCBhIFNvdXJjZU1hcENvbnN1bWVyLlxuICpcbiAqIEBwYXJhbSBhR2VuZXJhdGVkQ29kZSBUaGUgZ2VuZXJhdGVkIGNvZGVcbiAqIEBwYXJhbSBhU291cmNlTWFwQ29uc3VtZXIgVGhlIFNvdXJjZU1hcCBmb3IgdGhlIGdlbmVyYXRlZCBjb2RlXG4gKiBAcGFyYW0gYVJlbGF0aXZlUGF0aCBPcHRpb25hbC4gVGhlIHBhdGggdGhhdCByZWxhdGl2ZSBzb3VyY2VzIGluIHRoZVxuICogICAgICAgIFNvdXJjZU1hcENvbnN1bWVyIHNob3VsZCBiZSByZWxhdGl2ZSB0by5cbiAqL1xuU291cmNlTm9kZS5mcm9tU3RyaW5nV2l0aFNvdXJjZU1hcCA9XG4gIGZ1bmN0aW9uIFNvdXJjZU5vZGVfZnJvbVN0cmluZ1dpdGhTb3VyY2VNYXAoYUdlbmVyYXRlZENvZGUsIGFTb3VyY2VNYXBDb25zdW1lciwgYVJlbGF0aXZlUGF0aCkge1xuICAgIC8vIFRoZSBTb3VyY2VOb2RlIHdlIHdhbnQgdG8gZmlsbCB3aXRoIHRoZSBnZW5lcmF0ZWQgY29kZVxuICAgIC8vIGFuZCB0aGUgU291cmNlTWFwXG4gICAgdmFyIG5vZGUgPSBuZXcgU291cmNlTm9kZSgpO1xuXG4gICAgLy8gQWxsIGV2ZW4gaW5kaWNlcyBvZiB0aGlzIGFycmF5IGFyZSBvbmUgbGluZSBvZiB0aGUgZ2VuZXJhdGVkIGNvZGUsXG4gICAgLy8gd2hpbGUgYWxsIG9kZCBpbmRpY2VzIGFyZSB0aGUgbmV3bGluZXMgYmV0d2VlbiB0d28gYWRqYWNlbnQgbGluZXNcbiAgICAvLyAoc2luY2UgYFJFR0VYX05FV0xJTkVgIGNhcHR1cmVzIGl0cyBtYXRjaCkuXG4gICAgLy8gUHJvY2Vzc2VkIGZyYWdtZW50cyBhcmUgYWNjZXNzZWQgYnkgY2FsbGluZyBgc2hpZnROZXh0TGluZWAuXG4gICAgdmFyIHJlbWFpbmluZ0xpbmVzID0gYUdlbmVyYXRlZENvZGUuc3BsaXQoUkVHRVhfTkVXTElORSk7XG4gICAgdmFyIHJlbWFpbmluZ0xpbmVzSW5kZXggPSAwO1xuICAgIHZhciBzaGlmdE5leHRMaW5lID0gZnVuY3Rpb24oKSB7XG4gICAgICB2YXIgbGluZUNvbnRlbnRzID0gZ2V0TmV4dExpbmUoKTtcbiAgICAgIC8vIFRoZSBsYXN0IGxpbmUgb2YgYSBmaWxlIG1pZ2h0IG5vdCBoYXZlIGEgbmV3bGluZS5cbiAgICAgIHZhciBuZXdMaW5lID0gZ2V0TmV4dExpbmUoKSB8fCBcIlwiO1xuICAgICAgcmV0dXJuIGxpbmVDb250ZW50cyArIG5ld0xpbmU7XG5cbiAgICAgIGZ1bmN0aW9uIGdldE5leHRMaW5lKCkge1xuICAgICAgICByZXR1cm4gcmVtYWluaW5nTGluZXNJbmRleCA8IHJlbWFpbmluZ0xpbmVzLmxlbmd0aCA/XG4gICAgICAgICAgICByZW1haW5pbmdMaW5lc1tyZW1haW5pbmdMaW5lc0luZGV4KytdIDogdW5kZWZpbmVkO1xuICAgICAgfVxuICAgIH07XG5cbiAgICAvLyBXZSBuZWVkIHRvIHJlbWVtYmVyIHRoZSBwb3NpdGlvbiBvZiBcInJlbWFpbmluZ0xpbmVzXCJcbiAgICB2YXIgbGFzdEdlbmVyYXRlZExpbmUgPSAxLCBsYXN0R2VuZXJhdGVkQ29sdW1uID0gMDtcblxuICAgIC8vIFRoZSBnZW5lcmF0ZSBTb3VyY2VOb2RlcyB3ZSBuZWVkIGEgY29kZSByYW5nZS5cbiAgICAvLyBUbyBleHRyYWN0IGl0IGN1cnJlbnQgYW5kIGxhc3QgbWFwcGluZyBpcyB1c2VkLlxuICAgIC8vIEhlcmUgd2Ugc3RvcmUgdGhlIGxhc3QgbWFwcGluZy5cbiAgICB2YXIgbGFzdE1hcHBpbmcgPSBudWxsO1xuXG4gICAgYVNvdXJjZU1hcENvbnN1bWVyLmVhY2hNYXBwaW5nKGZ1bmN0aW9uIChtYXBwaW5nKSB7XG4gICAgICBpZiAobGFzdE1hcHBpbmcgIT09IG51bGwpIHtcbiAgICAgICAgLy8gV2UgYWRkIHRoZSBjb2RlIGZyb20gXCJsYXN0TWFwcGluZ1wiIHRvIFwibWFwcGluZ1wiOlxuICAgICAgICAvLyBGaXJzdCBjaGVjayBpZiB0aGVyZSBpcyBhIG5ldyBsaW5lIGluIGJldHdlZW4uXG4gICAgICAgIGlmIChsYXN0R2VuZXJhdGVkTGluZSA8IG1hcHBpbmcuZ2VuZXJhdGVkTGluZSkge1xuICAgICAgICAgIC8vIEFzc29jaWF0ZSBmaXJzdCBsaW5lIHdpdGggXCJsYXN0TWFwcGluZ1wiXG4gICAgICAgICAgYWRkTWFwcGluZ1dpdGhDb2RlKGxhc3RNYXBwaW5nLCBzaGlmdE5leHRMaW5lKCkpO1xuICAgICAgICAgIGxhc3RHZW5lcmF0ZWRMaW5lKys7XG4gICAgICAgICAgbGFzdEdlbmVyYXRlZENvbHVtbiA9IDA7XG4gICAgICAgICAgLy8gVGhlIHJlbWFpbmluZyBjb2RlIGlzIGFkZGVkIHdpdGhvdXQgbWFwcGluZ1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIC8vIFRoZXJlIGlzIG5vIG5ldyBsaW5lIGluIGJldHdlZW4uXG4gICAgICAgICAgLy8gQXNzb2NpYXRlIHRoZSBjb2RlIGJldHdlZW4gXCJsYXN0R2VuZXJhdGVkQ29sdW1uXCIgYW5kXG4gICAgICAgICAgLy8gXCJtYXBwaW5nLmdlbmVyYXRlZENvbHVtblwiIHdpdGggXCJsYXN0TWFwcGluZ1wiXG4gICAgICAgICAgdmFyIG5leHRMaW5lID0gcmVtYWluaW5nTGluZXNbcmVtYWluaW5nTGluZXNJbmRleF07XG4gICAgICAgICAgdmFyIGNvZGUgPSBuZXh0TGluZS5zdWJzdHIoMCwgbWFwcGluZy5nZW5lcmF0ZWRDb2x1bW4gLVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RHZW5lcmF0ZWRDb2x1bW4pO1xuICAgICAgICAgIHJlbWFpbmluZ0xpbmVzW3JlbWFpbmluZ0xpbmVzSW5kZXhdID0gbmV4dExpbmUuc3Vic3RyKG1hcHBpbmcuZ2VuZXJhdGVkQ29sdW1uIC1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0R2VuZXJhdGVkQ29sdW1uKTtcbiAgICAgICAgICBsYXN0R2VuZXJhdGVkQ29sdW1uID0gbWFwcGluZy5nZW5lcmF0ZWRDb2x1bW47XG4gICAgICAgICAgYWRkTWFwcGluZ1dpdGhDb2RlKGxhc3RNYXBwaW5nLCBjb2RlKTtcbiAgICAgICAgICAvLyBObyBtb3JlIHJlbWFpbmluZyBjb2RlLCBjb250aW51ZVxuICAgICAgICAgIGxhc3RNYXBwaW5nID0gbWFwcGluZztcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIC8vIFdlIGFkZCB0aGUgZ2VuZXJhdGVkIGNvZGUgdW50aWwgdGhlIGZpcnN0IG1hcHBpbmdcbiAgICAgIC8vIHRvIHRoZSBTb3VyY2VOb2RlIHdpdGhvdXQgYW55IG1hcHBpbmcuXG4gICAgICAvLyBFYWNoIGxpbmUgaXMgYWRkZWQgYXMgc2VwYXJhdGUgc3RyaW5nLlxuICAgICAgd2hpbGUgKGxhc3RHZW5lcmF0ZWRMaW5lIDwgbWFwcGluZy5nZW5lcmF0ZWRMaW5lKSB7XG4gICAgICAgIG5vZGUuYWRkKHNoaWZ0TmV4dExpbmUoKSk7XG4gICAgICAgIGxhc3RHZW5lcmF0ZWRMaW5lKys7XG4gICAgICB9XG4gICAgICBpZiAobGFzdEdlbmVyYXRlZENvbHVtbiA8IG1hcHBpbmcuZ2VuZXJhdGVkQ29sdW1uKSB7XG4gICAgICAgIHZhciBuZXh0TGluZSA9IHJlbWFpbmluZ0xpbmVzW3JlbWFpbmluZ0xpbmVzSW5kZXhdO1xuICAgICAgICBub2RlLmFkZChuZXh0TGluZS5zdWJzdHIoMCwgbWFwcGluZy5nZW5lcmF0ZWRDb2x1bW4pKTtcbiAgICAgICAgcmVtYWluaW5nTGluZXNbcmVtYWluaW5nTGluZXNJbmRleF0gPSBuZXh0TGluZS5zdWJzdHIobWFwcGluZy5nZW5lcmF0ZWRDb2x1bW4pO1xuICAgICAgICBsYXN0R2VuZXJhdGVkQ29sdW1uID0gbWFwcGluZy5nZW5lcmF0ZWRDb2x1bW47XG4gICAgICB9XG4gICAgICBsYXN0TWFwcGluZyA9IG1hcHBpbmc7XG4gICAgfSwgdGhpcyk7XG4gICAgLy8gV2UgaGF2ZSBwcm9jZXNzZWQgYWxsIG1hcHBpbmdzLlxuICAgIGlmIChyZW1haW5pbmdMaW5lc0luZGV4IDwgcmVtYWluaW5nTGluZXMubGVuZ3RoKSB7XG4gICAgICBpZiAobGFzdE1hcHBpbmcpIHtcbiAgICAgICAgLy8gQXNzb2NpYXRlIHRoZSByZW1haW5pbmcgY29kZSBpbiB0aGUgY3VycmVudCBsaW5lIHdpdGggXCJsYXN0TWFwcGluZ1wiXG4gICAgICAgIGFkZE1hcHBpbmdXaXRoQ29kZShsYXN0TWFwcGluZywgc2hpZnROZXh0TGluZSgpKTtcbiAgICAgIH1cbiAgICAgIC8vIGFuZCBhZGQgdGhlIHJlbWFpbmluZyBsaW5lcyB3aXRob3V0IGFueSBtYXBwaW5nXG4gICAgICBub2RlLmFkZChyZW1haW5pbmdMaW5lcy5zcGxpY2UocmVtYWluaW5nTGluZXNJbmRleCkuam9pbihcIlwiKSk7XG4gICAgfVxuXG4gICAgLy8gQ29weSBzb3VyY2VzQ29udGVudCBpbnRvIFNvdXJjZU5vZGVcbiAgICBhU291cmNlTWFwQ29uc3VtZXIuc291cmNlcy5mb3JFYWNoKGZ1bmN0aW9uIChzb3VyY2VGaWxlKSB7XG4gICAgICB2YXIgY29udGVudCA9IGFTb3VyY2VNYXBDb25zdW1lci5zb3VyY2VDb250ZW50Rm9yKHNvdXJjZUZpbGUpO1xuICAgICAgaWYgKGNvbnRlbnQgIT0gbnVsbCkge1xuICAgICAgICBpZiAoYVJlbGF0aXZlUGF0aCAhPSBudWxsKSB7XG4gICAgICAgICAgc291cmNlRmlsZSA9IHV0aWwuam9pbihhUmVsYXRpdmVQYXRoLCBzb3VyY2VGaWxlKTtcbiAgICAgICAgfVxuICAgICAgICBub2RlLnNldFNvdXJjZUNvbnRlbnQoc291cmNlRmlsZSwgY29udGVudCk7XG4gICAgICB9XG4gICAgfSk7XG5cbiAgICByZXR1cm4gbm9kZTtcblxuICAgIGZ1bmN0aW9uIGFkZE1hcHBpbmdXaXRoQ29kZShtYXBwaW5nLCBjb2RlKSB7XG4gICAgICBpZiAobWFwcGluZyA9PT0gbnVsbCB8fCBtYXBwaW5nLnNvdXJjZSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIG5vZGUuYWRkKGNvZGUpO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgdmFyIHNvdXJjZSA9IGFSZWxhdGl2ZVBhdGhcbiAgICAgICAgICA/IHV0aWwuam9pbihhUmVsYXRpdmVQYXRoLCBtYXBwaW5nLnNvdXJjZSlcbiAgICAgICAgICA6IG1hcHBpbmcuc291cmNlO1xuICAgICAgICBub2RlLmFkZChuZXcgU291cmNlTm9kZShtYXBwaW5nLm9yaWdpbmFsTGluZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFwcGluZy5vcmlnaW5hbENvbHVtbixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXBwaW5nLm5hbWUpKTtcbiAgICAgIH1cbiAgICB9XG4gIH07XG5cbi8qKlxuICogQWRkIGEgY2h1bmsgb2YgZ2VuZXJhdGVkIEpTIHRvIHRoaXMgc291cmNlIG5vZGUuXG4gKlxuICogQHBhcmFtIGFDaHVuayBBIHN0cmluZyBzbmlwcGV0IG9mIGdlbmVyYXRlZCBKUyBjb2RlLCBhbm90aGVyIGluc3RhbmNlIG9mXG4gKiAgICAgICAgU291cmNlTm9kZSwgb3IgYW4gYXJyYXkgd2hlcmUgZWFjaCBtZW1iZXIgaXMgb25lIG9mIHRob3NlIHRoaW5ncy5cbiAqL1xuU291cmNlTm9kZS5wcm90b3R5cGUuYWRkID0gZnVuY3Rpb24gU291cmNlTm9kZV9hZGQoYUNodW5rKSB7XG4gIGlmIChBcnJheS5pc0FycmF5KGFDaHVuaykpIHtcbiAgICBhQ2h1bmsuZm9yRWFjaChmdW5jdGlvbiAoY2h1bmspIHtcbiAgICAgIHRoaXMuYWRkKGNodW5rKTtcbiAgICB9LCB0aGlzKTtcbiAgfVxuICBlbHNlIGlmIChhQ2h1bmtbaXNTb3VyY2VOb2RlXSB8fCB0eXBlb2YgYUNodW5rID09PSBcInN0cmluZ1wiKSB7XG4gICAgaWYgKGFDaHVuaykge1xuICAgICAgdGhpcy5jaGlsZHJlbi5wdXNoKGFDaHVuayk7XG4gICAgfVxuICB9XG4gIGVsc2Uge1xuICAgIHRocm93IG5ldyBUeXBlRXJyb3IoXG4gICAgICBcIkV4cGVjdGVkIGEgU291cmNlTm9kZSwgc3RyaW5nLCBvciBhbiBhcnJheSBvZiBTb3VyY2VOb2RlcyBhbmQgc3RyaW5ncy4gR290IFwiICsgYUNodW5rXG4gICAgKTtcbiAgfVxuICByZXR1cm4gdGhpcztcbn07XG5cbi8qKlxuICogQWRkIGEgY2h1bmsgb2YgZ2VuZXJhdGVkIEpTIHRvIHRoZSBiZWdpbm5pbmcgb2YgdGhpcyBzb3VyY2Ugbm9kZS5cbiAqXG4gKiBAcGFyYW0gYUNodW5rIEEgc3RyaW5nIHNuaXBwZXQgb2YgZ2VuZXJhdGVkIEpTIGNvZGUsIGFub3RoZXIgaW5zdGFuY2Ugb2ZcbiAqICAgICAgICBTb3VyY2VOb2RlLCBvciBhbiBhcnJheSB3aGVyZSBlYWNoIG1lbWJlciBpcyBvbmUgb2YgdGhvc2UgdGhpbmdzLlxuICovXG5Tb3VyY2VOb2RlLnByb3RvdHlwZS5wcmVwZW5kID0gZnVuY3Rpb24gU291cmNlTm9kZV9wcmVwZW5kKGFDaHVuaykge1xuICBpZiAoQXJyYXkuaXNBcnJheShhQ2h1bmspKSB7XG4gICAgZm9yICh2YXIgaSA9IGFDaHVuay5sZW5ndGgtMTsgaSA+PSAwOyBpLS0pIHtcbiAgICAgIHRoaXMucHJlcGVuZChhQ2h1bmtbaV0pO1xuICAgIH1cbiAgfVxuICBlbHNlIGlmIChhQ2h1bmtbaXNTb3VyY2VOb2RlXSB8fCB0eXBlb2YgYUNodW5rID09PSBcInN0cmluZ1wiKSB7XG4gICAgdGhpcy5jaGlsZHJlbi51bnNoaWZ0KGFDaHVuayk7XG4gIH1cbiAgZWxzZSB7XG4gICAgdGhyb3cgbmV3IFR5cGVFcnJvcihcbiAgICAgIFwiRXhwZWN0ZWQgYSBTb3VyY2VOb2RlLCBzdHJpbmcsIG9yIGFuIGFycmF5IG9mIFNvdXJjZU5vZGVzIGFuZCBzdHJpbmdzLiBHb3QgXCIgKyBhQ2h1bmtcbiAgICApO1xuICB9XG4gIHJldHVybiB0aGlzO1xufTtcblxuLyoqXG4gKiBXYWxrIG92ZXIgdGhlIHRyZWUgb2YgSlMgc25pcHBldHMgaW4gdGhpcyBub2RlIGFuZCBpdHMgY2hpbGRyZW4uIFRoZVxuICogd2Fsa2luZyBmdW5jdGlvbiBpcyBjYWxsZWQgb25jZSBmb3IgZWFjaCBzbmlwcGV0IG9mIEpTIGFuZCBpcyBwYXNzZWQgdGhhdFxuICogc25pcHBldCBhbmQgdGhlIGl0cyBvcmlnaW5hbCBhc3NvY2lhdGVkIHNvdXJjZSdzIGxpbmUvY29sdW1uIGxvY2F0aW9uLlxuICpcbiAqIEBwYXJhbSBhRm4gVGhlIHRyYXZlcnNhbCBmdW5jdGlvbi5cbiAqL1xuU291cmNlTm9kZS5wcm90b3R5cGUud2FsayA9IGZ1bmN0aW9uIFNvdXJjZU5vZGVfd2FsayhhRm4pIHtcbiAgdmFyIGNodW5rO1xuICBmb3IgKHZhciBpID0gMCwgbGVuID0gdGhpcy5jaGlsZHJlbi5sZW5ndGg7IGkgPCBsZW47IGkrKykge1xuICAgIGNodW5rID0gdGhpcy5jaGlsZHJlbltpXTtcbiAgICBpZiAoY2h1bmtbaXNTb3VyY2VOb2RlXSkge1xuICAgICAgY2h1bmsud2FsayhhRm4pO1xuICAgIH1cbiAgICBlbHNlIHtcbiAgICAgIGlmIChjaHVuayAhPT0gJycpIHtcbiAgICAgICAgYUZuKGNodW5rLCB7IHNvdXJjZTogdGhpcy5zb3VyY2UsXG4gICAgICAgICAgICAgICAgICAgICBsaW5lOiB0aGlzLmxpbmUsXG4gICAgICAgICAgICAgICAgICAgICBjb2x1bW46IHRoaXMuY29sdW1uLFxuICAgICAgICAgICAgICAgICAgICAgbmFtZTogdGhpcy5uYW1lIH0pO1xuICAgICAgfVxuICAgIH1cbiAgfVxufTtcblxuLyoqXG4gKiBMaWtlIGBTdHJpbmcucHJvdG90eXBlLmpvaW5gIGV4Y2VwdCBmb3IgU291cmNlTm9kZXMuIEluc2VydHMgYGFTdHJgIGJldHdlZW5cbiAqIGVhY2ggb2YgYHRoaXMuY2hpbGRyZW5gLlxuICpcbiAqIEBwYXJhbSBhU2VwIFRoZSBzZXBhcmF0b3IuXG4gKi9cblNvdXJjZU5vZGUucHJvdG90eXBlLmpvaW4gPSBmdW5jdGlvbiBTb3VyY2VOb2RlX2pvaW4oYVNlcCkge1xuICB2YXIgbmV3Q2hpbGRyZW47XG4gIHZhciBpO1xuICB2YXIgbGVuID0gdGhpcy5jaGlsZHJlbi5sZW5ndGg7XG4gIGlmIChsZW4gPiAwKSB7XG4gICAgbmV3Q2hpbGRyZW4gPSBbXTtcbiAgICBmb3IgKGkgPSAwOyBpIDwgbGVuLTE7IGkrKykge1xuICAgICAgbmV3Q2hpbGRyZW4ucHVzaCh0aGlzLmNoaWxkcmVuW2ldKTtcbiAgICAgIG5ld0NoaWxkcmVuLnB1c2goYVNlcCk7XG4gICAgfVxuICAgIG5ld0NoaWxkcmVuLnB1c2godGhpcy5jaGlsZHJlbltpXSk7XG4gICAgdGhpcy5jaGlsZHJlbiA9IG5ld0NoaWxkcmVuO1xuICB9XG4gIHJldHVybiB0aGlzO1xufTtcblxuLyoqXG4gKiBDYWxsIFN0cmluZy5wcm90b3R5cGUucmVwbGFjZSBvbiB0aGUgdmVyeSByaWdodC1tb3N0IHNvdXJjZSBzbmlwcGV0LiBVc2VmdWxcbiAqIGZvciB0cmltbWluZyB3aGl0ZXNwYWNlIGZyb20gdGhlIGVuZCBvZiBhIHNvdXJjZSBub2RlLCBldGMuXG4gKlxuICogQHBhcmFtIGFQYXR0ZXJuIFRoZSBwYXR0ZXJuIHRvIHJlcGxhY2UuXG4gKiBAcGFyYW0gYVJlcGxhY2VtZW50IFRoZSB0aGluZyB0byByZXBsYWNlIHRoZSBwYXR0ZXJuIHdpdGguXG4gKi9cblNvdXJjZU5vZGUucHJvdG90eXBlLnJlcGxhY2VSaWdodCA9IGZ1bmN0aW9uIFNvdXJjZU5vZGVfcmVwbGFjZVJpZ2h0KGFQYXR0ZXJuLCBhUmVwbGFjZW1lbnQpIHtcbiAgdmFyIGxhc3RDaGlsZCA9IHRoaXMuY2hpbGRyZW5bdGhpcy5jaGlsZHJlbi5sZW5ndGggLSAxXTtcbiAgaWYgKGxhc3RDaGlsZFtpc1NvdXJjZU5vZGVdKSB7XG4gICAgbGFzdENoaWxkLnJlcGxhY2VSaWdodChhUGF0dGVybiwgYVJlcGxhY2VtZW50KTtcbiAgfVxuICBlbHNlIGlmICh0eXBlb2YgbGFzdENoaWxkID09PSAnc3RyaW5nJykge1xuICAgIHRoaXMuY2hpbGRyZW5bdGhpcy5jaGlsZHJlbi5sZW5ndGggLSAxXSA9IGxhc3RDaGlsZC5yZXBsYWNlKGFQYXR0ZXJuLCBhUmVwbGFjZW1lbnQpO1xuICB9XG4gIGVsc2Uge1xuICAgIHRoaXMuY2hpbGRyZW4ucHVzaCgnJy5yZXBsYWNlKGFQYXR0ZXJuLCBhUmVwbGFjZW1lbnQpKTtcbiAgfVxuICByZXR1cm4gdGhpcztcbn07XG5cbi8qKlxuICogU2V0IHRoZSBzb3VyY2UgY29udGVudCBmb3IgYSBzb3VyY2UgZmlsZS4gVGhpcyB3aWxsIGJlIGFkZGVkIHRvIHRoZSBTb3VyY2VNYXBHZW5lcmF0b3JcbiAqIGluIHRoZSBzb3VyY2VzQ29udGVudCBmaWVsZC5cbiAqXG4gKiBAcGFyYW0gYVNvdXJjZUZpbGUgVGhlIGZpbGVuYW1lIG9mIHRoZSBzb3VyY2UgZmlsZVxuICogQHBhcmFtIGFTb3VyY2VDb250ZW50IFRoZSBjb250ZW50IG9mIHRoZSBzb3VyY2UgZmlsZVxuICovXG5Tb3VyY2VOb2RlLnByb3RvdHlwZS5zZXRTb3VyY2VDb250ZW50ID1cbiAgZnVuY3Rpb24gU291cmNlTm9kZV9zZXRTb3VyY2VDb250ZW50KGFTb3VyY2VGaWxlLCBhU291cmNlQ29udGVudCkge1xuICAgIHRoaXMuc291cmNlQ29udGVudHNbdXRpbC50b1NldFN0cmluZyhhU291cmNlRmlsZSldID0gYVNvdXJjZUNvbnRlbnQ7XG4gIH07XG5cbi8qKlxuICogV2FsayBvdmVyIHRoZSB0cmVlIG9mIFNvdXJjZU5vZGVzLiBUaGUgd2Fsa2luZyBmdW5jdGlvbiBpcyBjYWxsZWQgZm9yIGVhY2hcbiAqIHNvdXJjZSBmaWxlIGNvbnRlbnQgYW5kIGlzIHBhc3NlZCB0aGUgZmlsZW5hbWUgYW5kIHNvdXJjZSBjb250ZW50LlxuICpcbiAqIEBwYXJhbSBhRm4gVGhlIHRyYXZlcnNhbCBmdW5jdGlvbi5cbiAqL1xuU291cmNlTm9kZS5wcm90b3R5cGUud2Fsa1NvdXJjZUNvbnRlbnRzID1cbiAgZnVuY3Rpb24gU291cmNlTm9kZV93YWxrU291cmNlQ29udGVudHMoYUZuKSB7XG4gICAgZm9yICh2YXIgaSA9IDAsIGxlbiA9IHRoaXMuY2hpbGRyZW4ubGVuZ3RoOyBpIDwgbGVuOyBpKyspIHtcbiAgICAgIGlmICh0aGlzLmNoaWxkcmVuW2ldW2lzU291cmNlTm9kZV0pIHtcbiAgICAgICAgdGhpcy5jaGlsZHJlbltpXS53YWxrU291cmNlQ29udGVudHMoYUZuKTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICB2YXIgc291cmNlcyA9IE9iamVjdC5rZXlzKHRoaXMuc291cmNlQ29udGVudHMpO1xuICAgIGZvciAodmFyIGkgPSAwLCBsZW4gPSBzb3VyY2VzLmxlbmd0aDsgaSA8IGxlbjsgaSsrKSB7XG4gICAgICBhRm4odXRpbC5mcm9tU2V0U3RyaW5nKHNvdXJjZXNbaV0pLCB0aGlzLnNvdXJjZUNvbnRlbnRzW3NvdXJjZXNbaV1dKTtcbiAgICB9XG4gIH07XG5cbi8qKlxuICogUmV0dXJuIHRoZSBzdHJpbmcgcmVwcmVzZW50YXRpb24gb2YgdGhpcyBzb3VyY2Ugbm9kZS4gV2Fsa3Mgb3ZlciB0aGUgdHJlZVxuICogYW5kIGNvbmNhdGVuYXRlcyBhbGwgdGhlIHZhcmlvdXMgc25pcHBldHMgdG9nZXRoZXIgdG8gb25lIHN0cmluZy5cbiAqL1xuU291cmNlTm9kZS5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiBTb3VyY2VOb2RlX3RvU3RyaW5nKCkge1xuICB2YXIgc3RyID0gXCJcIjtcbiAgdGhpcy53YWxrKGZ1bmN0aW9uIChjaHVuaykge1xuICAgIHN0ciArPSBjaHVuaztcbiAgfSk7XG4gIHJldHVybiBzdHI7XG59O1xuXG4vKipcbiAqIFJldHVybnMgdGhlIHN0cmluZyByZXByZXNlbnRhdGlvbiBvZiB0aGlzIHNvdXJjZSBub2RlIGFsb25nIHdpdGggYSBzb3VyY2VcbiAqIG1hcC5cbiAqL1xuU291cmNlTm9kZS5wcm90b3R5cGUudG9TdHJpbmdXaXRoU291cmNlTWFwID0gZnVuY3Rpb24gU291cmNlTm9kZV90b1N0cmluZ1dpdGhTb3VyY2VNYXAoYUFyZ3MpIHtcbiAgdmFyIGdlbmVyYXRlZCA9IHtcbiAgICBjb2RlOiBcIlwiLFxuICAgIGxpbmU6IDEsXG4gICAgY29sdW1uOiAwXG4gIH07XG4gIHZhciBtYXAgPSBuZXcgU291cmNlTWFwR2VuZXJhdG9yKGFBcmdzKTtcbiAgdmFyIHNvdXJjZU1hcHBpbmdBY3RpdmUgPSBmYWxzZTtcbiAgdmFyIGxhc3RPcmlnaW5hbFNvdXJjZSA9IG51bGw7XG4gIHZhciBsYXN0T3JpZ2luYWxMaW5lID0gbnVsbDtcbiAgdmFyIGxhc3RPcmlnaW5hbENvbHVtbiA9IG51bGw7XG4gIHZhciBsYXN0T3JpZ2luYWxOYW1lID0gbnVsbDtcbiAgdGhpcy53YWxrKGZ1bmN0aW9uIChjaHVuaywgb3JpZ2luYWwpIHtcbiAgICBnZW5lcmF0ZWQuY29kZSArPSBjaHVuaztcbiAgICBpZiAob3JpZ2luYWwuc291cmNlICE9PSBudWxsXG4gICAgICAgICYmIG9yaWdpbmFsLmxpbmUgIT09IG51bGxcbiAgICAgICAgJiYgb3JpZ2luYWwuY29sdW1uICE9PSBudWxsKSB7XG4gICAgICBpZihsYXN0T3JpZ2luYWxTb3VyY2UgIT09IG9yaWdpbmFsLnNvdXJjZVxuICAgICAgICAgfHwgbGFzdE9yaWdpbmFsTGluZSAhPT0gb3JpZ2luYWwubGluZVxuICAgICAgICAgfHwgbGFzdE9yaWdpbmFsQ29sdW1uICE9PSBvcmlnaW5hbC5jb2x1bW5cbiAgICAgICAgIHx8IGxhc3RPcmlnaW5hbE5hbWUgIT09IG9yaWdpbmFsLm5hbWUpIHtcbiAgICAgICAgbWFwLmFkZE1hcHBpbmcoe1xuICAgICAgICAgIHNvdXJjZTogb3JpZ2luYWwuc291cmNlLFxuICAgICAgICAgIG9yaWdpbmFsOiB7XG4gICAgICAgICAgICBsaW5lOiBvcmlnaW5hbC5saW5lLFxuICAgICAgICAgICAgY29sdW1uOiBvcmlnaW5hbC5jb2x1bW5cbiAgICAgICAgICB9LFxuICAgICAgICAgIGdlbmVyYXRlZDoge1xuICAgICAgICAgICAgbGluZTogZ2VuZXJhdGVkLmxpbmUsXG4gICAgICAgICAgICBjb2x1bW46IGdlbmVyYXRlZC5jb2x1bW5cbiAgICAgICAgICB9LFxuICAgICAgICAgIG5hbWU6IG9yaWdpbmFsLm5hbWVcbiAgICAgICAgfSk7XG4gICAgICB9XG4gICAgICBsYXN0T3JpZ2luYWxTb3VyY2UgPSBvcmlnaW5hbC5zb3VyY2U7XG4gICAgICBsYXN0T3JpZ2luYWxMaW5lID0gb3JpZ2luYWwubGluZTtcbiAgICAgIGxhc3RPcmlnaW5hbENvbHVtbiA9IG9yaWdpbmFsLmNvbHVtbjtcbiAgICAgIGxhc3RPcmlnaW5hbE5hbWUgPSBvcmlnaW5hbC5uYW1lO1xuICAgICAgc291cmNlTWFwcGluZ0FjdGl2ZSA9IHRydWU7XG4gICAgfSBlbHNlIGlmIChzb3VyY2VNYXBwaW5nQWN0aXZlKSB7XG4gICAgICBtYXAuYWRkTWFwcGluZyh7XG4gICAgICAgIGdlbmVyYXRlZDoge1xuICAgICAgICAgIGxpbmU6IGdlbmVyYXRlZC5saW5lLFxuICAgICAgICAgIGNvbHVtbjogZ2VuZXJhdGVkLmNvbHVtblxuICAgICAgICB9XG4gICAgICB9KTtcbiAgICAgIGxhc3RPcmlnaW5hbFNvdXJjZSA9IG51bGw7XG4gICAgICBzb3VyY2VNYXBwaW5nQWN0aXZlID0gZmFsc2U7XG4gICAgfVxuICAgIGZvciAodmFyIGlkeCA9IDAsIGxlbmd0aCA9IGNodW5rLmxlbmd0aDsgaWR4IDwgbGVuZ3RoOyBpZHgrKykge1xuICAgICAgaWYgKGNodW5rLmNoYXJDb2RlQXQoaWR4KSA9PT0gTkVXTElORV9DT0RFKSB7XG4gICAgICAgIGdlbmVyYXRlZC5saW5lKys7XG4gICAgICAgIGdlbmVyYXRlZC5jb2x1bW4gPSAwO1xuICAgICAgICAvLyBNYXBwaW5ncyBlbmQgYXQgZW9sXG4gICAgICAgIGlmIChpZHggKyAxID09PSBsZW5ndGgpIHtcbiAgICAgICAgICBsYXN0T3JpZ2luYWxTb3VyY2UgPSBudWxsO1xuICAgICAgICAgIHNvdXJjZU1hcHBpbmdBY3RpdmUgPSBmYWxzZTtcbiAgICAgICAgfSBlbHNlIGlmIChzb3VyY2VNYXBwaW5nQWN0aXZlKSB7XG4gICAgICAgICAgbWFwLmFkZE1hcHBpbmcoe1xuICAgICAgICAgICAgc291cmNlOiBvcmlnaW5hbC5zb3VyY2UsXG4gICAgICAgICAgICBvcmlnaW5hbDoge1xuICAgICAgICAgICAgICBsaW5lOiBvcmlnaW5hbC5saW5lLFxuICAgICAgICAgICAgICBjb2x1bW46IG9yaWdpbmFsLmNvbHVtblxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGdlbmVyYXRlZDoge1xuICAgICAgICAgICAgICBsaW5lOiBnZW5lcmF0ZWQubGluZSxcbiAgICAgICAgICAgICAgY29sdW1uOiBnZW5lcmF0ZWQuY29sdW1uXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgbmFtZTogb3JpZ2luYWwubmFtZVxuICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBnZW5lcmF0ZWQuY29sdW1uKys7XG4gICAgICB9XG4gICAgfVxuICB9KTtcbiAgdGhpcy53YWxrU291cmNlQ29udGVudHMoZnVuY3Rpb24gKHNvdXJjZUZpbGUsIHNvdXJjZUNvbnRlbnQpIHtcbiAgICBtYXAuc2V0U291cmNlQ29udGVudChzb3VyY2VGaWxlLCBzb3VyY2VDb250ZW50KTtcbiAgfSk7XG5cbiAgcmV0dXJuIHsgY29kZTogZ2VuZXJhdGVkLmNvZGUsIG1hcDogbWFwIH07XG59O1xuXG5leHBvcnRzLlNvdXJjZU5vZGUgPSBTb3VyY2VOb2RlO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvc291cmNlLW5vZGUuanNcbi8vIG1vZHVsZSBpZCA9IDEwXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file diff --git a/node_modules/snapdragon/node_modules/source-map/dist/source-map.js b/node_modules/snapdragon/node_modules/source-map/dist/source-map.js new file mode 100644 index 0000000..4e630e2 --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/dist/source-map.js @@ -0,0 +1,3090 @@ +(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) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!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 = Object.create(null); + } + 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) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + 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 next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + 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 consecutive 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; + + var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); + }()); + + function identity (s) { + return s; + } + + /** + * 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) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; + } + exports.toSetString = supportsNullProto ? identity : toSetString; + + function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; + } + exports.fromSetString = supportsNullProto ? identity : fromSetString; + + function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; + } + + /** + * 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); + var has = Object.prototype.hasOwnProperty; + var hasNativeMap = typeof Map !== "undefined"; + + /** + * 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 = hasNativeMap ? new Map() : Object.create(null); + } + + /** + * 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 hasNativeMap ? this._set.size : 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 = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } + }; + + /** + * Is the given string a member of this set? + * + * @param String aStr + */ + ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } + }; + + /** + * What is the index of the given string in the array? + * + * @param String aStr + */ + ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, 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 + .map(String) + // 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.map(String), 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 accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // 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[remainingLinesIndex]; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = 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[remainingLinesIndex]; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + 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.splice(remainingLinesIndex).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/node_modules/snapdragon/node_modules/source-map/dist/source-map.min.js b/node_modules/snapdragon/node_modules/source-map/dist/source-map.min.js new file mode 100644 index 0000000..f2a46bd --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/dist/source-map.min.js @@ -0,0 +1,2 @@ +!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&&(t=String(t),this._sources.has(t)||this._sources.add(t)),null!=o&&(o=String(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=Object.create(null)),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(n&&"number"!=typeof n.line&&"number"!=typeof n.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");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,s=0,a=1,u=0,l=0,c=0,g=0,p="",h=this._mappings.toArray(),f=0,d=h.length;f0){if(!i.compareByGeneratedPositionsInflated(n,h[f-1]))continue;e+=","}e+=o.encode(n.generatedColumn-s),s=n.generatedColumn,null!=n.source&&(t=this._sources.indexOf(n.source),e+=o.encode(t-g),g=t,e+=o.encode(n.originalLine-1-l),l=n.originalLine-1,e+=o.encode(n.originalColumn-u),u=n.originalColumn,null!=n.name&&(r=this._names.indexOf(n.name),e+=o.encode(r-c),c=r)),p+=e}return p},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 e<0?(-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++)),a===-1)throw new Error("Invalid base64 digit: "+e.charAt(n-1));t=!!(a&l),a&=u,g+=a<=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(_))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(t<0)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 g(e)?"$"+e:e}function c(e){return g(e)?e.slice(1):e}function g(e){if(!e)return!1;var n=e.length;if(n<9)return!1;if(95!==e.charCodeAt(n-1)||95!==e.charCodeAt(n-2)||111!==e.charCodeAt(n-3)||116!==e.charCodeAt(n-4)||111!==e.charCodeAt(n-5)||114!==e.charCodeAt(n-6)||112!==e.charCodeAt(n-7)||95!==e.charCodeAt(n-8)||95!==e.charCodeAt(n-9))return!1;for(var r=n-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function p(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 h(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 f(e,n){return e===n?0:e>n?1:-1}function d(e,n){var r=e.generatedLine-n.generatedLine;return 0!==r?r:(r=e.generatedColumn-n.generatedColumn,0!==r?r:(r=f(e.source,n.source),0!==r?r:(r=e.originalLine-n.originalLine,0!==r?r:(r=e.originalColumn-n.originalColumn,0!==r?r:f(e.name,n.name)))))}n.getArg=r;var m=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,_=/^data:.+\,.+$/;n.urlParse=t,n.urlGenerate=o,n.normalize=i,n.join=s,n.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(m)},n.relative=a;var v=function(){var e=Object.create(null);return!("__proto__"in e)}();n.toSetString=v?u:l,n.fromSetString=v?u:c,n.compareByOriginalPositions=p,n.compareByGeneratedPositionsDeflated=h,n.compareByGeneratedPositionsInflated=d},function(e,n,r){function t(){this._array=[],this._set=s?new Map:Object.create(null)}var o=r(4),i=Object.prototype.hasOwnProperty,s="undefined"!=typeof Map;t.fromArray=function(e,n){for(var r=new t,o=0,i=e.length;o=0)return n}else{var r=o.toSetString(e);if(i.call(this._set,r))return this._set[r]}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(String).map(a.normalize).map(function(e){return i&&a.isAbsolute(i)&&a.isAbsolute(e)?a.relative(i,e):e}),this._names=l.fromArray(o.map(String),!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;p1&&(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}))},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:e<0?-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(s<0)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(i=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;r0){for(n=[],r=0;r 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\tSourceMapGenerator.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 next;\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 next = ''\n\t\n\t if (mapping.generatedLine !== previousGeneratedLine) {\n\t previousGeneratedColumn = 0;\n\t while (mapping.generatedLine !== previousGeneratedLine) {\n\t next += ';';\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 next += ',';\n\t }\n\t }\n\t\n\t next += 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 next += base64VLQ.encode(sourceIdx - previousSource);\n\t previousSource = sourceIdx;\n\t\n\t // lines are stored 0-based in SourceMap spec version 3\n\t next += base64VLQ.encode(mapping.originalLine - 1\n\t - previousOriginalLine);\n\t previousOriginalLine = mapping.originalLine - 1;\n\t\n\t next += 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 next += base64VLQ.encode(nameIdx - previousName);\n\t previousName = nameIdx;\n\t }\n\t }\n\t\n\t result += next;\n\t }\n\t\n\t return result;\n\t };\n\t\n\tSourceMapGenerator.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, 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\tSourceMapGenerator.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\tSourceMapGenerator.prototype.toString =\n\t function SourceMapGenerator_toString() {\n\t return JSON.stringify(this.toJSON());\n\t };\n\t\n\texports.SourceMapGenerator = SourceMapGenerator;\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\tvar 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\tvar VLQ_BASE_SHIFT = 5;\n\t\n\t// binary: 100000\n\tvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\t\n\t// binary: 011111\n\tvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\t\n\t// binary: 100000\n\tvar 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\tfunction 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\tfunction 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\texports.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\texports.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\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\tvar 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\texports.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\texports.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\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\tfunction 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\texports.getArg = getArg;\n\t\n\tvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.]*)(?::(\\d+))?(\\S*)$/;\n\tvar dataUrlRegexp = /^data:.+\\,.+$/;\n\t\n\tfunction 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\texports.urlParse = urlParse;\n\t\n\tfunction 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\texports.urlGenerate = urlGenerate;\n\t\n\t/**\n\t * Normalizes a path, or the path portion of a URL:\n\t *\n\t * - Replaces consecutive 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\tfunction 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\texports.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\tfunction 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\texports.join = join;\n\t\n\texports.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\tfunction 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\texports.relative = relative;\n\t\n\tvar supportsNullProto = (function () {\n\t var obj = Object.create(null);\n\t return !('__proto__' in obj);\n\t}());\n\t\n\tfunction identity (s) {\n\t return s;\n\t}\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\tfunction toSetString(aStr) {\n\t if (isProtoString(aStr)) {\n\t return '$' + aStr;\n\t }\n\t\n\t return aStr;\n\t}\n\texports.toSetString = supportsNullProto ? identity : toSetString;\n\t\n\tfunction fromSetString(aStr) {\n\t if (isProtoString(aStr)) {\n\t return aStr.slice(1);\n\t }\n\t\n\t return aStr;\n\t}\n\texports.fromSetString = supportsNullProto ? identity : fromSetString;\n\t\n\tfunction isProtoString(s) {\n\t if (!s) {\n\t return false;\n\t }\n\t\n\t var length = s.length;\n\t\n\t if (length < 9 /* \"__proto__\".length */) {\n\t return false;\n\t }\n\t\n\t if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n\t s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n\t s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n\t s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n\t s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n\t s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 9) !== 95 /* '_' */) {\n\t return false;\n\t }\n\t\n\t for (var i = length - 10; i >= 0; i--) {\n\t if (s.charCodeAt(i) !== 36 /* '$' */) {\n\t return false;\n\t }\n\t }\n\t\n\t return true;\n\t}\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\tfunction 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\texports.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\tfunction 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\texports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\t\n\tfunction 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\tfunction 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\texports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\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\tvar util = __webpack_require__(4);\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar hasNativeMap = typeof Map !== \"undefined\";\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\tfunction ArraySet() {\n\t this._array = [];\n\t this._set = hasNativeMap ? new Map() : Object.create(null);\n\t}\n\t\n\t/**\n\t * Static method for creating ArraySet instances from an existing array.\n\t */\n\tArraySet.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\tArraySet.prototype.size = function ArraySet_size() {\n\t return hasNativeMap ? this._set.size : 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\tArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n\t var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n\t var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, 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 if (hasNativeMap) {\n\t this._set.set(aStr, idx);\n\t } else {\n\t this._set[sStr] = idx;\n\t }\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\tArraySet.prototype.has = function ArraySet_has(aStr) {\n\t if (hasNativeMap) {\n\t return this._set.has(aStr);\n\t } else {\n\t var sStr = util.toSetString(aStr);\n\t return has.call(this._set, sStr);\n\t }\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\tArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n\t if (hasNativeMap) {\n\t var idx = this._set.get(aStr);\n\t if (idx >= 0) {\n\t return idx;\n\t }\n\t } else {\n\t var sStr = util.toSetString(aStr);\n\t if (has.call(this._set, sStr)) {\n\t return this._set[sStr];\n\t }\n\t }\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\tArraySet.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\tArraySet.prototype.toArray = function ArraySet_toArray() {\n\t return this._array.slice();\n\t};\n\t\n\texports.ArraySet = ArraySet;\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\tvar 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\tfunction 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\tfunction 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\tMappingList.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\tMappingList.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\tMappingList.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\texports.MappingList = MappingList;\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\tvar util = __webpack_require__(4);\n\tvar binarySearch = __webpack_require__(8);\n\tvar ArraySet = __webpack_require__(5).ArraySet;\n\tvar base64VLQ = __webpack_require__(2);\n\tvar quickSort = __webpack_require__(9).quickSort;\n\t\n\tfunction 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\tSourceMapConsumer.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\tSourceMapConsumer.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\tSourceMapConsumer.prototype.__generatedMappings = null;\n\tObject.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\tSourceMapConsumer.prototype.__originalMappings = null;\n\tObject.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\tSourceMapConsumer.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\tSourceMapConsumer.prototype._parseMappings =\n\t function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t throw new Error(\"Subclasses must implement _parseMappings\");\n\t };\n\t\n\tSourceMapConsumer.GENERATED_ORDER = 1;\n\tSourceMapConsumer.ORIGINAL_ORDER = 2;\n\t\n\tSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\n\tSourceMapConsumer.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\tSourceMapConsumer.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\tSourceMapConsumer.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\texports.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\tfunction 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 .map(String)\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.map(String), 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\tBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.prototype._version = 3;\n\t\n\t/**\n\t * The list of original sources.\n\t */\n\tObject.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\tfunction 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\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.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\texports.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\tfunction 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\tIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n\tIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\t\n\t/**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\tIndexedSourceMapConsumer.prototype._version = 3;\n\t\n\t/**\n\t * The list of original sources.\n\t */\n\tObject.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\tIndexedSourceMapConsumer.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\tIndexedSourceMapConsumer.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\tIndexedSourceMapConsumer.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\tIndexedSourceMapConsumer.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\tIndexedSourceMapConsumer.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\texports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\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\texports.GREATEST_LOWER_BOUND = 1;\n\texports.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\tfunction 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\texports.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\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\tfunction 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\tfunction 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\tfunction 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\texports.quickSort = function (ary, comparator) {\n\t doQuickSort(ary, comparator, 0, ary.length - 1);\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\tvar SourceMapGenerator = __webpack_require__(1).SourceMapGenerator;\n\tvar 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\tvar REGEX_NEWLINE = /(\\r?\\n)/;\n\t\n\t// Newline character code for charCodeAt() comparisons\n\tvar 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\tvar 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\tfunction 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\tSourceNode.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 accessed by calling `shiftNextLine`.\n\t var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n\t var remainingLinesIndex = 0;\n\t var shiftNextLine = function() {\n\t var lineContents = getNextLine();\n\t // The last line of a file might not have a newline.\n\t var newLine = getNextLine() || \"\";\n\t return lineContents + newLine;\n\t\n\t function getNextLine() {\n\t return remainingLinesIndex < remainingLines.length ?\n\t remainingLines[remainingLinesIndex++] : undefined;\n\t }\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[remainingLinesIndex];\n\t var code = nextLine.substr(0, mapping.generatedColumn -\n\t lastGeneratedColumn);\n\t remainingLines[remainingLinesIndex] = 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[remainingLinesIndex];\n\t node.add(nextLine.substr(0, mapping.generatedColumn));\n\t remainingLines[remainingLinesIndex] = 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 (remainingLinesIndex < remainingLines.length) {\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.splice(remainingLinesIndex).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\tSourceNode.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\tSourceNode.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\tSourceNode.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\tSourceNode.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\tSourceNode.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\tSourceNode.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\tSourceNode.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\tSourceNode.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\tSourceNode.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\texports.SourceNode = SourceNode;\n\n\n/***/ })\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// source-map.min.js"," \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 42c329f865e32e011afb","/*\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","/* -*- 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\nvar base64VLQ = require('./base64-vlq');\nvar util = require('./util');\nvar ArraySet = require('./array-set').ArraySet;\nvar 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 */\nfunction 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\nSourceMapGenerator.prototype._version = 3;\n\n/**\n * Creates a new SourceMapGenerator based on a SourceMapConsumer\n *\n * @param aSourceMapConsumer The SourceMap.\n */\nSourceMapGenerator.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 */\nSourceMapGenerator.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) {\n source = String(source);\n if (!this._sources.has(source)) {\n this._sources.add(source);\n }\n }\n\n if (name != null) {\n name = String(name);\n if (!this._names.has(name)) {\n this._names.add(name);\n }\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 */\nSourceMapGenerator.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 = Object.create(null);\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 */\nSourceMapGenerator.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 */\nSourceMapGenerator.prototype._validateMapping =\n function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,\n aName) {\n // When aOriginal is truthy but has empty values for .line and .column,\n // it is most likely a programmer error. In this case we throw a very\n // specific error message to try to guide them the right way.\n // For example: https://github.com/Polymer/polymer-bundler/pull/519\n if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {\n throw new Error(\n 'original.line and original.column are not numbers -- you probably meant to omit ' +\n 'the original mapping entirely and only map the generated position. If so, pass ' +\n 'null for the original mapping instead of an object with empty or null values.'\n );\n }\n\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 */\nSourceMapGenerator.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 next;\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 next = ''\n\n if (mapping.generatedLine !== previousGeneratedLine) {\n previousGeneratedColumn = 0;\n while (mapping.generatedLine !== previousGeneratedLine) {\n next += ';';\n previousGeneratedLine++;\n }\n }\n else {\n if (i > 0) {\n if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n continue;\n }\n next += ',';\n }\n }\n\n next += base64VLQ.encode(mapping.generatedColumn\n - previousGeneratedColumn);\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (mapping.source != null) {\n sourceIdx = this._sources.indexOf(mapping.source);\n next += base64VLQ.encode(sourceIdx - previousSource);\n previousSource = sourceIdx;\n\n // lines are stored 0-based in SourceMap spec version 3\n next += base64VLQ.encode(mapping.originalLine - 1\n - previousOriginalLine);\n previousOriginalLine = mapping.originalLine - 1;\n\n next += base64VLQ.encode(mapping.originalColumn\n - previousOriginalColumn);\n previousOriginalColumn = mapping.originalColumn;\n\n if (mapping.name != null) {\n nameIdx = this._names.indexOf(mapping.name);\n next += base64VLQ.encode(nameIdx - previousName);\n previousName = nameIdx;\n }\n }\n\n result += next;\n }\n\n return result;\n };\n\nSourceMapGenerator.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, key)\n ? this._sourcesContents[key]\n : null;\n }, this);\n };\n\n/**\n * Externalize the source map.\n */\nSourceMapGenerator.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 */\nSourceMapGenerator.prototype.toString =\n function SourceMapGenerator_toString() {\n return JSON.stringify(this.toJSON());\n };\n\nexports.SourceMapGenerator = SourceMapGenerator;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-map-generator.js\n// module id = 1\n// module chunks = 0","/* -*- 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\nvar 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\nvar VLQ_BASE_SHIFT = 5;\n\n// binary: 100000\nvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\n// binary: 011111\nvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\n// binary: 100000\nvar 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 */\nfunction 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 */\nfunction 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 */\nexports.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 */\nexports.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// WEBPACK FOOTER\n// ./lib/base64-vlq.js\n// module id = 2\n// module chunks = 0","/* -*- 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\nvar intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\n/**\n * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n */\nexports.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 */\nexports.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// WEBPACK FOOTER\n// ./lib/base64.js\n// module id = 3\n// module chunks = 0","/* -*- 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 */\nfunction 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}\nexports.getArg = getArg;\n\nvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.]*)(?::(\\d+))?(\\S*)$/;\nvar dataUrlRegexp = /^data:.+\\,.+$/;\n\nfunction 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}\nexports.urlParse = urlParse;\n\nfunction 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}\nexports.urlGenerate = urlGenerate;\n\n/**\n * Normalizes a path, or the path portion of a URL:\n *\n * - Replaces consecutive 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 */\nfunction 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}\nexports.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 */\nfunction 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}\nexports.join = join;\n\nexports.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 */\nfunction 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}\nexports.relative = relative;\n\nvar supportsNullProto = (function () {\n var obj = Object.create(null);\n return !('__proto__' in obj);\n}());\n\nfunction identity (s) {\n return s;\n}\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 */\nfunction toSetString(aStr) {\n if (isProtoString(aStr)) {\n return '$' + aStr;\n }\n\n return aStr;\n}\nexports.toSetString = supportsNullProto ? identity : toSetString;\n\nfunction fromSetString(aStr) {\n if (isProtoString(aStr)) {\n return aStr.slice(1);\n }\n\n return aStr;\n}\nexports.fromSetString = supportsNullProto ? identity : fromSetString;\n\nfunction isProtoString(s) {\n if (!s) {\n return false;\n }\n\n var length = s.length;\n\n if (length < 9 /* \"__proto__\".length */) {\n return false;\n }\n\n if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n s.charCodeAt(length - 9) !== 95 /* '_' */) {\n return false;\n }\n\n for (var i = length - 10; i >= 0; i--) {\n if (s.charCodeAt(i) !== 36 /* '$' */) {\n return false;\n }\n }\n\n return true;\n}\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 */\nfunction 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}\nexports.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 */\nfunction 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}\nexports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\nfunction 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 */\nfunction 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}\nexports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/util.js\n// module id = 4\n// module chunks = 0","/* -*- 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\nvar util = require('./util');\nvar has = Object.prototype.hasOwnProperty;\nvar hasNativeMap = typeof Map !== \"undefined\";\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 */\nfunction ArraySet() {\n this._array = [];\n this._set = hasNativeMap ? new Map() : Object.create(null);\n}\n\n/**\n * Static method for creating ArraySet instances from an existing array.\n */\nArraySet.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 */\nArraySet.prototype.size = function ArraySet_size() {\n return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;\n};\n\n/**\n * Add the given string to this set.\n *\n * @param String aStr\n */\nArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);\n var idx = this._array.length;\n if (!isDuplicate || aAllowDuplicates) {\n this._array.push(aStr);\n }\n if (!isDuplicate) {\n if (hasNativeMap) {\n this._set.set(aStr, idx);\n } else {\n this._set[sStr] = idx;\n }\n }\n};\n\n/**\n * Is the given string a member of this set?\n *\n * @param String aStr\n */\nArraySet.prototype.has = function ArraySet_has(aStr) {\n if (hasNativeMap) {\n return this._set.has(aStr);\n } else {\n var sStr = util.toSetString(aStr);\n return has.call(this._set, sStr);\n }\n};\n\n/**\n * What is the index of the given string in the array?\n *\n * @param String aStr\n */\nArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n if (hasNativeMap) {\n var idx = this._set.get(aStr);\n if (idx >= 0) {\n return idx;\n }\n } else {\n var sStr = util.toSetString(aStr);\n if (has.call(this._set, sStr)) {\n return this._set[sStr];\n }\n }\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 */\nArraySet.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 */\nArraySet.prototype.toArray = function ArraySet_toArray() {\n return this._array.slice();\n};\n\nexports.ArraySet = ArraySet;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/array-set.js\n// module id = 5\n// module chunks = 0","/* -*- 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\nvar util = require('./util');\n\n/**\n * Determine whether mappingB is after mappingA with respect to generated\n * position.\n */\nfunction 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 */\nfunction 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 */\nMappingList.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 */\nMappingList.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 */\nMappingList.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\nexports.MappingList = MappingList;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/mapping-list.js\n// module id = 6\n// module chunks = 0","/* -*- 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\nvar util = require('./util');\nvar binarySearch = require('./binary-search');\nvar ArraySet = require('./array-set').ArraySet;\nvar base64VLQ = require('./base64-vlq');\nvar quickSort = require('./quick-sort').quickSort;\n\nfunction 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\nSourceMapConsumer.fromSourceMap = function(aSourceMap) {\n return BasicSourceMapConsumer.fromSourceMap(aSourceMap);\n}\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nSourceMapConsumer.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\nSourceMapConsumer.prototype.__generatedMappings = null;\nObject.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\nSourceMapConsumer.prototype.__originalMappings = null;\nObject.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\nSourceMapConsumer.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 */\nSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n throw new Error(\"Subclasses must implement _parseMappings\");\n };\n\nSourceMapConsumer.GENERATED_ORDER = 1;\nSourceMapConsumer.ORIGINAL_ORDER = 2;\n\nSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\nSourceMapConsumer.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 */\nSourceMapConsumer.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 */\nSourceMapConsumer.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\nexports.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 */\nfunction 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 .map(String)\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.map(String), 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\nBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.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 */\nfunction 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 */\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.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\nexports.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 */\nfunction 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\nIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nIndexedSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.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 */\nIndexedSourceMapConsumer.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 */\nIndexedSourceMapConsumer.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 */\nIndexedSourceMapConsumer.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 */\nIndexedSourceMapConsumer.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 */\nIndexedSourceMapConsumer.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\nexports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-map-consumer.js\n// module id = 7\n// module chunks = 0","/* -*- 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\nexports.GREATEST_LOWER_BOUND = 1;\nexports.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 */\nfunction 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 */\nexports.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// WEBPACK FOOTER\n// ./lib/binary-search.js\n// module id = 8\n// module chunks = 0","/* -*- 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 */\nfunction 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 */\nfunction 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 */\nfunction 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 */\nexports.quickSort = function (ary, comparator) {\n doQuickSort(ary, comparator, 0, ary.length - 1);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/quick-sort.js\n// module id = 9\n// module chunks = 0","/* -*- 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\nvar SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;\nvar 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).\nvar REGEX_NEWLINE = /(\\r?\\n)/;\n\n// Newline character code for charCodeAt() comparisons\nvar 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!\nvar 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 */\nfunction 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 */\nSourceNode.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 accessed by calling `shiftNextLine`.\n var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n var remainingLinesIndex = 0;\n var shiftNextLine = function() {\n var lineContents = getNextLine();\n // The last line of a file might not have a newline.\n var newLine = getNextLine() || \"\";\n return lineContents + newLine;\n\n function getNextLine() {\n return remainingLinesIndex < remainingLines.length ?\n remainingLines[remainingLinesIndex++] : undefined;\n }\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[remainingLinesIndex];\n var code = nextLine.substr(0, mapping.generatedColumn -\n lastGeneratedColumn);\n remainingLines[remainingLinesIndex] = 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[remainingLinesIndex];\n node.add(nextLine.substr(0, mapping.generatedColumn));\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n }\n lastMapping = mapping;\n }, this);\n // We have processed all mappings.\n if (remainingLinesIndex < remainingLines.length) {\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.splice(remainingLinesIndex).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 */\nSourceNode.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 */\nSourceNode.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 */\nSourceNode.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 */\nSourceNode.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 */\nSourceNode.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 */\nSourceNode.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 */\nSourceNode.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 */\nSourceNode.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 */\nSourceNode.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\nexports.SourceNode = SourceNode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-node.js\n// module id = 10\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/node_modules/snapdragon/node_modules/source-map/lib/array-set.js b/node_modules/snapdragon/node_modules/source-map/lib/array-set.js new file mode 100644 index 0000000..fbd5c81 --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/lib/array-set.js @@ -0,0 +1,121 @@ +/* -*- 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 has = Object.prototype.hasOwnProperty; +var hasNativeMap = typeof Map !== "undefined"; + +/** + * 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 = hasNativeMap ? new Map() : Object.create(null); +} + +/** + * 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 hasNativeMap ? this._set.size : 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 = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } +}; + +/** + * Is the given string a member of this set? + * + * @param String aStr + */ +ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } +}; + +/** + * What is the index of the given string in the array? + * + * @param String aStr + */ +ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, 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/node_modules/snapdragon/node_modules/source-map/lib/base64-vlq.js b/node_modules/snapdragon/node_modules/source-map/lib/base64-vlq.js new file mode 100644 index 0000000..612b404 --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/lib/base64-vlq.js @@ -0,0 +1,140 @@ +/* -*- 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/node_modules/snapdragon/node_modules/source-map/lib/base64.js b/node_modules/snapdragon/node_modules/source-map/lib/base64.js new file mode 100644 index 0000000..8aa86b3 --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/lib/base64.js @@ -0,0 +1,67 @@ +/* -*- 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/node_modules/snapdragon/node_modules/source-map/lib/binary-search.js b/node_modules/snapdragon/node_modules/source-map/lib/binary-search.js new file mode 100644 index 0000000..010ac94 --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/lib/binary-search.js @@ -0,0 +1,111 @@ +/* -*- 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/node_modules/snapdragon/node_modules/source-map/lib/mapping-list.js b/node_modules/snapdragon/node_modules/source-map/lib/mapping-list.js new file mode 100644 index 0000000..06d1274 --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/lib/mapping-list.js @@ -0,0 +1,79 @@ +/* -*- 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/node_modules/snapdragon/node_modules/source-map/lib/quick-sort.js b/node_modules/snapdragon/node_modules/source-map/lib/quick-sort.js new file mode 100644 index 0000000..6a7caad --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/lib/quick-sort.js @@ -0,0 +1,114 @@ +/* -*- 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/node_modules/snapdragon/node_modules/source-map/lib/source-map-consumer.js b/node_modules/snapdragon/node_modules/source-map/lib/source-map-consumer.js new file mode 100644 index 0000000..6abcc28 --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/lib/source-map-consumer.js @@ -0,0 +1,1082 @@ +/* -*- 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 + .map(String) + // 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.map(String), 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/node_modules/snapdragon/node_modules/source-map/lib/source-map-generator.js b/node_modules/snapdragon/node_modules/source-map/lib/source-map-generator.js new file mode 100644 index 0000000..aff1e7f --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/lib/source-map-generator.js @@ -0,0 +1,416 @@ +/* -*- 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) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!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 = Object.create(null); + } + 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) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + 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 next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + 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/node_modules/snapdragon/node_modules/source-map/lib/source-node.js b/node_modules/snapdragon/node_modules/source-map/lib/source-node.js new file mode 100644 index 0000000..d196a53 --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/lib/source-node.js @@ -0,0 +1,413 @@ +/* -*- 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 accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // 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[remainingLinesIndex]; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = 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[remainingLinesIndex]; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + 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.splice(remainingLinesIndex).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/node_modules/snapdragon/node_modules/source-map/lib/util.js b/node_modules/snapdragon/node_modules/source-map/lib/util.js new file mode 100644 index 0000000..44e0e45 --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/lib/util.js @@ -0,0 +1,417 @@ +/* -*- 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 consecutive 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; + +var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); +}()); + +function identity (s) { + return s; +} + +/** + * 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) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; +} +exports.toSetString = supportsNullProto ? identity : toSetString; + +function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; +} +exports.fromSetString = supportsNullProto ? identity : fromSetString; + +function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; +} + +/** + * 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/node_modules/snapdragon/node_modules/source-map/package.json b/node_modules/snapdragon/node_modules/source-map/package.json new file mode 100644 index 0000000..48a591f --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/package.json @@ -0,0 +1,211 @@ +{ + "_from": "source-map@^0.5.6", + "_id": "source-map@0.5.7", + "_inBundle": false, + "_integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "_location": "/snapdragon/source-map", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "source-map@^0.5.6", + "name": "source-map", + "escapedName": "source-map", + "rawSpec": "^0.5.6", + "saveSpec": null, + "fetchSpec": "^0.5.6" + }, + "_requiredBy": [ + "/snapdragon" + ], + "_resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "_shasum": "8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc", + "_spec": "source-map@^0.5.6", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/snapdragon", + "author": { + "name": "Nick Fitzgerald", + "email": "nfitzgerald@mozilla.com" + }, + "bugs": { + "url": "https://github.com/mozilla/source-map/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Tobias Koppers", + "email": "tobias.koppers@googlemail.com" + }, + { + "name": "Duncan Beevers", + "email": "duncan@dweebd.com" + }, + { + "name": "Stephen Crane", + "email": "scrane@mozilla.com" + }, + { + "name": "Ryan Seddon", + "email": "seddon.ryan@gmail.com" + }, + { + "name": "Miles Elam", + "email": "miles.elam@deem.com" + }, + { + "name": "Mihai Bazon", + "email": "mihai.bazon@gmail.com" + }, + { + "name": "Michael Ficarra", + "email": "github.public.email@michael.ficarra.me" + }, + { + "name": "Todd Wolfson", + "email": "todd@twolfson.com" + }, + { + "name": "Alexander Solovyov", + "email": "alexander@solovyov.net" + }, + { + "name": "Felix Gnass", + "email": "fgnass@gmail.com" + }, + { + "name": "Conrad Irwin", + "email": "conrad.irwin@gmail.com" + }, + { + "name": "usrbincc", + "email": "usrbincc@yahoo.com" + }, + { + "name": "David Glasser", + "email": "glasser@davidglasser.net" + }, + { + "name": "Chase Douglas", + "email": "chase@newrelic.com" + }, + { + "name": "Evan Wallace", + "email": "evan.exe@gmail.com" + }, + { + "name": "Heather Arthur", + "email": "fayearthur@gmail.com" + }, + { + "name": "Hugh Kennedy", + "email": "hughskennedy@gmail.com" + }, + { + "name": "David Glasser", + "email": "glasser@davidglasser.net" + }, + { + "name": "Simon Lydell", + "email": "simon.lydell@gmail.com" + }, + { + "name": "Jmeas Smith", + "email": "jellyes2@gmail.com" + }, + { + "name": "Michael Z Goddard", + "email": "mzgoddard@gmail.com" + }, + { + "name": "azu", + "email": "azu@users.noreply.github.com" + }, + { + "name": "John Gozde", + "email": "john@gozde.ca" + }, + { + "name": "Adam Kirkton", + "email": "akirkton@truefitinnovation.com" + }, + { + "name": "Chris Montgomery", + "email": "christopher.montgomery@dowjones.com" + }, + { + "name": "J. Ryan Stinnett", + "email": "jryans@gmail.com" + }, + { + "name": "Jack Herrington", + "email": "jherrington@walmartlabs.com" + }, + { + "name": "Chris Truter", + "email": "jeffpalentine@gmail.com" + }, + { + "name": "Daniel Espeset", + "email": "daniel@danielespeset.com" + }, + { + "name": "Jamie Wong", + "email": "jamie.lf.wong@gmail.com" + }, + { + "name": "Eddy Bruël", + "email": "ejpbruel@mozilla.com" + }, + { + "name": "Hawken Rives", + "email": "hawkrives@gmail.com" + }, + { + "name": "Gilad Peleg", + "email": "giladp007@gmail.com" + }, + { + "name": "djchie", + "email": "djchie.dev@gmail.com" + }, + { + "name": "Gary Ye", + "email": "garysye@gmail.com" + }, + { + "name": "Nicolas Lalevée", + "email": "nicolas.lalevee@hibnet.org" + } + ], + "deprecated": false, + "description": "Generates and consumes source maps", + "devDependencies": { + "doctoc": "^0.15.0", + "webpack": "^1.12.0" + }, + "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", + "name": "source-map", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/mozilla/source-map.git" + }, + "scripts": { + "build": "webpack --color", + "test": "npm run build && node test/run-tests.js", + "toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md" + }, + "typings": "source-map", + "version": "0.5.7" +} diff --git a/node_modules/snapdragon/node_modules/source-map/source-map.js b/node_modules/snapdragon/node_modules/source-map/source-map.js new file mode 100644 index 0000000..bc88fe8 --- /dev/null +++ b/node_modules/snapdragon/node_modules/source-map/source-map.js @@ -0,0 +1,8 @@ +/* + * 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/node_modules/snapdragon/package.json b/node_modules/snapdragon/package.json new file mode 100644 index 0000000..4716381 --- /dev/null +++ b/node_modules/snapdragon/package.json @@ -0,0 +1,126 @@ +{ + "_from": "snapdragon@^0.8.1", + "_id": "snapdragon@0.8.2", + "_inBundle": false, + "_integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "_location": "/snapdragon", + "_phantomChildren": { + "is-buffer": "1.1.6", + "is-extendable": "0.1.1" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "snapdragon@^0.8.1", + "name": "snapdragon", + "escapedName": "snapdragon", + "rawSpec": "^0.8.1", + "saveSpec": null, + "fetchSpec": "^0.8.1" + }, + "_requiredBy": [ + "/braces", + "/expand-brackets", + "/extglob", + "/micromatch", + "/nanomatch" + ], + "_resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "_shasum": "64922e7c565b0e14204ba1aa7d6964278d25182d", + "_spec": "snapdragon@^0.8.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/micromatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/snapdragon/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Brian Woodward", + "url": "https://twitter.com/doowb" + }, + { + "name": "Edward Betts", + "url": "http://edwardbetts.com" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + } + ], + "dependencies": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "deprecated": false, + "description": "Fast, pluggable and easy-to-use parser-renderer factory.", + "devDependencies": { + "gulp": "^3.9.1", + "gulp-eslint": "^3.0.1", + "gulp-format-md": "^0.1.10", + "gulp-istanbul": "^1.1.1", + "gulp-mocha": "^3.0.1", + "gulp-unused": "^0.2.0", + "mocha": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js", + "lib" + ], + "homepage": "https://github.com/jonschlinkert/snapdragon", + "keywords": [ + "lexer", + "snapdragon" + ], + "license": "MIT", + "main": "index.js", + "name": "snapdragon", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/snapdragon.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "description": "These libraries use snapdragon:", + "list": [ + "braces", + "expand-brackets", + "extglob", + "micromatch" + ] + }, + "reflinks": [ + "css", + "pug", + "verb", + "verb-generate-readme" + ], + "lint": { + "reflinks": true + } + }, + "version": "0.8.2" +} diff --git a/node_modules/source-map-resolve/.jshintrc b/node_modules/source-map-resolve/.jshintrc new file mode 100644 index 0000000..4a29289 --- /dev/null +++ b/node_modules/source-map-resolve/.jshintrc @@ -0,0 +1,46 @@ +{ + "bitwise": true, + "camelcase": true, + "curly": false, + "eqeqeq": true, + "es3": true, + "forin": true, + "immed": false, + "indent": false, + "latedef": "nofunc", + "newcap": false, + "noarg": true, + "noempty": true, + "nonew": false, + "plusplus": false, + "quotmark": false, + "undef": true, + "unused": "vars", + "strict": false, + "trailing": true, + "maxparams": 5, + "maxdepth": false, + "maxstatements": false, + "maxcomplexity": false, + "maxlen": 100, + + "asi": true, + "expr": true, + "globalstrict": true, + "smarttabs": true, + "sub": true, + + "node": true, + "globals": { + "describe": false, + "it": false, + "before": false, + "beforeEach": false, + "after": false, + "afterEach": false, + "define": false, + "window": false, + "atob": true, + "JSON": false + } +} diff --git a/node_modules/source-map-resolve/.travis.yml b/node_modules/source-map-resolve/.travis.yml new file mode 100644 index 0000000..2197832 --- /dev/null +++ b/node_modules/source-map-resolve/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "node" diff --git a/node_modules/source-map-resolve/LICENSE b/node_modules/source-map-resolve/LICENSE new file mode 100644 index 0000000..748f42e --- /dev/null +++ b/node_modules/source-map-resolve/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014, 2015, 2016, 2017 Simon Lydell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/source-map-resolve/bower.json b/node_modules/source-map-resolve/bower.json new file mode 100644 index 0000000..552663b --- /dev/null +++ b/node_modules/source-map-resolve/bower.json @@ -0,0 +1,30 @@ +{ + "name": "source-map-resolve", + "version": "0.5.1", + "author": "Simon Lydell", + "license": "MIT", + "description": "Resolve the source map and/or sources for a generated file.", + "keywords": [ + "source map", + "sourcemap", + "source", + "map", + "sourceMappingURL", + "resolve", + "resolver", + "locate", + "locator", + "find", + "finder" + ], + "authors": [ + "Simon Lydell" + ], + "ignore": [ + ".*" + ], + "dependencies": { + "source-map-url": "^0.4.0", + "resolve-url": "^0.2.1" + } +} \ No newline at end of file diff --git a/node_modules/source-map-resolve/changelog.md b/node_modules/source-map-resolve/changelog.md new file mode 100644 index 0000000..d730d36 --- /dev/null +++ b/node_modules/source-map-resolve/changelog.md @@ -0,0 +1,94 @@ +### Version 0.5.1 (2017-10-21) ### + +- Fixed: URLs are now decoded before being passed to `read` in Node.js. This + allows reading files with spaces, for example. +- Fixed: Missing or empty `sources` fields (such as `sources: []`) in source + maps are now handled. Previously, such source maps would cause crashes or + callbacks never bing called. Now, an empty result is produced: + + ```js + sourcesResolved: [], + sourcesContent: [] + ``` + +### Version 0.5.0 (2016-02-28) ### + +- Improved: Errors now have a `sourceMapData` property that contain as much as + possible of the intended result of the function up until the error occurred. +- Changed: `resolveSources` and `resolve`, as well as their `*Sync` + alternatives, no longer fail when one single source fails to be fetched. + Instead, the `sourcesContent` array in the result object will contain error + objects for all failed sources, and strings otherwise. (Backwards-incompatible + change.) + +### Version 0.4.0 (2015-08-29) ### + +- Removed: The `ignoreSourceRoot` option of `resolveSources`. It has been + replaced with `sourceRoot: false`. (Backwards-incompatible change.) +- Added: The `sourceRoot` option of `resolveSources`. It not only allows to + ignore the source root, it also lets you replace it. +- Added: The `parseMapToJSON` method. +- Added: The `resolve` method now accepts `null, mapUrl, ...` as arguments, in + addition to the existing signature, which will read `mapUrl` instead of + looking for a sourceMappingURL in the code. + +### Version 0.3.1 (2014-08-16) ### + +- Improved: Updated the source-map-url dependency to 0.3.0. + + +### Version 0.3.0 (2014-07-02) ### + +- Removed: Argument checking. It’s not worth it. (Possibly + backwards-incompatible change.) +- Added: The `sourceRoot` property of source maps may now be ignored, which can + be useful when resolving sources outside of the browser. +- Added: It is now possible to resolve only the URLs of sources, without + reading them. + + +### Version 0.2.0 (2014-06-22) ### + +- Changed: The result of `resolveSources` is now an object, not an array. The + old result array is available in the `sourcesContent` property. + (Backwards-incompatible change.) +- Changed: `sources` has been renamed to `sourcesContent` in the result object + of `resolve`. (Backwards-incompatible change.) +- Added: `resolveSources` now also returns all sources fully resolved, in the + `sourcesResolved` property. +- Added: The result object of `resolve` now contains the `sourcesResolved` + property from `resolveSources`. + + +### Version 0.1.4 (2014-06-16) ### + +- Fixed: `sourcesContent` was mis-typed as `sourceContents`, which meant that + the `sourcesContent` property of source maps never was used when resolving + sources. + + +### Version 0.1.3 (2014-05-06) ### + +- Only documentation and meta-data changes. + + +### Version 0.1.2 (2014-03-23) ### + +- Improved: Source maps starting with `)]}'` are now parsed correctly. The spec + allows source maps to start with that character sequence to prevent XSSI + attacks. + + +### Version 0.1.1 (2014-03-06) ### + +- Improved: Make sourceRoot resolving more sensible. + + A source root such as `/scripts/subdir` is now treated as `/scripts/subdir/` + — that is, as a directory called “subdir”, not a file called “subdir”. + Pointing to a file as source root does not makes sense. + + + +### Version 0.1.0 (2014-03-03) ### + +- Initial release. diff --git a/node_modules/source-map-resolve/component.json b/node_modules/source-map-resolve/component.json new file mode 100644 index 0000000..c081ca0 --- /dev/null +++ b/node_modules/source-map-resolve/component.json @@ -0,0 +1,29 @@ +{ + "name": "source-map-resolve", + "version": "0.5.1", + "author": "Simon Lydell", + "license": "MIT", + "description": "Resolve the source map and/or sources for a generated file.", + "keywords": [ + "source map", + "sourcemap", + "source", + "map", + "sourceMappingURL", + "resolve", + "resolver", + "locate", + "locator", + "find", + "finder" + ], + "repo": "lydell/source-map-resolve", + "main": "source-map-resolve.js", + "scripts": [ + "source-map-resolve.js" + ], + "dependencies": { + "lydell/source-map-url": "~0.4.0", + "lydell/resolve-url": "~0.2.1" + } +} \ No newline at end of file diff --git a/node_modules/source-map-resolve/generate-source-map-resolve.js b/node_modules/source-map-resolve/generate-source-map-resolve.js new file mode 100644 index 0000000..a37e393 --- /dev/null +++ b/node_modules/source-map-resolve/generate-source-map-resolve.js @@ -0,0 +1,28 @@ +// Copyright 2014, 2017 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +var fs = require("fs") + +var template = fs.readFileSync("source-map-resolve.js.template").toString() +var nodeCode = fs.readFileSync("lib/source-map-resolve-node.js").toString() + +nodeCode = nodeCode + + // Remove leading comments and `require`s. + .replace(/^\s*(?:\/\/.+\s+|var\s+\w+\s*=\s*require\([^)]+\).*\s+)*/, "") + + // Remove `urix`. + .replace(/(\w+)\s*=\s*urix\(\1\)\s*/g, "") + + // Remove `decode-uri-component`. + .replace(/(var readUrl = )decodeUriComponent\(([\w.]+)\)/g, "$1$2") + + // Change `module.exports = {...}` to `return {...}`. + .replace(/module\.exports = (\{[^}]+\})\s*$/, "return $1") + + // Indent. + .replace(/^(?!$)/gm, " ") + +var code = template.replace(/[ \t]*\{\{source-map-resolve-node.js\}\}/, nodeCode) + +fs.writeFileSync("source-map-resolve.js", code) diff --git a/node_modules/source-map-resolve/lib/decode-uri-component.js b/node_modules/source-map-resolve/lib/decode-uri-component.js new file mode 100644 index 0000000..c7064ff --- /dev/null +++ b/node_modules/source-map-resolve/lib/decode-uri-component.js @@ -0,0 +1,11 @@ +// Copyright 2017 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +var decodeUriComponent = require("decode-uri-component") + +function customDecodeUriComponent(string) { + // `decodeUriComponent` turns `+` into ` `, but that's not wanted. + return decodeUriComponent(string.replace(/\+/g, "%2B")) +} + +module.exports = customDecodeUriComponent diff --git a/node_modules/source-map-resolve/lib/resolve-url.js b/node_modules/source-map-resolve/lib/resolve-url.js new file mode 100644 index 0000000..2ca8fa9 --- /dev/null +++ b/node_modules/source-map-resolve/lib/resolve-url.js @@ -0,0 +1,12 @@ +// Copyright 2014 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +var url = require("url") + +function resolveUrl(/* ...urls */) { + return Array.prototype.reduce.call(arguments, function(resolved, nextUrl) { + return url.resolve(resolved, nextUrl) + }) +} + +module.exports = resolveUrl diff --git a/node_modules/source-map-resolve/lib/source-map-resolve-node.js b/node_modules/source-map-resolve/lib/source-map-resolve-node.js new file mode 100644 index 0000000..f80953d --- /dev/null +++ b/node_modules/source-map-resolve/lib/source-map-resolve-node.js @@ -0,0 +1,302 @@ +// Copyright 2014, 2015, 2016, 2017 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +var sourceMappingURL = require("source-map-url") +var resolveUrl = require("./resolve-url") +var decodeUriComponent = require("./decode-uri-component") +var urix = require("urix") +var atob = require("atob") + + + +function callbackAsync(callback, error, result) { + setImmediate(function() { callback(error, result) }) +} + +function parseMapToJSON(string, data) { + try { + return JSON.parse(string.replace(/^\)\]\}'/, "")) + } catch (error) { + error.sourceMapData = data + throw error + } +} + +function readSync(read, url, data) { + var readUrl = decodeUriComponent(url) + try { + return String(read(readUrl)) + } catch (error) { + error.sourceMapData = data + throw error + } +} + + + +function resolveSourceMap(code, codeUrl, read, callback) { + var mapData + try { + mapData = resolveSourceMapHelper(code, codeUrl) + } catch (error) { + return callbackAsync(callback, error) + } + if (!mapData || mapData.map) { + return callbackAsync(callback, null, mapData) + } + var readUrl = decodeUriComponent(mapData.url) + read(readUrl, function(error, result) { + if (error) { + error.sourceMapData = mapData + return callback(error) + } + mapData.map = String(result) + try { + mapData.map = parseMapToJSON(mapData.map, mapData) + } catch (error) { + return callback(error) + } + callback(null, mapData) + }) +} + +function resolveSourceMapSync(code, codeUrl, read) { + var mapData = resolveSourceMapHelper(code, codeUrl) + if (!mapData || mapData.map) { + return mapData + } + mapData.map = readSync(read, mapData.url, mapData) + mapData.map = parseMapToJSON(mapData.map, mapData) + return mapData +} + +var dataUriRegex = /^data:([^,;]*)(;[^,;]*)*(?:,(.*))?$/ +var jsonMimeTypeRegex = /^(?:application|text)\/json$/ + +function resolveSourceMapHelper(code, codeUrl) { + codeUrl = urix(codeUrl) + + var url = sourceMappingURL.getFrom(code) + if (!url) { + return null + } + + var dataUri = url.match(dataUriRegex) + if (dataUri) { + var mimeType = dataUri[1] + var lastParameter = dataUri[2] || "" + var encoded = dataUri[3] || "" + var data = { + sourceMappingURL: url, + url: null, + sourcesRelativeTo: codeUrl, + map: encoded + } + if (!jsonMimeTypeRegex.test(mimeType)) { + var error = new Error("Unuseful data uri mime type: " + (mimeType || "text/plain")) + error.sourceMapData = data + throw error + } + data.map = parseMapToJSON( + lastParameter === ";base64" ? atob(encoded) : decodeURIComponent(encoded), + data + ) + return data + } + + var mapUrl = resolveUrl(codeUrl, url) + return { + sourceMappingURL: url, + url: mapUrl, + sourcesRelativeTo: mapUrl, + map: null + } +} + + + +function resolveSources(map, mapUrl, read, options, callback) { + if (typeof options === "function") { + callback = options + options = {} + } + var pending = map.sources ? map.sources.length : 0 + var result = { + sourcesResolved: [], + sourcesContent: [] + } + + if (pending === 0) { + callbackAsync(callback, null, result) + return + } + + var done = function() { + pending-- + if (pending === 0) { + callback(null, result) + } + } + + resolveSourcesHelper(map, mapUrl, options, function(fullUrl, sourceContent, index) { + result.sourcesResolved[index] = fullUrl + if (typeof sourceContent === "string") { + result.sourcesContent[index] = sourceContent + callbackAsync(done, null) + } else { + var readUrl = decodeUriComponent(fullUrl) + read(readUrl, function(error, source) { + result.sourcesContent[index] = error ? error : String(source) + done() + }) + } + }) +} + +function resolveSourcesSync(map, mapUrl, read, options) { + var result = { + sourcesResolved: [], + sourcesContent: [] + } + + if (!map.sources || map.sources.length === 0) { + return result + } + + resolveSourcesHelper(map, mapUrl, options, function(fullUrl, sourceContent, index) { + result.sourcesResolved[index] = fullUrl + if (read !== null) { + if (typeof sourceContent === "string") { + result.sourcesContent[index] = sourceContent + } else { + var readUrl = decodeUriComponent(fullUrl) + try { + result.sourcesContent[index] = String(read(readUrl)) + } catch (error) { + result.sourcesContent[index] = error + } + } + } + }) + + return result +} + +var endingSlash = /\/?$/ + +function resolveSourcesHelper(map, mapUrl, options, fn) { + options = options || {} + mapUrl = urix(mapUrl) + var fullUrl + var sourceContent + var sourceRoot + for (var index = 0, len = map.sources.length; index < len; index++) { + sourceRoot = null + if (typeof options.sourceRoot === "string") { + sourceRoot = options.sourceRoot + } else if (typeof map.sourceRoot === "string" && options.sourceRoot !== false) { + sourceRoot = map.sourceRoot + } + // If the sourceRoot is the empty string, it is equivalent to not setting + // the property at all. + if (sourceRoot === null || sourceRoot === '') { + fullUrl = resolveUrl(mapUrl, map.sources[index]) + } else { + // Make sure that the sourceRoot ends with a slash, so that `/scripts/subdir` becomes + // `/scripts/subdir/`, not `/scripts/`. Pointing to a file as source root + // does not make sense. + fullUrl = resolveUrl(mapUrl, sourceRoot.replace(endingSlash, "/"), map.sources[index]) + } + sourceContent = (map.sourcesContent || [])[index] + fn(fullUrl, sourceContent, index) + } +} + + + +function resolve(code, codeUrl, read, options, callback) { + if (typeof options === "function") { + callback = options + options = {} + } + if (code === null) { + var mapUrl = codeUrl + var data = { + sourceMappingURL: null, + url: mapUrl, + sourcesRelativeTo: mapUrl, + map: null + } + var readUrl = decodeUriComponent(mapUrl) + read(readUrl, function(error, result) { + if (error) { + error.sourceMapData = data + return callback(error) + } + data.map = String(result) + try { + data.map = parseMapToJSON(data.map, data) + } catch (error) { + return callback(error) + } + _resolveSources(data) + }) + } else { + resolveSourceMap(code, codeUrl, read, function(error, mapData) { + if (error) { + return callback(error) + } + if (!mapData) { + return callback(null, null) + } + _resolveSources(mapData) + }) + } + + function _resolveSources(mapData) { + resolveSources(mapData.map, mapData.sourcesRelativeTo, read, options, function(error, result) { + if (error) { + return callback(error) + } + mapData.sourcesResolved = result.sourcesResolved + mapData.sourcesContent = result.sourcesContent + callback(null, mapData) + }) + } +} + +function resolveSync(code, codeUrl, read, options) { + var mapData + if (code === null) { + var mapUrl = codeUrl + mapData = { + sourceMappingURL: null, + url: mapUrl, + sourcesRelativeTo: mapUrl, + map: null + } + mapData.map = readSync(read, mapUrl, mapData) + mapData.map = parseMapToJSON(mapData.map, mapData) + } else { + mapData = resolveSourceMapSync(code, codeUrl, read) + if (!mapData) { + return null + } + } + var result = resolveSourcesSync(mapData.map, mapData.sourcesRelativeTo, read, options) + mapData.sourcesResolved = result.sourcesResolved + mapData.sourcesContent = result.sourcesContent + return mapData +} + + + +module.exports = { + resolveSourceMap: resolveSourceMap, + resolveSourceMapSync: resolveSourceMapSync, + resolveSources: resolveSources, + resolveSourcesSync: resolveSourcesSync, + resolve: resolve, + resolveSync: resolveSync, + parseMapToJSON: parseMapToJSON +} diff --git a/node_modules/source-map-resolve/package.json b/node_modules/source-map-resolve/package.json new file mode 100644 index 0000000..cc619b7 --- /dev/null +++ b/node_modules/source-map-resolve/package.json @@ -0,0 +1,90 @@ +{ + "_from": "source-map-resolve@^0.5.0", + "_id": "source-map-resolve@0.5.1", + "_inBundle": false, + "_integrity": "sha512-0KW2wvzfxm8NCTb30z0LMNyPqWCdDGE2viwzUaucqJdkTRXtZiSY3I+2A6nVAjmdOy0I4gU8DwnVVGsk9jvP2A==", + "_location": "/source-map-resolve", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "source-map-resolve@^0.5.0", + "name": "source-map-resolve", + "escapedName": "source-map-resolve", + "rawSpec": "^0.5.0", + "saveSpec": null, + "fetchSpec": "^0.5.0" + }, + "_requiredBy": [ + "/snapdragon" + ], + "_resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz", + "_shasum": "7ad0f593f2281598e854df80f19aae4b92d7a11a", + "_spec": "source-map-resolve@^0.5.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/snapdragon", + "author": { + "name": "Simon Lydell" + }, + "browser": "source-map-resolve.js", + "bugs": { + "url": "https://github.com/lydell/source-map-resolve/issues" + }, + "bundleDependencies": false, + "dependencies": { + "atob": "^2.0.0", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + }, + "deprecated": false, + "description": "Resolve the source map and/or sources for a generated file.", + "devDependencies": { + "Base64": "^0.3.0", + "jshint": "~2.9.1", + "setimmediate": "^1.0.4", + "simple-asyncify": "^1.0.0", + "tape": "^4.4.0" + }, + "homepage": "https://github.com/lydell/source-map-resolve#readme", + "keywords": [ + "source map", + "sourcemap", + "source", + "map", + "sourceMappingURL", + "resolve", + "resolver", + "locate", + "locator", + "find", + "finder" + ], + "license": "MIT", + "main": "lib/source-map-resolve-node.js", + "name": "source-map-resolve", + "repository": { + "type": "git", + "url": "git+https://github.com/lydell/source-map-resolve.git" + }, + "scripts": { + "build": "node generate-source-map-resolve.js", + "lint": "jshint lib/ test/", + "test": "npm run lint && npm run unit", + "unit": "node test/source-map-resolve.js && node test/windows.js && node test/read.js" + }, + "testling": { + "files": "test/source-map-resolve.js", + "browsers": [ + "ie/8..latest", + "chrome/latest", + "firefox/latest", + "opera/12", + "opera/latest", + "safari/5", + "iphone/6", + "android-browser/4" + ] + }, + "version": "0.5.1" +} diff --git a/node_modules/source-map-resolve/readme.md b/node_modules/source-map-resolve/readme.md new file mode 100644 index 0000000..a6bbd84 --- /dev/null +++ b/node_modules/source-map-resolve/readme.md @@ -0,0 +1,236 @@ +Overview [![Build Status](https://travis-ci.org/lydell/source-map-resolve.svg?branch=master)](https://travis-ci.org/lydell/source-map-resolve) +======== + +[![browser support](https://ci.testling.com/lydell/source-map-resolve.png)](https://ci.testling.com/lydell/source-map-resolve) + +Resolve the source map and/or sources for a generated file. + +```js +var sourceMapResolve = require("source-map-resolve") +var sourceMap = require("source-map") + +var code = [ + "!function(){...}();", + "/*# sourceMappingURL=foo.js.map */" +].join("\n") + +sourceMapResolve.resolveSourceMap(code, "/js/foo.js", fs.readFile, function(error, result) { + if (error) { + return notifyFailure(error) + } + result + // { + // map: {file: "foo.js", mappings: "...", sources: ["/coffee/foo.coffee"], names: []}, + // url: "/js/foo.js.map", + // sourcesRelativeTo: "/js/foo.js.map", + // sourceMappingURL: "foo.js.map" + // } + + sourceMapResolve.resolveSources(result.map, result.sourcesRelativeTo, fs.readFile, function(error, result) { + if (error) { + return notifyFailure(error) + } + result + // { + // sourcesResolved: ["/coffee/foo.coffee"], + // sourcesContent: [""] + // } + }) +}) + +sourceMapResolve.resolve(code, "/js/foo.js", fs.readFile, function(error, result) { + if (error) { + return notifyFailure(error) + } + result + // { + // map: {file: "foo.js", mappings: "...", sources: ["/coffee/foo.coffee"], names: []}, + // url: "/js/foo.js.map", + // sourcesRelativeTo: "/js/foo.js.map", + // sourceMappingURL: "foo.js.map", + // sourcesResolved: ["/coffee/foo.coffee"], + // sourcesContent: [""] + // } + result.map.sourcesContent = result.sourcesContent + var map = new sourceMap.sourceMapConsumer(result.map) + map.sourceContentFor("/coffee/foo.coffee") + // "" +}) +``` + + +Installation +============ + +- `npm install source-map-resolve` +- `bower install source-map-resolve` +- `component install lydell/source-map-resolve` + +Works with CommonJS, AMD and browser globals, through UMD. + +Note: This module requires `setImmediate` and `atob`. +Use polyfills if needed, such as: + +- +- + + +Usage +===== + +### `sourceMapResolve.resolveSourceMap(code, codeUrl, read, callback)` ### + +- `code` is a string of code that may or may not contain a sourceMappingURL + comment. Such a comment is used to resolve the source map. +- `codeUrl` is the url to the file containing `code`. If the sourceMappingURL + is relative, it is resolved against `codeUrl`. +- `read(url, callback)` is a function that reads `url` and responds using + `callback(error, content)`. In Node.js you might want to use `fs.readFile`, + while in the browser you might want to use an asynchronus `XMLHttpRequest`. +- `callback(error, result)` is a function that is invoked with either an error + or `null` and the result. + +The result is an object with the following properties: + +- `map`: The source map for `code`, as an object (not a string). +- `url`: The url to the source map. If the source map came from a data uri, + this property is `null`, since then there is no url to it. +- `sourcesRelativeTo`: The url that the sources of the source map are relative + to. Since the sources are relative to the source map, and the url to the + source map is provided as the `url` property, this property might seem + superfluos. However, remember that the `url` property can be `null` if the + source map came from a data uri. If so, the sources are relative to the file + containing the data uri—`codeUrl`. This property will be identical to the + `url` property or `codeUrl`, whichever is appropriate. This way you can + conveniently resolve the sources without having to think about where the + source map came from. +- `sourceMappingURL`: The url of the sourceMappingURL comment in `code`. + +If `code` contains no sourceMappingURL, the result is `null`. + +### `sourceMapResolve.resolveSources(map, mapUrl, read, [options], callback)` ### + +- `map` is a source map, as an object (not a string). +- `mapUrl` is the url to the file containing `map`. Relative sources in the + source map, if any, are resolved against `mapUrl`. +- `read(url, callback)` is a function that reads `url` and responds using + `callback(error, content)`. In Node.js you might want to use `fs.readFile`, + while in the browser you might want to use an asynchronus `XMLHttpRequest`. +- `options` is an optional object with any of the following properties: + - `sourceRoot`: Override the `sourceRoot` property of the source map, which + might only be relevant when resolving sources in the browser. This lets you + bypass it when using the module outside of a browser, if needed. Pass a + string to replace the `sourceRoot` property with, or `false` to ignore it. + Defaults to `undefined`. +- `callback(error, result)` is a function that is invoked with either an error + or `null` and the result. + +The result is an object with the following properties: + +- `sourcesResolved`: The same as `map.sources`, except all the sources are + fully resolved. +- `sourcesContent`: An array with the contents of all sources in `map.sources`, + in the same order as `map.sources`. If getting the contents of a source fails, + an error object is put into the array instead. + +### `sourceMapResolve.resolve(code, codeUrl, read, [options], callback)` ### + +The arguments are identical to `sourceMapResolve.resolveSourceMap`, except that +you may also provide the same `options` as in `sourceMapResolve.resolveSources`. + +This is a convenience method that first resolves the source map and then its +sources. You could also do this by first calling +`sourceMapResolve.resolveSourceMap` and then `sourceMapResolve.resolveSources`. + +The result is identical to `sourceMapResolve.resolveSourceMap`, with the +properties from `sourceMapResolve.resolveSources` merged into it. + +There is one extra feature available, though. If `code` is `null`, `codeUrl` is +treated as a url to the source map instead of to `code`, and will be read. This +is handy if you _sometimes_ get the source map url from the `SourceMap: ` +header (see the [Notes] section). In this case, the `sourceMappingURL` property +of the result is `null`. + + +[Notes]: #notes + +### `sourceMapResolve.*Sync()` ### + +There are also sync versions of the three previous functions. They are identical +to the async versions, except: + +- They expect a sync reading function. In Node.js you might want to use + `fs.readFileSync`, while in the browser you might want to use a synchronus + `XMLHttpRequest`. +- They throw errors and return the result instead of using a callback. + +`sourceMapResolve.resolveSourcesSync` also accepts `null` as the `read` +parameter. The result is the same as when passing a function as the `read +parameter`, except that the `sourcesContent` property of the result will be an +empty array. In other words, the sources aren’t read. You only get the +`sourcesResolved` property. (This only supported in the synchronus version, since +there is no point doing it asynchronusly.) + +### `sourceMapResolve.parseMapToJSON(string, [data])` ### + +The spec says that if a source map (as a string) starts with `)]}'`, it should +be stripped off. This is to prevent XSSI attacks. This function does that and +returns the result of `JSON.parse`ing what’s left. + +If this function throws `error`, `error.sourceMapData === data`. + +### Errors + +All errors passed to callbacks or thrown by this module have a `sourceMapData` +property that contain as much as possible of the intended result of the function +up until the error occurred. + +Note that while the `map` property of result objects always is an object, +`error.sourceMapData.map` will be a string if parsing that string fails. + + +Note +==== + +This module resolves the source map for a given generated file by looking for a +sourceMappingURL comment. The spec defines yet a way to provide the URL to the +source map: By sending the `SourceMap: ` header along with the generated +file. Since this module doesn’t retrive the generated code for you (instead +_you_ give the generated code to the module), it’s up to you to look for such a +header when you retrieve the file (should the need arise). + + +Development +=========== + +Tests +----- + +First off, run `npm install` to install testing modules and browser polyfills. + +`npm test` lints the code and runs the test suite in Node.js. + +To run the tests in a browser, run `testling` (`npm install -g testling`) or +`testling -u`. + +x-package.json5 +--------------- + +package.json, component.json and bower.json are all generated from +x-package.json5 by using [`xpkg`]. Only edit x-package.json5, and remember to +run `xpkg` before commiting! + +[`xpkg`]: https://github.com/kof/node-xpkg + +Generating the browser version +------------------------------ + +source-map-resolve.js is generated from source-map-resolve-node.js and +source-map-resolve-template.js. Only edit the two latter files, _not_ +source-map-resolve.js! To generate it, run `npm run build`. + + +License +======= + +[The X11 (“MIT”) License](LICENSE). diff --git a/node_modules/source-map-resolve/source-map-resolve.js b/node_modules/source-map-resolve/source-map-resolve.js new file mode 100644 index 0000000..387fc19 --- /dev/null +++ b/node_modules/source-map-resolve/source-map-resolve.js @@ -0,0 +1,309 @@ +// Copyright 2014, 2015, 2016, 2017 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +// Note: source-map-resolve.js is generated from source-map-resolve-node.js and +// source-map-resolve-template.js. Only edit the two latter files, _not_ +// source-map-resolve.js! + +void (function(root, factory) { + if (typeof define === "function" && define.amd) { + define(["source-map-url", "resolve-url"], factory) + } else if (typeof exports === "object") { + var sourceMappingURL = require("source-map-url") + var resolveUrl = require("resolve-url") + module.exports = factory(sourceMappingURL, resolveUrl) + } else { + root.sourceMapResolve = factory(root.sourceMappingURL, root.resolveUrl) + } +}(this, function(sourceMappingURL, resolveUrl) { + + function callbackAsync(callback, error, result) { + setImmediate(function() { callback(error, result) }) + } + + function parseMapToJSON(string, data) { + try { + return JSON.parse(string.replace(/^\)\]\}'/, "")) + } catch (error) { + error.sourceMapData = data + throw error + } + } + + function readSync(read, url, data) { + var readUrl = url + try { + return String(read(readUrl)) + } catch (error) { + error.sourceMapData = data + throw error + } + } + + + + function resolveSourceMap(code, codeUrl, read, callback) { + var mapData + try { + mapData = resolveSourceMapHelper(code, codeUrl) + } catch (error) { + return callbackAsync(callback, error) + } + if (!mapData || mapData.map) { + return callbackAsync(callback, null, mapData) + } + var readUrl = mapData.url + read(readUrl, function(error, result) { + if (error) { + error.sourceMapData = mapData + return callback(error) + } + mapData.map = String(result) + try { + mapData.map = parseMapToJSON(mapData.map, mapData) + } catch (error) { + return callback(error) + } + callback(null, mapData) + }) + } + + function resolveSourceMapSync(code, codeUrl, read) { + var mapData = resolveSourceMapHelper(code, codeUrl) + if (!mapData || mapData.map) { + return mapData + } + mapData.map = readSync(read, mapData.url, mapData) + mapData.map = parseMapToJSON(mapData.map, mapData) + return mapData + } + + var dataUriRegex = /^data:([^,;]*)(;[^,;]*)*(?:,(.*))?$/ + var jsonMimeTypeRegex = /^(?:application|text)\/json$/ + + function resolveSourceMapHelper(code, codeUrl) { + var url = sourceMappingURL.getFrom(code) + if (!url) { + return null + } + + var dataUri = url.match(dataUriRegex) + if (dataUri) { + var mimeType = dataUri[1] + var lastParameter = dataUri[2] || "" + var encoded = dataUri[3] || "" + var data = { + sourceMappingURL: url, + url: null, + sourcesRelativeTo: codeUrl, + map: encoded + } + if (!jsonMimeTypeRegex.test(mimeType)) { + var error = new Error("Unuseful data uri mime type: " + (mimeType || "text/plain")) + error.sourceMapData = data + throw error + } + data.map = parseMapToJSON( + lastParameter === ";base64" ? atob(encoded) : decodeURIComponent(encoded), + data + ) + return data + } + + var mapUrl = resolveUrl(codeUrl, url) + return { + sourceMappingURL: url, + url: mapUrl, + sourcesRelativeTo: mapUrl, + map: null + } + } + + + + function resolveSources(map, mapUrl, read, options, callback) { + if (typeof options === "function") { + callback = options + options = {} + } + var pending = map.sources ? map.sources.length : 0 + var result = { + sourcesResolved: [], + sourcesContent: [] + } + + if (pending === 0) { + callbackAsync(callback, null, result) + return + } + + var done = function() { + pending-- + if (pending === 0) { + callback(null, result) + } + } + + resolveSourcesHelper(map, mapUrl, options, function(fullUrl, sourceContent, index) { + result.sourcesResolved[index] = fullUrl + if (typeof sourceContent === "string") { + result.sourcesContent[index] = sourceContent + callbackAsync(done, null) + } else { + var readUrl = fullUrl + read(readUrl, function(error, source) { + result.sourcesContent[index] = error ? error : String(source) + done() + }) + } + }) + } + + function resolveSourcesSync(map, mapUrl, read, options) { + var result = { + sourcesResolved: [], + sourcesContent: [] + } + + if (!map.sources || map.sources.length === 0) { + return result + } + + resolveSourcesHelper(map, mapUrl, options, function(fullUrl, sourceContent, index) { + result.sourcesResolved[index] = fullUrl + if (read !== null) { + if (typeof sourceContent === "string") { + result.sourcesContent[index] = sourceContent + } else { + var readUrl = fullUrl + try { + result.sourcesContent[index] = String(read(readUrl)) + } catch (error) { + result.sourcesContent[index] = error + } + } + } + }) + + return result + } + + var endingSlash = /\/?$/ + + function resolveSourcesHelper(map, mapUrl, options, fn) { + options = options || {} + var fullUrl + var sourceContent + var sourceRoot + for (var index = 0, len = map.sources.length; index < len; index++) { + sourceRoot = null + if (typeof options.sourceRoot === "string") { + sourceRoot = options.sourceRoot + } else if (typeof map.sourceRoot === "string" && options.sourceRoot !== false) { + sourceRoot = map.sourceRoot + } + // If the sourceRoot is the empty string, it is equivalent to not setting + // the property at all. + if (sourceRoot === null || sourceRoot === '') { + fullUrl = resolveUrl(mapUrl, map.sources[index]) + } else { + // Make sure that the sourceRoot ends with a slash, so that `/scripts/subdir` becomes + // `/scripts/subdir/`, not `/scripts/`. Pointing to a file as source root + // does not make sense. + fullUrl = resolveUrl(mapUrl, sourceRoot.replace(endingSlash, "/"), map.sources[index]) + } + sourceContent = (map.sourcesContent || [])[index] + fn(fullUrl, sourceContent, index) + } + } + + + + function resolve(code, codeUrl, read, options, callback) { + if (typeof options === "function") { + callback = options + options = {} + } + if (code === null) { + var mapUrl = codeUrl + var data = { + sourceMappingURL: null, + url: mapUrl, + sourcesRelativeTo: mapUrl, + map: null + } + var readUrl = mapUrl + read(readUrl, function(error, result) { + if (error) { + error.sourceMapData = data + return callback(error) + } + data.map = String(result) + try { + data.map = parseMapToJSON(data.map, data) + } catch (error) { + return callback(error) + } + _resolveSources(data) + }) + } else { + resolveSourceMap(code, codeUrl, read, function(error, mapData) { + if (error) { + return callback(error) + } + if (!mapData) { + return callback(null, null) + } + _resolveSources(mapData) + }) + } + + function _resolveSources(mapData) { + resolveSources(mapData.map, mapData.sourcesRelativeTo, read, options, function(error, result) { + if (error) { + return callback(error) + } + mapData.sourcesResolved = result.sourcesResolved + mapData.sourcesContent = result.sourcesContent + callback(null, mapData) + }) + } + } + + function resolveSync(code, codeUrl, read, options) { + var mapData + if (code === null) { + var mapUrl = codeUrl + mapData = { + sourceMappingURL: null, + url: mapUrl, + sourcesRelativeTo: mapUrl, + map: null + } + mapData.map = readSync(read, mapUrl, mapData) + mapData.map = parseMapToJSON(mapData.map, mapData) + } else { + mapData = resolveSourceMapSync(code, codeUrl, read) + if (!mapData) { + return null + } + } + var result = resolveSourcesSync(mapData.map, mapData.sourcesRelativeTo, read, options) + mapData.sourcesResolved = result.sourcesResolved + mapData.sourcesContent = result.sourcesContent + return mapData + } + + + + return { + resolveSourceMap: resolveSourceMap, + resolveSourceMapSync: resolveSourceMapSync, + resolveSources: resolveSources, + resolveSourcesSync: resolveSourcesSync, + resolve: resolve, + resolveSync: resolveSync, + parseMapToJSON: parseMapToJSON + } + +})); diff --git a/node_modules/source-map-resolve/source-map-resolve.js.template b/node_modules/source-map-resolve/source-map-resolve.js.template new file mode 100644 index 0000000..813198a --- /dev/null +++ b/node_modules/source-map-resolve/source-map-resolve.js.template @@ -0,0 +1,22 @@ +// Copyright 2014, 2015, 2016, 2017 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +// Note: source-map-resolve.js is generated from source-map-resolve-node.js and +// source-map-resolve-template.js. Only edit the two latter files, _not_ +// source-map-resolve.js! + +void (function(root, factory) { + if (typeof define === "function" && define.amd) { + define(["source-map-url", "resolve-url"], factory) + } else if (typeof exports === "object") { + var sourceMappingURL = require("source-map-url") + var resolveUrl = require("resolve-url") + module.exports = factory(sourceMappingURL, resolveUrl) + } else { + root.sourceMapResolve = factory(root.sourceMappingURL, root.resolveUrl) + } +}(this, function(sourceMappingURL, resolveUrl) { + + {{source-map-resolve-node.js}} + +})); diff --git a/node_modules/source-map-resolve/x-package.json5 b/node_modules/source-map-resolve/x-package.json5 new file mode 100644 index 0000000..957399f --- /dev/null +++ b/node_modules/source-map-resolve/x-package.json5 @@ -0,0 +1,83 @@ +{ + name: "source-map-resolve", + version: "0.5.1", + author: "Simon Lydell", + license: "MIT", + description: "Resolve the source map and/or sources for a generated file.", + keywords: [ + "source map", + "sourcemap", + "source", + "map", + "sourceMappingURL", + "resolve", + "resolver", + "locate", + "locator", + "find", + "finder" + ], + overlay: { + npm: { + repository: "lydell/source-map-resolve", + main: "lib/source-map-resolve-node.js", + browser: "source-map-resolve.js", + scripts: { + lint: "jshint lib/ test/", + unit: "node test/source-map-resolve.js && node test/windows.js", + test: "npm run lint && npm run unit", + build: "node generate-source-map-resolve.js" + }, + dependencies: { + "source-map-url": "^0.4.0", + "atob": "^2.0.0", + "urix": "^0.1.0", + // resolve-url is a dependency in package.json even though it is not + // needed in Node.js, to allow using npm as a package manager for + // browser projects too. + "resolve-url": "^0.2.1" + }, + devDependencies: { + "tape": "^4.4.0", + "jshint": "~2.9.1", + "setimmediate": "^1.0.4", + "Base64": "^0.3.0", + "simple-asyncify": "^1.0.0" + }, + testling: { + files: "test/source-map-resolve.js", + browsers: [ + "ie/8..latest", + "chrome/latest", + "firefox/latest", + "opera/12", + "opera/latest", + "safari/5", + "iphone/6", + "android-browser/4" + ] + } + }, + component: { + repo: "lydell/source-map-resolve", + main: "source-map-resolve.js", + scripts: [ + "source-map-resolve.js" + ], + dependencies: { + "lydell/source-map-url": "~0.4.0", + "lydell/resolve-url": "~0.2.1" + } + }, + bower: { + authors: ["Simon Lydell"], + ignore: [ + ".*" + ], + dependencies: { + "source-map-url": "^0.4.0", + "resolve-url": "^0.2.1" + } + } + } +} diff --git a/node_modules/source-map-url/.jshintrc b/node_modules/source-map-url/.jshintrc new file mode 100644 index 0000000..8f33293 --- /dev/null +++ b/node_modules/source-map-url/.jshintrc @@ -0,0 +1,43 @@ +{ + "bitwise": true, + "camelcase": true, + "curly": false, + "eqeqeq": true, + "es3": true, + "forin": true, + "immed": false, + "indent": false, + "latedef": "nofunc", + "newcap": false, + "noarg": true, + "noempty": true, + "nonew": false, + "plusplus": false, + "quotmark": false, + "undef": true, + "unused": "vars", + "strict": false, + "trailing": true, + "maxparams": 5, + "maxdepth": false, + "maxstatements": false, + "maxcomplexity": false, + "maxlen": 100, + + "asi": true, + "expr": true, + "globalstrict": true, + "smarttabs": true, + "sub": true, + + "node": true, + "globals": { + "describe": false, + "it": false, + "before": false, + "beforeEach": false, + "after": false, + "afterEach": false, + "define": false + } +} diff --git a/node_modules/source-map-url/LICENSE b/node_modules/source-map-url/LICENSE new file mode 100644 index 0000000..10052a9 --- /dev/null +++ b/node_modules/source-map-url/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Simon Lydell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/source-map-url/bower.json b/node_modules/source-map-url/bower.json new file mode 100644 index 0000000..9831b7c --- /dev/null +++ b/node_modules/source-map-url/bower.json @@ -0,0 +1,20 @@ +{ + "name": "source-map-url", + "version": "0.4.0", + "author": "Simon Lydell", + "license": "MIT", + "description": "Tools for working with sourceMappingURL comments.", + "keywords": [ + "source map", + "sourceMappingURL", + "comment", + "annotation" + ], + "main": "source-map-url.js", + "authors": [ + "Simon Lydell" + ], + "ignore": [ + ".*" + ] +} \ No newline at end of file diff --git a/node_modules/source-map-url/changelog.md b/node_modules/source-map-url/changelog.md new file mode 100644 index 0000000..e291a7f --- /dev/null +++ b/node_modules/source-map-url/changelog.md @@ -0,0 +1,52 @@ +### Version 0.4.0 (2015-11-12) ### + +- Changed: sourceMappingURL comments used to be matched only when placed at + the end of the script. However, since several commonly used JavaScript + libraries do not follow this convention and all popular web browsers accept + non-trailing comments, this has been revised. + + So now non-trailing SourceMappingURL comments are matched as well. + + +### Version 0.3.0 (2014-08-16) ### + +- Changed: sourceMappingURL comments used to be matched only if they appeared + on their own line. However, the spec only says: + + > The generated code may include a line at the end of the source, with the following form: + > + > //# sourceMappingURL= + + So now they are matched also when they appear on the same line as code. + +- Removed: The `.set()` method. I couldn’t decide how it should work + considering the above change. Moreover, it was unnecessarily complex (and + would have gotten worse) for very little gain. It is much easier to run + `.remove()` if needed, and then simply `code += "\n//# sourceMappingURL=" + + url` (using the appropriate comment syntax and newline). KISS. + +- Changed: The `.insertBefore()` method now always inserts the string exactly + before the sourceMappingURL comment; not before the newline before the + comment (if any). Moreover, it does not ensure that the comment will be on a + new line anymore. This is up to the caller. KISS. + +- Changed: The `.remove()` method no longer removes the newline before the + sourceMappingURL (if any). + +- Changed: Renamed `.get()` to `.getFrom()`. +- Changed: Renamed `.remove()` to `.removeFrom()`. + +- Added: The `.existsIn()` method. + + +### Version 0.2.0 (2014-02-23) ### + +- Changed: A space is no longer inserted before the closing comment syntax. If + such a space is desired, it needs to be put in the closing comment syntax + itself (such as `["/*", " */"]` instead of `["/*", "*/"]`). (Backwards + incompatible change.) + + +### Version 0.1.0 (2014-02-22) ### + +- Initial release. diff --git a/node_modules/source-map-url/component.json b/node_modules/source-map-url/component.json new file mode 100644 index 0000000..11d569c --- /dev/null +++ b/node_modules/source-map-url/component.json @@ -0,0 +1,18 @@ +{ + "name": "source-map-url", + "version": "0.4.0", + "author": "Simon Lydell", + "license": "MIT", + "description": "Tools for working with sourceMappingURL comments.", + "keywords": [ + "source map", + "sourceMappingURL", + "comment", + "annotation" + ], + "main": "source-map-url.js", + "repo": "lydell/source-map-url", + "scripts": [ + "source-map-url.js" + ] +} diff --git a/node_modules/source-map-url/package.json b/node_modules/source-map-url/package.json new file mode 100644 index 0000000..b18ebba --- /dev/null +++ b/node_modules/source-map-url/package.json @@ -0,0 +1,73 @@ +{ + "_from": "source-map-url@^0.4.0", + "_id": "source-map-url@0.4.0", + "_inBundle": false, + "_integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "_location": "/source-map-url", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "source-map-url@^0.4.0", + "name": "source-map-url", + "escapedName": "source-map-url", + "rawSpec": "^0.4.0", + "saveSpec": null, + "fetchSpec": "^0.4.0" + }, + "_requiredBy": [ + "/source-map-resolve" + ], + "_resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "_shasum": "3e935d7ddd73631b97659956d55128e87b5084a3", + "_spec": "source-map-url@^0.4.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/source-map-resolve", + "author": { + "name": "Simon Lydell" + }, + "bugs": { + "url": "https://github.com/lydell/source-map-url/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tools for working with sourceMappingURL comments.", + "devDependencies": { + "expect.js": "~0.3.1", + "jshint": "~2.4.3", + "mocha": "~1.17.1" + }, + "homepage": "https://github.com/lydell/source-map-url#readme", + "keywords": [ + "source map", + "sourceMappingURL", + "comment", + "annotation" + ], + "license": "MIT", + "main": "source-map-url.js", + "name": "source-map-url", + "repository": { + "type": "git", + "url": "git+https://github.com/lydell/source-map-url.git" + }, + "scripts": { + "lint": "jshint source-map-url.js test/ ", + "test": "npm run lint && npm run unit", + "unit": "mocha" + }, + "testling": { + "harness": "mocha", + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "chrome/latest", + "firefox/latest", + "opera/12", + "opera/latest", + "safari/5", + "iphone/6", + "android-browser/4" + ] + }, + "version": "0.4.0" +} diff --git a/node_modules/source-map-url/readme.md b/node_modules/source-map-url/readme.md new file mode 100644 index 0000000..216de5e --- /dev/null +++ b/node_modules/source-map-url/readme.md @@ -0,0 +1,97 @@ +Overview [![Build Status](https://travis-ci.org/lydell/source-map-url.png?branch=master)](https://travis-ci.org/lydell/source-map-url) +======== + +[![browser support](https://ci.testling.com/lydell/source-map-url.png)](https://ci.testling.com/lydell/source-map-url) + +Tools for working with sourceMappingURL comments. + +```js +var sourceMappingURL = require("source-map-url") + +var code = [ + "!function(){...}();", + "/*# sourceMappingURL=foo.js.map */" +].join("\n") + +sourceMappingURL.existsIn(code) +// true + +sourceMappingURL.getFrom(code) +// foo.js.map + +code = sourceMappingURL.insertBefore(code, "// License: MIT\n") +// !function(){...}(); +// // License: MIT +// /*# sourceMappingURL=foo.js.map */ + +code = sourceMappingURL.removeFrom(code) +// !function(){...}(); +// // License: MIT + +sourceMappingURL.existsIn(code) +// false + +sourceMappingURL.getFrom(code) +// null + +code += "//# sourceMappingURL=/other/file.js.map" +// !function(){...}(); +// // License: MIT +// //# sourceMappingURL=/other/file.js.map +``` + + +Installation +============ + +- `npm install source-map-url` +- `bower install source-map-url` +- `component install lydell/source-map-url` + +Works with CommonJS, AMD and browser globals, through UMD. + + +Usage +===== + +### `sourceMappingURL.getFrom(code)` ### + +Returns the url of the sourceMappingURL comment in `code`. Returns `null` if +there is no such comment. + +### `sourceMappingURL.existsIn(code)` ### + +Returns `true` if there is a sourceMappingURL comment in `code`, or `false` +otherwise. + +### `sourceMappingURL.removeFrom(code)` ### + +Removes the sourceMappingURL comment in `code`. Does nothing if there is no +such comment. Returns the updated `code`. + +### `sourceMappingURL.insertBefore(code, string)` ### + +Inserts `string` before the sourceMappingURL comment in `code`. Appends +`string` to `code` if there is no such comment. + +Lets you append something to a file without worrying about burying the +sourceMappingURL comment (by keeping it at the end of the file). + +### `sourceMappingURL.regex` ### + +The regex that is used to match sourceMappingURL comments. It matches both `//` +and `/**/` comments, thus supporting both JavaScript and CSS. + + +Tests +===== + +Start by running `npm test`, which lints the code and runs the test suite in Node.js. + +To run the tests in a browser, run `testling` (`npm install -g testling`) or `testling -u`. + + +License +======= + +[The X11 (“MIT”) License](LICENSE). diff --git a/node_modules/source-map-url/source-map-url.js b/node_modules/source-map-url/source-map-url.js new file mode 100644 index 0000000..1724cb7 --- /dev/null +++ b/node_modules/source-map-url/source-map-url.js @@ -0,0 +1,57 @@ +// Copyright 2014 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +void (function(root, factory) { + if (typeof define === "function" && define.amd) { + define(factory) + } else if (typeof exports === "object") { + module.exports = factory() + } else { + root.sourceMappingURL = factory() + } +}(this, function() { + + var innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/ + + var regex = RegExp( + "(?:" + + "/\\*" + + "(?:\\s*\r?\n(?://)?)?" + + "(?:" + innerRegex.source + ")" + + "\\s*" + + "\\*/" + + "|" + + "//(?:" + innerRegex.source + ")" + + ")" + + "\\s*" + ) + + return { + + regex: regex, + _innerRegex: innerRegex, + + getFrom: function(code) { + var match = code.match(regex) + return (match ? match[1] || match[2] || "" : null) + }, + + existsIn: function(code) { + return regex.test(code) + }, + + removeFrom: function(code) { + return code.replace(regex, "") + }, + + insertBefore: function(code, string) { + var match = code.match(regex) + if (match) { + return code.slice(0, match.index) + string + code.slice(match.index) + } else { + return code + string + } + } + } + +})); diff --git a/node_modules/source-map-url/test/source-map-url.js b/node_modules/source-map-url/test/source-map-url.js new file mode 100644 index 0000000..630bc86 --- /dev/null +++ b/node_modules/source-map-url/test/source-map-url.js @@ -0,0 +1,402 @@ +// Copyright 2014 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +var expect = require("expect.js") + +var sourceMappingURL = require("../") + +var comments = { + + universal: [ + "/*# sourceMappingURL=foo.js.map */" + ], + + js: [ + "//# sourceMappingURL=foo.js.map" + ], + + block: [ + "/*", + "# sourceMappingURL=foo.js.map", + "*/" + ], + + mix: [ + "/*", + "//# sourceMappingURL=foo.js.map", + "*/" + ] + +} + +var nonTrailingComments = { + + jsLeading: { + contents: [ + "//# sourceMappingURL=foo.js.map", + "(function(){})" + ], + solution: [ + "(function(){})" + ] + }, + + mixEmbedded: { + contents: [ + "/*! Library Name v1.0.0", + "//# sourceMappingURL=foo.js.map", + "*/", + "(function(){})" + ], + solution: [ + "/*! Library Name v1.0.0", + "*/", + "(function(){})" + ] + } + +} + +function forEachComment(fn) { + forOf(comments, function(name, comment) { + var description = "the '" + name + "' syntax with " + fn(comment.join("\n"), description + "regular newlines") + fn(comment.join("\r\n"), description + "Windows newlines") + }) +} + +function forEachNonTrailingComment(fn) { + forOf(nonTrailingComments, function(name, comment) { + + var description = "the '" + name + "' syntax with " + + fn({ + contents: comment.contents.join("\n"), + solution: comment.solution.join("\n") + }, description + "regular newlines") + + fn({ + contents: comment.contents.join("\r\n"), + solution: comment.solution.join("\r\n") + }, description + "Windows newlines") + }) +} + +function forOf(obj, fn) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + fn(key, obj[key]) + } + } +} + + +describe("sourceMappingURL", function() { + + describe(".getFrom", function() { + + forEachComment(function(comment, description) { + + it("gets the url from " + description, function() { + expect(sourceMappingURL.getFrom("code\n" + comment)) + .to.equal("foo.js.map") + + expect(sourceMappingURL.getFrom("code" + comment)) + .to.equal("foo.js.map") + + expect(sourceMappingURL.getFrom(comment)) + .to.equal("foo.js.map") + }) + + }) + + forEachNonTrailingComment(function(comment, description) { + + it("gets the url from " + description, function() { + expect(sourceMappingURL.getFrom("code\n" + comment.contents)) + .to.equal("foo.js.map") + + expect(sourceMappingURL.getFrom("code" + comment.contents)) + .to.equal("foo.js.map") + + expect(sourceMappingURL.getFrom(comment.contents)) + .to.equal("foo.js.map") + }) + + }) + + + it("returns null if no comment", function() { + expect(sourceMappingURL.getFrom("code")) + .to.equal(null) + }) + + + it("can return an empty string as url", function() { + expect(sourceMappingURL.getFrom("/*# sourceMappingURL= */")) + .to.equal("") + }) + + + it("is detachable", function() { + var get = sourceMappingURL.getFrom + expect(get("/*# sourceMappingURL=foo */")) + .to.equal("foo") + }) + + }) + + + describe(".existsIn", function() { + + forEachComment(function(comment, description) { + + it("returns true for " + description, function() { + expect(sourceMappingURL.existsIn("code\n" + comment)) + .to.equal(true) + + expect(sourceMappingURL.existsIn("code" + comment)) + .to.equal(true) + + expect(sourceMappingURL.existsIn(comment)) + .to.equal(true) + }) + + }) + + forEachNonTrailingComment(function(comment, description) { + + it("returns true for " + description, function() { + expect(sourceMappingURL.existsIn("code\n" + comment.contents)) + .to.equal(true) + + expect(sourceMappingURL.existsIn("code" + comment.contents)) + .to.equal(true) + + expect(sourceMappingURL.existsIn(comment.contents)) + .to.equal(true) + }) + + }) + + + it("returns false if no comment", function() { + expect(sourceMappingURL.existsIn("code")) + .to.equal(false) + }) + + + it("is detachable", function() { + var has = sourceMappingURL.existsIn + expect(has("/*# sourceMappingURL=foo */")) + .to.equal(true) + }) + + }) + + + describe(".removeFrom", function() { + + forEachComment(function(comment, description) { + + it("removes the comment for " + description, function() { + expect(sourceMappingURL.removeFrom("code\n" + comment)) + .to.equal("code\n") + + expect(sourceMappingURL.removeFrom("code" + comment)) + .to.equal("code") + + expect(sourceMappingURL.removeFrom(comment)) + .to.equal("") + }) + + }) + + forEachNonTrailingComment(function(comment, description) { + + it("removes the comment for " + description, function() { + expect(sourceMappingURL.removeFrom("code\n" + comment.contents)) + .to.equal("code\n" + comment.solution) + + expect(sourceMappingURL.removeFrom("code" + comment.contents)) + .to.equal("code" + comment.solution) + + expect(sourceMappingURL.removeFrom(comment.contents)) + .to.equal(comment.solution) + }) + + }) + + + it("does nothing if no comment", function() { + expect(sourceMappingURL.removeFrom("code\n")) + .to.equal("code\n") + }) + + + it("is detachable", function() { + var remove = sourceMappingURL.removeFrom + expect(remove("/*# sourceMappingURL=foo */")) + .to.equal("") + }) + + }) + + + describe(".insertBefore", function() { + + forEachComment(function(comment, description) { + + it("inserts a string before the comment for " + description, function() { + expect(sourceMappingURL.insertBefore("code\n" + comment, "more code\n")) + .to.equal("code\nmore code\n" + comment) + + expect(sourceMappingURL.insertBefore("code" + comment, "\nmore code")) + .to.equal("code\nmore code" + comment) + + expect(sourceMappingURL.insertBefore(comment, "some code")) + .to.equal("some code" + comment) + }) + + }) + + + it("inserts a string before an embedded comment", function() { + expect(sourceMappingURL.insertBefore("/*! Library Name v1.0.0\n" + + "//# sourceMappingURL=foo.js.map\n*/\n(function(){})", "code\n")) + .to.equal("/*! Library Name v1.0.0\ncode\n" + + "//# sourceMappingURL=foo.js.map\n*/\n(function(){})") + }) + + + it("inserts a string before a leading comment", function() { + expect(sourceMappingURL.insertBefore("//# sourceMappingURL=foo.js.map\n" + + "(function(){})", "code\n")) + .to.equal("code\n//# sourceMappingURL=foo.js.map\n" + + "(function(){})") + }) + + + it("appends if no comment", function() { + expect(sourceMappingURL.insertBefore("code", "\nmore code")) + .to.equal("code\nmore code") + }) + + + it("is detachable", function() { + var insertBefore = sourceMappingURL.insertBefore + expect(insertBefore("/*# sourceMappingURL=foo */", "bar")) + .to.equal("bar/*# sourceMappingURL=foo */") + }) + + }) + + + describe(".regex", function() { + + it("includes ._innerRegex", function() { + expect(sourceMappingURL.regex.source) + .to.contain(sourceMappingURL._innerRegex.source) + }) + + + var match = function(code) { + expect(code) + .to.match(sourceMappingURL.regex) + } + + var noMatch = function(code) { + expect(code) + .not.to.match(sourceMappingURL.regex) + } + + + forEachComment(function(comment, description) { + + it("matches " + description, function() { + match("code\n" + comment) + match("code" + comment) + match(comment) + }) + + + it("matches " + description + ", with trailing whitespace", function() { + match(comment + " ") + match(comment + "\n") + match(comment + "\n\n\t\n \t ") + }) + + }) + + + it("does not match some cases that are easy to mess up", function() { + noMatch( + "/* # sourceMappingURL=foo */" + ) + + noMatch( + "// # sourceMappingURL=foo" + ) + }) + + + it("is liberal regarding inner whitespace", function() { + match( + "/*# sourceMappingURL=foo*/" + ) + + match( + "/*# sourceMappingURL=foo */" + ) + + match( + "/*# sourceMappingURL=foo \t\n" + + "*/" + ) + + match( + "/* \n" + + "# sourceMappingURL=foo\n" + + "*/" + ) + + match( + "/*\n" + + "# sourceMappingURL=foo\n" + + " */" + ) + + match( + "/*\n" + + "# sourceMappingURL=foo\n" + + "\n" + + "\t\n" + + "*/" + ) + }) + + }) + + + describe("._innerRegex", function() { + + it("matches the contents of sourceMappingURL comments", function() { + expect("# sourceMappingURL=http://www.example.com/foo/bar.js.map") + .to.match(sourceMappingURL._innerRegex) + }) + + + it("captures the url in the first capture group", function() { + expect(sourceMappingURL._innerRegex.exec("# sourceMappingURL=foo")[1]) + .to.equal("foo") + }) + + + it("supports the legacy syntax", function() { + expect("@ sourceMappingURL=http://www.example.com/foo/bar.js.map") + .to.match(sourceMappingURL._innerRegex) + }) + + }) + +}) diff --git a/node_modules/source-map-url/x-package.json5 b/node_modules/source-map-url/x-package.json5 new file mode 100644 index 0000000..bdcd6ae --- /dev/null +++ b/node_modules/source-map-url/x-package.json5 @@ -0,0 +1,55 @@ +{ + name: "source-map-url", + version: "0.4.0", + author: "Simon Lydell", + license: "MIT", + description: "Tools for working with sourceMappingURL comments.", + keywords: [ + "source map", + "sourceMappingURL", + "comment", + "annotation" + ], + main: "source-map-url.js", + overlay: { + npm: { + repository: "lydell/source-map-url", + scripts: { + lint: "jshint source-map-url.js test/ ", + unit: "mocha", + test: "npm run lint && npm run unit" + }, + devDependencies: { + "mocha": "~1.17.1", + "expect.js": "~0.3.1", + "jshint": "~2.4.3" + }, + testling: { + harness: "mocha", + files: "test/*.js", + browsers: [ + "ie/8..latest", + "chrome/latest", + "firefox/latest", + "opera/12", + "opera/latest", + "safari/5", + "iphone/6", + "android-browser/4" + ] + } + }, + component: { + repo: "lydell/source-map-url", + scripts: [ + "source-map-url.js" + ] + }, + bower: { + authors: ["Simon Lydell"], + ignore: [ + ".*" + ] + } + } +} diff --git a/node_modules/source-map/README.md b/node_modules/source-map/README.md new file mode 100644 index 0000000..b7c6786 --- /dev/null +++ b/node_modules/source-map/README.md @@ -0,0 +1,510 @@ +# Source Map + +This is a library to generate and consume the source map format +[described here][format]. + +This library is written in the Asynchronous Module Definition format, and works +in the following environments: + +* Modern Browsers supporting ECMAScript 5 (either after the build, or with an + AMD loader such as RequireJS) + +* Inside Firefox (as a JSM file, after the build) + +* With NodeJS versions 0.8.X and higher + +## Node + + $ npm install source-map + +## Building from Source (for everywhere else) + +Install Node and then run + + $ git clone https://fitzgen@github.com/mozilla/source-map.git + $ cd source-map + $ npm link . + +Next, run + + $ node Makefile.dryice.js + +This should spew a bunch of stuff to stdout, and create the following files: + +* `dist/source-map.js` - The unminified browser version. + +* `dist/source-map.min.js` - The minified browser version. + +* `dist/SourceMap.jsm` - The JavaScript Module for inclusion in Firefox source. + +## 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 +// NodeJS +var sourceMap = require('source-map'); + +// Browser builds +var sourceMap = window.sourceMap; + +// Inside Firefox +let sourceMap = {}; +Components.utils.import('resource:///modules/devtools/SourceMap.jsm', sourceMap); +``` + +### 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 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 filename this source map is associated with. + +#### SourceMapConsumer.prototype.computeColumnSpans() + +Compute the last column for each generated mapping. The last column is +inclusive. + +#### 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. + +#### 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. + +#### 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. + +#### 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 `smc.sourceContentFor(s)` +will succeed for every source `s` in `smc.sources`. + +#### 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. + +#### 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`. + +### 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. + +#### SourceMapGenerator.fromSourceMap(sourceMapConsumer) + +Creates a new SourceMapGenerator based on a SourceMapConsumer + +* `sourceMapConsumer` The SourceMap. + +#### 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. + +#### 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. + +#### 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 minimium 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. + +### 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. + +#### 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. + +#### 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. + +#### 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. + +#### 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 + +#### 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. + +#### 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. + +#### 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. + +#### SourceNode.prototype.replaceRight(pattern, replacement) + +Call `String.prototype.replace` on the very right-most source snippet. Useful +for trimming whitespace from the end of a source node, etc. + +* `pattern`: The pattern to replace. + +* `replacement`: The thing to replace the pattern with. + +#### 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. + +#### 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`. + +## Tests + +[![Build Status](https://travis-ci.org/mozilla/source-map.png?branch=master)](https://travis-ci.org/mozilla/source-map) + +Install NodeJS version 0.8.0 or greater, then run `node test/run-tests.js`. + +To add new tests, create a new file named `test/test-.js` +and export your test functions with names that start with "test", for example + +```js +exports["test doing the foo bar"] = function (assert, util) { + ... +}; +``` + +The new test will be located automatically when you run the suite. + +The `util` argument is the test utility module located at `test/source-map/util`. + +The `assert` argument is a cut down version of node's assert module. You have +access to the following assertion functions: + +* `doesNotThrow` + +* `equal` + +* `ok` + +* `strictEqual` + +* `throws` + +(The reason for the restricted set of test functions is because we need the +tests to run inside Firefox's test suite as well and so the assert module is +shimmed in that environment. See `build/assert-shim.js`.) + +[format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit +[feature]: https://wiki.mozilla.org/DevTools/Features/SourceMap +[Dryice]: https://github.com/mozilla/dryice diff --git a/node_modules/source-map/build/assert-shim.js b/node_modules/source-map/build/assert-shim.js new file mode 100644 index 0000000..daa1a62 --- /dev/null +++ b/node_modules/source-map/build/assert-shim.js @@ -0,0 +1,56 @@ +/* -*- 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 + */ +define('test/source-map/assert', ['exports'], function (exports) { + + let do_throw = function (msg) { + throw new Error(msg); + }; + + exports.init = function (throw_fn) { + do_throw = throw_fn; + }; + + exports.doesNotThrow = function (fn) { + try { + fn(); + } + catch (e) { + do_throw(e.message); + } + }; + + exports.equal = function (actual, expected, msg) { + msg = msg || String(actual) + ' != ' + String(expected); + if (actual != expected) { + do_throw(msg); + } + }; + + exports.ok = function (val, msg) { + msg = msg || String(val) + ' is falsey'; + if (!Boolean(val)) { + do_throw(msg); + } + }; + + exports.strictEqual = function (actual, expected, msg) { + msg = msg || String(actual) + ' !== ' + String(expected); + if (actual !== expected) { + do_throw(msg); + } + }; + + exports.throws = function (fn) { + try { + fn(); + do_throw('Expected an error to be thrown, but it wasn\'t.'); + } + catch (e) { + } + }; + +}); diff --git a/node_modules/source-map/build/mini-require.js b/node_modules/source-map/build/mini-require.js new file mode 100644 index 0000000..0daf453 --- /dev/null +++ b/node_modules/source-map/build/mini-require.js @@ -0,0 +1,152 @@ +/* -*- 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 + */ + +/** + * Define a module along with a payload. + * @param {string} moduleName Name for the payload + * @param {ignored} deps Ignored. For compatibility with CommonJS AMD Spec + * @param {function} payload Function with (require, exports, module) params + */ +function define(moduleName, deps, payload) { + if (typeof moduleName != "string") { + throw new TypeError('Expected string, got: ' + moduleName); + } + + if (arguments.length == 2) { + payload = deps; + } + + if (moduleName in define.modules) { + throw new Error("Module already defined: " + moduleName); + } + define.modules[moduleName] = payload; +}; + +/** + * The global store of un-instantiated modules + */ +define.modules = {}; + + +/** + * We invoke require() in the context of a Domain so we can have multiple + * sets of modules running separate from each other. + * This contrasts with JSMs which are singletons, Domains allows us to + * optionally load a CommonJS module twice with separate data each time. + * Perhaps you want 2 command lines with a different set of commands in each, + * for example. + */ +function Domain() { + this.modules = {}; + this._currentModule = null; +} + +(function () { + + /** + * Lookup module names and resolve them by calling the definition function if + * needed. + * There are 2 ways to call this, either with an array of dependencies and a + * callback to call when the dependencies are found (which can happen + * asynchronously in an in-page context) or with a single string an no callback + * where the dependency is resolved synchronously and returned. + * The API is designed to be compatible with the CommonJS AMD spec and + * RequireJS. + * @param {string[]|string} deps A name, or names for the payload + * @param {function|undefined} callback Function to call when the dependencies + * are resolved + * @return {undefined|object} The module required or undefined for + * array/callback method + */ + Domain.prototype.require = function(deps, callback) { + if (Array.isArray(deps)) { + var params = deps.map(function(dep) { + return this.lookup(dep); + }, this); + if (callback) { + callback.apply(null, params); + } + return undefined; + } + else { + return this.lookup(deps); + } + }; + + function normalize(path) { + var bits = path.split('/'); + var i = 1; + while (i < bits.length) { + if (bits[i] === '..') { + bits.splice(i-1, 1); + } else if (bits[i] === '.') { + bits.splice(i, 1); + } else { + i++; + } + } + return bits.join('/'); + } + + function join(a, b) { + a = a.trim(); + b = b.trim(); + if (/^\//.test(b)) { + return b; + } else { + return a.replace(/\/*$/, '/') + b; + } + } + + function dirname(path) { + var bits = path.split('/'); + bits.pop(); + return bits.join('/'); + } + + /** + * Lookup module names and resolve them by calling the definition function if + * needed. + * @param {string} moduleName A name for the payload to lookup + * @return {object} The module specified by aModuleName or null if not found. + */ + Domain.prototype.lookup = function(moduleName) { + if (/^\./.test(moduleName)) { + moduleName = normalize(join(dirname(this._currentModule), moduleName)); + } + + if (moduleName in this.modules) { + var module = this.modules[moduleName]; + return module; + } + + if (!(moduleName in define.modules)) { + throw new Error("Module not defined: " + moduleName); + } + + var module = define.modules[moduleName]; + + if (typeof module == "function") { + var exports = {}; + var previousModule = this._currentModule; + this._currentModule = moduleName; + module(this.require.bind(this), exports, { id: moduleName, uri: "" }); + this._currentModule = previousModule; + module = exports; + } + + // cache the resulting module object for next time + this.modules[moduleName] = module; + + return module; + }; + +}()); + +define.Domain = Domain; +define.globalDomain = new Domain(); +var require = define.globalDomain.require.bind(define.globalDomain); diff --git a/node_modules/source-map/build/prefix-source-map.jsm b/node_modules/source-map/build/prefix-source-map.jsm new file mode 100644 index 0000000..209dbd7 --- /dev/null +++ b/node_modules/source-map/build/prefix-source-map.jsm @@ -0,0 +1,21 @@ +/* -*- 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 + */ + +/* + * WARNING! + * + * Do not edit this file directly, it is built from the sources at + * https://github.com/mozilla/source-map/ + */ + +/////////////////////////////////////////////////////////////////////////////// + + +this.EXPORTED_SYMBOLS = [ "SourceMapConsumer", "SourceMapGenerator", "SourceNode" ]; + +Components.utils.import("resource://gre/modules/devtools/Console.jsm"); +Components.utils.import('resource://gre/modules/devtools/Require.jsm'); diff --git a/node_modules/source-map/build/prefix-utils.jsm b/node_modules/source-map/build/prefix-utils.jsm new file mode 100644 index 0000000..80341d4 --- /dev/null +++ b/node_modules/source-map/build/prefix-utils.jsm @@ -0,0 +1,18 @@ +/* -*- 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 + */ + +/* + * WARNING! + * + * Do not edit this file directly, it is built from the sources at + * https://github.com/mozilla/source-map/ + */ + +Components.utils.import('resource://gre/modules/devtools/Require.jsm'); +Components.utils.import('resource://gre/modules/devtools/SourceMap.jsm'); + +this.EXPORTED_SYMBOLS = [ "define", "runSourceMapTests" ]; diff --git a/node_modules/source-map/build/suffix-browser.js b/node_modules/source-map/build/suffix-browser.js new file mode 100644 index 0000000..fb29ff5 --- /dev/null +++ b/node_modules/source-map/build/suffix-browser.js @@ -0,0 +1,8 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/////////////////////////////////////////////////////////////////////////////// + +this.sourceMap = { + SourceMapConsumer: require('source-map/source-map-consumer').SourceMapConsumer, + SourceMapGenerator: require('source-map/source-map-generator').SourceMapGenerator, + SourceNode: require('source-map/source-node').SourceNode +}; diff --git a/node_modules/source-map/build/suffix-source-map.jsm b/node_modules/source-map/build/suffix-source-map.jsm new file mode 100644 index 0000000..cf3c2d8 --- /dev/null +++ b/node_modules/source-map/build/suffix-source-map.jsm @@ -0,0 +1,6 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/////////////////////////////////////////////////////////////////////////////// + +this.SourceMapConsumer = require('source-map/source-map-consumer').SourceMapConsumer; +this.SourceMapGenerator = require('source-map/source-map-generator').SourceMapGenerator; +this.SourceNode = require('source-map/source-node').SourceNode; diff --git a/node_modules/source-map/build/suffix-utils.jsm b/node_modules/source-map/build/suffix-utils.jsm new file mode 100644 index 0000000..b31b84c --- /dev/null +++ b/node_modules/source-map/build/suffix-utils.jsm @@ -0,0 +1,21 @@ +/* -*- 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 + */ +function runSourceMapTests(modName, do_throw) { + let mod = require(modName); + let assert = require('test/source-map/assert'); + let util = require('test/source-map/util'); + + assert.init(do_throw); + + for (let k in mod) { + if (/^test/.test(k)) { + mod[k](assert, util); + } + } + +} +this.runSourceMapTests = runSourceMapTests; diff --git a/node_modules/source-map/build/test-prefix.js b/node_modules/source-map/build/test-prefix.js new file mode 100644 index 0000000..1b13f30 --- /dev/null +++ b/node_modules/source-map/build/test-prefix.js @@ -0,0 +1,8 @@ +/* + * WARNING! + * + * Do not edit this file directly, it is built from the sources at + * https://github.com/mozilla/source-map/ + */ + +Components.utils.import('resource://test/Utils.jsm'); diff --git a/node_modules/source-map/build/test-suffix.js b/node_modules/source-map/build/test-suffix.js new file mode 100644 index 0000000..bec2de3 --- /dev/null +++ b/node_modules/source-map/build/test-suffix.js @@ -0,0 +1,3 @@ +function run_test() { + runSourceMapTests('{THIS_MODULE}', do_throw); +} diff --git a/node_modules/source-map/lib/source-map.js b/node_modules/source-map/lib/source-map.js new file mode 100644 index 0000000..121ad24 --- /dev/null +++ b/node_modules/source-map/lib/source-map.js @@ -0,0 +1,8 @@ +/* + * 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('./source-map/source-map-generator').SourceMapGenerator; +exports.SourceMapConsumer = require('./source-map/source-map-consumer').SourceMapConsumer; +exports.SourceNode = require('./source-map/source-node').SourceNode; diff --git a/node_modules/source-map/lib/source-map/array-set.js b/node_modules/source-map/lib/source-map/array-set.js new file mode 100644 index 0000000..19cb841 --- /dev/null +++ b/node_modules/source-map/lib/source-map/array-set.js @@ -0,0 +1,107 @@ +/* -*- 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 + */ +if (typeof define !== 'function') { + var define = require('amdefine')(module, require); +} +define(function (require, exports, module) { + + 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 isDuplicate = this.has(aStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + this._set[util.toSetString(aStr)] = idx; + } + }; + + /** + * Is the given string a member of this set? + * + * @param String aStr + */ + ArraySet.prototype.has = function ArraySet_has(aStr) { + return Object.prototype.hasOwnProperty.call(this._set, + util.toSetString(aStr)); + }; + + /** + * What is the index of the given string in the array? + * + * @param String aStr + */ + ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (this.has(aStr)) { + return this._set[util.toSetString(aStr)]; + } + 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/node_modules/source-map/lib/source-map/base64-vlq.js b/node_modules/source-map/lib/source-map/base64-vlq.js new file mode 100644 index 0000000..bbe9a58 --- /dev/null +++ b/node_modules/source-map/lib/source-map/base64-vlq.js @@ -0,0 +1,146 @@ +/* -*- 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. + */ +if (typeof define !== 'function') { + var define = require('amdefine')(module, require); +} +define(function (require, exports, module) { + + 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/node_modules/source-map/lib/source-map/base64.js b/node_modules/source-map/lib/source-map/base64.js new file mode 100644 index 0000000..35adbc1 --- /dev/null +++ b/node_modules/source-map/lib/source-map/base64.js @@ -0,0 +1,73 @@ +/* -*- 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 + */ +if (typeof define !== 'function') { + var define = require('amdefine')(module, require); +} +define(function (require, exports, module) { + + 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: " + aNumber); + }; + + /** + * 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/node_modules/source-map/lib/source-map/binary-search.js b/node_modules/source-map/lib/source-map/binary-search.js new file mode 100644 index 0000000..7936f7e --- /dev/null +++ b/node_modules/source-map/lib/source-map/binary-search.js @@ -0,0 +1,117 @@ +/* -*- 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 + */ +if (typeof define !== 'function') { + var define = require('amdefine')(module, require); +} +define(function (require, exports, module) { + + 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/node_modules/source-map/lib/source-map/mapping-list.js b/node_modules/source-map/lib/source-map/mapping-list.js new file mode 100644 index 0000000..01aff22 --- /dev/null +++ b/node_modules/source-map/lib/source-map/mapping-list.js @@ -0,0 +1,86 @@ +/* -*- 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 + */ +if (typeof define !== 'function') { + var define = require('amdefine')(module, require); +} +define(function (require, exports, module) { + + 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) { + var mapping; + 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/node_modules/source-map/lib/source-map/quick-sort.js b/node_modules/source-map/lib/source-map/quick-sort.js new file mode 100644 index 0000000..e0551ed --- /dev/null +++ b/node_modules/source-map/lib/source-map/quick-sort.js @@ -0,0 +1,120 @@ +/* -*- 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 + */ +if (typeof define !== 'function') { + var define = require('amdefine')(module, require); +} +define(function (require, exports, module) { + + // 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/node_modules/source-map/lib/source-map/source-map-consumer.js b/node_modules/source-map/lib/source-map/source-map-consumer.js new file mode 100644 index 0000000..cbdc467 --- /dev/null +++ b/node_modules/source-map/lib/source-map/source-map-consumer.js @@ -0,0 +1,1077 @@ +/* -*- 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 + */ +if (typeof define !== 'function') { + var define = require('amdefine')(module, require); +} +define(function (require, exports, module) { + + 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); + } + + // 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. + sources = sources.map(util.normalize); + + // 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 + * availible. + */ + 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[i]; + + 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.column + + (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/node_modules/source-map/lib/source-map/source-map-generator.js b/node_modules/source-map/lib/source-map/source-map-generator.js new file mode 100644 index 0000000..d8a9025 --- /dev/null +++ b/node_modules/source-map/lib/source-map/source-map-generator.js @@ -0,0 +1,399 @@ +/* -*- 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 + */ +if (typeof define !== 'function') { + var define = require('amdefine')(module, require); +} +define(function (require, exports, module) { + + 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 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) { + result += base64VLQ.encode(this._sources.indexOf(mapping.source) + - previousSource); + previousSource = this._sources.indexOf(mapping.source); + + // 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) { + result += base64VLQ.encode(this._names.indexOf(mapping.name) + - previousName); + previousName = this._names.indexOf(mapping.name); + } + } + } + + 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/node_modules/source-map/lib/source-map/source-node.js b/node_modules/source-map/lib/source-map/source-node.js new file mode 100644 index 0000000..9ee90bd --- /dev/null +++ b/node_modules/source-map/lib/source-map/source-node.js @@ -0,0 +1,414 @@ +/* -*- 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 + */ +if (typeof define !== 'function') { + var define = require('amdefine')(module, require); +} +define(function (require, exports, module) { + + 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) { + var code = ""; + // 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/node_modules/source-map/lib/source-map/util.js b/node_modules/source-map/lib/source-map/util.js new file mode 100644 index 0000000..0b9d75d --- /dev/null +++ b/node_modules/source-map/lib/source-map/util.js @@ -0,0 +1,370 @@ +/* -*- 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 + */ +if (typeof define !== 'function') { + var define = require('amdefine')(module, require); +} +define(function (require, exports, module) { + + /** + * 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 = (path.charAt(0) === '/'); + + 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; + + /** + * 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/node_modules/source-map/package.json b/node_modules/source-map/package.json new file mode 100644 index 0000000..f38b03a --- /dev/null +++ b/node_modules/source-map/package.json @@ -0,0 +1,198 @@ +{ + "_from": "source-map@0.4.x", + "_id": "source-map@0.4.4", + "_inBundle": false, + "_integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "_location": "/source-map", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "source-map@0.4.x", + "name": "source-map", + "escapedName": "source-map", + "rawSpec": "0.4.x", + "saveSpec": null, + "fetchSpec": "0.4.x" + }, + "_requiredBy": [ + "/clean-css" + ], + "_resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "_shasum": "eba4f5da9c0dc999de68032d8b4f76173652036b", + "_spec": "source-map@0.4.x", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/clean-css", + "author": { + "name": "Nick Fitzgerald", + "email": "nfitzgerald@mozilla.com" + }, + "bugs": { + "url": "https://github.com/mozilla/source-map/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Tobias Koppers", + "email": "tobias.koppers@googlemail.com" + }, + { + "name": "Duncan Beevers", + "email": "duncan@dweebd.com" + }, + { + "name": "Stephen Crane", + "email": "scrane@mozilla.com" + }, + { + "name": "Ryan Seddon", + "email": "seddon.ryan@gmail.com" + }, + { + "name": "Miles Elam", + "email": "miles.elam@deem.com" + }, + { + "name": "Mihai Bazon", + "email": "mihai.bazon@gmail.com" + }, + { + "name": "Michael Ficarra", + "email": "github.public.email@michael.ficarra.me" + }, + { + "name": "Todd Wolfson", + "email": "todd@twolfson.com" + }, + { + "name": "Alexander Solovyov", + "email": "alexander@solovyov.net" + }, + { + "name": "Felix Gnass", + "email": "fgnass@gmail.com" + }, + { + "name": "Conrad Irwin", + "email": "conrad.irwin@gmail.com" + }, + { + "name": "usrbincc", + "email": "usrbincc@yahoo.com" + }, + { + "name": "David Glasser", + "email": "glasser@davidglasser.net" + }, + { + "name": "Chase Douglas", + "email": "chase@newrelic.com" + }, + { + "name": "Evan Wallace", + "email": "evan.exe@gmail.com" + }, + { + "name": "Heather Arthur", + "email": "fayearthur@gmail.com" + }, + { + "name": "Hugh Kennedy", + "email": "hughskennedy@gmail.com" + }, + { + "name": "David Glasser", + "email": "glasser@davidglasser.net" + }, + { + "name": "Simon Lydell", + "email": "simon.lydell@gmail.com" + }, + { + "name": "Jmeas Smith", + "email": "jellyes2@gmail.com" + }, + { + "name": "Michael Z Goddard", + "email": "mzgoddard@gmail.com" + }, + { + "name": "azu", + "email": "azu@users.noreply.github.com" + }, + { + "name": "John Gozde", + "email": "john@gozde.ca" + }, + { + "name": "Adam Kirkton", + "email": "akirkton@truefitinnovation.com" + }, + { + "name": "Chris Montgomery", + "email": "christopher.montgomery@dowjones.com" + }, + { + "name": "J. Ryan Stinnett", + "email": "jryans@gmail.com" + }, + { + "name": "Jack Herrington", + "email": "jherrington@walmartlabs.com" + }, + { + "name": "Chris Truter", + "email": "jeffpalentine@gmail.com" + }, + { + "name": "Daniel Espeset", + "email": "daniel@danielespeset.com" + }, + { + "name": "Jamie Wong", + "email": "jamie.lf.wong@gmail.com" + }, + { + "name": "Eddy Bruël", + "email": "ejpbruel@mozilla.com" + }, + { + "name": "Hawken Rives", + "email": "hawkrives@gmail.com" + }, + { + "name": "Gilad Peleg", + "email": "giladp007@gmail.com" + } + ], + "dependencies": { + "amdefine": ">=0.0.4" + }, + "deprecated": false, + "description": "Generates and consumes source maps", + "devDependencies": { + "dryice": ">=0.4.8" + }, + "directories": { + "lib": "./lib" + }, + "engines": { + "node": ">=0.8.0" + }, + "files": [ + "lib/", + "build/" + ], + "homepage": "https://github.com/mozilla/source-map", + "license": "BSD-3-Clause", + "main": "./lib/source-map.js", + "name": "source-map", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/mozilla/source-map.git" + }, + "scripts": { + "build": "node Makefile.dryice.js", + "test": "node test/run-tests.js" + }, + "version": "0.4.4" +} diff --git a/node_modules/split-string/LICENSE b/node_modules/split-string/LICENSE new file mode 100644 index 0000000..e33d14b --- /dev/null +++ b/node_modules/split-string/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-2017, 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/node_modules/split-string/README.md b/node_modules/split-string/README.md new file mode 100644 index 0000000..d622e44 --- /dev/null +++ b/node_modules/split-string/README.md @@ -0,0 +1,321 @@ +# split-string [![NPM version](https://img.shields.io/npm/v/split-string.svg?style=flat)](https://www.npmjs.com/package/split-string) [![NPM monthly downloads](https://img.shields.io/npm/dm/split-string.svg?style=flat)](https://npmjs.org/package/split-string) [![NPM total downloads](https://img.shields.io/npm/dt/split-string.svg?style=flat)](https://npmjs.org/package/split-string) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/split-string.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/split-string) + +> Split a string on a character except when the character is escaped. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save split-string +``` + + + +
    +Why use this? + +
    + +Although it's easy to split on a string: + +```js +console.log('a.b.c'.split('.')); +//=> ['a', 'b', 'c'] +``` + +It's more challenging to split a string whilst respecting escaped or quoted characters. + +**Bad** + +```js +console.log('a\\.b.c'.split('.')); +//=> ['a\\', 'b', 'c'] + +console.log('"a.b.c".d'.split('.')); +//=> ['"a', 'b', 'c"', 'd'] +``` + +**Good** + +```js +var split = require('split-string'); +console.log(split('a\\.b.c')); +//=> ['a.b', 'c'] + +console.log(split('"a.b.c".d')); +//=> ['a.b.c', 'd'] +``` + +See the [options](#options) to learn how to choose the separator or retain quotes or escaping. + +
    + +
    + +## Usage + +```js +var split = require('split-string'); + +split('a.b.c'); +//=> ['a', 'b', 'c'] + +// respects escaped characters +split('a.b.c\\.d'); +//=> ['a', 'b', 'c.d'] + +// respects double-quoted strings +split('a."b.c.d".e'); +//=> ['a', 'b.c.d', 'e'] +``` + +**Brackets** + +Also respects brackets [unless disabled](#optionsbrackets): + +```js +split('a (b c d) e', ' '); +//=> ['a', '(b c d)', 'e'] +``` + +## Options + +### options.brackets + +**Type**: `object|boolean` + +**Default**: `undefined` + +**Description** + +If enabled, split-string will not split inside brackets. The following brackets types are supported when `options.brackets` is `true`, + +```js +{ + '<': '>', + '(': ')', + '[': ']', + '{': '}' +} +``` + +Or, if object of brackets must be passed, each property on the object must be a bracket type, where the property key is the opening delimiter and property value is the closing delimiter. + +**Examples** + +```js +// no bracket support by default +split('a.{b.c}'); +//=> [ 'a', '{b', 'c}' ] + +// support all basic bracket types: "<>{}[]()" +split('a.{b.c}', {brackets: true}); +//=> [ 'a', '{b.c}' ] + +// also supports nested brackets +split('a.{b.{c.d}.e}.f', {brackets: true}); +//=> [ 'a', '{b.{c.d}.e}', 'f' ] + +// support only the specified brackets +split('[a.b].(c.d)', {brackets: {'[': ']'}}); +//=> [ '[a.b]', '(c', 'd)' ] +``` + +### options.sep + +**Type**: `string` + +**Default**: `.` + +The separator/character to split on. + +**Example** + +```js +split('a.b,c', {sep: ','}); +//=> ['a.b', 'c'] + +// you can also pass the separator as string as the last argument +split('a.b,c', ','); +//=> ['a.b', 'c'] +``` + +### options.keepEscaping + +**Type**: `boolean` + +**Default**: `undefined` + +Keep backslashes in the result. + +**Example** + +```js +split('a.b\\.c'); +//=> ['a', 'b.c'] + +split('a.b.\\c', {keepEscaping: true}); +//=> ['a', 'b\.c'] +``` + +### options.keepQuotes + +**Type**: `boolean` + +**Default**: `undefined` + +Keep single- or double-quotes in the result. + +**Example** + +```js +split('a."b.c.d".e'); +//=> ['a', 'b.c.d', 'e'] + +split('a."b.c.d".e', {keepQuotes: true}); +//=> ['a', '"b.c.d"', 'e'] + +split('a.\'b.c.d\'.e', {keepQuotes: true}); +//=> ['a', '\'b.c.d\'', 'e'] +``` + +### options.keepDoubleQuotes + +**Type**: `boolean` + +**Default**: `undefined` + +Keep double-quotes in the result. + +**Example** + +```js +split('a."b.c.d".e'); +//=> ['a', 'b.c.d', 'e'] + +split('a."b.c.d".e', {keepDoubleQuotes: true}); +//=> ['a', '"b.c.d"', 'e'] +``` + +### options.keepSingleQuotes + +**Type**: `boolean` + +**Default**: `undefined` + +Keep single-quotes in the result. + +**Example** + +```js +split('a.\'b.c.d\'.e'); +//=> ['a', 'b.c.d', 'e'] + +split('a.\'b.c.d\'.e', {keepSingleQuotes: true}); +//=> ['a', '\'b.c.d\'', 'e'] +``` + +## Customizer + +**Type**: `function` + +**Default**: `undefined` + +Pass a function as the last argument to customize how tokens are added to the array. + +**Example** + +```js +var arr = split('a.b', function(tok) { + if (tok.arr[tok.arr.length - 1] === 'a') { + tok.split = false; + } +}); +console.log(arr); +//=> ['a.b'] +``` + +**Properties** + +The `tok` object has the following properties: + +* `tok.val` (string) The current value about to be pushed onto the result array +* `tok.idx` (number) the current index in the string +* `tok.str` (string) the entire string +* `tok.arr` (array) the result array + +## Release history + +### v3.0.0 - 2017-06-17 + +**Added** + +* adds support for brackets + +## About + +
    +Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
    + +
    +Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
    + +
    +Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
    + +### Related projects + +You might also be interested in these projects: + +* [deromanize](https://www.npmjs.com/package/deromanize): Convert roman numerals to arabic numbers (useful for books, outlines, documentation, slide decks, etc) | [homepage](https://github.com/jonschlinkert/deromanize "Convert roman numerals to arabic numbers (useful for books, outlines, documentation, slide decks, etc)") +* [randomatic](https://www.npmjs.com/package/randomatic): Generate randomized strings of a specified length using simple character sequences. The original generate-password. | [homepage](https://github.com/jonschlinkert/randomatic "Generate randomized strings of a specified length using simple character sequences. The original generate-password.") +* [repeat-string](https://www.npmjs.com/package/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string. | [homepage](https://github.com/jonschlinkert/repeat-string "Repeat the given string n times. Fastest implementation for repeating a string.") +* [romanize](https://www.npmjs.com/package/romanize): Convert numbers to roman numerals (useful for books, outlines, documentation, slide decks, etc) | [homepage](https://github.com/jonschlinkert/romanize "Convert numbers to roman numerals (useful for books, outlines, documentation, slide decks, etc)") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 28 | [jonschlinkert](https://github.com/jonschlinkert) | +| 9 | [doowb](https://github.com/doowb) | + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on November 19, 2017._ \ No newline at end of file diff --git a/node_modules/split-string/index.js b/node_modules/split-string/index.js new file mode 100644 index 0000000..7bc0ea9 --- /dev/null +++ b/node_modules/split-string/index.js @@ -0,0 +1,171 @@ +/*! + * split-string + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var extend = require('extend-shallow'); + +module.exports = function(str, options, fn) { + if (typeof str !== 'string') { + throw new TypeError('expected a string'); + } + + if (typeof options === 'function') { + fn = options; + options = null; + } + + // allow separator to be defined as a string + if (typeof options === 'string') { + options = { sep: options }; + } + + var opts = extend({sep: '.'}, options); + var quotes = opts.quotes || ['"', "'", '`']; + var brackets; + + if (opts.brackets === true) { + brackets = { + '<': '>', + '(': ')', + '[': ']', + '{': '}' + }; + } else if (opts.brackets) { + brackets = opts.brackets; + } + + var tokens = []; + var stack = []; + var arr = ['']; + var sep = opts.sep; + var len = str.length; + var idx = -1; + var closeIdx; + + function expected() { + if (brackets && stack.length) { + return brackets[stack[stack.length - 1]]; + } + } + + while (++idx < len) { + var ch = str[idx]; + var next = str[idx + 1]; + var tok = { val: ch, idx: idx, arr: arr, str: str }; + tokens.push(tok); + + if (ch === '\\') { + tok.val = keepEscaping(opts, str, idx) === true ? (ch + next) : next; + tok.escaped = true; + if (typeof fn === 'function') { + fn(tok); + } + arr[arr.length - 1] += tok.val; + idx++; + continue; + } + + if (brackets && brackets[ch]) { + stack.push(ch); + var e = expected(); + var i = idx + 1; + + if (str.indexOf(e, i + 1) !== -1) { + while (stack.length && i < len) { + var s = str[++i]; + if (s === '\\') { + s++; + continue; + } + + if (quotes.indexOf(s) !== -1) { + i = getClosingQuote(str, s, i + 1); + continue; + } + + e = expected(); + if (stack.length && str.indexOf(e, i + 1) === -1) { + break; + } + + if (brackets[s]) { + stack.push(s); + continue; + } + + if (e === s) { + stack.pop(); + } + } + } + + closeIdx = i; + if (closeIdx === -1) { + arr[arr.length - 1] += ch; + continue; + } + + ch = str.slice(idx, closeIdx + 1); + tok.val = ch; + tok.idx = idx = closeIdx; + } + + if (quotes.indexOf(ch) !== -1) { + closeIdx = getClosingQuote(str, ch, idx + 1); + if (closeIdx === -1) { + arr[arr.length - 1] += ch; + continue; + } + + if (keepQuotes(ch, opts) === true) { + ch = str.slice(idx, closeIdx + 1); + } else { + ch = str.slice(idx + 1, closeIdx); + } + + tok.val = ch; + tok.idx = idx = closeIdx; + } + + if (typeof fn === 'function') { + fn(tok, tokens); + ch = tok.val; + idx = tok.idx; + } + + if (tok.val === sep && tok.split !== false) { + arr.push(''); + continue; + } + + arr[arr.length - 1] += tok.val; + } + + return arr; +}; + +function getClosingQuote(str, ch, i, brackets) { + var idx = str.indexOf(ch, i); + if (str.charAt(idx - 1) === '\\') { + return getClosingQuote(str, ch, idx + 1); + } + return idx; +} + +function keepQuotes(ch, opts) { + if (opts.keepDoubleQuotes === true && ch === '"') return true; + if (opts.keepSingleQuotes === true && ch === "'") return true; + return opts.keepQuotes; +} + +function keepEscaping(opts, str, idx) { + if (typeof opts.keepEscaping === 'function') { + return opts.keepEscaping(str, idx); + } + return opts.keepEscaping === true || str[idx + 1] === '\\'; +} diff --git a/node_modules/split-string/package.json b/node_modules/split-string/package.json new file mode 100644 index 0000000..7b738f9 --- /dev/null +++ b/node_modules/split-string/package.json @@ -0,0 +1,103 @@ +{ + "_from": "split-string@^3.0.2", + "_id": "split-string@3.1.0", + "_inBundle": false, + "_integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "_location": "/split-string", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "split-string@^3.0.2", + "name": "split-string", + "escapedName": "split-string", + "rawSpec": "^3.0.2", + "saveSpec": null, + "fetchSpec": "^3.0.2" + }, + "_requiredBy": [ + "/braces", + "/set-value" + ], + "_resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "_shasum": "7cb09dda3a86585705c64b39a6466038682e8fe2", + "_spec": "split-string@^3.0.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/braces", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/split-string/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Brian Woodward", + "url": "https://twitter.com/doowb" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + } + ], + "dependencies": { + "extend-shallow": "^3.0.0" + }, + "deprecated": false, + "description": "Split a string on a character except when the character is escaped.", + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.5.3" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/split-string", + "keywords": [ + "character", + "escape", + "split", + "string" + ], + "license": "MIT", + "main": "index.js", + "name": "split-string", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/split-string.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "titles": [ + ".", + "install", + "Why use this?" + ], + "related": { + "list": [ + "deromanize", + "randomatic", + "repeat-string", + "romanize" + ] + }, + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + }, + "version": "3.1.0" +} diff --git a/node_modules/split/.npmignore b/node_modules/split/.npmignore new file mode 100644 index 0000000..13abef4 --- /dev/null +++ b/node_modules/split/.npmignore @@ -0,0 +1,3 @@ +node_modules +node_modules/* +npm_debug.log diff --git a/node_modules/split/.travis.yml b/node_modules/split/.travis.yml new file mode 100644 index 0000000..dad2273 --- /dev/null +++ b/node_modules/split/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.8 + - "0.10" diff --git a/node_modules/split/LICENCE b/node_modules/split/LICENCE new file mode 100644 index 0000000..171dd97 --- /dev/null +++ b/node_modules/split/LICENCE @@ -0,0 +1,22 @@ +Copyright (c) 2011 Dominic Tarr + +Permission is hereby granted, free of charge, +to any person obtaining a copy of this software and +associated documentation files (the "Software"), to +deal in the Software without restriction, including +without limitation the rights to use, copy, modify, +merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom +the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/split/examples/pretty.js b/node_modules/split/examples/pretty.js new file mode 100644 index 0000000..2e89131 --- /dev/null +++ b/node_modules/split/examples/pretty.js @@ -0,0 +1,26 @@ + +var inspect = require('util').inspect +var es = require('event-stream') //load event-stream +var split = require('../') + +if(!module.parent) { + es.pipe( //pipe joins streams together + process.openStdin(), //open stdin + split(), //split stream to break on newlines + es.map(function (data, callback) {//turn this async function into a stream + var j + try { + j = JSON.parse(data) //try to parse input into json + } catch (err) { + return callback(null, data) //if it fails just pass it anyway + } + callback(null, inspect(j)) //render it nicely + }), + process.stdout // pipe it to stdout ! + ) + } + +// run this +// +// curl -sS registry.npmjs.org/event-stream | node pretty.js +// diff --git a/node_modules/split/index.js b/node_modules/split/index.js new file mode 100644 index 0000000..d856433 --- /dev/null +++ b/node_modules/split/index.js @@ -0,0 +1,63 @@ +//filter will reemit the data if cb(err,pass) pass is truthy + +// reduce is more tricky +// maybe we want to group the reductions or emit progress updates occasionally +// the most basic reduce just emits one 'data' event after it has recieved 'end' + + +var through = require('through') +var Decoder = require('string_decoder').StringDecoder + +module.exports = split + +//TODO pass in a function to map across the lines. + +function split (matcher, mapper, options) { + var decoder = new Decoder() + var soFar = '' + var maxLength = options && options.maxLength; + if('function' === typeof matcher) + mapper = matcher, matcher = null + if (!matcher) + matcher = /\r?\n/ + + function emit(stream, piece) { + if(mapper) { + try { + piece = mapper(piece) + } + catch (err) { + return stream.emit('error', err) + } + if('undefined' !== typeof piece) + stream.queue(piece) + } + else + stream.queue(piece) + } + + function next (stream, buffer) { + var pieces = ((soFar != null ? soFar : '') + buffer).split(matcher) + soFar = pieces.pop() + + if (maxLength && soFar.length > maxLength) + stream.emit('error', new Error('maximum buffer reached')) + + for (var i = 0; i < pieces.length; i++) { + var piece = pieces[i] + emit(stream, piece) + } + } + + return through(function (b) { + next(this, decoder.write(b)) + }, + function () { + if(decoder.end) + next(this, decoder.end()) + if(soFar != null) + emit(this, soFar) + this.queue(null) + }) +} + diff --git a/node_modules/split/package.json b/node_modules/split/package.json new file mode 100644 index 0000000..502223b --- /dev/null +++ b/node_modules/split/package.json @@ -0,0 +1,62 @@ +{ + "_from": "split@0.3", + "_id": "split@0.3.3", + "_inBundle": false, + "_integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", + "_location": "/split", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "split@0.3", + "name": "split", + "escapedName": "split", + "rawSpec": "0.3", + "saveSpec": null, + "fetchSpec": "0.3" + }, + "_requiredBy": [ + "/event-stream" + ], + "_resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", + "_shasum": "cd0eea5e63a211dfff7eb0f091c4133e2d0dd28f", + "_spec": "split@0.3", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/event-stream", + "author": { + "name": "Dominic Tarr", + "email": "dominic.tarr@gmail.com", + "url": "http://bit.ly/dominictarr" + }, + "bugs": { + "url": "https://github.com/dominictarr/split/issues" + }, + "bundleDependencies": false, + "dependencies": { + "through": "2" + }, + "deprecated": false, + "description": "split a Text Stream into a Line Stream", + "devDependencies": { + "asynct": "*", + "event-stream": "~3.0.2", + "it-is": "1", + "stream-spec": "~0.2", + "string-to-stream": "~1.0.0", + "ubelt": "~2.9" + }, + "engines": { + "node": "*" + }, + "homepage": "http://github.com/dominictarr/split", + "license": "MIT", + "name": "split", + "optionalDependencies": {}, + "repository": { + "type": "git", + "url": "git://github.com/dominictarr/split.git" + }, + "scripts": { + "test": "asynct test/" + }, + "version": "0.3.3" +} diff --git a/node_modules/split/readme.markdown b/node_modules/split/readme.markdown new file mode 100644 index 0000000..13854ae --- /dev/null +++ b/node_modules/split/readme.markdown @@ -0,0 +1,66 @@ +# Split (matcher) + +[![build status](https://secure.travis-ci.org/dominictarr/split.png)](http://travis-ci.org/dominictarr/split) + +Break up a stream and reassemble it so that each line is a chunk. matcher may be a `String`, or a `RegExp` + +Example, read every line in a file ... + +``` js + fs.createReadStream(file) + .pipe(split()) + .on('data', function (line) { + //each chunk now is a seperate line! + }) + +``` + +`split` takes the same arguments as `string.split` except it defaults to '/\r?\n/' instead of ',', and the optional `limit` paremeter is ignored. +[String#split](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/split) + +`split` takes an optional options object on it's third argument. + +``` js + split(matcher, mapper, options) +``` + +Valid options: + +* maxLength - The maximum buffer length without seeing a newline or `matcher`, + if a single line exceeds this, the split stream will emit an error. + +``` js + split(JSON.parse, null, { maxLength: 2}) +``` + +## keep matched splitter + +As with `Array#split`, if you split by a regular expression with a matching group, +the matches will be retained in the collection. + +``` +stdin +.pipe(split(/(\r?\n)/)) +... //lines + separators. +``` + + +# NDJ - Newline Delimited Json + +`split` accepts a function which transforms each line. + +``` js +fs.createReadStream(file) + .pipe(split(JSON.parse)) + .on('data', function (obj) { + //each chunk now is a a js object + }) + .on('error', function (err) { + //syntax errors will land here + //note, this ends the stream. + }) +``` + +# License + +MIT diff --git a/node_modules/split/test/options.asynct.js b/node_modules/split/test/options.asynct.js new file mode 100644 index 0000000..6d34d87 --- /dev/null +++ b/node_modules/split/test/options.asynct.js @@ -0,0 +1,23 @@ +var it = require('it-is').style('colour') + , split = require('..') + +exports ['maximum buffer limit'] = function (test) { + var s = split(JSON.parse, null, { + maxLength: 2 + }) + , caughtError = false + , rows = [] + + s.on('error', function (err) { + caughtError = true + }) + + s.on('data', function (row) { rows.push(row) }) + + s.write('{"a":1}\n{"') + s.write('{ "') + it(caughtError).equal(true) + + s.end() + test.done() +} diff --git a/node_modules/split/test/partitioned_unicode.js b/node_modules/split/test/partitioned_unicode.js new file mode 100644 index 0000000..aff3d5d --- /dev/null +++ b/node_modules/split/test/partitioned_unicode.js @@ -0,0 +1,34 @@ +var it = require('it-is').style('colour') + , split = require('..') + +exports ['split data with partitioned unicode character'] = function (test) { + var s = split(/,/g) + , caughtError = false + , rows = [] + + s.on('error', function (err) { + caughtError = true + }) + + s.on('data', function (row) { rows.push(row) }) + + var x = 'テスト試験今日とても,よい天気で' + unicodeData = new Buffer(x); + + // partition of 日 + piece1 = unicodeData.slice(0, 20); + piece2 = unicodeData.slice(20, unicodeData.length); + + s.write(piece1); + s.write(piece2); + + s.end() + + it(caughtError).equal(false) + + it(rows).deepEqual(['テスト試験今日とても', 'よい天気で']); + + it(rows).deepEqual(x.split(',')) + + test.done() +} diff --git a/node_modules/split/test/split.asynct.js b/node_modules/split/test/split.asynct.js new file mode 100644 index 0000000..e5df026 --- /dev/null +++ b/node_modules/split/test/split.asynct.js @@ -0,0 +1,137 @@ +var es = require('event-stream') + , it = require('it-is').style('colour') + , d = require('ubelt') + , split = require('..') + , join = require('path').join + , fs = require('fs') + , Stream = require('stream').Stream + , Readable = require('stream').Readable + , spec = require('stream-spec') + , through = require('through') + , stringStream = require('string-to-stream') + +exports ['split() works like String#split'] = function (test) { + var readme = join(__filename) + , expected = fs.readFileSync(readme, 'utf-8').split('\n') + , cs = split() + , actual = [] + , ended = false + , x = spec(cs).through() + + var a = new Stream () + + a.write = function (l) { + actual.push(l.trim()) + } + a.end = function () { + + ended = true + expected.forEach(function (v,k) { + //String.split will append an empty string '' + //if the string ends in a split pattern. + //es.split doesn't which was breaking this test. + //clearly, appending the empty string is correct. + //tests are passing though. which is the current job. + if(v) + it(actual[k]).like(v) + }) + //give the stream time to close + process.nextTick(function () { + test.done() + x.validate() + }) + } + a.writable = true + + fs.createReadStream(readme, {flags: 'r'}).pipe(cs) + cs.pipe(a) + +} + +exports ['split() takes mapper function'] = function (test) { + var readme = join(__filename) + , expected = fs.readFileSync(readme, 'utf-8').split('\n') + , cs = split(function (line) { return line.toUpperCase() }) + , actual = [] + , ended = false + , x = spec(cs).through() + + var a = new Stream () + + a.write = function (l) { + actual.push(l.trim()) + } + a.end = function () { + + ended = true + expected.forEach(function (v,k) { + //String.split will append an empty string '' + //if the string ends in a split pattern. + //es.split doesn't which was breaking this test. + //clearly, appending the empty string is correct. + //tests are passing though. which is the current job. + if(v) + it(actual[k]).equal(v.trim().toUpperCase()) + }) + //give the stream time to close + process.nextTick(function () { + test.done() + x.validate() + }) + } + a.writable = true + + fs.createReadStream(readme, {flags: 'r'}).pipe(cs) + cs.pipe(a) + +} + +exports ['split() works with empty string chunks'] = function (test) { + var str = ' foo' + , expected = str.split(/[\s]*/).reduce(splitBy(/[\s]*/), []) + , cs1 = split(/[\s]*/) + , cs2 = split(/[\s]*/) + , actual = [] + , ended = false + , x = spec(cs1).through() + , y = spec(cs2).through() + + var a = new Stream () + + a.write = function (l) { + actual.push(l.trim()) + } + a.end = function () { + + ended = true + expected.forEach(function (v,k) { + //String.split will append an empty string '' + //if the string ends in a split pattern. + //es.split doesn't which was breaking this test. + //clearly, appending the empty string is correct. + //tests are passing though. which is the current job. + if(v) + it(actual[k]).like(v) + }) + //give the stream time to close + process.nextTick(function () { + test.done() + x.validate() + y.validate() + }) + } + a.writable = true + + cs1.pipe(cs2) + cs2.pipe(a) + + cs1.write(str) + cs1.end() + +} + +function splitBy (delimeter) { + return function (arr, piece) { + return arr.concat(piece.split(delimeter)) + } +} \ No newline at end of file diff --git a/node_modules/split/test/try_catch.asynct.js b/node_modules/split/test/try_catch.asynct.js new file mode 100644 index 0000000..39e49f7 --- /dev/null +++ b/node_modules/split/test/try_catch.asynct.js @@ -0,0 +1,51 @@ +var it = require('it-is').style('colour') + , split = require('..') + +exports ['emit mapper exceptions as error events'] = function (test) { + var s = split(JSON.parse) + , caughtError = false + , rows = [] + + s.on('error', function (err) { + caughtError = true + }) + + s.on('data', function (row) { rows.push(row) }) + + s.write('{"a":1}\n{"') + it(caughtError).equal(false) + it(rows).deepEqual([ { a: 1 } ]) + + s.write('b":2}\n{"c":}\n') + it(caughtError).equal(true) + it(rows).deepEqual([ { a: 1 }, { b: 2 } ]) + + s.end() + test.done() +} + +exports ['mapper error events on trailing chunks'] = function (test) { + var s = split(JSON.parse) + , caughtError = false + , rows = [] + + s.on('error', function (err) { + caughtError = true + }) + + s.on('data', function (row) { rows.push(row) }) + + s.write('{"a":1}\n{"') + it(caughtError).equal(false) + it(rows).deepEqual([ { a: 1 } ]) + + s.write('b":2}\n{"c":}') + it(caughtError).equal(false) + it(rows).deepEqual([ { a: 1 }, { b: 2 } ]) + + s.end() + it(caughtError).equal(true) + it(rows).deepEqual([ { a: 1 }, { b: 2 } ]) + + test.done() +} diff --git a/node_modules/static-extend/LICENSE b/node_modules/static-extend/LICENSE new file mode 100644 index 0000000..e28e603 --- /dev/null +++ b/node_modules/static-extend/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016, 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/node_modules/static-extend/index.js b/node_modules/static-extend/index.js new file mode 100644 index 0000000..f4124b2 --- /dev/null +++ b/node_modules/static-extend/index.js @@ -0,0 +1,90 @@ +/*! + * static-extend + * + * Copyright (c) 2016, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var copy = require('object-copy'); +var define = require('define-property'); +var util = require('util'); + +/** + * Returns a function for extending the static properties, + * prototype properties, and descriptors from the `Parent` + * constructor onto `Child` constructors. + * + * ```js + * var extend = require('static-extend'); + * Parent.extend = extend(Parent); + * + * // optionally pass a custom merge function as the second arg + * Parent.extend = extend(Parent, function(Child) { + * Child.prototype.mixin = function(key, val) { + * Child.prototype[key] = val; + * }; + * }); + * + * // extend "child" constructors + * Parent.extend(Child); + * + * // optionally define prototype methods as the second arg + * Parent.extend(Child, { + * foo: function() {}, + * bar: function() {} + * }); + * ``` + * @param {Function} `Parent` Parent ctor + * @param {Function} `extendFn` Optional extend function for handling any necessary custom merging. Useful when updating methods that require a specific prototype. + * @param {Function} `Child` Child ctor + * @param {Object} `proto` Optionally pass additional prototype properties to inherit. + * @return {Object} + * @api public + */ + +function extend(Parent, extendFn) { + if (typeof Parent !== 'function') { + throw new TypeError('expected Parent to be a function.'); + } + + return function(Ctor, proto) { + if (typeof Ctor !== 'function') { + throw new TypeError('expected Ctor to be a function.'); + } + + util.inherits(Ctor, Parent); + copy(Ctor, Parent); + + // proto can be null or a plain object + if (typeof proto === 'object') { + var obj = Object.create(proto); + + for (var k in obj) { + Ctor.prototype[k] = obj[k]; + } + } + + // keep a reference to the parent prototype + define(Ctor.prototype, '_parent_', { + configurable: true, + set: function() {}, + get: function() { + return Parent.prototype; + } + }); + + if (typeof extendFn === 'function') { + extendFn(Ctor, Parent); + } + + Ctor.extend = extend(Ctor, extendFn); + }; +}; + +/** + * Expose `extend` + */ + +module.exports = extend; diff --git a/node_modules/static-extend/node_modules/define-property/LICENSE b/node_modules/static-extend/node_modules/define-property/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/node_modules/static-extend/node_modules/define-property/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 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/node_modules/static-extend/node_modules/define-property/README.md b/node_modules/static-extend/node_modules/define-property/README.md new file mode 100644 index 0000000..8cac698 --- /dev/null +++ b/node_modules/static-extend/node_modules/define-property/README.md @@ -0,0 +1,77 @@ +# define-property [![NPM version](https://badge.fury.io/js/define-property.svg)](http://badge.fury.io/js/define-property) + +> Define a non-enumerable property on an object. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i define-property --save +``` + +## Usage + +**Params** + +* `obj`: The object on which to define the property. +* `prop`: The name of the property to be defined or modified. +* `descriptor`: The descriptor for the property being defined or modified. + +```js +var define = require('define-property'); +var obj = {}; +define(obj, 'foo', function(val) { + return val.toUpperCase(); +}); + +console.log(obj); +//=> {} + +console.log(obj.foo('bar')); +//=> 'BAR' +``` + +**get/set** + +```js +define(obj, 'foo', { + get: function() {}, + set: function() {} +}); +``` + +## Related projects + +* [delegate-object](https://www.npmjs.com/package/delegate-object): Copy properties from an object to another object, where properties with function values will be… [more](https://www.npmjs.com/package/delegate-object) | [homepage](https://github.com/doowb/delegate-object) +* [forward-object](https://www.npmjs.com/package/forward-object): Copy properties from an object to another object, where properties with function values will be… [more](https://www.npmjs.com/package/forward-object) | [homepage](https://github.com/doowb/forward-object) +* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep) +* [mixin-object](https://www.npmjs.com/package/mixin-object): Mixin the own and inherited properties of other objects onto the first object. Pass an… [more](https://www.npmjs.com/package/mixin-object) | [homepage](https://github.com/jonschlinkert/mixin-object) + +## Running tests + +Install dev dependencies: + +```sh +$ 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/define-property/issues/new). + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 Jon Schlinkert +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 31, 2015._ diff --git a/node_modules/static-extend/node_modules/define-property/index.js b/node_modules/static-extend/node_modules/define-property/index.js new file mode 100644 index 0000000..3e0e5e1 --- /dev/null +++ b/node_modules/static-extend/node_modules/define-property/index.js @@ -0,0 +1,31 @@ +/*! + * define-property + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var isDescriptor = require('is-descriptor'); + +module.exports = function defineProperty(obj, prop, val) { + if (typeof obj !== 'object' && typeof obj !== 'function') { + throw new TypeError('expected an object or function.'); + } + + if (typeof prop !== 'string') { + throw new TypeError('expected `prop` to be a string.'); + } + + if (isDescriptor(val) && ('set' in val || 'get' in val)) { + return Object.defineProperty(obj, prop, val); + } + + return Object.defineProperty(obj, prop, { + configurable: true, + enumerable: false, + writable: true, + value: val + }); +}; diff --git a/node_modules/static-extend/node_modules/define-property/package.json b/node_modules/static-extend/node_modules/define-property/package.json new file mode 100644 index 0000000..5a1ff1c --- /dev/null +++ b/node_modules/static-extend/node_modules/define-property/package.json @@ -0,0 +1,82 @@ +{ + "_from": "define-property@^0.2.5", + "_id": "define-property@0.2.5", + "_inBundle": false, + "_integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "_location": "/static-extend/define-property", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "define-property@^0.2.5", + "name": "define-property", + "escapedName": "define-property", + "rawSpec": "^0.2.5", + "saveSpec": null, + "fetchSpec": "^0.2.5" + }, + "_requiredBy": [ + "/static-extend" + ], + "_resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "_shasum": "c35b1ef918ec3c990f9a5bc57be04aacec5c8116", + "_spec": "define-property@^0.2.5", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/static-extend", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/define-property/issues" + }, + "bundleDependencies": false, + "dependencies": { + "is-descriptor": "^0.1.0" + }, + "deprecated": false, + "description": "Define a non-enumerable property on an object.", + "devDependencies": { + "mocha": "*", + "should": "^7.0.4" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/define-property", + "keywords": [ + "define", + "define-property", + "enumerable", + "key", + "non", + "non-enumerable", + "object", + "prop", + "property", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "define-property", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/define-property.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "mixin-deep", + "mixin-object", + "delegate-object", + "forward-object" + ] + } + }, + "version": "0.2.5" +} diff --git a/node_modules/static-extend/node_modules/is-accessor-descriptor/LICENSE b/node_modules/static-extend/node_modules/is-accessor-descriptor/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/node_modules/static-extend/node_modules/is-accessor-descriptor/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 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/node_modules/static-extend/node_modules/is-accessor-descriptor/README.md b/node_modules/static-extend/node_modules/is-accessor-descriptor/README.md new file mode 100644 index 0000000..3743fe6 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-accessor-descriptor/README.md @@ -0,0 +1,123 @@ +# is-accessor-descriptor [![NPM version](https://img.shields.io/npm/v/is-accessor-descriptor.svg)](https://www.npmjs.com/package/is-accessor-descriptor) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-accessor-descriptor.svg)](https://travis-ci.org/jonschlinkert/is-accessor-descriptor) + +> Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. + +- [Install](#install) +- [Usage](#usage) +- [Examples](#examples) +- [API](#api) +- [Related projects](#related-projects) +- [Running tests](#running-tests) +- [Contributing](#contributing) +- [Author](#author) +- [License](#license) + +_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm i is-accessor-descriptor --save +``` + +## Usage + +```js +var isAccessor = require('is-accessor-descriptor'); + +isAccessor({get: function() {}}); +//=> true +``` + +You may also pass an object and property name to check if the property is an accessor: + +```js +isAccessor(foo, 'bar'); +``` + +## Examples + +`false` when not an object + +```js +isAccessor('a') +isAccessor(null) +isAccessor([]) +//=> false +``` + +`true` when the object has valid properties + +and the properties all have the correct JavaScript types: + +```js +isAccessor({get: noop, set: noop}) +isAccessor({get: noop}) +isAccessor({set: noop}) +//=> true +``` + +`false` when the object has invalid properties + +```js +isAccessor({get: noop, set: noop, bar: 'baz'}) +isAccessor({get: noop, writable: true}) +isAccessor({get: noop, value: true}) +//=> false +``` + +`false` when an accessor is not a function + +```js +isAccessor({get: noop, set: 'baz'}) +isAccessor({get: 'foo', set: noop}) +isAccessor({get: 'foo', bar: 'baz'}) +isAccessor({get: 'foo', set: 'baz'}) +//=> false +``` + +`false` when a value is not the correct type + +```js +isAccessor({get: noop, set: noop, enumerable: 'foo'}) +isAccessor({set: noop, configurable: 'foo'}) +isAccessor({get: noop, configurable: 'foo'}) +//=> false +``` + +## Related projects + +* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor) +* [is-data-descriptor](https://www.npmjs.com/package/is-data-descriptor): Returns true if a value has the characteristics of a valid JavaScript data descriptor. | [homepage](https://github.com/jonschlinkert/is-data-descriptor) +* [is-descriptor](https://www.npmjs.com/package/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://www.npmjs.com/package/is-descriptor) | [homepage](https://github.com/jonschlinkert/is-descriptor) +* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject) + +## Running tests + +Install dev dependencies: + +```sh +$ 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-accessor-descriptor/issues/new). + +## Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert) +Released under the MIT license. + +*** + +_This file was generated by [verb](https://github.com/verbose/verb) on December 28, 2015._ \ No newline at end of file diff --git a/node_modules/static-extend/node_modules/is-accessor-descriptor/index.js b/node_modules/static-extend/node_modules/is-accessor-descriptor/index.js new file mode 100644 index 0000000..2ca4af8 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-accessor-descriptor/index.js @@ -0,0 +1,69 @@ +/*! + * is-accessor-descriptor + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var typeOf = require('kind-of'); + +// accessor descriptor properties +var accessor = { + get: 'function', + set: 'function', + configurable: 'boolean', + enumerable: 'boolean' +}; + +function isAccessorDescriptor(obj, prop) { + if (typeof prop === 'string') { + var val = Object.getOwnPropertyDescriptor(obj, prop); + return typeof val !== 'undefined'; + } + + if (typeOf(obj) !== 'object') { + return false; + } + + if (has(obj, 'value') || has(obj, 'writable')) { + return false; + } + + if (!has(obj, 'get') || typeof obj.get !== 'function') { + return false; + } + + // tldr: it's valid to have "set" be undefined + // "set" might be undefined if `Object.getOwnPropertyDescriptor` + // was used to get the value, and only `get` was defined by the user + if (has(obj, 'set') && typeof obj[key] !== 'function' && typeof obj[key] !== 'undefined') { + return false; + } + + for (var key in obj) { + if (!accessor.hasOwnProperty(key)) { + continue; + } + + if (typeOf(obj[key]) === accessor[key]) { + continue; + } + + if (typeof obj[key] !== 'undefined') { + return false; + } + } + return true; +} + +function has(obj, key) { + return {}.hasOwnProperty.call(obj, key); +} + +/** + * Expose `isAccessorDescriptor` + */ + +module.exports = isAccessorDescriptor; diff --git a/node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/LICENSE b/node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/LICENSE new file mode 100644 index 0000000..d734237 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, 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/node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/README.md b/node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/README.md new file mode 100644 index 0000000..6a9df36 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/README.md @@ -0,0 +1,261 @@ +# kind-of [![NPM version](https://img.shields.io/npm/v/kind-of.svg?style=flat)](https://www.npmjs.com/package/kind-of) [![NPM monthly downloads](https://img.shields.io/npm/dm/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![NPM total downloads](https://img.shields.io/npm/dt/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/kind-of.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/kind-of) + +> Get the native type of a value. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save kind-of +``` + +## Install + +Install with [bower](https://bower.io/) + +```sh +$ bower install kind-of --save +``` + +## Usage + +> es5, browser and es6 ready + +```js +var kindOf = require('kind-of'); + +kindOf(undefined); +//=> 'undefined' + +kindOf(null); +//=> 'null' + +kindOf(true); +//=> 'boolean' + +kindOf(false); +//=> 'boolean' + +kindOf(new Boolean(true)); +//=> 'boolean' + +kindOf(new Buffer('')); +//=> 'buffer' + +kindOf(42); +//=> 'number' + +kindOf(new Number(42)); +//=> 'number' + +kindOf('str'); +//=> 'string' + +kindOf(new String('str')); +//=> 'string' + +kindOf(arguments); +//=> 'arguments' + +kindOf({}); +//=> 'object' + +kindOf(Object.create(null)); +//=> 'object' + +kindOf(new Test()); +//=> 'object' + +kindOf(new Date()); +//=> 'date' + +kindOf([]); +//=> 'array' + +kindOf([1, 2, 3]); +//=> 'array' + +kindOf(new Array()); +//=> 'array' + +kindOf(/foo/); +//=> 'regexp' + +kindOf(new RegExp('foo')); +//=> 'regexp' + +kindOf(function () {}); +//=> 'function' + +kindOf(function * () {}); +//=> 'function' + +kindOf(new Function()); +//=> 'function' + +kindOf(new Map()); +//=> 'map' + +kindOf(new WeakMap()); +//=> 'weakmap' + +kindOf(new Set()); +//=> 'set' + +kindOf(new WeakSet()); +//=> 'weakset' + +kindOf(Symbol('str')); +//=> 'symbol' + +kindOf(new Int8Array()); +//=> 'int8array' + +kindOf(new Uint8Array()); +//=> 'uint8array' + +kindOf(new Uint8ClampedArray()); +//=> 'uint8clampedarray' + +kindOf(new Int16Array()); +//=> 'int16array' + +kindOf(new Uint16Array()); +//=> 'uint16array' + +kindOf(new Int32Array()); +//=> 'int32array' + +kindOf(new Uint32Array()); +//=> 'uint32array' + +kindOf(new Float32Array()); +//=> 'float32array' + +kindOf(new Float64Array()); +//=> 'float64array' +``` + +## Benchmarks + +Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of). +Note that performaces is slower for es6 features `Map`, `WeakMap`, `Set` and `WeakSet`. + +```bash +#1: array + current x 23,329,397 ops/sec ±0.82% (94 runs sampled) + lib-type-of x 4,170,273 ops/sec ±0.55% (94 runs sampled) + lib-typeof x 9,686,935 ops/sec ±0.59% (98 runs sampled) + +#2: boolean + current x 27,197,115 ops/sec ±0.85% (94 runs sampled) + lib-type-of x 3,145,791 ops/sec ±0.73% (97 runs sampled) + lib-typeof x 9,199,562 ops/sec ±0.44% (99 runs sampled) + +#3: date + current x 20,190,117 ops/sec ±0.86% (92 runs sampled) + lib-type-of x 5,166,970 ops/sec ±0.74% (94 runs sampled) + lib-typeof x 9,610,821 ops/sec ±0.50% (96 runs sampled) + +#4: function + current x 23,855,460 ops/sec ±0.60% (97 runs sampled) + lib-type-of x 5,667,740 ops/sec ±0.54% (100 runs sampled) + lib-typeof x 10,010,644 ops/sec ±0.44% (100 runs sampled) + +#5: null + current x 27,061,047 ops/sec ±0.97% (96 runs sampled) + lib-type-of x 13,965,573 ops/sec ±0.62% (97 runs sampled) + lib-typeof x 8,460,194 ops/sec ±0.61% (97 runs sampled) + +#6: number + current x 25,075,682 ops/sec ±0.53% (99 runs sampled) + lib-type-of x 2,266,405 ops/sec ±0.41% (98 runs sampled) + lib-typeof x 9,821,481 ops/sec ±0.45% (99 runs sampled) + +#7: object + current x 3,348,980 ops/sec ±0.49% (99 runs sampled) + lib-type-of x 3,245,138 ops/sec ±0.60% (94 runs sampled) + lib-typeof x 9,262,952 ops/sec ±0.59% (99 runs sampled) + +#8: regex + current x 21,284,827 ops/sec ±0.72% (96 runs sampled) + lib-type-of x 4,689,241 ops/sec ±0.43% (100 runs sampled) + lib-typeof x 8,957,593 ops/sec ±0.62% (98 runs sampled) + +#9: string + current x 25,379,234 ops/sec ±0.58% (96 runs sampled) + lib-type-of x 3,635,148 ops/sec ±0.76% (93 runs sampled) + lib-typeof x 9,494,134 ops/sec ±0.49% (98 runs sampled) + +#10: undef + current x 27,459,221 ops/sec ±1.01% (93 runs sampled) + lib-type-of x 14,360,433 ops/sec ±0.52% (99 runs sampled) + lib-typeof x 23,202,868 ops/sec ±0.59% (94 runs sampled) + +``` + +## Optimizations + +In 7 out of 8 cases, this library is 2x-10x faster than other top libraries included in the benchmarks. There are a few things that lead to this performance advantage, none of them hard and fast rules, but all of them simple and repeatable in almost any code library: + +1. Optimize around the fastest and most common use cases first. Of course, this will change from project-to-project, but I took some time to understand how and why `typeof` checks were being used in my own libraries and other libraries I use a lot. +2. Optimize around bottlenecks - In other words, the order in which conditionals are implemented is significant, because each check is only as fast as the failing checks that came before it. Here, the biggest bottleneck by far is checking for plain objects (an object that was created by the `Object` constructor). I opted to make this check happen by process of elimination rather than brute force up front (e.g. by using something like `val.constructor.name`), so that every other type check would not be penalized it. +3. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'` + +## About + +### Related projects + +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number "Returns true if the value is a number. comprehensive tests.") +* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 59 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [miguelmota](https://github.com/miguelmota) | +| 1 | [dtothefp](https://github.com/dtothefp) | +| 1 | [ksheedlo](https://github.com/ksheedlo) | +| 1 | [pdehaan](https://github.com/pdehaan) | +| 1 | [laggingreflex](https://github.com/laggingreflex) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 16, 2017._ \ No newline at end of file diff --git a/node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js b/node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js new file mode 100644 index 0000000..b52c291 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js @@ -0,0 +1,116 @@ +var isBuffer = require('is-buffer'); +var toString = Object.prototype.toString; + +/** + * Get the native `typeof` a value. + * + * @param {*} `val` + * @return {*} Native javascript type + */ + +module.exports = function kindOf(val) { + // primitivies + if (typeof val === 'undefined') { + return 'undefined'; + } + if (val === null) { + return 'null'; + } + if (val === true || val === false || val instanceof Boolean) { + return 'boolean'; + } + if (typeof val === 'string' || val instanceof String) { + return 'string'; + } + if (typeof val === 'number' || val instanceof Number) { + return 'number'; + } + + // functions + if (typeof val === 'function' || val instanceof Function) { + return 'function'; + } + + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; + } + + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } + + // other objects + var type = toString.call(val); + + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + if (type === '[object Error]') { + return 'error'; + } + + // buffer + if (isBuffer(val)) { + return 'buffer'; + } + + // es6: Map, WeakMap, Set, WeakSet + if (type === '[object Set]') { + return 'set'; + } + if (type === '[object WeakSet]') { + return 'weakset'; + } + if (type === '[object Map]') { + return 'map'; + } + if (type === '[object WeakMap]') { + return 'weakmap'; + } + if (type === '[object Symbol]') { + return 'symbol'; + } + + // typed arrays + if (type === '[object Int8Array]') { + return 'int8array'; + } + if (type === '[object Uint8Array]') { + return 'uint8array'; + } + if (type === '[object Uint8ClampedArray]') { + return 'uint8clampedarray'; + } + if (type === '[object Int16Array]') { + return 'int16array'; + } + if (type === '[object Uint16Array]') { + return 'uint16array'; + } + if (type === '[object Int32Array]') { + return 'int32array'; + } + if (type === '[object Uint32Array]') { + return 'uint32array'; + } + if (type === '[object Float32Array]') { + return 'float32array'; + } + if (type === '[object Float64Array]') { + return 'float64array'; + } + + // must be a plain object + return 'object'; +}; diff --git a/node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/package.json b/node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/package.json new file mode 100644 index 0000000..a0fcbd8 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of/package.json @@ -0,0 +1,139 @@ +{ + "_from": "kind-of@^3.0.2", + "_id": "kind-of@3.2.2", + "_inBundle": false, + "_integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "_location": "/static-extend/is-accessor-descriptor/kind-of", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "kind-of@^3.0.2", + "name": "kind-of", + "escapedName": "kind-of", + "rawSpec": "^3.0.2", + "saveSpec": null, + "fetchSpec": "^3.0.2" + }, + "_requiredBy": [ + "/static-extend/is-accessor-descriptor" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "_shasum": "31ea21a734bab9bbb0f32466d893aea51e4a3c64", + "_spec": "kind-of@^3.0.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/static-extend/node_modules/is-accessor-descriptor", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/kind-of/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "David Fox-Powell", + "url": "https://dtothefp.github.io/me" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Ken Sheedlo", + "url": "kensheedlo.com" + }, + { + "name": "laggingreflex", + "url": "https://github.com/laggingreflex" + }, + { + "name": "Miguel Mota", + "url": "https://miguelmota.com" + }, + { + "name": "Peter deHaan", + "url": "http://about.me/peterdehaan" + } + ], + "dependencies": { + "is-buffer": "^1.1.5" + }, + "deprecated": false, + "description": "Get the native type of a value.", + "devDependencies": { + "ansi-bold": "^0.1.1", + "benchmarked": "^1.0.0", + "browserify": "^14.3.0", + "glob": "^7.1.1", + "gulp-format-md": "^0.1.12", + "mocha": "^3.3.0", + "type-of": "^2.0.1", + "typeof": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/kind-of", + "keywords": [ + "arguments", + "array", + "boolean", + "check", + "date", + "function", + "is", + "is-type", + "is-type-of", + "kind", + "kind-of", + "number", + "object", + "of", + "regexp", + "string", + "test", + "type", + "type-of", + "typeof", + "types" + ], + "license": "MIT", + "main": "index.js", + "name": "kind-of", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/kind-of.git" + }, + "scripts": { + "prepublish": "browserify -o browser.js -e index.js -s index --bare", + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-glob", + "is-number", + "is-primitive" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb" + ] + }, + "version": "3.2.2" +} diff --git a/node_modules/static-extend/node_modules/is-accessor-descriptor/package.json b/node_modules/static-extend/node_modules/is-accessor-descriptor/package.json new file mode 100644 index 0000000..c38d6d9 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-accessor-descriptor/package.json @@ -0,0 +1,94 @@ +{ + "_from": "is-accessor-descriptor@^0.1.6", + "_id": "is-accessor-descriptor@0.1.6", + "_inBundle": false, + "_integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "_location": "/static-extend/is-accessor-descriptor", + "_phantomChildren": { + "is-buffer": "1.1.6" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-accessor-descriptor@^0.1.6", + "name": "is-accessor-descriptor", + "escapedName": "is-accessor-descriptor", + "rawSpec": "^0.1.6", + "saveSpec": null, + "fetchSpec": "^0.1.6" + }, + "_requiredBy": [ + "/static-extend/is-descriptor" + ], + "_resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "_shasum": "a9e12cb3ae8d876727eeef3843f8a0897b5c98d6", + "_spec": "is-accessor-descriptor@^0.1.6", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/static-extend/node_modules/is-descriptor", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-accessor-descriptor/issues" + }, + "bundleDependencies": false, + "dependencies": { + "kind-of": "^3.0.2" + }, + "deprecated": false, + "description": "Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/is-accessor-descriptor", + "keywords": [ + "accessor", + "check", + "data", + "descriptor", + "get", + "getter", + "is", + "keys", + "object", + "properties", + "property", + "set", + "setter", + "type", + "valid", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "is-accessor-descriptor", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/is-accessor-descriptor.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-accessor-descriptor", + "is-data-descriptor", + "is-descriptor", + "isobject" + ] + }, + "plugins": [ + "gulp-format-md" + ], + "layout": "default" + }, + "version": "0.1.6" +} diff --git a/node_modules/static-extend/node_modules/is-data-descriptor/LICENSE b/node_modules/static-extend/node_modules/is-data-descriptor/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/node_modules/static-extend/node_modules/is-data-descriptor/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 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/node_modules/static-extend/node_modules/is-data-descriptor/README.md b/node_modules/static-extend/node_modules/is-data-descriptor/README.md new file mode 100644 index 0000000..41e1643 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-data-descriptor/README.md @@ -0,0 +1,128 @@ +# is-data-descriptor [![NPM version](https://img.shields.io/npm/v/is-data-descriptor.svg)](https://www.npmjs.com/package/is-data-descriptor) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-data-descriptor.svg)](https://travis-ci.org/jonschlinkert/is-data-descriptor) + +> Returns true if a value has the characteristics of a valid JavaScript data descriptor. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm i is-data-descriptor --save +``` + +## Usage + +```js +var isDataDesc = require('is-data-descriptor'); +``` + +## Examples + +`true` when the descriptor has valid properties with valid values. + +```js +// `value` can be anything +isDataDesc({value: 'foo'}) +isDataDesc({value: function() {}}) +isDataDesc({value: true}) +//=> true +``` + +`false` when not an object + +```js +isDataDesc('a') +//=> false +isDataDesc(null) +//=> false +isDataDesc([]) +//=> false +``` + +`false` when the object has invalid properties + +```js +isDataDesc({value: 'foo', bar: 'baz'}) +//=> false +isDataDesc({value: 'foo', bar: 'baz'}) +//=> false +isDataDesc({value: 'foo', get: function(){}}) +//=> false +isDataDesc({get: function(){}, value: 'foo'}) +//=> false +``` + +`false` when a value is not the correct type + +```js +isDataDesc({value: 'foo', enumerable: 'foo'}) +//=> false +isDataDesc({value: 'foo', configurable: 'foo'}) +//=> false +isDataDesc({value: 'foo', writable: 'foo'}) +//=> false +``` + +## Valid properties + +The only valid data descriptor properties are the following: + +* `configurable` (required) +* `enumerable` (required) +* `value` (optional) +* `writable` (optional) + +To be a valid data descriptor, either `value` or `writable` must be defined. + +**Invalid properties** + +A descriptor may have additional _invalid_ properties (an error will **not** be thrown). + +```js +var foo = {}; + +Object.defineProperty(foo, 'bar', { + enumerable: true, + whatever: 'blah', // invalid, but doesn't cause an error + get: function() { + return 'baz'; + } +}); + +console.log(foo.bar); +//=> 'baz' +``` + +## Related projects + +* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor) +* [is-descriptor](https://www.npmjs.com/package/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://www.npmjs.com/package/is-descriptor) | [homepage](https://github.com/jonschlinkert/is-descriptor) +* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject) + +## Running tests + +Install dev dependencies: + +```sh +$ 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-data-descriptor/issues/new). + +## Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert) +Released under the MIT license. + +*** + +_This file was generated by [verb](https://github.com/verbose/verb) on December 28, 2015._ \ No newline at end of file diff --git a/node_modules/static-extend/node_modules/is-data-descriptor/index.js b/node_modules/static-extend/node_modules/is-data-descriptor/index.js new file mode 100644 index 0000000..d4d09c9 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-data-descriptor/index.js @@ -0,0 +1,55 @@ +/*! + * is-data-descriptor + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var typeOf = require('kind-of'); + +// data descriptor properties +var data = { + configurable: 'boolean', + enumerable: 'boolean', + writable: 'boolean' +}; + +function isDataDescriptor(obj, prop) { + if (typeOf(obj) !== 'object') { + return false; + } + + if (typeof prop === 'string') { + var val = Object.getOwnPropertyDescriptor(obj, prop); + return typeof val !== 'undefined'; + } + + if (!('value' in obj) && !('writable' in obj)) { + return false; + } + + for (var key in obj) { + if (key === 'value') continue; + + if (!data.hasOwnProperty(key)) { + continue; + } + + if (typeOf(obj[key]) === data[key]) { + continue; + } + + if (typeof obj[key] !== 'undefined') { + return false; + } + } + return true; +} + +/** + * Expose `isDataDescriptor` + */ + +module.exports = isDataDescriptor; diff --git a/node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/LICENSE b/node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/LICENSE new file mode 100644 index 0000000..d734237 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, 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/node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/README.md b/node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/README.md new file mode 100644 index 0000000..6a9df36 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/README.md @@ -0,0 +1,261 @@ +# kind-of [![NPM version](https://img.shields.io/npm/v/kind-of.svg?style=flat)](https://www.npmjs.com/package/kind-of) [![NPM monthly downloads](https://img.shields.io/npm/dm/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![NPM total downloads](https://img.shields.io/npm/dt/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/kind-of.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/kind-of) + +> Get the native type of a value. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save kind-of +``` + +## Install + +Install with [bower](https://bower.io/) + +```sh +$ bower install kind-of --save +``` + +## Usage + +> es5, browser and es6 ready + +```js +var kindOf = require('kind-of'); + +kindOf(undefined); +//=> 'undefined' + +kindOf(null); +//=> 'null' + +kindOf(true); +//=> 'boolean' + +kindOf(false); +//=> 'boolean' + +kindOf(new Boolean(true)); +//=> 'boolean' + +kindOf(new Buffer('')); +//=> 'buffer' + +kindOf(42); +//=> 'number' + +kindOf(new Number(42)); +//=> 'number' + +kindOf('str'); +//=> 'string' + +kindOf(new String('str')); +//=> 'string' + +kindOf(arguments); +//=> 'arguments' + +kindOf({}); +//=> 'object' + +kindOf(Object.create(null)); +//=> 'object' + +kindOf(new Test()); +//=> 'object' + +kindOf(new Date()); +//=> 'date' + +kindOf([]); +//=> 'array' + +kindOf([1, 2, 3]); +//=> 'array' + +kindOf(new Array()); +//=> 'array' + +kindOf(/foo/); +//=> 'regexp' + +kindOf(new RegExp('foo')); +//=> 'regexp' + +kindOf(function () {}); +//=> 'function' + +kindOf(function * () {}); +//=> 'function' + +kindOf(new Function()); +//=> 'function' + +kindOf(new Map()); +//=> 'map' + +kindOf(new WeakMap()); +//=> 'weakmap' + +kindOf(new Set()); +//=> 'set' + +kindOf(new WeakSet()); +//=> 'weakset' + +kindOf(Symbol('str')); +//=> 'symbol' + +kindOf(new Int8Array()); +//=> 'int8array' + +kindOf(new Uint8Array()); +//=> 'uint8array' + +kindOf(new Uint8ClampedArray()); +//=> 'uint8clampedarray' + +kindOf(new Int16Array()); +//=> 'int16array' + +kindOf(new Uint16Array()); +//=> 'uint16array' + +kindOf(new Int32Array()); +//=> 'int32array' + +kindOf(new Uint32Array()); +//=> 'uint32array' + +kindOf(new Float32Array()); +//=> 'float32array' + +kindOf(new Float64Array()); +//=> 'float64array' +``` + +## Benchmarks + +Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of). +Note that performaces is slower for es6 features `Map`, `WeakMap`, `Set` and `WeakSet`. + +```bash +#1: array + current x 23,329,397 ops/sec ±0.82% (94 runs sampled) + lib-type-of x 4,170,273 ops/sec ±0.55% (94 runs sampled) + lib-typeof x 9,686,935 ops/sec ±0.59% (98 runs sampled) + +#2: boolean + current x 27,197,115 ops/sec ±0.85% (94 runs sampled) + lib-type-of x 3,145,791 ops/sec ±0.73% (97 runs sampled) + lib-typeof x 9,199,562 ops/sec ±0.44% (99 runs sampled) + +#3: date + current x 20,190,117 ops/sec ±0.86% (92 runs sampled) + lib-type-of x 5,166,970 ops/sec ±0.74% (94 runs sampled) + lib-typeof x 9,610,821 ops/sec ±0.50% (96 runs sampled) + +#4: function + current x 23,855,460 ops/sec ±0.60% (97 runs sampled) + lib-type-of x 5,667,740 ops/sec ±0.54% (100 runs sampled) + lib-typeof x 10,010,644 ops/sec ±0.44% (100 runs sampled) + +#5: null + current x 27,061,047 ops/sec ±0.97% (96 runs sampled) + lib-type-of x 13,965,573 ops/sec ±0.62% (97 runs sampled) + lib-typeof x 8,460,194 ops/sec ±0.61% (97 runs sampled) + +#6: number + current x 25,075,682 ops/sec ±0.53% (99 runs sampled) + lib-type-of x 2,266,405 ops/sec ±0.41% (98 runs sampled) + lib-typeof x 9,821,481 ops/sec ±0.45% (99 runs sampled) + +#7: object + current x 3,348,980 ops/sec ±0.49% (99 runs sampled) + lib-type-of x 3,245,138 ops/sec ±0.60% (94 runs sampled) + lib-typeof x 9,262,952 ops/sec ±0.59% (99 runs sampled) + +#8: regex + current x 21,284,827 ops/sec ±0.72% (96 runs sampled) + lib-type-of x 4,689,241 ops/sec ±0.43% (100 runs sampled) + lib-typeof x 8,957,593 ops/sec ±0.62% (98 runs sampled) + +#9: string + current x 25,379,234 ops/sec ±0.58% (96 runs sampled) + lib-type-of x 3,635,148 ops/sec ±0.76% (93 runs sampled) + lib-typeof x 9,494,134 ops/sec ±0.49% (98 runs sampled) + +#10: undef + current x 27,459,221 ops/sec ±1.01% (93 runs sampled) + lib-type-of x 14,360,433 ops/sec ±0.52% (99 runs sampled) + lib-typeof x 23,202,868 ops/sec ±0.59% (94 runs sampled) + +``` + +## Optimizations + +In 7 out of 8 cases, this library is 2x-10x faster than other top libraries included in the benchmarks. There are a few things that lead to this performance advantage, none of them hard and fast rules, but all of them simple and repeatable in almost any code library: + +1. Optimize around the fastest and most common use cases first. Of course, this will change from project-to-project, but I took some time to understand how and why `typeof` checks were being used in my own libraries and other libraries I use a lot. +2. Optimize around bottlenecks - In other words, the order in which conditionals are implemented is significant, because each check is only as fast as the failing checks that came before it. Here, the biggest bottleneck by far is checking for plain objects (an object that was created by the `Object` constructor). I opted to make this check happen by process of elimination rather than brute force up front (e.g. by using something like `val.constructor.name`), so that every other type check would not be penalized it. +3. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'` + +## About + +### Related projects + +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number "Returns true if the value is a number. comprehensive tests.") +* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 59 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [miguelmota](https://github.com/miguelmota) | +| 1 | [dtothefp](https://github.com/dtothefp) | +| 1 | [ksheedlo](https://github.com/ksheedlo) | +| 1 | [pdehaan](https://github.com/pdehaan) | +| 1 | [laggingreflex](https://github.com/laggingreflex) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 16, 2017._ \ No newline at end of file diff --git a/node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/index.js b/node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/index.js new file mode 100644 index 0000000..b52c291 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/index.js @@ -0,0 +1,116 @@ +var isBuffer = require('is-buffer'); +var toString = Object.prototype.toString; + +/** + * Get the native `typeof` a value. + * + * @param {*} `val` + * @return {*} Native javascript type + */ + +module.exports = function kindOf(val) { + // primitivies + if (typeof val === 'undefined') { + return 'undefined'; + } + if (val === null) { + return 'null'; + } + if (val === true || val === false || val instanceof Boolean) { + return 'boolean'; + } + if (typeof val === 'string' || val instanceof String) { + return 'string'; + } + if (typeof val === 'number' || val instanceof Number) { + return 'number'; + } + + // functions + if (typeof val === 'function' || val instanceof Function) { + return 'function'; + } + + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; + } + + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } + + // other objects + var type = toString.call(val); + + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + if (type === '[object Error]') { + return 'error'; + } + + // buffer + if (isBuffer(val)) { + return 'buffer'; + } + + // es6: Map, WeakMap, Set, WeakSet + if (type === '[object Set]') { + return 'set'; + } + if (type === '[object WeakSet]') { + return 'weakset'; + } + if (type === '[object Map]') { + return 'map'; + } + if (type === '[object WeakMap]') { + return 'weakmap'; + } + if (type === '[object Symbol]') { + return 'symbol'; + } + + // typed arrays + if (type === '[object Int8Array]') { + return 'int8array'; + } + if (type === '[object Uint8Array]') { + return 'uint8array'; + } + if (type === '[object Uint8ClampedArray]') { + return 'uint8clampedarray'; + } + if (type === '[object Int16Array]') { + return 'int16array'; + } + if (type === '[object Uint16Array]') { + return 'uint16array'; + } + if (type === '[object Int32Array]') { + return 'int32array'; + } + if (type === '[object Uint32Array]') { + return 'uint32array'; + } + if (type === '[object Float32Array]') { + return 'float32array'; + } + if (type === '[object Float64Array]') { + return 'float64array'; + } + + // must be a plain object + return 'object'; +}; diff --git a/node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/package.json b/node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/package.json new file mode 100644 index 0000000..399b5ad --- /dev/null +++ b/node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of/package.json @@ -0,0 +1,139 @@ +{ + "_from": "kind-of@^3.0.2", + "_id": "kind-of@3.2.2", + "_inBundle": false, + "_integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "_location": "/static-extend/is-data-descriptor/kind-of", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "kind-of@^3.0.2", + "name": "kind-of", + "escapedName": "kind-of", + "rawSpec": "^3.0.2", + "saveSpec": null, + "fetchSpec": "^3.0.2" + }, + "_requiredBy": [ + "/static-extend/is-data-descriptor" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "_shasum": "31ea21a734bab9bbb0f32466d893aea51e4a3c64", + "_spec": "kind-of@^3.0.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/static-extend/node_modules/is-data-descriptor", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/kind-of/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "David Fox-Powell", + "url": "https://dtothefp.github.io/me" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Ken Sheedlo", + "url": "kensheedlo.com" + }, + { + "name": "laggingreflex", + "url": "https://github.com/laggingreflex" + }, + { + "name": "Miguel Mota", + "url": "https://miguelmota.com" + }, + { + "name": "Peter deHaan", + "url": "http://about.me/peterdehaan" + } + ], + "dependencies": { + "is-buffer": "^1.1.5" + }, + "deprecated": false, + "description": "Get the native type of a value.", + "devDependencies": { + "ansi-bold": "^0.1.1", + "benchmarked": "^1.0.0", + "browserify": "^14.3.0", + "glob": "^7.1.1", + "gulp-format-md": "^0.1.12", + "mocha": "^3.3.0", + "type-of": "^2.0.1", + "typeof": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/kind-of", + "keywords": [ + "arguments", + "array", + "boolean", + "check", + "date", + "function", + "is", + "is-type", + "is-type-of", + "kind", + "kind-of", + "number", + "object", + "of", + "regexp", + "string", + "test", + "type", + "type-of", + "typeof", + "types" + ], + "license": "MIT", + "main": "index.js", + "name": "kind-of", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/kind-of.git" + }, + "scripts": { + "prepublish": "browserify -o browser.js -e index.js -s index --bare", + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-glob", + "is-number", + "is-primitive" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb" + ] + }, + "version": "3.2.2" +} diff --git a/node_modules/static-extend/node_modules/is-data-descriptor/package.json b/node_modules/static-extend/node_modules/is-data-descriptor/package.json new file mode 100644 index 0000000..fdf64b5 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-data-descriptor/package.json @@ -0,0 +1,93 @@ +{ + "_from": "is-data-descriptor@^0.1.4", + "_id": "is-data-descriptor@0.1.4", + "_inBundle": false, + "_integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "_location": "/static-extend/is-data-descriptor", + "_phantomChildren": { + "is-buffer": "1.1.6" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-data-descriptor@^0.1.4", + "name": "is-data-descriptor", + "escapedName": "is-data-descriptor", + "rawSpec": "^0.1.4", + "saveSpec": null, + "fetchSpec": "^0.1.4" + }, + "_requiredBy": [ + "/static-extend/is-descriptor" + ], + "_resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "_shasum": "0b5ee648388e2c860282e793f1856fec3f301b56", + "_spec": "is-data-descriptor@^0.1.4", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/static-extend/node_modules/is-descriptor", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-data-descriptor/issues" + }, + "bundleDependencies": false, + "dependencies": { + "kind-of": "^3.0.2" + }, + "deprecated": false, + "description": "Returns true if a value has the characteristics of a valid JavaScript data descriptor.", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/is-data-descriptor", + "keywords": [ + "accessor", + "check", + "data", + "descriptor", + "get", + "getter", + "is", + "keys", + "object", + "properties", + "property", + "set", + "setter", + "type", + "valid", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "is-data-descriptor", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/is-data-descriptor.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-accessor-descriptor", + "is-data-descriptor", + "is-descriptor", + "isobject" + ] + }, + "plugins": [ + "gulp-format-md" + ] + }, + "version": "0.1.4" +} diff --git a/node_modules/static-extend/node_modules/is-descriptor/LICENSE b/node_modules/static-extend/node_modules/is-descriptor/LICENSE new file mode 100644 index 0000000..c0d7f13 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-descriptor/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-2017, 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. \ No newline at end of file diff --git a/node_modules/static-extend/node_modules/is-descriptor/README.md b/node_modules/static-extend/node_modules/is-descriptor/README.md new file mode 100644 index 0000000..658e533 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-descriptor/README.md @@ -0,0 +1,193 @@ +# is-descriptor [![NPM version](https://img.shields.io/npm/v/is-descriptor.svg?style=flat)](https://www.npmjs.com/package/is-descriptor) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-descriptor.svg?style=flat)](https://npmjs.org/package/is-descriptor) [![NPM total downloads](https://img.shields.io/npm/dt/is-descriptor.svg?style=flat)](https://npmjs.org/package/is-descriptor) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-descriptor.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-descriptor) + +> Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-descriptor +``` + +## Usage + +```js +var isDescriptor = require('is-descriptor'); + +isDescriptor({value: 'foo'}) +//=> true +isDescriptor({get: function(){}, set: function(){}}) +//=> true +isDescriptor({get: 'foo', set: function(){}}) +//=> false +``` + +You may also check for a descriptor by passing an object as the first argument and property name (`string`) as the second argument. + +```js +var obj = {}; +obj.foo = 'abc'; + +Object.defineProperty(obj, 'bar', { + value: 'xyz' +}); + +isDescriptor(obj, 'foo'); +//=> true +isDescriptor(obj, 'bar'); +//=> true +``` + +## Examples + +### value type + +`false` when not an object + +```js +isDescriptor('a'); +//=> false +isDescriptor(null); +//=> false +isDescriptor([]); +//=> false +``` + +### data descriptor + +`true` when the object has valid properties with valid values. + +```js +isDescriptor({value: 'foo'}); +//=> true +isDescriptor({value: noop}); +//=> true +``` + +`false` when the object has invalid properties + +```js +isDescriptor({value: 'foo', bar: 'baz'}); +//=> false +isDescriptor({value: 'foo', bar: 'baz'}); +//=> false +isDescriptor({value: 'foo', get: noop}); +//=> false +isDescriptor({get: noop, value: noop}); +//=> false +``` + +`false` when a value is not the correct type + +```js +isDescriptor({value: 'foo', enumerable: 'foo'}); +//=> false +isDescriptor({value: 'foo', configurable: 'foo'}); +//=> false +isDescriptor({value: 'foo', writable: 'foo'}); +//=> false +``` + +### accessor descriptor + +`true` when the object has valid properties with valid values. + +```js +isDescriptor({get: noop, set: noop}); +//=> true +isDescriptor({get: noop}); +//=> true +isDescriptor({set: noop}); +//=> true +``` + +`false` when the object has invalid properties + +```js +isDescriptor({get: noop, set: noop, bar: 'baz'}); +//=> false +isDescriptor({get: noop, writable: true}); +//=> false +isDescriptor({get: noop, value: true}); +//=> false +``` + +`false` when an accessor is not a function + +```js +isDescriptor({get: noop, set: 'baz'}); +//=> false +isDescriptor({get: 'foo', set: noop}); +//=> false +isDescriptor({get: 'foo', bar: 'baz'}); +//=> false +isDescriptor({get: 'foo', set: 'baz'}); +//=> false +``` + +`false` when a value is not the correct type + +```js +isDescriptor({get: noop, set: noop, enumerable: 'foo'}); +//=> false +isDescriptor({set: noop, configurable: 'foo'}); +//=> false +isDescriptor({get: noop, configurable: 'foo'}); +//=> false +``` + +## About + +### Related projects + +* [is-accessor-descriptor](https://www.npmjs.com/package/is-accessor-descriptor): Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. | [homepage](https://github.com/jonschlinkert/is-accessor-descriptor "Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.") +* [is-data-descriptor](https://www.npmjs.com/package/is-data-descriptor): Returns true if a value has the characteristics of a valid JavaScript data descriptor. | [homepage](https://github.com/jonschlinkert/is-data-descriptor "Returns true if a value has the characteristics of a valid JavaScript data descriptor.") +* [is-descriptor](https://www.npmjs.com/package/is-descriptor): Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for… [more](https://github.com/jonschlinkert/is-descriptor) | [homepage](https://github.com/jonschlinkert/is-descriptor "Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.") +* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 24 | [jonschlinkert](https://github.com/jonschlinkert) | +| 1 | [doowb](https://github.com/doowb) | +| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 22, 2017._ \ No newline at end of file diff --git a/node_modules/static-extend/node_modules/is-descriptor/index.js b/node_modules/static-extend/node_modules/is-descriptor/index.js new file mode 100644 index 0000000..c9b91d7 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-descriptor/index.js @@ -0,0 +1,22 @@ +/*! + * is-descriptor + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var typeOf = require('kind-of'); +var isAccessor = require('is-accessor-descriptor'); +var isData = require('is-data-descriptor'); + +module.exports = function isDescriptor(obj, key) { + if (typeOf(obj) !== 'object') { + return false; + } + if ('get' in obj) { + return isAccessor(obj, key); + } + return isData(obj, key); +}; diff --git a/node_modules/static-extend/node_modules/is-descriptor/package.json b/node_modules/static-extend/node_modules/is-descriptor/package.json new file mode 100644 index 0000000..82c4fc9 --- /dev/null +++ b/node_modules/static-extend/node_modules/is-descriptor/package.json @@ -0,0 +1,114 @@ +{ + "_from": "is-descriptor@^0.1.0", + "_id": "is-descriptor@0.1.6", + "_inBundle": false, + "_integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "_location": "/static-extend/is-descriptor", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-descriptor@^0.1.0", + "name": "is-descriptor", + "escapedName": "is-descriptor", + "rawSpec": "^0.1.0", + "saveSpec": null, + "fetchSpec": "^0.1.0" + }, + "_requiredBy": [ + "/static-extend/define-property" + ], + "_resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "_shasum": "366d8240dde487ca51823b1ab9f07a10a78251ca", + "_spec": "is-descriptor@^0.1.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/static-extend/node_modules/define-property", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-descriptor/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Brian Woodward", + "url": "https://twitter.com/doowb" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "url": "https://github.com/wtgtybhertgeghgtwtg" + } + ], + "dependencies": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "deprecated": false, + "description": "Returns true if a value has the characteristics of a valid JavaScript descriptor. Works for data descriptors and accessor descriptors.", + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.4.2" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/is-descriptor", + "keywords": [ + "accessor", + "check", + "data", + "descriptor", + "get", + "getter", + "is", + "keys", + "object", + "properties", + "property", + "set", + "setter", + "type", + "valid", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "is-descriptor", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/is-descriptor.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-accessor-descriptor", + "is-data-descriptor", + "is-descriptor", + "isobject" + ] + }, + "plugins": [ + "gulp-format-md" + ], + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "lint": { + "reflinks": true + } + }, + "version": "0.1.6" +} diff --git a/node_modules/static-extend/node_modules/kind-of/LICENSE b/node_modules/static-extend/node_modules/kind-of/LICENSE new file mode 100644 index 0000000..3f2eca1 --- /dev/null +++ b/node_modules/static-extend/node_modules/kind-of/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, 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/node_modules/static-extend/node_modules/kind-of/README.md b/node_modules/static-extend/node_modules/kind-of/README.md new file mode 100644 index 0000000..170bf30 --- /dev/null +++ b/node_modules/static-extend/node_modules/kind-of/README.md @@ -0,0 +1,342 @@ +# kind-of [![NPM version](https://img.shields.io/npm/v/kind-of.svg?style=flat)](https://www.npmjs.com/package/kind-of) [![NPM monthly downloads](https://img.shields.io/npm/dm/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![NPM total downloads](https://img.shields.io/npm/dt/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/kind-of.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/kind-of) + +> Get the native type of a value. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save kind-of +``` + +Install with [bower](https://bower.io/) + +```sh +$ bower install kind-of --save +``` + +## Why use this? + +1. [it's fast](#benchmarks) | [optimizations](#optimizations) +2. [better type checking](#better-type-checking) + +## Usage + +> es5, browser and es6 ready + +```js +var kindOf = require('kind-of'); + +kindOf(undefined); +//=> 'undefined' + +kindOf(null); +//=> 'null' + +kindOf(true); +//=> 'boolean' + +kindOf(false); +//=> 'boolean' + +kindOf(new Boolean(true)); +//=> 'boolean' + +kindOf(new Buffer('')); +//=> 'buffer' + +kindOf(42); +//=> 'number' + +kindOf(new Number(42)); +//=> 'number' + +kindOf('str'); +//=> 'string' + +kindOf(new String('str')); +//=> 'string' + +kindOf(arguments); +//=> 'arguments' + +kindOf({}); +//=> 'object' + +kindOf(Object.create(null)); +//=> 'object' + +kindOf(new Test()); +//=> 'object' + +kindOf(new Date()); +//=> 'date' + +kindOf([]); +//=> 'array' + +kindOf([1, 2, 3]); +//=> 'array' + +kindOf(new Array()); +//=> 'array' + +kindOf(/foo/); +//=> 'regexp' + +kindOf(new RegExp('foo')); +//=> 'regexp' + +kindOf(function () {}); +//=> 'function' + +kindOf(function * () {}); +//=> 'function' + +kindOf(new Function()); +//=> 'function' + +kindOf(new Map()); +//=> 'map' + +kindOf(new WeakMap()); +//=> 'weakmap' + +kindOf(new Set()); +//=> 'set' + +kindOf(new WeakSet()); +//=> 'weakset' + +kindOf(Symbol('str')); +//=> 'symbol' + +kindOf(new Int8Array()); +//=> 'int8array' + +kindOf(new Uint8Array()); +//=> 'uint8array' + +kindOf(new Uint8ClampedArray()); +//=> 'uint8clampedarray' + +kindOf(new Int16Array()); +//=> 'int16array' + +kindOf(new Uint16Array()); +//=> 'uint16array' + +kindOf(new Int32Array()); +//=> 'int32array' + +kindOf(new Uint32Array()); +//=> 'uint32array' + +kindOf(new Float32Array()); +//=> 'float32array' + +kindOf(new Float64Array()); +//=> 'float64array' +``` + +## Release history + +### v4.0.0 + +**Added** + +* `promise` support + +### v5.0.0 + +**Added** + +* `Set Iterator` and `Map Iterator` support + +**Fixed** + +* Now returns `generatorfunction` for generator functions + +## Benchmarks + +Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of). +Note that performaces is slower for es6 features `Map`, `WeakMap`, `Set` and `WeakSet`. + +```bash +#1: array + current x 23,329,397 ops/sec ±0.82% (94 runs sampled) + lib-type-of x 4,170,273 ops/sec ±0.55% (94 runs sampled) + lib-typeof x 9,686,935 ops/sec ±0.59% (98 runs sampled) + +#2: boolean + current x 27,197,115 ops/sec ±0.85% (94 runs sampled) + lib-type-of x 3,145,791 ops/sec ±0.73% (97 runs sampled) + lib-typeof x 9,199,562 ops/sec ±0.44% (99 runs sampled) + +#3: date + current x 20,190,117 ops/sec ±0.86% (92 runs sampled) + lib-type-of x 5,166,970 ops/sec ±0.74% (94 runs sampled) + lib-typeof x 9,610,821 ops/sec ±0.50% (96 runs sampled) + +#4: function + current x 23,855,460 ops/sec ±0.60% (97 runs sampled) + lib-type-of x 5,667,740 ops/sec ±0.54% (100 runs sampled) + lib-typeof x 10,010,644 ops/sec ±0.44% (100 runs sampled) + +#5: null + current x 27,061,047 ops/sec ±0.97% (96 runs sampled) + lib-type-of x 13,965,573 ops/sec ±0.62% (97 runs sampled) + lib-typeof x 8,460,194 ops/sec ±0.61% (97 runs sampled) + +#6: number + current x 25,075,682 ops/sec ±0.53% (99 runs sampled) + lib-type-of x 2,266,405 ops/sec ±0.41% (98 runs sampled) + lib-typeof x 9,821,481 ops/sec ±0.45% (99 runs sampled) + +#7: object + current x 3,348,980 ops/sec ±0.49% (99 runs sampled) + lib-type-of x 3,245,138 ops/sec ±0.60% (94 runs sampled) + lib-typeof x 9,262,952 ops/sec ±0.59% (99 runs sampled) + +#8: regex + current x 21,284,827 ops/sec ±0.72% (96 runs sampled) + lib-type-of x 4,689,241 ops/sec ±0.43% (100 runs sampled) + lib-typeof x 8,957,593 ops/sec ±0.62% (98 runs sampled) + +#9: string + current x 25,379,234 ops/sec ±0.58% (96 runs sampled) + lib-type-of x 3,635,148 ops/sec ±0.76% (93 runs sampled) + lib-typeof x 9,494,134 ops/sec ±0.49% (98 runs sampled) + +#10: undef + current x 27,459,221 ops/sec ±1.01% (93 runs sampled) + lib-type-of x 14,360,433 ops/sec ±0.52% (99 runs sampled) + lib-typeof x 23,202,868 ops/sec ±0.59% (94 runs sampled) + +``` + +## Optimizations + +In 7 out of 8 cases, this library is 2x-10x faster than other top libraries included in the benchmarks. There are a few things that lead to this performance advantage, none of them hard and fast rules, but all of them simple and repeatable in almost any code library: + +1. Optimize around the fastest and most common use cases first. Of course, this will change from project-to-project, but I took some time to understand how and why `typeof` checks were being used in my own libraries and other libraries I use a lot. +2. Optimize around bottlenecks - In other words, the order in which conditionals are implemented is significant, because each check is only as fast as the failing checks that came before it. Here, the biggest bottleneck by far is checking for plain objects (an object that was created by the `Object` constructor). I opted to make this check happen by process of elimination rather than brute force up front (e.g. by using something like `val.constructor.name`), so that every other type check would not be penalized it. +3. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'` +4. There is no reason to make the code in a microlib as terse as possible, just to win points for making it shorter. It's always better to favor performant code over terse code. You will always only be using a single `require()` statement to use the library anyway, regardless of how the code is written. + +## Better type checking + +kind-of is more correct than other type checking libs I've looked at. For example, here are some differing results from other popular libs: + +### [typeof](https://github.com/CodingFu/typeof) lib + +Incorrectly tests instances of custom constructors (pretty common): + +```js +var typeOf = require('typeof'); +function Test() {} +console.log(typeOf(new Test())); +//=> 'test' +``` + +Returns `object` instead of `arguments`: + +```js +function foo() { + console.log(typeOf(arguments)) //=> 'object' +} +foo(); +``` + +### [type-of](https://github.com/ForbesLindesay/type-of) lib + +Incorrectly returns `object` for generator functions, buffers, `Map`, `Set`, `WeakMap` and `WeakSet`: + +```js +function * foo() {} +console.log(typeOf(foo)); +//=> 'object' +console.log(typeOf(new Buffer(''))); +//=> 'object' +console.log(typeOf(new Map())); +//=> 'object' +console.log(typeOf(new Set())); +//=> 'object' +console.log(typeOf(new WeakMap())); +//=> 'object' +console.log(typeOf(new WeakSet())); +//=> 'object' +``` + +## About + +
    +Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
    + +
    +Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
    + +
    +Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
    + +### Related projects + +You might also be interested in these projects: + +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number "Returns true if the value is a number. comprehensive tests.") +* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 82 | [jonschlinkert](https://github.com/jonschlinkert) | +| 3 | [aretecode](https://github.com/aretecode) | +| 2 | [miguelmota](https://github.com/miguelmota) | +| 1 | [dtothefp](https://github.com/dtothefp) | +| 1 | [ksheedlo](https://github.com/ksheedlo) | +| 1 | [pdehaan](https://github.com/pdehaan) | +| 1 | [laggingreflex](https://github.com/laggingreflex) | +| 1 | [charlike](https://github.com/charlike) | + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on October 13, 2017._ \ No newline at end of file diff --git a/node_modules/static-extend/node_modules/kind-of/index.js b/node_modules/static-extend/node_modules/kind-of/index.js new file mode 100644 index 0000000..fc5cde9 --- /dev/null +++ b/node_modules/static-extend/node_modules/kind-of/index.js @@ -0,0 +1,147 @@ +var toString = Object.prototype.toString; + +/** + * Get the native `typeof` a value. + * + * @param {*} `val` + * @return {*} Native javascript type + */ + +module.exports = function kindOf(val) { + var type = typeof val; + + // primitivies + if (type === 'undefined') { + return 'undefined'; + } + if (val === null) { + return 'null'; + } + if (val === true || val === false || val instanceof Boolean) { + return 'boolean'; + } + if (type === 'string' || val instanceof String) { + return 'string'; + } + if (type === 'number' || val instanceof Number) { + return 'number'; + } + + // functions + if (type === 'function' || val instanceof Function) { + if (typeof val.constructor.name !== 'undefined' && val.constructor.name.slice(0, 9) === 'Generator') { + return 'generatorfunction'; + } + return 'function'; + } + + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; + } + + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } + + // other objects + type = toString.call(val); + + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + if (type === '[object Error]') { + return 'error'; + } + if (type === '[object Promise]') { + return 'promise'; + } + + // buffer + if (isBuffer(val)) { + return 'buffer'; + } + + // es6: Map, WeakMap, Set, WeakSet + if (type === '[object Set]') { + return 'set'; + } + if (type === '[object WeakSet]') { + return 'weakset'; + } + if (type === '[object Map]') { + return 'map'; + } + if (type === '[object WeakMap]') { + return 'weakmap'; + } + if (type === '[object Symbol]') { + return 'symbol'; + } + + if (type === '[object Map Iterator]') { + return 'mapiterator'; + } + if (type === '[object Set Iterator]') { + return 'setiterator'; + } + if (type === '[object String Iterator]') { + return 'stringiterator'; + } + if (type === '[object Array Iterator]') { + return 'arrayiterator'; + } + + // typed arrays + if (type === '[object Int8Array]') { + return 'int8array'; + } + if (type === '[object Uint8Array]') { + return 'uint8array'; + } + if (type === '[object Uint8ClampedArray]') { + return 'uint8clampedarray'; + } + if (type === '[object Int16Array]') { + return 'int16array'; + } + if (type === '[object Uint16Array]') { + return 'uint16array'; + } + if (type === '[object Int32Array]') { + return 'int32array'; + } + if (type === '[object Uint32Array]') { + return 'uint32array'; + } + if (type === '[object Float32Array]') { + return 'float32array'; + } + if (type === '[object Float64Array]') { + return 'float64array'; + } + + // must be a plain object + return 'object'; +}; + +/** + * If you need to support Safari 5-7 (8-10 yr-old browser), + * take a look at https://github.com/feross/is-buffer + */ + +function isBuffer(val) { + return val.constructor + && typeof val.constructor.isBuffer === 'function' + && val.constructor.isBuffer(val); +} diff --git a/node_modules/static-extend/node_modules/kind-of/package.json b/node_modules/static-extend/node_modules/kind-of/package.json new file mode 100644 index 0000000..09a3779 --- /dev/null +++ b/node_modules/static-extend/node_modules/kind-of/package.json @@ -0,0 +1,146 @@ +{ + "_from": "kind-of@^5.0.0", + "_id": "kind-of@5.1.0", + "_inBundle": false, + "_integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "_location": "/static-extend/kind-of", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "kind-of@^5.0.0", + "name": "kind-of", + "escapedName": "kind-of", + "rawSpec": "^5.0.0", + "saveSpec": null, + "fetchSpec": "^5.0.0" + }, + "_requiredBy": [ + "/static-extend/is-descriptor" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "_shasum": "729c91e2d857b7a419a1f9aa65685c4c33f5845d", + "_spec": "kind-of@^5.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/static-extend/node_modules/is-descriptor", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/kind-of/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "David Fox-Powell", + "url": "https://dtothefp.github.io/me" + }, + { + "name": "James", + "url": "https://twitter.com/aretecode" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Ken Sheedlo", + "url": "kensheedlo.com" + }, + { + "name": "laggingreflex", + "url": "https://github.com/laggingreflex" + }, + { + "name": "Miguel Mota", + "url": "https://miguelmota.com" + }, + { + "name": "Peter deHaan", + "url": "http://about.me/peterdehaan" + }, + { + "name": "tunnckoCore", + "url": "https://i.am.charlike.online" + } + ], + "deprecated": false, + "description": "Get the native type of a value.", + "devDependencies": { + "ansi-bold": "^0.1.1", + "benchmarked": "^1.1.1", + "browserify": "^14.4.0", + "gulp-format-md": "^0.1.12", + "matched": "^0.4.4", + "mocha": "^3.4.2", + "type-of": "^2.0.1", + "typeof": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/kind-of", + "keywords": [ + "arguments", + "array", + "boolean", + "check", + "date", + "function", + "is", + "is-type", + "is-type-of", + "kind", + "kind-of", + "number", + "object", + "of", + "regexp", + "string", + "test", + "type", + "type-of", + "typeof", + "types" + ], + "license": "MIT", + "main": "index.js", + "name": "kind-of", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/kind-of.git" + }, + "scripts": { + "prepublish": "browserify -o browser.js -e index.js -s index --bare", + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "is-glob", + "is-number", + "is-primitive" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "type-of", + "typeof", + "verb" + ] + }, + "version": "5.1.0" +} diff --git a/node_modules/static-extend/package.json b/node_modules/static-extend/package.json new file mode 100644 index 0000000..784b323 --- /dev/null +++ b/node_modules/static-extend/package.json @@ -0,0 +1,96 @@ +{ + "_from": "static-extend@^0.1.1", + "_id": "static-extend@0.1.2", + "_inBundle": false, + "_integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "_location": "/static-extend", + "_phantomChildren": { + "is-buffer": "1.1.6" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "static-extend@^0.1.1", + "name": "static-extend", + "escapedName": "static-extend", + "rawSpec": "^0.1.1", + "saveSpec": null, + "fetchSpec": "^0.1.1" + }, + "_requiredBy": [ + "/class-utils" + ], + "_resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "_shasum": "60809c39cbff55337226fd5e0b520f341f1fb5c6", + "_spec": "static-extend@^0.1.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/class-utils", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/static-extend/issues" + }, + "bundleDependencies": false, + "dependencies": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "deprecated": false, + "description": "Adds a static `extend` method to a class, to simplify inheritance. Extends the static properties, prototype properties, and descriptors from a `Parent` constructor onto `Child` constructors.", + "devDependencies": { + "gulp-format-md": "^0.1.9", + "mocha": "^2.5.3" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/static-extend", + "keywords": [ + "class", + "ctor", + "descriptor", + "extend", + "extends", + "inherit", + "inheritance", + "merge", + "method", + "prop", + "properties", + "property", + "prototype" + ], + "license": "MIT", + "main": "index.js", + "name": "static-extend", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/static-extend.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "reflinks": [ + "verb", + "verb-readme-generator" + ], + "lint": { + "reflinks": true + } + }, + "version": "0.1.2" +} diff --git a/node_modules/statuses/HISTORY.md b/node_modules/statuses/HISTORY.md new file mode 100644 index 0000000..7b59790 --- /dev/null +++ b/node_modules/statuses/HISTORY.md @@ -0,0 +1,60 @@ +1.4.0 / 2017-10-20 +================== + + * Add `STATUS_CODES` export + +1.3.1 / 2016-11-11 +================== + + * Fix return type in JSDoc + +1.3.0 / 2016-05-17 +================== + + * Add `421 Misdirected Request` + * perf: enable strict mode + +1.2.1 / 2015-02-01 +================== + + * Fix message for status 451 + - `451 Unavailable For Legal Reasons` + +1.2.0 / 2014-09-28 +================== + + * Add `208 Already Repored` + * Add `226 IM Used` + * Add `306 (Unused)` + * Add `415 Unable For Legal Reasons` + * Add `508 Loop Detected` + +1.1.1 / 2014-09-24 +================== + + * Add missing 308 to `codes.json` + +1.1.0 / 2014-09-21 +================== + + * Add `codes.json` for universal support + +1.0.4 / 2014-08-20 +================== + + * Package cleanup + +1.0.3 / 2014-06-08 +================== + + * Add 308 to `.redirect` category + +1.0.2 / 2014-03-13 +================== + + * Add `.retry` category + +1.0.1 / 2014-03-12 +================== + + * Initial release diff --git a/node_modules/statuses/LICENSE b/node_modules/statuses/LICENSE new file mode 100644 index 0000000..28a3161 --- /dev/null +++ b/node_modules/statuses/LICENSE @@ -0,0 +1,23 @@ + +The MIT License (MIT) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2016 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/statuses/README.md b/node_modules/statuses/README.md new file mode 100644 index 0000000..0fe5720 --- /dev/null +++ b/node_modules/statuses/README.md @@ -0,0 +1,127 @@ +# Statuses + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +HTTP status utility for node. + +This module provides a list of status codes and messages sourced from +a few different projects: + + * The [IANA Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml) + * The [Node.js project](https://nodejs.org/) + * The [NGINX project](https://www.nginx.com/) + * The [Apache HTTP Server project](https://httpd.apache.org/) + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install statuses +``` + +## API + + + +```js +var status = require('statuses') +``` + +### var code = status(Integer || String) + +If `Integer` or `String` is a valid HTTP code or status message, then the +appropriate `code` will be returned. Otherwise, an error will be thrown. + + + +```js +status(403) // => 403 +status('403') // => 403 +status('forbidden') // => 403 +status('Forbidden') // => 403 +status(306) // throws, as it's not supported by node.js +``` + +### status.STATUS_CODES + +Returns an object which maps status codes to status messages, in +the same format as the +[Node.js http module](https://nodejs.org/dist/latest/docs/api/http.html#http_http_status_codes). + +### status.codes + +Returns an array of all the status codes as `Integer`s. + +### var msg = status[code] + +Map of `code` to `status message`. `undefined` for invalid `code`s. + + + +```js +status[404] // => 'Not Found' +``` + +### var code = status[msg] + +Map of `status message` to `code`. `msg` can either be title-cased or +lower-cased. `undefined` for invalid `status message`s. + + + +```js +status['not found'] // => 404 +status['Not Found'] // => 404 +``` + +### status.redirect[code] + +Returns `true` if a status code is a valid redirect status. + + + +```js +status.redirect[200] // => undefined +status.redirect[301] // => true +``` + +### status.empty[code] + +Returns `true` if a status code expects an empty body. + + + +```js +status.empty[200] // => undefined +status.empty[204] // => true +status.empty[304] // => true +``` + +### status.retry[code] + +Returns `true` if you should retry the rest. + + + +```js +status.retry[501] // => undefined +status.retry[503] // => true +``` + +[npm-image]: https://img.shields.io/npm/v/statuses.svg +[npm-url]: https://npmjs.org/package/statuses +[node-version-image]: https://img.shields.io/node/v/statuses.svg +[node-version-url]: https://nodejs.org/en/download +[travis-image]: https://img.shields.io/travis/jshttp/statuses.svg +[travis-url]: https://travis-ci.org/jshttp/statuses +[coveralls-image]: https://img.shields.io/coveralls/jshttp/statuses.svg +[coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master +[downloads-image]: https://img.shields.io/npm/dm/statuses.svg +[downloads-url]: https://npmjs.org/package/statuses diff --git a/node_modules/statuses/codes.json b/node_modules/statuses/codes.json new file mode 100644 index 0000000..66f70e3 --- /dev/null +++ b/node_modules/statuses/codes.json @@ -0,0 +1,65 @@ +{ + "100": "Continue", + "101": "Switching Protocols", + "102": "Processing", + "200": "OK", + "201": "Created", + "202": "Accepted", + "203": "Non-Authoritative Information", + "204": "No Content", + "205": "Reset Content", + "206": "Partial Content", + "207": "Multi-Status", + "208": "Already Reported", + "226": "IM Used", + "300": "Multiple Choices", + "301": "Moved Permanently", + "302": "Found", + "303": "See Other", + "304": "Not Modified", + "305": "Use Proxy", + "306": "(Unused)", + "307": "Temporary Redirect", + "308": "Permanent Redirect", + "400": "Bad Request", + "401": "Unauthorized", + "402": "Payment Required", + "403": "Forbidden", + "404": "Not Found", + "405": "Method Not Allowed", + "406": "Not Acceptable", + "407": "Proxy Authentication Required", + "408": "Request Timeout", + "409": "Conflict", + "410": "Gone", + "411": "Length Required", + "412": "Precondition Failed", + "413": "Payload Too Large", + "414": "URI Too Long", + "415": "Unsupported Media Type", + "416": "Range Not Satisfiable", + "417": "Expectation Failed", + "418": "I'm a teapot", + "421": "Misdirected Request", + "422": "Unprocessable Entity", + "423": "Locked", + "424": "Failed Dependency", + "425": "Unordered Collection", + "426": "Upgrade Required", + "428": "Precondition Required", + "429": "Too Many Requests", + "431": "Request Header Fields Too Large", + "451": "Unavailable For Legal Reasons", + "500": "Internal Server Error", + "501": "Not Implemented", + "502": "Bad Gateway", + "503": "Service Unavailable", + "504": "Gateway Timeout", + "505": "HTTP Version Not Supported", + "506": "Variant Also Negotiates", + "507": "Insufficient Storage", + "508": "Loop Detected", + "509": "Bandwidth Limit Exceeded", + "510": "Not Extended", + "511": "Network Authentication Required" +} diff --git a/node_modules/statuses/index.js b/node_modules/statuses/index.js new file mode 100644 index 0000000..4df469a --- /dev/null +++ b/node_modules/statuses/index.js @@ -0,0 +1,113 @@ +/*! + * statuses + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var codes = require('./codes.json') + +/** + * Module exports. + * @public + */ + +module.exports = status + +// status code to message map +status.STATUS_CODES = codes + +// array of status codes +status.codes = populateStatusesMap(status, codes) + +// status codes for redirects +status.redirect = { + 300: true, + 301: true, + 302: true, + 303: true, + 305: true, + 307: true, + 308: true +} + +// status codes for empty bodies +status.empty = { + 204: true, + 205: true, + 304: true +} + +// status codes for when you should retry the request +status.retry = { + 502: true, + 503: true, + 504: true +} + +/** + * Populate the statuses map for given codes. + * @private + */ + +function populateStatusesMap (statuses, codes) { + var arr = [] + + Object.keys(codes).forEach(function forEachCode (code) { + var message = codes[code] + var status = Number(code) + + // Populate properties + statuses[status] = message + statuses[message] = status + statuses[message.toLowerCase()] = status + + // Add to array + arr.push(status) + }) + + return arr +} + +/** + * Get the status code. + * + * Given a number, this will throw if it is not a known status + * code, otherwise the code will be returned. Given a string, + * the string will be parsed for a number and return the code + * if valid, otherwise will lookup the code assuming this is + * the status message. + * + * @param {string|number} code + * @returns {number} + * @public + */ + +function status (code) { + if (typeof code === 'number') { + if (!status[code]) throw new Error('invalid status code: ' + code) + return code + } + + if (typeof code !== 'string') { + throw new TypeError('code must be a number or string') + } + + // '403' + var n = parseInt(code, 10) + if (!isNaN(n)) { + if (!status[n]) throw new Error('invalid status code: ' + n) + return n + } + + n = status[code.toLowerCase()] + if (!n) throw new Error('invalid status message: "' + code + '"') + return n +} diff --git a/node_modules/statuses/package.json b/node_modules/statuses/package.json new file mode 100644 index 0000000..56b5aa8 --- /dev/null +++ b/node_modules/statuses/package.json @@ -0,0 +1,87 @@ +{ + "_from": "statuses@>= 1.3.1 < 2", + "_id": "statuses@1.4.0", + "_inBundle": false, + "_integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==", + "_location": "/statuses", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "statuses@>= 1.3.1 < 2", + "name": "statuses", + "escapedName": "statuses", + "rawSpec": ">= 1.3.1 < 2", + "saveSpec": null, + "fetchSpec": ">= 1.3.1 < 2" + }, + "_requiredBy": [ + "/http-errors" + ], + "_resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "_shasum": "bb73d446da2796106efcc1b601a253d6c46bd087", + "_spec": "statuses@>= 1.3.1 < 2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/http-errors", + "bugs": { + "url": "https://github.com/jshttp/statuses/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com" + } + ], + "deprecated": false, + "description": "HTTP status utility", + "devDependencies": { + "csv-parse": "1.2.4", + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.8.0", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-node": "5.2.0", + "eslint-plugin-promise": "3.6.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "mocha": "1.21.5", + "raw-body": "2.3.2", + "stream-to-array": "2.3.0" + }, + "engines": { + "node": ">= 0.6" + }, + "files": [ + "HISTORY.md", + "index.js", + "codes.json", + "LICENSE" + ], + "homepage": "https://github.com/jshttp/statuses#readme", + "keywords": [ + "http", + "status", + "code" + ], + "license": "MIT", + "name": "statuses", + "repository": { + "type": "git", + "url": "git+https://github.com/jshttp/statuses.git" + }, + "scripts": { + "build": "node scripts/build.js", + "fetch": "node scripts/fetch-apache.js && node scripts/fetch-iana.js && node scripts/fetch-nginx.js && node scripts/fetch-node.js", + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "update": "npm run fetch && npm run build" + }, + "version": "1.4.0" +} diff --git a/node_modules/stream-combiner/.npmignore b/node_modules/stream-combiner/.npmignore new file mode 100644 index 0000000..13abef4 --- /dev/null +++ b/node_modules/stream-combiner/.npmignore @@ -0,0 +1,3 @@ +node_modules +node_modules/* +npm_debug.log diff --git a/node_modules/stream-combiner/.travis.yml b/node_modules/stream-combiner/.travis.yml new file mode 100644 index 0000000..895dbd3 --- /dev/null +++ b/node_modules/stream-combiner/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.6 + - 0.8 diff --git a/node_modules/stream-combiner/LICENSE b/node_modules/stream-combiner/LICENSE new file mode 100644 index 0000000..6d03581 --- /dev/null +++ b/node_modules/stream-combiner/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2012 'Dominic Tarr' + +Permission is hereby granted, free of charge, +to any person obtaining a copy of this software and +associated documentation files (the "Software"), to +deal in the Software without restriction, including +without limitation the rights to use, copy, modify, +merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom +the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/stream-combiner/README.md b/node_modules/stream-combiner/README.md new file mode 100644 index 0000000..565e0e2 --- /dev/null +++ b/node_modules/stream-combiner/README.md @@ -0,0 +1,29 @@ +# stream-combiner + + + +## Combine (stream1,...,streamN) + +Turn a pipeline into a single stream. `pipeline` returns a stream that writes to the first stream +and reads from the last stream. + +Listening for 'error' will recieve errors from all streams inside the pipe. + +``` js + var Combine = require('stream-combiner') + var es = require('event-stream') + + Combine( //connect streams together with `pipe` + process.openStdin(), //open stdin + es.split(), //split stream to break on newlines + es.map(function (data, callback) {//turn this async function into a stream + callback(null + , inspect(JSON.parse(data))) //render it nicely + }), + process.stdout // pipe it to stdout ! + ) +``` + +## License + +MIT diff --git a/node_modules/stream-combiner/index.js b/node_modules/stream-combiner/index.js new file mode 100644 index 0000000..99cf5b6 --- /dev/null +++ b/node_modules/stream-combiner/index.js @@ -0,0 +1,39 @@ +var duplexer = require('duplexer') + +module.exports = function () { + + var streams = [].slice.call(arguments) + , first = streams[0] + , last = streams[streams.length - 1] + , thepipe = duplexer(first, last) + + if(streams.length == 1) + return streams[0] + else if (!streams.length) + throw new Error('connect called with empty args') + + //pipe all the streams together + + function recurse (streams) { + if(streams.length < 2) + return + streams[0].pipe(streams[1]) + recurse(streams.slice(1)) + } + + recurse(streams) + + function onerror () { + var args = [].slice.call(arguments) + args.unshift('error') + thepipe.emit.apply(thepipe, args) + } + + //es.duplex already reemits the error from the first and last stream. + //add a listener for the inner streams in the pipeline. + for(var i = 1; i < streams.length - 1; i ++) + streams[i].on('error', onerror) + + return thepipe +} + diff --git a/node_modules/stream-combiner/package.json b/node_modules/stream-combiner/package.json new file mode 100644 index 0000000..3c177ff --- /dev/null +++ b/node_modules/stream-combiner/package.json @@ -0,0 +1,54 @@ +{ + "_from": "stream-combiner@~0.0.4", + "_id": "stream-combiner@0.0.4", + "_inBundle": false, + "_integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", + "_location": "/stream-combiner", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "stream-combiner@~0.0.4", + "name": "stream-combiner", + "escapedName": "stream-combiner", + "rawSpec": "~0.0.4", + "saveSpec": null, + "fetchSpec": "~0.0.4" + }, + "_requiredBy": [ + "/event-stream" + ], + "_resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "_shasum": "4d5e433c185261dde623ca3f44c586bcf5c4ad14", + "_spec": "stream-combiner@~0.0.4", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/event-stream", + "author": { + "name": "'Dominic Tarr'", + "email": "dominic.tarr@gmail.com", + "url": "http://dominictarr.com" + }, + "bugs": { + "url": "https://github.com/dominictarr/stream-combiner/issues" + }, + "bundleDependencies": false, + "dependencies": { + "duplexer": "~0.1.1" + }, + "deprecated": false, + "description": "", + "devDependencies": { + "event-stream": "~3.0.7", + "tape": "~2.3.0" + }, + "homepage": "https://github.com/dominictarr/stream-combiner", + "license": "MIT", + "name": "stream-combiner", + "repository": { + "type": "git", + "url": "git://github.com/dominictarr/stream-combiner.git" + }, + "scripts": { + "test": "set -e; for t in test/*.js; do node $t; done" + }, + "version": "0.0.4" +} diff --git a/node_modules/stream-combiner/test/index.js b/node_modules/stream-combiner/test/index.js new file mode 100644 index 0000000..d17ddad --- /dev/null +++ b/node_modules/stream-combiner/test/index.js @@ -0,0 +1,52 @@ +var es = require('event-stream') +var combine = require('..') +var test = require('tape') + +test('do not duplicate errors', function (test) { + + var errors = 0; + var pipe = combine( + es.through(function(data) { + return this.emit('data', data); + }), + es.through(function(data) { + return this.emit('error', new Error(data)); + }) + ) + + pipe.on('error', function(err) { + errors++ + test.ok(errors, 'expected error count') + process.nextTick(function () { + return test.end(); + }) + }) + + return pipe.write('meh'); +}) + +test('3 pipe do not duplicate errors', function (test) { + + var errors = 0; + var pipe = combine( + es.through(function(data) { + return this.emit('data', data); + }), + es.through(function(data) { + return this.emit('error', new Error(data)); + }), + es.through() + ) + + pipe.on('error', function(err) { + errors++ + test.ok(errors, 'expected error count') + process.nextTick(function () { + return test.end(); + }) + }) + + return pipe.write('meh'); + +}) + diff --git a/node_modules/string-width/index.js b/node_modules/string-width/index.js new file mode 100644 index 0000000..bbc49d2 --- /dev/null +++ b/node_modules/string-width/index.js @@ -0,0 +1,36 @@ +'use strict'; +const stripAnsi = require('strip-ansi'); +const isFullwidthCodePoint = require('is-fullwidth-code-point'); + +module.exports = str => { + if (typeof str !== 'string' || str.length === 0) { + return 0; + } + + str = stripAnsi(str); + + let width = 0; + + for (let i = 0; i < str.length; i++) { + const code = str.codePointAt(i); + + // Ignore control characters + if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { + continue; + } + + // Ignore combining characters + if (code >= 0x300 && code <= 0x36F) { + continue; + } + + // Surrogates + if (code > 0xFFFF) { + i++; + } + + width += isFullwidthCodePoint(code) ? 2 : 1; + } + + return width; +}; diff --git a/node_modules/string-width/license b/node_modules/string-width/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/string-width/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/string-width/package.json b/node_modules/string-width/package.json new file mode 100644 index 0000000..17d9d84 --- /dev/null +++ b/node_modules/string-width/package.json @@ -0,0 +1,89 @@ +{ + "_from": "string-width@^2.0.0", + "_id": "string-width@2.1.1", + "_inBundle": false, + "_integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "_location": "/string-width", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "string-width@^2.0.0", + "name": "string-width", + "escapedName": "string-width", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/ansi-align", + "/boxen", + "/widest-line" + ], + "_resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "_shasum": "ab93f27a8dc13d28cac815c462143a6d9012ae9e", + "_spec": "string-width@^2.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/boxen", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/string-width/issues" + }, + "bundleDependencies": false, + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "deprecated": false, + "description": "Get the visual width of a string - the number of columns required to display it", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/string-width#readme", + "keywords": [ + "string", + "str", + "character", + "char", + "unicode", + "width", + "visual", + "column", + "columns", + "fullwidth", + "full-width", + "full", + "ansi", + "escape", + "codes", + "cli", + "command-line", + "terminal", + "console", + "cjk", + "chinese", + "japanese", + "korean", + "fixed-width" + ], + "license": "MIT", + "name": "string-width", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/string-width.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "2.1.1" +} diff --git a/node_modules/string-width/readme.md b/node_modules/string-width/readme.md new file mode 100644 index 0000000..df5b719 --- /dev/null +++ b/node_modules/string-width/readme.md @@ -0,0 +1,42 @@ +# string-width [![Build Status](https://travis-ci.org/sindresorhus/string-width.svg?branch=master)](https://travis-ci.org/sindresorhus/string-width) + +> Get the visual width of a string - the number of columns required to display it + +Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. + +Useful to be able to measure the actual width of command-line output. + + +## Install + +``` +$ npm install string-width +``` + + +## Usage + +```js +const stringWidth = require('string-width'); + +stringWidth('古'); +//=> 2 + +stringWidth('\u001b[1m古\u001b[22m'); +//=> 2 + +stringWidth('a'); +//=> 1 +``` + + +## Related + +- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module +- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string +- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/string_decoder/.npmignore b/node_modules/string_decoder/.npmignore new file mode 100644 index 0000000..206320c --- /dev/null +++ b/node_modules/string_decoder/.npmignore @@ -0,0 +1,2 @@ +build +test diff --git a/node_modules/string_decoder/LICENSE b/node_modules/string_decoder/LICENSE new file mode 100644 index 0000000..778edb2 --- /dev/null +++ b/node_modules/string_decoder/LICENSE @@ -0,0 +1,48 @@ +Node.js is licensed for use as follows: + +""" +Copyright Node.js contributors. All rights reserved. + +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 license applies to parts of Node.js originating from the +https://github.com/joyent/node repository: + +""" +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" + diff --git a/node_modules/string_decoder/README.md b/node_modules/string_decoder/README.md new file mode 100644 index 0000000..dc3a2d2 --- /dev/null +++ b/node_modules/string_decoder/README.md @@ -0,0 +1,28 @@ +# string_decoder + +***Node-core v7.0.0 string_decoder for userland*** + + +[![NPM](https://nodei.co/npm/string_decoder.png?downloads=true&downloadRank=true)](https://nodei.co/npm/string_decoder/) +[![NPM](https://nodei.co/npm-dl/string_decoder.png?&months=6&height=3)](https://nodei.co/npm/string_decoder/) + + +```bash +npm install --save string_decoder +``` + +***Node-core string_decoderstring_decoder for userland*** + +This package is a mirror of the string_decoder implementation in Node-core. + +Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v7.8.0/docs/api/). + +As of version 1.0.0 **string_decoder** uses semantic versioning. + +## Previous versions + +Previous version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. + +## Update + +The *build/* directory contains a build script that will scrape the source from the [nodejs/node](https://github.com/nodejs/node) repo given a specific Node version. diff --git a/node_modules/string_decoder/lib/string_decoder.js b/node_modules/string_decoder/lib/string_decoder.js new file mode 100644 index 0000000..26fb94c --- /dev/null +++ b/node_modules/string_decoder/lib/string_decoder.js @@ -0,0 +1,272 @@ +'use strict'; + +var Buffer = require('safe-buffer').Buffer; + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.StringDecoder = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} + +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; + +StringDecoder.prototype.end = utf8End; + +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; + +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; + +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return -1; +} + +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; +} + +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// UTF-8 replacement characters ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'.repeat(p); + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'.repeat(p + 1); + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'.repeat(p + 2); + } + } + } +} + +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; +} + +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} + +// For UTF-8, a replacement character for each buffered byte of a (partial) +// character needs to be added to the output. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'.repeat(this.lastTotal - this.lastNeed); + return r; +} + +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} + +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} + +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} + +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} + +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} + +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} \ No newline at end of file diff --git a/node_modules/string_decoder/package.json b/node_modules/string_decoder/package.json new file mode 100644 index 0000000..b31e101 --- /dev/null +++ b/node_modules/string_decoder/package.json @@ -0,0 +1,56 @@ +{ + "_from": "string_decoder@~1.0.3", + "_id": "string_decoder@1.0.3", + "_inBundle": false, + "_integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "_location": "/string_decoder", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "string_decoder@~1.0.3", + "name": "string_decoder", + "escapedName": "string_decoder", + "rawSpec": "~1.0.3", + "saveSpec": null, + "fetchSpec": "~1.0.3" + }, + "_requiredBy": [ + "/readable-stream" + ], + "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "_shasum": "0fc67d7c141825de94282dd536bec6b9bce860ab", + "_spec": "string_decoder@~1.0.3", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/readable-stream", + "bugs": { + "url": "https://github.com/rvagg/string_decoder/issues" + }, + "bundleDependencies": false, + "dependencies": { + "safe-buffer": "~5.1.0" + }, + "deprecated": false, + "description": "The string_decoder module from Node core", + "devDependencies": { + "babel-polyfill": "^6.23.0", + "tap": "~0.4.8" + }, + "homepage": "https://github.com/rvagg/string_decoder", + "keywords": [ + "string", + "decoder", + "browser", + "browserify" + ], + "license": "MIT", + "main": "lib/string_decoder.js", + "name": "string_decoder", + "repository": { + "type": "git", + "url": "git://github.com/rvagg/string_decoder.git" + }, + "scripts": { + "test": "tap test/parallel/*.js && node test/verify-dependencies" + }, + "version": "1.0.3" +} diff --git a/node_modules/strip-ansi/index.js b/node_modules/strip-ansi/index.js new file mode 100644 index 0000000..96e0292 --- /dev/null +++ b/node_modules/strip-ansi/index.js @@ -0,0 +1,4 @@ +'use strict'; +const ansiRegex = require('ansi-regex'); + +module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input; diff --git a/node_modules/strip-ansi/license b/node_modules/strip-ansi/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/strip-ansi/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/strip-ansi/package.json b/node_modules/strip-ansi/package.json new file mode 100644 index 0000000..0dc9fb8 --- /dev/null +++ b/node_modules/strip-ansi/package.json @@ -0,0 +1,84 @@ +{ + "_from": "strip-ansi@^4.0.0", + "_id": "strip-ansi@4.0.0", + "_inBundle": false, + "_integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "_location": "/strip-ansi", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "strip-ansi@^4.0.0", + "name": "strip-ansi", + "escapedName": "strip-ansi", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/string-width" + ], + "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "_shasum": "a8479022eb1ac368a871389b635262c505ee368f", + "_spec": "strip-ansi@^4.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/string-width", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/chalk/strip-ansi/issues" + }, + "bundleDependencies": false, + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "deprecated": false, + "description": "Strip ANSI escape codes", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/chalk/strip-ansi#readme", + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "license": "MIT", + "name": "strip-ansi", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/strip-ansi.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "4.0.0" +} diff --git a/node_modules/strip-ansi/readme.md b/node_modules/strip-ansi/readme.md new file mode 100644 index 0000000..dc76f0c --- /dev/null +++ b/node_modules/strip-ansi/readme.md @@ -0,0 +1,39 @@ +# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) + +> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +``` +$ npm install strip-ansi +``` + + +## Usage + +```js +const stripAnsi = require('strip-ansi'); + +stripAnsi('\u001B[4mUnicorn\u001B[0m'); +//=> 'Unicorn' +``` + + +## Related + +- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module +- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes +- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + +## License + +MIT diff --git a/node_modules/strip-eof/index.js b/node_modules/strip-eof/index.js new file mode 100644 index 0000000..a17d0af --- /dev/null +++ b/node_modules/strip-eof/index.js @@ -0,0 +1,15 @@ +'use strict'; +module.exports = function (x) { + var lf = typeof x === 'string' ? '\n' : '\n'.charCodeAt(); + var cr = typeof x === 'string' ? '\r' : '\r'.charCodeAt(); + + if (x[x.length - 1] === lf) { + x = x.slice(0, x.length - 1); + } + + if (x[x.length - 1] === cr) { + x = x.slice(0, x.length - 1); + } + + return x; +}; diff --git a/node_modules/strip-eof/license b/node_modules/strip-eof/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/strip-eof/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/strip-eof/package.json b/node_modules/strip-eof/package.json new file mode 100644 index 0000000..06ebfd8 --- /dev/null +++ b/node_modules/strip-eof/package.json @@ -0,0 +1,71 @@ +{ + "_from": "strip-eof@^1.0.0", + "_id": "strip-eof@1.0.0", + "_inBundle": false, + "_integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "_location": "/strip-eof", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "strip-eof@^1.0.0", + "name": "strip-eof", + "escapedName": "strip-eof", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/execa" + ], + "_resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "_shasum": "bb43ff5598a6eb05d89b59fcd129c983313606bf", + "_spec": "strip-eof@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/execa", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/strip-eof/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Strip the End-Of-File (EOF) character from a string/buffer", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/strip-eof#readme", + "keywords": [ + "strip", + "trim", + "remove", + "delete", + "eof", + "end", + "file", + "newline", + "linebreak", + "character", + "string", + "buffer" + ], + "license": "MIT", + "name": "strip-eof", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/strip-eof.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.0.0" +} diff --git a/node_modules/strip-eof/readme.md b/node_modules/strip-eof/readme.md new file mode 100644 index 0000000..45ffe04 --- /dev/null +++ b/node_modules/strip-eof/readme.md @@ -0,0 +1,28 @@ +# strip-eof [![Build Status](https://travis-ci.org/sindresorhus/strip-eof.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-eof) + +> Strip the [End-Of-File](https://en.wikipedia.org/wiki/End-of-file) (EOF) character from a string/buffer + + +## Install + +``` +$ npm install --save strip-eof +``` + + +## Usage + +```js +const stripEof = require('strip-eof'); + +stripEof('foo\nbar\n\n'); +//=> 'foo\nbar\n' + +stripEof(new Buffer('foo\nbar\n\n')).toString(); +//=> 'foo\nbar\n' +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/strip-json-comments/index.js b/node_modules/strip-json-comments/index.js new file mode 100644 index 0000000..4e6576e --- /dev/null +++ b/node_modules/strip-json-comments/index.js @@ -0,0 +1,70 @@ +'use strict'; +var singleComment = 1; +var multiComment = 2; + +function stripWithoutWhitespace() { + return ''; +} + +function stripWithWhitespace(str, start, end) { + return str.slice(start, end).replace(/\S/g, ' '); +} + +module.exports = function (str, opts) { + opts = opts || {}; + + var currentChar; + var nextChar; + var insideString = false; + var insideComment = false; + var offset = 0; + var ret = ''; + var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace; + + for (var i = 0; i < str.length; i++) { + currentChar = str[i]; + nextChar = str[i + 1]; + + if (!insideComment && currentChar === '"') { + var escaped = str[i - 1] === '\\' && str[i - 2] !== '\\'; + if (!escaped) { + insideString = !insideString; + } + } + + if (insideString) { + continue; + } + + if (!insideComment && currentChar + nextChar === '//') { + ret += str.slice(offset, i); + offset = i; + insideComment = singleComment; + i++; + } else if (insideComment === singleComment && currentChar + nextChar === '\r\n') { + i++; + insideComment = false; + ret += strip(str, offset, i); + offset = i; + continue; + } else if (insideComment === singleComment && currentChar === '\n') { + insideComment = false; + ret += strip(str, offset, i); + offset = i; + } else if (!insideComment && currentChar + nextChar === '/*') { + ret += str.slice(offset, i); + offset = i; + insideComment = multiComment; + i++; + continue; + } else if (insideComment === multiComment && currentChar + nextChar === '*/') { + i++; + insideComment = false; + ret += strip(str, offset, i + 1); + offset = i + 1; + continue; + } + } + + return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset)); +}; diff --git a/node_modules/strip-json-comments/license b/node_modules/strip-json-comments/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/strip-json-comments/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/strip-json-comments/package.json b/node_modules/strip-json-comments/package.json new file mode 100644 index 0000000..8262cba --- /dev/null +++ b/node_modules/strip-json-comments/package.json @@ -0,0 +1,74 @@ +{ + "_from": "strip-json-comments@~2.0.1", + "_id": "strip-json-comments@2.0.1", + "_inBundle": false, + "_integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "_location": "/strip-json-comments", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "strip-json-comments@~2.0.1", + "name": "strip-json-comments", + "escapedName": "strip-json-comments", + "rawSpec": "~2.0.1", + "saveSpec": null, + "fetchSpec": "~2.0.1" + }, + "_requiredBy": [ + "/rc" + ], + "_resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "_shasum": "3c531942e908c2697c0ec344858c286c7ca0a60a", + "_spec": "strip-json-comments@~2.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/rc", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/strip-json-comments/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Strip comments from JSON. Lets you use comments in your JSON files!", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/strip-json-comments#readme", + "keywords": [ + "json", + "strip", + "remove", + "delete", + "trim", + "comments", + "multiline", + "parse", + "config", + "configuration", + "conf", + "settings", + "util", + "env", + "environment" + ], + "license": "MIT", + "name": "strip-json-comments", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/strip-json-comments.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "2.0.1" +} diff --git a/node_modules/strip-json-comments/readme.md b/node_modules/strip-json-comments/readme.md new file mode 100644 index 0000000..0ee58df --- /dev/null +++ b/node_modules/strip-json-comments/readme.md @@ -0,0 +1,64 @@ +# strip-json-comments [![Build Status](https://travis-ci.org/sindresorhus/strip-json-comments.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-json-comments) + +> Strip comments from JSON. Lets you use comments in your JSON files! + +This is now possible: + +```js +{ + // rainbows + "unicorn": /* ❤ */ "cake" +} +``` + +It will replace single-line comments `//` and multi-line comments `/**/` with whitespace. This allows JSON error positions to remain as close as possible to the original source. + +Also available as a [gulp](https://github.com/sindresorhus/gulp-strip-json-comments)/[grunt](https://github.com/sindresorhus/grunt-strip-json-comments)/[broccoli](https://github.com/sindresorhus/broccoli-strip-json-comments) plugin. + + +## Install + +``` +$ npm install --save strip-json-comments +``` + + +## Usage + +```js +const json = '{/*rainbows*/"unicorn":"cake"}'; + +JSON.parse(stripJsonComments(json)); +//=> {unicorn: 'cake'} +``` + + +## API + +### stripJsonComments(input, [options]) + +#### input + +Type: `string` + +Accepts a string with JSON and returns a string without comments. + +#### options + +##### whitespace + +Type: `boolean` +Default: `true` + +Replace comments with whitespace instead of stripping them entirely. + + +## Related + +- [strip-json-comments-cli](https://github.com/sindresorhus/strip-json-comments-cli) - CLI for this module +- [strip-css-comments](https://github.com/sindresorhus/strip-css-comments) - Strip comments from CSS + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/supports-color/browser.js b/node_modules/supports-color/browser.js new file mode 100644 index 0000000..62afa3a --- /dev/null +++ b/node_modules/supports-color/browser.js @@ -0,0 +1,5 @@ +'use strict'; +module.exports = { + stdout: false, + stderr: false +}; diff --git a/node_modules/supports-color/index.js b/node_modules/supports-color/index.js new file mode 100644 index 0000000..d0d008a --- /dev/null +++ b/node_modules/supports-color/index.js @@ -0,0 +1,135 @@ +'use strict'; +const os = require('os'); +const hasFlag = require('has-flag'); + +const env = process.env; + +let forceColor; +if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false')) { + forceColor = false; +} else if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + forceColor = true; +} +if ('FORCE_COLOR' in env) { + forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; +} + +function translateLevel(level) { + if (level === 0) { + return false; + } + + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} + +function supportsColor(stream) { + if (forceColor === false) { + return 0; + } + + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; + } + + if (stream && !stream.isTTY && forceColor !== true) { + // VS code debugger doesn't have isTTY set + if (env.VSCODE_PID) { + return 1; + } + return 0; + } + + const min = forceColor ? 1 : 0; + + if (process.platform === 'win32') { + // Node.js 7.5.0 is the first version of Node.js to include a patch to + // libuv that enables 256 color output on Windows. Anything earlier and it + // won't work. However, here we target Node.js 8 at minimum as it is an LTS + // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows + // release that supports 256 colors. Windows 10 build 14931 is the first release + // that supports 16m/TrueColor. + const osRelease = os.release().split('.'); + if ( + Number(process.versions.node.split('.')[0]) >= 8 && + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } + + return 1; + } + + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } + + return min; + } + + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } + + if (env.COLORTERM === 'truecolor') { + return 3; + } + + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Apple_Terminal': + return 2; + // No default + } + } + + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } + + if ('COLORTERM' in env) { + return 1; + } + + if (env.TERM === 'dumb') { + return min; + } + + return min; +} + +function getSupportLevel(stream) { + const level = supportsColor(stream); + return translateLevel(level); +} + +module.exports = { + supportsColor: getSupportLevel, + stdout: getSupportLevel(process.stdout), + stderr: getSupportLevel(process.stderr) +}; diff --git a/node_modules/supports-color/license b/node_modules/supports-color/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/supports-color/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/supports-color/package.json b/node_modules/supports-color/package.json new file mode 100644 index 0000000..b00453c --- /dev/null +++ b/node_modules/supports-color/package.json @@ -0,0 +1,86 @@ +{ + "_from": "supports-color@^5.2.0", + "_id": "supports-color@5.3.0", + "_inBundle": false, + "_integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", + "_location": "/supports-color", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "supports-color@^5.2.0", + "name": "supports-color", + "escapedName": "supports-color", + "rawSpec": "^5.2.0", + "saveSpec": null, + "fetchSpec": "^5.2.0" + }, + "_requiredBy": [ + "/chalk", + "/nodemon" + ], + "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "_shasum": "5b24ac15db80fa927cf5227a4a33fd3c4c7676c0", + "_spec": "supports-color@^5.2.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/nodemon", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "browser": "browser.js", + "bugs": { + "url": "https://github.com/chalk/supports-color/issues" + }, + "bundleDependencies": false, + "dependencies": { + "has-flag": "^3.0.0" + }, + "deprecated": false, + "description": "Detect whether a terminal supports color", + "devDependencies": { + "ava": "*", + "import-fresh": "^2.0.0", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js", + "browser.js" + ], + "homepage": "https://github.com/chalk/supports-color#readme", + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "ansi", + "styles", + "tty", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "support", + "supports", + "capability", + "detect", + "truecolor", + "16m" + ], + "license": "MIT", + "name": "supports-color", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/supports-color.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "5.3.0" +} diff --git a/node_modules/supports-color/readme.md b/node_modules/supports-color/readme.md new file mode 100644 index 0000000..f6e4019 --- /dev/null +++ b/node_modules/supports-color/readme.md @@ -0,0 +1,66 @@ +# supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color) + +> Detect whether a terminal supports color + + +## Install + +``` +$ npm install supports-color +``` + + +## Usage + +```js +const supportsColor = require('supports-color'); + +if (supportsColor.stdout) { + console.log('Terminal stdout supports color'); +} + +if (supportsColor.stdout.has256) { + console.log('Terminal stdout supports 256 colors'); +} + +if (supportsColor.stderr.has16m) { + console.log('Terminal stderr supports 16 million colors (truecolor)'); +} +``` + + +## API + +Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported. + +The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag: + +- `.level = 1` and `.hasBasic = true`: Basic color support (16 colors) +- `.level = 2` and `.has256 = true`: 256 color support +- `.level = 3` and `.has16m = true`: Truecolor support (16 million colors) + + +## Info + +It obeys the `--color` and `--no-color` CLI flags. + +Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks. + +Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively. + + +## Related + +- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + +## License + +MIT diff --git a/node_modules/term-size/index.js b/node_modules/term-size/index.js new file mode 100644 index 0000000..95e410d --- /dev/null +++ b/node_modules/term-size/index.js @@ -0,0 +1,70 @@ +'use strict'; +const path = require('path'); +const execa = require('execa'); + +const create = (columns, rows) => ({ + columns: parseInt(columns, 10), + rows: parseInt(rows, 10) +}); + +module.exports = () => { + const env = process.env; + const stdout = process.stdout; + const stderr = process.stderr; + + if (stdout && stdout.columns && stdout.rows) { + return create(stdout.columns, stdout.rows); + } + + if (stderr && stderr.columns && stderr.rows) { + return create(stderr.columns, stderr.rows); + } + + // These values are static, so not the first choice + if (env.COLUMNS && env.LINES) { + return create(env.COLUMNS, env.LINES); + } + + if (process.platform === 'win32') { + try { + // Binary: https://github.com/sindresorhus/win-term-size + const size = execa.sync(path.join(__dirname, 'vendor/windows/term-size.exe')).stdout.split(/\r?\n/); + + if (size.length === 2) { + return create(size[0], size[1]); + } + } catch (err) {} + } else { + if (process.platform === 'darwin') { + try { + // Binary: https://github.com/sindresorhus/macos-term-size + const size = execa.shellSync(path.join(__dirname, 'vendor/macos/term-size')).stdout.split(/\r?\n/); + + if (size.length === 2) { + return create(size[0], size[1]); + } + } catch (err) {} + } + + // `resize` is preferred as it works even when all file descriptors are redirected + // https://linux.die.net/man/1/resize + try { + const size = execa.sync('resize', ['-u']).stdout.match(/\d+/g); + + if (size.length === 2) { + return create(size[0], size[1]); + } + } catch (err) {} + + try { + const columns = execa.sync('tput', ['cols']).stdout; + const rows = execa.sync('tput', ['lines']).stdout; + + if (columns && rows) { + return create(columns, rows); + } + } catch (err) {} + } + + return create(80, 24); +}; diff --git a/node_modules/term-size/license b/node_modules/term-size/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/term-size/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/term-size/package.json b/node_modules/term-size/package.json new file mode 100644 index 0000000..feda656 --- /dev/null +++ b/node_modules/term-size/package.json @@ -0,0 +1,75 @@ +{ + "_from": "term-size@^1.2.0", + "_id": "term-size@1.2.0", + "_inBundle": false, + "_integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", + "_location": "/term-size", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "term-size@^1.2.0", + "name": "term-size", + "escapedName": "term-size", + "rawSpec": "^1.2.0", + "saveSpec": null, + "fetchSpec": "^1.2.0" + }, + "_requiredBy": [ + "/boxen" + ], + "_resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", + "_shasum": "458b83887f288fc56d6fffbfad262e26638efa69", + "_spec": "term-size@^1.2.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/boxen", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/term-size/issues" + }, + "bundleDependencies": false, + "dependencies": { + "execa": "^0.7.0" + }, + "deprecated": false, + "description": "Reliably get the terminal window size (columns & rows)", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js", + "vendor" + ], + "homepage": "https://github.com/sindresorhus/term-size#readme", + "keywords": [ + "term", + "terminal", + "size", + "console", + "window", + "width", + "height", + "columns", + "rows", + "lines", + "tty", + "redirected" + ], + "license": "MIT", + "name": "term-size", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/term-size.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.2.0" +} diff --git a/node_modules/term-size/readme.md b/node_modules/term-size/readme.md new file mode 100644 index 0000000..dd642ca --- /dev/null +++ b/node_modules/term-size/readme.md @@ -0,0 +1,41 @@ +# term-size [![Build Status: Linux & macOS](https://travis-ci.org/sindresorhus/term-size.svg?branch=master)](https://travis-ci.org/sindresorhus/term-size) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/c3tydg6uedsk0bob/branch/master?svg=true)](https://ci.appveyor.com/project/sindresorhus/term-size/branch/master) + +> Reliably get the terminal window size + +Because [`process.stdout.columns`](https://nodejs.org/api/tty.html#tty_writestream_columns) doesn't exist when run [non-interactively](http://www.tldp.org/LDP/abs/html/intandnonint.html), for example, in a child process or when piped. This module even works when all the TTY file descriptors are redirected! + +Confirmed working on macOS, Linux, and Windows. + + +## Install + +``` +$ npm install --save term-size +``` + + +## Usage + +```js +const termSize = require('term-size'); + +termSize(); +//=> {columns: 143, rows: 24} +``` + + +## API + +### termSize() + +Returns an `Object` with `columns` and `rows` properties. + + +## Related + +- [term-size-cli](https://github.com/sindresorhus/term-size-cli) - CLI for this module + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/term-size/vendor/macos/term-size b/node_modules/term-size/vendor/macos/term-size new file mode 100755 index 0000000000000000000000000000000000000000..e383cc737f8e232aecd06a8492657b28d5fb9f1c GIT binary patch literal 8760 zcmeHNU1%It6u#SRHO6341ZnVxNpUreke{0B+M;AjmP|;rF+Vj}^){QGGz**EWp`E+ zA2bm9u!O)q`qoE%(+8z5vP2@-H>D3%RImuj1{D-RLBaL=?%dhV&Q|G@FWy7$ob%m# z?zwlqvja2td(I9~5PxETz6rN@b*+Eywmwt`T~ zl3PxdnqA>|Kk9f7YY!j$6FPOgJ9LK^Pp&!Hf>T6aI9@LZ=Kf~1KQVc4O56TcN^UWe zyQm$)@m|vL=JYsmP+DSRK+1CNwM;H8Gr85g!masuPsd} z@6V4%9FEuN2Uqd3%l{V7((y+09O7U+-fveR-p%J~X6m`=nnc7A+|BWxFfb8M3!9 zAGg{jcx;4)){Qn?E)|EfnbdH4Gn)pc+>ge6ygL|ud$RAzQy*Ts_wqx(#{2l3sd(LB z3vJNH(3An(FX!>O4hq+aqj8LTjy!%nN~W4?WBvKflIyGwof*PDGATGg9zo-JS1pgf z;~JA6BZdLPfMLKeU>GnA7zX|i3@qA}?-DO0&dtx-yHB5v2vLh}2{F1?{~UK;+28)N z;Z7z;f3tTNZ`9V@&hgQ`$~W~7FqWu%0_!rZ?MB0$ws#J{gX#88yywc|w>?*$y*5EGT3?d^{{&nI3<$d~u4jo1)+8?g~}J)y2+>iUGb@;hc`_rVBM zV!jdk1re%ixQK)A8;!;qzpM_vru6`=YqTDtb(I!hJ`ZZNCTP76YdGz^I_$ce;%vdm z;SiQ*3W2dYdxp+Z3Q(>h5^HXVZbn87%&VN z1`Gp+0mFb{z%XDKFbw>s3>-OTo#TQ>#wAPFX{T5$i06x>G-8~VnBFRIJ`xN%hM*OoA=;rxH z4C6sO62hlL_)G{-hcN5#!FWp{oC;y?m;c|u+BIvttl_fW$}<}jF#VeG_&@nssBE`$ hBo#-nI6g4iDD~~02@qkn#&%AI*_*;)(f-*0&EJjm8-Ovk_|qj$0nrx_n^ty+eL=UUa_-zByDqxj$ylpl z4*Sue7uROB9bwjjVuSHQ_8DLtfLVZ2fDKRuASAVon%xF8$$nlQ#}l10lY#rin5fYb z1M#5fmDcHpNRt0BW9<}(Ke7lT&~+M~vfCJY{WSP2s#5Z7k-hriqF}@Xpo%_KwcrbyzbfNX(I6cSp3OL2p|96=ctMvEw4^` zhw3PpZ8xS04|Y440r*tm{#wtOuA-!W zi%e5W)1Vl&yYZ;NBk}NU4kp{u|AMh-omd5FQeSm4I$oYN3)}{h)DB6RC%q#|X)P=p zdYbH`y(9kj)QSvRcim9t9s01?ApH$hMr-UAD2+Zf3}%aU`%UO5_fMl!os7L`{c>{h zdSK$4$-0TpI9U2gtQ$>nbgKl0MZ_SdHHHJk@EKsdBhjOa5=r=wYO>qdMqZmrv|1>m zTCkU+8l|yB2^^A}?B?`c=QB2H11dVcXe_=HQnT@1U7dXD9CYQMuU!*g{YZ!WO7!Tq z_rLvkRr*WV@fME9o9q`wk4&Z5L6nq3&?=KwnYGHMRV7+grd8!sMc0TmZz}+sxUy1r>3k=%v*#RiX|g&CaTb=J{+Ak zScl6%$@{USb-0Jv3WbeY5^yvpnhSjFuyyz{B96Yha+pLjuTZ|VS0BifYGIXs5Pjd^ zjehu7)}|jslSb<<8#>}Z+8cXOGDm-AkY+zc`ILD(`YR%vKVaolOX6!)>TZ5-v<#A! zc|2%`rBdsz)h{1+P8fE>KxTFB9mO8X5;VoKb3{(Xg&1u-vh!XU;k%{;eyg%`hcb_H z!Frz$x~f(A6C|3xz7*lR-slo$9sUm3o+eYGdtu17_D@*kKjO9L%C+|NvGcG}+IGmo z6N>q}(R~Jao81KQa;sfPPhjkt$Vg=QJOY!o!>VQ#w-dgju?9W~<-J767t4w95on$g&ck)rg|(3YUFxaZjVo4alr zd(H@g$+cJte72wA4j?aL>Hkz!%+-7hr|%^$${9+A*!wgBwWdLBHc_Q-1V!v{s*s3C zqBZstP~FWlZt?{*t7&0&VAU&E*1{Z0M+b8B zr?87wz_Z|z$FkVcbs$kn9h%*vBD^DO&jW{CZkJcTqrMnDYLZjR>URjgP{VWNsDQkR zsnR(#Aa3NE_P0aRD~TE!NlHtgrG7>?c0k6Y^ND;V$-yqGD>lh{k?eCoPMqqCXo%+{ zQ1>GQ*?E+Y>-m@}B*j!{>e=L0+7`79iX-5E^k`XvTbJZQxm6Phat>CRxnjHK@qsby zkF7AtMzTl-ko+qEv?`2yHu8C%{r=bp$xjs$f~GaIgC-y`48PPPd@ks*T3aoN zMKCNc5wI~bR=468j%Ot62NR=J7{#lQZz+hjjYp`NPraaQu-mTKU@uWitALQ7S4(TC zPN}7>RPW=nLlNDe(Sx=OP+py>{`cxnhCbm+%H*jJCgdy0iW8KL?0)>h=bFC15{6`s zkUu=XD^i7yZU>tqu%zM?;;V&JVH5g1d3mxjxm0jL)HHk_ZN-q{G>slbhx;izrxN6m z>^zoxc_Gk#2O?A2uUV;xAkJ4G(Np>*&RYdA#fX>mn4lpezs{$o{H`Fc$V^&0=<{TL1WP{iP47r` zQd_4p{?#U4MgZSvvNr?TV@W*MNef?n0iHSDz+3{zGaLF%Xjh<3TZB!y1P7 zFFIbU5viJJI&gD1ASCZ_UG{1C;CVB@P(Lt-%~&9JZhQ`E*|v%E~eiYy^_%7Nx~61CD)CP188 zx`n5?8EMo9XDZ_DA4lK%NV+PTc0`XnCsmSz1@nl5L^yO2z?Q&m?d>9Q2{yha3du1; zbi4|C$5{38$?LF@sijLmf#8)l@c9$c58@n<$XP*Yx!i>DG=fV8rZ>|$VS`-&Za;8o zFZ$ZDNxTmE&@@{=rf1*(t*Js9F~Gib8R8Qc960;Y2XUOv)4xD0Qrt8kv{U3#TTGAW^la;WUniF7V(WdYAuB;>?D?@cu!&y1Gl-5-=ST0EenP3%;l&_+hKQ9$ z6F*gb1VnVqJoFJE!!62r%JqVB7oCXXPta3#j$3yUt<5@IM6}bQbvVWwChKq;8Wafl zzomiv$MH$uHuQrYSEftPC}BZ4FFIx_c#tdD&K0aanEoQz6z4&WOy=m&O9`5x>cg?* zotDfKBgn05<`L$Oe~#C#=W`OTp;HqxOer>;Q{IfX9n2*UPPnujPe>c<@UK7}ckYM5 zW^Gc1-DsN>=OOX|25<&FOEPgSPFEoNW7i-#5Eweyj$w)?FGJtDYlz$5h72G2F~hBw zH~JJ|n6){j+%dkG+6yNPDS1l1<6!#RI0{;KIS(prNw3T~b78mM6(ga=By{I2u*!Re z4nUqdcr9e@IZ4na613BK@Sa(jXBDF6(s= z)PlVjRoa8k5&Yv@nSs{7v{)a&uG^hEFV^hyo4Ue_d^K{s1v&pIF&f}3T)>5k!K|5Ph#_dk&$s4fSuWs zSNfY6NC!St)y&Sid1M^F0LWt}U(-VxyHrMp_ZBFGdKyqCCbyyI9mx~R8QQ@x>B5kH zO_DdxgGTpWll7+^=l0rY{9=sjGo+o5%As}|@ls1g>|DycDYWs4LRsvmZXIoBIJs3I z3`zkd_fIe=?^9pFQO_JZE}4`@L9W5;P+4z^9gZB%N$Uh7NO4}!j#isl;uxQnNOnJ? z_Ye7iw;F|xBA9**If4CtOlrWkE9%1J0(9(hBhKVxV?sAk=C)>O8ck{`>BNDYwBkI; zXEAdumoNN%M>gPCC&GLysH&4V7-!>oLLf?YE!Y<>P>f3tMT#;j6w}gIr3!hk(qIDr zd#Cz(f;^?!Bwxo*Mc>E#olKnhH+e!?Ws~K2+hN}D>7G)n>9u$ zo;&f3jpXnT0M9#=jc@YsAf3-q)^X+aP#!xhABw!2DkPt%qzWkxyp?sjT$``VKjz}4 z%a<913-JC|?;j@qFmbWtW1;^^WX@eXY% zD>mRm20meoQGOv8yhBUcZq&y!KRWR~a7_o!VP-m$7p$ta?h4Ja?rJEB9gjB|%cP5{ z4~!`7=B2L<%r0m*Eqy6uj_xr;lNC$fi=;8fH}`6^HGj2+ocyKj0K>_;?znV`$Q_z2;wy9P^mb<3>y24h+5*AYu5h4bD%Lv*ZS z>2IVCC3aIbaLG-C_$)5Jfx z>0!|9*@=A~_PmW~*)RiS58u6M8&1E9LE;)CzP!s*sQ{muG=4g7fd5_Y4?LL#0owU> zP4)4d@(zUAEX^fbbL&Inze?l(xfYLm^5PNiG?ZC)wakhgkW$b+a=hVlqBI+u$NA9= z<^l)1ilzG_lhwz$RPTuVQ{Kqs8~o4dmjv=a(>RVaiY0m5iuWw=+WFuF|Bz1zp2qM1 zXOI>kMCMaMv{M^AS8>=snAnq^k8tJWWqzxlJotUX+BMZG*5u5LD3ZNQnnUrOrX!!G z>=I4hB#(#k)j@<4F2AN9=_owuMvY|O&=_^)*CNH4r;(4*-ykF<%5^vsL}n`ubSy28 z9ltZJ+-`=B^*0ZtIQev!ZXb}iz~id<4t_&>9erIBZ?&64r9+d{j?O_cpymSunT30R zSoZ}S`qc$Tu}G;->-9T&eMGNc*Xu)i{jy$9==DLp-mll=dY#nk@9FiEdi|JQKcd$U z>GfCjdPJ}9)$4oodXU%H9Yzu*ZlopxmG}AO?m~{_{^NXc)8sFY=H6#msA?7N4X99? zH_kr(Y$8ykTiT8}r1{Gg;Ee$4+b|{q=w{^!T%Y{eICs|2-x~qHZ&OcqcUQQ}J#hKr z>PolY&$_xoo*rLV@`U&|#hxx-z#9bC?KvHu3%F%*^;H`0b(_0Z>D-NeS2*kmGq%88 zg#XxAar|*?bg&~AI@s#Kt%2Y`K=gz{!4RzM>T^lG=u|AcT3isOUkfYO(z|K2Jar-N8N=D7g%=qG@GYeani4Gs9tDpeN#Yg?!Rhv7)18 zImXz^&7P3g9~=-vu0W3`%er!nbJeoem1`HW&R+an!4r=7B@sVmkb*%m+~@N9(c(X3 z@bqI4sy%M8V)crqEEm4V4@xe-=nsa&V$dsweLVr6*N0y~bbG{#&eoM39njtG3Q4{* zQnl+;j6Laau$KT+02{6+ngM=58~hnqJaAPF{h&hf^?5|E%jb`TJXaU7dbb;vg~bK^ zVy`PK27;om&(-5u9QJfezF>ff;u>E_in#nYL_DFboDn{FgCTK&Timo&@`Oc~B)W1^ zC~<^Oc^e>Q$+ zGJ2(?!W)n@&A+Tr+4Z9*TTP;g>i=4S24pjli?z>Al!pnCw!h|^nK2e z=Tz0G8!w{9>yW(;+-K=#s?j1EV?`FBx!8Ccs(RdrlDtm9p`@xdq6SUXofd&DLemeh z?NQYm3(%;ym}173xrNK_F4!(a3k$w(EE=odSD&hX9v0LWlbnYDj&W6`pGHECZ58AY z{z*XdY4AjLvLB?E{8$3|V?@C9HstggU&vE?T`{L^1)1r2RsDQE{jFq|<{zO?)*}K( zdKma_rMl75-e;-B^9D;Zp540bG;}g=1#rY$177+*j%sB6|o1!K3G` zxSFT-MnsG8{H;a(IL7}DbuM0R#A_Mi)mZG&TTS%E0L8;kbSYJ(bfZ?=eQEags%*f_JEYeDi5zz=%*S|b>-?uYt*2D#Zh zasziR=|K?zbn(;=Tpen%eLLkuv|#HPrhOk)sT=5Cz`dX$KTjK9r=_Y3y9OLPVPApi zSnegxlhBRD2tCm@=IueWUrzwWp{HHf6E!+5HYB1Rv0E%Ah{DD}zI+TwgZ46_MWNib zA(w<7>GQ^YX(eA;igagMijA$=c4IMQX)f|Ow1T%8yqA(N@J5a8AjQ_WmaF7{kI)aA zPSA7`O^3z28GG4sY4XM}UJ#xpJm8Nc;rDpvMm_^m)Zv=4S;$oGpK91Zw+d zI3J1Ny>c7oB@bucjCUe%rz^*Rx8d@x0^k6w0QdoefCmAO0lo*A0K5e_2C(2h@Uwuc z0jmI;0NVgx1N;+UCtw_K1n^q`6{7?_01RT?zzdK7e+Re+umkWA;1R&T0(JxT z0$u>T40s*z3&3vx(*PstfL%%6uWU>$(}zI*WzXe^01w~FxCwuD=bC{m5x=L|6>$4K z^^7?QN5b_BQN}!k>5y>u8tErH*0R6ln60?s?(4)YYJGT_&+nlY`wES8`nqpz4C00r zKdv*j1P}+8AGeVwyM9SQtH-tZ6f|2{&>D2P^@zZt2MYL=Ydh|pgP}gU5$3`X>mH%Q zBdrefa@*a`E#01ex-*3}h%}Rg4!_6K&+ZaBJ)u5d027uC8k2=ie;B5&arq-2_MmV^ zA#A6h-}{1>?r<4s%)dOQ+c$Gbv3ShrgULn1r@>>&5EE>~Z;r;Dq=AIEfcYpwGP zU0(W&K*nx1aD{NZk8MIbxC!SBLl^FmZ)IU)mu_8iL02Teal-{&1KoXYe}K&wT$_R+ ziCrcjT`|VkRe~mcnc(dY`2v!cwFzEiDRvFPJAlMS>u!Or^@;jRLZ7FvyMHTVUlDY2 z_HBV~@Lf1uJu8Hzklz!)FN&xY=-=1&EkI;u6M3l;cUI)a{dhq)RjQr z|0eW>H+P4mtajQR&z8TW2vnWp$hl*);XAsrnLd42Hv%|Y{(>Vg;$Y=~iEalI2hYy+ zU+_%-9@h-~^D6FU22Uh3FnnaB&upjQ@z*T;K5E^=I8)O-i(aOUHE6A29jpsaCtHP9 z3tP!npx=V$GPJ2YE4=#&Zc4a(>XV+|SJpv~0rDgk!uce?dLYe*bBPC%1I){C)MPcB zrV96GRctAs1~!mItJsC$Z3ImpUfV9vZ-q53^l&IZ>4j7YBVl$m`#k=Ixdt~hdC(4` z?qw0QDp@y|K|Gt-Jjl%2(8MXbxo!QBAoE_R2H#Wc{}*d<;SfFdJM=`7bIn^ hqbO<_h5KZNWJd%-pa>v#e$@H%J4bk&2>z_fe*q!}CAt6r literal 0 HcmV?d00001 diff --git a/node_modules/through/.travis.yml b/node_modules/through/.travis.yml new file mode 100644 index 0000000..c693a93 --- /dev/null +++ b/node_modules/through/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - 0.6 + - 0.8 + - "0.10" diff --git a/node_modules/through/LICENSE.APACHE2 b/node_modules/through/LICENSE.APACHE2 new file mode 100644 index 0000000..6366c04 --- /dev/null +++ b/node_modules/through/LICENSE.APACHE2 @@ -0,0 +1,15 @@ +Apache License, Version 2.0 + +Copyright (c) 2011 Dominic Tarr + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/node_modules/through/LICENSE.MIT b/node_modules/through/LICENSE.MIT new file mode 100644 index 0000000..6eafbd7 --- /dev/null +++ b/node_modules/through/LICENSE.MIT @@ -0,0 +1,24 @@ +The MIT License + +Copyright (c) 2011 Dominic Tarr + +Permission is hereby granted, free of charge, +to any person obtaining a copy of this software and +associated documentation files (the "Software"), to +deal in the Software without restriction, including +without limitation the rights to use, copy, modify, +merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom +the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/through/index.js b/node_modules/through/index.js new file mode 100644 index 0000000..ca5fc59 --- /dev/null +++ b/node_modules/through/index.js @@ -0,0 +1,108 @@ +var Stream = require('stream') + +// through +// +// a stream that does nothing but re-emit the input. +// useful for aggregating a series of changing but not ending streams into one stream) + +exports = module.exports = through +through.through = through + +//create a readable writable stream. + +function through (write, end, opts) { + write = write || function (data) { this.queue(data) } + end = end || function () { this.queue(null) } + + var ended = false, destroyed = false, buffer = [], _ended = false + var stream = new Stream() + stream.readable = stream.writable = true + stream.paused = false + +// stream.autoPause = !(opts && opts.autoPause === false) + stream.autoDestroy = !(opts && opts.autoDestroy === false) + + stream.write = function (data) { + write.call(this, data) + return !stream.paused + } + + function drain() { + while(buffer.length && !stream.paused) { + var data = buffer.shift() + if(null === data) + return stream.emit('end') + else + stream.emit('data', data) + } + } + + stream.queue = stream.push = function (data) { +// console.error(ended) + if(_ended) return stream + if(data === null) _ended = true + buffer.push(data) + drain() + return stream + } + + //this will be registered as the first 'end' listener + //must call destroy next tick, to make sure we're after any + //stream piped from here. + //this is only a problem if end is not emitted synchronously. + //a nicer way to do this is to make sure this is the last listener for 'end' + + stream.on('end', function () { + stream.readable = false + if(!stream.writable && stream.autoDestroy) + process.nextTick(function () { + stream.destroy() + }) + }) + + function _end () { + stream.writable = false + end.call(stream) + if(!stream.readable && stream.autoDestroy) + stream.destroy() + } + + stream.end = function (data) { + if(ended) return + ended = true + if(arguments.length) stream.write(data) + _end() // will emit or queue + return stream + } + + stream.destroy = function () { + if(destroyed) return + destroyed = true + ended = true + buffer.length = 0 + stream.writable = stream.readable = false + stream.emit('close') + return stream + } + + stream.pause = function () { + if(stream.paused) return + stream.paused = true + return stream + } + + stream.resume = function () { + if(stream.paused) { + stream.paused = false + stream.emit('resume') + } + drain() + //may have become paused again, + //as drain emits 'data'. + if(!stream.paused) + stream.emit('drain') + return stream + } + return stream +} + diff --git a/node_modules/through/package.json b/node_modules/through/package.json new file mode 100644 index 0000000..d8b4d7d --- /dev/null +++ b/node_modules/through/package.json @@ -0,0 +1,70 @@ +{ + "_from": "through@~2.3.1", + "_id": "through@2.3.8", + "_inBundle": false, + "_integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "_location": "/through", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "through@~2.3.1", + "name": "through", + "escapedName": "through", + "rawSpec": "~2.3.1", + "saveSpec": null, + "fetchSpec": "~2.3.1" + }, + "_requiredBy": [ + "/event-stream", + "/pause-stream", + "/split" + ], + "_resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "_shasum": "0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5", + "_spec": "through@~2.3.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/event-stream", + "author": { + "name": "Dominic Tarr", + "email": "dominic.tarr@gmail.com", + "url": "dominictarr.com" + }, + "bugs": { + "url": "https://github.com/dominictarr/through/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "simplified stream construction", + "devDependencies": { + "from": "~0.1.3", + "stream-spec": "~0.3.5", + "tape": "~2.3.2" + }, + "homepage": "https://github.com/dominictarr/through", + "keywords": [ + "stream", + "streams", + "user-streams", + "pipe" + ], + "license": "MIT", + "main": "index.js", + "name": "through", + "repository": { + "type": "git", + "url": "git+https://github.com/dominictarr/through.git" + }, + "scripts": { + "test": "set -e; for t in test/*.js; do node $t; done" + }, + "testling": { + "browsers": [ + "ie/8..latest", + "ff/15..latest", + "chrome/20..latest", + "safari/5.1..latest" + ], + "files": "test/*.js" + }, + "version": "2.3.8" +} diff --git a/node_modules/through/readme.markdown b/node_modules/through/readme.markdown new file mode 100644 index 0000000..cb34c81 --- /dev/null +++ b/node_modules/through/readme.markdown @@ -0,0 +1,64 @@ +#through + +[![build status](https://secure.travis-ci.org/dominictarr/through.png)](http://travis-ci.org/dominictarr/through) +[![testling badge](https://ci.testling.com/dominictarr/through.png)](https://ci.testling.com/dominictarr/through) + +Easy way to create a `Stream` that is both `readable` and `writable`. + +* Pass in optional `write` and `end` methods. +* `through` takes care of pause/resume logic if you use `this.queue(data)` instead of `this.emit('data', data)`. +* Use `this.pause()` and `this.resume()` to manage flow. +* Check `this.paused` to see current flow state. (`write` always returns `!this.paused`). + +This function is the basis for most of the synchronous streams in +[event-stream](http://github.com/dominictarr/event-stream). + +``` js +var through = require('through') + +through(function write(data) { + this.queue(data) //data *must* not be null + }, + function end () { //optional + this.queue(null) + }) +``` + +Or, can also be used _without_ buffering on pause, use `this.emit('data', data)`, +and this.emit('end') + +``` js +var through = require('through') + +through(function write(data) { + this.emit('data', data) + //this.pause() + }, + function end () { //optional + this.emit('end') + }) +``` + +## Extended Options + +You will probably not need these 99% of the time. + +### autoDestroy=false + +By default, `through` emits close when the writable +and readable side of the stream has ended. +If that is not desired, set `autoDestroy=false`. + +``` js +var through = require('through') + +//like this +var ts = through(write, end, {autoDestroy: false}) +//or like this +var ts = through(write, end) +ts.autoDestroy = false +``` + +## License + +MIT / Apache2 diff --git a/node_modules/through/test/async.js b/node_modules/through/test/async.js new file mode 100644 index 0000000..46bdbae --- /dev/null +++ b/node_modules/through/test/async.js @@ -0,0 +1,28 @@ +var from = require('from') +var through = require('../') + +var tape = require('tape') + +tape('simple async example', function (t) { + + var n = 0, expected = [1,2,3,4,5], actual = [] + from(expected) + .pipe(through(function(data) { + this.pause() + n ++ + setTimeout(function(){ + console.log('pushing data', data) + this.push(data) + this.resume() + }.bind(this), 300) + })).pipe(through(function(data) { + console.log('pushing data second time', data); + this.push(data) + })).on('data', function (d) { + actual.push(d) + }).on('end', function() { + t.deepEqual(actual, expected) + t.end() + }) + +}) diff --git a/node_modules/through/test/auto-destroy.js b/node_modules/through/test/auto-destroy.js new file mode 100644 index 0000000..9a8fd00 --- /dev/null +++ b/node_modules/through/test/auto-destroy.js @@ -0,0 +1,30 @@ +var test = require('tape') +var through = require('../') + +// must emit end before close. + +test('end before close', function (assert) { + var ts = through() + ts.autoDestroy = false + var ended = false, closed = false + + ts.on('end', function () { + assert.ok(!closed) + ended = true + }) + ts.on('close', function () { + assert.ok(ended) + closed = true + }) + + ts.write(1) + ts.write(2) + ts.write(3) + ts.end() + assert.ok(ended) + assert.notOk(closed) + ts.destroy() + assert.ok(closed) + assert.end() +}) + diff --git a/node_modules/through/test/buffering.js b/node_modules/through/test/buffering.js new file mode 100644 index 0000000..b0084bf --- /dev/null +++ b/node_modules/through/test/buffering.js @@ -0,0 +1,71 @@ +var test = require('tape') +var through = require('../') + +// must emit end before close. + +test('buffering', function(assert) { + var ts = through(function (data) { + this.queue(data) + }, function () { + this.queue(null) + }) + + var ended = false, actual = [] + + ts.on('data', actual.push.bind(actual)) + ts.on('end', function () { + ended = true + }) + + ts.write(1) + ts.write(2) + ts.write(3) + assert.deepEqual(actual, [1, 2, 3]) + ts.pause() + ts.write(4) + ts.write(5) + ts.write(6) + assert.deepEqual(actual, [1, 2, 3]) + ts.resume() + assert.deepEqual(actual, [1, 2, 3, 4, 5, 6]) + ts.pause() + ts.end() + assert.ok(!ended) + ts.resume() + assert.ok(ended) + assert.end() +}) + +test('buffering has data in queue, when ends', function (assert) { + + /* + * If stream ends while paused with data in the queue, + * stream should still emit end after all data is written + * on resume. + */ + + var ts = through(function (data) { + this.queue(data) + }, function () { + this.queue(null) + }) + + var ended = false, actual = [] + + ts.on('data', actual.push.bind(actual)) + ts.on('end', function () { + ended = true + }) + + ts.pause() + ts.write(1) + ts.write(2) + ts.write(3) + ts.end() + assert.deepEqual(actual, [], 'no data written yet, still paused') + assert.ok(!ended, 'end not emitted yet, still paused') + ts.resume() + assert.deepEqual(actual, [1, 2, 3], 'resumed, all data should be delivered') + assert.ok(ended, 'end should be emitted once all data was delivered') + assert.end(); +}) diff --git a/node_modules/through/test/end.js b/node_modules/through/test/end.js new file mode 100644 index 0000000..fa113f5 --- /dev/null +++ b/node_modules/through/test/end.js @@ -0,0 +1,45 @@ +var test = require('tape') +var through = require('../') + +// must emit end before close. + +test('end before close', function (assert) { + var ts = through() + var ended = false, closed = false + + ts.on('end', function () { + assert.ok(!closed) + ended = true + }) + ts.on('close', function () { + assert.ok(ended) + closed = true + }) + + ts.write(1) + ts.write(2) + ts.write(3) + ts.end() + assert.ok(ended) + assert.ok(closed) + assert.end() +}) + +test('end only once', function (t) { + + var ts = through() + var ended = false, closed = false + + ts.on('end', function () { + t.equal(ended, false) + ended = true + }) + + ts.queue(null) + ts.queue(null) + ts.queue(null) + + ts.resume() + + t.end() +}) diff --git a/node_modules/through/test/index.js b/node_modules/through/test/index.js new file mode 100644 index 0000000..96da82f --- /dev/null +++ b/node_modules/through/test/index.js @@ -0,0 +1,133 @@ + +var test = require('tape') +var spec = require('stream-spec') +var through = require('../') + +/* + I'm using these two functions, and not streams and pipe + so there is less to break. if this test fails it must be + the implementation of _through_ +*/ + +function write(array, stream) { + array = array.slice() + function next() { + while(array.length) + if(stream.write(array.shift()) === false) + return stream.once('drain', next) + + stream.end() + } + + next() +} + +function read(stream, callback) { + var actual = [] + stream.on('data', function (data) { + actual.push(data) + }) + stream.once('end', function () { + callback(null, actual) + }) + stream.once('error', function (err) { + callback(err) + }) +} + +test('simple defaults', function(assert) { + + var l = 1000 + , expected = [] + + while(l--) expected.push(l * Math.random()) + + var t = through() + var s = spec(t).through().pausable() + + read(t, function (err, actual) { + assert.ifError(err) + assert.deepEqual(actual, expected) + assert.end() + }) + + t.on('close', s.validate) + + write(expected, t) +}); + +test('simple functions', function(assert) { + + var l = 1000 + , expected = [] + + while(l--) expected.push(l * Math.random()) + + var t = through(function (data) { + this.emit('data', data*2) + }) + var s = spec(t).through().pausable() + + + read(t, function (err, actual) { + assert.ifError(err) + assert.deepEqual(actual, expected.map(function (data) { + return data*2 + })) + assert.end() + }) + + t.on('close', s.validate) + + write(expected, t) +}) + +test('pauses', function(assert) { + + var l = 1000 + , expected = [] + + while(l--) expected.push(l) //Math.random()) + + var t = through() + + var s = spec(t) + .through() + .pausable() + + t.on('data', function () { + if(Math.random() > 0.1) return + t.pause() + process.nextTick(function () { + t.resume() + }) + }) + + read(t, function (err, actual) { + assert.ifError(err) + assert.deepEqual(actual, expected) + }) + + t.on('close', function () { + s.validate() + assert.end() + }) + + write(expected, t) +}) + +test('does not soft-end on `undefined`', function(assert) { + var stream = through() + , count = 0 + + stream.on('data', function (data) { + count++ + }) + + stream.write(undefined) + stream.write(undefined) + + assert.equal(count, 2) + + assert.end() +}) diff --git a/node_modules/timed-out/index.js b/node_modules/timed-out/index.js new file mode 100644 index 0000000..94007a4 --- /dev/null +++ b/node_modules/timed-out/index.js @@ -0,0 +1,55 @@ +'use strict'; + +module.exports = function (req, time) { + if (req.timeoutTimer) { + return req; + } + + var delays = isNaN(time) ? time : {socket: time, connect: time}; + var host = req._headers ? (' to ' + req._headers.host) : ''; + + if (delays.connect !== undefined) { + req.timeoutTimer = setTimeout(function timeoutHandler() { + req.abort(); + var e = new Error('Connection timed out on request' + host); + e.code = 'ETIMEDOUT'; + req.emit('error', e); + }, delays.connect); + } + + // Clear the connection timeout timer once a socket is assigned to the + // request and is connected. + req.on('socket', function assign(socket) { + // Socket may come from Agent pool and may be already connected. + if (!(socket.connecting || socket._connecting)) { + connect(); + return; + } + + socket.once('connect', connect); + }); + + function clear() { + if (req.timeoutTimer) { + clearTimeout(req.timeoutTimer); + req.timeoutTimer = null; + } + } + + function connect() { + clear(); + + if (delays.socket !== undefined) { + // Abort the request if there is no activity on the socket for more + // than `delays.socket` milliseconds. + req.setTimeout(delays.socket, function socketTimeoutHandler() { + req.abort(); + var e = new Error('Socket timed out on request' + host); + e.code = 'ESOCKETTIMEDOUT'; + req.emit('error', e); + }); + } + } + + return req.on('error', clear); +}; diff --git a/node_modules/timed-out/license b/node_modules/timed-out/license new file mode 100644 index 0000000..faadd52 --- /dev/null +++ b/node_modules/timed-out/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Vsevolod Strukchinsky + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/timed-out/package.json b/node_modules/timed-out/package.json new file mode 100644 index 0000000..943dbec --- /dev/null +++ b/node_modules/timed-out/package.json @@ -0,0 +1,68 @@ +{ + "_from": "timed-out@^4.0.0", + "_id": "timed-out@4.0.1", + "_inBundle": false, + "_integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "_location": "/timed-out", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "timed-out@^4.0.0", + "name": "timed-out", + "escapedName": "timed-out", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/got" + ], + "_resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "_shasum": "f32eacac5a175bea25d7fab565ab3ed8741ef56f", + "_spec": "timed-out@^4.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/got", + "author": { + "name": "Vsevolod Strukchinsky", + "email": "floatdrop@gmail.com" + }, + "bugs": { + "url": "https://github.com/floatdrop/timed-out/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Emit `ETIMEDOUT` or `ESOCKETTIMEDOUT` when ClientRequest is hanged", + "devDependencies": { + "mocha": "*", + "xo": "^0.16.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/floatdrop/timed-out#readme", + "keywords": [ + "http", + "https", + "get", + "got", + "url", + "uri", + "request", + "util", + "utility", + "simple" + ], + "license": "MIT", + "name": "timed-out", + "repository": { + "type": "git", + "url": "git+https://github.com/floatdrop/timed-out.git" + }, + "scripts": { + "test": "xo && mocha" + }, + "version": "4.0.1" +} diff --git a/node_modules/timed-out/readme.md b/node_modules/timed-out/readme.md new file mode 100644 index 0000000..fa0a035 --- /dev/null +++ b/node_modules/timed-out/readme.md @@ -0,0 +1,42 @@ +# timed-out [![Build Status](https://travis-ci.org/floatdrop/timed-out.svg?branch=master)](https://travis-ci.org/floatdrop/timed-out) + +> Timeout HTTP/HTTPS requests + +Emit Error object with `code` property equal `ETIMEDOUT` or `ESOCKETTIMEDOUT` when ClientRequest is hanged. + +## Usage + +```js +var get = require('http').get; +var timeout = require('timed-out'); + +var req = get('http://www.google.ru'); +timeout(req, 2000); // Set 2 seconds limit +``` + +### API + +#### timedout(request, time) + +##### request + +*Required* +Type: [`ClientRequest`](http://nodejs.org/api/http.html#http_class_http_clientrequest) + +The request to watch on. + +##### time + +*Required* +Type: `number` or `object` + +Time in milliseconds to wait for `connect` event on socket and also time to wait on inactive socket. + +Or you can pass Object with following fields: + +- `connect` - time to wait for connection +- `socket` - time to wait for activity on socket + +## License + +MIT © [Vsevolod Strukchinsky](floatdrop@gmail.com) diff --git a/node_modules/to-fast-properties/index.js b/node_modules/to-fast-properties/index.js new file mode 100644 index 0000000..56fc00b --- /dev/null +++ b/node_modules/to-fast-properties/index.js @@ -0,0 +1,11 @@ +'use strict'; +module.exports = function toFastproperties(o) { + function Sub() {} + Sub.prototype = o; + var receiver = new Sub(); // create an instance + function ic() { return typeof receiver.foo; } // perform access + ic(); + ic(); + return o; + eval("o" + o); // ensure no dead code elimination +} diff --git a/node_modules/to-fast-properties/license b/node_modules/to-fast-properties/license new file mode 100644 index 0000000..55cc204 --- /dev/null +++ b/node_modules/to-fast-properties/license @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014 Petka Antonov + 2015 Sindre Sorhus + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/to-fast-properties/package.json b/node_modules/to-fast-properties/package.json new file mode 100644 index 0000000..13532de --- /dev/null +++ b/node_modules/to-fast-properties/package.json @@ -0,0 +1,67 @@ +{ + "_from": "to-fast-properties@^1.0.3", + "_id": "to-fast-properties@1.0.3", + "_inBundle": false, + "_integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "_location": "/to-fast-properties", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "to-fast-properties@^1.0.3", + "name": "to-fast-properties", + "escapedName": "to-fast-properties", + "rawSpec": "^1.0.3", + "saveSpec": null, + "fetchSpec": "^1.0.3" + }, + "_requiredBy": [ + "/babel-types" + ], + "_resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "_shasum": "b83571fa4d8c25b82e231b06e3a3055de4ca1a47", + "_spec": "to-fast-properties@^1.0.3", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/babel-types", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/to-fast-properties/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Force V8 to use fast properties for an object", + "devDependencies": { + "ava": "0.0.4" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/to-fast-properties#readme", + "keywords": [ + "object", + "obj", + "properties", + "props", + "v8", + "optimize", + "fast", + "convert", + "mode" + ], + "license": "MIT", + "name": "to-fast-properties", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/to-fast-properties.git" + }, + "scripts": { + "test": "node --allow-natives-syntax test.js" + }, + "version": "1.0.3" +} diff --git a/node_modules/to-fast-properties/readme.md b/node_modules/to-fast-properties/readme.md new file mode 100644 index 0000000..e298c20 --- /dev/null +++ b/node_modules/to-fast-properties/readme.md @@ -0,0 +1,37 @@ +# to-fast-properties [![Build Status](https://travis-ci.org/sindresorhus/to-fast-properties.svg?branch=master)](https://travis-ci.org/sindresorhus/to-fast-properties) + +> Force V8 to use fast properties for an object + +[Read more.](http://stackoverflow.com/questions/24987896/) + +Use `%HasFastProperties(object)` and `--allow-natives-syntax` to check whether an object already has fast properties. + + +## Install + +``` +$ npm install --save to-fast-properties +``` + + +## Usage + +```js +const toFastProperties = require('to-fast-properties'); + +const obj = { + foo: true, + bar: true +}; + +delete obj.foo; +// `obj` now has slow properties + +toFastProperties(obj); +// `obj` now has fast properties +``` + + +## License + +MIT © Petka Antonov, Sindre Sorhus diff --git a/node_modules/to-object-path/LICENSE b/node_modules/to-object-path/LICENSE new file mode 100644 index 0000000..1e49edf --- /dev/null +++ b/node_modules/to-object-path/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-2016, 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/node_modules/to-object-path/README.md b/node_modules/to-object-path/README.md new file mode 100644 index 0000000..7f3cfb1 --- /dev/null +++ b/node_modules/to-object-path/README.md @@ -0,0 +1,71 @@ +# to-object-path [![NPM version](https://badge.fury.io/js/to-object-path.svg)](http://badge.fury.io/js/to-object-path) + +> Create an object path from a list or array of strings. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i to-object-path --save +``` + +## Usage + +```js +var toPath = require('to-object-path'); + +toPath('foo', 'bar', 'baz'); +toPath('foo', ['bar', 'baz']); +//=> 'foo.bar.baz' +``` + +Also supports passing an arguments object (without having to slice args): + +```js +function foo() + return toPath(arguments); +} + +foo('foo', 'bar', 'baz'); +foo('foo', ['bar', 'baz']); +//=> 'foo.bar.baz' +``` + +Visit the [example](./example.js) to see how this could be used in an application. + +## Related projects + +* [get-value](https://www.npmjs.com/package/get-value): Use property paths (` a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value) +* [has-value](https://www.npmjs.com/package/has-value): Returns true if a value exists, false if empty. Works with deeply nested values using… [more](https://www.npmjs.com/package/has-value) | [homepage](https://github.com/jonschlinkert/has-value) +* [omit-value](https://www.npmjs.com/package/omit-value): Omit properties from an object or deeply nested property of an object using object path… [more](https://www.npmjs.com/package/omit-value) | [homepage](https://github.com/jonschlinkert/omit-value) +* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value) +* [unset-value](https://www.npmjs.com/package/unset-value): Delete nested properties from an object using dot notation. | [homepage](https://github.com/jonschlinkert/unset-value) + +## Running tests + +Install dev dependencies: + +```sh +$ 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/to-object-path/issues/new). + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 Jon Schlinkert +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 28, 2015._ \ No newline at end of file diff --git a/node_modules/to-object-path/index.js b/node_modules/to-object-path/index.js new file mode 100644 index 0000000..489f8f6 --- /dev/null +++ b/node_modules/to-object-path/index.js @@ -0,0 +1,33 @@ +/*! + * to-object-path + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var typeOf = require('kind-of'); + +module.exports = function toPath(args) { + if (typeOf(args) !== 'arguments') { + args = arguments; + } + return filter(args).join('.'); +}; + +function filter(arr) { + var len = arr.length; + var idx = -1; + var res = []; + + while (++idx < len) { + var ele = arr[idx]; + if (typeOf(ele) === 'arguments' || Array.isArray(ele)) { + res.push.apply(res, filter(ele)); + } else if (typeof ele === 'string') { + res.push(ele); + } + } + return res; +} diff --git a/node_modules/to-object-path/package.json b/node_modules/to-object-path/package.json new file mode 100644 index 0000000..e803f18 --- /dev/null +++ b/node_modules/to-object-path/package.json @@ -0,0 +1,80 @@ +{ + "_from": "to-object-path@^0.3.0", + "_id": "to-object-path@0.3.0", + "_inBundle": false, + "_integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "_location": "/to-object-path", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "to-object-path@^0.3.0", + "name": "to-object-path", + "escapedName": "to-object-path", + "rawSpec": "^0.3.0", + "saveSpec": null, + "fetchSpec": "^0.3.0" + }, + "_requiredBy": [ + "/cache-base", + "/union-value/set-value" + ], + "_resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "_shasum": "297588b7b0e7e0ac08e04e672f85c1f4999e17af", + "_spec": "to-object-path@^0.3.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/cache-base", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/to-object-path/issues" + }, + "bundleDependencies": false, + "dependencies": { + "kind-of": "^3.0.2" + }, + "deprecated": false, + "description": "Create an object path from a list or array of strings.", + "devDependencies": { + "base": "^0.6.7", + "mocha": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/to-object-path", + "keywords": [ + "dot", + "nested", + "notation", + "object", + "path", + "stringify" + ], + "license": "MIT", + "main": "index.js", + "name": "to-object-path", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/to-object-path.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "get-value", + "set-value", + "has-value", + "omit-value", + "unset-value" + ] + } + }, + "version": "0.3.0" +} diff --git a/node_modules/to-regex-range/LICENSE b/node_modules/to-regex-range/LICENSE new file mode 100644 index 0000000..83b56e7 --- /dev/null +++ b/node_modules/to-regex-range/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-2017, 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/node_modules/to-regex-range/README.md b/node_modules/to-regex-range/README.md new file mode 100644 index 0000000..2763c5a --- /dev/null +++ b/node_modules/to-regex-range/README.md @@ -0,0 +1,281 @@ +# to-regex-range [![NPM version](https://img.shields.io/npm/v/to-regex-range.svg?style=flat)](https://www.npmjs.com/package/to-regex-range) [![NPM monthly downloads](https://img.shields.io/npm/dm/to-regex-range.svg?style=flat)](https://npmjs.org/package/to-regex-range) [![NPM total downloads](https://img.shields.io/npm/dt/to-regex-range.svg?style=flat)](https://npmjs.org/package/to-regex-range) [![Linux Build Status](https://img.shields.io/travis/micromatch/to-regex-range.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/to-regex-range) + +> Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than 2.78 million test assertions. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save to-regex-range +``` + +Install with [yarn](https://yarnpkg.com): + +```sh +$ yarn add to-regex-range +``` + +
    +What does this do? + +
    + +This libary generates the `source` string to be passed to `new RegExp()` for matching a range of numbers. + +**Example** + +```js +var toRegexRange = require('to-regex-range'); +var regex = new RegExp(toRegexRange('15', '95')); +``` + +A string is returned so that you can do whatever you need with it before passing it to `new RegExp()` (like adding `^` or `$` boundaries, defining flags, or combining it another string). + +
    + +
    + +
    +Why use this library? + +
    + +### Convenience + +Creating regular expressions for matching numbers gets deceptively complicated pretty fast. + +For example, let's say you need a validation regex for matching part of a user-id, postal code, social security number, tax id, etc: + +* regex for matching `1` => `/1/` (easy enough) +* regex for matching `1` through `5` => `/[1-5]/` (not bad...) +* regex for matching `1` or `5` => `/(1|5)/` (still easy...) +* regex for matching `1` through `50` => `/([1-9]|[1-4][0-9]|50)/` (uh-oh...) +* regex for matching `1` through `55` => `/([1-9]|[1-4][0-9]|5[0-5])/` (no prob, I can do this...) +* regex for matching `1` through `555` => `/([1-9]|[1-9][0-9]|[1-4][0-9]{2}|5[0-4][0-9]|55[0-5])/` (maybe not...) +* regex for matching `0001` through `5555` => `/(0{3}[1-9]|0{2}[1-9][0-9]|0[1-9][0-9]{2}|[1-4][0-9]{3}|5[0-4][0-9]{2}|55[0-4][0-9]|555[0-5])/` (okay, I get the point!) + +The numbers are contrived, but they're also really basic. In the real world you might need to generate a regex on-the-fly for validation. + +**Learn more** + +If you're interested in learning more about [character classes](http://www.regular-expressions.info/charclass.html) and other regex features, I personally have always found [regular-expressions.info](http://www.regular-expressions.info/charclass.html) to be pretty useful. + +### Heavily tested + +As of April 27, 2017, this library runs [2,783,483 test assertions](./test/test.js) against generated regex-ranges to provide brute-force verification that results are indeed correct. + +Tests run in ~870ms on my MacBook Pro, 2.5 GHz Intel Core i7. + +### Highly optimized + +Generated regular expressions are highly optimized: + +* duplicate sequences and character classes are reduced using quantifiers +* smart enough to use `?` conditionals when number(s) or range(s) can be positive or negative +* uses fragment caching to avoid processing the same exact string more than once + +
    + +
    + +## Usage + +Add this library to your javascript application with the following line of code + +```js +var toRegexRange = require('to-regex-range'); +``` + +The main export is a function that takes two integers: the `min` value and `max` value (formatted as strings or numbers). + +```js +var source = toRegexRange('15', '95'); +//=> 1[5-9]|[2-8][0-9]|9[0-5] + +var re = new RegExp('^' + source + '$'); +console.log(re.test('14')); //=> false +console.log(re.test('50')); //=> true +console.log(re.test('94')); //=> true +console.log(re.test('96')); //=> false +``` + +## Options + +### options.capture + +**Type**: `boolean` + +**Deafault**: `undefined` + +Wrap the returned value in parentheses when there is more than one regex condition. Useful when you're dynamically generating ranges. + +```js +console.log(toRegexRange('-10', '10')); +//=> -[1-9]|-?10|[0-9] + +console.log(toRegexRange('-10', '10', {capture: true})); +//=> (-[1-9]|-?10|[0-9]) +``` + +### options.shorthand + +**Type**: `boolean` + +**Deafault**: `undefined` + +Use the regex shorthand for `[0-9]`: + +```js +console.log(toRegexRange('0', '999999')); +//=> [0-9]|[1-9][0-9]{1,5} + +console.log(toRegexRange('0', '999999', {shorthand: true})); +//=> \d|[1-9]\d{1,5} +``` + +### options.relaxZeros + +**Type**: `boolean` + +**Default**: `true` + +This option only applies to **negative zero-padded ranges**. By default, when a negative zero-padded range is defined, the number of leading zeros is relaxed using `-0*`. + +```js +console.log(toRegexRange('-001', '100')); +//=> -0*1|0{2}[0-9]|0[1-9][0-9]|100 + +console.log(toRegexRange('-001', '100', {relaxZeros: false})); +//=> -0{2}1|0{2}[0-9]|0[1-9][0-9]|100 +``` + +
    +Why are zeros relaxed for negative zero-padded ranges by default? + +Consider the following. + +```js +var regex = toRegexRange('-001', '100'); +``` + +_Note that `-001` and `100` are both three digits long_. + +In most zero-padding implementations, only a single leading zero is enough to indicate that zero-padding should be applied. Thus, the leading zeros would be "corrected" on the negative range in the example to `-01`, instead of `-001`, to make total length of each string no greater than the length of the largest number in the range (in other words, `-001` is 4 digits, but `100` is only three digits). + +If zeros were not relaxed by default, you might expect the resulting regex of the above pattern to match `-001` - given that it's defined that way in the arguments - _but it wouldn't_. It would, however, match `-01`. This gets even more ambiguous with large ranges, like `-01` to `1000000`. + +Thus, we relax zeros by default to provide a more predictable experience for users. + +
    + +## Examples + +| **Range** | **Result** | **Compile time** | +| --- | --- | --- | +| `toRegexRange('5, 5')` | `5` | _33μs_ | +| `toRegexRange('5, 6')` | `5\|6` | _53μs_ | +| `toRegexRange('29, 51')` | `29\|[34][0-9]\|5[01]` | _699μs_ | +| `toRegexRange('31, 877')` | `3[1-9]\|[4-9][0-9]\|[1-7][0-9]{2}\|8[0-6][0-9]\|87[0-7]` | _711μs_ | +| `toRegexRange('111, 555')` | `11[1-9]\|1[2-9][0-9]\|[2-4][0-9]{2}\|5[0-4][0-9]\|55[0-5]` | _62μs_ | +| `toRegexRange('-10, 10')` | `-[1-9]\|-?10\|[0-9]` | _74μs_ | +| `toRegexRange('-100, -10')` | `-1[0-9]\|-[2-9][0-9]\|-100` | _49μs_ | +| `toRegexRange('-100, 100')` | `-[1-9]\|-?[1-9][0-9]\|-?100\|[0-9]` | _45μs_ | +| `toRegexRange('001, 100')` | `0{2}[1-9]\|0[1-9][0-9]\|100` | _158μs_ | +| `toRegexRange('0010, 1000')` | `0{2}1[0-9]\|0{2}[2-9][0-9]\|0[1-9][0-9]{2}\|1000` | _61μs_ | +| `toRegexRange('1, 2')` | `1\|2` | _10μs_ | +| `toRegexRange('1, 5')` | `[1-5]` | _24μs_ | +| `toRegexRange('1, 10')` | `[1-9]\|10` | _23μs_ | +| `toRegexRange('1, 100')` | `[1-9]\|[1-9][0-9]\|100` | _30μs_ | +| `toRegexRange('1, 1000')` | `[1-9]\|[1-9][0-9]{1,2}\|1000` | _52μs_ | +| `toRegexRange('1, 10000')` | `[1-9]\|[1-9][0-9]{1,3}\|10000` | _47μs_ | +| `toRegexRange('1, 100000')` | `[1-9]\|[1-9][0-9]{1,4}\|100000` | _44μs_ | +| `toRegexRange('1, 1000000')` | `[1-9]\|[1-9][0-9]{1,5}\|1000000` | _49μs_ | +| `toRegexRange('1, 10000000')` | `[1-9]\|[1-9][0-9]{1,6}\|10000000` | _63μs_ | + +## Heads up! + +**Order of arguments** + +When the `min` is larger than the `max`, values will be flipped to create a valid range: + +```js +toRegexRange('51', '29'); +``` + +Is effectively flipped to: + +```js +toRegexRange('29', '51'); +//=> 29|[3-4][0-9]|5[0-1] +``` + +**Steps / increments** + +This library does not support steps (increments). A pr to add support would be welcome. + +## History + +### v2.0.0 - 2017-04-21 + +**New features** + +Adds support for zero-padding! + +### v1.0.0 + +**Optimizations** + +Repeating ranges are now grouped using quantifiers. rocessing time is roughly the same, but the generated regex is much smaller, which should result in faster matching. + +## Attribution + +Inspired by the python library [range-regex](https://github.com/dimka665/range-regex). + +## About + +### Related projects + +* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. See… [more](https://github.com/jonschlinkert/expand-range) | [homepage](https://github.com/jonschlinkert/expand-range "Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. See the benchmarks. Used by micromatch.") +* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or `step` to… [more](https://github.com/jonschlinkert/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`") +* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") +* [repeat-element](https://www.npmjs.com/package/repeat-element): Create an array by repeating the given value n times. | [homepage](https://github.com/jonschlinkert/repeat-element "Create an array by repeating the given value n times.") +* [repeat-string](https://www.npmjs.com/package/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string. | [homepage](https://github.com/jonschlinkert/repeat-string "Repeat the given string n times. Fastest implementation for repeating a string.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on April 27, 2017._ \ No newline at end of file diff --git a/node_modules/to-regex-range/index.js b/node_modules/to-regex-range/index.js new file mode 100644 index 0000000..7bb5a74 --- /dev/null +++ b/node_modules/to-regex-range/index.js @@ -0,0 +1,294 @@ +/*! + * to-regex-range + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var repeat = require('repeat-string'); +var isNumber = require('is-number'); +var cache = {}; + +function toRegexRange(min, max, options) { + if (isNumber(min) === false) { + throw new RangeError('toRegexRange: first argument is invalid.'); + } + + if (typeof max === 'undefined' || min === max) { + return String(min); + } + + if (isNumber(max) === false) { + throw new RangeError('toRegexRange: second argument is invalid.'); + } + + options = options || {}; + var relax = String(options.relaxZeros); + var shorthand = String(options.shorthand); + var capture = String(options.capture); + var key = min + ':' + max + '=' + relax + shorthand + capture; + if (cache.hasOwnProperty(key)) { + return cache[key].result; + } + + var a = Math.min(min, max); + var b = Math.max(min, max); + + if (Math.abs(a - b) === 1) { + var result = min + '|' + max; + if (options.capture) { + return '(' + result + ')'; + } + return result; + } + + var isPadded = padding(min) || padding(max); + var positives = []; + var negatives = []; + + var tok = {min: min, max: max, a: a, b: b}; + if (isPadded) { + tok.isPadded = isPadded; + tok.maxLen = String(tok.max).length; + } + + if (a < 0) { + var newMin = b < 0 ? Math.abs(b) : 1; + var newMax = Math.abs(a); + negatives = splitToPatterns(newMin, newMax, tok, options); + a = tok.a = 0; + } + + if (b >= 0) { + positives = splitToPatterns(a, b, tok, options); + } + + tok.negatives = negatives; + tok.positives = positives; + tok.result = siftPatterns(negatives, positives, options); + + if (options.capture && (positives.length + negatives.length) > 1) { + tok.result = '(' + tok.result + ')'; + } + + cache[key] = tok; + return tok.result; +} + +function siftPatterns(neg, pos, options) { + var onlyNegative = filterPatterns(neg, pos, '-', false, options) || []; + var onlyPositive = filterPatterns(pos, neg, '', false, options) || []; + var intersected = filterPatterns(neg, pos, '-?', true, options) || []; + var subpatterns = onlyNegative.concat(intersected).concat(onlyPositive); + return subpatterns.join('|'); +} + +function splitToRanges(min, max) { + min = Number(min); + max = Number(max); + + var nines = 1; + var stops = [max]; + var stop = +countNines(min, nines); + + while (min <= stop && stop <= max) { + stops = push(stops, stop); + nines += 1; + stop = +countNines(min, nines); + } + + var zeros = 1; + stop = countZeros(max + 1, zeros) - 1; + + while (min < stop && stop <= max) { + stops = push(stops, stop); + zeros += 1; + stop = countZeros(max + 1, zeros) - 1; + } + + stops.sort(compare); + return stops; +} + +/** + * Convert a range to a regex pattern + * @param {Number} `start` + * @param {Number} `stop` + * @return {String} + */ + +function rangeToPattern(start, stop, options) { + if (start === stop) { + return {pattern: String(start), digits: []}; + } + + var zipped = zip(String(start), String(stop)); + var len = zipped.length, i = -1; + + var pattern = ''; + var digits = 0; + + while (++i < len) { + var numbers = zipped[i]; + var startDigit = numbers[0]; + var stopDigit = numbers[1]; + + if (startDigit === stopDigit) { + pattern += startDigit; + + } else if (startDigit !== '0' || stopDigit !== '9') { + pattern += toCharacterClass(startDigit, stopDigit); + + } else { + digits += 1; + } + } + + if (digits) { + pattern += options.shorthand ? '\\d' : '[0-9]'; + } + + return { pattern: pattern, digits: [digits] }; +} + +function splitToPatterns(min, max, tok, options) { + var ranges = splitToRanges(min, max); + var len = ranges.length; + var idx = -1; + + var tokens = []; + var start = min; + var prev; + + while (++idx < len) { + var range = ranges[idx]; + var obj = rangeToPattern(start, range, options); + var zeros = ''; + + if (!tok.isPadded && prev && prev.pattern === obj.pattern) { + if (prev.digits.length > 1) { + prev.digits.pop(); + } + prev.digits.push(obj.digits[0]); + prev.string = prev.pattern + toQuantifier(prev.digits); + start = range + 1; + continue; + } + + if (tok.isPadded) { + zeros = padZeros(range, tok); + } + + obj.string = zeros + obj.pattern + toQuantifier(obj.digits); + tokens.push(obj); + start = range + 1; + prev = obj; + } + + return tokens; +} + +function filterPatterns(arr, comparison, prefix, intersection, options) { + var res = []; + + for (var i = 0; i < arr.length; i++) { + var tok = arr[i]; + var ele = tok.string; + + if (options.relaxZeros !== false) { + if (prefix === '-' && ele.charAt(0) === '0') { + if (ele.charAt(1) === '{') { + ele = '0*' + ele.replace(/^0\{\d+\}/, ''); + } else { + ele = '0*' + ele.slice(1); + } + } + } + + if (!intersection && !contains(comparison, 'string', ele)) { + res.push(prefix + ele); + } + + if (intersection && contains(comparison, 'string', ele)) { + res.push(prefix + ele); + } + } + return res; +} + +/** + * Zip strings (`for in` can be used on string characters) + */ + +function zip(a, b) { + var arr = []; + for (var ch in a) arr.push([a[ch], b[ch]]); + return arr; +} + +function compare(a, b) { + return a > b ? 1 : b > a ? -1 : 0; +} + +function push(arr, ele) { + if (arr.indexOf(ele) === -1) arr.push(ele); + return arr; +} + +function contains(arr, key, val) { + for (var i = 0; i < arr.length; i++) { + if (arr[i][key] === val) { + return true; + } + } + return false; +} + +function countNines(min, len) { + return String(min).slice(0, -len) + repeat('9', len); +} + +function countZeros(integer, zeros) { + return integer - (integer % Math.pow(10, zeros)); +} + +function toQuantifier(digits) { + var start = digits[0]; + var stop = digits[1] ? (',' + digits[1]) : ''; + if (!stop && (!start || start === 1)) { + return ''; + } + return '{' + start + stop + '}'; +} + +function toCharacterClass(a, b) { + return '[' + a + ((b - a === 1) ? '' : '-') + b + ']'; +} + +function padding(str) { + return /^-?(0+)\d/.exec(str); +} + +function padZeros(val, tok) { + if (tok.isPadded) { + var diff = Math.abs(tok.maxLen - String(val).length); + switch (diff) { + case 0: + return ''; + case 1: + return '0'; + default: { + return '0{' + diff + '}'; + } + } + } + return val; +} + +/** + * Expose `toRegexRange` + */ + +module.exports = toRegexRange; diff --git a/node_modules/to-regex-range/package.json b/node_modules/to-regex-range/package.json new file mode 100644 index 0000000..7ae224c --- /dev/null +++ b/node_modules/to-regex-range/package.json @@ -0,0 +1,117 @@ +{ + "_from": "to-regex-range@^2.1.0", + "_id": "to-regex-range@2.1.1", + "_inBundle": false, + "_integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "_location": "/to-regex-range", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "to-regex-range@^2.1.0", + "name": "to-regex-range", + "escapedName": "to-regex-range", + "rawSpec": "^2.1.0", + "saveSpec": null, + "fetchSpec": "^2.1.0" + }, + "_requiredBy": [ + "/fill-range" + ], + "_resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "_shasum": "7c80c17b9dfebe599e27367e0d4dd5590141db38", + "_spec": "to-regex-range@^2.1.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/fill-range", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/micromatch/to-regex-range/issues" + }, + "bundleDependencies": false, + "dependencies": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + }, + "deprecated": false, + "description": "Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than 2.78 million test assertions.", + "devDependencies": { + "fill-range": "^3.1.1", + "gulp-format-md": "^0.1.12", + "mocha": "^3.2.0", + "text-table": "^0.2.0", + "time-diff": "^0.3.1" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/micromatch/to-regex-range", + "keywords": [ + "alpha", + "alphabetical", + "bash", + "brace", + "date", + "expand", + "expansion", + "glob", + "match", + "matches", + "matching", + "number", + "numerical", + "range", + "ranges", + "regex", + "sequence", + "sh", + "to", + "year" + ], + "license": "MIT", + "main": "index.js", + "name": "to-regex-range", + "repository": { + "type": "git", + "url": "git+https://github.com/micromatch/to-regex-range.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "expand-range", + "fill-range", + "micromatch", + "repeat-element", + "repeat-string" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "helpers": [ + "./examples.js" + ], + "reflinks": [ + "0-5", + "0-9", + "1-5", + "1-9" + ] + }, + "version": "2.1.1" +} diff --git a/node_modules/to-regex/LICENSE b/node_modules/to-regex/LICENSE new file mode 100644 index 0000000..7c9987b --- /dev/null +++ b/node_modules/to-regex/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016-2018, 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/node_modules/to-regex/README.md b/node_modules/to-regex/README.md new file mode 100644 index 0000000..5a28fc3 --- /dev/null +++ b/node_modules/to-regex/README.md @@ -0,0 +1,205 @@ +# to-regex [![NPM version](https://img.shields.io/npm/v/to-regex.svg?style=flat)](https://www.npmjs.com/package/to-regex) [![NPM monthly downloads](https://img.shields.io/npm/dm/to-regex.svg?style=flat)](https://npmjs.org/package/to-regex) [![NPM total downloads](https://img.shields.io/npm/dt/to-regex.svg?style=flat)](https://npmjs.org/package/to-regex) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/to-regex.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/to-regex) + +> Generate a regex from a string or array of strings. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +- [Install](#install) +- [Usage](#usage) +- [Options](#options) + * [options.contains](#optionscontains) + * [options.negate](#optionsnegate) + * [options.nocase](#optionsnocase) + * [options.flags](#optionsflags) + * [options.cache](#optionscache) + * [options.safe](#optionssafe) +- [About](#about) + * [Related projects](#related-projects) + * [Author](#author) + * [License](#license) + +_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save to-regex +``` + +## Usage + +```js +var toRegex = require('to-regex'); + +console.log(toRegex('foo')); +//=> /^(?:foo)$/ + +console.log(toRegex('foo', {negate: true})); +//=> /^(?:(?:(?!^(?:foo)$).)*)$/ + +console.log(toRegex('foo', {contains: true})); +//=> /(?:foo)/ + +console.log(toRegex(['foo', 'bar'], {negate: true})); +//=> /^(?:(?:(?!^(?:(?:foo)|(?:bar))$).)*)$/ + +console.log(toRegex(['foo', 'bar'], {negate: true, contains: true})); +//=> /^(?:(?:(?!(?:(?:foo)|(?:bar))).)*)$/ +``` + +## Options + +### options.contains + +**Type**: `Boolean` + +**Default**: `undefined` + +Generate a regex that will match any string that _contains_ the given pattern. By default, regex is strict will only return true for exact matches. + +```js +var toRegex = require('to-regex'); +console.log(toRegex('foo', {contains: true})); +//=> /(?:foo)/ +``` + +### options.negate + +**Type**: `Boolean` + +**Default**: `undefined` + +Create a regex that will match everything except the given pattern. + +```js +var toRegex = require('to-regex'); +console.log(toRegex('foo', {negate: true})); +//=> /^(?:(?:(?!^(?:foo)$).)*)$/ +``` + +### options.nocase + +**Type**: `Boolean` + +**Default**: `undefined` + +Adds the `i` flag, to enable case-insensitive matching. + +```js +var toRegex = require('to-regex'); +console.log(toRegex('foo', {nocase: true})); +//=> /^(?:foo)$/i +``` + +Alternatively you can pass the flags you want directly on [options.flags](#options.flags). + +### options.flags + +**Type**: `String` + +**Default**: `undefined` + +Define the flags you want to use on the generated regex. + +```js +var toRegex = require('to-regex'); +console.log(toRegex('foo', {flags: 'gm'})); +//=> /^(?:foo)$/gm +console.log(toRegex('foo', {flags: 'gmi', nocase: true})); //<= handles redundancy +//=> /^(?:foo)$/gmi +``` + +### options.cache + +**Type**: `Boolean` + +**Default**: `true` + +Generated regex is cached based on the provided string and options. As a result, runtime compilation only happens once per pattern (as long as options are also the same), which can result in dramatic speed improvements. + +This also helps with debugging, since adding options and pattern are added to the generated regex. + +**Disable caching** + +```js +toRegex('foo', {cache: false}); +``` + +### options.safe + +**Type**: `Boolean` + +**Default**: `undefined` + +Check the generated regular expression with [safe-regex](https://github.com/substack/safe-regex) and throw an error if the regex is potentially unsafe. + +**Examples** + +```js +console.log(toRegex('(x+x+)+y')); +//=> /^(?:(x+x+)+y)$/ + +// The following would throw an error +toRegex('(x+x+)+y', {safe: true}); +``` + +## About + +
    +Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
    + +
    +Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
    + +
    +Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
    + +### Related projects + +You might also be interested in these projects: + +* [has-glob](https://www.npmjs.com/package/has-glob): Returns `true` if an array has a glob pattern. | [homepage](https://github.com/jonschlinkert/has-glob "Returns `true` if an array has a glob pattern.") +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [path-regex](https://www.npmjs.com/package/path-regex): Regular expression for matching the parts of a file path. | [homepage](https://github.com/regexps/path-regex "Regular expression for matching the parts of a file path.") +* [to-regex-range](https://www.npmjs.com/package/to-regex-range): Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than… [more](https://github.com/micromatch/to-regex-range) | [homepage](https://github.com/micromatch/to-regex-range "Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than 2.78 million test assertions.") + +### Author + +**Jon Schlinkert** + +* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert) +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on February 24, 2018._ \ No newline at end of file diff --git a/node_modules/to-regex/index.js b/node_modules/to-regex/index.js new file mode 100644 index 0000000..a87d015 --- /dev/null +++ b/node_modules/to-regex/index.js @@ -0,0 +1,155 @@ +'use strict'; + +var safe = require('safe-regex'); +var define = require('define-property'); +var extend = require('extend-shallow'); +var not = require('regex-not'); +var MAX_LENGTH = 1024 * 64; + +/** + * Session cache + */ + +var cache = {}; + +/** + * Create a regular expression from the given `pattern` string. + * + * @param {String|RegExp} `pattern` Pattern can be a string or regular expression. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +module.exports = function(patterns, options) { + if (!Array.isArray(patterns)) { + return makeRe(patterns, options); + } + return makeRe(patterns.join('|'), options); +}; + +/** + * Create a regular expression from the given `pattern` string. + * + * @param {String|RegExp} `pattern` Pattern can be a string or regular expression. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +function makeRe(pattern, options) { + if (pattern instanceof RegExp) { + return pattern; + } + + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + + if (pattern.length > MAX_LENGTH) { + throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters'); + } + + var key = pattern; + // do this before shallow cloning options, it's a lot faster + if (!options || (options && options.cache !== false)) { + key = createKey(pattern, options); + + if (cache.hasOwnProperty(key)) { + return cache[key]; + } + } + + var opts = extend({}, options); + if (opts.contains === true) { + if (opts.negate === true) { + opts.strictNegate = false; + } else { + opts.strict = false; + } + } + + if (opts.strict === false) { + opts.strictOpen = false; + opts.strictClose = false; + } + + var open = opts.strictOpen !== false ? '^' : ''; + var close = opts.strictClose !== false ? '$' : ''; + var flags = opts.flags || ''; + var regex; + + if (opts.nocase === true && !/i/.test(flags)) { + flags += 'i'; + } + + try { + if (opts.negate || typeof opts.strictNegate === 'boolean') { + pattern = not.create(pattern, opts); + } + + var str = open + '(?:' + pattern + ')' + close; + regex = new RegExp(str, flags); + + if (opts.safe === true && safe(regex) === false) { + throw new Error('potentially unsafe regular expression: ' + regex.source); + } + + } catch (err) { + if (opts.strictErrors === true || opts.safe === true) { + err.key = key; + err.pattern = pattern; + err.originalOptions = options; + err.createdOptions = opts; + throw err; + } + + try { + regex = new RegExp('^' + pattern.replace(/(\W)/g, '\\$1') + '$'); + } catch (err) { + regex = /.^/; //<= match nothing + } + } + + if (opts.cache !== false) { + memoize(regex, key, pattern, opts); + } + return regex; +} + +/** + * Memoize generated regex. This can result in dramatic speed improvements + * and simplify debugging by adding options and pattern to the regex. It can be + * disabled by passing setting `options.cache` to false. + */ + +function memoize(regex, key, pattern, options) { + define(regex, 'cached', true); + define(regex, 'pattern', pattern); + define(regex, 'options', options); + define(regex, 'key', key); + cache[key] = regex; +} + +/** + * Create the key to use for memoization. The key is generated + * by iterating over the options and concatenating key-value pairs + * to the pattern string. + */ + +function createKey(pattern, options) { + if (!options) return pattern; + var key = pattern; + for (var prop in options) { + if (options.hasOwnProperty(prop)) { + key += ';' + prop + '=' + String(options[prop]); + } + } + return key; +} + +/** + * Expose `makeRe` + */ + +module.exports.makeRe = makeRe; diff --git a/node_modules/to-regex/package.json b/node_modules/to-regex/package.json new file mode 100644 index 0000000..b9a2abc --- /dev/null +++ b/node_modules/to-regex/package.json @@ -0,0 +1,97 @@ +{ + "_from": "to-regex@^3.0.1", + "_id": "to-regex@3.0.2", + "_inBundle": false, + "_integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "_location": "/to-regex", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "to-regex@^3.0.1", + "name": "to-regex", + "escapedName": "to-regex", + "rawSpec": "^3.0.1", + "saveSpec": null, + "fetchSpec": "^3.0.1" + }, + "_requiredBy": [ + "/braces", + "/expand-brackets", + "/extglob", + "/micromatch", + "/nanomatch" + ], + "_resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "_shasum": "13cfdd9b336552f30b51f33a8ae1b42a7a7599ce", + "_spec": "to-regex@^3.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/micromatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/to-regex/issues" + }, + "bundleDependencies": false, + "dependencies": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + }, + "deprecated": false, + "description": "Generate a regex from a string or array of strings.", + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.5.3" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/to-regex", + "keywords": [ + "match", + "regex", + "regular expression", + "test", + "to" + ], + "license": "MIT", + "main": "index.js", + "name": "to-regex", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/to-regex.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": { + "method": "preWrite" + }, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "has-glob", + "is-glob", + "path-regex", + "to-regex-range" + ] + }, + "lint": { + "reflinks": true + } + }, + "version": "3.0.2" +} diff --git a/node_modules/token-stream/.npmignore b/node_modules/token-stream/.npmignore new file mode 100644 index 0000000..0ced68c --- /dev/null +++ b/node_modules/token-stream/.npmignore @@ -0,0 +1,14 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz +pids +logs +results +npm-debug.log +node_modules +coverage diff --git a/node_modules/token-stream/.travis.yml b/node_modules/token-stream/.travis.yml new file mode 100644 index 0000000..6e5919d --- /dev/null +++ b/node_modules/token-stream/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "0.10" diff --git a/node_modules/token-stream/LICENSE b/node_modules/token-stream/LICENSE new file mode 100644 index 0000000..27cc9f3 --- /dev/null +++ b/node_modules/token-stream/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 Forbes Lindesay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/token-stream/README.md b/node_modules/token-stream/README.md new file mode 100644 index 0000000..0e9c12c --- /dev/null +++ b/node_modules/token-stream/README.md @@ -0,0 +1,68 @@ +# token-stream + +Take an array of token and produce a more useful API to give to a parser. + +[![Build Status](https://img.shields.io/travis/jadejs/token-stream/master.svg)](https://travis-ci.org/jadejs/token-stream) +[![Dependency Status](https://img.shields.io/gemnasium/jadejs/token-stream.svg)](https://gemnasium.com/jadejs/token-stream) +[![NPM version](https://img.shields.io/npm/v/token-stream.svg)](https://www.npmjs.org/package/token-stream) + +## Installation + + npm install token-stream + +## Usage + +```js +var TokenStream = require('token-stream'); + +var stream = new TokenStream([ + 'a', + 'b', + 'c', + 'd' +]); +assert(stream.peek() === 'a'); +assert(stream.lookahead(0) == 'a'); +assert(stream.lookahead(1) == 'b'); + +assert(stream.advance() === 'a'); +assert(stream.peek() === 'b'); +assert(stream.lookahead(0) == 'b'); +assert(stream.lookahead(1) == 'c'); + +stream.defer('z'); +assert(stream.peek() === 'z'); +assert(stream.lookahead(0) == 'z'); +assert(stream.lookahead(1) == 'b'); +assert(stream.advance() === 'z'); +assert(stream.advance() === 'b'); +assert(stream.advance() === 'c'); +assert(stream.advance() === 'd'); + +// an error is thrown if you try and advance beyond the end of the stream +assert.throws(function () { + stream.adavance(); +}); +``` + +## API + +### stream.peek() + +Gets and returns the next item in the stream without advancing the stream's position. + +### stream.advance() + +Returns the next item in the stream and advances the stream by one item. + +### stream.defer(token) + +Put a token on the start of the stream (useful if you need to back track after calling advance. + +### stream.lookahead(index) + +Return the item at `index` position from the start of the stream, but don't advance the stream. `stream.lookahead(0)` is equivalent to `stream.peek()`. + +## License + + MIT diff --git a/node_modules/token-stream/index.js b/node_modules/token-stream/index.js new file mode 100644 index 0000000..70641bb --- /dev/null +++ b/node_modules/token-stream/index.js @@ -0,0 +1,30 @@ +'use strict'; + +module.exports = TokenStream; +function TokenStream(tokens) { + if (!Array.isArray(tokens)) { + throw new TypeError('tokens must be passed to TokenStream as an array.'); + } + this._tokens = tokens; +} +TokenStream.prototype.lookahead = function (index) { + if (this._tokens.length <= index) { + throw new Error('Cannot read past the end of a stream'); + } + return this._tokens[index]; +}; +TokenStream.prototype.peek = function () { + if (this._tokens.length === 0) { + throw new Error('Cannot read past the end of a stream'); + } + return this._tokens[0]; +}; +TokenStream.prototype.advance = function () { + if (this._tokens.length === 0) { + throw new Error('Cannot read past the end of a stream'); + } + return this._tokens.shift(); +}; +TokenStream.prototype.defer = function (token) { + this._tokens.unshift(token); +}; diff --git a/node_modules/token-stream/package.json b/node_modules/token-stream/package.json new file mode 100644 index 0000000..420a157 --- /dev/null +++ b/node_modules/token-stream/package.json @@ -0,0 +1,50 @@ +{ + "_from": "token-stream@0.0.1", + "_id": "token-stream@0.0.1", + "_inBundle": false, + "_integrity": "sha1-zu78cXp2xDFvEm0LnbqlXX598Bo=", + "_location": "/token-stream", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "token-stream@0.0.1", + "name": "token-stream", + "escapedName": "token-stream", + "rawSpec": "0.0.1", + "saveSpec": null, + "fetchSpec": "0.0.1" + }, + "_requiredBy": [ + "/pug-parser" + ], + "_resolved": "https://registry.npmjs.org/token-stream/-/token-stream-0.0.1.tgz", + "_shasum": "ceeefc717a76c4316f126d0b9dbaa55d7e7df01a", + "_spec": "token-stream@0.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/pug-parser", + "author": { + "name": "ForbesLindesay" + }, + "bugs": { + "url": "https://github.com/jadejs/token-stream/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Take an array of token and produce a more useful API to give to a parser", + "devDependencies": { + "istanbul": "^0.3.2" + }, + "homepage": "https://github.com/jadejs/token-stream#readme", + "license": "MIT", + "name": "token-stream", + "repository": { + "type": "git", + "url": "git+https://github.com/jadejs/token-stream.git" + }, + "scripts": { + "coverage": "istanbul cover test", + "test": "node test && npm run coverage" + }, + "version": "0.0.1" +} diff --git a/node_modules/token-stream/test/index.js b/node_modules/token-stream/test/index.js new file mode 100644 index 0000000..8a127a2 --- /dev/null +++ b/node_modules/token-stream/test/index.js @@ -0,0 +1,46 @@ +'use strict'; + +var assert = require('assert'); +var TokenStream = require('../'); + +assert.throws(function () { + new TokenStream('foo,bar'); +}); +var stream = new TokenStream([ + 'a', + 'b', + 'c', + 'd' +]); +assert.throws(function () { + stream.lookahead(9); +}); +assert(stream.peek() === 'a'); +assert(stream.lookahead(0) == 'a'); +assert(stream.lookahead(1) == 'b'); + +assert(stream.advance() === 'a'); +assert(stream.peek() === 'b'); +assert(stream.lookahead(0) == 'b'); +assert(stream.lookahead(1) == 'c'); + +stream.defer('z'); +assert(stream.peek() === 'z'); +assert(stream.lookahead(0) == 'z'); +assert(stream.lookahead(1) == 'b'); +assert(stream.advance() === 'z'); +assert(stream.advance() === 'b'); +assert(stream.advance() === 'c'); +assert(stream.advance() === 'd'); +assert.throws(function () { + stream.peek(); +}); +assert.throws(function () { + stream.lookahead(0); +}); +assert.throws(function () { + stream.lookahead(1); +}); +assert.throws(function () { + stream.advance(); +}); diff --git a/node_modules/touch/LICENSE b/node_modules/touch/LICENSE new file mode 100644 index 0000000..05eeeb8 --- /dev/null +++ b/node_modules/touch/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/touch/README.md b/node_modules/touch/README.md new file mode 100644 index 0000000..b5a361e --- /dev/null +++ b/node_modules/touch/README.md @@ -0,0 +1,52 @@ +# node-touch + +For all your node touching needs. + +## Installing + +```bash +npm install touch +``` + +## CLI Usage: + +See `man touch` + +This package exports a binary called `nodetouch` that works mostly +like the unix builtin `touch(1)`. + +## API Usage: + +```javascript +var touch = require("touch") +``` + +Gives you the following functions: + +* `touch(filename, options, cb)` +* `touch.sync(filename, options)` +* `touch.ftouch(fd, options, cb)` +* `touch.ftouchSync(fd, options)` + +All the `options` objects are optional. + +All the async functions return a Promise. If a callback function is +provided, then it's attached to the Promise. + +## Options + +* `force` like `touch -f` Boolean +* `time` like `touch -t ` Can be a Date object, or any parseable + Date string, or epoch ms number. +* `atime` like `touch -a` Can be either a Boolean, or a Date. +* `mtime` like `touch -m` Can be either a Boolean, or a Date. +* `ref` like `touch -r ` Must be path to a file. +* `nocreate` like `touch -c` Boolean + +If neither `atime` nor `mtime` are set, then both values are set. If +one of them is set, then the other is not. + +## cli + +This package creates a `nodetouch` command line executable that works +very much like the unix builtin `touch(1)` diff --git a/node_modules/touch/bin/nodetouch.js b/node_modules/touch/bin/nodetouch.js new file mode 100755 index 0000000..f78f082 --- /dev/null +++ b/node_modules/touch/bin/nodetouch.js @@ -0,0 +1,112 @@ +#!/usr/bin/env node +const touch = require("../index.js") + +const usage = code => { + console[code ? 'error' : 'log']( + 'usage:\n' + + 'touch [-acfm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...' + ) + process.exit(code) +} + +const singleFlags = { + a: 'atime', + m: 'mtime', + c: 'nocreate', + f: 'force' +} + +const singleOpts = { + r: 'ref', + t: 'time' +} + +const files = [] +const args = process.argv.slice(2) +const options = {} +for (let i = 0; i < args.length; i++) { + const arg = args[i] + if (!arg.match(/^-/)) { + files.push(arg) + continue + } + + // expand shorthands + if (arg.charAt(1) !== '-') { + const expand = [] + for (let f = 1; f < arg.length; f++) { + const fc = arg.charAt(f) + const sf = singleFlags[fc] + const so = singleOpts[fc] + if (sf) + expand.push('--' + sf) + else if (so) { + const soslice = arg.slice(f + 1) + const soval = soslice.charAt(0) === '=' ? soslice : '=' + soslice + expand.push('--' + so + soval) + f = arg.length + } else if (arg !== '-' + fc) + expand.push('-' + fc) + } + if (expand.length) { + args.splice.apply(args, [i, 1].concat(expand)) + i-- + continue + } + } + + const argsplit = arg.split('=') + const key = argsplit.shift().replace(/^\-\-/, '') + const val = argsplit.length ? argsplit.join('=') : null + + switch (key) { + case 'time': + const timestr = val || args[++i] + // [-t [[CC]YY]MMDDhhmm[.SS]] + const parsedtime = timestr.match( + /^(([0-9]{2})?([0-9]{2}))?([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})(\.([0-9]{2}))?$/ + ) + if (!parsedtime) { + console.error('touch: out of range or illegal ' + + 'time specification: ' + + '[[CC]YY]MMDDhhmm[.SS]') + process.exit(1) + } else { + const y = +parsedtime[1] + const year = parsedtime[2] ? y + : y <= 68 ? 2000 + y + : 1900 + y + + const MM = +parsedtime[4] - 1 + const dd = +parsedtime[5] + const hh = +parsedtime[6] + const mm = +parsedtime[7] + const ss = +parsedtime[8] + + options.time = new Date(Date.UTC(year, MM, dd, hh, mm, ss)) + } + continue + + case 'ref': + options.ref = val || args[++i] + continue + + case 'mtime': + case 'nocreate': + case 'atime': + case 'force': + options[key] = true + continue + + default: + console.error('touch: illegal option -- ' + arg) + usage(1) + } +} + +if (!files.length) + usage() + +process.exitCode = 0 +Promise.all(files.map(f => touch(f, options))) + .catch(er => process.exitCode = 1) diff --git a/node_modules/touch/index.js b/node_modules/touch/index.js new file mode 100644 index 0000000..f942e42 --- /dev/null +++ b/node_modules/touch/index.js @@ -0,0 +1,224 @@ +'use strict' + +const EE = require('events').EventEmitter +const cons = require('constants') +const fs = require('fs') + +module.exports = (f, options, cb) => { + if (typeof options === 'function') + cb = options, options = {} + + const p = new Promise((res, rej) => { + new Touch(validOpts(options, f, null)) + .on('done', res).on('error', rej) + }) + + return cb ? p.then(res => cb(null, res), cb) : p +} + +module.exports.sync = module.exports.touchSync = (f, options) => + (new TouchSync(validOpts(options, f, null)), undefined) + +module.exports.ftouch = (fd, options, cb) => { + if (typeof options === 'function') + cb = options, options = {} + + const p = new Promise((res, rej) => { + new Touch(validOpts(options, null, fd)) + .on('done', res).on('error', rej) + }) + + return cb ? p.then(res => cb(null, res), cb) : p +} + +module.exports.ftouchSync = (fd, opt) => + (new TouchSync(validOpts(opt, null, fd)), undefined) + +const validOpts = (options, path, fd) => { + options = Object.create(options || {}) + options.fd = fd + options.path = path + + // {mtime: true}, {ctime: true} + // If set to something else, then treat as epoch ms value + const now = parseInt(new Date(options.time || Date.now()).getTime() / 1000) + if (!options.atime && !options.mtime) + options.atime = options.mtime = now + else { + if (true === options.atime) + options.atime = now + + if (true === options.mtime) + options.mtime = now + } + + let oflags = 0 + if (!options.force) + oflags = oflags | cons.O_RDWR + + if (!options.nocreate) + oflags = oflags | cons.O_CREAT + + options.oflags = oflags + return options +} + +class Touch extends EE { + constructor (options) { + super(options) + this.fd = options.fd + this.path = options.path + this.atime = options.atime + this.mtime = options.mtime + this.ref = options.ref + this.nocreate = !!options.nocreate + this.force = !!options.force + this.closeAfter = options.closeAfter + this.oflags = options.oflags + this.options = options + + if (typeof this.fd !== 'number') { + this.closeAfter = true + this.open() + } else + this.onopen(null, this.fd) + } + + emit (ev, data) { + // we only emit when either done or erroring + // in both cases, need to close + this.close() + return super.emit(ev, data) + } + + close () { + if (typeof this.fd === 'number' && this.closeAfter) + fs.close(this.fd, () => {}) + } + + open () { + fs.open(this.path, this.oflags, (er, fd) => this.onopen(er, fd)) + } + + onopen (er, fd) { + if (er) { + if (er.code === 'EISDIR') + this.onopen(null, null) + else if (er.code === 'ENOENT' && this.nocreate) + this.emit('done') + else + this.emit('error', er) + } else { + this.fd = fd + if (this.ref) + this.statref() + else if (!this.atime || !this.mtime) + this.fstat() + else + this.futimes() + } + } + + statref () { + fs.stat(this.ref, (er, st) => { + if (er) + this.emit('error', er) + else + this.onstatref(st) + }) + } + + onstatref (st) { + this.atime = this.atime && parseInt(st.atime.getTime()/1000, 10) + this.mtime = this.mtime && parseInt(st.mtime.getTime()/1000, 10) + if (!this.atime || !this.mtime) + this.fstat() + else + this.futimes() + } + + fstat () { + const stat = this.fd ? 'fstat' : 'stat' + const target = this.fd || this.path + fs[stat](target, (er, st) => { + if (er) + this.emit('error', er) + else + this.onfstat(st) + }) + } + + onfstat (st) { + if (typeof this.atime !== 'number') + this.atime = parseInt(st.atime.getTime()/1000, 10) + + if (typeof this.mtime !== 'number') + this.mtime = parseInt(st.mtime.getTime()/1000, 10) + + this.futimes() + } + + futimes () { + const utimes = this.fd ? 'futimes' : 'utimes' + const target = this.fd || this.path + fs[utimes](target, ''+this.atime, ''+this.mtime, er => { + if (er) + this.emit('error', er) + else + this.emit('done') + }) + } +} + +class TouchSync extends Touch { + open () { + try { + this.onopen(null, fs.openSync(this.path, this.oflags)) + } catch (er) { + this.onopen(er) + } + } + + statref () { + let threw = true + try { + this.onstatref(fs.statSync(this.ref)) + threw = false + } finally { + if (threw) + this.close() + } + } + + fstat () { + let threw = true + const stat = this.fd ? 'fstatSync' : 'statSync' + const target = this.fd || this.path + try { + this.onfstat(fs[stat](target)) + threw = false + } finally { + if (threw) + this.close() + } + } + + futimes () { + let threw = true + const utimes = this.fd ? 'futimesSync' : 'utimesSync' + const target = this.fd || this.path + try { + fs[utimes](target, this.atime, this.mtime) + threw = false + } finally { + if (threw) + this.close() + } + this.emit('done') + } + + close () { + if (typeof this.fd === 'number' && this.closeAfter) + try { fs.closeSync(this.fd) } catch (er) {} + } +} diff --git a/node_modules/touch/package.json b/node_modules/touch/package.json new file mode 100644 index 0000000..335a7ce --- /dev/null +++ b/node_modules/touch/package.json @@ -0,0 +1,64 @@ +{ + "_from": "touch@^3.1.0", + "_id": "touch@3.1.0", + "_inBundle": false, + "_integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "_location": "/touch", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "touch@^3.1.0", + "name": "touch", + "escapedName": "touch", + "rawSpec": "^3.1.0", + "saveSpec": null, + "fetchSpec": "^3.1.0" + }, + "_requiredBy": [ + "/nodemon" + ], + "_resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "_shasum": "fe365f5f75ec9ed4e56825e0bb76d24ab74af83b", + "_spec": "touch@^3.1.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/nodemon", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bin": { + "nodetouch": "./bin/nodetouch.js" + }, + "bugs": { + "url": "https://github.com/isaacs/node-touch/issues" + }, + "bundleDependencies": false, + "dependencies": { + "nopt": "~1.0.10" + }, + "deprecated": false, + "description": "like touch(1) in node", + "devDependencies": { + "mutate-fs": "^1.1.0", + "tap": "^10.7.0" + }, + "files": [ + "index.js", + "bin/nodetouch.js" + ], + "homepage": "https://github.com/isaacs/node-touch#readme", + "license": "ISC", + "name": "touch", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-touch.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test/*.js --100 -J" + }, + "version": "3.1.0" +} diff --git a/node_modules/type-is/HISTORY.md b/node_modules/type-is/HISTORY.md new file mode 100644 index 0000000..183290c --- /dev/null +++ b/node_modules/type-is/HISTORY.md @@ -0,0 +1,236 @@ +1.6.16 / 2018-02-16 +=================== + + * deps: mime-types@~2.1.18 + - Add `application/raml+yaml` with extension `.raml` + - Add `application/wasm` with extension `.wasm` + - Add `text/shex` with extension `.shex` + - Add extensions for JPEG-2000 images + - Add extensions from IANA for `message/*` types + - Add extension `.mjs` to `application/javascript` + - Add extension `.wadl` to `application/vnd.sun.wadl+xml` + - Add extension `.gz` to `application/gzip` + - Add glTF types and extensions + - Add new mime types + - Update extensions `.md` and `.markdown` to be `text/markdown` + - Update font MIME types + - Update `text/hjson` to registered `application/hjson` + +1.6.15 / 2017-03-31 +=================== + + * deps: mime-types@~2.1.15 + - Add new mime types + +1.6.14 / 2016-11-18 +=================== + + * deps: mime-types@~2.1.13 + - Add new mime types + +1.6.13 / 2016-05-18 +=================== + + * deps: mime-types@~2.1.11 + - Add new mime types + +1.6.12 / 2016-02-28 +=================== + + * deps: mime-types@~2.1.10 + - Add new mime types + - Fix extension of `application/dash+xml` + - Update primary extension for `audio/mp4` + +1.6.11 / 2016-01-29 +=================== + + * deps: mime-types@~2.1.9 + - Add new mime types + +1.6.10 / 2015-12-01 +=================== + + * deps: mime-types@~2.1.8 + - Add new mime types + +1.6.9 / 2015-09-27 +================== + + * deps: mime-types@~2.1.7 + - Add new mime types + +1.6.8 / 2015-09-04 +================== + + * deps: mime-types@~2.1.6 + - Add new mime types + +1.6.7 / 2015-08-20 +================== + + * Fix type error when given invalid type to match against + * deps: mime-types@~2.1.5 + - Add new mime types + +1.6.6 / 2015-07-31 +================== + + * deps: mime-types@~2.1.4 + - Add new mime types + +1.6.5 / 2015-07-16 +================== + + * deps: mime-types@~2.1.3 + - Add new mime types + +1.6.4 / 2015-07-01 +================== + + * deps: mime-types@~2.1.2 + - Add new mime types + * perf: enable strict mode + * perf: remove argument reassignment + +1.6.3 / 2015-06-08 +================== + + * deps: mime-types@~2.1.1 + - Add new mime types + * perf: reduce try block size + * perf: remove bitwise operations + +1.6.2 / 2015-05-10 +================== + + * deps: mime-types@~2.0.11 + - Add new mime types + +1.6.1 / 2015-03-13 +================== + + * deps: mime-types@~2.0.10 + - Add new mime types + +1.6.0 / 2015-02-12 +================== + + * fix false-positives in `hasBody` `Transfer-Encoding` check + * support wildcard for both type and subtype (`*/*`) + +1.5.7 / 2015-02-09 +================== + + * fix argument reassignment + * deps: mime-types@~2.0.9 + - Add new mime types + +1.5.6 / 2015-01-29 +================== + + * deps: mime-types@~2.0.8 + - Add new mime types + +1.5.5 / 2014-12-30 +================== + + * deps: mime-types@~2.0.7 + - Add new mime types + - Fix missing extensions + - Fix various invalid MIME type entries + - Remove example template MIME types + - deps: mime-db@~1.5.0 + +1.5.4 / 2014-12-10 +================== + + * deps: mime-types@~2.0.4 + - Add new mime types + - deps: mime-db@~1.3.0 + +1.5.3 / 2014-11-09 +================== + + * deps: mime-types@~2.0.3 + - Add new mime types + - deps: mime-db@~1.2.0 + +1.5.2 / 2014-09-28 +================== + + * deps: mime-types@~2.0.2 + - Add new mime types + - deps: mime-db@~1.1.0 + +1.5.1 / 2014-09-07 +================== + + * Support Node.js 0.6 + * deps: media-typer@0.3.0 + * deps: mime-types@~2.0.1 + - Support Node.js 0.6 + +1.5.0 / 2014-09-05 +================== + + * fix `hasbody` to be true for `content-length: 0` + +1.4.0 / 2014-09-02 +================== + + * update mime-types + +1.3.2 / 2014-06-24 +================== + + * use `~` range on mime-types + +1.3.1 / 2014-06-19 +================== + + * fix global variable leak + +1.3.0 / 2014-06-19 +================== + + * improve type parsing + + - invalid media type never matches + - media type not case-sensitive + - extra LWS does not affect results + +1.2.2 / 2014-06-19 +================== + + * fix behavior on unknown type argument + +1.2.1 / 2014-06-03 +================== + + * switch dependency from `mime` to `mime-types@1.0.0` + +1.2.0 / 2014-05-11 +================== + + * support suffix matching: + + - `+json` matches `application/vnd+json` + - `*/vnd+json` matches `application/vnd+json` + - `application/*+json` matches `application/vnd+json` + +1.1.0 / 2014-04-12 +================== + + * add non-array values support + * expose internal utilities: + + - `.is()` + - `.hasBody()` + - `.normalize()` + - `.match()` + +1.0.1 / 2014-03-30 +================== + + * add `multipart` as a shorthand diff --git a/node_modules/type-is/LICENSE b/node_modules/type-is/LICENSE new file mode 100644 index 0000000..386b7b6 --- /dev/null +++ b/node_modules/type-is/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2014-2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/type-is/README.md b/node_modules/type-is/README.md new file mode 100644 index 0000000..70c47da --- /dev/null +++ b/node_modules/type-is/README.md @@ -0,0 +1,146 @@ +# type-is + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Infer the content-type of a request. + +### Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install type-is +``` + +## API + +```js +var http = require('http') +var typeis = require('type-is') + +http.createServer(function (req, res) { + var istext = typeis(req, ['text/*']) + res.end('you ' + (istext ? 'sent' : 'did not send') + ' me text') +}) +``` + +### type = typeis(request, types) + +`request` is the node HTTP request. `types` is an array of types. + + + +```js +// req.headers.content-type = 'application/json' + +typeis(req, ['json']) // 'json' +typeis(req, ['html', 'json']) // 'json' +typeis(req, ['application/*']) // 'application/json' +typeis(req, ['application/json']) // 'application/json' + +typeis(req, ['html']) // false +``` + +### typeis.hasBody(request) + +Returns a Boolean if the given `request` has a body, regardless of the +`Content-Type` header. + +Having a body has no relation to how large the body is (it may be 0 bytes). +This is similar to how file existence works. If a body does exist, then this +indicates that there is data to read from the Node.js request stream. + + + +```js +if (typeis.hasBody(req)) { + // read the body, since there is one + + req.on('data', function (chunk) { + // ... + }) +} +``` + +### type = typeis.is(mediaType, types) + +`mediaType` is the [media type](https://tools.ietf.org/html/rfc6838) string. `types` is an array of types. + + + +```js +var mediaType = 'application/json' + +typeis.is(mediaType, ['json']) // 'json' +typeis.is(mediaType, ['html', 'json']) // 'json' +typeis.is(mediaType, ['application/*']) // 'application/json' +typeis.is(mediaType, ['application/json']) // 'application/json' + +typeis.is(mediaType, ['html']) // false +``` + +### Each type can be: + +- An extension name such as `json`. This name will be returned if matched. +- A mime type such as `application/json`. +- A mime type with a wildcard such as `*/*` or `*/json` or `application/*`. The full mime type will be returned if matched. +- A suffix such as `+json`. This can be combined with a wildcard such as `*/vnd+json` or `application/*+json`. The full mime type will be returned if matched. + +`false` will be returned if no type matches or the content type is invalid. + +`null` will be returned if the request does not have a body. + +## Examples + +### Example body parser + +```js +var express = require('express') +var typeis = require('type-is') + +var app = express() + +app.use(function bodyParser (req, res, next) { + if (!typeis.hasBody(req)) { + return next() + } + + switch (typeis(req, ['urlencoded', 'json', 'multipart'])) { + case 'urlencoded': + // parse urlencoded body + throw new Error('implement urlencoded body parsing') + case 'json': + // parse json body + throw new Error('implement json body parsing') + case 'multipart': + // parse multipart body + throw new Error('implement multipart body parsing') + default: + // 415 error code + res.statusCode = 415 + res.end() + break + } +}) +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/type-is.svg +[npm-url]: https://npmjs.org/package/type-is +[node-version-image]: https://img.shields.io/node/v/type-is.svg +[node-version-url]: https://nodejs.org/en/download/ +[travis-image]: https://img.shields.io/travis/jshttp/type-is/master.svg +[travis-url]: https://travis-ci.org/jshttp/type-is +[coveralls-image]: https://img.shields.io/coveralls/jshttp/type-is/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/type-is?branch=master +[downloads-image]: https://img.shields.io/npm/dm/type-is.svg +[downloads-url]: https://npmjs.org/package/type-is diff --git a/node_modules/type-is/index.js b/node_modules/type-is/index.js new file mode 100644 index 0000000..4da7301 --- /dev/null +++ b/node_modules/type-is/index.js @@ -0,0 +1,262 @@ +/*! + * type-is + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var typer = require('media-typer') +var mime = require('mime-types') + +/** + * Module exports. + * @public + */ + +module.exports = typeofrequest +module.exports.is = typeis +module.exports.hasBody = hasbody +module.exports.normalize = normalize +module.exports.match = mimeMatch + +/** + * Compare a `value` content-type with `types`. + * Each `type` can be an extension like `html`, + * a special shortcut like `multipart` or `urlencoded`, + * or a mime type. + * + * If no types match, `false` is returned. + * Otherwise, the first `type` that matches is returned. + * + * @param {String} value + * @param {Array} types + * @public + */ + +function typeis (value, types_) { + var i + var types = types_ + + // remove parameters and normalize + var val = tryNormalizeType(value) + + // no type or invalid + if (!val) { + return false + } + + // support flattened arguments + if (types && !Array.isArray(types)) { + types = new Array(arguments.length - 1) + for (i = 0; i < types.length; i++) { + types[i] = arguments[i + 1] + } + } + + // no types, return the content type + if (!types || !types.length) { + return val + } + + var type + for (i = 0; i < types.length; i++) { + if (mimeMatch(normalize(type = types[i]), val)) { + return type[0] === '+' || type.indexOf('*') !== -1 + ? val + : type + } + } + + // no matches + return false +} + +/** + * Check if a request has a request body. + * A request with a body __must__ either have `transfer-encoding` + * or `content-length` headers set. + * http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3 + * + * @param {Object} request + * @return {Boolean} + * @public + */ + +function hasbody (req) { + return req.headers['transfer-encoding'] !== undefined || + !isNaN(req.headers['content-length']) +} + +/** + * Check if the incoming request contains the "Content-Type" + * header field, and it contains any of the give mime `type`s. + * If there is no request body, `null` is returned. + * If there is no content type, `false` is returned. + * Otherwise, it returns the first `type` that matches. + * + * Examples: + * + * // With Content-Type: text/html; charset=utf-8 + * this.is('html'); // => 'html' + * this.is('text/html'); // => 'text/html' + * this.is('text/*', 'application/json'); // => 'text/html' + * + * // When Content-Type is application/json + * this.is('json', 'urlencoded'); // => 'json' + * this.is('application/json'); // => 'application/json' + * this.is('html', 'application/*'); // => 'application/json' + * + * this.is('html'); // => false + * + * @param {String|Array} types... + * @return {String|false|null} + * @public + */ + +function typeofrequest (req, types_) { + var types = types_ + + // no body + if (!hasbody(req)) { + return null + } + + // support flattened arguments + if (arguments.length > 2) { + types = new Array(arguments.length - 1) + for (var i = 0; i < types.length; i++) { + types[i] = arguments[i + 1] + } + } + + // request content type + var value = req.headers['content-type'] + + return typeis(value, types) +} + +/** + * Normalize a mime type. + * If it's a shorthand, expand it to a valid mime type. + * + * In general, you probably want: + * + * var type = is(req, ['urlencoded', 'json', 'multipart']); + * + * Then use the appropriate body parsers. + * These three are the most common request body types + * and are thus ensured to work. + * + * @param {String} type + * @private + */ + +function normalize (type) { + if (typeof type !== 'string') { + // invalid type + return false + } + + switch (type) { + case 'urlencoded': + return 'application/x-www-form-urlencoded' + case 'multipart': + return 'multipart/*' + } + + if (type[0] === '+') { + // "+json" -> "*/*+json" expando + return '*/*' + type + } + + return type.indexOf('/') === -1 + ? mime.lookup(type) + : type +} + +/** + * Check if `expected` mime type + * matches `actual` mime type with + * wildcard and +suffix support. + * + * @param {String} expected + * @param {String} actual + * @return {Boolean} + * @private + */ + +function mimeMatch (expected, actual) { + // invalid type + if (expected === false) { + return false + } + + // split types + var actualParts = actual.split('/') + var expectedParts = expected.split('/') + + // invalid format + if (actualParts.length !== 2 || expectedParts.length !== 2) { + return false + } + + // validate type + if (expectedParts[0] !== '*' && expectedParts[0] !== actualParts[0]) { + return false + } + + // validate suffix wildcard + if (expectedParts[1].substr(0, 2) === '*+') { + return expectedParts[1].length <= actualParts[1].length + 1 && + expectedParts[1].substr(1) === actualParts[1].substr(1 - expectedParts[1].length) + } + + // validate subtype + if (expectedParts[1] !== '*' && expectedParts[1] !== actualParts[1]) { + return false + } + + return true +} + +/** + * Normalize a type and remove parameters. + * + * @param {string} value + * @return {string} + * @private + */ + +function normalizeType (value) { + // parse the type + var type = typer.parse(value) + + // remove the parameters + type.parameters = undefined + + // reformat it + return typer.format(type) +} + +/** + * Try to normalize a type and remove parameters. + * + * @param {string} value + * @return {string} + * @private + */ + +function tryNormalizeType (value) { + try { + return normalizeType(value) + } catch (err) { + return null + } +} diff --git a/node_modules/type-is/package.json b/node_modules/type-is/package.json new file mode 100644 index 0000000..6f555bf --- /dev/null +++ b/node_modules/type-is/package.json @@ -0,0 +1,85 @@ +{ + "_from": "type-is@~1.6.15", + "_id": "type-is@1.6.16", + "_inBundle": false, + "_integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "_location": "/type-is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "type-is@~1.6.15", + "name": "type-is", + "escapedName": "type-is", + "rawSpec": "~1.6.15", + "saveSpec": null, + "fetchSpec": "~1.6.15" + }, + "_requiredBy": [ + "/body-parser", + "/express" + ], + "_resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "_shasum": "f89ce341541c672b25ee7ae3c73dee3b2be50194", + "_spec": "type-is@~1.6.15", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/body-parser", + "bugs": { + "url": "https://github.com/jshttp/type-is/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com" + } + ], + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + }, + "deprecated": false, + "description": "Infer the content-type of a request.", + "devDependencies": { + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.8.0", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-node": "5.2.1", + "eslint-plugin-promise": "3.6.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "mocha": "1.21.5" + }, + "engines": { + "node": ">= 0.6" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "index.js" + ], + "homepage": "https://github.com/jshttp/type-is#readme", + "keywords": [ + "content", + "type", + "checking" + ], + "license": "MIT", + "name": "type-is", + "repository": { + "type": "git", + "url": "git+https://github.com/jshttp/type-is.git" + }, + "scripts": { + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + }, + "version": "1.6.16" +} diff --git a/node_modules/uglify-js/LICENSE b/node_modules/uglify-js/LICENSE new file mode 100644 index 0000000..dd7706f --- /dev/null +++ b/node_modules/uglify-js/LICENSE @@ -0,0 +1,29 @@ +UglifyJS is released under the BSD license: + +Copyright 2012-2013 (c) Mihai Bazon + +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. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 HOLDER 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. diff --git a/node_modules/uglify-js/README.md b/node_modules/uglify-js/README.md new file mode 100644 index 0000000..8c1d676 --- /dev/null +++ b/node_modules/uglify-js/README.md @@ -0,0 +1,995 @@ +UglifyJS 2 +========== +[![Build Status](https://travis-ci.org/mishoo/UglifyJS2.svg)](https://travis-ci.org/mishoo/UglifyJS2) + +UglifyJS is a JavaScript parser, minifier, compressor or beautifier toolkit. + +This page documents the command line utility. For +[API and internals documentation see my website](http://lisperator.net/uglifyjs/). +There's also an +[in-browser online demo](http://lisperator.net/uglifyjs/#demo) (for Firefox, +Chrome and probably Safari). + +#### Note: +- `uglify-js` only supports ECMAScript 5 (ES5). +- Support for `const` is [present but incomplete](#support-for-const), and may not be + transformed properly. +- Those wishing to minify ES2015+ (ES6+) should use the `npm` package [**uglify-es**](https://github.com/mishoo/UglifyJS2/tree/harmony). + +Install +------- + +First make sure you have installed the latest version of [node.js](http://nodejs.org/) +(You may need to restart your computer after this step). + +From NPM for use as a command line app: + + npm install uglify-js -g + +From NPM for programmatic use: + + npm install uglify-js + +Usage +----- + + uglifyjs [input files] [options] + +UglifyJS2 can take multiple input files. It's recommended that you pass the +input files first, then pass the options. UglifyJS will parse input files +in sequence and apply any compression options. The files are parsed in the +same global scope, that is, a reference from a file to some +variable/function declared in another file will be matched properly. + +If you want to read from STDIN instead, pass a single dash instead of input +files. + +If you wish to pass your options before the input files, separate the two with +a double dash to prevent input files being used as option arguments: + + uglifyjs --compress --mangle -- input.js + +The available options are: + +``` + --source-map Specify an output file where to generate source + map. + --source-map-root The path to the original source to be included + in the source map. + --source-map-url The path to the source map to be added in //# + sourceMappingURL. Defaults to the value passed + with --source-map. + --source-map-include-sources Pass this flag if you want to include the + content of source files in the source map as + sourcesContent property. + --source-map-inline Write base64-encoded source map to the end of js output. + --in-source-map Input source map, useful if you're compressing + JS that was generated from some other original + code. Specify "inline" if the source map is included + inline with the sources. + --screw-ie8 Use this flag if you don't wish to support + Internet Explorer 6/7/8. + By default UglifyJS will not try to be IE-proof. + --support-ie8 Use this flag to support Internet Explorer 6/7/8. + Equivalent to setting `screw_ie8: false` in `minify()` + for `compress`, `mangle` and `output` options. + --expr Parse a single expression, rather than a + program (for parsing JSON) + -p, --prefix Skip prefix for original filenames that appear + in source maps. For example -p 3 will drop 3 + directories from file names and ensure they are + relative paths. You can also specify -p + relative, which will make UglifyJS figure out + itself the relative paths between original + sources, the source map and the output file. + -o, --output Output file (default STDOUT). + -b, --beautify Beautify output/specify output options. + -m, --mangle Mangle names/pass mangler options. + -r, --reserved Reserved names to exclude from mangling. + -c, --compress Enable compressor/pass compressor options, e.g. + `-c 'if_return=false,pure_funcs=["Math.pow","console.log"]'` + Use `-c` with no argument to enable default compression + options. + -d, --define Global definitions + -e, --enclose Embed everything in a big function, with a + configurable parameter/argument list. + --comments Preserve copyright comments in the output. By + default this works like Google Closure, keeping + JSDoc-style comments that contain "@license" or + "@preserve". You can optionally pass one of the + following arguments to this flag: + - "all" to keep all comments + - a valid JS RegExp like `/foo/` or `/^!/` to + keep only matching comments. + Note that currently not *all* comments can be + kept when compression is on, because of dead + code removal or cascading statements into + sequences. + --preamble Preamble to prepend to the output. You can use + this to insert a comment, for example for + licensing information. This will not be + parsed, but the source map will adjust for its + presence. + --stats Display operations run time on STDERR. + --acorn Use Acorn for parsing. + --spidermonkey Assume input files are SpiderMonkey AST format + (as JSON). + --self Build itself (UglifyJS2) as a library (implies + --wrap=UglifyJS --export-all) + --wrap Embed everything in a big function, making the + “exports” and “global” variables available. You + need to pass an argument to this option to + specify the name that your module will take + when included in, say, a browser. + --export-all Only used when --wrap, this tells UglifyJS to + add code to automatically export all globals. + --lint Display some scope warnings + -v, --verbose Verbose + -V, --version Print version number and exit. + --noerr Don't throw an error for unknown options in -c, + -b or -m. + --bare-returns Allow return outside of functions. Useful when + minifying CommonJS modules and Userscripts that + may be anonymous function wrapped (IIFE) by the + .user.js engine `caller`. + --keep-fnames Do not mangle/drop function names. Useful for + code relying on Function.prototype.name. + --reserved-file File containing reserved names + --reserve-domprops Make (most?) DOM properties reserved for + --mangle-props + --mangle-props Mangle property names (default `0`). Set to + `true` or `1` to mangle all property names. Set + to `unquoted` or `2` to only mangle unquoted + property names. Mode `2` also enables the + `keep_quoted_props` beautifier option to + preserve the quotes around property names and + disables the `properties` compressor option to + prevent rewriting quoted properties with dot + notation. You can override these by setting + them explicitly on the command line. + --mangle-regex Only mangle property names matching the regex + --name-cache File to hold mangled names mappings + --pure-funcs Functions that can be safely removed if their + return value is not used, e.g. + `--pure-funcs Math.floor console.info` + (requires `--compress`) +``` + +Specify `--output` (`-o`) to declare the output file. Otherwise the output +goes to STDOUT. + +## Source map options + +UglifyJS2 can generate a source map file, which is highly useful for +debugging your compressed JavaScript. To get a source map, pass +`--source-map output.js.map` (full path to the file where you want the +source map dumped). + +Additionally you might need `--source-map-root` to pass the URL where the +original files can be found. In case you are passing full paths to input +files to UglifyJS, you can use `--prefix` (`-p`) to specify the number of +directories to drop from the path prefix when declaring files in the source +map. + +For example: + + uglifyjs /home/doe/work/foo/src/js/file1.js \ + /home/doe/work/foo/src/js/file2.js \ + -o foo.min.js \ + --source-map foo.min.js.map \ + --source-map-root http://foo.com/src \ + -p 5 -c -m + +The above will compress and mangle `file1.js` and `file2.js`, will drop the +output in `foo.min.js` and the source map in `foo.min.js.map`. The source +mapping will refer to `http://foo.com/src/js/file1.js` and +`http://foo.com/src/js/file2.js` (in fact it will list `http://foo.com/src` +as the source map root, and the original files as `js/file1.js` and +`js/file2.js`). + +### Composed source map + +When you're compressing JS code that was output by a compiler such as +CoffeeScript, mapping to the JS code won't be too helpful. Instead, you'd +like to map back to the original code (i.e. CoffeeScript). UglifyJS has an +option to take an input source map. Assuming you have a mapping from +CoffeeScript → compiled JS, UglifyJS can generate a map from CoffeeScript → +compressed JS by mapping every token in the compiled JS to its original +location. + +To use this feature you need to pass `--in-source-map +/path/to/input/source.map` or `--in-source-map inline` if the source map is +included inline with the sources. Normally the input source map should also +point to the file containing the generated JS, so if that's correct you can +omit input files from the command line. + +## Mangler options + +To enable the mangler you need to pass `--mangle` (`-m`). The following +(comma-separated) options are supported: + +- `toplevel` — mangle names declared in the toplevel scope (disabled by + default). + +- `eval` — mangle names visible in scopes where `eval` or `with` are used + (disabled by default). + +When mangling is enabled but you want to prevent certain names from being +mangled, you can declare those names with `--reserved` (`-r`) — pass a +comma-separated list of names. For example: + + uglifyjs ... -m -r '$,require,exports' + +to prevent the `require`, `exports` and `$` names from being changed. + +### Mangling property names (`--mangle-props`) + +**Note:** this will probably break your code. Mangling property names is a +separate step, different from variable name mangling. Pass +`--mangle-props`. It will mangle all properties that are seen in some +object literal, or that are assigned to. For example: + +```js +var x = { + foo: 1 +}; + +x.bar = 2; +x["baz"] = 3; +x[condition ? "moo" : "boo"] = 4; +console.log(x.something()); +``` + +In the above code, `foo`, `bar`, `baz`, `moo` and `boo` will be replaced +with single characters, while `something()` will be left as is. + +In order for this to be of any use, we should avoid mangling standard JS +names. For instance, if your code would contain `x.length = 10`, then +`length` becomes a candidate for mangling and it will be mangled throughout +the code, regardless if it's being used as part of your own objects or +accessing an array's length. To avoid that, you can use `--reserved-file` +to pass a filename that should contain the names to be excluded from +mangling. This file can be used both for excluding variable names and +property names. It could look like this, for example: + +```js +{ + "vars": [ "define", "require", ... ], + "props": [ "length", "prototype", ... ] +} +``` + +`--reserved-file` can be an array of file names (either a single +comma-separated argument, or you can pass multiple `--reserved-file` +arguments) — in this case it will exclude names from all those files. + +A default exclusion file is provided in `tools/domprops.json` which should +cover most standard JS and DOM properties defined in various browsers. Pass +`--reserve-domprops` to read that in. + +You can also use a regular expression to define which property names should be +mangled. For example, `--mangle-regex="/^_/"` will only mangle property names +that start with an underscore. + +When you compress multiple files using this option, in order for them to +work together in the end we need to ensure somehow that one property gets +mangled to the same name in all of them. For this, pass `--name-cache +filename.json` and UglifyJS will maintain these mappings in a file which can +then be reused. It should be initially empty. Example: + +``` +rm -f /tmp/cache.json # start fresh +uglifyjs file1.js file2.js --mangle-props --name-cache /tmp/cache.json -o part1.js +uglifyjs file3.js file4.js --mangle-props --name-cache /tmp/cache.json -o part2.js +``` + +Now, `part1.js` and `part2.js` will be consistent with each other in terms +of mangled property names. + +Using the name cache is not necessary if you compress all your files in a +single call to UglifyJS. + +#### Mangling unquoted names (`--mangle-props=unquoted` or `--mangle-props=2`) + +Using quoted property name (`o["foo"]`) reserves the property name (`foo`) +so that it is not mangled throughout the entire script even when used in an +unquoted style (`o.foo`). Example: + +``` +$ echo 'var o={"foo":1, bar:3}; o.foo += o.bar; console.log(o.foo);' | uglifyjs --mangle-props=2 -mc +var o={"foo":1,a:3};o.foo+=o.a,console.log(o.foo); +``` + +#### Debugging property name mangling + +You can also pass `--mangle-props-debug` in order to mangle property names +without completely obscuring them. For example the property `o.foo` +would mangle to `o._$foo$_` with this option. This allows property mangling +of a large codebase while still being able to debug the code and identify +where mangling is breaking things. + +You can also pass a custom suffix using `--mangle-props-debug=XYZ`. This would then +mangle `o.foo` to `o._$foo$XYZ_`. You can change this each time you compile a +script to identify how a property got mangled. One technique is to pass a +random number on every compile to simulate mangling changing with different +inputs (e.g. as you update the input script with new properties), and to help +identify mistakes like writing mangled keys to storage. + +## Compressor options + +You need to pass `--compress` (`-c`) to enable the compressor. Optionally +you can pass a comma-separated list of options. Options are in the form +`foo=bar`, or just `foo` (the latter implies a boolean option that you want +to set `true`; it's effectively a shortcut for `foo=true`). + +- `sequences` (default: true) -- join consecutive simple statements using the + comma operator. May be set to a positive integer to specify the maximum number + of consecutive comma sequences that will be generated. If this option is set to + `true` then the default `sequences` limit is `200`. Set option to `false` or `0` + to disable. The smallest `sequences` length is `2`. A `sequences` value of `1` + is grandfathered to be equivalent to `true` and as such means `200`. On rare + occasions the default sequences limit leads to very slow compress times in which + case a value of `20` or less is recommended. + +- `properties` -- rewrite property access using the dot notation, for + example `foo["bar"] → foo.bar` + +- `dead_code` -- remove unreachable code + +- `drop_debugger` -- remove `debugger;` statements + +- `unsafe` (default: false) -- apply "unsafe" transformations (discussion below) + +- `unsafe_comps` (default: false) -- Reverse `<` and `<=` to `>` and `>=` to + allow improved compression. This might be unsafe when an at least one of two + operands is an object with computed values due the use of methods like `get`, + or `valueOf`. This could cause change in execution order after operands in the + comparison are switching. Compression only works if both `comparisons` and + `unsafe_comps` are both set to true. + +- `unsafe_math` (default: false) -- optimize numerical expressions like + `2 * x * 3` into `6 * x`, which may give imprecise floating point results. + +- `unsafe_proto` (default: false) -- optimize expressions like + `Array.prototype.slice.call(a)` into `[].slice.call(a)` + +- `unsafe_regexp` (default: false) -- enable substitutions of variables with + `RegExp` values the same way as if they are constants. + +- `conditionals` -- apply optimizations for `if`-s and conditional + expressions + +- `comparisons` -- apply certain optimizations to binary nodes, for example: + `!(a <= b) → a > b` (only when `unsafe_comps`), attempts to negate binary + nodes, e.g. `a = !b && !c && !d && !e → a=!(b||c||d||e)` etc. + +- `evaluate` -- attempt to evaluate constant expressions + +- `booleans` -- various optimizations for boolean context, for example `!!a + ? b : c → a ? b : c` + +- `loops` -- optimizations for `do`, `while` and `for` loops when we can + statically determine the condition + +- `unused` -- drop unreferenced functions and variables (simple direct variable + assignments do not count as references unless set to `"keep_assign"`) + +- `toplevel` -- drop unreferenced functions (`"funcs"`) and/or variables (`"vars"`) + in the toplevel scope (`false` by default, `true` to drop both unreferenced + functions and variables) + +- `top_retain` -- prevent specific toplevel functions and variables from `unused` + removal (can be array, comma-separated, RegExp or function. Implies `toplevel`) + +- `hoist_funs` -- hoist function declarations + +- `hoist_vars` (default: false) -- hoist `var` declarations (this is `false` + by default because it seems to increase the size of the output in general) + +- `if_return` -- optimizations for if/return and if/continue + +- `join_vars` -- join consecutive `var` statements + +- `cascade` -- small optimization for sequences, transform `x, x` into `x` + and `x = something(), x` into `x = something()` + +- `collapse_vars` -- Collapse single-use `var` and `const` definitions + when possible. + +- `reduce_vars` -- Improve optimization on variables assigned with and + used as constant values. + +- `warnings` -- display warnings when dropping unreachable code or unused + declarations etc. + +- `negate_iife` -- negate "Immediately-Called Function Expressions" + where the return value is discarded, to avoid the parens that the + code generator would insert. + +- `pure_getters` -- the default is `false`. If you pass `true` for + this, UglifyJS will assume that object property access + (e.g. `foo.bar` or `foo["bar"]`) doesn't have any side effects. + Specify `"strict"` to treat `foo.bar` as side-effect-free only when + `foo` is certain to not throw, i.e. not `null` or `undefined`. + +- `pure_funcs` -- default `null`. You can pass an array of names and + UglifyJS will assume that those functions do not produce side + effects. DANGER: will not check if the name is redefined in scope. + An example case here, for instance `var q = Math.floor(a/b)`. If + variable `q` is not used elsewhere, UglifyJS will drop it, but will + still keep the `Math.floor(a/b)`, not knowing what it does. You can + pass `pure_funcs: [ 'Math.floor' ]` to let it know that this + function won't produce any side effect, in which case the whole + statement would get discarded. The current implementation adds some + overhead (compression will be slower). + +- `drop_console` -- default `false`. Pass `true` to discard calls to + `console.*` functions. If you wish to drop a specific function call + such as `console.info` and/or retain side effects from function arguments + after dropping the function call then use `pure_funcs` instead. + +- `expression` -- default `false`. Pass `true` to preserve completion values + from terminal statements without `return`, e.g. in bookmarklets. + +- `keep_fargs` -- default `true`. Prevents the + compressor from discarding unused function arguments. You need this + for code which relies on `Function.length`. + +- `keep_fnames` -- default `false`. Pass `true` to prevent the + compressor from discarding function names. Useful for code relying on + `Function.prototype.name`. See also: the `keep_fnames` [mangle option](#mangle). + +- `passes` -- default `1`. Number of times to run compress with a maximum of 3. + In some cases more than one pass leads to further compressed code. Keep in + mind more passes will take more time. + +- `keep_infinity` -- default `false`. Pass `true` to prevent `Infinity` from + being compressed into `1/0`, which may cause performance issues on Chrome. + +- `side_effects` -- default `true`. Pass `false` to disable potentially dropping + functions marked as "pure". A function call is marked as "pure" if a comment + annotation `/*@__PURE__*/` or `/*#__PURE__*/` immediately precedes the call. For + example: `/*@__PURE__*/foo();` + + +### The `unsafe` option + +It enables some transformations that *might* break code logic in certain +contrived cases, but should be fine for most code. You might want to try it +on your own code, it should reduce the minified size. Here's what happens +when this flag is on: + +- `new Array(1, 2, 3)` or `Array(1, 2, 3)` → `[ 1, 2, 3 ]` +- `new Object()` → `{}` +- `String(exp)` or `exp.toString()` → `"" + exp` +- `new Object/RegExp/Function/Error/Array (...)` → we discard the `new` +- `typeof foo == "undefined"` → `foo === void 0` +- `void 0` → `undefined` (if there is a variable named "undefined" in + scope; we do it because the variable name will be mangled, typically + reduced to a single character) + +### Conditional compilation + +You can use the `--define` (`-d`) switch in order to declare global +variables that UglifyJS will assume to be constants (unless defined in +scope). For example if you pass `--define DEBUG=false` then, coupled with +dead code removal UglifyJS will discard the following from the output: +```javascript +if (DEBUG) { + console.log("debug stuff"); +} +``` + +You can specify nested constants in the form of `--define env.DEBUG=false`. + +UglifyJS will warn about the condition being always false and about dropping +unreachable code; for now there is no option to turn off only this specific +warning, you can pass `warnings=false` to turn off *all* warnings. + +Another way of doing that is to declare your globals as constants in a +separate file and include it into the build. For example you can have a +`build/defines.js` file with the following: +```javascript +const DEBUG = false; +const PRODUCTION = true; +// etc. +``` + +and build your code like this: + + uglifyjs build/defines.js js/foo.js js/bar.js... -c + +UglifyJS will notice the constants and, since they cannot be altered, it +will evaluate references to them to the value itself and drop unreachable +code as usual. The build will contain the `const` declarations if you use +them. If you are targeting < ES6 environments which does not support `const`, +using `var` with `reduce_vars` (enabled by default) should suffice. + + + +#### Conditional compilation, API +You can also use conditional compilation via the programmatic API. With the difference that the +property name is `global_defs` and is a compressor property: + +```js +uglifyJS.minify([ "input.js"], { + compress: { + dead_code: true, + global_defs: { + DEBUG: false + } + } +}); +``` + +## Beautifier options + +The code generator tries to output shortest code possible by default. In +case you want beautified output, pass `--beautify` (`-b`). Optionally you +can pass additional arguments that control the code output: + +- `beautify` (default `true`) -- whether to actually beautify the output. + Passing `-b` will set this to true, but you might need to pass `-b` even + when you want to generate minified code, in order to specify additional + arguments, so you can use `-b beautify=false` to override it. +- `indent-level` (default 4) +- `indent-start` (default 0) -- prefix all lines by that many spaces +- `quote-keys` (default `false`) -- pass `true` to quote all keys in literal + objects +- `space-colon` (default `true`) -- insert a space after the colon signs +- `ascii-only` (default `false`) -- escape Unicode characters in strings and + regexps (affects directives with non-ascii characters becoming invalid) +- `inline-script` (default `false`) -- escape the slash in occurrences of + ` 0) { + print_error("WARN: Ignoring input files since --self was passed"); + } + files = UglifyJS.FILES; + if (!ARGS.wrap) ARGS.wrap = "UglifyJS"; +} + +var ORIG_MAP = ARGS.in_source_map; + +if (ORIG_MAP && ORIG_MAP != "inline") { + ORIG_MAP = JSON.parse(fs.readFileSync(ORIG_MAP)); + if (files.length == 0) { + print_error("INFO: Using file from the input source map: " + ORIG_MAP.file); + files = [ ORIG_MAP.file ]; + } +} + +if (files.length == 0) { + files = [ "-" ]; +} + +if (ORIG_MAP == "inline") { + if (files.length > 1) { + print_error("ERROR: Inline source map only works with singular input"); + process.exit(1); + } + if (ARGS.acorn || ARGS.spidermonkey) { + print_error("ERROR: Inline source map only works with built-in parser"); + process.exit(1); + } +} + +if (files.indexOf("-") >= 0 && ARGS.source_map) { + print_error("ERROR: Source map doesn't work with input from STDIN"); + process.exit(1); +} + +if (files.filter(function(el){ return el == "-" }).length > 1) { + print_error("ERROR: Can read a single file from STDIN (two or more dashes specified)"); + process.exit(1); +} + +var STATS = {}; +var TOPLEVEL = null; +var P_RELATIVE = ARGS.p && ARGS.p == "relative"; +var SOURCES_CONTENT = {}; +var index = 0; + +!function cb() { + if (index == files.length) return done(); + var file = files[index++]; + read_whole_file(file, function (err, code) { + if (err) { + print_error("ERROR: can't read file: " + file); + process.exit(1); + } + if (ORIG_MAP == "inline") { + ORIG_MAP = read_source_map(code); + } + if (ARGS.p != null) { + if (P_RELATIVE) { + file = path.relative(path.dirname(ARGS.source_map), file).replace(/\\/g, '/'); + } else { + var p = parseInt(ARGS.p, 10); + if (!isNaN(p)) { + file = file.replace(/^\/+/, "").split(/\/+/).slice(ARGS.p).join("/"); + } + } + } + SOURCES_CONTENT[file] = code; + time_it("parse", function(){ + if (ARGS.spidermonkey) { + var program = JSON.parse(code); + if (!TOPLEVEL) TOPLEVEL = program; + else TOPLEVEL.body = TOPLEVEL.body.concat(program.body); + } + else if (ARGS.acorn) { + TOPLEVEL = acorn.parse(code, { + locations : true, + sourceFile : file, + program : TOPLEVEL + }); + } + else { + try { + TOPLEVEL = UglifyJS.parse(code, { + filename : file, + toplevel : TOPLEVEL, + expression : ARGS.expr, + bare_returns : ARGS.bare_returns, + }); + } catch(ex) { + if (ex instanceof UglifyJS.JS_Parse_Error) { + print_error("Parse error at " + file + ":" + ex.line + "," + ex.col); + var col = ex.col; + var lines = code.split(/\r?\n/); + var line = lines[ex.line - 1]; + if (!line && !col) { + line = lines[ex.line - 2]; + col = line.length; + } + if (line) { + if (col > 40) { + line = line.slice(col - 40); + col = 40; + } + print_error(line.slice(0, 80)); + print_error(line.slice(0, col).replace(/\S/g, " ") + "^"); + } + print_error(ex.stack); + process.exit(1); + } + throw ex; + } + }; + }); + cb(); + }); +}(); + +function done() { + var OUTPUT_FILE = ARGS.o; + + var SOURCE_MAP = (ARGS.source_map || ARGS.source_map_inline) ? UglifyJS.SourceMap({ + file: P_RELATIVE ? path.relative(path.dirname(ARGS.source_map), OUTPUT_FILE) : OUTPUT_FILE, + root: ARGS.source_map_root || ORIG_MAP && ORIG_MAP.sourceRoot, + orig: ORIG_MAP, + }) : null; + + OUTPUT_OPTIONS.source_map = SOURCE_MAP; + + try { + var output = UglifyJS.OutputStream(OUTPUT_OPTIONS); + var compressor = COMPRESS && UglifyJS.Compressor(COMPRESS); + } catch(ex) { + if (ex instanceof UglifyJS.DefaultsError) { + print_error(ex.message); + print_error("Supported options:"); + print_error(sys.inspect(ex.defs)); + process.exit(1); + } + } + + if (ARGS.acorn || ARGS.spidermonkey) time_it("convert_ast", function(){ + TOPLEVEL = UglifyJS.AST_Node.from_mozilla_ast(TOPLEVEL); + }); + + if (ARGS.wrap != null) { + TOPLEVEL = TOPLEVEL.wrap_commonjs(ARGS.wrap, ARGS.export_all); + } + + if (ARGS.enclose != null) { + var arg_parameter_list = ARGS.enclose; + if (arg_parameter_list === true) { + arg_parameter_list = []; + } + else if (!(arg_parameter_list instanceof Array)) { + arg_parameter_list = [arg_parameter_list]; + } + TOPLEVEL = TOPLEVEL.wrap_enclose(arg_parameter_list); + } + + if (ARGS.mangle_props || ARGS.name_cache) (function(){ + var reserved = RESERVED ? RESERVED.props : null; + var cache = readNameCache("props"); + var regex; + + try { + regex = ARGS.mangle_regex ? extractRegex(ARGS.mangle_regex) : null; + } catch (e) { + print_error("ERROR: Invalid --mangle-regex: " + e.message); + process.exit(1); + } + + TOPLEVEL = UglifyJS.mangle_properties(TOPLEVEL, { + reserved : reserved, + cache : cache, + only_cache : !ARGS.mangle_props, + regex : regex, + ignore_quoted : ARGS.mangle_props == 2, + debug : typeof ARGS.mangle_props_debug === "undefined" ? false : ARGS.mangle_props_debug + }); + writeNameCache("props", cache); + })(); + + var SCOPE_IS_NEEDED = COMPRESS || MANGLE || ARGS.lint + var TL_CACHE = readNameCache("vars"); + if (MANGLE) MANGLE.cache = TL_CACHE; + + if (SCOPE_IS_NEEDED) { + time_it("scope", function(){ + TOPLEVEL.figure_out_scope(MANGLE || { screw_ie8: screw_ie8, cache: TL_CACHE }); + if (ARGS.lint) { + TOPLEVEL.scope_warnings(); + } + }); + } + + if (COMPRESS) { + time_it("squeeze", function(){ + TOPLEVEL = compressor.compress(TOPLEVEL); + }); + } + + if (SCOPE_IS_NEEDED) { + time_it("scope", function(){ + TOPLEVEL.figure_out_scope(MANGLE || { screw_ie8: screw_ie8, cache: TL_CACHE }); + if (MANGLE && !TL_CACHE) { + TOPLEVEL.compute_char_frequency(MANGLE); + } + }); + } + + if (MANGLE) time_it("mangle", function(){ + TOPLEVEL.mangle_names(MANGLE); + }); + + writeNameCache("vars", TL_CACHE); + + if (ARGS.source_map_include_sources) { + for (var file in SOURCES_CONTENT) { + if (SOURCES_CONTENT.hasOwnProperty(file)) { + SOURCE_MAP.get().setSourceContent(file, SOURCES_CONTENT[file]); + } + } + } + + if (ARGS.dump_spidermonkey_ast) { + print(JSON.stringify(TOPLEVEL.to_mozilla_ast(), null, 2)); + } else { + time_it("generate", function(){ + TOPLEVEL.print(output); + }); + + output = output.get(); + + if (SOURCE_MAP) { + if (ARGS.source_map_inline) { + var base64_string = new Buffer(SOURCE_MAP.toString()).toString('base64'); + output += "\n//# sourceMappingURL=data:application/json;charset=utf-8;base64," + base64_string; + } else { + fs.writeFileSync(ARGS.source_map, SOURCE_MAP, "utf8"); + var source_map_url = ARGS.source_map_url || ( + P_RELATIVE + ? path.relative(path.dirname(OUTPUT_FILE), ARGS.source_map) + : ARGS.source_map + ); + output += "\n//# sourceMappingURL=" + source_map_url; + } + } + + if (OUTPUT_FILE) { + fs.writeFileSync(OUTPUT_FILE, output, "utf8"); + } else { + print(output); + } + } + + if (ARGS.stats) { + print_error(UglifyJS.string_template("Timing information (compressed {count} files):", { + count: files.length + })); + for (var i in STATS) if (STATS.hasOwnProperty(i)) { + print_error(UglifyJS.string_template("- {name}: {time}s", { + name: i, + time: (STATS[i] / 1000).toFixed(3) + })); + } + } +} + +/* -----[ functions ]----- */ + +function normalize(o) { + for (var i in o) if (o.hasOwnProperty(i) && /-/.test(i)) { + o[i.replace(/-/g, "_")] = o[i]; + delete o[i]; + } +} + +function getOptions(flag, constants) { + var x = ARGS[flag]; + if (x == null || x === false) return null; + var ret = {}; + if (x !== "") { + if (Array.isArray(x)) x = x.map(function (v) { return "(" + v + ")"; }).join(", "); + + var ast; + try { + ast = UglifyJS.parse(x, { cli: true, expression: true }); + } catch(ex) { + if (ex instanceof UglifyJS.JS_Parse_Error) { + print_error("Error parsing arguments for flag `" + flag + "': " + x); + process.exit(1); + } + } + ast.walk(new UglifyJS.TreeWalker(function(node){ + if (node instanceof UglifyJS.AST_Seq) return; // descend + if (node instanceof UglifyJS.AST_Assign) { + var name = node.left.print_to_string().replace(/-/g, "_"); + var value = node.right; + if (constants) + value = new Function("return (" + value.print_to_string() + ")")(); + ret[name] = value; + return true; // no descend + } + if (node instanceof UglifyJS.AST_Symbol || node instanceof UglifyJS.AST_Binary) { + var name = node.print_to_string().replace(/-/g, "_"); + ret[name] = true; + return true; // no descend + } + print_error(node.TYPE) + print_error("Error parsing arguments for flag `" + flag + "': " + x); + process.exit(1); + })); + } + return ret; +} + +function read_whole_file(filename, cb) { + if (filename == "-") { + var chunks = []; + process.stdin.setEncoding('utf-8'); + process.stdin.on('data', function (chunk) { + chunks.push(chunk); + }).on('end', function () { + cb(null, chunks.join("")); + }); + process.openStdin(); + } else { + fs.readFile(filename, "utf-8", cb); + } +} + +function read_source_map(code) { + var match = /\n\/\/# sourceMappingURL=data:application\/json(;.*?)?;base64,(.*)/.exec(code); + if (!match) { + print_error("WARN: inline source map not found"); + return null; + } + return JSON.parse(new Buffer(match[2], "base64")); +} + +function time_it(name, cont) { + var t1 = new Date().getTime(); + var ret = cont(); + if (ARGS.stats) { + var spent = new Date().getTime() - t1; + if (STATS[name]) STATS[name] += spent; + else STATS[name] = spent; + } + return ret; +} + +function print_error(msg) { + console.error("%s", msg); +} + +function print(txt) { + console.log("%s", txt); +} diff --git a/node_modules/uglify-js/lib/ast.js b/node_modules/uglify-js/lib/ast.js new file mode 100644 index 0000000..028772f --- /dev/null +++ b/node_modules/uglify-js/lib/ast.js @@ -0,0 +1,1052 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS2 + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + 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. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 HOLDER 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. + + ***********************************************************************/ + +"use strict"; + +function DEFNODE(type, props, methods, base) { + if (arguments.length < 4) base = AST_Node; + if (!props) props = []; + else props = props.split(/\s+/); + var self_props = props; + if (base && base.PROPS) + props = props.concat(base.PROPS); + var code = "return function AST_" + type + "(props){ if (props) { "; + for (var i = props.length; --i >= 0;) { + code += "this." + props[i] + " = props." + props[i] + ";"; + } + var proto = base && new base; + if (proto && proto.initialize || (methods && methods.initialize)) + code += "this.initialize();"; + code += "}}"; + var ctor = new Function(code)(); + if (proto) { + ctor.prototype = proto; + ctor.BASE = base; + } + if (base) base.SUBCLASSES.push(ctor); + ctor.prototype.CTOR = ctor; + ctor.PROPS = props || null; + ctor.SELF_PROPS = self_props; + ctor.SUBCLASSES = []; + if (type) { + ctor.prototype.TYPE = ctor.TYPE = type; + } + if (methods) for (i in methods) if (HOP(methods, i)) { + if (/^\$/.test(i)) { + ctor[i.substr(1)] = methods[i]; + } else { + ctor.prototype[i] = methods[i]; + } + } + ctor.DEFMETHOD = function(name, method) { + this.prototype[name] = method; + }; + if (typeof exports !== "undefined") { + exports["AST_" + type] = ctor; + } + return ctor; +}; + +var AST_Token = DEFNODE("Token", "type value line col pos endline endcol endpos nlb comments_before file raw", { +}, null); + +var AST_Node = DEFNODE("Node", "start end", { + _clone: function(deep) { + if (deep) { + var self = this.clone(); + return self.transform(new TreeTransformer(function(node) { + if (node !== self) { + return node.clone(true); + } + })); + } + return new this.CTOR(this); + }, + clone: function(deep) { + return this._clone(deep); + }, + $documentation: "Base class of all AST nodes", + $propdoc: { + start: "[AST_Token] The first token of this node", + end: "[AST_Token] The last token of this node" + }, + _walk: function(visitor) { + return visitor._visit(this); + }, + walk: function(visitor) { + return this._walk(visitor); // not sure the indirection will be any help + } +}, null); + +AST_Node.warn_function = null; +AST_Node.warn = function(txt, props) { + if (AST_Node.warn_function) + AST_Node.warn_function(string_template(txt, props)); +}; + +/* -----[ statements ]----- */ + +var AST_Statement = DEFNODE("Statement", null, { + $documentation: "Base class of all statements", +}); + +var AST_Debugger = DEFNODE("Debugger", null, { + $documentation: "Represents a debugger statement", +}, AST_Statement); + +var AST_Directive = DEFNODE("Directive", "value scope quote", { + $documentation: "Represents a directive, like \"use strict\";", + $propdoc: { + value: "[string] The value of this directive as a plain string (it's not an AST_String!)", + scope: "[AST_Scope/S] The scope that this directive affects", + quote: "[string] the original quote character" + }, +}, AST_Statement); + +var AST_SimpleStatement = DEFNODE("SimpleStatement", "body", { + $documentation: "A statement consisting of an expression, i.e. a = 1 + 2", + $propdoc: { + body: "[AST_Node] an expression node (should not be instanceof AST_Statement)" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.body._walk(visitor); + }); + } +}, AST_Statement); + +function walk_body(node, visitor) { + var body = node.body; + if (body instanceof AST_Statement) { + body._walk(visitor); + } + else for (var i = 0, len = body.length; i < len; i++) { + body[i]._walk(visitor); + } +}; + +var AST_Block = DEFNODE("Block", "body", { + $documentation: "A body of statements (usually bracketed)", + $propdoc: { + body: "[AST_Statement*] an array of statements" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + walk_body(this, visitor); + }); + } +}, AST_Statement); + +var AST_BlockStatement = DEFNODE("BlockStatement", null, { + $documentation: "A block statement", +}, AST_Block); + +var AST_EmptyStatement = DEFNODE("EmptyStatement", null, { + $documentation: "The empty statement (empty block or simply a semicolon)", + _walk: function(visitor) { + return visitor._visit(this); + } +}, AST_Statement); + +var AST_StatementWithBody = DEFNODE("StatementWithBody", "body", { + $documentation: "Base class for all statements that contain one nested body: `For`, `ForIn`, `Do`, `While`, `With`", + $propdoc: { + body: "[AST_Statement] the body; this should always be present, even if it's an AST_EmptyStatement" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.body._walk(visitor); + }); + } +}, AST_Statement); + +var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", { + $documentation: "Statement with a label", + $propdoc: { + label: "[AST_Label] a label definition" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.label._walk(visitor); + this.body._walk(visitor); + }); + }, + clone: function(deep) { + var node = this._clone(deep); + if (deep) { + var label = node.label; + var def = this.label; + node.walk(new TreeWalker(function(node) { + if (node instanceof AST_LoopControl + && node.label && node.label.thedef === def) { + node.label.thedef = label; + label.references.push(node); + } + })); + } + return node; + } +}, AST_StatementWithBody); + +var AST_IterationStatement = DEFNODE("IterationStatement", null, { + $documentation: "Internal class. All loops inherit from it." +}, AST_StatementWithBody); + +var AST_DWLoop = DEFNODE("DWLoop", "condition", { + $documentation: "Base class for do/while statements", + $propdoc: { + condition: "[AST_Node] the loop condition. Should not be instanceof AST_Statement" + } +}, AST_IterationStatement); + +var AST_Do = DEFNODE("Do", null, { + $documentation: "A `do` statement", + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.body._walk(visitor); + this.condition._walk(visitor); + }); + } +}, AST_DWLoop); + +var AST_While = DEFNODE("While", null, { + $documentation: "A `while` statement", + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.condition._walk(visitor); + this.body._walk(visitor); + }); + } +}, AST_DWLoop); + +var AST_For = DEFNODE("For", "init condition step", { + $documentation: "A `for` statement", + $propdoc: { + init: "[AST_Node?] the `for` initialization code, or null if empty", + condition: "[AST_Node?] the `for` termination clause, or null if empty", + step: "[AST_Node?] the `for` update clause, or null if empty" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + if (this.init) this.init._walk(visitor); + if (this.condition) this.condition._walk(visitor); + if (this.step) this.step._walk(visitor); + this.body._walk(visitor); + }); + } +}, AST_IterationStatement); + +var AST_ForIn = DEFNODE("ForIn", "init name object", { + $documentation: "A `for ... in` statement", + $propdoc: { + init: "[AST_Node] the `for/in` initialization code", + name: "[AST_SymbolRef?] the loop variable, only if `init` is AST_Var", + object: "[AST_Node] the object that we're looping through" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.init._walk(visitor); + this.object._walk(visitor); + this.body._walk(visitor); + }); + } +}, AST_IterationStatement); + +var AST_With = DEFNODE("With", "expression", { + $documentation: "A `with` statement", + $propdoc: { + expression: "[AST_Node] the `with` expression" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.expression._walk(visitor); + this.body._walk(visitor); + }); + } +}, AST_StatementWithBody); + +/* -----[ scope and functions ]----- */ + +var AST_Scope = DEFNODE("Scope", "directives variables functions uses_with uses_eval parent_scope enclosed cname", { + $documentation: "Base class for all statements introducing a lexical scope", + $propdoc: { + directives: "[string*/S] an array of directives declared in this scope", + variables: "[Object/S] a map of name -> SymbolDef for all variables/functions defined in this scope", + functions: "[Object/S] like `variables`, but only lists function declarations", + uses_with: "[boolean/S] tells whether this scope uses the `with` statement", + uses_eval: "[boolean/S] tells whether this scope contains a direct call to the global `eval`", + parent_scope: "[AST_Scope?/S] link to the parent scope", + enclosed: "[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes", + cname: "[integer/S] current index for mangling variables (used internally by the mangler)", + }, +}, AST_Block); + +var AST_Toplevel = DEFNODE("Toplevel", "globals", { + $documentation: "The toplevel scope", + $propdoc: { + globals: "[Object/S] a map of name -> SymbolDef for all undeclared names", + }, + wrap_enclose: function(arg_parameter_pairs) { + var self = this; + var args = []; + var parameters = []; + + arg_parameter_pairs.forEach(function(pair) { + var splitAt = pair.lastIndexOf(":"); + + args.push(pair.substr(0, splitAt)); + parameters.push(pair.substr(splitAt + 1)); + }); + + var wrapped_tl = "(function(" + parameters.join(",") + "){ '$ORIG'; })(" + args.join(",") + ")"; + wrapped_tl = parse(wrapped_tl); + wrapped_tl = wrapped_tl.transform(new TreeTransformer(function before(node){ + if (node instanceof AST_Directive && node.value == "$ORIG") { + return MAP.splice(self.body); + } + })); + return wrapped_tl; + }, + wrap_commonjs: function(name, export_all) { + var self = this; + var to_export = []; + if (export_all) { + self.figure_out_scope(); + self.walk(new TreeWalker(function(node){ + if (node instanceof AST_SymbolDeclaration && node.definition().global) { + if (!find_if(function(n){ return n.name == node.name }, to_export)) + to_export.push(node); + } + })); + } + var wrapped_tl = "(function(exports, global){ '$ORIG'; '$EXPORTS'; global['" + name + "'] = exports; }({}, (function(){return this}())))"; + wrapped_tl = parse(wrapped_tl); + wrapped_tl = wrapped_tl.transform(new TreeTransformer(function before(node){ + if (node instanceof AST_Directive) { + switch (node.value) { + case "$ORIG": + return MAP.splice(self.body); + case "$EXPORTS": + var body = []; + to_export.forEach(function(sym){ + body.push(new AST_SimpleStatement({ + body: new AST_Assign({ + left: new AST_Sub({ + expression: new AST_SymbolRef({ name: "exports" }), + property: new AST_String({ value: sym.name }), + }), + operator: "=", + right: new AST_SymbolRef(sym), + }), + })); + }); + return MAP.splice(body); + } + } + })); + return wrapped_tl; + } +}, AST_Scope); + +var AST_Lambda = DEFNODE("Lambda", "name argnames uses_arguments", { + $documentation: "Base class for functions", + $propdoc: { + name: "[AST_SymbolDeclaration?] the name of this function", + argnames: "[AST_SymbolFunarg*] array of function arguments", + uses_arguments: "[boolean/S] tells whether this function accesses the arguments array" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + if (this.name) this.name._walk(visitor); + var argnames = this.argnames; + for (var i = 0, len = argnames.length; i < len; i++) { + argnames[i]._walk(visitor); + } + walk_body(this, visitor); + }); + } +}, AST_Scope); + +var AST_Accessor = DEFNODE("Accessor", null, { + $documentation: "A setter/getter function. The `name` property is always null." +}, AST_Lambda); + +var AST_Function = DEFNODE("Function", null, { + $documentation: "A function expression" +}, AST_Lambda); + +var AST_Defun = DEFNODE("Defun", null, { + $documentation: "A function definition" +}, AST_Lambda); + +/* -----[ JUMPS ]----- */ + +var AST_Jump = DEFNODE("Jump", null, { + $documentation: "Base class for “jumps” (for now that's `return`, `throw`, `break` and `continue`)" +}, AST_Statement); + +var AST_Exit = DEFNODE("Exit", "value", { + $documentation: "Base class for “exits” (`return` and `throw`)", + $propdoc: { + value: "[AST_Node?] the value returned or thrown by this statement; could be null for AST_Return" + }, + _walk: function(visitor) { + return visitor._visit(this, this.value && function(){ + this.value._walk(visitor); + }); + } +}, AST_Jump); + +var AST_Return = DEFNODE("Return", null, { + $documentation: "A `return` statement" +}, AST_Exit); + +var AST_Throw = DEFNODE("Throw", null, { + $documentation: "A `throw` statement" +}, AST_Exit); + +var AST_LoopControl = DEFNODE("LoopControl", "label", { + $documentation: "Base class for loop control statements (`break` and `continue`)", + $propdoc: { + label: "[AST_LabelRef?] the label, or null if none", + }, + _walk: function(visitor) { + return visitor._visit(this, this.label && function(){ + this.label._walk(visitor); + }); + } +}, AST_Jump); + +var AST_Break = DEFNODE("Break", null, { + $documentation: "A `break` statement" +}, AST_LoopControl); + +var AST_Continue = DEFNODE("Continue", null, { + $documentation: "A `continue` statement" +}, AST_LoopControl); + +/* -----[ IF ]----- */ + +var AST_If = DEFNODE("If", "condition alternative", { + $documentation: "A `if` statement", + $propdoc: { + condition: "[AST_Node] the `if` condition", + alternative: "[AST_Statement?] the `else` part, or null if not present" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.condition._walk(visitor); + this.body._walk(visitor); + if (this.alternative) this.alternative._walk(visitor); + }); + } +}, AST_StatementWithBody); + +/* -----[ SWITCH ]----- */ + +var AST_Switch = DEFNODE("Switch", "expression", { + $documentation: "A `switch` statement", + $propdoc: { + expression: "[AST_Node] the `switch` “discriminant”" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.expression._walk(visitor); + walk_body(this, visitor); + }); + } +}, AST_Block); + +var AST_SwitchBranch = DEFNODE("SwitchBranch", null, { + $documentation: "Base class for `switch` branches", +}, AST_Block); + +var AST_Default = DEFNODE("Default", null, { + $documentation: "A `default` switch branch", +}, AST_SwitchBranch); + +var AST_Case = DEFNODE("Case", "expression", { + $documentation: "A `case` switch branch", + $propdoc: { + expression: "[AST_Node] the `case` expression" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.expression._walk(visitor); + walk_body(this, visitor); + }); + } +}, AST_SwitchBranch); + +/* -----[ EXCEPTIONS ]----- */ + +var AST_Try = DEFNODE("Try", "bcatch bfinally", { + $documentation: "A `try` statement", + $propdoc: { + bcatch: "[AST_Catch?] the catch block, or null if not present", + bfinally: "[AST_Finally?] the finally block, or null if not present" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + walk_body(this, visitor); + if (this.bcatch) this.bcatch._walk(visitor); + if (this.bfinally) this.bfinally._walk(visitor); + }); + } +}, AST_Block); + +var AST_Catch = DEFNODE("Catch", "argname", { + $documentation: "A `catch` node; only makes sense as part of a `try` statement", + $propdoc: { + argname: "[AST_SymbolCatch] symbol for the exception" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.argname._walk(visitor); + walk_body(this, visitor); + }); + } +}, AST_Block); + +var AST_Finally = DEFNODE("Finally", null, { + $documentation: "A `finally` node; only makes sense as part of a `try` statement" +}, AST_Block); + +/* -----[ VAR/CONST ]----- */ + +var AST_Definitions = DEFNODE("Definitions", "definitions", { + $documentation: "Base class for `var` or `const` nodes (variable declarations/initializations)", + $propdoc: { + definitions: "[AST_VarDef*] array of variable definitions" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + var definitions = this.definitions; + for (var i = 0, len = definitions.length; i < len; i++) { + definitions[i]._walk(visitor); + } + }); + } +}, AST_Statement); + +var AST_Var = DEFNODE("Var", null, { + $documentation: "A `var` statement" +}, AST_Definitions); + +var AST_Const = DEFNODE("Const", null, { + $documentation: "A `const` statement" +}, AST_Definitions); + +var AST_VarDef = DEFNODE("VarDef", "name value", { + $documentation: "A variable declaration; only appears in a AST_Definitions node", + $propdoc: { + name: "[AST_SymbolVar|AST_SymbolConst] name of the variable", + value: "[AST_Node?] initializer, or null of there's no initializer" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.name._walk(visitor); + if (this.value) this.value._walk(visitor); + }); + } +}); + +/* -----[ OTHER ]----- */ + +var AST_Call = DEFNODE("Call", "expression args", { + $documentation: "A function call expression", + $propdoc: { + expression: "[AST_Node] expression to invoke as function", + args: "[AST_Node*] array of arguments" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.expression._walk(visitor); + var args = this.args; + for (var i = 0, len = args.length; i < len; i++) { + args[i]._walk(visitor); + } + }); + } +}); + +var AST_New = DEFNODE("New", null, { + $documentation: "An object instantiation. Derives from a function call since it has exactly the same properties" +}, AST_Call); + +var AST_Seq = DEFNODE("Seq", "car cdr", { + $documentation: "A sequence expression (two comma-separated expressions)", + $propdoc: { + car: "[AST_Node] first element in sequence", + cdr: "[AST_Node] second element in sequence" + }, + $cons: function(x, y) { + var seq = new AST_Seq(x); + seq.car = x; + seq.cdr = y; + return seq; + }, + $from_array: function(array) { + if (array.length == 0) return null; + if (array.length == 1) return array[0].clone(); + var list = null; + for (var i = array.length; --i >= 0;) { + list = AST_Seq.cons(array[i], list); + } + var p = list; + while (p) { + if (p.cdr && !p.cdr.cdr) { + p.cdr = p.cdr.car; + break; + } + p = p.cdr; + } + return list; + }, + to_array: function() { + var p = this, a = []; + while (p) { + a.push(p.car); + if (p.cdr && !(p.cdr instanceof AST_Seq)) { + a.push(p.cdr); + break; + } + p = p.cdr; + } + return a; + }, + add: function(node) { + var p = this; + while (p) { + if (!(p.cdr instanceof AST_Seq)) { + var cell = AST_Seq.cons(p.cdr, node); + return p.cdr = cell; + } + p = p.cdr; + } + }, + len: function() { + if (this.cdr instanceof AST_Seq) { + return this.cdr.len() + 1; + } else { + return 2; + } + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.car._walk(visitor); + if (this.cdr) this.cdr._walk(visitor); + }); + } +}); + +var AST_PropAccess = DEFNODE("PropAccess", "expression property", { + $documentation: "Base class for property access expressions, i.e. `a.foo` or `a[\"foo\"]`", + $propdoc: { + expression: "[AST_Node] the “container” expression", + property: "[AST_Node|string] the property to access. For AST_Dot this is always a plain string, while for AST_Sub it's an arbitrary AST_Node" + } +}); + +var AST_Dot = DEFNODE("Dot", null, { + $documentation: "A dotted property access expression", + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.expression._walk(visitor); + }); + } +}, AST_PropAccess); + +var AST_Sub = DEFNODE("Sub", null, { + $documentation: "Index-style property access, i.e. `a[\"foo\"]`", + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.expression._walk(visitor); + this.property._walk(visitor); + }); + } +}, AST_PropAccess); + +var AST_Unary = DEFNODE("Unary", "operator expression", { + $documentation: "Base class for unary expressions", + $propdoc: { + operator: "[string] the operator", + expression: "[AST_Node] expression that this unary operator applies to" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.expression._walk(visitor); + }); + } +}); + +var AST_UnaryPrefix = DEFNODE("UnaryPrefix", null, { + $documentation: "Unary prefix expression, i.e. `typeof i` or `++i`" +}, AST_Unary); + +var AST_UnaryPostfix = DEFNODE("UnaryPostfix", null, { + $documentation: "Unary postfix expression, i.e. `i++`" +}, AST_Unary); + +var AST_Binary = DEFNODE("Binary", "left operator right", { + $documentation: "Binary expression, i.e. `a + b`", + $propdoc: { + left: "[AST_Node] left-hand side expression", + operator: "[string] the operator", + right: "[AST_Node] right-hand side expression" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.left._walk(visitor); + this.right._walk(visitor); + }); + } +}); + +var AST_Conditional = DEFNODE("Conditional", "condition consequent alternative", { + $documentation: "Conditional expression using the ternary operator, i.e. `a ? b : c`", + $propdoc: { + condition: "[AST_Node]", + consequent: "[AST_Node]", + alternative: "[AST_Node]" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.condition._walk(visitor); + this.consequent._walk(visitor); + this.alternative._walk(visitor); + }); + } +}); + +var AST_Assign = DEFNODE("Assign", null, { + $documentation: "An assignment expression — `a = b + 5`", +}, AST_Binary); + +/* -----[ LITERALS ]----- */ + +var AST_Array = DEFNODE("Array", "elements", { + $documentation: "An array literal", + $propdoc: { + elements: "[AST_Node*] array of elements" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + var elements = this.elements; + for (var i = 0, len = elements.length; i < len; i++) { + elements[i]._walk(visitor); + } + }); + } +}); + +var AST_Object = DEFNODE("Object", "properties", { + $documentation: "An object literal", + $propdoc: { + properties: "[AST_ObjectProperty*] array of properties" + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + var properties = this.properties; + for (var i = 0, len = properties.length; i < len; i++) { + properties[i]._walk(visitor); + } + }); + } +}); + +var AST_ObjectProperty = DEFNODE("ObjectProperty", "key value", { + $documentation: "Base class for literal object properties", + $propdoc: { + key: "[string] the property name converted to a string for ObjectKeyVal. For setters and getters this is an AST_SymbolAccessor.", + value: "[AST_Node] property value. For setters and getters this is an AST_Accessor." + }, + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.value._walk(visitor); + }); + } +}); + +var AST_ObjectKeyVal = DEFNODE("ObjectKeyVal", "quote", { + $documentation: "A key: value object property", + $propdoc: { + quote: "[string] the original quote character" + } +}, AST_ObjectProperty); + +var AST_ObjectSetter = DEFNODE("ObjectSetter", null, { + $documentation: "An object setter property", +}, AST_ObjectProperty); + +var AST_ObjectGetter = DEFNODE("ObjectGetter", null, { + $documentation: "An object getter property", +}, AST_ObjectProperty); + +var AST_Symbol = DEFNODE("Symbol", "scope name thedef", { + $propdoc: { + name: "[string] name of this symbol", + scope: "[AST_Scope/S] the current scope (not necessarily the definition scope)", + thedef: "[SymbolDef/S] the definition of this symbol" + }, + $documentation: "Base class for all symbols", +}); + +var AST_SymbolAccessor = DEFNODE("SymbolAccessor", null, { + $documentation: "The name of a property accessor (setter/getter function)" +}, AST_Symbol); + +var AST_SymbolDeclaration = DEFNODE("SymbolDeclaration", "init", { + $documentation: "A declaration symbol (symbol in var/const, function name or argument, symbol in catch)", +}, AST_Symbol); + +var AST_SymbolVar = DEFNODE("SymbolVar", null, { + $documentation: "Symbol defining a variable", +}, AST_SymbolDeclaration); + +var AST_SymbolConst = DEFNODE("SymbolConst", null, { + $documentation: "A constant declaration" +}, AST_SymbolDeclaration); + +var AST_SymbolFunarg = DEFNODE("SymbolFunarg", null, { + $documentation: "Symbol naming a function argument", +}, AST_SymbolVar); + +var AST_SymbolDefun = DEFNODE("SymbolDefun", null, { + $documentation: "Symbol defining a function", +}, AST_SymbolDeclaration); + +var AST_SymbolLambda = DEFNODE("SymbolLambda", null, { + $documentation: "Symbol naming a function expression", +}, AST_SymbolDeclaration); + +var AST_SymbolCatch = DEFNODE("SymbolCatch", null, { + $documentation: "Symbol naming the exception in catch", +}, AST_SymbolDeclaration); + +var AST_Label = DEFNODE("Label", "references", { + $documentation: "Symbol naming a label (declaration)", + $propdoc: { + references: "[AST_LoopControl*] a list of nodes referring to this label" + }, + initialize: function() { + this.references = []; + this.thedef = this; + } +}, AST_Symbol); + +var AST_SymbolRef = DEFNODE("SymbolRef", null, { + $documentation: "Reference to some symbol (not definition/declaration)", +}, AST_Symbol); + +var AST_LabelRef = DEFNODE("LabelRef", null, { + $documentation: "Reference to a label symbol", +}, AST_Symbol); + +var AST_This = DEFNODE("This", null, { + $documentation: "The `this` symbol", +}, AST_Symbol); + +var AST_Constant = DEFNODE("Constant", null, { + $documentation: "Base class for all constants", + getValue: function() { + return this.value; + } +}); + +var AST_String = DEFNODE("String", "value quote", { + $documentation: "A string literal", + $propdoc: { + value: "[string] the contents of this string", + quote: "[string] the original quote character" + } +}, AST_Constant); + +var AST_Number = DEFNODE("Number", "value literal", { + $documentation: "A number literal", + $propdoc: { + value: "[number] the numeric value", + literal: "[string] numeric value as string (optional)" + } +}, AST_Constant); + +var AST_RegExp = DEFNODE("RegExp", "value", { + $documentation: "A regexp literal", + $propdoc: { + value: "[RegExp] the actual regexp" + } +}, AST_Constant); + +var AST_Atom = DEFNODE("Atom", null, { + $documentation: "Base class for atoms", +}, AST_Constant); + +var AST_Null = DEFNODE("Null", null, { + $documentation: "The `null` atom", + value: null +}, AST_Atom); + +var AST_NaN = DEFNODE("NaN", null, { + $documentation: "The impossible value", + value: 0/0 +}, AST_Atom); + +var AST_Undefined = DEFNODE("Undefined", null, { + $documentation: "The `undefined` value", + value: (function(){}()) +}, AST_Atom); + +var AST_Hole = DEFNODE("Hole", null, { + $documentation: "A hole in an array", + value: (function(){}()) +}, AST_Atom); + +var AST_Infinity = DEFNODE("Infinity", null, { + $documentation: "The `Infinity` value", + value: 1/0 +}, AST_Atom); + +var AST_Boolean = DEFNODE("Boolean", null, { + $documentation: "Base class for booleans", +}, AST_Atom); + +var AST_False = DEFNODE("False", null, { + $documentation: "The `false` atom", + value: false +}, AST_Boolean); + +var AST_True = DEFNODE("True", null, { + $documentation: "The `true` atom", + value: true +}, AST_Boolean); + +/* -----[ TreeWalker ]----- */ + +function TreeWalker(callback) { + this.visit = callback; + this.stack = []; + this.directives = Object.create(null); +}; +TreeWalker.prototype = { + _visit: function(node, descend) { + this.push(node); + var ret = this.visit(node, descend ? function(){ + descend.call(node); + } : noop); + if (!ret && descend) { + descend.call(node); + } + this.pop(node); + return ret; + }, + parent: function(n) { + return this.stack[this.stack.length - 2 - (n || 0)]; + }, + push: function (node) { + if (node instanceof AST_Lambda) { + this.directives = Object.create(this.directives); + } else if (node instanceof AST_Directive && !this.directives[node.value]) { + this.directives[node.value] = node; + } + this.stack.push(node); + }, + pop: function(node) { + this.stack.pop(); + if (node instanceof AST_Lambda) { + this.directives = Object.getPrototypeOf(this.directives); + } + }, + self: function() { + return this.stack[this.stack.length - 1]; + }, + find_parent: function(type) { + var stack = this.stack; + for (var i = stack.length; --i >= 0;) { + var x = stack[i]; + if (x instanceof type) return x; + } + }, + has_directive: function(type) { + var dir = this.directives[type]; + if (dir) return dir; + var node = this.stack[this.stack.length - 1]; + if (node instanceof AST_Scope) { + for (var i = 0; i < node.body.length; ++i) { + var st = node.body[i]; + if (!(st instanceof AST_Directive)) break; + if (st.value == type) return st; + } + } + }, + in_boolean_context: function() { + var stack = this.stack; + var i = stack.length, self = stack[--i]; + while (i > 0) { + var p = stack[--i]; + if ((p instanceof AST_If && p.condition === self) || + (p instanceof AST_Conditional && p.condition === self) || + (p instanceof AST_DWLoop && p.condition === self) || + (p instanceof AST_For && p.condition === self) || + (p instanceof AST_UnaryPrefix && p.operator == "!" && p.expression === self)) + { + return true; + } + if (!(p instanceof AST_Binary && (p.operator == "&&" || p.operator == "||"))) + return false; + self = p; + } + }, + loopcontrol_target: function(node) { + var stack = this.stack; + if (node.label) for (var i = stack.length; --i >= 0;) { + var x = stack[i]; + if (x instanceof AST_LabeledStatement && x.label.name == node.label.name) + return x.body; + } else for (var i = stack.length; --i >= 0;) { + var x = stack[i]; + if (x instanceof AST_IterationStatement + || node instanceof AST_Break && x instanceof AST_Switch) + return x; + } + } +}; diff --git a/node_modules/uglify-js/lib/compress.js b/node_modules/uglify-js/lib/compress.js new file mode 100644 index 0000000..d8a491e --- /dev/null +++ b/node_modules/uglify-js/lib/compress.js @@ -0,0 +1,4101 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS2 + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + 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. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 HOLDER 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. + + ***********************************************************************/ + +"use strict"; + +function Compressor(options, false_by_default) { + if (!(this instanceof Compressor)) + return new Compressor(options, false_by_default); + TreeTransformer.call(this, this.before, this.after); + this.options = defaults(options, { + angular : false, + booleans : !false_by_default, + cascade : !false_by_default, + collapse_vars : !false_by_default, + comparisons : !false_by_default, + conditionals : !false_by_default, + dead_code : !false_by_default, + drop_console : false, + drop_debugger : !false_by_default, + evaluate : !false_by_default, + expression : false, + global_defs : {}, + hoist_funs : !false_by_default, + hoist_vars : false, + if_return : !false_by_default, + join_vars : !false_by_default, + keep_fargs : true, + keep_fnames : false, + keep_infinity : false, + loops : !false_by_default, + negate_iife : !false_by_default, + passes : 1, + properties : !false_by_default, + pure_getters : !false_by_default && "strict", + pure_funcs : null, + reduce_vars : !false_by_default, + screw_ie8 : true, + sequences : !false_by_default, + side_effects : !false_by_default, + switches : !false_by_default, + top_retain : null, + toplevel : !!(options && options["top_retain"]), + unsafe : false, + unsafe_comps : false, + unsafe_math : false, + unsafe_proto : false, + unsafe_regexp : false, + unused : !false_by_default, + warnings : true, + }, true); + var pure_funcs = this.options["pure_funcs"]; + if (typeof pure_funcs == "function") { + this.pure_funcs = pure_funcs; + } else { + this.pure_funcs = pure_funcs ? function(node) { + return pure_funcs.indexOf(node.expression.print_to_string()) < 0; + } : return_true; + } + var top_retain = this.options["top_retain"]; + if (top_retain instanceof RegExp) { + this.top_retain = function(def) { + return top_retain.test(def.name); + }; + } else if (typeof top_retain == "function") { + this.top_retain = top_retain; + } else if (top_retain) { + if (typeof top_retain == "string") { + top_retain = top_retain.split(/,/); + } + this.top_retain = function(def) { + return top_retain.indexOf(def.name) >= 0; + }; + } + var sequences = this.options["sequences"]; + this.sequences_limit = sequences == 1 ? 200 : sequences | 0; + this.warnings_produced = {}; +}; + +Compressor.prototype = new TreeTransformer; +merge(Compressor.prototype, { + option: function(key) { return this.options[key] }, + compress: function(node) { + if (this.option("expression")) { + node = node.process_expression(true); + } + var passes = +this.options.passes || 1; + for (var pass = 0; pass < passes && pass < 3; ++pass) { + if (pass > 0 || this.option("reduce_vars")) + node.reset_opt_flags(this, true); + node = node.transform(this); + } + if (this.option("expression")) { + node = node.process_expression(false); + } + return node; + }, + info: function() { + if (this.options.warnings == "verbose") { + AST_Node.warn.apply(AST_Node, arguments); + } + }, + warn: function(text, props) { + if (this.options.warnings) { + // only emit unique warnings + var message = string_template(text, props); + if (!(message in this.warnings_produced)) { + this.warnings_produced[message] = true; + AST_Node.warn.apply(AST_Node, arguments); + } + } + }, + clear_warnings: function() { + this.warnings_produced = {}; + }, + before: function(node, descend, in_list) { + if (node._squeezed) return node; + var was_scope = false; + if (node instanceof AST_Scope) { + node = node.hoist_declarations(this); + was_scope = true; + } + // Before https://github.com/mishoo/UglifyJS2/pull/1602 AST_Node.optimize() + // would call AST_Node.transform() if a different instance of AST_Node is + // produced after OPT(). + // This corrupts TreeWalker.stack, which cause AST look-ups to malfunction. + // Migrate and defer all children's AST_Node.transform() to below, which + // will now happen after this parent AST_Node has been properly substituted + // thus gives a consistent AST snapshot. + descend(node, this); + // Existing code relies on how AST_Node.optimize() worked, and omitting the + // following replacement call would result in degraded efficiency of both + // output and performance. + descend(node, this); + var opt = node.optimize(this); + if (was_scope && opt instanceof AST_Scope) { + opt.drop_unused(this); + descend(opt, this); + } + if (opt === node) opt._squeezed = true; + return opt; + } +}); + +(function(){ + + function OPT(node, optimizer) { + node.DEFMETHOD("optimize", function(compressor){ + var self = this; + if (self._optimized) return self; + if (compressor.has_directive("use asm")) return self; + var opt = optimizer(self, compressor); + opt._optimized = true; + return opt; + }); + }; + + OPT(AST_Node, function(self, compressor){ + return self; + }); + + AST_Node.DEFMETHOD("equivalent_to", function(node){ + return this.TYPE == node.TYPE && this.print_to_string() == node.print_to_string(); + }); + + AST_Node.DEFMETHOD("process_expression", function(insert, compressor) { + var self = this; + var tt = new TreeTransformer(function(node) { + if (insert && node instanceof AST_SimpleStatement) { + return make_node(AST_Return, node, { + value: node.body + }); + } + if (!insert && node instanceof AST_Return) { + if (compressor) { + var value = node.value && node.value.drop_side_effect_free(compressor, true); + return value ? make_node(AST_SimpleStatement, node, { + body: value + }) : make_node(AST_EmptyStatement, node); + } + return make_node(AST_SimpleStatement, node, { + body: node.value || make_node(AST_UnaryPrefix, node, { + operator: "void", + expression: make_node(AST_Number, node, { + value: 0 + }) + }) + }); + } + if (node instanceof AST_Lambda && node !== self) { + return node; + } + if (node instanceof AST_Block) { + var index = node.body.length - 1; + if (index >= 0) { + node.body[index] = node.body[index].transform(tt); + } + } + if (node instanceof AST_If) { + node.body = node.body.transform(tt); + if (node.alternative) { + node.alternative = node.alternative.transform(tt); + } + } + if (node instanceof AST_With) { + node.body = node.body.transform(tt); + } + return node; + }); + return self.transform(tt); + }); + + AST_Node.DEFMETHOD("reset_opt_flags", function(compressor, rescan){ + var reduce_vars = rescan && compressor.option("reduce_vars"); + var toplevel = compressor.option("toplevel"); + var safe_ids = Object.create(null); + var suppressor = new TreeWalker(function(node) { + if (node instanceof AST_Symbol) { + var d = node.definition(); + if (node instanceof AST_SymbolRef) d.references.push(node); + d.fixed = false; + } + }); + var tw = new TreeWalker(function(node, descend){ + node._squeezed = false; + node._optimized = false; + if (reduce_vars) { + if (node instanceof AST_Toplevel) node.globals.each(reset_def); + if (node instanceof AST_Scope) node.variables.each(reset_def); + if (node instanceof AST_SymbolRef) { + var d = node.definition(); + d.references.push(node); + if (d.fixed === undefined || !is_safe(d) + || is_modified(node, 0, node.fixed_value() instanceof AST_Lambda)) { + d.fixed = false; + } else { + var parent = tw.parent(); + if (parent instanceof AST_Assign && parent.operator == "=" && node === parent.right + || parent instanceof AST_Call && node !== parent.expression + || parent instanceof AST_Return && node === parent.value && node.scope !== d.scope + || parent instanceof AST_VarDef && node === parent.value) { + d.escaped = true; + } + } + } + if (node instanceof AST_SymbolCatch) { + node.definition().fixed = false; + } + if (node instanceof AST_VarDef) { + var d = node.name.definition(); + if (d.fixed == null) { + if (node.value) { + d.fixed = function() { + return node.value; + }; + mark(d, false); + descend(); + } else { + d.fixed = null; + } + mark(d, true); + return true; + } else if (node.value) { + d.fixed = false; + } + } + if (node instanceof AST_Defun) { + var d = node.name.definition(); + if (!toplevel && d.global || is_safe(d)) { + d.fixed = false; + } else { + d.fixed = node; + mark(d, true); + } + var save_ids = safe_ids; + safe_ids = Object.create(null); + descend(); + safe_ids = save_ids; + return true; + } + if (node instanceof AST_Function) { + push(); + var iife; + if (!node.name + && (iife = tw.parent()) instanceof AST_Call + && iife.expression === node) { + // Virtually turn IIFE parameters into variable definitions: + // (function(a,b) {...})(c,d) => (function() {var a=c,b=d; ...})() + // So existing transformation rules can work on them. + node.argnames.forEach(function(arg, i) { + var d = arg.definition(); + if (!node.uses_arguments && d.fixed === undefined) { + d.fixed = function() { + return iife.args[i] || make_node(AST_Undefined, iife); + }; + mark(d, true); + } else { + d.fixed = false; + } + }); + } + descend(); + pop(); + return true; + } + if (node instanceof AST_Accessor) { + var save_ids = safe_ids; + safe_ids = Object.create(null); + descend(); + safe_ids = save_ids; + return true; + } + if (node instanceof AST_Binary + && (node.operator == "&&" || node.operator == "||")) { + node.left.walk(tw); + push(); + node.right.walk(tw); + pop(); + return true; + } + if (node instanceof AST_Conditional) { + node.condition.walk(tw); + push(); + node.consequent.walk(tw); + pop(); + push(); + node.alternative.walk(tw); + pop(); + return true; + } + if (node instanceof AST_If || node instanceof AST_DWLoop) { + node.condition.walk(tw); + push(); + node.body.walk(tw); + pop(); + if (node.alternative) { + push(); + node.alternative.walk(tw); + pop(); + } + return true; + } + if (node instanceof AST_LabeledStatement) { + push(); + node.body.walk(tw); + pop(); + return true; + } + if (node instanceof AST_For) { + if (node.init) node.init.walk(tw); + push(); + if (node.condition) node.condition.walk(tw); + node.body.walk(tw); + if (node.step) node.step.walk(tw); + pop(); + return true; + } + if (node instanceof AST_ForIn) { + node.init.walk(suppressor); + node.object.walk(tw); + push(); + node.body.walk(tw); + pop(); + return true; + } + if (node instanceof AST_Try) { + push(); + walk_body(node, tw); + pop(); + if (node.bcatch) { + push(); + node.bcatch.walk(tw); + pop(); + } + if (node.bfinally) node.bfinally.walk(tw); + return true; + } + if (node instanceof AST_SwitchBranch) { + push(); + descend(); + pop(); + return true; + } + } + }); + this.walk(tw); + + function mark(def, safe) { + safe_ids[def.id] = safe; + } + + function is_safe(def) { + if (safe_ids[def.id]) { + if (def.fixed == null) { + var orig = def.orig[0]; + if (orig instanceof AST_SymbolFunarg || orig.name == "arguments") return false; + def.fixed = make_node(AST_Undefined, orig); + } + return true; + } + } + + function push() { + safe_ids = Object.create(safe_ids); + } + + function pop() { + safe_ids = Object.getPrototypeOf(safe_ids); + } + + function reset_def(def) { + def.escaped = false; + if (def.scope.uses_eval) { + def.fixed = false; + } else if (toplevel || !def.global || def.orig[0] instanceof AST_SymbolConst) { + def.fixed = undefined; + } else { + def.fixed = false; + } + def.references = []; + def.should_replace = undefined; + } + + function is_modified(node, level, func) { + var parent = tw.parent(level); + if (is_lhs(node, parent) + || !func && parent instanceof AST_Call && parent.expression === node) { + return true; + } else if (parent instanceof AST_PropAccess && parent.expression === node) { + return !func && is_modified(parent, level + 1); + } + } + }); + + AST_SymbolRef.DEFMETHOD("fixed_value", function() { + var fixed = this.definition().fixed; + if (!fixed || fixed instanceof AST_Node) return fixed; + return fixed(); + }); + + function is_reference_const(ref) { + if (!(ref instanceof AST_SymbolRef)) return false; + var orig = ref.definition().orig; + for (var i = orig.length; --i >= 0;) { + if (orig[i] instanceof AST_SymbolConst) return true; + } + } + + function find_variable(compressor, name) { + var scope, i = 0; + while (scope = compressor.parent(i++)) { + if (scope instanceof AST_Scope) break; + if (scope instanceof AST_Catch) { + scope = scope.argname.definition().scope; + break; + } + } + return scope.find_variable(name); + } + + function make_node(ctor, orig, props) { + if (!props) props = {}; + if (orig) { + if (!props.start) props.start = orig.start; + if (!props.end) props.end = orig.end; + } + return new ctor(props); + }; + + function make_node_from_constant(val, orig) { + switch (typeof val) { + case "string": + return make_node(AST_String, orig, { + value: val + }); + case "number": + if (isNaN(val)) return make_node(AST_NaN, orig); + if (isFinite(val)) { + return 1 / val < 0 ? make_node(AST_UnaryPrefix, orig, { + operator: "-", + expression: make_node(AST_Number, orig, { value: -val }) + }) : make_node(AST_Number, orig, { value: val }); + } + return val < 0 ? make_node(AST_UnaryPrefix, orig, { + operator: "-", + expression: make_node(AST_Infinity, orig) + }) : make_node(AST_Infinity, orig); + case "boolean": + return make_node(val ? AST_True : AST_False, orig); + case "undefined": + return make_node(AST_Undefined, orig); + default: + if (val === null) { + return make_node(AST_Null, orig, { value: null }); + } + if (val instanceof RegExp) { + return make_node(AST_RegExp, orig, { value: val }); + } + throw new Error(string_template("Can't handle constant of type: {type}", { + type: typeof val + })); + } + }; + + // we shouldn't compress (1,func)(something) to + // func(something) because that changes the meaning of + // the func (becomes lexical instead of global). + function maintain_this_binding(parent, orig, val) { + if (parent instanceof AST_UnaryPrefix && parent.operator == "delete" + || parent instanceof AST_Call && parent.expression === orig + && (val instanceof AST_PropAccess || val instanceof AST_SymbolRef && val.name == "eval")) { + return make_node(AST_Seq, orig, { + car: make_node(AST_Number, orig, { + value: 0 + }), + cdr: val + }); + } + return val; + } + + function as_statement_array(thing) { + if (thing === null) return []; + if (thing instanceof AST_BlockStatement) return thing.body; + if (thing instanceof AST_EmptyStatement) return []; + if (thing instanceof AST_Statement) return [ thing ]; + throw new Error("Can't convert thing to statement array"); + }; + + function is_empty(thing) { + if (thing === null) return true; + if (thing instanceof AST_EmptyStatement) return true; + if (thing instanceof AST_BlockStatement) return thing.body.length == 0; + return false; + }; + + function loop_body(x) { + if (x instanceof AST_Switch) return x; + if (x instanceof AST_For || x instanceof AST_ForIn || x instanceof AST_DWLoop) { + return (x.body instanceof AST_BlockStatement ? x.body : x); + } + return x; + }; + + function is_iife_call(node) { + if (node instanceof AST_Call && !(node instanceof AST_New)) { + return node.expression instanceof AST_Function || is_iife_call(node.expression); + } + return false; + } + + function tighten_body(statements, compressor) { + var CHANGED, max_iter = 10; + do { + CHANGED = false; + if (compressor.option("angular")) { + statements = process_for_angular(statements); + } + statements = eliminate_spurious_blocks(statements); + if (compressor.option("dead_code")) { + statements = eliminate_dead_code(statements, compressor); + } + if (compressor.option("if_return")) { + statements = handle_if_return(statements, compressor); + } + if (compressor.sequences_limit > 0) { + statements = sequencesize(statements, compressor); + } + if (compressor.option("join_vars")) { + statements = join_consecutive_vars(statements, compressor); + } + if (compressor.option("collapse_vars")) { + statements = collapse_single_use_vars(statements, compressor); + } + } while (CHANGED && max_iter-- > 0); + + return statements; + + function collapse_single_use_vars(statements, compressor) { + // Iterate statements backwards looking for a statement with a var/const + // declaration immediately preceding it. Grab the rightmost var definition + // and if it has exactly one reference then attempt to replace its reference + // in the statement with the var value and then erase the var definition. + + var self = compressor.self(); + var var_defs_removed = false; + var toplevel = compressor.option("toplevel"); + for (var stat_index = statements.length; --stat_index >= 0;) { + var stat = statements[stat_index]; + if (stat instanceof AST_Definitions) continue; + + // Process child blocks of statement if present. + [stat, stat.body, stat.alternative, stat.bcatch, stat.bfinally].forEach(function(node) { + node && node.body && collapse_single_use_vars(node.body, compressor); + }); + + // The variable definition must precede a statement. + if (stat_index <= 0) break; + var prev_stat_index = stat_index - 1; + var prev_stat = statements[prev_stat_index]; + if (!(prev_stat instanceof AST_Definitions)) continue; + var var_defs = prev_stat.definitions; + if (var_defs == null) continue; + + var var_names_seen = {}; + var side_effects_encountered = false; + var lvalues_encountered = false; + var lvalues = {}; + + // Scan variable definitions from right to left. + for (var var_defs_index = var_defs.length; --var_defs_index >= 0;) { + + // Obtain var declaration and var name with basic sanity check. + var var_decl = var_defs[var_defs_index]; + if (var_decl.value == null) break; + var var_name = var_decl.name.name; + if (!var_name || !var_name.length) break; + + // Bail if we've seen a var definition of same name before. + if (var_name in var_names_seen) break; + var_names_seen[var_name] = true; + + // Only interested in cases with just one reference to the variable. + var def = self.find_variable && self.find_variable(var_name); + if (!def || !def.references || def.references.length !== 1 + || var_name == "arguments" || (!toplevel && def.global)) { + side_effects_encountered = true; + continue; + } + var ref = def.references[0]; + + // Don't replace ref if eval() or with statement in scope. + if (ref.scope.uses_eval || ref.scope.uses_with) break; + + // Constant single use vars can be replaced in any scope. + if (var_decl.value.is_constant()) { + var ctt = new TreeTransformer(function(node) { + var parent = ctt.parent(); + if (parent instanceof AST_IterationStatement + && (parent.condition === node || parent.init === node)) { + return node; + } + if (node === ref) + return replace_var(node, parent, true); + }); + stat.transform(ctt); + continue; + } + + // Restrict var replacement to constants if side effects encountered. + if (side_effects_encountered |= lvalues_encountered) continue; + + var value_has_side_effects = var_decl.value.has_side_effects(compressor); + // Non-constant single use vars can only be replaced in same scope. + if (ref.scope !== self) { + side_effects_encountered |= value_has_side_effects; + continue; + } + + // Detect lvalues in var value. + var tw = new TreeWalker(function(node){ + if (node instanceof AST_SymbolRef && is_lvalue(node, tw.parent())) { + lvalues[node.name] = lvalues_encountered = true; + } + }); + var_decl.value.walk(tw); + + // Replace the non-constant single use var in statement if side effect free. + var unwind = false; + var tt = new TreeTransformer( + function preorder(node) { + if (unwind) return node; + var parent = tt.parent(); + if (node instanceof AST_Lambda + || node instanceof AST_Try + || node instanceof AST_With + || node instanceof AST_Case + || node instanceof AST_IterationStatement + || (parent instanceof AST_If && node !== parent.condition) + || (parent instanceof AST_Conditional && node !== parent.condition) + || (node instanceof AST_SymbolRef + && value_has_side_effects + && !are_references_in_scope(node.definition(), self)) + || (parent instanceof AST_Binary + && (parent.operator == "&&" || parent.operator == "||") + && node === parent.right) + || (parent instanceof AST_Switch && node !== parent.expression)) { + return side_effects_encountered = unwind = true, node; + } + function are_references_in_scope(def, scope) { + if (def.orig.length === 1 + && def.orig[0] instanceof AST_SymbolDefun) return true; + if (def.scope !== scope) return false; + var refs = def.references; + for (var i = 0, len = refs.length; i < len; i++) { + if (refs[i].scope !== scope) return false; + } + return true; + } + }, + function postorder(node) { + if (unwind) return node; + if (node === ref) + return unwind = true, replace_var(node, tt.parent(), false); + if (side_effects_encountered |= node.has_side_effects(compressor)) + return unwind = true, node; + if (lvalues_encountered && node instanceof AST_SymbolRef && node.name in lvalues) { + side_effects_encountered = true; + return unwind = true, node; + } + } + ); + stat.transform(tt); + } + } + + // Remove extraneous empty statments in block after removing var definitions. + // Leave at least one statement in `statements`. + if (var_defs_removed) for (var i = statements.length; --i >= 0;) { + if (statements.length > 1 && statements[i] instanceof AST_EmptyStatement) + statements.splice(i, 1); + } + + return statements; + + function is_lvalue(node, parent) { + return node instanceof AST_SymbolRef && is_lhs(node, parent); + } + function replace_var(node, parent, is_constant) { + if (is_lvalue(node, parent)) return node; + + // Remove var definition and return its value to the TreeTransformer to replace. + var value = maintain_this_binding(parent, node, var_decl.value); + var_decl.value = null; + + var_defs.splice(var_defs_index, 1); + if (var_defs.length === 0) { + statements[prev_stat_index] = make_node(AST_EmptyStatement, self); + var_defs_removed = true; + } + // Further optimize statement after substitution. + stat.reset_opt_flags(compressor); + + compressor.info("Collapsing " + (is_constant ? "constant" : "variable") + + " " + var_name + " [{file}:{line},{col}]", node.start); + CHANGED = true; + return value; + } + } + + function process_for_angular(statements) { + function has_inject(comment) { + return /@ngInject/.test(comment.value); + } + function make_arguments_names_list(func) { + return func.argnames.map(function(sym){ + return make_node(AST_String, sym, { value: sym.name }); + }); + } + function make_array(orig, elements) { + return make_node(AST_Array, orig, { elements: elements }); + } + function make_injector(func, name) { + return make_node(AST_SimpleStatement, func, { + body: make_node(AST_Assign, func, { + operator: "=", + left: make_node(AST_Dot, name, { + expression: make_node(AST_SymbolRef, name, name), + property: "$inject" + }), + right: make_array(func, make_arguments_names_list(func)) + }) + }); + } + function check_expression(body) { + if (body && body.args) { + // if this is a function call check all of arguments passed + body.args.forEach(function(argument, index, array) { + var comments = argument.start.comments_before; + // if the argument is function preceded by @ngInject + if (argument instanceof AST_Lambda && comments.length && has_inject(comments[0])) { + // replace the function with an array of names of its parameters and function at the end + array[index] = make_array(argument, make_arguments_names_list(argument).concat(argument)); + } + }); + // if this is chained call check previous one recursively + if (body.expression && body.expression.expression) { + check_expression(body.expression.expression); + } + } + } + return statements.reduce(function(a, stat){ + a.push(stat); + + if (stat.body && stat.body.args) { + check_expression(stat.body); + } else { + var token = stat.start; + var comments = token.comments_before; + if (comments && comments.length > 0) { + var last = comments.pop(); + if (has_inject(last)) { + // case 1: defun + if (stat instanceof AST_Defun) { + a.push(make_injector(stat, stat.name)); + } + else if (stat instanceof AST_Definitions) { + stat.definitions.forEach(function(def) { + if (def.value && def.value instanceof AST_Lambda) { + a.push(make_injector(def.value, def.name)); + } + }); + } + else { + compressor.warn("Unknown statement marked with @ngInject [{file}:{line},{col}]", token); + } + } + } + } + + return a; + }, []); + } + + function eliminate_spurious_blocks(statements) { + var seen_dirs = []; + return statements.reduce(function(a, stat){ + if (stat instanceof AST_BlockStatement) { + CHANGED = true; + a.push.apply(a, eliminate_spurious_blocks(stat.body)); + } else if (stat instanceof AST_EmptyStatement) { + CHANGED = true; + } else if (stat instanceof AST_Directive) { + if (seen_dirs.indexOf(stat.value) < 0) { + a.push(stat); + seen_dirs.push(stat.value); + } else { + CHANGED = true; + } + } else { + a.push(stat); + } + return a; + }, []); + }; + + function handle_if_return(statements, compressor) { + var self = compressor.self(); + var multiple_if_returns = has_multiple_if_returns(statements); + var in_lambda = self instanceof AST_Lambda; + var ret = []; // Optimized statements, build from tail to front + loop: for (var i = statements.length; --i >= 0;) { + var stat = statements[i]; + switch (true) { + case (in_lambda && stat instanceof AST_Return && !stat.value && ret.length == 0): + CHANGED = true; + // note, ret.length is probably always zero + // because we drop unreachable code before this + // step. nevertheless, it's good to check. + continue loop; + case stat instanceof AST_If: + if (stat.body instanceof AST_Return) { + //--- + // pretty silly case, but: + // if (foo()) return; return; ==> foo(); return; + if (((in_lambda && ret.length == 0) + || (ret[0] instanceof AST_Return && !ret[0].value)) + && !stat.body.value && !stat.alternative) { + CHANGED = true; + var cond = make_node(AST_SimpleStatement, stat.condition, { + body: stat.condition + }); + ret.unshift(cond); + continue loop; + } + //--- + // if (foo()) return x; return y; ==> return foo() ? x : y; + if (ret[0] instanceof AST_Return && stat.body.value && ret[0].value && !stat.alternative) { + CHANGED = true; + stat = stat.clone(); + stat.alternative = ret[0]; + ret[0] = stat.transform(compressor); + continue loop; + } + //--- + // if (foo()) return x; [ return ; ] ==> return foo() ? x : undefined; + if (multiple_if_returns && (ret.length == 0 || ret[0] instanceof AST_Return) + && stat.body.value && !stat.alternative && in_lambda) { + CHANGED = true; + stat = stat.clone(); + stat.alternative = ret[0] || make_node(AST_Return, stat, { + value: null + }); + ret[0] = stat.transform(compressor); + continue loop; + } + //--- + // if (foo()) return; [ else x... ]; y... ==> if (!foo()) { x...; y... } + if (!stat.body.value && in_lambda) { + CHANGED = true; + stat = stat.clone(); + stat.condition = stat.condition.negate(compressor); + var body = as_statement_array(stat.alternative).concat(ret); + var funs = extract_functions_from_statement_array(body); + stat.body = make_node(AST_BlockStatement, stat, { + body: body + }); + stat.alternative = null; + ret = funs.concat([ stat.transform(compressor) ]); + continue loop; + } + + //--- + // if (a) return b; if (c) return d; e; ==> return a ? b : c ? d : void e; + // + // if sequences is not enabled, this can lead to an endless loop (issue #866). + // however, with sequences on this helps producing slightly better output for + // the example code. + if (compressor.option("sequences") + && i > 0 && statements[i - 1] instanceof AST_If && statements[i - 1].body instanceof AST_Return + && ret.length == 1 && in_lambda && ret[0] instanceof AST_SimpleStatement + && !stat.alternative) { + CHANGED = true; + ret.push(make_node(AST_Return, ret[0], { + value: null + }).transform(compressor)); + ret.unshift(stat); + continue loop; + } + } + + var ab = aborts(stat.body); + var lct = ab instanceof AST_LoopControl ? compressor.loopcontrol_target(ab) : null; + if (ab && ((ab instanceof AST_Return && !ab.value && in_lambda) + || (ab instanceof AST_Continue && self === loop_body(lct)) + || (ab instanceof AST_Break && lct instanceof AST_BlockStatement && self === lct))) { + if (ab.label) { + remove(ab.label.thedef.references, ab); + } + CHANGED = true; + var body = as_statement_array(stat.body).slice(0, -1); + stat = stat.clone(); + stat.condition = stat.condition.negate(compressor); + stat.body = make_node(AST_BlockStatement, stat, { + body: as_statement_array(stat.alternative).concat(ret) + }); + stat.alternative = make_node(AST_BlockStatement, stat, { + body: body + }); + ret = [ stat.transform(compressor) ]; + continue loop; + } + + var ab = aborts(stat.alternative); + var lct = ab instanceof AST_LoopControl ? compressor.loopcontrol_target(ab) : null; + if (ab && ((ab instanceof AST_Return && !ab.value && in_lambda) + || (ab instanceof AST_Continue && self === loop_body(lct)) + || (ab instanceof AST_Break && lct instanceof AST_BlockStatement && self === lct))) { + if (ab.label) { + remove(ab.label.thedef.references, ab); + } + CHANGED = true; + stat = stat.clone(); + stat.body = make_node(AST_BlockStatement, stat.body, { + body: as_statement_array(stat.body).concat(ret) + }); + stat.alternative = make_node(AST_BlockStatement, stat.alternative, { + body: as_statement_array(stat.alternative).slice(0, -1) + }); + ret = [ stat.transform(compressor) ]; + continue loop; + } + + ret.unshift(stat); + break; + default: + ret.unshift(stat); + break; + } + } + return ret; + + function has_multiple_if_returns(statements) { + var n = 0; + for (var i = statements.length; --i >= 0;) { + var stat = statements[i]; + if (stat instanceof AST_If && stat.body instanceof AST_Return) { + if (++n > 1) return true; + } + } + return false; + } + }; + + function eliminate_dead_code(statements, compressor) { + var has_quit = false; + var orig = statements.length; + var self = compressor.self(); + statements = statements.reduce(function(a, stat){ + if (has_quit) { + extract_declarations_from_unreachable_code(compressor, stat, a); + } else { + if (stat instanceof AST_LoopControl) { + var lct = compressor.loopcontrol_target(stat); + if ((stat instanceof AST_Break + && !(lct instanceof AST_IterationStatement) + && loop_body(lct) === self) || (stat instanceof AST_Continue + && loop_body(lct) === self)) { + if (stat.label) { + remove(stat.label.thedef.references, stat); + } + } else { + a.push(stat); + } + } else { + a.push(stat); + } + if (aborts(stat)) has_quit = true; + } + return a; + }, []); + CHANGED = statements.length != orig; + return statements; + }; + + function sequencesize(statements, compressor) { + if (statements.length < 2) return statements; + var seq = [], ret = []; + function push_seq() { + seq = AST_Seq.from_array(seq); + if (seq) ret.push(make_node(AST_SimpleStatement, seq, { + body: seq + })); + seq = []; + }; + statements.forEach(function(stat){ + if (stat instanceof AST_SimpleStatement) { + if (seqLength(seq) >= compressor.sequences_limit) push_seq(); + var body = stat.body; + if (seq.length > 0) body = body.drop_side_effect_free(compressor); + if (body) seq.push(body); + } else { + push_seq(); + ret.push(stat); + } + }); + push_seq(); + ret = sequencesize_2(ret, compressor); + CHANGED = ret.length != statements.length; + return ret; + }; + + function seqLength(a) { + for (var len = 0, i = 0; i < a.length; ++i) { + var stat = a[i]; + if (stat instanceof AST_Seq) { + len += stat.len(); + } else { + len++; + } + } + return len; + }; + + function sequencesize_2(statements, compressor) { + function cons_seq(right) { + ret.pop(); + var left = prev.body; + if (left instanceof AST_Seq) { + left.add(right); + } else { + left = AST_Seq.cons(left, right); + } + return left.transform(compressor); + }; + var ret = [], prev = null; + statements.forEach(function(stat){ + if (prev) { + if (stat instanceof AST_For) { + var opera = {}; + try { + prev.body.walk(new TreeWalker(function(node){ + if (node instanceof AST_Binary && node.operator == "in") + throw opera; + })); + if (stat.init && !(stat.init instanceof AST_Definitions)) { + stat.init = cons_seq(stat.init); + } + else if (!stat.init) { + stat.init = prev.body.drop_side_effect_free(compressor); + ret.pop(); + } + } catch(ex) { + if (ex !== opera) throw ex; + } + } + else if (stat instanceof AST_If) { + stat.condition = cons_seq(stat.condition); + } + else if (stat instanceof AST_With) { + stat.expression = cons_seq(stat.expression); + } + else if (stat instanceof AST_Exit && stat.value) { + stat.value = cons_seq(stat.value); + } + else if (stat instanceof AST_Exit) { + stat.value = cons_seq(make_node(AST_Undefined, stat).transform(compressor)); + } + else if (stat instanceof AST_Switch) { + stat.expression = cons_seq(stat.expression); + } + } + ret.push(stat); + prev = stat instanceof AST_SimpleStatement ? stat : null; + }); + return ret; + }; + + function join_consecutive_vars(statements, compressor) { + var prev = null; + return statements.reduce(function(a, stat){ + if (stat instanceof AST_Definitions && prev && prev.TYPE == stat.TYPE) { + prev.definitions = prev.definitions.concat(stat.definitions); + CHANGED = true; + } + else if (stat instanceof AST_For + && prev instanceof AST_Var + && (!stat.init || stat.init.TYPE == prev.TYPE)) { + CHANGED = true; + a.pop(); + if (stat.init) { + stat.init.definitions = prev.definitions.concat(stat.init.definitions); + } else { + stat.init = prev; + } + a.push(stat); + prev = stat; + } + else { + prev = stat; + a.push(stat); + } + return a; + }, []); + }; + + }; + + function extract_functions_from_statement_array(statements) { + var funs = []; + for (var i = statements.length - 1; i >= 0; --i) { + var stat = statements[i]; + if (stat instanceof AST_Defun) { + statements.splice(i, 1); + funs.unshift(stat); + } + } + return funs; + } + + function extract_declarations_from_unreachable_code(compressor, stat, target) { + if (!(stat instanceof AST_Defun)) { + compressor.warn("Dropping unreachable code [{file}:{line},{col}]", stat.start); + } + stat.walk(new TreeWalker(function(node){ + if (node instanceof AST_Definitions) { + compressor.warn("Declarations in unreachable code! [{file}:{line},{col}]", node.start); + node.remove_initializers(); + target.push(node); + return true; + } + if (node instanceof AST_Defun) { + target.push(node); + return true; + } + if (node instanceof AST_Scope) { + return true; + } + })); + }; + + function is_undefined(node, compressor) { + return node.is_undefined + || node instanceof AST_Undefined + || node instanceof AST_UnaryPrefix + && node.operator == "void" + && !node.expression.has_side_effects(compressor); + } + + // may_throw_on_access() + // returns true if this node may be null, undefined or contain `AST_Accessor` + (function(def) { + AST_Node.DEFMETHOD("may_throw_on_access", function(compressor) { + var pure_getters = compressor.option("pure_getters"); + return !pure_getters || this._throw_on_access(pure_getters); + }); + + function is_strict(pure_getters) { + return /strict/.test(pure_getters); + } + + def(AST_Node, is_strict); + def(AST_Null, return_true); + def(AST_Undefined, return_true); + def(AST_Constant, return_false); + def(AST_Array, return_false); + def(AST_Object, function(pure_getters) { + if (!is_strict(pure_getters)) return false; + for (var i = this.properties.length; --i >=0;) + if (this.properties[i].value instanceof AST_Accessor) return true; + return false; + }); + def(AST_Function, return_false); + def(AST_UnaryPostfix, return_false); + def(AST_UnaryPrefix, function() { + return this.operator == "void"; + }); + def(AST_Binary, function(pure_getters) { + switch (this.operator) { + case "&&": + return this.left._throw_on_access(pure_getters); + case "||": + return this.left._throw_on_access(pure_getters) + && this.right._throw_on_access(pure_getters); + default: + return false; + } + }) + def(AST_Assign, function(pure_getters) { + return this.operator == "=" + && this.right._throw_on_access(pure_getters); + }) + def(AST_Conditional, function(pure_getters) { + return this.consequent._throw_on_access(pure_getters) + || this.alternative._throw_on_access(pure_getters); + }) + def(AST_Seq, function(pure_getters) { + return this.cdr._throw_on_access(pure_getters); + }); + def(AST_SymbolRef, function(pure_getters) { + if (this.is_undefined) return true; + if (!is_strict(pure_getters)) return false; + var fixed = this.fixed_value(); + return !fixed || fixed._throw_on_access(pure_getters); + }); + })(function(node, func) { + node.DEFMETHOD("_throw_on_access", func); + }); + + /* -----[ boolean/negation helpers ]----- */ + + // methods to determine whether an expression has a boolean result type + (function (def){ + var unary_bool = [ "!", "delete" ]; + var binary_bool = [ "in", "instanceof", "==", "!=", "===", "!==", "<", "<=", ">=", ">" ]; + def(AST_Node, return_false); + def(AST_UnaryPrefix, function(){ + return member(this.operator, unary_bool); + }); + def(AST_Binary, function(){ + return member(this.operator, binary_bool) || + ( (this.operator == "&&" || this.operator == "||") && + this.left.is_boolean() && this.right.is_boolean() ); + }); + def(AST_Conditional, function(){ + return this.consequent.is_boolean() && this.alternative.is_boolean(); + }); + def(AST_Assign, function(){ + return this.operator == "=" && this.right.is_boolean(); + }); + def(AST_Seq, function(){ + return this.cdr.is_boolean(); + }); + def(AST_True, return_true); + def(AST_False, return_true); + })(function(node, func){ + node.DEFMETHOD("is_boolean", func); + }); + + // methods to determine if an expression has a numeric result type + (function (def){ + def(AST_Node, return_false); + def(AST_Number, return_true); + var unary = makePredicate("+ - ~ ++ --"); + def(AST_Unary, function(){ + return unary(this.operator); + }); + var binary = makePredicate("- * / % & | ^ << >> >>>"); + def(AST_Binary, function(compressor){ + return binary(this.operator) || this.operator == "+" + && this.left.is_number(compressor) + && this.right.is_number(compressor); + }); + def(AST_Assign, function(compressor){ + return binary(this.operator.slice(0, -1)) + || this.operator == "=" && this.right.is_number(compressor); + }); + def(AST_Seq, function(compressor){ + return this.cdr.is_number(compressor); + }); + def(AST_Conditional, function(compressor){ + return this.consequent.is_number(compressor) && this.alternative.is_number(compressor); + }); + })(function(node, func){ + node.DEFMETHOD("is_number", func); + }); + + // methods to determine if an expression has a string result type + (function (def){ + def(AST_Node, return_false); + def(AST_String, return_true); + def(AST_UnaryPrefix, function(){ + return this.operator == "typeof"; + }); + def(AST_Binary, function(compressor){ + return this.operator == "+" && + (this.left.is_string(compressor) || this.right.is_string(compressor)); + }); + def(AST_Assign, function(compressor){ + return (this.operator == "=" || this.operator == "+=") && this.right.is_string(compressor); + }); + def(AST_Seq, function(compressor){ + return this.cdr.is_string(compressor); + }); + def(AST_Conditional, function(compressor){ + return this.consequent.is_string(compressor) && this.alternative.is_string(compressor); + }); + })(function(node, func){ + node.DEFMETHOD("is_string", func); + }); + + var unary_side_effects = makePredicate("delete ++ --"); + + function is_lhs(node, parent) { + if (parent instanceof AST_Unary && unary_side_effects(parent.operator)) return parent.expression; + if (parent instanceof AST_Assign && parent.left === node) return node; + } + + (function (def){ + AST_Node.DEFMETHOD("resolve_defines", function(compressor) { + if (!compressor.option("global_defs")) return; + var def = this._find_defs(compressor, ""); + if (def) { + var node, parent = this, level = 0; + do { + node = parent; + parent = compressor.parent(level++); + } while (parent instanceof AST_PropAccess && parent.expression === node); + if (is_lhs(node, parent)) { + compressor.warn('global_defs ' + this.print_to_string() + ' redefined [{file}:{line},{col}]', this.start); + } else { + return def; + } + } + }); + function to_node(value, orig) { + if (value instanceof AST_Node) return make_node(value.CTOR, orig, value); + if (Array.isArray(value)) return make_node(AST_Array, orig, { + elements: value.map(function(value) { + return to_node(value, orig); + }) + }); + if (value && typeof value == "object") { + var props = []; + for (var key in value) { + props.push(make_node(AST_ObjectKeyVal, orig, { + key: key, + value: to_node(value[key], orig) + })); + } + return make_node(AST_Object, orig, { + properties: props + }); + } + return make_node_from_constant(value, orig); + } + def(AST_Node, noop); + def(AST_Dot, function(compressor, suffix){ + return this.expression._find_defs(compressor, "." + this.property + suffix); + }); + def(AST_SymbolRef, function(compressor, suffix){ + if (!this.global()) return; + var name; + var defines = compressor.option("global_defs"); + if (defines && HOP(defines, (name = this.name + suffix))) { + var node = to_node(defines[name], this); + var top = compressor.find_parent(AST_Toplevel); + node.walk(new TreeWalker(function(node) { + if (node instanceof AST_SymbolRef) { + node.scope = top; + node.thedef = top.def_global(node); + } + })); + return node; + } + }); + })(function(node, func){ + node.DEFMETHOD("_find_defs", func); + }); + + function best_of_expression(ast1, ast2) { + return ast1.print_to_string().length > + ast2.print_to_string().length + ? ast2 : ast1; + } + + function best_of_statement(ast1, ast2) { + return best_of_expression(make_node(AST_SimpleStatement, ast1, { + body: ast1 + }), make_node(AST_SimpleStatement, ast2, { + body: ast2 + })).body; + } + + function best_of(compressor, ast1, ast2) { + return (first_in_statement(compressor) ? best_of_statement : best_of_expression)(ast1, ast2); + } + + // methods to evaluate a constant expression + (function (def){ + // If the node has been successfully reduced to a constant, + // then its value is returned; otherwise the element itself + // is returned. + // They can be distinguished as constant value is never a + // descendant of AST_Node. + AST_Node.DEFMETHOD("evaluate", function(compressor){ + if (!compressor.option("evaluate")) return this; + try { + var val = this._eval(compressor); + return !val || val instanceof RegExp || typeof val != "object" ? val : this; + } catch(ex) { + if (ex !== def) throw ex; + return this; + } + }); + var unaryPrefix = makePredicate("! ~ - + void"); + AST_Node.DEFMETHOD("is_constant", function(){ + // Accomodate when compress option evaluate=false + // as well as the common constant expressions !0 and -1 + if (this instanceof AST_Constant) { + return !(this instanceof AST_RegExp); + } else { + return this instanceof AST_UnaryPrefix + && this.expression instanceof AST_Constant + && unaryPrefix(this.operator); + } + }); + // Obtain the constant value of an expression already known to be constant. + // Result only valid iff this.is_constant() is true. + AST_Node.DEFMETHOD("constant_value", function(compressor){ + // Accomodate when option evaluate=false. + if (this instanceof AST_Constant && !(this instanceof AST_RegExp)) { + return this.value; + } + // Accomodate the common constant expressions !0 and -1 when option evaluate=false. + if (this instanceof AST_UnaryPrefix + && this.expression instanceof AST_Constant) switch (this.operator) { + case "!": + return !this.expression.value; + case "~": + return ~this.expression.value; + case "-": + return -this.expression.value; + case "+": + return +this.expression.value; + default: + throw new Error(string_template("Cannot evaluate unary expression {value}", { + value: this.print_to_string() + })); + } + var result = this.evaluate(compressor); + if (result !== this) { + return result; + } + throw new Error(string_template("Cannot evaluate constant [{file}:{line},{col}]", this.start)); + }); + def(AST_Statement, function(){ + throw new Error(string_template("Cannot evaluate a statement [{file}:{line},{col}]", this.start)); + }); + def(AST_Lambda, function(){ + throw def; + }); + function ev(node, compressor) { + if (!compressor) throw new Error("Compressor must be passed"); + + return node._eval(compressor); + }; + def(AST_Node, function(){ + throw def; // not constant + }); + def(AST_Constant, function(){ + return this.getValue(); + }); + def(AST_Array, function(compressor){ + if (compressor.option("unsafe")) { + return this.elements.map(function(element) { + return ev(element, compressor); + }); + } + throw def; + }); + def(AST_Object, function(compressor){ + if (compressor.option("unsafe")) { + var val = {}; + for (var i = 0, len = this.properties.length; i < len; i++) { + var prop = this.properties[i]; + var key = prop.key; + if (key instanceof AST_Symbol) { + key = key.name; + } else if (key instanceof AST_Node) { + key = ev(key, compressor); + } + if (typeof Object.prototype[key] === 'function') { + throw def; + } + val[key] = ev(prop.value, compressor); + } + return val; + } + throw def; + }); + def(AST_UnaryPrefix, function(compressor){ + var e = this.expression; + switch (this.operator) { + case "!": return !ev(e, compressor); + case "typeof": + // Function would be evaluated to an array and so typeof would + // incorrectly return 'object'. Hence making is a special case. + if (e instanceof AST_Function) return typeof function(){}; + + e = ev(e, compressor); + + // typeof returns "object" or "function" on different platforms + // so cannot evaluate reliably + if (e instanceof RegExp) throw def; + + return typeof e; + case "void": return void ev(e, compressor); + case "~": return ~ev(e, compressor); + case "-": return -ev(e, compressor); + case "+": return +ev(e, compressor); + } + throw def; + }); + def(AST_Binary, function(c){ + var left = this.left, right = this.right, result; + switch (this.operator) { + case "&&" : result = ev(left, c) && ev(right, c); break; + case "||" : result = ev(left, c) || ev(right, c); break; + case "|" : result = ev(left, c) | ev(right, c); break; + case "&" : result = ev(left, c) & ev(right, c); break; + case "^" : result = ev(left, c) ^ ev(right, c); break; + case "+" : result = ev(left, c) + ev(right, c); break; + case "*" : result = ev(left, c) * ev(right, c); break; + case "/" : result = ev(left, c) / ev(right, c); break; + case "%" : result = ev(left, c) % ev(right, c); break; + case "-" : result = ev(left, c) - ev(right, c); break; + case "<<" : result = ev(left, c) << ev(right, c); break; + case ">>" : result = ev(left, c) >> ev(right, c); break; + case ">>>" : result = ev(left, c) >>> ev(right, c); break; + case "==" : result = ev(left, c) == ev(right, c); break; + case "===" : result = ev(left, c) === ev(right, c); break; + case "!=" : result = ev(left, c) != ev(right, c); break; + case "!==" : result = ev(left, c) !== ev(right, c); break; + case "<" : result = ev(left, c) < ev(right, c); break; + case "<=" : result = ev(left, c) <= ev(right, c); break; + case ">" : result = ev(left, c) > ev(right, c); break; + case ">=" : result = ev(left, c) >= ev(right, c); break; + default: + throw def; + } + if (isNaN(result) && c.find_parent(AST_With)) { + // leave original expression as is + throw def; + } + return result; + }); + def(AST_Conditional, function(compressor){ + return ev(this.condition, compressor) + ? ev(this.consequent, compressor) + : ev(this.alternative, compressor); + }); + def(AST_SymbolRef, function(compressor){ + if (!compressor.option("reduce_vars") || this._evaluating) throw def; + this._evaluating = true; + try { + var fixed = this.fixed_value(); + if (!fixed) throw def; + var value = ev(fixed, compressor); + if (!HOP(fixed, "_eval")) fixed._eval = function() { + return value; + }; + if (value && typeof value == "object" && this.definition().escaped) throw def; + return value; + } finally { + this._evaluating = false; + } + }); + def(AST_PropAccess, function(compressor){ + if (compressor.option("unsafe")) { + var key = this.property; + if (key instanceof AST_Node) { + key = ev(key, compressor); + } + var val = ev(this.expression, compressor); + if (val && HOP(val, key)) { + return val[key]; + } + } + throw def; + }); + })(function(node, func){ + node.DEFMETHOD("_eval", func); + }); + + // method to negate an expression + (function(def){ + function basic_negation(exp) { + return make_node(AST_UnaryPrefix, exp, { + operator: "!", + expression: exp + }); + } + function best(orig, alt, first_in_statement) { + var negated = basic_negation(orig); + if (first_in_statement) { + var stat = make_node(AST_SimpleStatement, alt, { + body: alt + }); + return best_of_expression(negated, stat) === stat ? alt : negated; + } + return best_of_expression(negated, alt); + } + def(AST_Node, function(){ + return basic_negation(this); + }); + def(AST_Statement, function(){ + throw new Error("Cannot negate a statement"); + }); + def(AST_Function, function(){ + return basic_negation(this); + }); + def(AST_UnaryPrefix, function(){ + if (this.operator == "!") + return this.expression; + return basic_negation(this); + }); + def(AST_Seq, function(compressor){ + var self = this.clone(); + self.cdr = self.cdr.negate(compressor); + return self; + }); + def(AST_Conditional, function(compressor, first_in_statement){ + var self = this.clone(); + self.consequent = self.consequent.negate(compressor); + self.alternative = self.alternative.negate(compressor); + return best(this, self, first_in_statement); + }); + def(AST_Binary, function(compressor, first_in_statement){ + var self = this.clone(), op = this.operator; + if (compressor.option("unsafe_comps")) { + switch (op) { + case "<=" : self.operator = ">" ; return self; + case "<" : self.operator = ">=" ; return self; + case ">=" : self.operator = "<" ; return self; + case ">" : self.operator = "<=" ; return self; + } + } + switch (op) { + case "==" : self.operator = "!="; return self; + case "!=" : self.operator = "=="; return self; + case "===": self.operator = "!=="; return self; + case "!==": self.operator = "==="; return self; + case "&&": + self.operator = "||"; + self.left = self.left.negate(compressor, first_in_statement); + self.right = self.right.negate(compressor); + return best(this, self, first_in_statement); + case "||": + self.operator = "&&"; + self.left = self.left.negate(compressor, first_in_statement); + self.right = self.right.negate(compressor); + return best(this, self, first_in_statement); + } + return basic_negation(this); + }); + })(function(node, func){ + node.DEFMETHOD("negate", function(compressor, first_in_statement){ + return func.call(this, compressor, first_in_statement); + }); + }); + + AST_Call.DEFMETHOD("has_pure_annotation", function(compressor) { + if (!compressor.option("side_effects")) return false; + if (this.pure !== undefined) return this.pure; + var pure = false; + var comments, last_comment; + if (this.start + && (comments = this.start.comments_before) + && comments.length + && /[@#]__PURE__/.test((last_comment = comments[comments.length - 1]).value)) { + pure = last_comment; + } + return this.pure = pure; + }); + + // determine if expression has side effects + (function(def){ + def(AST_Node, return_true); + + def(AST_EmptyStatement, return_false); + def(AST_Constant, return_false); + def(AST_This, return_false); + + def(AST_Call, function(compressor){ + if (!this.has_pure_annotation(compressor) && compressor.pure_funcs(this)) return true; + for (var i = this.args.length; --i >= 0;) { + if (this.args[i].has_side_effects(compressor)) + return true; + } + return false; + }); + + function any(list, compressor) { + for (var i = list.length; --i >= 0;) + if (list[i].has_side_effects(compressor)) + return true; + return false; + } + + def(AST_Block, function(compressor){ + return any(this.body, compressor); + }); + def(AST_Switch, function(compressor){ + return this.expression.has_side_effects(compressor) + || any(this.body, compressor); + }); + def(AST_Case, function(compressor){ + return this.expression.has_side_effects(compressor) + || any(this.body, compressor); + }); + def(AST_Try, function(compressor){ + return any(this.body, compressor) + || this.bcatch && this.bcatch.has_side_effects(compressor) + || this.bfinally && this.bfinally.has_side_effects(compressor); + }); + def(AST_If, function(compressor){ + return this.condition.has_side_effects(compressor) + || this.body && this.body.has_side_effects(compressor) + || this.alternative && this.alternative.has_side_effects(compressor); + }); + def(AST_LabeledStatement, function(compressor){ + return this.body.has_side_effects(compressor); + }); + def(AST_SimpleStatement, function(compressor){ + return this.body.has_side_effects(compressor); + }); + def(AST_Defun, return_true); + def(AST_Function, return_false); + def(AST_Binary, function(compressor){ + return this.left.has_side_effects(compressor) + || this.right.has_side_effects(compressor); + }); + def(AST_Assign, return_true); + def(AST_Conditional, function(compressor){ + return this.condition.has_side_effects(compressor) + || this.consequent.has_side_effects(compressor) + || this.alternative.has_side_effects(compressor); + }); + def(AST_Unary, function(compressor){ + return unary_side_effects(this.operator) + || this.expression.has_side_effects(compressor); + }); + def(AST_SymbolRef, function(compressor){ + return this.undeclared(); + }); + def(AST_Object, function(compressor){ + return any(this.properties, compressor); + }); + def(AST_ObjectProperty, function(compressor){ + return this.value.has_side_effects(compressor); + }); + def(AST_Array, function(compressor){ + return any(this.elements, compressor); + }); + def(AST_Dot, function(compressor){ + return this.expression.may_throw_on_access(compressor) + || this.expression.has_side_effects(compressor); + }); + def(AST_Sub, function(compressor){ + return this.expression.may_throw_on_access(compressor) + || this.expression.has_side_effects(compressor) + || this.property.has_side_effects(compressor); + }); + def(AST_Seq, function(compressor){ + return this.car.has_side_effects(compressor) + || this.cdr.has_side_effects(compressor); + }); + })(function(node, func){ + node.DEFMETHOD("has_side_effects", func); + }); + + // tell me if a statement aborts + function aborts(thing) { + return thing && thing.aborts(); + }; + (function(def){ + def(AST_Statement, return_null); + def(AST_Jump, return_this); + function block_aborts(){ + var n = this.body.length; + return n > 0 && aborts(this.body[n - 1]); + }; + def(AST_BlockStatement, block_aborts); + def(AST_SwitchBranch, block_aborts); + def(AST_If, function(){ + return this.alternative && aborts(this.body) && aborts(this.alternative) && this; + }); + })(function(node, func){ + node.DEFMETHOD("aborts", func); + }); + + /* -----[ optimizers ]----- */ + + OPT(AST_Directive, function(self, compressor){ + if (compressor.has_directive(self.value) !== self) { + return make_node(AST_EmptyStatement, self); + } + return self; + }); + + OPT(AST_Debugger, function(self, compressor){ + if (compressor.option("drop_debugger")) + return make_node(AST_EmptyStatement, self); + return self; + }); + + OPT(AST_LabeledStatement, function(self, compressor){ + if (self.body instanceof AST_Break + && compressor.loopcontrol_target(self.body) === self.body) { + return make_node(AST_EmptyStatement, self); + } + return self.label.references.length == 0 ? self.body : self; + }); + + OPT(AST_Block, function(self, compressor){ + self.body = tighten_body(self.body, compressor); + return self; + }); + + OPT(AST_BlockStatement, function(self, compressor){ + self.body = tighten_body(self.body, compressor); + switch (self.body.length) { + case 1: return self.body[0]; + case 0: return make_node(AST_EmptyStatement, self); + } + return self; + }); + + AST_Scope.DEFMETHOD("drop_unused", function(compressor){ + var self = this; + if (compressor.has_directive("use asm")) return self; + var toplevel = compressor.option("toplevel"); + if (compressor.option("unused") + && (!(self instanceof AST_Toplevel) || toplevel) + && !self.uses_eval + && !self.uses_with) { + var assign_as_unused = !/keep_assign/.test(compressor.option("unused")); + var drop_funcs = /funcs/.test(toplevel); + var drop_vars = /vars/.test(toplevel); + if (!(self instanceof AST_Toplevel) || toplevel == true) { + drop_funcs = drop_vars = true; + } + var in_use = []; + var in_use_ids = Object.create(null); // avoid expensive linear scans of in_use + if (self instanceof AST_Toplevel && compressor.top_retain) { + self.variables.each(function(def) { + if (compressor.top_retain(def) && !(def.id in in_use_ids)) { + in_use_ids[def.id] = true; + in_use.push(def); + } + }); + } + var initializations = new Dictionary(); + // pass 1: find out which symbols are directly used in + // this scope (not in nested scopes). + var scope = this; + var tw = new TreeWalker(function(node, descend){ + if (node !== self) { + if (node instanceof AST_Defun) { + if (!drop_funcs && scope === self) { + var node_def = node.name.definition(); + if (!(node_def.id in in_use_ids)) { + in_use_ids[node_def.id] = true; + in_use.push(node_def); + } + } + initializations.add(node.name.name, node); + return true; // don't go in nested scopes + } + if (node instanceof AST_Definitions && scope === self) { + node.definitions.forEach(function(def){ + if (!drop_vars) { + var node_def = def.name.definition(); + if (!(node_def.id in in_use_ids)) { + in_use_ids[node_def.id] = true; + in_use.push(node_def); + } + } + if (def.value) { + initializations.add(def.name.name, def.value); + if (def.value.has_side_effects(compressor)) { + def.value.walk(tw); + } + } + }); + return true; + } + if (assign_as_unused + && node instanceof AST_Assign + && node.operator == "=" + && node.left instanceof AST_SymbolRef + && !is_reference_const(node.left) + && scope === self) { + node.right.walk(tw); + return true; + } + if (node instanceof AST_SymbolRef) { + var node_def = node.definition(); + if (!(node_def.id in in_use_ids)) { + in_use_ids[node_def.id] = true; + in_use.push(node_def); + } + return true; + } + if (node instanceof AST_Scope) { + var save_scope = scope; + scope = node; + descend(); + scope = save_scope; + return true; + } + } + }); + self.walk(tw); + // pass 2: for every used symbol we need to walk its + // initialization code to figure out if it uses other + // symbols (that may not be in_use). + for (var i = 0; i < in_use.length; ++i) { + in_use[i].orig.forEach(function(decl){ + // undeclared globals will be instanceof AST_SymbolRef + var init = initializations.get(decl.name); + if (init) init.forEach(function(init){ + var tw = new TreeWalker(function(node){ + if (node instanceof AST_SymbolRef) { + var node_def = node.definition(); + if (!(node_def.id in in_use_ids)) { + in_use_ids[node_def.id] = true; + in_use.push(node_def); + } + } + }); + init.walk(tw); + }); + }); + } + // pass 3: we should drop declarations not in_use + var tt = new TreeTransformer( + function before(node, descend, in_list) { + if (node instanceof AST_Function + && node.name + && !compressor.option("keep_fnames")) { + var def = node.name.definition(); + // any declarations with same name will overshadow + // name of this anonymous function and can therefore + // never be used anywhere + if (!(def.id in in_use_ids) || def.orig.length > 1) + node.name = null; + } + if (node instanceof AST_Lambda && !(node instanceof AST_Accessor)) { + var trim = !compressor.option("keep_fargs"); + for (var a = node.argnames, i = a.length; --i >= 0;) { + var sym = a[i]; + if (!(sym.definition().id in in_use_ids)) { + sym.__unused = true; + if (trim) { + a.pop(); + compressor[sym.unreferenced() ? "warn" : "info"]("Dropping unused function argument {name} [{file}:{line},{col}]", { + name : sym.name, + file : sym.start.file, + line : sym.start.line, + col : sym.start.col + }); + } + } + else { + trim = false; + } + } + } + if (drop_funcs && node instanceof AST_Defun && node !== self) { + if (!(node.name.definition().id in in_use_ids)) { + compressor[node.name.unreferenced() ? "warn" : "info"]("Dropping unused function {name} [{file}:{line},{col}]", { + name : node.name.name, + file : node.name.start.file, + line : node.name.start.line, + col : node.name.start.col + }); + return make_node(AST_EmptyStatement, node); + } + return node; + } + if (drop_vars && node instanceof AST_Definitions && !(tt.parent() instanceof AST_ForIn && tt.parent().init === node)) { + var def = node.definitions.filter(function(def){ + if (def.value) def.value = def.value.transform(tt); + var sym = def.name.definition(); + if (sym.id in in_use_ids) return true; + if (sym.orig[0] instanceof AST_SymbolCatch) { + def.value = def.value && def.value.drop_side_effect_free(compressor); + return true; + } + var w = { + name : def.name.name, + file : def.name.start.file, + line : def.name.start.line, + col : def.name.start.col + }; + if (def.value && (def._unused_side_effects = def.value.drop_side_effect_free(compressor))) { + compressor.warn("Side effects in initialization of unused variable {name} [{file}:{line},{col}]", w); + return true; + } + compressor[def.name.unreferenced() ? "warn" : "info"]("Dropping unused variable {name} [{file}:{line},{col}]", w); + return false; + }); + // place uninitialized names at the start + def = mergeSort(def, function(a, b){ + if (!a.value && b.value) return -1; + if (!b.value && a.value) return 1; + return 0; + }); + // for unused names whose initialization has + // side effects, we can cascade the init. code + // into the next one, or next statement. + var side_effects = []; + for (var i = 0; i < def.length;) { + var x = def[i]; + if (x._unused_side_effects) { + side_effects.push(x._unused_side_effects); + def.splice(i, 1); + } else { + if (side_effects.length > 0) { + side_effects.push(x.value); + x.value = AST_Seq.from_array(side_effects); + side_effects = []; + } + ++i; + } + } + if (side_effects.length > 0) { + side_effects = make_node(AST_BlockStatement, node, { + body: [ make_node(AST_SimpleStatement, node, { + body: AST_Seq.from_array(side_effects) + }) ] + }); + } else { + side_effects = null; + } + if (def.length == 0 && !side_effects) { + return make_node(AST_EmptyStatement, node); + } + if (def.length == 0) { + return in_list ? MAP.splice(side_effects.body) : side_effects; + } + node.definitions = def; + if (side_effects) { + side_effects.body.unshift(node); + return in_list ? MAP.splice(side_effects.body) : side_effects; + } + return node; + } + if (drop_vars && assign_as_unused + && node instanceof AST_Assign + && node.operator == "=" + && node.left instanceof AST_SymbolRef) { + var def = node.left.definition(); + if (!(def.id in in_use_ids) + && self.variables.get(def.name) === def) { + return maintain_this_binding(tt.parent(), node, node.right.transform(tt)); + } + } + // certain combination of unused name + side effect leads to: + // https://github.com/mishoo/UglifyJS2/issues/44 + // https://github.com/mishoo/UglifyJS2/issues/1830 + // that's an invalid AST. + // We fix it at this stage by moving the `var` outside the `for`. + if (node instanceof AST_For) { + descend(node, this); + if (node.init instanceof AST_BlockStatement) { + var block = node.init; + node.init = block.body.pop(); + block.body.push(node); + return in_list ? MAP.splice(block.body) : block; + } else if (is_empty(node.init)) { + node.init = null; + } + return node; + } + if (node instanceof AST_LabeledStatement && node.body instanceof AST_For) { + descend(node, this); + if (node.body instanceof AST_BlockStatement) { + var block = node.body; + node.body = block.body.pop(); + block.body.push(node); + return in_list ? MAP.splice(block.body) : block; + } + return node; + } + if (node instanceof AST_Scope && node !== self) + return node; + } + ); + self.transform(tt); + } + }); + + AST_Scope.DEFMETHOD("hoist_declarations", function(compressor){ + var self = this; + if (compressor.has_directive("use asm")) return self; + var hoist_funs = compressor.option("hoist_funs"); + var hoist_vars = compressor.option("hoist_vars"); + if (hoist_funs || hoist_vars) { + var dirs = []; + var hoisted = []; + var vars = new Dictionary(), vars_found = 0, var_decl = 0; + // let's count var_decl first, we seem to waste a lot of + // space if we hoist `var` when there's only one. + self.walk(new TreeWalker(function(node){ + if (node instanceof AST_Scope && node !== self) + return true; + if (node instanceof AST_Var) { + ++var_decl; + return true; + } + })); + hoist_vars = hoist_vars && var_decl > 1; + var tt = new TreeTransformer( + function before(node) { + if (node !== self) { + if (node instanceof AST_Directive) { + dirs.push(node); + return make_node(AST_EmptyStatement, node); + } + if (node instanceof AST_Defun && hoist_funs) { + hoisted.push(node); + return make_node(AST_EmptyStatement, node); + } + if (node instanceof AST_Var && hoist_vars) { + node.definitions.forEach(function(def){ + vars.set(def.name.name, def); + ++vars_found; + }); + var seq = node.to_assignments(compressor); + var p = tt.parent(); + if (p instanceof AST_ForIn && p.init === node) { + if (seq == null) { + var def = node.definitions[0].name; + return make_node(AST_SymbolRef, def, def); + } + return seq; + } + if (p instanceof AST_For && p.init === node) { + return seq; + } + if (!seq) return make_node(AST_EmptyStatement, node); + return make_node(AST_SimpleStatement, node, { + body: seq + }); + } + if (node instanceof AST_Scope) + return node; // to avoid descending in nested scopes + } + } + ); + self = self.transform(tt); + if (vars_found > 0) { + // collect only vars which don't show up in self's arguments list + var defs = []; + vars.each(function(def, name){ + if (self instanceof AST_Lambda + && find_if(function(x){ return x.name == def.name.name }, + self.argnames)) { + vars.del(name); + } else { + def = def.clone(); + def.value = null; + defs.push(def); + vars.set(name, def); + } + }); + if (defs.length > 0) { + // try to merge in assignments + for (var i = 0; i < self.body.length;) { + if (self.body[i] instanceof AST_SimpleStatement) { + var expr = self.body[i].body, sym, assign; + if (expr instanceof AST_Assign + && expr.operator == "=" + && (sym = expr.left) instanceof AST_Symbol + && vars.has(sym.name)) + { + var def = vars.get(sym.name); + if (def.value) break; + def.value = expr.right; + remove(defs, def); + defs.push(def); + self.body.splice(i, 1); + continue; + } + if (expr instanceof AST_Seq + && (assign = expr.car) instanceof AST_Assign + && assign.operator == "=" + && (sym = assign.left) instanceof AST_Symbol + && vars.has(sym.name)) + { + var def = vars.get(sym.name); + if (def.value) break; + def.value = assign.right; + remove(defs, def); + defs.push(def); + self.body[i].body = expr.cdr; + continue; + } + } + if (self.body[i] instanceof AST_EmptyStatement) { + self.body.splice(i, 1); + continue; + } + if (self.body[i] instanceof AST_BlockStatement) { + var tmp = [ i, 1 ].concat(self.body[i].body); + self.body.splice.apply(self.body, tmp); + continue; + } + break; + } + defs = make_node(AST_Var, self, { + definitions: defs + }); + hoisted.push(defs); + }; + } + self.body = dirs.concat(hoisted, self.body); + } + return self; + }); + + // drop_side_effect_free() + // remove side-effect-free parts which only affects return value + (function(def){ + // Drop side-effect-free elements from an array of expressions. + // Returns an array of expressions with side-effects or null + // if all elements were dropped. Note: original array may be + // returned if nothing changed. + function trim(nodes, compressor, first_in_statement) { + var ret = [], changed = false; + for (var i = 0, len = nodes.length; i < len; i++) { + var node = nodes[i].drop_side_effect_free(compressor, first_in_statement); + changed |= node !== nodes[i]; + if (node) { + ret.push(node); + first_in_statement = false; + } + } + return changed ? ret.length ? ret : null : nodes; + } + + def(AST_Node, return_this); + def(AST_Constant, return_null); + def(AST_This, return_null); + def(AST_Call, function(compressor, first_in_statement){ + if (!this.has_pure_annotation(compressor) && compressor.pure_funcs(this)) { + if (this.expression instanceof AST_Function + && (!this.expression.name || !this.expression.name.definition().references.length)) { + var node = this.clone(); + node.expression = node.expression.process_expression(false, compressor); + return node; + } + return this; + } + if (this.pure) { + compressor.warn("Dropping __PURE__ call [{file}:{line},{col}]", this.start); + this.pure.value = this.pure.value.replace(/[@#]__PURE__/g, ' '); + } + var args = trim(this.args, compressor, first_in_statement); + return args && AST_Seq.from_array(args); + }); + def(AST_Accessor, return_null); + def(AST_Function, return_null); + def(AST_Binary, function(compressor, first_in_statement){ + var right = this.right.drop_side_effect_free(compressor); + if (!right) return this.left.drop_side_effect_free(compressor, first_in_statement); + switch (this.operator) { + case "&&": + case "||": + if (right === this.right) return this; + var node = this.clone(); + node.right = right; + return node; + default: + var left = this.left.drop_side_effect_free(compressor, first_in_statement); + if (!left) return this.right.drop_side_effect_free(compressor, first_in_statement); + return make_node(AST_Seq, this, { + car: left, + cdr: right + }); + } + }); + def(AST_Assign, return_this); + def(AST_Conditional, function(compressor){ + var consequent = this.consequent.drop_side_effect_free(compressor); + var alternative = this.alternative.drop_side_effect_free(compressor); + if (consequent === this.consequent && alternative === this.alternative) return this; + if (!consequent) return alternative ? make_node(AST_Binary, this, { + operator: "||", + left: this.condition, + right: alternative + }) : this.condition.drop_side_effect_free(compressor); + if (!alternative) return make_node(AST_Binary, this, { + operator: "&&", + left: this.condition, + right: consequent + }); + var node = this.clone(); + node.consequent = consequent; + node.alternative = alternative; + return node; + }); + def(AST_Unary, function(compressor, first_in_statement){ + if (unary_side_effects(this.operator)) return this; + if (this.operator == "typeof" && this.expression instanceof AST_SymbolRef) return null; + var expression = this.expression.drop_side_effect_free(compressor, first_in_statement); + if (first_in_statement + && this instanceof AST_UnaryPrefix + && is_iife_call(expression)) { + if (expression === this.expression && this.operator.length === 1) return this; + return make_node(AST_UnaryPrefix, this, { + operator: this.operator.length === 1 ? this.operator : "!", + expression: expression + }); + } + return expression; + }); + def(AST_SymbolRef, function() { + return this.undeclared() ? this : null; + }); + def(AST_Object, function(compressor, first_in_statement){ + var values = trim(this.properties, compressor, first_in_statement); + return values && AST_Seq.from_array(values); + }); + def(AST_ObjectProperty, function(compressor, first_in_statement){ + return this.value.drop_side_effect_free(compressor, first_in_statement); + }); + def(AST_Array, function(compressor, first_in_statement){ + var values = trim(this.elements, compressor, first_in_statement); + return values && AST_Seq.from_array(values); + }); + def(AST_Dot, function(compressor, first_in_statement){ + if (this.expression.may_throw_on_access(compressor)) return this; + return this.expression.drop_side_effect_free(compressor, first_in_statement); + }); + def(AST_Sub, function(compressor, first_in_statement){ + if (this.expression.may_throw_on_access(compressor)) return this; + var expression = this.expression.drop_side_effect_free(compressor, first_in_statement); + if (!expression) return this.property.drop_side_effect_free(compressor, first_in_statement); + var property = this.property.drop_side_effect_free(compressor); + if (!property) return expression; + return make_node(AST_Seq, this, { + car: expression, + cdr: property + }); + }); + def(AST_Seq, function(compressor){ + var cdr = this.cdr.drop_side_effect_free(compressor); + if (cdr === this.cdr) return this; + if (!cdr) return this.car; + return make_node(AST_Seq, this, { + car: this.car, + cdr: cdr + }); + }); + })(function(node, func){ + node.DEFMETHOD("drop_side_effect_free", func); + }); + + OPT(AST_SimpleStatement, function(self, compressor){ + if (compressor.option("side_effects")) { + var body = self.body; + var node = body.drop_side_effect_free(compressor, true); + if (!node) { + compressor.warn("Dropping side-effect-free statement [{file}:{line},{col}]", self.start); + return make_node(AST_EmptyStatement, self); + } + if (node !== body) { + return make_node(AST_SimpleStatement, self, { body: node }); + } + } + return self; + }); + + OPT(AST_DWLoop, function(self, compressor){ + if (!compressor.option("loops")) return self; + var cond = self.condition.evaluate(compressor); + if (cond !== self.condition) { + if (cond) { + return make_node(AST_For, self, { + body: self.body + }); + } + if (compressor.option("dead_code") && self instanceof AST_While) { + var a = []; + extract_declarations_from_unreachable_code(compressor, self.body, a); + return make_node(AST_BlockStatement, self, { body: a }).optimize(compressor); + } + if (self instanceof AST_Do) { + var has_loop_control = false; + var tw = new TreeWalker(function(node) { + if (node instanceof AST_Scope || has_loop_control) return true; + if (node instanceof AST_LoopControl && tw.loopcontrol_target(node) === self) + return has_loop_control = true; + }); + var parent = compressor.parent(); + (parent instanceof AST_LabeledStatement ? parent : self).walk(tw); + if (!has_loop_control) return self.body; + } + } + if (self instanceof AST_While) { + return make_node(AST_For, self, self).optimize(compressor); + } + return self; + }); + + function if_break_in_loop(self, compressor) { + function drop_it(rest) { + rest = as_statement_array(rest); + if (self.body instanceof AST_BlockStatement) { + self.body = self.body.clone(); + self.body.body = rest.concat(self.body.body.slice(1)); + self.body = self.body.transform(compressor); + } else { + self.body = make_node(AST_BlockStatement, self.body, { + body: rest + }).transform(compressor); + } + if_break_in_loop(self, compressor); + } + var first = self.body instanceof AST_BlockStatement ? self.body.body[0] : self.body; + if (first instanceof AST_If) { + if (first.body instanceof AST_Break + && compressor.loopcontrol_target(first.body) === compressor.self()) { + if (self.condition) { + self.condition = make_node(AST_Binary, self.condition, { + left: self.condition, + operator: "&&", + right: first.condition.negate(compressor), + }); + } else { + self.condition = first.condition.negate(compressor); + } + drop_it(first.alternative); + } + else if (first.alternative instanceof AST_Break + && compressor.loopcontrol_target(first.alternative) === compressor.self()) { + if (self.condition) { + self.condition = make_node(AST_Binary, self.condition, { + left: self.condition, + operator: "&&", + right: first.condition, + }); + } else { + self.condition = first.condition; + } + drop_it(first.body); + } + } + }; + + OPT(AST_For, function(self, compressor){ + if (!compressor.option("loops")) return self; + if (self.condition) { + var cond = self.condition.evaluate(compressor); + if (compressor.option("dead_code") && !cond) { + var a = []; + if (self.init instanceof AST_Statement) { + a.push(self.init); + } + else if (self.init) { + a.push(make_node(AST_SimpleStatement, self.init, { + body: self.init + })); + } + extract_declarations_from_unreachable_code(compressor, self.body, a); + return make_node(AST_BlockStatement, self, { body: a }).optimize(compressor); + } + if (cond !== self.condition) { + cond = make_node_from_constant(cond, self.condition).transform(compressor); + self.condition = best_of_expression(cond, self.condition); + } + } + if_break_in_loop(self, compressor); + return self; + }); + + OPT(AST_If, function(self, compressor){ + if (is_empty(self.alternative)) self.alternative = null; + + if (!compressor.option("conditionals")) return self; + // if condition can be statically determined, warn and drop + // one of the blocks. note, statically determined implies + // “has no side effects”; also it doesn't work for cases like + // `x && true`, though it probably should. + var cond = self.condition.evaluate(compressor); + if (cond !== self.condition) { + if (cond) { + compressor.warn("Condition always true [{file}:{line},{col}]", self.condition.start); + if (compressor.option("dead_code")) { + var a = []; + if (self.alternative) { + extract_declarations_from_unreachable_code(compressor, self.alternative, a); + } + a.push(self.body); + return make_node(AST_BlockStatement, self, { body: a }).optimize(compressor); + } + } else { + compressor.warn("Condition always false [{file}:{line},{col}]", self.condition.start); + if (compressor.option("dead_code")) { + var a = []; + extract_declarations_from_unreachable_code(compressor, self.body, a); + if (self.alternative) a.push(self.alternative); + return make_node(AST_BlockStatement, self, { body: a }).optimize(compressor); + } + } + cond = make_node_from_constant(cond, self.condition).transform(compressor); + self.condition = best_of_expression(cond, self.condition); + } + var negated = self.condition.negate(compressor); + var self_condition_length = self.condition.print_to_string().length; + var negated_length = negated.print_to_string().length; + var negated_is_best = negated_length < self_condition_length; + if (self.alternative && negated_is_best) { + negated_is_best = false; // because we already do the switch here. + // no need to swap values of self_condition_length and negated_length + // here because they are only used in an equality comparison later on. + self.condition = negated; + var tmp = self.body; + self.body = self.alternative || make_node(AST_EmptyStatement, self); + self.alternative = tmp; + } + if (is_empty(self.body) && is_empty(self.alternative)) { + return make_node(AST_SimpleStatement, self.condition, { + body: self.condition.clone() + }).optimize(compressor); + } + if (self.body instanceof AST_SimpleStatement + && self.alternative instanceof AST_SimpleStatement) { + return make_node(AST_SimpleStatement, self, { + body: make_node(AST_Conditional, self, { + condition : self.condition, + consequent : self.body.body, + alternative : self.alternative.body + }) + }).optimize(compressor); + } + if (is_empty(self.alternative) && self.body instanceof AST_SimpleStatement) { + if (self_condition_length === negated_length && !negated_is_best + && self.condition instanceof AST_Binary && self.condition.operator == "||") { + // although the code length of self.condition and negated are the same, + // negated does not require additional surrounding parentheses. + // see https://github.com/mishoo/UglifyJS2/issues/979 + negated_is_best = true; + } + if (negated_is_best) return make_node(AST_SimpleStatement, self, { + body: make_node(AST_Binary, self, { + operator : "||", + left : negated, + right : self.body.body + }) + }).optimize(compressor); + return make_node(AST_SimpleStatement, self, { + body: make_node(AST_Binary, self, { + operator : "&&", + left : self.condition, + right : self.body.body + }) + }).optimize(compressor); + } + if (self.body instanceof AST_EmptyStatement + && self.alternative instanceof AST_SimpleStatement) { + return make_node(AST_SimpleStatement, self, { + body: make_node(AST_Binary, self, { + operator : "||", + left : self.condition, + right : self.alternative.body + }) + }).optimize(compressor); + } + if (self.body instanceof AST_Exit + && self.alternative instanceof AST_Exit + && self.body.TYPE == self.alternative.TYPE) { + return make_node(self.body.CTOR, self, { + value: make_node(AST_Conditional, self, { + condition : self.condition, + consequent : self.body.value || make_node(AST_Undefined, self.body), + alternative : self.alternative.value || make_node(AST_Undefined, self.alternative) + }).transform(compressor) + }).optimize(compressor); + } + if (self.body instanceof AST_If + && !self.body.alternative + && !self.alternative) { + self = make_node(AST_If, self, { + condition: make_node(AST_Binary, self.condition, { + operator: "&&", + left: self.condition, + right: self.body.condition + }), + body: self.body.body, + alternative: null + }); + } + if (aborts(self.body)) { + if (self.alternative) { + var alt = self.alternative; + self.alternative = null; + return make_node(AST_BlockStatement, self, { + body: [ self, alt ] + }).optimize(compressor); + } + } + if (aborts(self.alternative)) { + var body = self.body; + self.body = self.alternative; + self.condition = negated_is_best ? negated : self.condition.negate(compressor); + self.alternative = null; + return make_node(AST_BlockStatement, self, { + body: [ self, body ] + }).optimize(compressor); + } + return self; + }); + + OPT(AST_Switch, function(self, compressor){ + if (!compressor.option("switches")) return self; + var branch; + var value = self.expression.evaluate(compressor); + if (value !== self.expression) { + var expression = make_node_from_constant(value, self.expression).transform(compressor); + self.expression = best_of_expression(expression, self.expression); + } + if (!compressor.option("dead_code")) return self; + var decl = []; + var body = []; + var default_branch; + var exact_match; + for (var i = 0, len = self.body.length; i < len && !exact_match; i++) { + branch = self.body[i]; + if (branch instanceof AST_Default) { + if (!default_branch) { + default_branch = branch; + } else { + eliminate_branch(branch, body[body.length - 1]); + } + } else if (value !== self.expression) { + var exp = branch.expression.evaluate(compressor); + if (exp === value) { + exact_match = branch; + if (default_branch) { + var default_index = body.indexOf(default_branch); + body.splice(default_index, 1); + eliminate_branch(default_branch, body[default_index - 1]); + default_branch = null; + } + } else if (exp !== branch.expression) { + eliminate_branch(branch, body[body.length - 1]); + continue; + } + } + if (aborts(branch)) { + var prev = body[body.length - 1]; + if (aborts(prev) && prev.body.length == branch.body.length + && make_node(AST_BlockStatement, prev, prev).equivalent_to(make_node(AST_BlockStatement, branch, branch))) { + prev.body = []; + } + } + body.push(branch); + } + while (i < len) eliminate_branch(self.body[i++], body[body.length - 1]); + if (body.length > 0) { + body[0].body = decl.concat(body[0].body); + } + self.body = body; + while (branch = body[body.length - 1]) { + var stat = branch.body[branch.body.length - 1]; + if (stat instanceof AST_Break && compressor.loopcontrol_target(stat) === self) + branch.body.pop(); + if (branch.body.length || branch instanceof AST_Case + && (default_branch || branch.expression.has_side_effects(compressor))) break; + if (body.pop() === default_branch) default_branch = null; + } + if (body.length == 0) { + return make_node(AST_BlockStatement, self, { + body: decl.concat(make_node(AST_SimpleStatement, self.expression, { + body: self.expression + })) + }).optimize(compressor); + } + if (body.length == 1 && (body[0] === exact_match || body[0] === default_branch)) { + var has_break = false; + var tw = new TreeWalker(function(node) { + if (has_break + || node instanceof AST_Lambda + || node instanceof AST_SimpleStatement) return true; + if (node instanceof AST_Break && tw.loopcontrol_target(node) === self) + has_break = true; + }); + self.walk(tw); + if (!has_break) { + body = body[0].body.slice(); + body.unshift(make_node(AST_SimpleStatement, self.expression, { + body: self.expression + })); + return make_node(AST_BlockStatement, self, { + body: body + }).optimize(compressor); + } + } + return self; + + function eliminate_branch(branch, prev) { + if (prev && !aborts(prev)) { + prev.body = prev.body.concat(branch.body); + } else { + extract_declarations_from_unreachable_code(compressor, branch, decl); + } + } + }); + + OPT(AST_Try, function(self, compressor){ + self.body = tighten_body(self.body, compressor); + if (self.bcatch && self.bfinally && all(self.bfinally.body, is_empty)) self.bfinally = null; + if (all(self.body, is_empty)) { + var body = []; + if (self.bcatch) extract_declarations_from_unreachable_code(compressor, self.bcatch, body); + if (self.bfinally) body = body.concat(self.bfinally.body); + return make_node(AST_BlockStatement, self, { + body: body + }).optimize(compressor); + } + return self; + }); + + AST_Definitions.DEFMETHOD("remove_initializers", function(){ + this.definitions.forEach(function(def){ def.value = null }); + }); + + AST_Definitions.DEFMETHOD("to_assignments", function(compressor){ + var reduce_vars = compressor.option("reduce_vars"); + var assignments = this.definitions.reduce(function(a, def){ + if (def.value) { + var name = make_node(AST_SymbolRef, def.name, def.name); + a.push(make_node(AST_Assign, def, { + operator : "=", + left : name, + right : def.value + })); + if (reduce_vars) name.definition().fixed = false; + } + return a; + }, []); + if (assignments.length == 0) return null; + return AST_Seq.from_array(assignments); + }); + + OPT(AST_Definitions, function(self, compressor){ + if (self.definitions.length == 0) + return make_node(AST_EmptyStatement, self); + return self; + }); + + OPT(AST_Call, function(self, compressor){ + var exp = self.expression; + if (compressor.option("reduce_vars") + && exp instanceof AST_SymbolRef) { + var def = exp.definition(); + var fixed = exp.fixed_value(); + if (fixed instanceof AST_Defun) { + def.fixed = fixed = make_node(AST_Function, fixed, fixed).clone(true); + } + if (fixed instanceof AST_Function) { + exp = fixed; + if (compressor.option("unused") + && def.references.length == 1 + && !(def.scope.uses_arguments + && def.orig[0] instanceof AST_SymbolFunarg) + && !def.scope.uses_eval + && compressor.find_parent(AST_Scope) === def.scope) { + self.expression = exp; + } + } + } + if (compressor.option("unused") + && exp instanceof AST_Function + && !exp.uses_arguments + && !exp.uses_eval) { + var pos = 0, last = 0; + for (var i = 0, len = self.args.length; i < len; i++) { + var trim = i >= exp.argnames.length; + if (trim || exp.argnames[i].__unused) { + var node = self.args[i].drop_side_effect_free(compressor); + if (node) { + self.args[pos++] = node; + } else if (!trim) { + self.args[pos++] = make_node(AST_Number, self.args[i], { + value: 0 + }); + continue; + } + } else { + self.args[pos++] = self.args[i]; + } + last = pos; + } + self.args.length = last; + } + if (compressor.option("unsafe")) { + if (exp instanceof AST_SymbolRef && exp.undeclared()) { + switch (exp.name) { + case "Array": + if (self.args.length != 1) { + return make_node(AST_Array, self, { + elements: self.args + }).optimize(compressor); + } + break; + case "Object": + if (self.args.length == 0) { + return make_node(AST_Object, self, { + properties: [] + }); + } + break; + case "String": + if (self.args.length == 0) return make_node(AST_String, self, { + value: "" + }); + if (self.args.length <= 1) return make_node(AST_Binary, self, { + left: self.args[0], + operator: "+", + right: make_node(AST_String, self, { value: "" }) + }).optimize(compressor); + break; + case "Number": + if (self.args.length == 0) return make_node(AST_Number, self, { + value: 0 + }); + if (self.args.length == 1) return make_node(AST_UnaryPrefix, self, { + expression: self.args[0], + operator: "+" + }).optimize(compressor); + case "Boolean": + if (self.args.length == 0) return make_node(AST_False, self); + if (self.args.length == 1) return make_node(AST_UnaryPrefix, self, { + expression: make_node(AST_UnaryPrefix, self, { + expression: self.args[0], + operator: "!" + }), + operator: "!" + }).optimize(compressor); + break; + case "Function": + // new Function() => function(){} + if (self.args.length == 0) return make_node(AST_Function, self, { + argnames: [], + body: [] + }); + if (all(self.args, function(x){ return x instanceof AST_String })) { + // quite a corner-case, but we can handle it: + // https://github.com/mishoo/UglifyJS2/issues/203 + // if the code argument is a constant, then we can minify it. + try { + var code = "(function(" + self.args.slice(0, -1).map(function(arg){ + return arg.value; + }).join(",") + "){" + self.args[self.args.length - 1].value + "})()"; + var ast = parse(code); + ast.figure_out_scope({ screw_ie8: compressor.option("screw_ie8") }); + var comp = new Compressor(compressor.options); + ast = ast.transform(comp); + ast.figure_out_scope({ screw_ie8: compressor.option("screw_ie8") }); + ast.mangle_names(); + var fun; + try { + ast.walk(new TreeWalker(function(node){ + if (node instanceof AST_Lambda) { + fun = node; + throw ast; + } + })); + } catch(ex) { + if (ex !== ast) throw ex; + }; + if (!fun) return self; + var args = fun.argnames.map(function(arg, i){ + return make_node(AST_String, self.args[i], { + value: arg.print_to_string() + }); + }); + var code = OutputStream(); + AST_BlockStatement.prototype._codegen.call(fun, fun, code); + code = code.toString().replace(/^\{|\}$/g, ""); + args.push(make_node(AST_String, self.args[self.args.length - 1], { + value: code + })); + self.args = args; + return self; + } catch(ex) { + if (ex instanceof JS_Parse_Error) { + compressor.warn("Error parsing code passed to new Function [{file}:{line},{col}]", self.args[self.args.length - 1].start); + compressor.warn(ex.toString()); + } else { + console.log(ex); + throw ex; + } + } + } + break; + } + } + else if (exp instanceof AST_Dot && exp.property == "toString" && self.args.length == 0) { + return make_node(AST_Binary, self, { + left: make_node(AST_String, self, { value: "" }), + operator: "+", + right: exp.expression + }).optimize(compressor); + } + else if (exp instanceof AST_Dot && exp.expression instanceof AST_Array && exp.property == "join") EXIT: { + var separator; + if (self.args.length > 0) { + separator = self.args[0].evaluate(compressor); + if (separator === self.args[0]) break EXIT; // not a constant + } + var elements = []; + var consts = []; + exp.expression.elements.forEach(function(el) { + var value = el.evaluate(compressor); + if (value !== el) { + consts.push(value); + } else { + if (consts.length > 0) { + elements.push(make_node(AST_String, self, { + value: consts.join(separator) + })); + consts.length = 0; + } + elements.push(el); + } + }); + if (consts.length > 0) { + elements.push(make_node(AST_String, self, { + value: consts.join(separator) + })); + } + if (elements.length == 0) return make_node(AST_String, self, { value: "" }); + if (elements.length == 1) { + if (elements[0].is_string(compressor)) { + return elements[0]; + } + return make_node(AST_Binary, elements[0], { + operator : "+", + left : make_node(AST_String, self, { value: "" }), + right : elements[0] + }); + } + if (separator == "") { + var first; + if (elements[0].is_string(compressor) + || elements[1].is_string(compressor)) { + first = elements.shift(); + } else { + first = make_node(AST_String, self, { value: "" }); + } + return elements.reduce(function(prev, el){ + return make_node(AST_Binary, el, { + operator : "+", + left : prev, + right : el + }); + }, first).optimize(compressor); + } + // need this awkward cloning to not affect original element + // best_of will decide which one to get through. + var node = self.clone(); + node.expression = node.expression.clone(); + node.expression.expression = node.expression.expression.clone(); + node.expression.expression.elements = elements; + return best_of(compressor, self, node); + } + else if (exp instanceof AST_Dot && exp.expression.is_string(compressor) && exp.property == "charAt") { + var arg = self.args[0]; + var index = arg ? arg.evaluate(compressor) : 0; + if (index !== arg) { + return make_node(AST_Sub, exp, { + expression: exp.expression, + property: make_node_from_constant(index | 0, arg || exp) + }).optimize(compressor); + } + } + } + if (exp instanceof AST_Function) { + if (exp.body[0] instanceof AST_Return) { + var value = exp.body[0].value; + if (!value || value.is_constant()) { + var args = self.args.concat(value || make_node(AST_Undefined, self)); + return AST_Seq.from_array(args).transform(compressor); + } + } + if (compressor.option("side_effects") && all(exp.body, is_empty)) { + var args = self.args.concat(make_node(AST_Undefined, self)); + return AST_Seq.from_array(args).transform(compressor); + } + } + if (compressor.option("drop_console")) { + if (exp instanceof AST_PropAccess) { + var name = exp.expression; + while (name.expression) { + name = name.expression; + } + if (name instanceof AST_SymbolRef + && name.name == "console" + && name.undeclared()) { + return make_node(AST_Undefined, self).optimize(compressor); + } + } + } + if (compressor.option("negate_iife") + && compressor.parent() instanceof AST_SimpleStatement + && is_iife_call(self)) { + return self.negate(compressor, true); + } + return self; + }); + + OPT(AST_New, function(self, compressor){ + if (compressor.option("unsafe")) { + var exp = self.expression; + if (exp instanceof AST_SymbolRef && exp.undeclared()) { + switch (exp.name) { + case "Object": + case "RegExp": + case "Function": + case "Error": + case "Array": + return make_node(AST_Call, self, self).transform(compressor); + } + } + } + return self; + }); + + OPT(AST_Seq, function(self, compressor){ + if (!compressor.option("side_effects")) + return self; + self.car = self.car.drop_side_effect_free(compressor, first_in_statement(compressor)); + if (!self.car) return maintain_this_binding(compressor.parent(), self, self.cdr); + if (compressor.option("cascade")) { + var left; + if (self.car instanceof AST_Assign + && !self.car.left.has_side_effects(compressor)) { + left = self.car.left; + } else if (self.car instanceof AST_Unary + && (self.car.operator == "++" || self.car.operator == "--")) { + left = self.car.expression; + } + if (left + && !(left instanceof AST_SymbolRef + && (left.definition().orig[0] instanceof AST_SymbolLambda + || is_reference_const(left)))) { + var parent, field; + var cdr = self.cdr; + while (true) { + if (cdr.equivalent_to(left)) { + var car = self.car instanceof AST_UnaryPostfix ? make_node(AST_UnaryPrefix, self.car, { + operator: self.car.operator, + expression: left + }) : self.car; + if (parent) { + parent[field] = car; + return self.cdr; + } + return car; + } + if (cdr instanceof AST_Binary && !(cdr instanceof AST_Assign)) { + if (cdr.left.is_constant()) { + if (cdr.operator == "||" || cdr.operator == "&&") break; + field = "right"; + } else { + field = "left"; + } + } else if (cdr instanceof AST_Call + || cdr instanceof AST_Unary && !unary_side_effects(cdr.operator)) { + field = "expression"; + } else break; + parent = cdr; + cdr = cdr[field]; + } + } + } + if (is_undefined(self.cdr, compressor)) { + return make_node(AST_UnaryPrefix, self, { + operator : "void", + expression : self.car + }); + } + return self; + }); + + AST_Unary.DEFMETHOD("lift_sequences", function(compressor){ + if (compressor.option("sequences")) { + if (this.expression instanceof AST_Seq) { + var seq = this.expression; + var x = seq.to_array(); + var e = this.clone(); + e.expression = x.pop(); + x.push(e); + seq = AST_Seq.from_array(x).transform(compressor); + return seq; + } + } + return this; + }); + + OPT(AST_UnaryPostfix, function(self, compressor){ + return self.lift_sequences(compressor); + }); + + OPT(AST_UnaryPrefix, function(self, compressor){ + var e = self.expression; + if (self.operator == "delete" + && !(e instanceof AST_SymbolRef + || e instanceof AST_PropAccess + || e instanceof AST_NaN + || e instanceof AST_Infinity + || e instanceof AST_Undefined)) { + if (e instanceof AST_Seq) { + e = e.to_array(); + e.push(make_node(AST_True, self)); + return AST_Seq.from_array(e).optimize(compressor); + } + return make_node(AST_Seq, self, { + car: e, + cdr: make_node(AST_True, self) + }).optimize(compressor); + } + var seq = self.lift_sequences(compressor); + if (seq !== self) { + return seq; + } + if (compressor.option("side_effects") && self.operator == "void") { + e = e.drop_side_effect_free(compressor); + if (e) { + self.expression = e; + return self; + } else { + return make_node(AST_Undefined, self).optimize(compressor); + } + } + if (compressor.option("booleans") && compressor.in_boolean_context()) { + switch (self.operator) { + case "!": + if (e instanceof AST_UnaryPrefix && e.operator == "!") { + // !!foo ==> foo, if we're in boolean context + return e.expression; + } + if (e instanceof AST_Binary) { + self = best_of(compressor, self, e.negate(compressor, first_in_statement(compressor))); + } + break; + case "typeof": + // typeof always returns a non-empty string, thus it's + // always true in booleans + compressor.warn("Boolean expression always true [{file}:{line},{col}]", self.start); + return (e instanceof AST_SymbolRef ? make_node(AST_True, self) : make_node(AST_Seq, self, { + car: e, + cdr: make_node(AST_True, self) + })).optimize(compressor); + } + } + if (self.operator == "-" && e instanceof AST_Infinity) { + e = e.transform(compressor); + } + if (e instanceof AST_Binary + && (self.operator == "+" || self.operator == "-") + && (e.operator == "*" || e.operator == "/" || e.operator == "%")) { + return make_node(AST_Binary, self, { + operator: e.operator, + left: make_node(AST_UnaryPrefix, e.left, { + operator: self.operator, + expression: e.left + }), + right: e.right + }); + } + // avoids infinite recursion of numerals + if (self.operator != "-" + || !(e instanceof AST_Number || e instanceof AST_Infinity)) { + var ev = self.evaluate(compressor); + if (ev !== self) { + ev = make_node_from_constant(ev, self).optimize(compressor); + return best_of(compressor, ev, self); + } + } + return self; + }); + + AST_Binary.DEFMETHOD("lift_sequences", function(compressor){ + if (compressor.option("sequences")) { + if (this.left instanceof AST_Seq) { + var seq = this.left; + var x = seq.to_array(); + var e = this.clone(); + e.left = x.pop(); + x.push(e); + return AST_Seq.from_array(x).optimize(compressor); + } + if (this.right instanceof AST_Seq && !this.left.has_side_effects(compressor)) { + var assign = this.operator == "=" && this.left instanceof AST_SymbolRef; + var root = this.right.clone(); + var cursor, seq = root; + while (assign || !seq.car.has_side_effects(compressor)) { + cursor = seq; + if (seq.cdr instanceof AST_Seq) { + seq = seq.cdr = seq.cdr.clone(); + } else break; + } + if (cursor) { + var e = this.clone(); + e.right = cursor.cdr; + cursor.cdr = e; + return root.optimize(compressor); + } + } + } + return this; + }); + + var commutativeOperators = makePredicate("== === != !== * & | ^"); + + OPT(AST_Binary, function(self, compressor){ + function reversible() { + return self.left.is_constant() + || self.right.is_constant() + || !self.left.has_side_effects(compressor) + && !self.right.has_side_effects(compressor); + } + function reverse(op) { + if (reversible()) { + if (op) self.operator = op; + var tmp = self.left; + self.left = self.right; + self.right = tmp; + } + } + if (commutativeOperators(self.operator)) { + if (self.right.is_constant() + && !self.left.is_constant()) { + // if right is a constant, whatever side effects the + // left side might have could not influence the + // result. hence, force switch. + + if (!(self.left instanceof AST_Binary + && PRECEDENCE[self.left.operator] >= PRECEDENCE[self.operator])) { + reverse(); + } + } + } + self = self.lift_sequences(compressor); + if (compressor.option("comparisons")) switch (self.operator) { + case "===": + case "!==": + if ((self.left.is_string(compressor) && self.right.is_string(compressor)) || + (self.left.is_number(compressor) && self.right.is_number(compressor)) || + (self.left.is_boolean() && self.right.is_boolean())) { + self.operator = self.operator.substr(0, 2); + } + // XXX: intentionally falling down to the next case + case "==": + case "!=": + // "undefined" == typeof x => undefined === x + if (self.left instanceof AST_String + && self.left.value == "undefined" + && self.right instanceof AST_UnaryPrefix + && self.right.operator == "typeof") { + var expr = self.right.expression; + if (expr instanceof AST_SymbolRef ? !expr.undeclared() + : !(expr instanceof AST_PropAccess) || compressor.option("screw_ie8")) { + self.right = expr; + self.left = make_node(AST_Undefined, self.left).optimize(compressor); + if (self.operator.length == 2) self.operator += "="; + } + } + break; + } + if (compressor.option("booleans") && self.operator == "+" && compressor.in_boolean_context()) { + var ll = self.left.evaluate(compressor); + var rr = self.right.evaluate(compressor); + if (ll && typeof ll == "string") { + compressor.warn("+ in boolean context always true [{file}:{line},{col}]", self.start); + return make_node(AST_Seq, self, { + car: self.right, + cdr: make_node(AST_True, self) + }).optimize(compressor); + } + if (rr && typeof rr == "string") { + compressor.warn("+ in boolean context always true [{file}:{line},{col}]", self.start); + return make_node(AST_Seq, self, { + car: self.left, + cdr: make_node(AST_True, self) + }).optimize(compressor); + } + } + if (compressor.option("comparisons") && self.is_boolean()) { + if (!(compressor.parent() instanceof AST_Binary) + || compressor.parent() instanceof AST_Assign) { + var negated = make_node(AST_UnaryPrefix, self, { + operator: "!", + expression: self.negate(compressor, first_in_statement(compressor)) + }); + self = best_of(compressor, self, negated); + } + if (compressor.option("unsafe_comps")) { + switch (self.operator) { + case "<": reverse(">"); break; + case "<=": reverse(">="); break; + } + } + } + if (self.operator == "+") { + if (self.right instanceof AST_String + && self.right.getValue() == "" + && self.left.is_string(compressor)) { + return self.left; + } + if (self.left instanceof AST_String + && self.left.getValue() == "" + && self.right.is_string(compressor)) { + return self.right; + } + if (self.left instanceof AST_Binary + && self.left.operator == "+" + && self.left.left instanceof AST_String + && self.left.left.getValue() == "" + && self.right.is_string(compressor)) { + self.left = self.left.right; + return self.transform(compressor); + } + } + if (compressor.option("evaluate")) { + switch (self.operator) { + case "&&": + var ll = self.left.evaluate(compressor); + if (!ll) { + compressor.warn("Condition left of && always false [{file}:{line},{col}]", self.start); + return maintain_this_binding(compressor.parent(), self, self.left).optimize(compressor); + } else if (ll !== self.left) { + compressor.warn("Condition left of && always true [{file}:{line},{col}]", self.start); + return maintain_this_binding(compressor.parent(), self, self.right).optimize(compressor); + } + if (compressor.option("booleans") && compressor.in_boolean_context()) { + var rr = self.right.evaluate(compressor); + if (!rr) { + compressor.warn("Boolean && always false [{file}:{line},{col}]", self.start); + return make_node(AST_Seq, self, { + car: self.left, + cdr: make_node(AST_False, self) + }).optimize(compressor); + } else if (rr !== self.right) { + compressor.warn("Dropping side-effect-free && in boolean context [{file}:{line},{col}]", self.start); + return self.left.optimize(compressor); + } + } + break; + case "||": + var ll = self.left.evaluate(compressor); + if (!ll) { + compressor.warn("Condition left of || always false [{file}:{line},{col}]", self.start); + return maintain_this_binding(compressor.parent(), self, self.right).optimize(compressor); + } else if (ll !== self.left) { + compressor.warn("Condition left of || always true [{file}:{line},{col}]", self.start); + return maintain_this_binding(compressor.parent(), self, self.left).optimize(compressor); + } + if (compressor.option("booleans") && compressor.in_boolean_context()) { + var rr = self.right.evaluate(compressor); + if (!rr) { + compressor.warn("Dropping side-effect-free || in boolean context [{file}:{line},{col}]", self.start); + return self.left.optimize(compressor); + } else if (rr !== self.right) { + compressor.warn("Boolean || always true [{file}:{line},{col}]", self.start); + return make_node(AST_Seq, self, { + car: self.left, + cdr: make_node(AST_True, self) + }).optimize(compressor); + } + } + break; + } + var associative = true; + switch (self.operator) { + case "+": + // "foo" + ("bar" + x) => "foobar" + x + if (self.left instanceof AST_Constant + && self.right instanceof AST_Binary + && self.right.operator == "+" + && self.right.left instanceof AST_Constant + && self.right.is_string(compressor)) { + self = make_node(AST_Binary, self, { + operator: "+", + left: make_node(AST_String, self.left, { + value: "" + self.left.getValue() + self.right.left.getValue(), + start: self.left.start, + end: self.right.left.end + }), + right: self.right.right + }); + } + // (x + "foo") + "bar" => x + "foobar" + if (self.right instanceof AST_Constant + && self.left instanceof AST_Binary + && self.left.operator == "+" + && self.left.right instanceof AST_Constant + && self.left.is_string(compressor)) { + self = make_node(AST_Binary, self, { + operator: "+", + left: self.left.left, + right: make_node(AST_String, self.right, { + value: "" + self.left.right.getValue() + self.right.getValue(), + start: self.left.right.start, + end: self.right.end + }) + }); + } + // (x + "foo") + ("bar" + y) => (x + "foobar") + y + if (self.left instanceof AST_Binary + && self.left.operator == "+" + && self.left.is_string(compressor) + && self.left.right instanceof AST_Constant + && self.right instanceof AST_Binary + && self.right.operator == "+" + && self.right.left instanceof AST_Constant + && self.right.is_string(compressor)) { + self = make_node(AST_Binary, self, { + operator: "+", + left: make_node(AST_Binary, self.left, { + operator: "+", + left: self.left.left, + right: make_node(AST_String, self.left.right, { + value: "" + self.left.right.getValue() + self.right.left.getValue(), + start: self.left.right.start, + end: self.right.left.end + }) + }), + right: self.right.right + }); + } + // a + -b => a - b + if (self.right instanceof AST_UnaryPrefix + && self.right.operator == "-" + && self.left.is_number(compressor)) { + self = make_node(AST_Binary, self, { + operator: "-", + left: self.left, + right: self.right.expression + }); + break; + } + // -a + b => b - a + if (self.left instanceof AST_UnaryPrefix + && self.left.operator == "-" + && reversible() + && self.right.is_number(compressor)) { + self = make_node(AST_Binary, self, { + operator: "-", + left: self.right, + right: self.left.expression + }); + break; + } + case "*": + associative = compressor.option("unsafe_math"); + case "&": + case "|": + case "^": + // a + +b => +b + a + if (self.left.is_number(compressor) + && self.right.is_number(compressor) + && reversible() + && !(self.left instanceof AST_Binary + && self.left.operator != self.operator + && PRECEDENCE[self.left.operator] >= PRECEDENCE[self.operator])) { + var reversed = make_node(AST_Binary, self, { + operator: self.operator, + left: self.right, + right: self.left + }); + if (self.right instanceof AST_Constant + && !(self.left instanceof AST_Constant)) { + self = best_of(compressor, reversed, self); + } else { + self = best_of(compressor, self, reversed); + } + } + if (associative && self.is_number(compressor)) { + // a + (b + c) => (a + b) + c + if (self.right instanceof AST_Binary + && self.right.operator == self.operator) { + self = make_node(AST_Binary, self, { + operator: self.operator, + left: make_node(AST_Binary, self.left, { + operator: self.operator, + left: self.left, + right: self.right.left, + start: self.left.start, + end: self.right.left.end + }), + right: self.right.right + }); + } + // (n + 2) + 3 => 5 + n + // (2 * n) * 3 => 6 + n + if (self.right instanceof AST_Constant + && self.left instanceof AST_Binary + && self.left.operator == self.operator) { + if (self.left.left instanceof AST_Constant) { + self = make_node(AST_Binary, self, { + operator: self.operator, + left: make_node(AST_Binary, self.left, { + operator: self.operator, + left: self.left.left, + right: self.right, + start: self.left.left.start, + end: self.right.end + }), + right: self.left.right + }); + } else if (self.left.right instanceof AST_Constant) { + self = make_node(AST_Binary, self, { + operator: self.operator, + left: make_node(AST_Binary, self.left, { + operator: self.operator, + left: self.left.right, + right: self.right, + start: self.left.right.start, + end: self.right.end + }), + right: self.left.left + }); + } + } + // (a | 1) | (2 | d) => (3 | a) | b + if (self.left instanceof AST_Binary + && self.left.operator == self.operator + && self.left.right instanceof AST_Constant + && self.right instanceof AST_Binary + && self.right.operator == self.operator + && self.right.left instanceof AST_Constant) { + self = make_node(AST_Binary, self, { + operator: self.operator, + left: make_node(AST_Binary, self.left, { + operator: self.operator, + left: make_node(AST_Binary, self.left.left, { + operator: self.operator, + left: self.left.right, + right: self.right.left, + start: self.left.right.start, + end: self.right.left.end + }), + right: self.left.left + }), + right: self.right.right + }); + } + } + } + } + // x && (y && z) ==> x && y && z + // x || (y || z) ==> x || y || z + // x + ("y" + z) ==> x + "y" + z + // "x" + (y + "z")==> "x" + y + "z" + if (self.right instanceof AST_Binary + && self.right.operator == self.operator + && (self.operator == "&&" + || self.operator == "||" + || (self.operator == "+" + && (self.right.left.is_string(compressor) + || (self.left.is_string(compressor) + && self.right.right.is_string(compressor)))))) + { + self.left = make_node(AST_Binary, self.left, { + operator : self.operator, + left : self.left, + right : self.right.left + }); + self.right = self.right.right; + return self.transform(compressor); + } + var ev = self.evaluate(compressor); + if (ev !== self) { + ev = make_node_from_constant(ev, self).optimize(compressor); + return best_of(compressor, ev, self); + } + return self; + }); + + OPT(AST_SymbolRef, function(self, compressor){ + var def = self.resolve_defines(compressor); + if (def) { + return def.optimize(compressor); + } + // testing against !self.scope.uses_with first is an optimization + if (compressor.option("screw_ie8") + && self.undeclared() + && (!self.scope.uses_with || !compressor.find_parent(AST_With))) { + switch (self.name) { + case "undefined": + return make_node(AST_Undefined, self).optimize(compressor); + case "NaN": + return make_node(AST_NaN, self).optimize(compressor); + case "Infinity": + return make_node(AST_Infinity, self).optimize(compressor); + } + } + if (compressor.option("evaluate") + && compressor.option("reduce_vars") + && is_lhs(self, compressor.parent()) !== self) { + var d = self.definition(); + var fixed = self.fixed_value(); + if (fixed) { + if (d.should_replace === undefined) { + var init = fixed.evaluate(compressor); + if (init !== fixed && (compressor.option("unsafe_regexp") || !(init instanceof RegExp))) { + init = make_node_from_constant(init, fixed); + var value = init.optimize(compressor).print_to_string().length; + var fn; + if (has_symbol_ref(fixed)) { + fn = function() { + var result = init.optimize(compressor); + return result === init ? result.clone(true) : result; + }; + } else { + value = Math.min(value, fixed.print_to_string().length); + fn = function() { + var result = best_of_expression(init.optimize(compressor), fixed); + return result === init || result === fixed ? result.clone(true) : result; + }; + } + var name = d.name.length; + var overhead = 0; + if (compressor.option("unused") && (!d.global || compressor.option("toplevel"))) { + overhead = (name + 2 + value) / d.references.length; + } + d.should_replace = value <= name + overhead ? fn : false; + } else { + d.should_replace = false; + } + } + if (d.should_replace) { + return d.should_replace(); + } + } + } + return self; + + function has_symbol_ref(value) { + var found; + value.walk(new TreeWalker(function(node) { + if (node instanceof AST_SymbolRef) found = true; + if (found) return true; + })); + return found; + } + }); + + function is_atomic(lhs, self) { + return lhs instanceof AST_SymbolRef || lhs.TYPE === self.TYPE; + } + + OPT(AST_Undefined, function(self, compressor){ + if (compressor.option("unsafe")) { + var undef = find_variable(compressor, "undefined"); + if (undef) { + var ref = make_node(AST_SymbolRef, self, { + name : "undefined", + scope : undef.scope, + thedef : undef + }); + ref.is_undefined = true; + return ref; + } + } + var lhs = is_lhs(compressor.self(), compressor.parent()); + if (lhs && is_atomic(lhs, self)) return self; + return make_node(AST_UnaryPrefix, self, { + operator: "void", + expression: make_node(AST_Number, self, { + value: 0 + }) + }); + }); + + OPT(AST_Infinity, function(self, compressor){ + var lhs = is_lhs(compressor.self(), compressor.parent()); + if (lhs && is_atomic(lhs, self)) return self; + if (compressor.option("keep_infinity") + && !(lhs && !is_atomic(lhs, self)) + && !find_variable(compressor, "Infinity")) + return self; + return make_node(AST_Binary, self, { + operator: "/", + left: make_node(AST_Number, self, { + value: 1 + }), + right: make_node(AST_Number, self, { + value: 0 + }) + }); + }); + + OPT(AST_NaN, function(self, compressor){ + var lhs = is_lhs(compressor.self(), compressor.parent()); + if (lhs && !is_atomic(lhs, self) + || find_variable(compressor, "NaN")) { + return make_node(AST_Binary, self, { + operator: "/", + left: make_node(AST_Number, self, { + value: 0 + }), + right: make_node(AST_Number, self, { + value: 0 + }) + }); + } + return self; + }); + + var ASSIGN_OPS = [ '+', '-', '/', '*', '%', '>>', '<<', '>>>', '|', '^', '&' ]; + var ASSIGN_OPS_COMMUTATIVE = [ '*', '|', '^', '&' ]; + OPT(AST_Assign, function(self, compressor){ + self = self.lift_sequences(compressor); + if (self.operator == "=" && self.left instanceof AST_SymbolRef && self.right instanceof AST_Binary) { + // x = expr1 OP expr2 + if (self.right.left instanceof AST_SymbolRef + && self.right.left.name == self.left.name + && member(self.right.operator, ASSIGN_OPS)) { + // x = x - 2 ---> x -= 2 + self.operator = self.right.operator + "="; + self.right = self.right.right; + } + else if (self.right.right instanceof AST_SymbolRef + && self.right.right.name == self.left.name + && member(self.right.operator, ASSIGN_OPS_COMMUTATIVE) + && !self.right.left.has_side_effects(compressor)) { + // x = 2 & x ---> x &= 2 + self.operator = self.right.operator + "="; + self.right = self.right.left; + } + } + return self; + }); + + OPT(AST_Conditional, function(self, compressor){ + if (!compressor.option("conditionals")) return self; + if (self.condition instanceof AST_Seq) { + var car = self.condition.car; + self.condition = self.condition.cdr; + return AST_Seq.cons(car, self); + } + var cond = self.condition.evaluate(compressor); + if (cond !== self.condition) { + if (cond) { + compressor.warn("Condition always true [{file}:{line},{col}]", self.start); + return maintain_this_binding(compressor.parent(), self, self.consequent); + } else { + compressor.warn("Condition always false [{file}:{line},{col}]", self.start); + return maintain_this_binding(compressor.parent(), self, self.alternative); + } + } + var negated = cond.negate(compressor, first_in_statement(compressor)); + if (best_of(compressor, cond, negated) === negated) { + self = make_node(AST_Conditional, self, { + condition: negated, + consequent: self.alternative, + alternative: self.consequent + }); + } + var condition = self.condition; + var consequent = self.consequent; + var alternative = self.alternative; + // x?x:y --> x||y + if (condition instanceof AST_SymbolRef + && consequent instanceof AST_SymbolRef + && condition.definition() === consequent.definition()) { + return make_node(AST_Binary, self, { + operator: "||", + left: condition, + right: alternative + }); + } + // if (foo) exp = something; else exp = something_else; + // | + // v + // exp = foo ? something : something_else; + if (consequent instanceof AST_Assign + && alternative instanceof AST_Assign + && consequent.operator == alternative.operator + && consequent.left.equivalent_to(alternative.left) + && (!self.condition.has_side_effects(compressor) + || consequent.operator == "=" + && !consequent.left.has_side_effects(compressor))) { + return make_node(AST_Assign, self, { + operator: consequent.operator, + left: consequent.left, + right: make_node(AST_Conditional, self, { + condition: self.condition, + consequent: consequent.right, + alternative: alternative.right + }) + }); + } + // x ? y(a) : y(b) --> y(x ? a : b) + if (consequent instanceof AST_Call + && alternative.TYPE === consequent.TYPE + && consequent.args.length == 1 + && alternative.args.length == 1 + && consequent.expression.equivalent_to(alternative.expression) + && !consequent.expression.has_side_effects(compressor)) { + consequent.args[0] = make_node(AST_Conditional, self, { + condition: self.condition, + consequent: consequent.args[0], + alternative: alternative.args[0] + }); + return consequent; + } + // x?y?z:a:a --> x&&y?z:a + if (consequent instanceof AST_Conditional + && consequent.alternative.equivalent_to(alternative)) { + return make_node(AST_Conditional, self, { + condition: make_node(AST_Binary, self, { + left: self.condition, + operator: "&&", + right: consequent.condition + }), + consequent: consequent.consequent, + alternative: alternative + }); + } + // x ? y : y --> x, y + if (consequent.equivalent_to(alternative)) { + return make_node(AST_Seq, self, { + car: self.condition, + cdr: consequent + }).optimize(compressor); + } + + if (is_true(self.consequent)) { + if (is_false(self.alternative)) { + // c ? true : false ---> !!c + return booleanize(self.condition); + } + // c ? true : x ---> !!c || x + return make_node(AST_Binary, self, { + operator: "||", + left: booleanize(self.condition), + right: self.alternative + }); + } + if (is_false(self.consequent)) { + if (is_true(self.alternative)) { + // c ? false : true ---> !c + return booleanize(self.condition.negate(compressor)); + } + // c ? false : x ---> !c && x + return make_node(AST_Binary, self, { + operator: "&&", + left: booleanize(self.condition.negate(compressor)), + right: self.alternative + }); + } + if (is_true(self.alternative)) { + // c ? x : true ---> !c || x + return make_node(AST_Binary, self, { + operator: "||", + left: booleanize(self.condition.negate(compressor)), + right: self.consequent + }); + } + if (is_false(self.alternative)) { + // c ? x : false ---> !!c && x + return make_node(AST_Binary, self, { + operator: "&&", + left: booleanize(self.condition), + right: self.consequent + }); + } + + return self; + + function booleanize(node) { + if (node.is_boolean()) return node; + // !!expression + return make_node(AST_UnaryPrefix, node, { + operator: "!", + expression: node.negate(compressor) + }); + } + + // AST_True or !0 + function is_true(node) { + return node instanceof AST_True + || (node instanceof AST_UnaryPrefix + && node.operator == "!" + && node.expression instanceof AST_Constant + && !node.expression.value); + } + // AST_False or !1 + function is_false(node) { + return node instanceof AST_False + || (node instanceof AST_UnaryPrefix + && node.operator == "!" + && node.expression instanceof AST_Constant + && !!node.expression.value); + } + }); + + OPT(AST_Boolean, function(self, compressor){ + if (compressor.option("booleans")) { + var p = compressor.parent(); + if (p instanceof AST_Binary && (p.operator == "==" + || p.operator == "!=")) { + compressor.warn("Non-strict equality against boolean: {operator} {value} [{file}:{line},{col}]", { + operator : p.operator, + value : self.value, + file : p.start.file, + line : p.start.line, + col : p.start.col, + }); + return make_node(AST_Number, self, { + value: +self.value + }); + } + return make_node(AST_UnaryPrefix, self, { + operator: "!", + expression: make_node(AST_Number, self, { + value: 1 - self.value + }) + }); + } + return self; + }); + + OPT(AST_Sub, function(self, compressor){ + var prop = self.property; + if (prop instanceof AST_String && compressor.option("properties")) { + prop = prop.getValue(); + if (RESERVED_WORDS(prop) ? compressor.option("screw_ie8") : is_identifier_string(prop)) { + return make_node(AST_Dot, self, { + expression : self.expression, + property : prop + }).optimize(compressor); + } + var v = parseFloat(prop); + if (!isNaN(v) && v.toString() == prop) { + self.property = make_node(AST_Number, self.property, { + value: v + }); + } + } + var ev = self.evaluate(compressor); + if (ev !== self) { + ev = make_node_from_constant(ev, self).optimize(compressor); + return best_of(compressor, ev, self); + } + return self; + }); + + OPT(AST_Dot, function(self, compressor){ + var def = self.resolve_defines(compressor); + if (def) { + return def.optimize(compressor); + } + var prop = self.property; + if (RESERVED_WORDS(prop) && !compressor.option("screw_ie8")) { + return make_node(AST_Sub, self, { + expression : self.expression, + property : make_node(AST_String, self, { + value: prop + }) + }).optimize(compressor); + } + if (compressor.option("unsafe_proto") + && self.expression instanceof AST_Dot + && self.expression.property == "prototype") { + var exp = self.expression.expression; + if (exp instanceof AST_SymbolRef && exp.undeclared()) switch (exp.name) { + case "Array": + self.expression = make_node(AST_Array, self.expression, { + elements: [] + }); + break; + case "Object": + self.expression = make_node(AST_Object, self.expression, { + properties: [] + }); + break; + case "String": + self.expression = make_node(AST_String, self.expression, { + value: "" + }); + break; + } + } + var ev = self.evaluate(compressor); + if (ev !== self) { + ev = make_node_from_constant(ev, self).optimize(compressor); + return best_of(compressor, ev, self); + } + return self; + }); + + function literals_in_boolean_context(self, compressor) { + if (compressor.option("booleans") && compressor.in_boolean_context()) { + return best_of(compressor, self, make_node(AST_Seq, self, { + car: self, + cdr: make_node(AST_True, self) + }).optimize(compressor)); + } + return self; + }; + OPT(AST_Array, literals_in_boolean_context); + OPT(AST_Object, literals_in_boolean_context); + OPT(AST_RegExp, literals_in_boolean_context); + + OPT(AST_Return, function(self, compressor){ + if (self.value && is_undefined(self.value, compressor)) { + self.value = null; + } + return self; + }); + + OPT(AST_VarDef, function(self, compressor){ + var defines = compressor.option("global_defs"); + if (defines && HOP(defines, self.name.name)) { + compressor.warn('global_defs ' + self.name.name + ' redefined [{file}:{line},{col}]', self.start); + } + return self; + }); + +})(); diff --git a/node_modules/uglify-js/lib/mozilla-ast.js b/node_modules/uglify-js/lib/mozilla-ast.js new file mode 100644 index 0000000..88a2eb5 --- /dev/null +++ b/node_modules/uglify-js/lib/mozilla-ast.js @@ -0,0 +1,611 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS2 + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + 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. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 HOLDER 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. + + ***********************************************************************/ + +"use strict"; + +(function(){ + + var normalize_directives = function(body) { + var in_directive = true; + + for (var i = 0; i < body.length; i++) { + if (in_directive && body[i] instanceof AST_Statement && body[i].body instanceof AST_String) { + body[i] = new AST_Directive({ + start: body[i].start, + end: body[i].end, + value: body[i].body.value + }); + } else if (in_directive && !(body[i] instanceof AST_Statement && body[i].body instanceof AST_String)) { + in_directive = false; + } + } + + return body; + }; + + var MOZ_TO_ME = { + Program: function(M) { + return new AST_Toplevel({ + start: my_start_token(M), + end: my_end_token(M), + body: normalize_directives(M.body.map(from_moz)) + }); + }, + FunctionDeclaration: function(M) { + return new AST_Defun({ + start: my_start_token(M), + end: my_end_token(M), + name: from_moz(M.id), + argnames: M.params.map(from_moz), + body: normalize_directives(from_moz(M.body).body) + }); + }, + FunctionExpression: function(M) { + return new AST_Function({ + start: my_start_token(M), + end: my_end_token(M), + name: from_moz(M.id), + argnames: M.params.map(from_moz), + body: normalize_directives(from_moz(M.body).body) + }); + }, + ExpressionStatement: function(M) { + return new AST_SimpleStatement({ + start: my_start_token(M), + end: my_end_token(M), + body: from_moz(M.expression) + }); + }, + TryStatement: function(M) { + var handlers = M.handlers || [M.handler]; + if (handlers.length > 1 || M.guardedHandlers && M.guardedHandlers.length) { + throw new Error("Multiple catch clauses are not supported."); + } + return new AST_Try({ + start : my_start_token(M), + end : my_end_token(M), + body : from_moz(M.block).body, + bcatch : from_moz(handlers[0]), + bfinally : M.finalizer ? new AST_Finally(from_moz(M.finalizer)) : null + }); + }, + Property: function(M) { + var key = M.key; + var args = { + start : my_start_token(key), + end : my_end_token(M.value), + key : key.type == "Identifier" ? key.name : key.value, + value : from_moz(M.value) + }; + if (M.kind == "init") return new AST_ObjectKeyVal(args); + args.key = new AST_SymbolAccessor({ + name: args.key + }); + args.value = new AST_Accessor(args.value); + if (M.kind == "get") return new AST_ObjectGetter(args); + if (M.kind == "set") return new AST_ObjectSetter(args); + }, + ArrayExpression: function(M) { + return new AST_Array({ + start : my_start_token(M), + end : my_end_token(M), + elements : M.elements.map(function(elem){ + return elem === null ? new AST_Hole() : from_moz(elem); + }) + }); + }, + ObjectExpression: function(M) { + return new AST_Object({ + start : my_start_token(M), + end : my_end_token(M), + properties : M.properties.map(function(prop){ + prop.type = "Property"; + return from_moz(prop) + }) + }); + }, + SequenceExpression: function(M) { + return AST_Seq.from_array(M.expressions.map(from_moz)); + }, + MemberExpression: function(M) { + return new (M.computed ? AST_Sub : AST_Dot)({ + start : my_start_token(M), + end : my_end_token(M), + property : M.computed ? from_moz(M.property) : M.property.name, + expression : from_moz(M.object) + }); + }, + SwitchCase: function(M) { + return new (M.test ? AST_Case : AST_Default)({ + start : my_start_token(M), + end : my_end_token(M), + expression : from_moz(M.test), + body : M.consequent.map(from_moz) + }); + }, + VariableDeclaration: function(M) { + return new (M.kind === "const" ? AST_Const : AST_Var)({ + start : my_start_token(M), + end : my_end_token(M), + definitions : M.declarations.map(from_moz) + }); + }, + Literal: function(M) { + var val = M.value, args = { + start : my_start_token(M), + end : my_end_token(M) + }; + if (val === null) return new AST_Null(args); + switch (typeof val) { + case "string": + args.value = val; + return new AST_String(args); + case "number": + args.value = val; + return new AST_Number(args); + case "boolean": + return new (val ? AST_True : AST_False)(args); + default: + var rx = M.regex; + if (rx && rx.pattern) { + // RegExpLiteral as per ESTree AST spec + args.value = new RegExp(rx.pattern, rx.flags).toString(); + } else { + // support legacy RegExp + args.value = M.regex && M.raw ? M.raw : val; + } + return new AST_RegExp(args); + } + }, + Identifier: function(M) { + var p = FROM_MOZ_STACK[FROM_MOZ_STACK.length - 2]; + return new ( p.type == "LabeledStatement" ? AST_Label + : p.type == "VariableDeclarator" && p.id === M ? (p.kind == "const" ? AST_SymbolConst : AST_SymbolVar) + : p.type == "FunctionExpression" ? (p.id === M ? AST_SymbolLambda : AST_SymbolFunarg) + : p.type == "FunctionDeclaration" ? (p.id === M ? AST_SymbolDefun : AST_SymbolFunarg) + : p.type == "CatchClause" ? AST_SymbolCatch + : p.type == "BreakStatement" || p.type == "ContinueStatement" ? AST_LabelRef + : AST_SymbolRef)({ + start : my_start_token(M), + end : my_end_token(M), + name : M.name + }); + } + }; + + MOZ_TO_ME.UpdateExpression = + MOZ_TO_ME.UnaryExpression = function To_Moz_Unary(M) { + var prefix = "prefix" in M ? M.prefix + : M.type == "UnaryExpression" ? true : false; + return new (prefix ? AST_UnaryPrefix : AST_UnaryPostfix)({ + start : my_start_token(M), + end : my_end_token(M), + operator : M.operator, + expression : from_moz(M.argument) + }); + }; + + map("EmptyStatement", AST_EmptyStatement); + map("BlockStatement", AST_BlockStatement, "body@body"); + map("IfStatement", AST_If, "test>condition, consequent>body, alternate>alternative"); + map("LabeledStatement", AST_LabeledStatement, "label>label, body>body"); + map("BreakStatement", AST_Break, "label>label"); + map("ContinueStatement", AST_Continue, "label>label"); + map("WithStatement", AST_With, "object>expression, body>body"); + map("SwitchStatement", AST_Switch, "discriminant>expression, cases@body"); + map("ReturnStatement", AST_Return, "argument>value"); + map("ThrowStatement", AST_Throw, "argument>value"); + map("WhileStatement", AST_While, "test>condition, body>body"); + map("DoWhileStatement", AST_Do, "test>condition, body>body"); + map("ForStatement", AST_For, "init>init, test>condition, update>step, body>body"); + map("ForInStatement", AST_ForIn, "left>init, right>object, body>body"); + map("DebuggerStatement", AST_Debugger); + map("VariableDeclarator", AST_VarDef, "id>name, init>value"); + map("CatchClause", AST_Catch, "param>argname, body%body"); + + map("ThisExpression", AST_This); + map("BinaryExpression", AST_Binary, "operator=operator, left>left, right>right"); + map("LogicalExpression", AST_Binary, "operator=operator, left>left, right>right"); + map("AssignmentExpression", AST_Assign, "operator=operator, left>left, right>right"); + map("ConditionalExpression", AST_Conditional, "test>condition, consequent>consequent, alternate>alternative"); + map("NewExpression", AST_New, "callee>expression, arguments@args"); + map("CallExpression", AST_Call, "callee>expression, arguments@args"); + + def_to_moz(AST_Toplevel, function To_Moz_Program(M) { + return to_moz_scope("Program", M); + }); + + def_to_moz(AST_Defun, function To_Moz_FunctionDeclaration(M) { + return { + type: "FunctionDeclaration", + id: to_moz(M.name), + params: M.argnames.map(to_moz), + body: to_moz_scope("BlockStatement", M) + } + }); + + def_to_moz(AST_Function, function To_Moz_FunctionExpression(M) { + return { + type: "FunctionExpression", + id: to_moz(M.name), + params: M.argnames.map(to_moz), + body: to_moz_scope("BlockStatement", M) + } + }); + + def_to_moz(AST_Directive, function To_Moz_Directive(M) { + return { + type: "ExpressionStatement", + expression: { + type: "Literal", + value: M.value + } + }; + }); + + def_to_moz(AST_SimpleStatement, function To_Moz_ExpressionStatement(M) { + return { + type: "ExpressionStatement", + expression: to_moz(M.body) + }; + }); + + def_to_moz(AST_SwitchBranch, function To_Moz_SwitchCase(M) { + return { + type: "SwitchCase", + test: to_moz(M.expression), + consequent: M.body.map(to_moz) + }; + }); + + def_to_moz(AST_Try, function To_Moz_TryStatement(M) { + return { + type: "TryStatement", + block: to_moz_block(M), + handler: to_moz(M.bcatch), + guardedHandlers: [], + finalizer: to_moz(M.bfinally) + }; + }); + + def_to_moz(AST_Catch, function To_Moz_CatchClause(M) { + return { + type: "CatchClause", + param: to_moz(M.argname), + guard: null, + body: to_moz_block(M) + }; + }); + + def_to_moz(AST_Definitions, function To_Moz_VariableDeclaration(M) { + return { + type: "VariableDeclaration", + kind: M instanceof AST_Const ? "const" : "var", + declarations: M.definitions.map(to_moz) + }; + }); + + def_to_moz(AST_Seq, function To_Moz_SequenceExpression(M) { + return { + type: "SequenceExpression", + expressions: M.to_array().map(to_moz) + }; + }); + + def_to_moz(AST_PropAccess, function To_Moz_MemberExpression(M) { + var isComputed = M instanceof AST_Sub; + return { + type: "MemberExpression", + object: to_moz(M.expression), + computed: isComputed, + property: isComputed ? to_moz(M.property) : {type: "Identifier", name: M.property} + }; + }); + + def_to_moz(AST_Unary, function To_Moz_Unary(M) { + return { + type: M.operator == "++" || M.operator == "--" ? "UpdateExpression" : "UnaryExpression", + operator: M.operator, + prefix: M instanceof AST_UnaryPrefix, + argument: to_moz(M.expression) + }; + }); + + def_to_moz(AST_Binary, function To_Moz_BinaryExpression(M) { + return { + type: M.operator == "&&" || M.operator == "||" ? "LogicalExpression" : "BinaryExpression", + left: to_moz(M.left), + operator: M.operator, + right: to_moz(M.right) + }; + }); + + def_to_moz(AST_Array, function To_Moz_ArrayExpression(M) { + return { + type: "ArrayExpression", + elements: M.elements.map(to_moz) + }; + }); + + def_to_moz(AST_Object, function To_Moz_ObjectExpression(M) { + return { + type: "ObjectExpression", + properties: M.properties.map(to_moz) + }; + }); + + def_to_moz(AST_ObjectProperty, function To_Moz_Property(M) { + var key = { + type: "Literal", + value: M.key instanceof AST_SymbolAccessor ? M.key.name : M.key + }; + var kind; + if (M instanceof AST_ObjectKeyVal) { + kind = "init"; + } else + if (M instanceof AST_ObjectGetter) { + kind = "get"; + } else + if (M instanceof AST_ObjectSetter) { + kind = "set"; + } + return { + type: "Property", + kind: kind, + key: key, + value: to_moz(M.value) + }; + }); + + def_to_moz(AST_Symbol, function To_Moz_Identifier(M) { + var def = M.definition(); + return { + type: "Identifier", + name: def ? def.mangled_name || def.name : M.name + }; + }); + + def_to_moz(AST_RegExp, function To_Moz_RegExpLiteral(M) { + var value = M.value; + return { + type: "Literal", + value: value, + raw: value.toString(), + regex: { + pattern: value.source, + flags: value.toString().match(/[gimuy]*$/)[0] + } + }; + }); + + def_to_moz(AST_Constant, function To_Moz_Literal(M) { + var value = M.value; + if (typeof value === 'number' && (value < 0 || (value === 0 && 1 / value < 0))) { + return { + type: "UnaryExpression", + operator: "-", + prefix: true, + argument: { + type: "Literal", + value: -value, + raw: M.start.raw + } + }; + } + return { + type: "Literal", + value: value, + raw: M.start.raw + }; + }); + + def_to_moz(AST_Atom, function To_Moz_Atom(M) { + return { + type: "Identifier", + name: String(M.value) + }; + }); + + AST_Boolean.DEFMETHOD("to_mozilla_ast", AST_Constant.prototype.to_mozilla_ast); + AST_Null.DEFMETHOD("to_mozilla_ast", AST_Constant.prototype.to_mozilla_ast); + AST_Hole.DEFMETHOD("to_mozilla_ast", function To_Moz_ArrayHole() { return null }); + + AST_Block.DEFMETHOD("to_mozilla_ast", AST_BlockStatement.prototype.to_mozilla_ast); + AST_Lambda.DEFMETHOD("to_mozilla_ast", AST_Function.prototype.to_mozilla_ast); + + /* -----[ tools ]----- */ + + function raw_token(moznode) { + if (moznode.type == "Literal") { + return moznode.raw != null ? moznode.raw : moznode.value + ""; + } + } + + function my_start_token(moznode) { + var loc = moznode.loc, start = loc && loc.start; + var range = moznode.range; + return new AST_Token({ + file : loc && loc.source, + line : start && start.line, + col : start && start.column, + pos : range ? range[0] : moznode.start, + endline : start && start.line, + endcol : start && start.column, + endpos : range ? range[0] : moznode.start, + raw : raw_token(moznode), + }); + }; + + function my_end_token(moznode) { + var loc = moznode.loc, end = loc && loc.end; + var range = moznode.range; + return new AST_Token({ + file : loc && loc.source, + line : end && end.line, + col : end && end.column, + pos : range ? range[1] : moznode.end, + endline : end && end.line, + endcol : end && end.column, + endpos : range ? range[1] : moznode.end, + raw : raw_token(moznode), + }); + }; + + function map(moztype, mytype, propmap) { + var moz_to_me = "function From_Moz_" + moztype + "(M){\n"; + moz_to_me += "return new U2." + mytype.name + "({\n" + + "start: my_start_token(M),\n" + + "end: my_end_token(M)"; + + var me_to_moz = "function To_Moz_" + moztype + "(M){\n"; + me_to_moz += "return {\n" + + "type: " + JSON.stringify(moztype); + + if (propmap) propmap.split(/\s*,\s*/).forEach(function(prop){ + var m = /([a-z0-9$_]+)(=|@|>|%)([a-z0-9$_]+)/i.exec(prop); + if (!m) throw new Error("Can't understand property map: " + prop); + var moz = m[1], how = m[2], my = m[3]; + moz_to_me += ",\n" + my + ": "; + me_to_moz += ",\n" + moz + ": "; + switch (how) { + case "@": + moz_to_me += "M." + moz + ".map(from_moz)"; + me_to_moz += "M." + my + ".map(to_moz)"; + break; + case ">": + moz_to_me += "from_moz(M." + moz + ")"; + me_to_moz += "to_moz(M." + my + ")"; + break; + case "=": + moz_to_me += "M." + moz; + me_to_moz += "M." + my; + break; + case "%": + moz_to_me += "from_moz(M." + moz + ").body"; + me_to_moz += "to_moz_block(M)"; + break; + default: + throw new Error("Can't understand operator in propmap: " + prop); + } + }); + + moz_to_me += "\n})\n}"; + me_to_moz += "\n}\n}"; + + //moz_to_me = parse(moz_to_me).print_to_string({ beautify: true }); + //me_to_moz = parse(me_to_moz).print_to_string({ beautify: true }); + //console.log(moz_to_me); + + moz_to_me = new Function("U2", "my_start_token", "my_end_token", "from_moz", "return(" + moz_to_me + ")")( + exports, my_start_token, my_end_token, from_moz + ); + me_to_moz = new Function("to_moz", "to_moz_block", "to_moz_scope", "return(" + me_to_moz + ")")( + to_moz, to_moz_block, to_moz_scope + ); + MOZ_TO_ME[moztype] = moz_to_me; + def_to_moz(mytype, me_to_moz); + }; + + var FROM_MOZ_STACK = null; + + function from_moz(node) { + FROM_MOZ_STACK.push(node); + var ret = node != null ? MOZ_TO_ME[node.type](node) : null; + FROM_MOZ_STACK.pop(); + return ret; + }; + + AST_Node.from_mozilla_ast = function(node){ + var save_stack = FROM_MOZ_STACK; + FROM_MOZ_STACK = []; + var ast = from_moz(node); + FROM_MOZ_STACK = save_stack; + return ast; + }; + + function set_moz_loc(mynode, moznode, myparent) { + var start = mynode.start; + var end = mynode.end; + if (start.pos != null && end.endpos != null) { + moznode.range = [start.pos, end.endpos]; + } + if (start.line) { + moznode.loc = { + start: {line: start.line, column: start.col}, + end: end.endline ? {line: end.endline, column: end.endcol} : null + }; + if (start.file) { + moznode.loc.source = start.file; + } + } + return moznode; + }; + + function def_to_moz(mytype, handler) { + mytype.DEFMETHOD("to_mozilla_ast", function() { + return set_moz_loc(this, handler(this)); + }); + }; + + function to_moz(node) { + return node != null ? node.to_mozilla_ast() : null; + }; + + function to_moz_block(node) { + return { + type: "BlockStatement", + body: node.body.map(to_moz) + }; + }; + + function to_moz_scope(type, node) { + var body = node.body.map(to_moz); + if (node.body[0] instanceof AST_SimpleStatement && node.body[0].body instanceof AST_String) { + body.unshift(to_moz(new AST_EmptyStatement(node.body[0]))); + } + return { + type: type, + body: body + }; + }; +})(); diff --git a/node_modules/uglify-js/lib/output.js b/node_modules/uglify-js/lib/output.js new file mode 100644 index 0000000..78e2487 --- /dev/null +++ b/node_modules/uglify-js/lib/output.js @@ -0,0 +1,1423 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS2 + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + 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. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 HOLDER 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. + + ***********************************************************************/ + +"use strict"; + +var EXPECT_DIRECTIVE = /^$|[;{][\s\n]*$/; + +function is_some_comments(comment) { + // multiline comment + return comment.type == "comment2" && /@preserve|@license|@cc_on/i.test(comment.value); +} + +function OutputStream(options) { + + options = defaults(options, { + ascii_only : false, + beautify : false, + bracketize : false, + comments : false, + indent_level : 4, + indent_start : 0, + inline_script : true, + keep_quoted_props: false, + max_line_len : false, + preamble : null, + preserve_line : false, + quote_keys : false, + quote_style : 0, + screw_ie8 : true, + semicolons : true, + shebang : true, + source_map : null, + space_colon : true, + unescape_regexps : false, + width : 80, + wrap_iife : false, + }, true); + + // Convert comment option to RegExp if neccessary and set up comments filter + var comment_filter = return_false; // Default case, throw all comments away + if (options.comments) { + var comments = options.comments; + if (typeof options.comments === "string" && /^\/.*\/[a-zA-Z]*$/.test(options.comments)) { + var regex_pos = options.comments.lastIndexOf("/"); + comments = new RegExp( + options.comments.substr(1, regex_pos - 1), + options.comments.substr(regex_pos + 1) + ); + } + if (comments instanceof RegExp) { + comment_filter = function(comment) { + return comment.type != "comment5" && comments.test(comment.value); + }; + } + else if (typeof comments === "function") { + comment_filter = function(comment) { + return comment.type != "comment5" && comments(this, comment); + }; + } + else if (comments === "some") { + comment_filter = is_some_comments; + } else { // NOTE includes "all" option + comment_filter = return_true; + } + } + + var indentation = 0; + var current_col = 0; + var current_line = 1; + var current_pos = 0; + var OUTPUT = ""; + + function to_ascii(str, identifier) { + return str.replace(/[\u0000-\u001f\u007f-\uffff]/g, function(ch) { + var code = ch.charCodeAt(0).toString(16); + if (code.length <= 2 && !identifier) { + while (code.length < 2) code = "0" + code; + return "\\x" + code; + } else { + while (code.length < 4) code = "0" + code; + return "\\u" + code; + } + }); + }; + + function make_string(str, quote) { + var dq = 0, sq = 0; + str = str.replace(/[\\\b\f\n\r\v\t\x22\x27\u2028\u2029\0\ufeff]/g, + function(s, i){ + switch (s) { + case '"': ++dq; return '"'; + case "'": ++sq; return "'"; + case "\\": return "\\\\"; + case "\n": return "\\n"; + case "\r": return "\\r"; + case "\t": return "\\t"; + case "\b": return "\\b"; + case "\f": return "\\f"; + case "\x0B": return options.screw_ie8 ? "\\v" : "\\x0B"; + case "\u2028": return "\\u2028"; + case "\u2029": return "\\u2029"; + case "\ufeff": return "\\ufeff"; + case "\0": + return /[0-7]/.test(str.charAt(i+1)) ? "\\x00" : "\\0"; + } + return s; + }); + function quote_single() { + return "'" + str.replace(/\x27/g, "\\'") + "'"; + } + function quote_double() { + return '"' + str.replace(/\x22/g, '\\"') + '"'; + } + if (options.ascii_only) str = to_ascii(str); + switch (options.quote_style) { + case 1: + return quote_single(); + case 2: + return quote_double(); + case 3: + return quote == "'" ? quote_single() : quote_double(); + default: + return dq > sq ? quote_single() : quote_double(); + } + }; + + function encode_string(str, quote) { + var ret = make_string(str, quote); + if (options.inline_script) { + ret = ret.replace(/<\x2fscript([>\/\t\n\f\r ])/gi, "<\\/script$1"); + ret = ret.replace(/\x3c!--/g, "\\x3c!--"); + ret = ret.replace(/--\x3e/g, "--\\x3e"); + } + return ret; + }; + + function make_name(name) { + name = name.toString(); + if (options.ascii_only) + name = to_ascii(name, true); + return name; + }; + + function make_indent(back) { + return repeat_string(" ", options.indent_start + indentation - back * options.indent_level); + }; + + /* -----[ beautification/minification ]----- */ + + var might_need_space = false; + var might_need_semicolon = false; + var might_add_newline = 0; + var last = ""; + + var ensure_line_len = options.max_line_len ? function() { + if (current_col > options.max_line_len) { + if (might_add_newline) { + var left = OUTPUT.slice(0, might_add_newline); + var right = OUTPUT.slice(might_add_newline); + OUTPUT = left + "\n" + right; + current_line++; + current_pos++; + current_col = right.length; + } + if (current_col > options.max_line_len) { + AST_Node.warn("Output exceeds {max_line_len} characters", options); + } + } + might_add_newline = 0; + } : noop; + + var requireSemicolonChars = makePredicate("( [ + * / - , ."); + + function print(str) { + str = String(str); + var ch = str.charAt(0); + var prev = last.charAt(last.length - 1); + if (might_need_semicolon) { + might_need_semicolon = false; + + if (prev == ":" && ch == "}" || (!ch || ";}".indexOf(ch) < 0) && prev != ";") { + if (options.semicolons || requireSemicolonChars(ch)) { + OUTPUT += ";"; + current_col++; + current_pos++; + } else { + ensure_line_len(); + OUTPUT += "\n"; + current_pos++; + current_line++; + current_col = 0; + + if (/^\s+$/.test(str)) { + // reset the semicolon flag, since we didn't print one + // now and might still have to later + might_need_semicolon = true; + } + } + + if (!options.beautify) + might_need_space = false; + } + } + + if (!options.beautify && options.preserve_line && stack[stack.length - 1]) { + var target_line = stack[stack.length - 1].start.line; + while (current_line < target_line) { + ensure_line_len(); + OUTPUT += "\n"; + current_pos++; + current_line++; + current_col = 0; + might_need_space = false; + } + } + + if (might_need_space) { + if ((is_identifier_char(prev) + && (is_identifier_char(ch) || ch == "\\")) + || (ch == "/" && ch == prev) + || ((ch == "+" || ch == "-") && ch == last)) + { + OUTPUT += " "; + current_col++; + current_pos++; + } + might_need_space = false; + } + OUTPUT += str; + current_pos += str.length; + var a = str.split(/\r?\n/), n = a.length - 1; + current_line += n; + current_col += a[0].length; + if (n > 0) { + ensure_line_len(); + current_col = a[n].length; + } + last = str; + }; + + var space = options.beautify ? function() { + print(" "); + } : function() { + might_need_space = true; + }; + + var indent = options.beautify ? function(half) { + if (options.beautify) { + print(make_indent(half ? 0.5 : 0)); + } + } : noop; + + var with_indent = options.beautify ? function(col, cont) { + if (col === true) col = next_indent(); + var save_indentation = indentation; + indentation = col; + var ret = cont(); + indentation = save_indentation; + return ret; + } : function(col, cont) { return cont() }; + + var newline = options.beautify ? function() { + print("\n"); + } : options.max_line_len ? function() { + ensure_line_len(); + might_add_newline = OUTPUT.length; + } : noop; + + var semicolon = options.beautify ? function() { + print(";"); + } : function() { + might_need_semicolon = true; + }; + + function force_semicolon() { + might_need_semicolon = false; + print(";"); + }; + + function next_indent() { + return indentation + options.indent_level; + }; + + function with_block(cont) { + var ret; + print("{"); + newline(); + with_indent(next_indent(), function(){ + ret = cont(); + }); + indent(); + print("}"); + return ret; + }; + + function with_parens(cont) { + print("("); + //XXX: still nice to have that for argument lists + //var ret = with_indent(current_col, cont); + var ret = cont(); + print(")"); + return ret; + }; + + function with_square(cont) { + print("["); + //var ret = with_indent(current_col, cont); + var ret = cont(); + print("]"); + return ret; + }; + + function comma() { + print(","); + space(); + }; + + function colon() { + print(":"); + if (options.space_colon) space(); + }; + + var add_mapping = options.source_map ? function(token, name) { + try { + if (token) options.source_map.add( + token.file || "?", + current_line, current_col, + token.line, token.col, + (!name && token.type == "name") ? token.value : name + ); + } catch(ex) { + AST_Node.warn("Couldn't figure out mapping for {file}:{line},{col} → {cline},{ccol} [{name}]", { + file: token.file, + line: token.line, + col: token.col, + cline: current_line, + ccol: current_col, + name: name || "" + }) + } + } : noop; + + function get() { + if (might_add_newline) { + ensure_line_len(); + } + return OUTPUT; + }; + + var stack = []; + return { + get : get, + toString : get, + indent : indent, + indentation : function() { return indentation }, + current_width : function() { return current_col - indentation }, + should_break : function() { return options.width && this.current_width() >= options.width }, + newline : newline, + print : print, + space : space, + comma : comma, + colon : colon, + last : function() { return last }, + semicolon : semicolon, + force_semicolon : force_semicolon, + to_ascii : to_ascii, + print_name : function(name) { print(make_name(name)) }, + print_string : function(str, quote, escape_directive) { + var encoded = encode_string(str, quote); + if (escape_directive === true && encoded.indexOf("\\") === -1) { + // Insert semicolons to break directive prologue + if (!EXPECT_DIRECTIVE.test(OUTPUT)) { + force_semicolon(); + } + force_semicolon(); + } + print(encoded); + }, + encode_string : encode_string, + next_indent : next_indent, + with_indent : with_indent, + with_block : with_block, + with_parens : with_parens, + with_square : with_square, + add_mapping : add_mapping, + option : function(opt) { return options[opt] }, + comment_filter : comment_filter, + line : function() { return current_line }, + col : function() { return current_col }, + pos : function() { return current_pos }, + push_node : function(node) { stack.push(node) }, + pop_node : function() { return stack.pop() }, + parent : function(n) { + return stack[stack.length - 2 - (n || 0)]; + } + }; + +}; + +/* -----[ code generators ]----- */ + +(function(){ + + /* -----[ utils ]----- */ + + function DEFPRINT(nodetype, generator) { + nodetype.DEFMETHOD("_codegen", generator); + }; + + var use_asm = false; + var in_directive = false; + + AST_Node.DEFMETHOD("print", function(stream, force_parens){ + var self = this, generator = self._codegen, prev_use_asm = use_asm; + if (self instanceof AST_Directive && self.value == "use asm" && stream.parent() instanceof AST_Scope) { + use_asm = true; + } + function doit() { + self.add_comments(stream); + self.add_source_map(stream); + generator(self, stream); + } + stream.push_node(self); + if (force_parens || self.needs_parens(stream)) { + stream.with_parens(doit); + } else { + doit(); + } + stream.pop_node(); + if (self instanceof AST_Scope) { + use_asm = prev_use_asm; + } + }); + + AST_Node.DEFMETHOD("print_to_string", function(options){ + var s = OutputStream(options); + if (!options) s._readonly = true; + this.print(s); + return s.get(); + }); + + /* -----[ comments ]----- */ + + AST_Node.DEFMETHOD("add_comments", function(output){ + if (output._readonly) return; + var self = this; + var start = self.start; + if (start && !start._comments_dumped) { + start._comments_dumped = true; + var comments = start.comments_before || []; + + // XXX: ugly fix for https://github.com/mishoo/UglifyJS2/issues/112 + // and https://github.com/mishoo/UglifyJS2/issues/372 + if (self instanceof AST_Exit && self.value) { + self.value.walk(new TreeWalker(function(node){ + if (node.start && node.start.comments_before) { + comments = comments.concat(node.start.comments_before); + node.start.comments_before = []; + } + if (node instanceof AST_Function || + node instanceof AST_Array || + node instanceof AST_Object) + { + return true; // don't go inside. + } + })); + } + + if (output.pos() == 0) { + if (comments.length > 0 && output.option("shebang") && comments[0].type == "comment5") { + output.print("#!" + comments.shift().value + "\n"); + output.indent(); + } + var preamble = output.option("preamble"); + if (preamble) { + output.print(preamble.replace(/\r\n?|[\n\u2028\u2029]|\s*$/g, "\n")); + } + } + + comments = comments.filter(output.comment_filter, self); + + // Keep single line comments after nlb, after nlb + if (!output.option("beautify") && comments.length > 0 && + /comment[134]/.test(comments[0].type) && + output.col() !== 0 && comments[0].nlb) + { + output.print("\n"); + } + + comments.forEach(function(c){ + if (/comment[134]/.test(c.type)) { + output.print("//" + c.value + "\n"); + output.indent(); + } + else if (c.type == "comment2") { + output.print("/*" + c.value + "*/"); + if (start.nlb) { + output.print("\n"); + output.indent(); + } else { + output.space(); + } + } + }); + } + }); + + /* -----[ PARENTHESES ]----- */ + + function PARENS(nodetype, func) { + if (Array.isArray(nodetype)) { + nodetype.forEach(function(nodetype){ + PARENS(nodetype, func); + }); + } else { + nodetype.DEFMETHOD("needs_parens", func); + } + }; + + PARENS(AST_Node, function(){ + return false; + }); + + // a function expression needs parens around it when it's provably + // the first token to appear in a statement. + PARENS(AST_Function, function(output){ + if (first_in_statement(output)) { + return true; + } + + if (output.option('wrap_iife')) { + var p = output.parent(); + return p instanceof AST_Call && p.expression === this; + } + + return false; + }); + + // same goes for an object literal, because otherwise it would be + // interpreted as a block of code. + PARENS(AST_Object, function(output){ + return first_in_statement(output); + }); + + PARENS(AST_Unary, function(output){ + var p = output.parent(); + return p instanceof AST_PropAccess && p.expression === this + || p instanceof AST_Call && p.expression === this; + }); + + PARENS(AST_Seq, function(output){ + var p = output.parent(); + return p instanceof AST_Call // (foo, bar)() or foo(1, (2, 3), 4) + || p instanceof AST_Unary // !(foo, bar, baz) + || p instanceof AST_Binary // 1 + (2, 3) + 4 ==> 8 + || p instanceof AST_VarDef // var a = (1, 2), b = a + a; ==> b == 4 + || p instanceof AST_PropAccess // (1, {foo:2}).foo or (1, {foo:2})["foo"] ==> 2 + || p instanceof AST_Array // [ 1, (2, 3), 4 ] ==> [ 1, 3, 4 ] + || p instanceof AST_ObjectProperty // { foo: (1, 2) }.foo ==> 2 + || p instanceof AST_Conditional /* (false, true) ? (a = 10, b = 20) : (c = 30) + * ==> 20 (side effect, set a := 10 and b := 20) */ + ; + }); + + PARENS(AST_Binary, function(output){ + var p = output.parent(); + // (foo && bar)() + if (p instanceof AST_Call && p.expression === this) + return true; + // typeof (foo && bar) + if (p instanceof AST_Unary) + return true; + // (foo && bar)["prop"], (foo && bar).prop + if (p instanceof AST_PropAccess && p.expression === this) + return true; + // this deals with precedence: 3 * (2 + 1) + if (p instanceof AST_Binary) { + var po = p.operator, pp = PRECEDENCE[po]; + var so = this.operator, sp = PRECEDENCE[so]; + if (pp > sp + || (pp == sp + && this === p.right)) { + return true; + } + } + }); + + PARENS(AST_PropAccess, function(output){ + var p = output.parent(); + if (p instanceof AST_New && p.expression === this) { + // i.e. new (foo.bar().baz) + // + // if there's one call into this subtree, then we need + // parens around it too, otherwise the call will be + // interpreted as passing the arguments to the upper New + // expression. + try { + this.walk(new TreeWalker(function(node){ + if (node instanceof AST_Call) throw p; + })); + } catch(ex) { + if (ex !== p) throw ex; + return true; + } + } + }); + + PARENS(AST_Call, function(output){ + var p = output.parent(), p1; + if (p instanceof AST_New && p.expression === this) + return true; + + // workaround for Safari bug. + // https://bugs.webkit.org/show_bug.cgi?id=123506 + return this.expression instanceof AST_Function + && p instanceof AST_PropAccess + && p.expression === this + && (p1 = output.parent(1)) instanceof AST_Assign + && p1.left === p; + }); + + PARENS(AST_New, function(output){ + var p = output.parent(); + if (!need_constructor_parens(this, output) + && (p instanceof AST_PropAccess // (new Date).getTime(), (new Date)["getTime"]() + || p instanceof AST_Call && p.expression === this)) // (new foo)(bar) + return true; + }); + + PARENS(AST_Number, function(output){ + var p = output.parent(); + if (p instanceof AST_PropAccess && p.expression === this) { + var value = this.getValue(); + if (value < 0 || /^0/.test(make_num(value))) { + return true; + } + } + }); + + PARENS([ AST_Assign, AST_Conditional ], function (output){ + var p = output.parent(); + // !(a = false) → true + if (p instanceof AST_Unary) + return true; + // 1 + (a = 2) + 3 → 6, side effect setting a = 2 + if (p instanceof AST_Binary && !(p instanceof AST_Assign)) + return true; + // (a = func)() —or— new (a = Object)() + if (p instanceof AST_Call && p.expression === this) + return true; + // (a = foo) ? bar : baz + if (p instanceof AST_Conditional && p.condition === this) + return true; + // (a = foo)["prop"] —or— (a = foo).prop + if (p instanceof AST_PropAccess && p.expression === this) + return true; + }); + + /* -----[ PRINTERS ]----- */ + + DEFPRINT(AST_Directive, function(self, output){ + output.print_string(self.value, self.quote); + output.semicolon(); + }); + DEFPRINT(AST_Debugger, function(self, output){ + output.print("debugger"); + output.semicolon(); + }); + + /* -----[ statements ]----- */ + + function display_body(body, is_toplevel, output, allow_directives) { + var last = body.length - 1; + in_directive = allow_directives; + body.forEach(function(stmt, i){ + if (in_directive === true && !(stmt instanceof AST_Directive || + stmt instanceof AST_EmptyStatement || + (stmt instanceof AST_SimpleStatement && stmt.body instanceof AST_String) + )) { + in_directive = false; + } + if (!(stmt instanceof AST_EmptyStatement)) { + output.indent(); + stmt.print(output); + if (!(i == last && is_toplevel)) { + output.newline(); + if (is_toplevel) output.newline(); + } + } + if (in_directive === true && + stmt instanceof AST_SimpleStatement && + stmt.body instanceof AST_String + ) { + in_directive = false; + } + }); + in_directive = false; + }; + + AST_StatementWithBody.DEFMETHOD("_do_print_body", function(output){ + force_statement(this.body, output); + }); + + DEFPRINT(AST_Statement, function(self, output){ + self.body.print(output); + output.semicolon(); + }); + DEFPRINT(AST_Toplevel, function(self, output){ + display_body(self.body, true, output, true); + output.print(""); + }); + DEFPRINT(AST_LabeledStatement, function(self, output){ + self.label.print(output); + output.colon(); + self.body.print(output); + }); + DEFPRINT(AST_SimpleStatement, function(self, output){ + self.body.print(output); + output.semicolon(); + }); + function print_bracketed(body, output, allow_directives) { + if (body.length > 0) output.with_block(function(){ + display_body(body, false, output, allow_directives); + }); + else output.print("{}"); + }; + DEFPRINT(AST_BlockStatement, function(self, output){ + print_bracketed(self.body, output); + }); + DEFPRINT(AST_EmptyStatement, function(self, output){ + output.semicolon(); + }); + DEFPRINT(AST_Do, function(self, output){ + output.print("do"); + output.space(); + make_block(self.body, output); + output.space(); + output.print("while"); + output.space(); + output.with_parens(function(){ + self.condition.print(output); + }); + output.semicolon(); + }); + DEFPRINT(AST_While, function(self, output){ + output.print("while"); + output.space(); + output.with_parens(function(){ + self.condition.print(output); + }); + output.space(); + self._do_print_body(output); + }); + DEFPRINT(AST_For, function(self, output){ + output.print("for"); + output.space(); + output.with_parens(function(){ + if (self.init) { + if (self.init instanceof AST_Definitions) { + self.init.print(output); + } else { + parenthesize_for_noin(self.init, output, true); + } + output.print(";"); + output.space(); + } else { + output.print(";"); + } + if (self.condition) { + self.condition.print(output); + output.print(";"); + output.space(); + } else { + output.print(";"); + } + if (self.step) { + self.step.print(output); + } + }); + output.space(); + self._do_print_body(output); + }); + DEFPRINT(AST_ForIn, function(self, output){ + output.print("for"); + output.space(); + output.with_parens(function(){ + self.init.print(output); + output.space(); + output.print("in"); + output.space(); + self.object.print(output); + }); + output.space(); + self._do_print_body(output); + }); + DEFPRINT(AST_With, function(self, output){ + output.print("with"); + output.space(); + output.with_parens(function(){ + self.expression.print(output); + }); + output.space(); + self._do_print_body(output); + }); + + /* -----[ functions ]----- */ + AST_Lambda.DEFMETHOD("_do_print", function(output, nokeyword){ + var self = this; + if (!nokeyword) { + output.print("function"); + } + if (self.name) { + output.space(); + self.name.print(output); + } + output.with_parens(function(){ + self.argnames.forEach(function(arg, i){ + if (i) output.comma(); + arg.print(output); + }); + }); + output.space(); + print_bracketed(self.body, output, true); + }); + DEFPRINT(AST_Lambda, function(self, output){ + self._do_print(output); + }); + + /* -----[ exits ]----- */ + AST_Exit.DEFMETHOD("_do_print", function(output, kind){ + output.print(kind); + if (this.value) { + output.space(); + this.value.print(output); + } + output.semicolon(); + }); + DEFPRINT(AST_Return, function(self, output){ + self._do_print(output, "return"); + }); + DEFPRINT(AST_Throw, function(self, output){ + self._do_print(output, "throw"); + }); + + /* -----[ loop control ]----- */ + AST_LoopControl.DEFMETHOD("_do_print", function(output, kind){ + output.print(kind); + if (this.label) { + output.space(); + this.label.print(output); + } + output.semicolon(); + }); + DEFPRINT(AST_Break, function(self, output){ + self._do_print(output, "break"); + }); + DEFPRINT(AST_Continue, function(self, output){ + self._do_print(output, "continue"); + }); + + /* -----[ if ]----- */ + function make_then(self, output) { + var b = self.body; + if (output.option("bracketize") + || !output.option("screw_ie8") && b instanceof AST_Do) + return make_block(b, output); + // The squeezer replaces "block"-s that contain only a single + // statement with the statement itself; technically, the AST + // is correct, but this can create problems when we output an + // IF having an ELSE clause where the THEN clause ends in an + // IF *without* an ELSE block (then the outer ELSE would refer + // to the inner IF). This function checks for this case and + // adds the block brackets if needed. + if (!b) return output.force_semicolon(); + while (true) { + if (b instanceof AST_If) { + if (!b.alternative) { + make_block(self.body, output); + return; + } + b = b.alternative; + } + else if (b instanceof AST_StatementWithBody) { + b = b.body; + } + else break; + } + force_statement(self.body, output); + }; + DEFPRINT(AST_If, function(self, output){ + output.print("if"); + output.space(); + output.with_parens(function(){ + self.condition.print(output); + }); + output.space(); + if (self.alternative) { + make_then(self, output); + output.space(); + output.print("else"); + output.space(); + if (self.alternative instanceof AST_If) + self.alternative.print(output); + else + force_statement(self.alternative, output); + } else { + self._do_print_body(output); + } + }); + + /* -----[ switch ]----- */ + DEFPRINT(AST_Switch, function(self, output){ + output.print("switch"); + output.space(); + output.with_parens(function(){ + self.expression.print(output); + }); + output.space(); + var last = self.body.length - 1; + if (last < 0) output.print("{}"); + else output.with_block(function(){ + self.body.forEach(function(branch, i){ + output.indent(true); + branch.print(output); + if (i < last && branch.body.length > 0) + output.newline(); + }); + }); + }); + AST_SwitchBranch.DEFMETHOD("_do_print_body", function(output){ + output.newline(); + this.body.forEach(function(stmt){ + output.indent(); + stmt.print(output); + output.newline(); + }); + }); + DEFPRINT(AST_Default, function(self, output){ + output.print("default:"); + self._do_print_body(output); + }); + DEFPRINT(AST_Case, function(self, output){ + output.print("case"); + output.space(); + self.expression.print(output); + output.print(":"); + self._do_print_body(output); + }); + + /* -----[ exceptions ]----- */ + DEFPRINT(AST_Try, function(self, output){ + output.print("try"); + output.space(); + print_bracketed(self.body, output); + if (self.bcatch) { + output.space(); + self.bcatch.print(output); + } + if (self.bfinally) { + output.space(); + self.bfinally.print(output); + } + }); + DEFPRINT(AST_Catch, function(self, output){ + output.print("catch"); + output.space(); + output.with_parens(function(){ + self.argname.print(output); + }); + output.space(); + print_bracketed(self.body, output); + }); + DEFPRINT(AST_Finally, function(self, output){ + output.print("finally"); + output.space(); + print_bracketed(self.body, output); + }); + + /* -----[ var/const ]----- */ + AST_Definitions.DEFMETHOD("_do_print", function(output, kind){ + output.print(kind); + output.space(); + this.definitions.forEach(function(def, i){ + if (i) output.comma(); + def.print(output); + }); + var p = output.parent(); + var in_for = p instanceof AST_For || p instanceof AST_ForIn; + var avoid_semicolon = in_for && p.init === this; + if (!avoid_semicolon) + output.semicolon(); + }); + DEFPRINT(AST_Var, function(self, output){ + self._do_print(output, "var"); + }); + DEFPRINT(AST_Const, function(self, output){ + self._do_print(output, "const"); + }); + + function parenthesize_for_noin(node, output, noin) { + if (!noin) node.print(output); + else try { + // need to take some precautions here: + // https://github.com/mishoo/UglifyJS2/issues/60 + node.walk(new TreeWalker(function(node){ + if (node instanceof AST_Binary && node.operator == "in") + throw output; + })); + node.print(output); + } catch(ex) { + if (ex !== output) throw ex; + node.print(output, true); + } + }; + + DEFPRINT(AST_VarDef, function(self, output){ + self.name.print(output); + if (self.value) { + output.space(); + output.print("="); + output.space(); + var p = output.parent(1); + var noin = p instanceof AST_For || p instanceof AST_ForIn; + parenthesize_for_noin(self.value, output, noin); + } + }); + + /* -----[ other expressions ]----- */ + DEFPRINT(AST_Call, function(self, output){ + self.expression.print(output); + if (self instanceof AST_New && !need_constructor_parens(self, output)) + return; + output.with_parens(function(){ + self.args.forEach(function(expr, i){ + if (i) output.comma(); + expr.print(output); + }); + }); + }); + DEFPRINT(AST_New, function(self, output){ + output.print("new"); + output.space(); + AST_Call.prototype._codegen(self, output); + }); + + AST_Seq.DEFMETHOD("_do_print", function(output){ + this.car.print(output); + if (this.cdr) { + output.comma(); + if (output.should_break()) { + output.newline(); + output.indent(); + } + this.cdr.print(output); + } + }); + DEFPRINT(AST_Seq, function(self, output){ + self._do_print(output); + // var p = output.parent(); + // if (p instanceof AST_Statement) { + // output.with_indent(output.next_indent(), function(){ + // self._do_print(output); + // }); + // } else { + // self._do_print(output); + // } + }); + DEFPRINT(AST_Dot, function(self, output){ + var expr = self.expression; + expr.print(output); + if (expr instanceof AST_Number && expr.getValue() >= 0) { + if (!/[xa-f.)]/i.test(output.last())) { + output.print("."); + } + } + output.print("."); + // the name after dot would be mapped about here. + output.add_mapping(self.end); + output.print_name(self.property); + }); + DEFPRINT(AST_Sub, function(self, output){ + self.expression.print(output); + output.print("["); + self.property.print(output); + output.print("]"); + }); + DEFPRINT(AST_UnaryPrefix, function(self, output){ + var op = self.operator; + output.print(op); + if (/^[a-z]/i.test(op) + || (/[+-]$/.test(op) + && self.expression instanceof AST_UnaryPrefix + && /^[+-]/.test(self.expression.operator))) { + output.space(); + } + self.expression.print(output); + }); + DEFPRINT(AST_UnaryPostfix, function(self, output){ + self.expression.print(output); + output.print(self.operator); + }); + DEFPRINT(AST_Binary, function(self, output){ + var op = self.operator; + self.left.print(output); + if (op[0] == ">" /* ">>" ">>>" ">" ">=" */ + && self.left instanceof AST_UnaryPostfix + && self.left.operator == "--") { + // space is mandatory to avoid outputting --> + output.print(" "); + } else { + // the space is optional depending on "beautify" + output.space(); + } + output.print(op); + if ((op == "<" || op == "<<") + && self.right instanceof AST_UnaryPrefix + && self.right.operator == "!" + && self.right.expression instanceof AST_UnaryPrefix + && self.right.expression.operator == "--") { + // space is mandatory to avoid outputting ") && S.newline_before) { + forward(3); + skip_line_comment("comment4"); + continue; + } + } + var ch = peek(); + if (!ch) return token("eof"); + var code = ch.charCodeAt(0); + switch (code) { + case 34: case 39: return read_string(ch); + case 46: return handle_dot(); + case 47: { + var tok = handle_slash(); + if (tok === next_token) continue; + return tok; + } + } + if (is_digit(code)) return read_num(); + if (PUNC_CHARS(ch)) return token("punc", next()); + if (OPERATOR_CHARS(ch)) return read_operator(); + if (code == 92 || is_identifier_start(code)) return read_word(); + break; + } + parse_error("Unexpected character '" + ch + "'"); + }; + + next_token.context = function(nc) { + if (nc) S = nc; + return S; + }; + + next_token.add_directive = function(directive) { + S.directive_stack[S.directive_stack.length - 1].push(directive); + + if (S.directives[directive] === undefined) { + S.directives[directive] = 1; + } else { + S.directives[directive]++; + } + } + + next_token.push_directives_stack = function() { + S.directive_stack.push([]); + } + + next_token.pop_directives_stack = function() { + var directives = S.directive_stack[S.directive_stack.length - 1]; + + for (var i = 0; i < directives.length; i++) { + S.directives[directives[i]]--; + } + + S.directive_stack.pop(); + } + + next_token.has_directive = function(directive) { + return S.directives[directive] !== undefined && + S.directives[directive] > 0; + } + + return next_token; + +}; + +/* -----[ Parser (constants) ]----- */ + +var UNARY_PREFIX = makePredicate([ + "typeof", + "void", + "delete", + "--", + "++", + "!", + "~", + "-", + "+" +]); + +var UNARY_POSTFIX = makePredicate([ "--", "++" ]); + +var ASSIGNMENT = makePredicate([ "=", "+=", "-=", "/=", "*=", "%=", ">>=", "<<=", ">>>=", "|=", "^=", "&=" ]); + +var PRECEDENCE = (function(a, ret){ + for (var i = 0; i < a.length; ++i) { + var b = a[i]; + for (var j = 0; j < b.length; ++j) { + ret[b[j]] = i + 1; + } + } + return ret; +})( + [ + ["||"], + ["&&"], + ["|"], + ["^"], + ["&"], + ["==", "===", "!=", "!=="], + ["<", ">", "<=", ">=", "in", "instanceof"], + [">>", "<<", ">>>"], + ["+", "-"], + ["*", "/", "%"] + ], + {} +); + +var STATEMENTS_WITH_LABELS = array_to_hash([ "for", "do", "while", "switch" ]); + +var ATOMIC_START_TOKEN = array_to_hash([ "atom", "num", "string", "regexp", "name" ]); + +/* -----[ Parser ]----- */ + +function parse($TEXT, options) { + + options = defaults(options, { + bare_returns : false, + cli : false, + expression : false, + filename : null, + html5_comments : true, + shebang : true, + strict : false, + toplevel : null, + }); + + var S = { + input : (typeof $TEXT == "string" + ? tokenizer($TEXT, options.filename, + options.html5_comments, options.shebang) + : $TEXT), + token : null, + prev : null, + peeked : null, + in_function : 0, + in_directives : true, + in_loop : 0, + labels : [] + }; + + S.token = next(); + + function is(type, value) { + return is_token(S.token, type, value); + }; + + function peek() { return S.peeked || (S.peeked = S.input()); }; + + function next() { + S.prev = S.token; + if (S.peeked) { + S.token = S.peeked; + S.peeked = null; + } else { + S.token = S.input(); + } + S.in_directives = S.in_directives && ( + S.token.type == "string" || is("punc", ";") + ); + return S.token; + }; + + function prev() { + return S.prev; + }; + + function croak(msg, line, col, pos) { + var ctx = S.input.context(); + js_error(msg, + ctx.filename, + line != null ? line : ctx.tokline, + col != null ? col : ctx.tokcol, + pos != null ? pos : ctx.tokpos); + }; + + function token_error(token, msg) { + croak(msg, token.line, token.col); + }; + + function unexpected(token) { + if (token == null) + token = S.token; + token_error(token, "Unexpected token: " + token.type + " (" + token.value + ")"); + }; + + function expect_token(type, val) { + if (is(type, val)) { + return next(); + } + token_error(S.token, "Unexpected token " + S.token.type + " «" + S.token.value + "»" + ", expected " + type + " «" + val + "»"); + }; + + function expect(punc) { return expect_token("punc", punc); }; + + function can_insert_semicolon() { + return !options.strict && ( + S.token.nlb || is("eof") || is("punc", "}") + ); + }; + + function semicolon(optional) { + if (is("punc", ";")) next(); + else if (!optional && !can_insert_semicolon()) unexpected(); + }; + + function parenthesised() { + expect("("); + var exp = expression(true); + expect(")"); + return exp; + }; + + function embed_tokens(parser) { + return function() { + var start = S.token; + var expr = parser(); + var end = prev(); + expr.start = start; + expr.end = end; + return expr; + }; + }; + + function handle_regexp() { + if (is("operator", "/") || is("operator", "/=")) { + S.peeked = null; + S.token = S.input(S.token.value.substr(1)); // force regexp + } + }; + + var statement = embed_tokens(function() { + handle_regexp(); + switch (S.token.type) { + case "string": + if (S.in_directives) { + var token = peek(); + if (S.token.raw.indexOf("\\") == -1 + && (token.nlb + || is_token(token, "eof") + || is_token(token, "punc", ";") + || is_token(token, "punc", "}"))) { + S.input.add_directive(S.token.value); + } else { + S.in_directives = false; + } + } + var dir = S.in_directives, stat = simple_statement(); + return dir ? new AST_Directive(stat.body) : stat; + case "num": + case "regexp": + case "operator": + case "atom": + return simple_statement(); + + case "name": + return is_token(peek(), "punc", ":") + ? labeled_statement() + : simple_statement(); + + case "punc": + switch (S.token.value) { + case "{": + return new AST_BlockStatement({ + start : S.token, + body : block_(), + end : prev() + }); + case "[": + case "(": + return simple_statement(); + case ";": + S.in_directives = false; + next(); + return new AST_EmptyStatement(); + default: + unexpected(); + } + + case "keyword": + switch (S.token.value) { + case "break": + next(); + return break_cont(AST_Break); + + case "continue": + next(); + return break_cont(AST_Continue); + + case "debugger": + next(); + semicolon(); + return new AST_Debugger(); + + case "do": + next(); + var body = in_loop(statement); + expect_token("keyword", "while"); + var condition = parenthesised(); + semicolon(true); + return new AST_Do({ + body : body, + condition : condition + }); + + case "while": + next(); + return new AST_While({ + condition : parenthesised(), + body : in_loop(statement) + }); + + case "for": + next(); + return for_(); + + case "function": + next(); + return function_(AST_Defun); + + case "if": + next(); + return if_(); + + case "return": + if (S.in_function == 0 && !options.bare_returns) + croak("'return' outside of function"); + next(); + var value = null; + if (is("punc", ";")) { + next(); + } else if (!can_insert_semicolon()) { + value = expression(true); + semicolon(); + } + return new AST_Return({ + value: value + }); + + case "switch": + next(); + return new AST_Switch({ + expression : parenthesised(), + body : in_loop(switch_body_) + }); + + case "throw": + next(); + if (S.token.nlb) + croak("Illegal newline after 'throw'"); + var value = expression(true); + semicolon(); + return new AST_Throw({ + value: value + }); + + case "try": + next(); + return try_(); + + case "var": + next(); + var node = var_(); + semicolon(); + return node; + + case "const": + next(); + var node = const_(); + semicolon(); + return node; + + case "with": + if (S.input.has_directive("use strict")) { + croak("Strict mode may not include a with statement"); + } + next(); + return new AST_With({ + expression : parenthesised(), + body : statement() + }); + } + } + unexpected(); + }); + + function labeled_statement() { + var label = as_symbol(AST_Label); + if (find_if(function(l){ return l.name == label.name }, S.labels)) { + // ECMA-262, 12.12: An ECMAScript program is considered + // syntactically incorrect if it contains a + // LabelledStatement that is enclosed by a + // LabelledStatement with the same Identifier as label. + croak("Label " + label.name + " defined twice"); + } + expect(":"); + S.labels.push(label); + var stat = statement(); + S.labels.pop(); + if (!(stat instanceof AST_IterationStatement)) { + // check for `continue` that refers to this label. + // those should be reported as syntax errors. + // https://github.com/mishoo/UglifyJS2/issues/287 + label.references.forEach(function(ref){ + if (ref instanceof AST_Continue) { + ref = ref.label.start; + croak("Continue label `" + label.name + "` refers to non-IterationStatement.", + ref.line, ref.col, ref.pos); + } + }); + } + return new AST_LabeledStatement({ body: stat, label: label }); + }; + + function simple_statement(tmp) { + return new AST_SimpleStatement({ body: (tmp = expression(true), semicolon(), tmp) }); + }; + + function break_cont(type) { + var label = null, ldef; + if (!can_insert_semicolon()) { + label = as_symbol(AST_LabelRef, true); + } + if (label != null) { + ldef = find_if(function(l){ return l.name == label.name }, S.labels); + if (!ldef) + croak("Undefined label " + label.name); + label.thedef = ldef; + } + else if (S.in_loop == 0) + croak(type.TYPE + " not inside a loop or switch"); + semicolon(); + var stat = new type({ label: label }); + if (ldef) ldef.references.push(stat); + return stat; + }; + + function for_() { + expect("("); + var init = null; + if (!is("punc", ";")) { + init = is("keyword", "var") + ? (next(), var_(true)) + : expression(true, true); + if (is("operator", "in")) { + if (init instanceof AST_Var && init.definitions.length > 1) + croak("Only one variable declaration allowed in for..in loop"); + next(); + return for_in(init); + } + } + return regular_for(init); + }; + + function regular_for(init) { + expect(";"); + var test = is("punc", ";") ? null : expression(true); + expect(";"); + var step = is("punc", ")") ? null : expression(true); + expect(")"); + return new AST_For({ + init : init, + condition : test, + step : step, + body : in_loop(statement) + }); + }; + + function for_in(init) { + var lhs = init instanceof AST_Var ? init.definitions[0].name : null; + var obj = expression(true); + expect(")"); + return new AST_ForIn({ + init : init, + name : lhs, + object : obj, + body : in_loop(statement) + }); + }; + + var function_ = function(ctor) { + var in_statement = ctor === AST_Defun; + var name = is("name") ? as_symbol(in_statement ? AST_SymbolDefun : AST_SymbolLambda) : null; + if (in_statement && !name) + unexpected(); + expect("("); + return new ctor({ + name: name, + argnames: (function(first, a){ + while (!is("punc", ")")) { + if (first) first = false; else expect(","); + a.push(as_symbol(AST_SymbolFunarg)); + } + next(); + return a; + })(true, []), + body: (function(loop, labels){ + ++S.in_function; + S.in_directives = true; + S.input.push_directives_stack(); + S.in_loop = 0; + S.labels = []; + var a = block_(); + S.input.pop_directives_stack(); + --S.in_function; + S.in_loop = loop; + S.labels = labels; + return a; + })(S.in_loop, S.labels) + }); + }; + + function if_() { + var cond = parenthesised(), body = statement(), belse = null; + if (is("keyword", "else")) { + next(); + belse = statement(); + } + return new AST_If({ + condition : cond, + body : body, + alternative : belse + }); + }; + + function block_() { + expect("{"); + var a = []; + while (!is("punc", "}")) { + if (is("eof")) unexpected(); + a.push(statement()); + } + next(); + return a; + }; + + function switch_body_() { + expect("{"); + var a = [], cur = null, branch = null, tmp; + while (!is("punc", "}")) { + if (is("eof")) unexpected(); + if (is("keyword", "case")) { + if (branch) branch.end = prev(); + cur = []; + branch = new AST_Case({ + start : (tmp = S.token, next(), tmp), + expression : expression(true), + body : cur + }); + a.push(branch); + expect(":"); + } + else if (is("keyword", "default")) { + if (branch) branch.end = prev(); + cur = []; + branch = new AST_Default({ + start : (tmp = S.token, next(), expect(":"), tmp), + body : cur + }); + a.push(branch); + } + else { + if (!cur) unexpected(); + cur.push(statement()); + } + } + if (branch) branch.end = prev(); + next(); + return a; + }; + + function try_() { + var body = block_(), bcatch = null, bfinally = null; + if (is("keyword", "catch")) { + var start = S.token; + next(); + expect("("); + var name = as_symbol(AST_SymbolCatch); + expect(")"); + bcatch = new AST_Catch({ + start : start, + argname : name, + body : block_(), + end : prev() + }); + } + if (is("keyword", "finally")) { + var start = S.token; + next(); + bfinally = new AST_Finally({ + start : start, + body : block_(), + end : prev() + }); + } + if (!bcatch && !bfinally) + croak("Missing catch/finally blocks"); + return new AST_Try({ + body : body, + bcatch : bcatch, + bfinally : bfinally + }); + }; + + function vardefs(no_in, in_const) { + var a = []; + for (;;) { + a.push(new AST_VarDef({ + start : S.token, + name : as_symbol(in_const ? AST_SymbolConst : AST_SymbolVar), + value : is("operator", "=") ? (next(), expression(false, no_in)) : null, + end : prev() + })); + if (!is("punc", ",")) + break; + next(); + } + return a; + }; + + var var_ = function(no_in) { + return new AST_Var({ + start : prev(), + definitions : vardefs(no_in, false), + end : prev() + }); + }; + + var const_ = function() { + return new AST_Const({ + start : prev(), + definitions : vardefs(false, true), + end : prev() + }); + }; + + var new_ = function(allow_calls) { + var start = S.token; + expect_token("operator", "new"); + var newexp = expr_atom(false), args; + if (is("punc", "(")) { + next(); + args = expr_list(")"); + } else { + args = []; + } + return subscripts(new AST_New({ + start : start, + expression : newexp, + args : args, + end : prev() + }), allow_calls); + }; + + function as_atom_node() { + var tok = S.token, ret; + switch (tok.type) { + case "name": + case "keyword": + ret = _make_symbol(AST_SymbolRef); + break; + case "num": + ret = new AST_Number({ start: tok, end: tok, value: tok.value }); + break; + case "string": + ret = new AST_String({ + start : tok, + end : tok, + value : tok.value, + quote : tok.quote + }); + break; + case "regexp": + ret = new AST_RegExp({ start: tok, end: tok, value: tok.value }); + break; + case "atom": + switch (tok.value) { + case "false": + ret = new AST_False({ start: tok, end: tok }); + break; + case "true": + ret = new AST_True({ start: tok, end: tok }); + break; + case "null": + ret = new AST_Null({ start: tok, end: tok }); + break; + } + break; + case "operator": + if (!is_identifier_string(tok.value)) { + croak("Invalid getter/setter name: " + tok.value, + tok.line, tok.col, tok.pos); + } + ret = _make_symbol(AST_SymbolRef); + break; + } + next(); + return ret; + }; + + var expr_atom = function(allow_calls) { + if (is("operator", "new")) { + return new_(allow_calls); + } + var start = S.token; + if (is("punc")) { + switch (start.value) { + case "(": + next(); + var ex = expression(true); + ex.start = start; + ex.end = S.token; + expect(")"); + return subscripts(ex, allow_calls); + case "[": + return subscripts(array_(), allow_calls); + case "{": + return subscripts(object_(), allow_calls); + } + unexpected(); + } + if (is("keyword", "function")) { + next(); + var func = function_(AST_Function); + func.start = start; + func.end = prev(); + return subscripts(func, allow_calls); + } + if (ATOMIC_START_TOKEN[S.token.type]) { + return subscripts(as_atom_node(), allow_calls); + } + unexpected(); + }; + + function expr_list(closing, allow_trailing_comma, allow_empty) { + var first = true, a = []; + while (!is("punc", closing)) { + if (first) first = false; else expect(","); + if (allow_trailing_comma && is("punc", closing)) break; + if (is("punc", ",") && allow_empty) { + a.push(new AST_Hole({ start: S.token, end: S.token })); + } else { + a.push(expression(false)); + } + } + next(); + return a; + }; + + var array_ = embed_tokens(function() { + expect("["); + return new AST_Array({ + elements: expr_list("]", !options.strict, true) + }); + }); + + var create_accessor = embed_tokens(function() { + return function_(AST_Accessor); + }); + + var object_ = embed_tokens(function() { + expect("{"); + var first = true, a = []; + while (!is("punc", "}")) { + if (first) first = false; else expect(","); + if (!options.strict && is("punc", "}")) + // allow trailing comma + break; + var start = S.token; + var type = start.type; + var name = as_property_name(); + if (type == "name" && !is("punc", ":")) { + var key = new AST_SymbolAccessor({ + start: S.token, + name: as_property_name(), + end: prev() + }); + if (name == "get") { + a.push(new AST_ObjectGetter({ + start : start, + key : key, + value : create_accessor(), + end : prev() + })); + continue; + } + if (name == "set") { + a.push(new AST_ObjectSetter({ + start : start, + key : key, + value : create_accessor(), + end : prev() + })); + continue; + } + } + expect(":"); + a.push(new AST_ObjectKeyVal({ + start : start, + quote : start.quote, + key : name, + value : expression(false), + end : prev() + })); + } + next(); + return new AST_Object({ properties: a }); + }); + + function as_property_name() { + var tmp = S.token; + switch (tmp.type) { + case "operator": + if (!KEYWORDS(tmp.value)) unexpected(); + case "num": + case "string": + case "name": + case "keyword": + case "atom": + next(); + return tmp.value; + default: + unexpected(); + } + }; + + function as_name() { + var tmp = S.token; + if (tmp.type != "name") unexpected(); + next(); + return tmp.value; + }; + + function _make_symbol(type) { + var name = S.token.value; + return new (name == "this" ? AST_This : type)({ + name : String(name), + start : S.token, + end : S.token + }); + }; + + function as_symbol(type, noerror) { + if (!is("name")) { + if (!noerror) croak("Name expected"); + return null; + } + var sym = _make_symbol(type); + next(); + return sym; + }; + + var subscripts = function(expr, allow_calls) { + var start = expr.start; + if (is("punc", ".")) { + next(); + return subscripts(new AST_Dot({ + start : start, + expression : expr, + property : as_name(), + end : prev() + }), allow_calls); + } + if (is("punc", "[")) { + next(); + var prop = expression(true); + expect("]"); + return subscripts(new AST_Sub({ + start : start, + expression : expr, + property : prop, + end : prev() + }), allow_calls); + } + if (allow_calls && is("punc", "(")) { + next(); + return subscripts(new AST_Call({ + start : start, + expression : expr, + args : expr_list(")"), + end : prev() + }), true); + } + return expr; + }; + + var maybe_unary = function(allow_calls) { + var start = S.token; + if (is("operator") && UNARY_PREFIX(start.value)) { + next(); + handle_regexp(); + var ex = make_unary(AST_UnaryPrefix, start, maybe_unary(allow_calls)); + ex.start = start; + ex.end = prev(); + return ex; + } + var val = expr_atom(allow_calls); + while (is("operator") && UNARY_POSTFIX(S.token.value) && !S.token.nlb) { + val = make_unary(AST_UnaryPostfix, S.token, val); + val.start = start; + val.end = S.token; + next(); + } + return val; + }; + + function make_unary(ctor, token, expr) { + var op = token.value; + if ((op == "++" || op == "--") && !is_assignable(expr)) + croak("Invalid use of " + op + " operator", token.line, token.col, token.pos); + return new ctor({ operator: op, expression: expr }); + }; + + var expr_op = function(left, min_prec, no_in) { + var op = is("operator") ? S.token.value : null; + if (op == "in" && no_in) op = null; + var prec = op != null ? PRECEDENCE[op] : null; + if (prec != null && prec > min_prec) { + next(); + var right = expr_op(maybe_unary(true), prec, no_in); + return expr_op(new AST_Binary({ + start : left.start, + left : left, + operator : op, + right : right, + end : right.end + }), min_prec, no_in); + } + return left; + }; + + function expr_ops(no_in) { + return expr_op(maybe_unary(true), 0, no_in); + }; + + var maybe_conditional = function(no_in) { + var start = S.token; + var expr = expr_ops(no_in); + if (is("operator", "?")) { + next(); + var yes = expression(false); + expect(":"); + return new AST_Conditional({ + start : start, + condition : expr, + consequent : yes, + alternative : expression(false, no_in), + end : prev() + }); + } + return expr; + }; + + function is_assignable(expr) { + if (options.cli) return true; + return expr instanceof AST_PropAccess || expr instanceof AST_SymbolRef; + }; + + var maybe_assign = function(no_in) { + var start = S.token; + var left = maybe_conditional(no_in), val = S.token.value; + if (is("operator") && ASSIGNMENT(val)) { + if (is_assignable(left)) { + next(); + return new AST_Assign({ + start : start, + left : left, + operator : val, + right : maybe_assign(no_in), + end : prev() + }); + } + croak("Invalid assignment"); + } + return left; + }; + + var expression = function(commas, no_in) { + var start = S.token; + var expr = maybe_assign(no_in); + if (commas && is("punc", ",")) { + next(); + return new AST_Seq({ + start : start, + car : expr, + cdr : expression(true, no_in), + end : peek() + }); + } + return expr; + }; + + function in_loop(cont) { + ++S.in_loop; + var ret = cont(); + --S.in_loop; + return ret; + }; + + if (options.expression) { + return expression(true); + } + + return (function(){ + var start = S.token; + var body = []; + S.input.push_directives_stack(); + while (!is("eof")) + body.push(statement()); + S.input.pop_directives_stack(); + var end = prev(); + var toplevel = options.toplevel; + if (toplevel) { + toplevel.body = toplevel.body.concat(body); + toplevel.end = end; + } else { + toplevel = new AST_Toplevel({ start: start, body: body, end: end }); + } + return toplevel; + })(); + +}; diff --git a/node_modules/uglify-js/lib/propmangle.js b/node_modules/uglify-js/lib/propmangle.js new file mode 100644 index 0000000..b622299 --- /dev/null +++ b/node_modules/uglify-js/lib/propmangle.js @@ -0,0 +1,264 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS2 + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + 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. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 HOLDER 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. + + ***********************************************************************/ + +"use strict"; + +function find_builtins() { + // NaN will be included due to Number.NaN + var a = [ + "null", + "true", + "false", + "Infinity", + "-Infinity", + "undefined", + ]; + [ Object, Array, Function, Number, + String, Boolean, Error, Math, + Date, RegExp + ].forEach(function(ctor){ + Object.getOwnPropertyNames(ctor).map(add); + if (ctor.prototype) { + Object.getOwnPropertyNames(ctor.prototype).map(add); + } + }); + function add(name) { + push_uniq(a, name); + } + return a; +} + +function mangle_properties(ast, options) { + options = defaults(options, { + cache: null, + debug: false, + ignore_quoted: false, + only_cache: false, + regex: null, + reserved: null, + }); + + var reserved = options.reserved; + if (reserved == null) + reserved = find_builtins(); + + var cache = options.cache; + if (cache == null) { + cache = { + cname: -1, + props: new Dictionary() + }; + } + + var regex = options.regex; + var ignore_quoted = options.ignore_quoted; + + // note debug is either false (disabled), or a string of the debug suffix to use (enabled). + // note debug may be enabled as an empty string, which is falsey. Also treat passing 'true' + // the same as passing an empty string. + var debug = (options.debug !== false); + var debug_name_suffix; + if (debug) { + debug_name_suffix = (options.debug === true ? "" : options.debug); + } + + var names_to_mangle = []; + var unmangleable = []; + var ignored = {}; + + // step 1: find candidates to mangle + ast.walk(new TreeWalker(function(node){ + if (node instanceof AST_ObjectKeyVal) { + add(node.key, ignore_quoted && node.quote); + } + else if (node instanceof AST_ObjectProperty) { + // setter or getter, since KeyVal is handled above + add(node.key.name); + } + else if (node instanceof AST_Dot) { + add(node.property); + } + else if (node instanceof AST_Sub) { + addStrings(node.property, ignore_quoted); + } + })); + + // step 2: transform the tree, renaming properties + return ast.transform(new TreeTransformer(function(node){ + if (node instanceof AST_ObjectKeyVal) { + if (!(ignore_quoted && node.quote)) + node.key = mangle(node.key); + } + else if (node instanceof AST_ObjectProperty) { + // setter or getter + node.key.name = mangle(node.key.name); + } + else if (node instanceof AST_Dot) { + node.property = mangle(node.property); + } + else if (node instanceof AST_Sub) { + if (!ignore_quoted) + node.property = mangleStrings(node.property); + } + // else if (node instanceof AST_String) { + // if (should_mangle(node.value)) { + // AST_Node.warn( + // "Found \"{prop}\" property candidate for mangling in an arbitrary string [{file}:{line},{col}]", { + // file : node.start.file, + // line : node.start.line, + // col : node.start.col, + // prop : node.value + // } + // ); + // } + // } + })); + + // only function declarations after this line + + function can_mangle(name) { + if (unmangleable.indexOf(name) >= 0) return false; + if (reserved.indexOf(name) >= 0) return false; + if (options.only_cache) { + return cache.props.has(name); + } + if (/^-?[0-9]+(\.[0-9]+)?(e[+-][0-9]+)?$/.test(name)) return false; + return true; + } + + function should_mangle(name) { + if (ignore_quoted && name in ignored) return false; + if (regex && !regex.test(name)) return false; + if (reserved.indexOf(name) >= 0) return false; + return cache.props.has(name) + || names_to_mangle.indexOf(name) >= 0; + } + + function add(name, ignore) { + if (ignore) { + ignored[name] = true; + return; + } + + if (can_mangle(name)) + push_uniq(names_to_mangle, name); + + if (!should_mangle(name)) { + push_uniq(unmangleable, name); + } + } + + function mangle(name) { + if (!should_mangle(name)) { + return name; + } + + var mangled = cache.props.get(name); + if (!mangled) { + if (debug) { + // debug mode: use a prefix and suffix to preserve readability, e.g. o.foo -> o._$foo$NNN_. + var debug_mangled = "_$" + name + "$" + debug_name_suffix + "_"; + + if (can_mangle(debug_mangled) && !(ignore_quoted && debug_mangled in ignored)) { + mangled = debug_mangled; + } + } + + // either debug mode is off, or it is on and we could not use the mangled name + if (!mangled) { + // note can_mangle() does not check if the name collides with the 'ignored' set + // (filled with quoted properties when ignore_quoted set). Make sure we add this + // check so we don't collide with a quoted name. + do { + mangled = base54(++cache.cname); + } while (!can_mangle(mangled) || (ignore_quoted && mangled in ignored)); + } + + cache.props.set(name, mangled); + } + return mangled; + } + + function addStrings(node, ignore) { + var out = {}; + try { + (function walk(node){ + node.walk(new TreeWalker(function(node){ + if (node instanceof AST_Seq) { + walk(node.cdr); + return true; + } + if (node instanceof AST_String) { + add(node.value, ignore); + return true; + } + if (node instanceof AST_Conditional) { + walk(node.consequent); + walk(node.alternative); + return true; + } + throw out; + })); + })(node); + } catch(ex) { + if (ex !== out) throw ex; + } + } + + function mangleStrings(node) { + return node.transform(new TreeTransformer(function(node){ + if (node instanceof AST_Seq) { + node.cdr = mangleStrings(node.cdr); + } + else if (node instanceof AST_String) { + node.value = mangle(node.value); + } + else if (node instanceof AST_Conditional) { + node.consequent = mangleStrings(node.consequent); + node.alternative = mangleStrings(node.alternative); + } + return node; + })); + } + +} diff --git a/node_modules/uglify-js/lib/scope.js b/node_modules/uglify-js/lib/scope.js new file mode 100644 index 0000000..bf6dbcb --- /dev/null +++ b/node_modules/uglify-js/lib/scope.js @@ -0,0 +1,656 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS2 + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + 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. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 HOLDER 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. + + ***********************************************************************/ + +"use strict"; + +function SymbolDef(scope, index, orig) { + this.name = orig.name; + this.orig = [ orig ]; + this.scope = scope; + this.references = []; + this.global = false; + this.mangled_name = null; + this.undeclared = false; + this.index = index; + this.id = SymbolDef.next_id++; +}; + +SymbolDef.next_id = 1; + +SymbolDef.prototype = { + unmangleable: function(options) { + if (!options) options = {}; + + return (this.global && !options.toplevel) + || this.undeclared + || (!options.eval && (this.scope.uses_eval || this.scope.uses_with)) + || (options.keep_fnames + && (this.orig[0] instanceof AST_SymbolLambda + || this.orig[0] instanceof AST_SymbolDefun)); + }, + mangle: function(options) { + var cache = options.cache && options.cache.props; + if (this.global && cache && cache.has(this.name)) { + this.mangled_name = cache.get(this.name); + } + else if (!this.mangled_name && !this.unmangleable(options)) { + var s = this.scope; + var sym = this.orig[0]; + if (!options.screw_ie8 && sym instanceof AST_SymbolLambda) + s = s.parent_scope; + var def; + if (this.defun && (def = this.defun.variables.get(this.name))) { + this.mangled_name = def.mangled_name || def.name; + } else + this.mangled_name = s.next_mangled(options, this); + if (this.global && cache) { + cache.set(this.name, this.mangled_name); + } + } + } +}; + +AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ + options = defaults(options, { + cache: null, + screw_ie8: true, + }); + + // pass 1: setup scope chaining and handle definitions + var self = this; + var scope = self.parent_scope = null; + var labels = new Dictionary(); + var defun = null; + var tw = new TreeWalker(function(node, descend){ + if (node instanceof AST_Catch) { + var save_scope = scope; + scope = new AST_Scope(node); + scope.init_scope_vars(save_scope); + descend(); + scope = save_scope; + return true; + } + if (node instanceof AST_Scope) { + node.init_scope_vars(scope); + var save_scope = scope; + var save_defun = defun; + var save_labels = labels; + defun = scope = node; + labels = new Dictionary(); + descend(); + scope = save_scope; + defun = save_defun; + labels = save_labels; + return true; // don't descend again in TreeWalker + } + if (node instanceof AST_LabeledStatement) { + var l = node.label; + if (labels.has(l.name)) { + throw new Error(string_template("Label {name} defined twice", l)); + } + labels.set(l.name, l); + descend(); + labels.del(l.name); + return true; // no descend again + } + if (node instanceof AST_With) { + for (var s = scope; s; s = s.parent_scope) + s.uses_with = true; + return; + } + if (node instanceof AST_Symbol) { + node.scope = scope; + } + if (node instanceof AST_Label) { + node.thedef = node; + node.references = []; + } + if (node instanceof AST_SymbolLambda) { + defun.def_function(node); + } + else if (node instanceof AST_SymbolDefun) { + // Careful here, the scope where this should be defined is + // the parent scope. The reason is that we enter a new + // scope when we encounter the AST_Defun node (which is + // instanceof AST_Scope) but we get to the symbol a bit + // later. + (node.scope = defun.parent_scope).def_function(node); + } + else if (node instanceof AST_SymbolVar + || node instanceof AST_SymbolConst) { + defun.def_variable(node); + if (defun !== scope) { + node.mark_enclosed(options); + var def = scope.find_variable(node); + if (node.thedef !== def) { + node.thedef = def; + node.reference(options); + } + } + } + else if (node instanceof AST_SymbolCatch) { + scope.def_variable(node).defun = defun; + } + else if (node instanceof AST_LabelRef) { + var sym = labels.get(node.name); + if (!sym) throw new Error(string_template("Undefined label {name} [{line},{col}]", { + name: node.name, + line: node.start.line, + col: node.start.col + })); + node.thedef = sym; + } + }); + self.walk(tw); + + // pass 2: find back references and eval + var func = null; + var globals = self.globals = new Dictionary(); + var tw = new TreeWalker(function(node, descend){ + if (node instanceof AST_Lambda) { + var prev_func = func; + func = node; + descend(); + func = prev_func; + return true; + } + if (node instanceof AST_LoopControl && node.label) { + node.label.thedef.references.push(node); + return true; + } + if (node instanceof AST_SymbolRef) { + var name = node.name; + if (name == "eval" && tw.parent() instanceof AST_Call) { + for (var s = node.scope; s && !s.uses_eval; s = s.parent_scope) { + s.uses_eval = true; + } + } + var sym = node.scope.find_variable(name); + if (node.scope instanceof AST_Lambda && name == "arguments") { + node.scope.uses_arguments = true; + } + if (!sym) { + sym = self.def_global(node); + } + node.thedef = sym; + node.reference(options); + return true; + } + }); + self.walk(tw); + + // pass 3: fix up any scoping issue with IE8 + if (!options.screw_ie8) { + self.walk(new TreeWalker(function(node, descend) { + if (node instanceof AST_SymbolCatch) { + var name = node.name; + var refs = node.thedef.references; + var scope = node.thedef.defun; + var def = scope.find_variable(name) || self.globals.get(name) || scope.def_variable(node); + refs.forEach(function(ref) { + ref.thedef = def; + ref.reference(options); + }); + node.thedef = def; + return true; + } + })); + } + + if (options.cache) { + this.cname = options.cache.cname; + } +}); + +AST_Toplevel.DEFMETHOD("def_global", function(node){ + var globals = this.globals, name = node.name; + if (globals.has(name)) { + return globals.get(name); + } else { + var g = new SymbolDef(this, globals.size(), node); + g.undeclared = true; + g.global = true; + globals.set(name, g); + return g; + } +}); + +AST_Scope.DEFMETHOD("init_scope_vars", function(parent_scope){ + this.variables = new Dictionary(); // map name to AST_SymbolVar (variables defined in this scope; includes functions) + this.functions = new Dictionary(); // map name to AST_SymbolDefun (functions defined in this scope) + this.uses_with = false; // will be set to true if this or some nested scope uses the `with` statement + this.uses_eval = false; // will be set to true if this or nested scope uses the global `eval` + this.parent_scope = parent_scope; // the parent scope + this.enclosed = []; // a list of variables from this or outer scope(s) that are referenced from this or inner scopes + this.cname = -1; // the current index for mangling functions/variables +}); + +AST_Lambda.DEFMETHOD("init_scope_vars", function(){ + AST_Scope.prototype.init_scope_vars.apply(this, arguments); + this.uses_arguments = false; + this.def_variable(new AST_SymbolVar({ + name: "arguments", + start: this.start, + end: this.end + })); +}); + +AST_Symbol.DEFMETHOD("mark_enclosed", function(options) { + var def = this.definition(); + var s = this.scope; + while (s) { + push_uniq(s.enclosed, def); + if (options.keep_fnames) { + s.functions.each(function(d) { + push_uniq(def.scope.enclosed, d); + }); + } + if (s === def.scope) break; + s = s.parent_scope; + } +}); + +AST_Symbol.DEFMETHOD("reference", function(options) { + this.definition().references.push(this); + this.mark_enclosed(options); +}); + +AST_Scope.DEFMETHOD("find_variable", function(name){ + if (name instanceof AST_Symbol) name = name.name; + return this.variables.get(name) + || (this.parent_scope && this.parent_scope.find_variable(name)); +}); + +AST_Scope.DEFMETHOD("def_function", function(symbol){ + this.functions.set(symbol.name, this.def_variable(symbol)); +}); + +AST_Scope.DEFMETHOD("def_variable", function(symbol){ + var def; + if (!this.variables.has(symbol.name)) { + def = new SymbolDef(this, this.variables.size(), symbol); + this.variables.set(symbol.name, def); + def.global = !this.parent_scope; + } else { + def = this.variables.get(symbol.name); + def.orig.push(symbol); + } + return symbol.thedef = def; +}); + +AST_Scope.DEFMETHOD("next_mangled", function(options){ + var ext = this.enclosed; + out: while (true) { + var m = base54(++this.cname); + if (!is_identifier(m)) continue; // skip over "do" + + // https://github.com/mishoo/UglifyJS2/issues/242 -- do not + // shadow a name excepted from mangling. + if (options.except.indexOf(m) >= 0) continue; + + // we must ensure that the mangled name does not shadow a name + // from some parent scope that is referenced in this or in + // inner scopes. + for (var i = ext.length; --i >= 0;) { + var sym = ext[i]; + var name = sym.mangled_name || (sym.unmangleable(options) && sym.name); + if (m == name) continue out; + } + return m; + } +}); + +AST_Function.DEFMETHOD("next_mangled", function(options, def){ + // #179, #326 + // in Safari strict mode, something like (function x(x){...}) is a syntax error; + // a function expression's argument cannot shadow the function expression's name + + var tricky_def = def.orig[0] instanceof AST_SymbolFunarg && this.name && this.name.definition(); + + // the function's mangled_name is null when keep_fnames is true + var tricky_name = tricky_def ? tricky_def.mangled_name || tricky_def.name : null; + + while (true) { + var name = AST_Lambda.prototype.next_mangled.call(this, options, def); + if (!tricky_name || tricky_name != name) + return name; + } +}); + +AST_Symbol.DEFMETHOD("unmangleable", function(options){ + return this.definition().unmangleable(options); +}); + +// labels are always mangleable +AST_Label.DEFMETHOD("unmangleable", function(){ + return false; +}); + +AST_Symbol.DEFMETHOD("unreferenced", function(){ + return this.definition().references.length == 0 + && !(this.scope.uses_eval || this.scope.uses_with); +}); + +AST_Symbol.DEFMETHOD("undeclared", function(){ + return this.definition().undeclared; +}); + +AST_LabelRef.DEFMETHOD("undeclared", function(){ + return false; +}); + +AST_Label.DEFMETHOD("undeclared", function(){ + return false; +}); + +AST_Symbol.DEFMETHOD("definition", function(){ + return this.thedef; +}); + +AST_Symbol.DEFMETHOD("global", function(){ + return this.definition().global; +}); + +AST_Toplevel.DEFMETHOD("_default_mangler_options", function(options){ + return defaults(options, { + eval : false, + except : [], + keep_fnames : false, + screw_ie8 : true, + sort : false, // Ignored. Flag retained for backwards compatibility. + toplevel : false, + }); +}); + +AST_Toplevel.DEFMETHOD("mangle_names", function(options){ + options = this._default_mangler_options(options); + + // Never mangle arguments + options.except.push('arguments'); + + // We only need to mangle declaration nodes. Special logic wired + // into the code generator will display the mangled name if it's + // present (and for AST_SymbolRef-s it'll use the mangled name of + // the AST_SymbolDeclaration that it points to). + var lname = -1; + var to_mangle = []; + + if (options.cache) { + this.globals.each(function(symbol){ + if (options.except.indexOf(symbol.name) < 0) { + to_mangle.push(symbol); + } + }); + } + + var tw = new TreeWalker(function(node, descend){ + if (node instanceof AST_LabeledStatement) { + // lname is incremented when we get to the AST_Label + var save_nesting = lname; + descend(); + lname = save_nesting; + return true; // don't descend again in TreeWalker + } + if (node instanceof AST_Scope) { + var p = tw.parent(), a = []; + node.variables.each(function(symbol){ + if (options.except.indexOf(symbol.name) < 0) { + a.push(symbol); + } + }); + to_mangle.push.apply(to_mangle, a); + return; + } + if (node instanceof AST_Label) { + var name; + do name = base54(++lname); while (!is_identifier(name)); + node.mangled_name = name; + return true; + } + if (options.screw_ie8 && node instanceof AST_SymbolCatch) { + to_mangle.push(node.definition()); + return; + } + }); + this.walk(tw); + to_mangle.forEach(function(def){ def.mangle(options) }); + + if (options.cache) { + options.cache.cname = this.cname; + } +}); + +AST_Toplevel.DEFMETHOD("compute_char_frequency", function(options){ + options = this._default_mangler_options(options); + var tw = new TreeWalker(function(node){ + if (node instanceof AST_Constant) + base54.consider(node.print_to_string()); + else if (node instanceof AST_Return) + base54.consider("return"); + else if (node instanceof AST_Throw) + base54.consider("throw"); + else if (node instanceof AST_Continue) + base54.consider("continue"); + else if (node instanceof AST_Break) + base54.consider("break"); + else if (node instanceof AST_Debugger) + base54.consider("debugger"); + else if (node instanceof AST_Directive) + base54.consider(node.value); + else if (node instanceof AST_While) + base54.consider("while"); + else if (node instanceof AST_Do) + base54.consider("do while"); + else if (node instanceof AST_If) { + base54.consider("if"); + if (node.alternative) base54.consider("else"); + } + else if (node instanceof AST_Var) + base54.consider("var"); + else if (node instanceof AST_Const) + base54.consider("const"); + else if (node instanceof AST_Lambda) + base54.consider("function"); + else if (node instanceof AST_For) + base54.consider("for"); + else if (node instanceof AST_ForIn) + base54.consider("for in"); + else if (node instanceof AST_Switch) + base54.consider("switch"); + else if (node instanceof AST_Case) + base54.consider("case"); + else if (node instanceof AST_Default) + base54.consider("default"); + else if (node instanceof AST_With) + base54.consider("with"); + else if (node instanceof AST_ObjectSetter) + base54.consider("set" + node.key); + else if (node instanceof AST_ObjectGetter) + base54.consider("get" + node.key); + else if (node instanceof AST_ObjectKeyVal) + base54.consider(node.key); + else if (node instanceof AST_New) + base54.consider("new"); + else if (node instanceof AST_This) + base54.consider("this"); + else if (node instanceof AST_Try) + base54.consider("try"); + else if (node instanceof AST_Catch) + base54.consider("catch"); + else if (node instanceof AST_Finally) + base54.consider("finally"); + else if (node instanceof AST_Symbol && node.unmangleable(options)) + base54.consider(node.name); + else if (node instanceof AST_Unary || node instanceof AST_Binary) + base54.consider(node.operator); + else if (node instanceof AST_Dot) + base54.consider(node.property); + }); + this.walk(tw); + base54.sort(); +}); + +var base54 = (function() { + var string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789"; + var chars, frequency; + function reset() { + frequency = Object.create(null); + chars = string.split("").map(function(ch){ return ch.charCodeAt(0) }); + chars.forEach(function(ch){ frequency[ch] = 0 }); + } + base54.consider = function(str){ + for (var i = str.length; --i >= 0;) { + var code = str.charCodeAt(i); + if (code in frequency) ++frequency[code]; + } + }; + base54.sort = function() { + chars = mergeSort(chars, function(a, b){ + if (is_digit(a) && !is_digit(b)) return 1; + if (is_digit(b) && !is_digit(a)) return -1; + return frequency[b] - frequency[a]; + }); + }; + base54.reset = reset; + reset(); + base54.get = function(){ return chars }; + base54.freq = function(){ return frequency }; + function base54(num) { + var ret = "", base = 54; + num++; + do { + num--; + ret += String.fromCharCode(chars[num % base]); + num = Math.floor(num / base); + base = 64; + } while (num > 0); + return ret; + }; + return base54; +})(); + +AST_Toplevel.DEFMETHOD("scope_warnings", function(options){ + options = defaults(options, { + assign_to_global : true, + eval : true, + func_arguments : true, + nested_defuns : true, + undeclared : false, // this makes a lot of noise + unreferenced : true, + }); + var tw = new TreeWalker(function(node){ + if (options.undeclared + && node instanceof AST_SymbolRef + && node.undeclared()) + { + // XXX: this also warns about JS standard names, + // i.e. Object, Array, parseInt etc. Should add a list of + // exceptions. + AST_Node.warn("Undeclared symbol: {name} [{file}:{line},{col}]", { + name: node.name, + file: node.start.file, + line: node.start.line, + col: node.start.col + }); + } + if (options.assign_to_global) + { + var sym = null; + if (node instanceof AST_Assign && node.left instanceof AST_SymbolRef) + sym = node.left; + else if (node instanceof AST_ForIn && node.init instanceof AST_SymbolRef) + sym = node.init; + if (sym + && (sym.undeclared() + || (sym.global() && sym.scope !== sym.definition().scope))) { + AST_Node.warn("{msg}: {name} [{file}:{line},{col}]", { + msg: sym.undeclared() ? "Accidental global?" : "Assignment to global", + name: sym.name, + file: sym.start.file, + line: sym.start.line, + col: sym.start.col + }); + } + } + if (options.eval + && node instanceof AST_SymbolRef + && node.undeclared() + && node.name == "eval") { + AST_Node.warn("Eval is used [{file}:{line},{col}]", node.start); + } + if (options.unreferenced + && (node instanceof AST_SymbolDeclaration || node instanceof AST_Label) + && !(node instanceof AST_SymbolCatch) + && node.unreferenced()) { + AST_Node.warn("{type} {name} is declared but not referenced [{file}:{line},{col}]", { + type: node instanceof AST_Label ? "Label" : "Symbol", + name: node.name, + file: node.start.file, + line: node.start.line, + col: node.start.col + }); + } + if (options.func_arguments + && node instanceof AST_Lambda + && node.uses_arguments) { + AST_Node.warn("arguments used in function {name} [{file}:{line},{col}]", { + name: node.name ? node.name.name : "anonymous", + file: node.start.file, + line: node.start.line, + col: node.start.col + }); + } + if (options.nested_defuns + && node instanceof AST_Defun + && !(tw.parent() instanceof AST_Scope)) { + AST_Node.warn("Function {name} declared in nested statement \"{type}\" [{file}:{line},{col}]", { + name: node.name.name, + type: tw.parent().TYPE, + file: node.start.file, + line: node.start.line, + col: node.start.col + }); + } + }); + this.walk(tw); +}); diff --git a/node_modules/uglify-js/lib/sourcemap.js b/node_modules/uglify-js/lib/sourcemap.js new file mode 100644 index 0000000..0be16bf --- /dev/null +++ b/node_modules/uglify-js/lib/sourcemap.js @@ -0,0 +1,97 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS2 + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + 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. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 HOLDER 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. + + ***********************************************************************/ + +"use strict"; + +// a small wrapper around fitzgen's source-map library +function SourceMap(options) { + options = defaults(options, { + file : null, + root : null, + orig : null, + + orig_line_diff : 0, + dest_line_diff : 0, + }); + var generator = new MOZ_SourceMap.SourceMapGenerator({ + file : options.file, + sourceRoot : options.root + }); + var orig_map = options.orig && new MOZ_SourceMap.SourceMapConsumer(options.orig); + + if (orig_map && Array.isArray(options.orig.sources)) { + orig_map._sources.toArray().forEach(function(source) { + var sourceContent = orig_map.sourceContentFor(source, true); + if (sourceContent) { + generator.setSourceContent(source, sourceContent); + } + }); + } + + function add(source, gen_line, gen_col, orig_line, orig_col, name) { + if (orig_map) { + var info = orig_map.originalPositionFor({ + line: orig_line, + column: orig_col + }); + if (info.source === null) { + return; + } + source = info.source; + orig_line = info.line; + orig_col = info.column; + name = info.name || name; + } + generator.addMapping({ + generated : { line: gen_line + options.dest_line_diff, column: gen_col }, + original : { line: orig_line + options.orig_line_diff, column: orig_col }, + source : source, + name : name + }); + }; + return { + add : add, + get : function() { return generator }, + toString : function() { return JSON.stringify(generator.toJSON()); } + }; +}; diff --git a/node_modules/uglify-js/lib/transform.js b/node_modules/uglify-js/lib/transform.js new file mode 100644 index 0000000..3018e8f --- /dev/null +++ b/node_modules/uglify-js/lib/transform.js @@ -0,0 +1,218 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS2 + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + 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. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 HOLDER 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. + + ***********************************************************************/ + +"use strict"; + +// Tree transformer helpers. + +function TreeTransformer(before, after) { + TreeWalker.call(this); + this.before = before; + this.after = after; +} +TreeTransformer.prototype = new TreeWalker; + +(function(undefined){ + + function _(node, descend) { + node.DEFMETHOD("transform", function(tw, in_list){ + var x, y; + tw.push(this); + if (tw.before) x = tw.before(this, descend, in_list); + if (x === undefined) { + if (!tw.after) { + x = this; + descend(x, tw); + } else { + tw.stack[tw.stack.length - 1] = x = this; + descend(x, tw); + y = tw.after(x, in_list); + if (y !== undefined) x = y; + } + } + tw.pop(this); + return x; + }); + }; + + function do_list(list, tw) { + return MAP(list, function(node){ + return node.transform(tw, true); + }); + }; + + _(AST_Node, noop); + + _(AST_LabeledStatement, function(self, tw){ + self.label = self.label.transform(tw); + self.body = self.body.transform(tw); + }); + + _(AST_SimpleStatement, function(self, tw){ + self.body = self.body.transform(tw); + }); + + _(AST_Block, function(self, tw){ + self.body = do_list(self.body, tw); + }); + + _(AST_DWLoop, function(self, tw){ + self.condition = self.condition.transform(tw); + self.body = self.body.transform(tw); + }); + + _(AST_For, function(self, tw){ + if (self.init) self.init = self.init.transform(tw); + if (self.condition) self.condition = self.condition.transform(tw); + if (self.step) self.step = self.step.transform(tw); + self.body = self.body.transform(tw); + }); + + _(AST_ForIn, function(self, tw){ + self.init = self.init.transform(tw); + self.object = self.object.transform(tw); + self.body = self.body.transform(tw); + }); + + _(AST_With, function(self, tw){ + self.expression = self.expression.transform(tw); + self.body = self.body.transform(tw); + }); + + _(AST_Exit, function(self, tw){ + if (self.value) self.value = self.value.transform(tw); + }); + + _(AST_LoopControl, function(self, tw){ + if (self.label) self.label = self.label.transform(tw); + }); + + _(AST_If, function(self, tw){ + self.condition = self.condition.transform(tw); + self.body = self.body.transform(tw); + if (self.alternative) self.alternative = self.alternative.transform(tw); + }); + + _(AST_Switch, function(self, tw){ + self.expression = self.expression.transform(tw); + self.body = do_list(self.body, tw); + }); + + _(AST_Case, function(self, tw){ + self.expression = self.expression.transform(tw); + self.body = do_list(self.body, tw); + }); + + _(AST_Try, function(self, tw){ + self.body = do_list(self.body, tw); + if (self.bcatch) self.bcatch = self.bcatch.transform(tw); + if (self.bfinally) self.bfinally = self.bfinally.transform(tw); + }); + + _(AST_Catch, function(self, tw){ + self.argname = self.argname.transform(tw); + self.body = do_list(self.body, tw); + }); + + _(AST_Definitions, function(self, tw){ + self.definitions = do_list(self.definitions, tw); + }); + + _(AST_VarDef, function(self, tw){ + self.name = self.name.transform(tw); + if (self.value) self.value = self.value.transform(tw); + }); + + _(AST_Lambda, function(self, tw){ + if (self.name) self.name = self.name.transform(tw); + self.argnames = do_list(self.argnames, tw); + self.body = do_list(self.body, tw); + }); + + _(AST_Call, function(self, tw){ + self.expression = self.expression.transform(tw); + self.args = do_list(self.args, tw); + }); + + _(AST_Seq, function(self, tw){ + self.car = self.car.transform(tw); + self.cdr = self.cdr.transform(tw); + }); + + _(AST_Dot, function(self, tw){ + self.expression = self.expression.transform(tw); + }); + + _(AST_Sub, function(self, tw){ + self.expression = self.expression.transform(tw); + self.property = self.property.transform(tw); + }); + + _(AST_Unary, function(self, tw){ + self.expression = self.expression.transform(tw); + }); + + _(AST_Binary, function(self, tw){ + self.left = self.left.transform(tw); + self.right = self.right.transform(tw); + }); + + _(AST_Conditional, function(self, tw){ + self.condition = self.condition.transform(tw); + self.consequent = self.consequent.transform(tw); + self.alternative = self.alternative.transform(tw); + }); + + _(AST_Array, function(self, tw){ + self.elements = do_list(self.elements, tw); + }); + + _(AST_Object, function(self, tw){ + self.properties = do_list(self.properties, tw); + }); + + _(AST_ObjectProperty, function(self, tw){ + self.value = self.value.transform(tw); + }); + +})(); diff --git a/node_modules/uglify-js/lib/utils.js b/node_modules/uglify-js/lib/utils.js new file mode 100644 index 0000000..fdb2047 --- /dev/null +++ b/node_modules/uglify-js/lib/utils.js @@ -0,0 +1,362 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS2 + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + 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. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 HOLDER 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. + + ***********************************************************************/ + +"use strict"; + +function array_to_hash(a) { + var ret = Object.create(null); + for (var i = 0; i < a.length; ++i) + ret[a[i]] = true; + return ret; +}; + +function slice(a, start) { + return Array.prototype.slice.call(a, start || 0); +}; + +function characters(str) { + return str.split(""); +}; + +function member(name, array) { + return array.indexOf(name) >= 0; +}; + +function find_if(func, array) { + for (var i = 0, n = array.length; i < n; ++i) { + if (func(array[i])) + return array[i]; + } +}; + +function repeat_string(str, i) { + if (i <= 0) return ""; + if (i == 1) return str; + var d = repeat_string(str, i >> 1); + d += d; + if (i & 1) d += str; + return d; +}; + +function configure_error_stack(fn) { + Object.defineProperty(fn.prototype, "stack", { + get: function() { + var err = new Error(this.message); + err.name = this.name; + try { + throw err; + } catch(e) { + return e.stack; + } + } + }); +} + +function DefaultsError(msg, defs) { + this.message = msg; + this.defs = defs; +}; +DefaultsError.prototype = Object.create(Error.prototype); +DefaultsError.prototype.constructor = DefaultsError; +DefaultsError.prototype.name = "DefaultsError"; +configure_error_stack(DefaultsError); + +DefaultsError.croak = function(msg, defs) { + throw new DefaultsError(msg, defs); +}; + +function defaults(args, defs, croak) { + if (args === true) + args = {}; + var ret = args || {}; + if (croak) for (var i in ret) if (HOP(ret, i) && !HOP(defs, i)) + DefaultsError.croak("`" + i + "` is not a supported option", defs); + for (var i in defs) if (HOP(defs, i)) { + ret[i] = (args && HOP(args, i)) ? args[i] : defs[i]; + } + return ret; +}; + +function merge(obj, ext) { + var count = 0; + for (var i in ext) if (HOP(ext, i)) { + obj[i] = ext[i]; + count++; + } + return count; +}; + +function noop() {} +function return_false() { return false; } +function return_true() { return true; } +function return_this() { return this; } +function return_null() { return null; } + +var MAP = (function(){ + function MAP(a, f, backwards) { + var ret = [], top = [], i; + function doit() { + var val = f(a[i], i); + var is_last = val instanceof Last; + if (is_last) val = val.v; + if (val instanceof AtTop) { + val = val.v; + if (val instanceof Splice) { + top.push.apply(top, backwards ? val.v.slice().reverse() : val.v); + } else { + top.push(val); + } + } + else if (val !== skip) { + if (val instanceof Splice) { + ret.push.apply(ret, backwards ? val.v.slice().reverse() : val.v); + } else { + ret.push(val); + } + } + return is_last; + }; + if (a instanceof Array) { + if (backwards) { + for (i = a.length; --i >= 0;) if (doit()) break; + ret.reverse(); + top.reverse(); + } else { + for (i = 0; i < a.length; ++i) if (doit()) break; + } + } + else { + for (i in a) if (HOP(a, i)) if (doit()) break; + } + return top.concat(ret); + }; + MAP.at_top = function(val) { return new AtTop(val) }; + MAP.splice = function(val) { return new Splice(val) }; + MAP.last = function(val) { return new Last(val) }; + var skip = MAP.skip = {}; + function AtTop(val) { this.v = val }; + function Splice(val) { this.v = val }; + function Last(val) { this.v = val }; + return MAP; +})(); + +function push_uniq(array, el) { + if (array.indexOf(el) < 0) + array.push(el); +}; + +function string_template(text, props) { + return text.replace(/\{(.+?)\}/g, function(str, p){ + return props && props[p]; + }); +}; + +function remove(array, el) { + for (var i = array.length; --i >= 0;) { + if (array[i] === el) array.splice(i, 1); + } +}; + +function mergeSort(array, cmp) { + if (array.length < 2) return array.slice(); + function merge(a, b) { + var r = [], ai = 0, bi = 0, i = 0; + while (ai < a.length && bi < b.length) { + cmp(a[ai], b[bi]) <= 0 + ? r[i++] = a[ai++] + : r[i++] = b[bi++]; + } + if (ai < a.length) r.push.apply(r, a.slice(ai)); + if (bi < b.length) r.push.apply(r, b.slice(bi)); + return r; + }; + function _ms(a) { + if (a.length <= 1) + return a; + var m = Math.floor(a.length / 2), left = a.slice(0, m), right = a.slice(m); + left = _ms(left); + right = _ms(right); + return merge(left, right); + }; + return _ms(array); +}; + +function set_difference(a, b) { + return a.filter(function(el){ + return b.indexOf(el) < 0; + }); +}; + +function set_intersection(a, b) { + return a.filter(function(el){ + return b.indexOf(el) >= 0; + }); +}; + +// this function is taken from Acorn [1], written by Marijn Haverbeke +// [1] https://github.com/marijnh/acorn +function makePredicate(words) { + if (!(words instanceof Array)) 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 quote(word) { + return JSON.stringify(word).replace(/[\u2028\u2029]/g, function(s) { + switch (s) { + case "\u2028": return "\\u2028"; + case "\u2029": return "\\u2029"; + } + return s; + }); + } + function compareTo(arr) { + if (arr.length == 1) return f += "return str === " + quote(arr[0]) + ";"; + f += "switch(str){"; + for (var i = 0; i < arr.length; ++i) f += "case " + quote(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); +}; + +function all(array, predicate) { + for (var i = array.length; --i >= 0;) + if (!predicate(array[i])) + return false; + return true; +}; + +function Dictionary() { + this._values = Object.create(null); + this._size = 0; +}; +Dictionary.prototype = { + set: function(key, val) { + if (!this.has(key)) ++this._size; + this._values["$" + key] = val; + return this; + }, + add: function(key, val) { + if (this.has(key)) { + this.get(key).push(val); + } else { + this.set(key, [ val ]); + } + return this; + }, + get: function(key) { return this._values["$" + key] }, + del: function(key) { + if (this.has(key)) { + --this._size; + delete this._values["$" + key]; + } + return this; + }, + has: function(key) { return ("$" + key) in this._values }, + each: function(f) { + for (var i in this._values) + f(this._values[i], i.substr(1)); + }, + size: function() { + return this._size; + }, + map: function(f) { + var ret = []; + for (var i in this._values) + ret.push(f(this._values[i], i.substr(1))); + return ret; + }, + toObject: function() { return this._values } +}; +Dictionary.fromObject = function(obj) { + var dict = new Dictionary(); + dict._size = merge(dict._values, obj); + return dict; +}; + +function HOP(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +// return true if the node at the top of the stack (that means the +// innermost node in the current output) is lexically the first in +// a statement. +function first_in_statement(stack) { + var node = stack.parent(-1); + for (var i = 0, p; p = stack.parent(i); i++) { + if (p instanceof AST_Statement && p.body === node) + return true; + if ((p instanceof AST_Seq && p.car === node ) || + (p instanceof AST_Call && p.expression === node && !(p instanceof AST_New) ) || + (p instanceof AST_Dot && p.expression === node ) || + (p instanceof AST_Sub && p.expression === node ) || + (p instanceof AST_Conditional && p.condition === node ) || + (p instanceof AST_Binary && p.left === node ) || + (p instanceof AST_UnaryPostfix && p.expression === node )) + { + node = p; + } else { + return false; + } + } +} diff --git a/node_modules/uglify-js/node_modules/source-map/CHANGELOG.md b/node_modules/uglify-js/node_modules/source-map/CHANGELOG.md new file mode 100644 index 0000000..3a8c066 --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/CHANGELOG.md @@ -0,0 +1,301 @@ +# Change Log + +## 0.5.6 + +* Fix for regression when people were using numbers as names in source maps. See + #236. + +## 0.5.5 + +* Fix "regression" of unsupported, implementation behavior that half the world + happens to have come to depend on. See #235. + +* Fix regression involving function hoisting in SpiderMonkey. See #233. + +## 0.5.4 + +* Large performance improvements to source-map serialization. See #228 and #229. + +## 0.5.3 + +* Do not include unnecessary distribution files. See + commit ef7006f8d1647e0a83fdc60f04f5a7ca54886f86. + +## 0.5.2 + +* Include browser distributions of the library in package.json's `files`. See + issue #212. + +## 0.5.1 + +* Fix latent bugs in IndexedSourceMapConsumer.prototype._parseMappings. See + ff05274becc9e6e1295ed60f3ea090d31d843379. + +## 0.5.0 + +* Node 0.8 is no longer supported. + +* Use webpack instead of dryice for bundling. + +* Big speedups serializing source maps. See pull request #203. + +* Fix a bug with `SourceMapConsumer.prototype.sourceContentFor` and sources that + explicitly start with the source root. See issue #199. + +## 0.4.4 + +* Fix an issue where using a `SourceMapGenerator` after having created a + `SourceMapConsumer` from it via `SourceMapConsumer.fromSourceMap` failed. See + issue #191. + +* Fix an issue with where `SourceMapGenerator` would mistakenly consider + different mappings as duplicates of each other and avoid generating them. See + issue #192. + +## 0.4.3 + +* A very large number of performance improvements, particularly when parsing + source maps. Collectively about 75% of time shaved off of the source map + parsing benchmark! + +* Fix a bug in `SourceMapConsumer.prototype.allGeneratedPositionsFor` and fuzzy + searching in the presence of a column option. See issue #177. + +* Fix a bug with joining a source and its source root when the source is above + the root. See issue #182. + +* Add the `SourceMapConsumer.prototype.hasContentsOfAllSources` method to + determine when all sources' contents are inlined into the source map. See + issue #190. + +## 0.4.2 + +* Add an `.npmignore` file so that the benchmarks aren't pulled down by + dependent projects. Issue #169. + +* Add an optional `column` argument to + `SourceMapConsumer.prototype.allGeneratedPositionsFor` and better handle lines + with no mappings. Issues #172 and #173. + +## 0.4.1 + +* Fix accidentally defining a global variable. #170. + +## 0.4.0 + +* The default direction for fuzzy searching was changed back to its original + direction. See #164. + +* There is now a `bias` option you can supply to `SourceMapConsumer` to control + the fuzzy searching direction. See #167. + +* About an 8% speed up in parsing source maps. See #159. + +* Added a benchmark for parsing and generating source maps. + +## 0.3.0 + +* Change the default direction that searching for positions fuzzes when there is + not an exact match. See #154. + +* Support for environments using json2.js for JSON serialization. See #156. + +## 0.2.0 + +* Support for consuming "indexed" source maps which do not have any remote + sections. See pull request #127. This introduces a minor backwards + incompatibility if you are monkey patching `SourceMapConsumer.prototype` + methods. + +## 0.1.43 + +* Performance improvements for `SourceMapGenerator` and `SourceNode`. See issue + #148 for some discussion and issues #150, #151, and #152 for implementations. + +## 0.1.42 + +* Fix an issue where `SourceNode`s from different versions of the source-map + library couldn't be used in conjunction with each other. See issue #142. + +## 0.1.41 + +* Fix a bug with getting the source content of relative sources with a "./" + prefix. See issue #145 and [Bug 1090768](bugzil.la/1090768). + +* Add the `SourceMapConsumer.prototype.computeColumnSpans` method to compute the + column span of each mapping. + +* Add the `SourceMapConsumer.prototype.allGeneratedPositionsFor` method to find + all generated positions associated with a given original source and line. + +## 0.1.40 + +* Performance improvements for parsing source maps in SourceMapConsumer. + +## 0.1.39 + +* Fix a bug where setting a source's contents to null before any source content + had been set before threw a TypeError. See issue #131. + +## 0.1.38 + +* Fix a bug where finding relative paths from an empty path were creating + absolute paths. See issue #129. + +## 0.1.37 + +* Fix a bug where if the source root was an empty string, relative source paths + would turn into absolute source paths. Issue #124. + +## 0.1.36 + +* Allow the `names` mapping property to be an empty string. Issue #121. + +## 0.1.35 + +* A third optional parameter was added to `SourceNode.fromStringWithSourceMap` + to specify a path that relative sources in the second parameter should be + relative to. Issue #105. + +* If no file property is given to a `SourceMapGenerator`, then the resulting + source map will no longer have a `null` file property. The property will + simply not exist. Issue #104. + +* Fixed a bug where consecutive newlines were ignored in `SourceNode`s. + Issue #116. + +## 0.1.34 + +* Make `SourceNode` work with windows style ("\r\n") newlines. Issue #103. + +* Fix bug involving source contents and the + `SourceMapGenerator.prototype.applySourceMap`. Issue #100. + +## 0.1.33 + +* Fix some edge cases surrounding path joining and URL resolution. + +* Add a third parameter for relative path to + `SourceMapGenerator.prototype.applySourceMap`. + +* Fix issues with mappings and EOLs. + +## 0.1.32 + +* Fixed a bug where SourceMapConsumer couldn't handle negative relative columns + (issue 92). + +* Fixed test runner to actually report number of failed tests as its process + exit code. + +* Fixed a typo when reporting bad mappings (issue 87). + +## 0.1.31 + +* Delay parsing the mappings in SourceMapConsumer until queried for a source + location. + +* Support Sass source maps (which at the time of writing deviate from the spec + in small ways) in SourceMapConsumer. + +## 0.1.30 + +* Do not join source root with a source, when the source is a data URI. + +* Extend the test runner to allow running single specific test files at a time. + +* Performance improvements in `SourceNode.prototype.walk` and + `SourceMapConsumer.prototype.eachMapping`. + +* Source map browser builds will now work inside Workers. + +* Better error messages when attempting to add an invalid mapping to a + `SourceMapGenerator`. + +## 0.1.29 + +* Allow duplicate entries in the `names` and `sources` arrays of source maps + (usually from TypeScript) we are parsing. Fixes github issue 72. + +## 0.1.28 + +* Skip duplicate mappings when creating source maps from SourceNode; github + issue 75. + +## 0.1.27 + +* Don't throw an error when the `file` property is missing in SourceMapConsumer, + we don't use it anyway. + +## 0.1.26 + +* Fix SourceNode.fromStringWithSourceMap for empty maps. Fixes github issue 70. + +## 0.1.25 + +* Make compatible with browserify + +## 0.1.24 + +* Fix issue with absolute paths and `file://` URIs. See + https://bugzilla.mozilla.org/show_bug.cgi?id=885597 + +## 0.1.23 + +* Fix issue with absolute paths and sourcesContent, github issue 64. + +## 0.1.22 + +* Ignore duplicate mappings in SourceMapGenerator. Fixes github issue 21. + +## 0.1.21 + +* Fixed handling of sources that start with a slash so that they are relative to + the source root's host. + +## 0.1.20 + +* Fixed github issue #43: absolute URLs aren't joined with the source root + anymore. + +## 0.1.19 + +* Using Travis CI to run tests. + +## 0.1.18 + +* Fixed a bug in the handling of sourceRoot. + +## 0.1.17 + +* Added SourceNode.fromStringWithSourceMap. + +## 0.1.16 + +* Added missing documentation. + +* Fixed the generating of empty mappings in SourceNode. + +## 0.1.15 + +* Added SourceMapGenerator.applySourceMap. + +## 0.1.14 + +* The sourceRoot is now handled consistently. + +## 0.1.13 + +* Added SourceMapGenerator.fromSourceMap. + +## 0.1.12 + +* SourceNode now generates empty mappings too. + +## 0.1.11 + +* Added name support to SourceNode. + +## 0.1.10 + +* Added sourcesContent support to the customer and generator. diff --git a/node_modules/uglify-js/node_modules/source-map/LICENSE b/node_modules/uglify-js/node_modules/source-map/LICENSE new file mode 100644 index 0000000..ed1b7cf --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/LICENSE @@ -0,0 +1,28 @@ + +Copyright (c) 2009-2011, Mozilla Foundation and contributors +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 names of the Mozilla Foundation nor the names of project + 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 HOLDER 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. diff --git a/node_modules/uglify-js/node_modules/source-map/README.md b/node_modules/uglify-js/node_modules/source-map/README.md new file mode 100644 index 0000000..3281339 --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/README.md @@ -0,0 +1,729 @@ +# 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 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", "utf8")); +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/node_modules/uglify-js/node_modules/source-map/dist/source-map.debug.js b/node_modules/uglify-js/node_modules/source-map/dist/source-map.debug.js new file mode 100644 index 0000000..b5ab638 --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/dist/source-map.debug.js @@ -0,0 +1,3091 @@ +(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) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!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 = Object.create(null); + } + 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) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + 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 next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + 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 consecutive 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; + + var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); + }()); + + function identity (s) { + return s; + } + + /** + * 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) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; + } + exports.toSetString = supportsNullProto ? identity : toSetString; + + function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; + } + exports.fromSetString = supportsNullProto ? identity : fromSetString; + + function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; + } + + /** + * 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); + var has = Object.prototype.hasOwnProperty; + var hasNativeMap = typeof Map !== "undefined"; + + /** + * 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 = hasNativeMap ? new Map() : Object.create(null); + } + + /** + * 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 hasNativeMap ? this._set.size : 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 = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } + }; + + /** + * Is the given string a member of this set? + * + * @param String aStr + */ + ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } + }; + + /** + * What is the index of the given string in the array? + * + * @param String aStr + */ + ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, 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 + .map(String) + // 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.map(String), 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 accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // 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[remainingLinesIndex]; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = 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[remainingLinesIndex]; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + 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.splice(remainingLinesIndex).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;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay91bml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uIiwid2VicGFjazovLy93ZWJwYWNrL2Jvb3RzdHJhcCBlNDczOGZjNzJhN2IyMzAzOTg4OSIsIndlYnBhY2s6Ly8vLi9zb3VyY2UtbWFwLmpzIiwid2VicGFjazovLy8uL2xpYi9zb3VyY2UtbWFwLWdlbmVyYXRvci5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LXZscS5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LmpzIiwid2VicGFjazovLy8uL2xpYi91dGlsLmpzIiwid2VicGFjazovLy8uL2xpYi9hcnJheS1zZXQuanMiLCJ3ZWJwYWNrOi8vLy4vbGliL21hcHBpbmctbGlzdC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvc291cmNlLW1hcC1jb25zdW1lci5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmluYXJ5LXNlYXJjaC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvcXVpY2stc29ydC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvc291cmNlLW5vZGUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsQ0FBQztBQUNELE87QUNWQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQSx1QkFBZTtBQUNmO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOzs7QUFHQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBOzs7Ozs7O0FDdENBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Ozs7Ozs7QUNQQSxpQkFBZ0Isb0JBQW9CO0FBQ3BDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQSxNQUFLO0FBQ0w7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7QUFDTDtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7QUFDTDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxVQUFTO0FBQ1Q7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUEsTUFBSztBQUNMO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxRQUFPO0FBQ1A7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0EsMkNBQTBDLFNBQVM7QUFDbkQ7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxxQkFBb0I7QUFDcEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxNQUFLO0FBQ0w7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBOzs7Ozs7O0FDL1pBLGlCQUFnQixvQkFBb0I7QUFDcEM7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLDREQUEyRDtBQUMzRCxxQkFBb0I7QUFDcEI7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxJQUFHOztBQUVIO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsSUFBRzs7QUFFSDtBQUNBO0FBQ0E7Ozs7Ozs7QUMzSUEsaUJBQWdCLG9CQUFvQjtBQUNwQztBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsaUJBQWdCO0FBQ2hCLGlCQUFnQjs7QUFFaEIsb0JBQW1CO0FBQ25CLHFCQUFvQjs7QUFFcEIsaUJBQWdCO0FBQ2hCLGlCQUFnQjs7QUFFaEIsaUJBQWdCO0FBQ2hCLGtCQUFpQjs7QUFFakI7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7Ozs7Ozs7QUNsRUEsaUJBQWdCLG9CQUFvQjtBQUNwQztBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsSUFBRztBQUNIO0FBQ0EsSUFBRztBQUNIO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0EsK0NBQThDLFFBQVE7QUFDdEQ7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMO0FBQ0EsTUFBSztBQUNMO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFFBQU87QUFDUDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxFQUFDOztBQUVEO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBLDRCQUEyQixRQUFRO0FBQ25DO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7Ozs7Ozs7QUNoYUEsaUJBQWdCLG9CQUFvQjtBQUNwQztBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsdUNBQXNDLFNBQVM7QUFDL0M7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7QUFDTDtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsSUFBRztBQUNIO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxJQUFHO0FBQ0g7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7Ozs7OztBQ3hIQSxpQkFBZ0Isb0JBQW9CO0FBQ3BDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsaUJBQWdCO0FBQ2hCOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLElBQUc7QUFDSDtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7Ozs7OztBQzlFQSxpQkFBZ0Isb0JBQW9CO0FBQ3BDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSx1REFBc0Q7QUFDdEQ7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQSxFQUFDOztBQUVEO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsRUFBQzs7QUFFRDtBQUNBO0FBQ0E7QUFDQSxvQkFBbUI7QUFDbkI7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7QUFDTDs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFlBQVc7O0FBRVg7QUFDQTtBQUNBLFFBQU87QUFDUDs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsWUFBVzs7QUFFWDtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsNEJBQTJCLE1BQU07QUFDakM7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSx1REFBc0Q7QUFDdEQ7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7O0FBRUw7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBLHVEQUFzRCxZQUFZO0FBQ2xFO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7QUFDTDtBQUNBLEVBQUM7O0FBRUQ7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0Esb0NBQW1DO0FBQ25DO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSwwQkFBeUIsY0FBYztBQUN2QztBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLFVBQVM7QUFDVDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0Esd0JBQXVCLHdDQUF3QztBQUMvRDs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsZ0RBQStDLG1CQUFtQixFQUFFO0FBQ3BFOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGtCQUFpQixvQkFBb0I7QUFDckM7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLDhCQUE2QixNQUFNO0FBQ25DO0FBQ0EsUUFBTztBQUNQO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsdURBQXNEO0FBQ3REOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxRQUFPO0FBQ1A7QUFDQTtBQUNBLElBQUc7QUFDSDs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLG9CQUFtQiwyQkFBMkI7QUFDOUMsc0JBQXFCLCtDQUErQztBQUNwRTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsRUFBQzs7QUFFRDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsUUFBTztBQUNQOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7QUFDTDs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0Esb0JBQW1CLDJCQUEyQjtBQUM5Qzs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxvQkFBbUIsMkJBQTJCO0FBQzlDOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLG9CQUFtQiwyQkFBMkI7QUFDOUM7QUFDQTtBQUNBLHNCQUFxQiw0QkFBNEI7QUFDakQ7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBOzs7Ozs7O0FDempDQSxpQkFBZ0Isb0JBQW9CO0FBQ3BDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxNQUFLO0FBQ0w7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7Ozs7OztBQzlHQSxpQkFBZ0Isb0JBQW9CO0FBQ3BDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLFlBQVcsTUFBTTtBQUNqQjtBQUNBLFlBQVcsT0FBTztBQUNsQjtBQUNBLFlBQVcsT0FBTztBQUNsQjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxZQUFXLE9BQU87QUFDbEI7QUFDQSxZQUFXLE9BQU87QUFDbEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxZQUFXLE1BQU07QUFDakI7QUFDQSxZQUFXLFNBQVM7QUFDcEI7QUFDQSxZQUFXLE9BQU87QUFDbEI7QUFDQSxZQUFXLE9BQU87QUFDbEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLG9CQUFtQixPQUFPO0FBQzFCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxZQUFXLE1BQU07QUFDakI7QUFDQSxZQUFXLFNBQVM7QUFDcEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7Ozs7OztBQ2pIQSxpQkFBZ0Isb0JBQW9CO0FBQ3BDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFVBQVM7QUFDVDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxNQUFLOztBQUVMOztBQUVBO0FBQ0E7QUFDQTtBQUNBLFFBQU87QUFDUDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxrQ0FBaUMsUUFBUTtBQUN6QztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSw4Q0FBNkMsU0FBUztBQUN0RDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxxQkFBb0I7QUFDcEI7QUFDQTtBQUNBLHVDQUFzQztBQUN0QztBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxnQkFBZSxXQUFXO0FBQzFCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxnREFBK0MsU0FBUztBQUN4RDtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBLDBDQUF5QyxTQUFTO0FBQ2xEO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsSUFBRztBQUNIO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsWUFBVztBQUNYO0FBQ0E7QUFDQTtBQUNBLFlBQVc7QUFDWDtBQUNBLFVBQVM7QUFDVDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxNQUFLO0FBQ0w7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFFBQU87QUFDUDtBQUNBO0FBQ0E7QUFDQSw2Q0FBNEMsY0FBYztBQUMxRDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFVBQVM7QUFDVDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsY0FBYTtBQUNiO0FBQ0E7QUFDQTtBQUNBLGNBQWE7QUFDYjtBQUNBLFlBQVc7QUFDWDtBQUNBLFFBQU87QUFDUDtBQUNBO0FBQ0E7QUFDQSxJQUFHO0FBQ0g7QUFDQTtBQUNBLElBQUc7O0FBRUgsV0FBVTtBQUNWOztBQUVBIiwiZmlsZSI6InNvdXJjZS1tYXAuZGVidWcuanMiLCJzb3VyY2VzQ29udGVudCI6WyIoZnVuY3Rpb24gd2VicGFja1VuaXZlcnNhbE1vZHVsZURlZmluaXRpb24ocm9vdCwgZmFjdG9yeSkge1xuXHRpZih0eXBlb2YgZXhwb3J0cyA9PT0gJ29iamVjdCcgJiYgdHlwZW9mIG1vZHVsZSA9PT0gJ29iamVjdCcpXG5cdFx0bW9kdWxlLmV4cG9ydHMgPSBmYWN0b3J5KCk7XG5cdGVsc2UgaWYodHlwZW9mIGRlZmluZSA9PT0gJ2Z1bmN0aW9uJyAmJiBkZWZpbmUuYW1kKVxuXHRcdGRlZmluZShbXSwgZmFjdG9yeSk7XG5cdGVsc2UgaWYodHlwZW9mIGV4cG9ydHMgPT09ICdvYmplY3QnKVxuXHRcdGV4cG9ydHNbXCJzb3VyY2VNYXBcIl0gPSBmYWN0b3J5KCk7XG5cdGVsc2Vcblx0XHRyb290W1wic291cmNlTWFwXCJdID0gZmFjdG9yeSgpO1xufSkodGhpcywgZnVuY3Rpb24oKSB7XG5yZXR1cm4gXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHdlYnBhY2svdW5pdmVyc2FsTW9kdWxlRGVmaW5pdGlvbiIsIiBcdC8vIFRoZSBtb2R1bGUgY2FjaGVcbiBcdHZhciBpbnN0YWxsZWRNb2R1bGVzID0ge307XG5cbiBcdC8vIFRoZSByZXF1aXJlIGZ1bmN0aW9uXG4gXHRmdW5jdGlvbiBfX3dlYnBhY2tfcmVxdWlyZV9fKG1vZHVsZUlkKSB7XG5cbiBcdFx0Ly8gQ2hlY2sgaWYgbW9kdWxlIGlzIGluIGNhY2hlXG4gXHRcdGlmKGluc3RhbGxlZE1vZHVsZXNbbW9kdWxlSWRdKVxuIFx0XHRcdHJldHVybiBpbnN0YWxsZWRNb2R1bGVzW21vZHVsZUlkXS5leHBvcnRzO1xuXG4gXHRcdC8vIENyZWF0ZSBhIG5ldyBtb2R1bGUgKGFuZCBwdXQgaXQgaW50byB0aGUgY2FjaGUpXG4gXHRcdHZhciBtb2R1bGUgPSBpbnN0YWxsZWRNb2R1bGVzW21vZHVsZUlkXSA9IHtcbiBcdFx0XHRleHBvcnRzOiB7fSxcbiBcdFx0XHRpZDogbW9kdWxlSWQsXG4gXHRcdFx0bG9hZGVkOiBmYWxzZVxuIFx0XHR9O1xuXG4gXHRcdC8vIEV4ZWN1dGUgdGhlIG1vZHVsZSBmdW5jdGlvblxuIFx0XHRtb2R1bGVzW21vZHVsZUlkXS5jYWxsKG1vZHVsZS5leHBvcnRzLCBtb2R1bGUsIG1vZHVsZS5leHBvcnRzLCBfX3dlYnBhY2tfcmVxdWlyZV9fKTtcblxuIFx0XHQvLyBGbGFnIHRoZSBtb2R1bGUgYXMgbG9hZGVkXG4gXHRcdG1vZHVsZS5sb2FkZWQgPSB0cnVlO1xuXG4gXHRcdC8vIFJldHVybiB0aGUgZXhwb3J0cyBvZiB0aGUgbW9kdWxlXG4gXHRcdHJldHVybiBtb2R1bGUuZXhwb3J0cztcbiBcdH1cblxuXG4gXHQvLyBleHBvc2UgdGhlIG1vZHVsZXMgb2JqZWN0IChfX3dlYnBhY2tfbW9kdWxlc19fKVxuIFx0X193ZWJwYWNrX3JlcXVpcmVfXy5tID0gbW9kdWxlcztcblxuIFx0Ly8gZXhwb3NlIHRoZSBtb2R1bGUgY2FjaGVcbiBcdF9fd2VicGFja19yZXF1aXJlX18uYyA9IGluc3RhbGxlZE1vZHVsZXM7XG5cbiBcdC8vIF9fd2VicGFja19wdWJsaWNfcGF0aF9fXG4gXHRfX3dlYnBhY2tfcmVxdWlyZV9fLnAgPSBcIlwiO1xuXG4gXHQvLyBMb2FkIGVudHJ5IG1vZHVsZSBhbmQgcmV0dXJuIGV4cG9ydHNcbiBcdHJldHVybiBfX3dlYnBhY2tfcmVxdWlyZV9fKDApO1xuXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHdlYnBhY2svYm9vdHN0cmFwIGU0NzM4ZmM3MmE3YjIzMDM5ODg5IiwiLypcbiAqIENvcHlyaWdodCAyMDA5LTIwMTEgTW96aWxsYSBGb3VuZGF0aW9uIGFuZCBjb250cmlidXRvcnNcbiAqIExpY2Vuc2VkIHVuZGVyIHRoZSBOZXcgQlNEIGxpY2Vuc2UuIFNlZSBMSUNFTlNFLnR4dCBvcjpcbiAqIGh0dHA6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMy1DbGF1c2VcbiAqL1xuZXhwb3J0cy5Tb3VyY2VNYXBHZW5lcmF0b3IgPSByZXF1aXJlKCcuL2xpYi9zb3VyY2UtbWFwLWdlbmVyYXRvcicpLlNvdXJjZU1hcEdlbmVyYXRvcjtcbmV4cG9ydHMuU291cmNlTWFwQ29uc3VtZXIgPSByZXF1aXJlKCcuL2xpYi9zb3VyY2UtbWFwLWNvbnN1bWVyJykuU291cmNlTWFwQ29uc3VtZXI7XG5leHBvcnRzLlNvdXJjZU5vZGUgPSByZXF1aXJlKCcuL2xpYi9zb3VyY2Utbm9kZScpLlNvdXJjZU5vZGU7XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL3NvdXJjZS1tYXAuanNcbi8vIG1vZHVsZSBpZCA9IDBcbi8vIG1vZHVsZSBjaHVua3MgPSAwIiwiLyogLSotIE1vZGU6IGpzOyBqcy1pbmRlbnQtbGV2ZWw6IDI7IC0qLSAqL1xuLypcbiAqIENvcHlyaWdodCAyMDExIE1vemlsbGEgRm91bmRhdGlvbiBhbmQgY29udHJpYnV0b3JzXG4gKiBMaWNlbnNlZCB1bmRlciB0aGUgTmV3IEJTRCBsaWNlbnNlLiBTZWUgTElDRU5TRSBvcjpcbiAqIGh0dHA6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMy1DbGF1c2VcbiAqL1xuXG52YXIgYmFzZTY0VkxRID0gcmVxdWlyZSgnLi9iYXNlNjQtdmxxJyk7XG52YXIgdXRpbCA9IHJlcXVpcmUoJy4vdXRpbCcpO1xudmFyIEFycmF5U2V0ID0gcmVxdWlyZSgnLi9hcnJheS1zZXQnKS5BcnJheVNldDtcbnZhciBNYXBwaW5nTGlzdCA9IHJlcXVpcmUoJy4vbWFwcGluZy1saXN0JykuTWFwcGluZ0xpc3Q7XG5cbi8qKlxuICogQW4gaW5zdGFuY2Ugb2YgdGhlIFNvdXJjZU1hcEdlbmVyYXRvciByZXByZXNlbnRzIGEgc291cmNlIG1hcCB3aGljaCBpc1xuICogYmVpbmcgYnVpbHQgaW5jcmVtZW50YWxseS4gWW91IG1heSBwYXNzIGFuIG9iamVjdCB3aXRoIHRoZSBmb2xsb3dpbmdcbiAqIHByb3BlcnRpZXM6XG4gKlxuICogICAtIGZpbGU6IFRoZSBmaWxlbmFtZSBvZiB0aGUgZ2VuZXJhdGVkIHNvdXJjZS5cbiAqICAgLSBzb3VyY2VSb290OiBBIHJvb3QgZm9yIGFsbCByZWxhdGl2ZSBVUkxzIGluIHRoaXMgc291cmNlIG1hcC5cbiAqL1xuZnVuY3Rpb24gU291cmNlTWFwR2VuZXJhdG9yKGFBcmdzKSB7XG4gIGlmICghYUFyZ3MpIHtcbiAgICBhQXJncyA9IHt9O1xuICB9XG4gIHRoaXMuX2ZpbGUgPSB1dGlsLmdldEFyZyhhQXJncywgJ2ZpbGUnLCBudWxsKTtcbiAgdGhpcy5fc291cmNlUm9vdCA9IHV0aWwuZ2V0QXJnKGFBcmdzLCAnc291cmNlUm9vdCcsIG51bGwpO1xuICB0aGlzLl9za2lwVmFsaWRhdGlvbiA9IHV0aWwuZ2V0QXJnKGFBcmdzLCAnc2tpcFZhbGlkYXRpb24nLCBmYWxzZSk7XG4gIHRoaXMuX3NvdXJjZXMgPSBuZXcgQXJyYXlTZXQoKTtcbiAgdGhpcy5fbmFtZXMgPSBuZXcgQXJyYXlTZXQoKTtcbiAgdGhpcy5fbWFwcGluZ3MgPSBuZXcgTWFwcGluZ0xpc3QoKTtcbiAgdGhpcy5fc291cmNlc0NvbnRlbnRzID0gbnVsbDtcbn1cblxuU291cmNlTWFwR2VuZXJhdG9yLnByb3RvdHlwZS5fdmVyc2lvbiA9IDM7XG5cbi8qKlxuICogQ3JlYXRlcyBhIG5ldyBTb3VyY2VNYXBHZW5lcmF0b3IgYmFzZWQgb24gYSBTb3VyY2VNYXBDb25zdW1lclxuICpcbiAqIEBwYXJhbSBhU291cmNlTWFwQ29uc3VtZXIgVGhlIFNvdXJjZU1hcC5cbiAqL1xuU291cmNlTWFwR2VuZXJhdG9yLmZyb21Tb3VyY2VNYXAgPVxuICBmdW5jdGlvbiBTb3VyY2VNYXBHZW5lcmF0b3JfZnJvbVNvdXJjZU1hcChhU291cmNlTWFwQ29uc3VtZXIpIHtcbiAgICB2YXIgc291cmNlUm9vdCA9IGFTb3VyY2VNYXBDb25zdW1lci5zb3VyY2VSb290O1xuICAgIHZhciBnZW5lcmF0b3IgPSBuZXcgU291cmNlTWFwR2VuZXJhdG9yKHtcbiAgICAgIGZpbGU6IGFTb3VyY2VNYXBDb25zdW1lci5maWxlLFxuICAgICAgc291cmNlUm9vdDogc291cmNlUm9vdFxuICAgIH0pO1xuICAgIGFTb3VyY2VNYXBDb25zdW1lci5lYWNoTWFwcGluZyhmdW5jdGlvbiAobWFwcGluZykge1xuICAgICAgdmFyIG5ld01hcHBpbmcgPSB7XG4gICAgICAgIGdlbmVyYXRlZDoge1xuICAgICAgICAgIGxpbmU6IG1hcHBpbmcuZ2VuZXJhdGVkTGluZSxcbiAgICAgICAgICBjb2x1bW46IG1hcHBpbmcuZ2VuZXJhdGVkQ29sdW1uXG4gICAgICAgIH1cbiAgICAgIH07XG5cbiAgICAgIGlmIChtYXBwaW5nLnNvdXJjZSAhPSBudWxsKSB7XG4gICAgICAgIG5ld01hcHBpbmcuc291cmNlID0gbWFwcGluZy5zb3VyY2U7XG4gICAgICAgIGlmIChzb3VyY2VSb290ICE9IG51bGwpIHtcbiAgICAgICAgICBuZXdNYXBwaW5nLnNvdXJjZSA9IHV0aWwucmVsYXRpdmUoc291cmNlUm9vdCwgbmV3TWFwcGluZy5zb3VyY2UpO1xuICAgICAgICB9XG5cbiAgICAgICAgbmV3TWFwcGluZy5vcmlnaW5hbCA9IHtcbiAgICAgICAgICBsaW5lOiBtYXBwaW5nLm9yaWdpbmFsTGluZSxcbiAgICAgICAgICBjb2x1bW46IG1hcHBpbmcub3JpZ2luYWxDb2x1bW5cbiAgICAgICAgfTtcblxuICAgICAgICBpZiAobWFwcGluZy5uYW1lICE9IG51bGwpIHtcbiAgICAgICAgICBuZXdNYXBwaW5nLm5hbWUgPSBtYXBwaW5nLm5hbWU7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgZ2VuZXJhdG9yLmFkZE1hcHBpbmcobmV3TWFwcGluZyk7XG4gICAgfSk7XG4gICAgYVNvdXJjZU1hcENvbnN1bWVyLnNvdXJjZXMuZm9yRWFjaChmdW5jdGlvbiAoc291cmNlRmlsZSkge1xuICAgICAgdmFyIGNvbnRlbnQgPSBhU291cmNlTWFwQ29uc3VtZXIuc291cmNlQ29udGVudEZvcihzb3VyY2VGaWxlKTtcbiAgICAgIGlmIChjb250ZW50ICE9IG51bGwpIHtcbiAgICAgICAgZ2VuZXJhdG9yLnNldFNvdXJjZUNvbnRlbnQoc291cmNlRmlsZSwgY29udGVudCk7XG4gICAgICB9XG4gICAgfSk7XG4gICAgcmV0dXJuIGdlbmVyYXRvcjtcbiAgfTtcblxuLyoqXG4gKiBBZGQgYSBzaW5nbGUgbWFwcGluZyBmcm9tIG9yaWdpbmFsIHNvdXJjZSBsaW5lIGFuZCBjb2x1bW4gdG8gdGhlIGdlbmVyYXRlZFxuICogc291cmNlJ3MgbGluZSBhbmQgY29sdW1uIGZvciB0aGlzIHNvdXJjZSBtYXAgYmVpbmcgY3JlYXRlZC4gVGhlIG1hcHBpbmdcbiAqIG9iamVjdCBzaG91bGQgaGF2ZSB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIGdlbmVyYXRlZDogQW4gb2JqZWN0IHdpdGggdGhlIGdlbmVyYXRlZCBsaW5lIGFuZCBjb2x1bW4gcG9zaXRpb25zLlxuICogICAtIG9yaWdpbmFsOiBBbiBvYmplY3Qgd2l0aCB0aGUgb3JpZ2luYWwgbGluZSBhbmQgY29sdW1uIHBvc2l0aW9ucy5cbiAqICAgLSBzb3VyY2U6IFRoZSBvcmlnaW5hbCBzb3VyY2UgZmlsZSAocmVsYXRpdmUgdG8gdGhlIHNvdXJjZVJvb3QpLlxuICogICAtIG5hbWU6IEFuIG9wdGlvbmFsIG9yaWdpbmFsIHRva2VuIG5hbWUgZm9yIHRoaXMgbWFwcGluZy5cbiAqL1xuU291cmNlTWFwR2VuZXJhdG9yLnByb3RvdHlwZS5hZGRNYXBwaW5nID1cbiAgZnVuY3Rpb24gU291cmNlTWFwR2VuZXJhdG9yX2FkZE1hcHBpbmcoYUFyZ3MpIHtcbiAgICB2YXIgZ2VuZXJhdGVkID0gdXRpbC5nZXRBcmcoYUFyZ3MsICdnZW5lcmF0ZWQnKTtcbiAgICB2YXIgb3JpZ2luYWwgPSB1dGlsLmdldEFyZyhhQXJncywgJ29yaWdpbmFsJywgbnVsbCk7XG4gICAgdmFyIHNvdXJjZSA9IHV0aWwuZ2V0QXJnKGFBcmdzLCAnc291cmNlJywgbnVsbCk7XG4gICAgdmFyIG5hbWUgPSB1dGlsLmdldEFyZyhhQXJncywgJ25hbWUnLCBudWxsKTtcblxuICAgIGlmICghdGhpcy5fc2tpcFZhbGlkYXRpb24pIHtcbiAgICAgIHRoaXMuX3ZhbGlkYXRlTWFwcGluZyhnZW5lcmF0ZWQsIG9yaWdpbmFsLCBzb3VyY2UsIG5hbWUpO1xuICAgIH1cblxuICAgIGlmIChzb3VyY2UgIT0gbnVsbCkge1xuICAgICAgc291cmNlID0gU3RyaW5nKHNvdXJjZSk7XG4gICAgICBpZiAoIXRoaXMuX3NvdXJjZXMuaGFzKHNvdXJjZSkpIHtcbiAgICAgICAgdGhpcy5fc291cmNlcy5hZGQoc291cmNlKTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICBpZiAobmFtZSAhPSBudWxsKSB7XG4gICAgICBuYW1lID0gU3RyaW5nKG5hbWUpO1xuICAgICAgaWYgKCF0aGlzLl9uYW1lcy5oYXMobmFtZSkpIHtcbiAgICAgICAgdGhpcy5fbmFtZXMuYWRkKG5hbWUpO1xuICAgICAgfVxuICAgIH1cblxuICAgIHRoaXMuX21hcHBpbmdzLmFkZCh7XG4gICAgICBnZW5lcmF0ZWRMaW5lOiBnZW5lcmF0ZWQubGluZSxcbiAgICAgIGdlbmVyYXRlZENvbHVtbjogZ2VuZXJhdGVkLmNvbHVtbixcbiAgICAgIG9yaWdpbmFsTGluZTogb3JpZ2luYWwgIT0gbnVsbCAmJiBvcmlnaW5hbC5saW5lLFxuICAgICAgb3JpZ2luYWxDb2x1bW46IG9yaWdpbmFsICE9IG51bGwgJiYgb3JpZ2luYWwuY29sdW1uLFxuICAgICAgc291cmNlOiBzb3VyY2UsXG4gICAgICBuYW1lOiBuYW1lXG4gICAgfSk7XG4gIH07XG5cbi8qKlxuICogU2V0IHRoZSBzb3VyY2UgY29udGVudCBmb3IgYSBzb3VyY2UgZmlsZS5cbiAqL1xuU291cmNlTWFwR2VuZXJhdG9yLnByb3RvdHlwZS5zZXRTb3VyY2VDb250ZW50ID1cbiAgZnVuY3Rpb24gU291cmNlTWFwR2VuZXJhdG9yX3NldFNvdXJjZUNvbnRlbnQoYVNvdXJjZUZpbGUsIGFTb3VyY2VDb250ZW50KSB7XG4gICAgdmFyIHNvdXJjZSA9IGFTb3VyY2VGaWxlO1xuICAgIGlmICh0aGlzLl9zb3VyY2VSb290ICE9IG51bGwpIHtcbiAgICAgIHNvdXJjZSA9IHV0aWwucmVsYXRpdmUodGhpcy5fc291cmNlUm9vdCwgc291cmNlKTtcbiAgICB9XG5cbiAgICBpZiAoYVNvdXJjZUNvbnRlbnQgIT0gbnVsbCkge1xuICAgICAgLy8gQWRkIHRoZSBzb3VyY2UgY29udGVudCB0byB0aGUgX3NvdXJjZXNDb250ZW50cyBtYXAuXG4gICAgICAvLyBDcmVhdGUgYSBuZXcgX3NvdXJjZXNDb250ZW50cyBtYXAgaWYgdGhlIHByb3BlcnR5IGlzIG51bGwuXG4gICAgICBpZiAoIXRoaXMuX3NvdXJjZXNDb250ZW50cykge1xuICAgICAgICB0aGlzLl9zb3VyY2VzQ29udGVudHMgPSBPYmplY3QuY3JlYXRlKG51bGwpO1xuICAgICAgfVxuICAgICAgdGhpcy5fc291cmNlc0NvbnRlbnRzW3V0aWwudG9TZXRTdHJpbmcoc291cmNlKV0gPSBhU291cmNlQ29udGVudDtcbiAgICB9IGVsc2UgaWYgKHRoaXMuX3NvdXJjZXNDb250ZW50cykge1xuICAgICAgLy8gUmVtb3ZlIHRoZSBzb3VyY2UgZmlsZSBmcm9tIHRoZSBfc291cmNlc0NvbnRlbnRzIG1hcC5cbiAgICAgIC8vIElmIHRoZSBfc291cmNlc0NvbnRlbnRzIG1hcCBpcyBlbXB0eSwgc2V0IHRoZSBwcm9wZXJ0eSB0byBudWxsLlxuICAgICAgZGVsZXRlIHRoaXMuX3NvdXJjZXNDb250ZW50c1t1dGlsLnRvU2V0U3RyaW5nKHNvdXJjZSldO1xuICAgICAgaWYgKE9iamVjdC5rZXlzKHRoaXMuX3NvdXJjZXNDb250ZW50cykubGVuZ3RoID09PSAwKSB7XG4gICAgICAgIHRoaXMuX3NvdXJjZXNDb250ZW50cyA9IG51bGw7XG4gICAgICB9XG4gICAgfVxuICB9O1xuXG4vKipcbiAqIEFwcGxpZXMgdGhlIG1hcHBpbmdzIG9mIGEgc3ViLXNvdXJjZS1tYXAgZm9yIGEgc3BlY2lmaWMgc291cmNlIGZpbGUgdG8gdGhlXG4gKiBzb3VyY2UgbWFwIGJlaW5nIGdlbmVyYXRlZC4gRWFjaCBtYXBwaW5nIHRvIHRoZSBzdXBwbGllZCBzb3VyY2UgZmlsZSBpc1xuICogcmV3cml0dGVuIHVzaW5nIHRoZSBzdXBwbGllZCBzb3VyY2UgbWFwLiBOb3RlOiBUaGUgcmVzb2x1dGlvbiBmb3IgdGhlXG4gKiByZXN1bHRpbmcgbWFwcGluZ3MgaXMgdGhlIG1pbmltaXVtIG9mIHRoaXMgbWFwIGFuZCB0aGUgc3VwcGxpZWQgbWFwLlxuICpcbiAqIEBwYXJhbSBhU291cmNlTWFwQ29uc3VtZXIgVGhlIHNvdXJjZSBtYXAgdG8gYmUgYXBwbGllZC5cbiAqIEBwYXJhbSBhU291cmNlRmlsZSBPcHRpb25hbC4gVGhlIGZpbGVuYW1lIG9mIHRoZSBzb3VyY2UgZmlsZS5cbiAqICAgICAgICBJZiBvbWl0dGVkLCBTb3VyY2VNYXBDb25zdW1lcidzIGZpbGUgcHJvcGVydHkgd2lsbCBiZSB1c2VkLlxuICogQHBhcmFtIGFTb3VyY2VNYXBQYXRoIE9wdGlvbmFsLiBUaGUgZGlybmFtZSBvZiB0aGUgcGF0aCB0byB0aGUgc291cmNlIG1hcFxuICogICAgICAgIHRvIGJlIGFwcGxpZWQuIElmIHJlbGF0aXZlLCBpdCBpcyByZWxhdGl2ZSB0byB0aGUgU291cmNlTWFwQ29uc3VtZXIuXG4gKiAgICAgICAgVGhpcyBwYXJhbWV0ZXIgaXMgbmVlZGVkIHdoZW4gdGhlIHR3byBzb3VyY2UgbWFwcyBhcmVuJ3QgaW4gdGhlIHNhbWVcbiAqICAgICAgICBkaXJlY3RvcnksIGFuZCB0aGUgc291cmNlIG1hcCB0byBiZSBhcHBsaWVkIGNvbnRhaW5zIHJlbGF0aXZlIHNvdXJjZVxuICogICAgICAgIHBhdGhzLiBJZiBzbywgdGhvc2UgcmVsYXRpdmUgc291cmNlIHBhdGhzIG5lZWQgdG8gYmUgcmV3cml0dGVuXG4gKiAgICAgICAgcmVsYXRpdmUgdG8gdGhlIFNvdXJjZU1hcEdlbmVyYXRvci5cbiAqL1xuU291cmNlTWFwR2VuZXJhdG9yLnByb3RvdHlwZS5hcHBseVNvdXJjZU1hcCA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcEdlbmVyYXRvcl9hcHBseVNvdXJjZU1hcChhU291cmNlTWFwQ29uc3VtZXIsIGFTb3VyY2VGaWxlLCBhU291cmNlTWFwUGF0aCkge1xuICAgIHZhciBzb3VyY2VGaWxlID0gYVNvdXJjZUZpbGU7XG4gICAgLy8gSWYgYVNvdXJjZUZpbGUgaXMgb21pdHRlZCwgd2Ugd2lsbCB1c2UgdGhlIGZpbGUgcHJvcGVydHkgb2YgdGhlIFNvdXJjZU1hcFxuICAgIGlmIChhU291cmNlRmlsZSA9PSBudWxsKSB7XG4gICAgICBpZiAoYVNvdXJjZU1hcENvbnN1bWVyLmZpbGUgPT0gbnVsbCkge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXG4gICAgICAgICAgJ1NvdXJjZU1hcEdlbmVyYXRvci5wcm90b3R5cGUuYXBwbHlTb3VyY2VNYXAgcmVxdWlyZXMgZWl0aGVyIGFuIGV4cGxpY2l0IHNvdXJjZSBmaWxlLCAnICtcbiAgICAgICAgICAnb3IgdGhlIHNvdXJjZSBtYXBcXCdzIFwiZmlsZVwiIHByb3BlcnR5LiBCb3RoIHdlcmUgb21pdHRlZC4nXG4gICAgICAgICk7XG4gICAgICB9XG4gICAgICBzb3VyY2VGaWxlID0gYVNvdXJjZU1hcENvbnN1bWVyLmZpbGU7XG4gICAgfVxuICAgIHZhciBzb3VyY2VSb290ID0gdGhpcy5fc291cmNlUm9vdDtcbiAgICAvLyBNYWtlIFwic291cmNlRmlsZVwiIHJlbGF0aXZlIGlmIGFuIGFic29sdXRlIFVybCBpcyBwYXNzZWQuXG4gICAgaWYgKHNvdXJjZVJvb3QgIT0gbnVsbCkge1xuICAgICAgc291cmNlRmlsZSA9IHV0aWwucmVsYXRpdmUoc291cmNlUm9vdCwgc291cmNlRmlsZSk7XG4gICAgfVxuICAgIC8vIEFwcGx5aW5nIHRoZSBTb3VyY2VNYXAgY2FuIGFkZCBhbmQgcmVtb3ZlIGl0ZW1zIGZyb20gdGhlIHNvdXJjZXMgYW5kXG4gICAgLy8gdGhlIG5hbWVzIGFycmF5LlxuICAgIHZhciBuZXdTb3VyY2VzID0gbmV3IEFycmF5U2V0KCk7XG4gICAgdmFyIG5ld05hbWVzID0gbmV3IEFycmF5U2V0KCk7XG5cbiAgICAvLyBGaW5kIG1hcHBpbmdzIGZvciB0aGUgXCJzb3VyY2VGaWxlXCJcbiAgICB0aGlzLl9tYXBwaW5ncy51bnNvcnRlZEZvckVhY2goZnVuY3Rpb24gKG1hcHBpbmcpIHtcbiAgICAgIGlmIChtYXBwaW5nLnNvdXJjZSA9PT0gc291cmNlRmlsZSAmJiBtYXBwaW5nLm9yaWdpbmFsTGluZSAhPSBudWxsKSB7XG4gICAgICAgIC8vIENoZWNrIGlmIGl0IGNhbiBiZSBtYXBwZWQgYnkgdGhlIHNvdXJjZSBtYXAsIHRoZW4gdXBkYXRlIHRoZSBtYXBwaW5nLlxuICAgICAgICB2YXIgb3JpZ2luYWwgPSBhU291cmNlTWFwQ29uc3VtZXIub3JpZ2luYWxQb3NpdGlvbkZvcih7XG4gICAgICAgICAgbGluZTogbWFwcGluZy5vcmlnaW5hbExpbmUsXG4gICAgICAgICAgY29sdW1uOiBtYXBwaW5nLm9yaWdpbmFsQ29sdW1uXG4gICAgICAgIH0pO1xuICAgICAgICBpZiAob3JpZ2luYWwuc291cmNlICE9IG51bGwpIHtcbiAgICAgICAgICAvLyBDb3B5IG1hcHBpbmdcbiAgICAgICAgICBtYXBwaW5nLnNvdXJjZSA9IG9yaWdpbmFsLnNvdXJjZTtcbiAgICAgICAgICBpZiAoYVNvdXJjZU1hcFBhdGggIT0gbnVsbCkge1xuICAgICAgICAgICAgbWFwcGluZy5zb3VyY2UgPSB1dGlsLmpvaW4oYVNvdXJjZU1hcFBhdGgsIG1hcHBpbmcuc291cmNlKVxuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoc291cmNlUm9vdCAhPSBudWxsKSB7XG4gICAgICAgICAgICBtYXBwaW5nLnNvdXJjZSA9IHV0aWwucmVsYXRpdmUoc291cmNlUm9vdCwgbWFwcGluZy5zb3VyY2UpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBtYXBwaW5nLm9yaWdpbmFsTGluZSA9IG9yaWdpbmFsLmxpbmU7XG4gICAgICAgICAgbWFwcGluZy5vcmlnaW5hbENvbHVtbiA9IG9yaWdpbmFsLmNvbHVtbjtcbiAgICAgICAgICBpZiAob3JpZ2luYWwubmFtZSAhPSBudWxsKSB7XG4gICAgICAgICAgICBtYXBwaW5nLm5hbWUgPSBvcmlnaW5hbC5uYW1lO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICB2YXIgc291cmNlID0gbWFwcGluZy5zb3VyY2U7XG4gICAgICBpZiAoc291cmNlICE9IG51bGwgJiYgIW5ld1NvdXJjZXMuaGFzKHNvdXJjZSkpIHtcbiAgICAgICAgbmV3U291cmNlcy5hZGQoc291cmNlKTtcbiAgICAgIH1cblxuICAgICAgdmFyIG5hbWUgPSBtYXBwaW5nLm5hbWU7XG4gICAgICBpZiAobmFtZSAhPSBudWxsICYmICFuZXdOYW1lcy5oYXMobmFtZSkpIHtcbiAgICAgICAgbmV3TmFtZXMuYWRkKG5hbWUpO1xuICAgICAgfVxuXG4gICAgfSwgdGhpcyk7XG4gICAgdGhpcy5fc291cmNlcyA9IG5ld1NvdXJjZXM7XG4gICAgdGhpcy5fbmFtZXMgPSBuZXdOYW1lcztcblxuICAgIC8vIENvcHkgc291cmNlc0NvbnRlbnRzIG9mIGFwcGxpZWQgbWFwLlxuICAgIGFTb3VyY2VNYXBDb25zdW1lci5zb3VyY2VzLmZvckVhY2goZnVuY3Rpb24gKHNvdXJjZUZpbGUpIHtcbiAgICAgIHZhciBjb250ZW50ID0gYVNvdXJjZU1hcENvbnN1bWVyLnNvdXJjZUNvbnRlbnRGb3Ioc291cmNlRmlsZSk7XG4gICAgICBpZiAoY29udGVudCAhPSBudWxsKSB7XG4gICAgICAgIGlmIChhU291cmNlTWFwUGF0aCAhPSBudWxsKSB7XG4gICAgICAgICAgc291cmNlRmlsZSA9IHV0aWwuam9pbihhU291cmNlTWFwUGF0aCwgc291cmNlRmlsZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHNvdXJjZVJvb3QgIT0gbnVsbCkge1xuICAgICAgICAgIHNvdXJjZUZpbGUgPSB1dGlsLnJlbGF0aXZlKHNvdXJjZVJvb3QsIHNvdXJjZUZpbGUpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMuc2V0U291cmNlQ29udGVudChzb3VyY2VGaWxlLCBjb250ZW50KTtcbiAgICAgIH1cbiAgICB9LCB0aGlzKTtcbiAgfTtcblxuLyoqXG4gKiBBIG1hcHBpbmcgY2FuIGhhdmUgb25lIG9mIHRoZSB0aHJlZSBsZXZlbHMgb2YgZGF0YTpcbiAqXG4gKiAgIDEuIEp1c3QgdGhlIGdlbmVyYXRlZCBwb3NpdGlvbi5cbiAqICAgMi4gVGhlIEdlbmVyYXRlZCBwb3NpdGlvbiwgb3JpZ2luYWwgcG9zaXRpb24sIGFuZCBvcmlnaW5hbCBzb3VyY2UuXG4gKiAgIDMuIEdlbmVyYXRlZCBhbmQgb3JpZ2luYWwgcG9zaXRpb24sIG9yaWdpbmFsIHNvdXJjZSwgYXMgd2VsbCBhcyBhIG5hbWVcbiAqICAgICAgdG9rZW4uXG4gKlxuICogVG8gbWFpbnRhaW4gY29uc2lzdGVuY3ksIHdlIHZhbGlkYXRlIHRoYXQgYW55IG5ldyBtYXBwaW5nIGJlaW5nIGFkZGVkIGZhbGxzXG4gKiBpbiB0byBvbmUgb2YgdGhlc2UgY2F0ZWdvcmllcy5cbiAqL1xuU291cmNlTWFwR2VuZXJhdG9yLnByb3RvdHlwZS5fdmFsaWRhdGVNYXBwaW5nID1cbiAgZnVuY3Rpb24gU291cmNlTWFwR2VuZXJhdG9yX3ZhbGlkYXRlTWFwcGluZyhhR2VuZXJhdGVkLCBhT3JpZ2luYWwsIGFTb3VyY2UsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYU5hbWUpIHtcbiAgICAvLyBXaGVuIGFPcmlnaW5hbCBpcyB0cnV0aHkgYnV0IGhhcyBlbXB0eSB2YWx1ZXMgZm9yIC5saW5lIGFuZCAuY29sdW1uLFxuICAgIC8vIGl0IGlzIG1vc3QgbGlrZWx5IGEgcHJvZ3JhbW1lciBlcnJvci4gSW4gdGhpcyBjYXNlIHdlIHRocm93IGEgdmVyeVxuICAgIC8vIHNwZWNpZmljIGVycm9yIG1lc3NhZ2UgdG8gdHJ5IHRvIGd1aWRlIHRoZW0gdGhlIHJpZ2h0IHdheS5cbiAgICAvLyBGb3IgZXhhbXBsZTogaHR0cHM6Ly9naXRodWIuY29tL1BvbHltZXIvcG9seW1lci1idW5kbGVyL3B1bGwvNTE5XG4gICAgaWYgKGFPcmlnaW5hbCAmJiB0eXBlb2YgYU9yaWdpbmFsLmxpbmUgIT09ICdudW1iZXInICYmIHR5cGVvZiBhT3JpZ2luYWwuY29sdW1uICE9PSAnbnVtYmVyJykge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXG4gICAgICAgICAgICAnb3JpZ2luYWwubGluZSBhbmQgb3JpZ2luYWwuY29sdW1uIGFyZSBub3QgbnVtYmVycyAtLSB5b3UgcHJvYmFibHkgbWVhbnQgdG8gb21pdCAnICtcbiAgICAgICAgICAgICd0aGUgb3JpZ2luYWwgbWFwcGluZyBlbnRpcmVseSBhbmQgb25seSBtYXAgdGhlIGdlbmVyYXRlZCBwb3NpdGlvbi4gSWYgc28sIHBhc3MgJyArXG4gICAgICAgICAgICAnbnVsbCBmb3IgdGhlIG9yaWdpbmFsIG1hcHBpbmcgaW5zdGVhZCBvZiBhbiBvYmplY3Qgd2l0aCBlbXB0eSBvciBudWxsIHZhbHVlcy4nXG4gICAgICAgICk7XG4gICAgfVxuXG4gICAgaWYgKGFHZW5lcmF0ZWQgJiYgJ2xpbmUnIGluIGFHZW5lcmF0ZWQgJiYgJ2NvbHVtbicgaW4gYUdlbmVyYXRlZFxuICAgICAgICAmJiBhR2VuZXJhdGVkLmxpbmUgPiAwICYmIGFHZW5lcmF0ZWQuY29sdW1uID49IDBcbiAgICAgICAgJiYgIWFPcmlnaW5hbCAmJiAhYVNvdXJjZSAmJiAhYU5hbWUpIHtcbiAgICAgIC8vIENhc2UgMS5cbiAgICAgIHJldHVybjtcbiAgICB9XG4gICAgZWxzZSBpZiAoYUdlbmVyYXRlZCAmJiAnbGluZScgaW4gYUdlbmVyYXRlZCAmJiAnY29sdW1uJyBpbiBhR2VuZXJhdGVkXG4gICAgICAgICAgICAgJiYgYU9yaWdpbmFsICYmICdsaW5lJyBpbiBhT3JpZ2luYWwgJiYgJ2NvbHVtbicgaW4gYU9yaWdpbmFsXG4gICAgICAgICAgICAgJiYgYUdlbmVyYXRlZC5saW5lID4gMCAmJiBhR2VuZXJhdGVkLmNvbHVtbiA+PSAwXG4gICAgICAgICAgICAgJiYgYU9yaWdpbmFsLmxpbmUgPiAwICYmIGFPcmlnaW5hbC5jb2x1bW4gPj0gMFxuICAgICAgICAgICAgICYmIGFTb3VyY2UpIHtcbiAgICAgIC8vIENhc2VzIDIgYW5kIDMuXG4gICAgICByZXR1cm47XG4gICAgfVxuICAgIGVsc2Uge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKCdJbnZhbGlkIG1hcHBpbmc6ICcgKyBKU09OLnN0cmluZ2lmeSh7XG4gICAgICAgIGdlbmVyYXRlZDogYUdlbmVyYXRlZCxcbiAgICAgICAgc291cmNlOiBhU291cmNlLFxuICAgICAgICBvcmlnaW5hbDogYU9yaWdpbmFsLFxuICAgICAgICBuYW1lOiBhTmFtZVxuICAgICAgfSkpO1xuICAgIH1cbiAgfTtcblxuLyoqXG4gKiBTZXJpYWxpemUgdGhlIGFjY3VtdWxhdGVkIG1hcHBpbmdzIGluIHRvIHRoZSBzdHJlYW0gb2YgYmFzZSA2NCBWTFFzXG4gKiBzcGVjaWZpZWQgYnkgdGhlIHNvdXJjZSBtYXAgZm9ybWF0LlxuICovXG5Tb3VyY2VNYXBHZW5lcmF0b3IucHJvdG90eXBlLl9zZXJpYWxpemVNYXBwaW5ncyA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcEdlbmVyYXRvcl9zZXJpYWxpemVNYXBwaW5ncygpIHtcbiAgICB2YXIgcHJldmlvdXNHZW5lcmF0ZWRDb2x1bW4gPSAwO1xuICAgIHZhciBwcmV2aW91c0dlbmVyYXRlZExpbmUgPSAxO1xuICAgIHZhciBwcmV2aW91c09yaWdpbmFsQ29sdW1uID0gMDtcbiAgICB2YXIgcHJldmlvdXNPcmlnaW5hbExpbmUgPSAwO1xuICAgIHZhciBwcmV2aW91c05hbWUgPSAwO1xuICAgIHZhciBwcmV2aW91c1NvdXJjZSA9IDA7XG4gICAgdmFyIHJlc3VsdCA9ICcnO1xuICAgIHZhciBuZXh0O1xuICAgIHZhciBtYXBwaW5nO1xuICAgIHZhciBuYW1lSWR4O1xuICAgIHZhciBzb3VyY2VJZHg7XG5cbiAgICB2YXIgbWFwcGluZ3MgPSB0aGlzLl9tYXBwaW5ncy50b0FycmF5KCk7XG4gICAgZm9yICh2YXIgaSA9IDAsIGxlbiA9IG1hcHBpbmdzLmxlbmd0aDsgaSA8IGxlbjsgaSsrKSB7XG4gICAgICBtYXBwaW5nID0gbWFwcGluZ3NbaV07XG4gICAgICBuZXh0ID0gJydcblxuICAgICAgaWYgKG1hcHBpbmcuZ2VuZXJhdGVkTGluZSAhPT0gcHJldmlvdXNHZW5lcmF0ZWRMaW5lKSB7XG4gICAgICAgIHByZXZpb3VzR2VuZXJhdGVkQ29sdW1uID0gMDtcbiAgICAgICAgd2hpbGUgKG1hcHBpbmcuZ2VuZXJhdGVkTGluZSAhPT0gcHJldmlvdXNHZW5lcmF0ZWRMaW5lKSB7XG4gICAgICAgICAgbmV4dCArPSAnOyc7XG4gICAgICAgICAgcHJldmlvdXNHZW5lcmF0ZWRMaW5lKys7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIGVsc2Uge1xuICAgICAgICBpZiAoaSA+IDApIHtcbiAgICAgICAgICBpZiAoIXV0aWwuY29tcGFyZUJ5R2VuZXJhdGVkUG9zaXRpb25zSW5mbGF0ZWQobWFwcGluZywgbWFwcGluZ3NbaSAtIDFdKSkge1xuICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgfVxuICAgICAgICAgIG5leHQgKz0gJywnO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIG5leHQgKz0gYmFzZTY0VkxRLmVuY29kZShtYXBwaW5nLmdlbmVyYXRlZENvbHVtblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBwcmV2aW91c0dlbmVyYXRlZENvbHVtbik7XG4gICAgICBwcmV2aW91c0dlbmVyYXRlZENvbHVtbiA9IG1hcHBpbmcuZ2VuZXJhdGVkQ29sdW1uO1xuXG4gICAgICBpZiAobWFwcGluZy5zb3VyY2UgIT0gbnVsbCkge1xuICAgICAgICBzb3VyY2VJZHggPSB0aGlzLl9zb3VyY2VzLmluZGV4T2YobWFwcGluZy5zb3VyY2UpO1xuICAgICAgICBuZXh0ICs9IGJhc2U2NFZMUS5lbmNvZGUoc291cmNlSWR4IC0gcHJldmlvdXNTb3VyY2UpO1xuICAgICAgICBwcmV2aW91c1NvdXJjZSA9IHNvdXJjZUlkeDtcblxuICAgICAgICAvLyBsaW5lcyBhcmUgc3RvcmVkIDAtYmFzZWQgaW4gU291cmNlTWFwIHNwZWMgdmVyc2lvbiAzXG4gICAgICAgIG5leHQgKz0gYmFzZTY0VkxRLmVuY29kZShtYXBwaW5nLm9yaWdpbmFsTGluZSAtIDFcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBwcmV2aW91c09yaWdpbmFsTGluZSk7XG4gICAgICAgIHByZXZpb3VzT3JpZ2luYWxMaW5lID0gbWFwcGluZy5vcmlnaW5hbExpbmUgLSAxO1xuXG4gICAgICAgIG5leHQgKz0gYmFzZTY0VkxRLmVuY29kZShtYXBwaW5nLm9yaWdpbmFsQ29sdW1uXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gcHJldmlvdXNPcmlnaW5hbENvbHVtbik7XG4gICAgICAgIHByZXZpb3VzT3JpZ2luYWxDb2x1bW4gPSBtYXBwaW5nLm9yaWdpbmFsQ29sdW1uO1xuXG4gICAgICAgIGlmIChtYXBwaW5nLm5hbWUgIT0gbnVsbCkge1xuICAgICAgICAgIG5hbWVJZHggPSB0aGlzLl9uYW1lcy5pbmRleE9mKG1hcHBpbmcubmFtZSk7XG4gICAgICAgICAgbmV4dCArPSBiYXNlNjRWTFEuZW5jb2RlKG5hbWVJZHggLSBwcmV2aW91c05hbWUpO1xuICAgICAgICAgIHByZXZpb3VzTmFtZSA9IG5hbWVJZHg7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgcmVzdWx0ICs9IG5leHQ7XG4gICAgfVxuXG4gICAgcmV0dXJuIHJlc3VsdDtcbiAgfTtcblxuU291cmNlTWFwR2VuZXJhdG9yLnByb3RvdHlwZS5fZ2VuZXJhdGVTb3VyY2VzQ29udGVudCA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcEdlbmVyYXRvcl9nZW5lcmF0ZVNvdXJjZXNDb250ZW50KGFTb3VyY2VzLCBhU291cmNlUm9vdCkge1xuICAgIHJldHVybiBhU291cmNlcy5tYXAoZnVuY3Rpb24gKHNvdXJjZSkge1xuICAgICAgaWYgKCF0aGlzLl9zb3VyY2VzQ29udGVudHMpIHtcbiAgICAgICAgcmV0dXJuIG51bGw7XG4gICAgICB9XG4gICAgICBpZiAoYVNvdXJjZVJvb3QgIT0gbnVsbCkge1xuICAgICAgICBzb3VyY2UgPSB1dGlsLnJlbGF0aXZlKGFTb3VyY2VSb290LCBzb3VyY2UpO1xuICAgICAgfVxuICAgICAgdmFyIGtleSA9IHV0aWwudG9TZXRTdHJpbmcoc291cmNlKTtcbiAgICAgIHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwodGhpcy5fc291cmNlc0NvbnRlbnRzLCBrZXkpXG4gICAgICAgID8gdGhpcy5fc291cmNlc0NvbnRlbnRzW2tleV1cbiAgICAgICAgOiBudWxsO1xuICAgIH0sIHRoaXMpO1xuICB9O1xuXG4vKipcbiAqIEV4dGVybmFsaXplIHRoZSBzb3VyY2UgbWFwLlxuICovXG5Tb3VyY2VNYXBHZW5lcmF0b3IucHJvdG90eXBlLnRvSlNPTiA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcEdlbmVyYXRvcl90b0pTT04oKSB7XG4gICAgdmFyIG1hcCA9IHtcbiAgICAgIHZlcnNpb246IHRoaXMuX3ZlcnNpb24sXG4gICAgICBzb3VyY2VzOiB0aGlzLl9zb3VyY2VzLnRvQXJyYXkoKSxcbiAgICAgIG5hbWVzOiB0aGlzLl9uYW1lcy50b0FycmF5KCksXG4gICAgICBtYXBwaW5nczogdGhpcy5fc2VyaWFsaXplTWFwcGluZ3MoKVxuICAgIH07XG4gICAgaWYgKHRoaXMuX2ZpbGUgIT0gbnVsbCkge1xuICAgICAgbWFwLmZpbGUgPSB0aGlzLl9maWxlO1xuICAgIH1cbiAgICBpZiAodGhpcy5fc291cmNlUm9vdCAhPSBudWxsKSB7XG4gICAgICBtYXAuc291cmNlUm9vdCA9IHRoaXMuX3NvdXJjZVJvb3Q7XG4gICAgfVxuICAgIGlmICh0aGlzLl9zb3VyY2VzQ29udGVudHMpIHtcbiAgICAgIG1hcC5zb3VyY2VzQ29udGVudCA9IHRoaXMuX2dlbmVyYXRlU291cmNlc0NvbnRlbnQobWFwLnNvdXJjZXMsIG1hcC5zb3VyY2VSb290KTtcbiAgICB9XG5cbiAgICByZXR1cm4gbWFwO1xuICB9O1xuXG4vKipcbiAqIFJlbmRlciB0aGUgc291cmNlIG1hcCBiZWluZyBnZW5lcmF0ZWQgdG8gYSBzdHJpbmcuXG4gKi9cblNvdXJjZU1hcEdlbmVyYXRvci5wcm90b3R5cGUudG9TdHJpbmcgPVxuICBmdW5jdGlvbiBTb3VyY2VNYXBHZW5lcmF0b3JfdG9TdHJpbmcoKSB7XG4gICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHRoaXMudG9KU09OKCkpO1xuICB9O1xuXG5leHBvcnRzLlNvdXJjZU1hcEdlbmVyYXRvciA9IFNvdXJjZU1hcEdlbmVyYXRvcjtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbGliL3NvdXJjZS1tYXAtZ2VuZXJhdG9yLmpzXG4vLyBtb2R1bGUgaWQgPSAxXG4vLyBtb2R1bGUgY2h1bmtzID0gMCIsIi8qIC0qLSBNb2RlOiBqczsganMtaW5kZW50LWxldmVsOiAyOyAtKi0gKi9cbi8qXG4gKiBDb3B5cmlnaHQgMjAxMSBNb3ppbGxhIEZvdW5kYXRpb24gYW5kIGNvbnRyaWJ1dG9yc1xuICogTGljZW5zZWQgdW5kZXIgdGhlIE5ldyBCU0QgbGljZW5zZS4gU2VlIExJQ0VOU0Ugb3I6XG4gKiBodHRwOi8vb3BlbnNvdXJjZS5vcmcvbGljZW5zZXMvQlNELTMtQ2xhdXNlXG4gKlxuICogQmFzZWQgb24gdGhlIEJhc2UgNjQgVkxRIGltcGxlbWVudGF0aW9uIGluIENsb3N1cmUgQ29tcGlsZXI6XG4gKiBodHRwczovL2NvZGUuZ29vZ2xlLmNvbS9wL2Nsb3N1cmUtY29tcGlsZXIvc291cmNlL2Jyb3dzZS90cnVuay9zcmMvY29tL2dvb2dsZS9kZWJ1Z2dpbmcvc291cmNlbWFwL0Jhc2U2NFZMUS5qYXZhXG4gKlxuICogQ29weXJpZ2h0IDIwMTEgVGhlIENsb3N1cmUgQ29tcGlsZXIgQXV0aG9ycy4gQWxsIHJpZ2h0cyByZXNlcnZlZC5cbiAqIFJlZGlzdHJpYnV0aW9uIGFuZCB1c2UgaW4gc291cmNlIGFuZCBiaW5hcnkgZm9ybXMsIHdpdGggb3Igd2l0aG91dFxuICogbW9kaWZpY2F0aW9uLCBhcmUgcGVybWl0dGVkIHByb3ZpZGVkIHRoYXQgdGhlIGZvbGxvd2luZyBjb25kaXRpb25zIGFyZVxuICogbWV0OlxuICpcbiAqICAqIFJlZGlzdHJpYnV0aW9ucyBvZiBzb3VyY2UgY29kZSBtdXN0IHJldGFpbiB0aGUgYWJvdmUgY29weXJpZ2h0XG4gKiAgICBub3RpY2UsIHRoaXMgbGlzdCBvZiBjb25kaXRpb25zIGFuZCB0aGUgZm9sbG93aW5nIGRpc2NsYWltZXIuXG4gKiAgKiBSZWRpc3RyaWJ1dGlvbnMgaW4gYmluYXJ5IGZvcm0gbXVzdCByZXByb2R1Y2UgdGhlIGFib3ZlXG4gKiAgICBjb3B5cmlnaHQgbm90aWNlLCB0aGlzIGxpc3Qgb2YgY29uZGl0aW9ucyBhbmQgdGhlIGZvbGxvd2luZ1xuICogICAgZGlzY2xhaW1lciBpbiB0aGUgZG9jdW1lbnRhdGlvbiBhbmQvb3Igb3RoZXIgbWF0ZXJpYWxzIHByb3ZpZGVkXG4gKiAgICB3aXRoIHRoZSBkaXN0cmlidXRpb24uXG4gKiAgKiBOZWl0aGVyIHRoZSBuYW1lIG9mIEdvb2dsZSBJbmMuIG5vciB0aGUgbmFtZXMgb2YgaXRzXG4gKiAgICBjb250cmlidXRvcnMgbWF5IGJlIHVzZWQgdG8gZW5kb3JzZSBvciBwcm9tb3RlIHByb2R1Y3RzIGRlcml2ZWRcbiAqICAgIGZyb20gdGhpcyBzb2Z0d2FyZSB3aXRob3V0IHNwZWNpZmljIHByaW9yIHdyaXR0ZW4gcGVybWlzc2lvbi5cbiAqXG4gKiBUSElTIFNPRlRXQVJFIElTIFBST1ZJREVEIEJZIFRIRSBDT1BZUklHSFQgSE9MREVSUyBBTkQgQ09OVFJJQlVUT1JTXG4gKiBcIkFTIElTXCIgQU5EIEFOWSBFWFBSRVNTIE9SIElNUExJRUQgV0FSUkFOVElFUywgSU5DTFVESU5HLCBCVVQgTk9UXG4gKiBMSU1JVEVEIFRPLCBUSEUgSU1QTElFRCBXQVJSQU5USUVTIE9GIE1FUkNIQU5UQUJJTElUWSBBTkQgRklUTkVTUyBGT1JcbiAqIEEgUEFSVElDVUxBUiBQVVJQT1NFIEFSRSBESVNDTEFJTUVELiBJTiBOTyBFVkVOVCBTSEFMTCBUSEUgQ09QWVJJR0hUXG4gKiBPV05FUiBPUiBDT05UUklCVVRPUlMgQkUgTElBQkxFIEZPUiBBTlkgRElSRUNULCBJTkRJUkVDVCwgSU5DSURFTlRBTCxcbiAqIFNQRUNJQUwsIEVYRU1QTEFSWSwgT1IgQ09OU0VRVUVOVElBTCBEQU1BR0VTIChJTkNMVURJTkcsIEJVVCBOT1RcbiAqIExJTUlURUQgVE8sIFBST0NVUkVNRU5UIE9GIFNVQlNUSVRVVEUgR09PRFMgT1IgU0VSVklDRVM7IExPU1MgT0YgVVNFLFxuICogREFUQSwgT1IgUFJPRklUUzsgT1IgQlVTSU5FU1MgSU5URVJSVVBUSU9OKSBIT1dFVkVSIENBVVNFRCBBTkQgT04gQU5ZXG4gKiBUSEVPUlkgT0YgTElBQklMSVRZLCBXSEVUSEVSIElOIENPTlRSQUNULCBTVFJJQ1QgTElBQklMSVRZLCBPUiBUT1JUXG4gKiAoSU5DTFVESU5HIE5FR0xJR0VOQ0UgT1IgT1RIRVJXSVNFKSBBUklTSU5HIElOIEFOWSBXQVkgT1VUIE9GIFRIRSBVU0VcbiAqIE9GIFRISVMgU09GVFdBUkUsIEVWRU4gSUYgQURWSVNFRCBPRiBUSEUgUE9TU0lCSUxJVFkgT0YgU1VDSCBEQU1BR0UuXG4gKi9cblxudmFyIGJhc2U2NCA9IHJlcXVpcmUoJy4vYmFzZTY0Jyk7XG5cbi8vIEEgc2luZ2xlIGJhc2UgNjQgZGlnaXQgY2FuIGNvbnRhaW4gNiBiaXRzIG9mIGRhdGEuIEZvciB0aGUgYmFzZSA2NCB2YXJpYWJsZVxuLy8gbGVuZ3RoIHF1YW50aXRpZXMgd2UgdXNlIGluIHRoZSBzb3VyY2UgbWFwIHNwZWMsIHRoZSBmaXJzdCBiaXQgaXMgdGhlIHNpZ24sXG4vLyB0aGUgbmV4dCBmb3VyIGJpdHMgYXJlIHRoZSBhY3R1YWwgdmFsdWUsIGFuZCB0aGUgNnRoIGJpdCBpcyB0aGVcbi8vIGNvbnRpbnVhdGlvbiBiaXQuIFRoZSBjb250aW51YXRpb24gYml0IHRlbGxzIHVzIHdoZXRoZXIgdGhlcmUgYXJlIG1vcmVcbi8vIGRpZ2l0cyBpbiB0aGlzIHZhbHVlIGZvbGxvd2luZyB0aGlzIGRpZ2l0LlxuLy9cbi8vICAgQ29udGludWF0aW9uXG4vLyAgIHwgICAgU2lnblxuLy8gICB8ICAgIHxcbi8vICAgViAgICBWXG4vLyAgIDEwMTAxMVxuXG52YXIgVkxRX0JBU0VfU0hJRlQgPSA1O1xuXG4vLyBiaW5hcnk6IDEwMDAwMFxudmFyIFZMUV9CQVNFID0gMSA8PCBWTFFfQkFTRV9TSElGVDtcblxuLy8gYmluYXJ5OiAwMTExMTFcbnZhciBWTFFfQkFTRV9NQVNLID0gVkxRX0JBU0UgLSAxO1xuXG4vLyBiaW5hcnk6IDEwMDAwMFxudmFyIFZMUV9DT05USU5VQVRJT05fQklUID0gVkxRX0JBU0U7XG5cbi8qKlxuICogQ29udmVydHMgZnJvbSBhIHR3by1jb21wbGVtZW50IHZhbHVlIHRvIGEgdmFsdWUgd2hlcmUgdGhlIHNpZ24gYml0IGlzXG4gKiBwbGFjZWQgaW4gdGhlIGxlYXN0IHNpZ25pZmljYW50IGJpdC4gIEZvciBleGFtcGxlLCBhcyBkZWNpbWFsczpcbiAqICAgMSBiZWNvbWVzIDIgKDEwIGJpbmFyeSksIC0xIGJlY29tZXMgMyAoMTEgYmluYXJ5KVxuICogICAyIGJlY29tZXMgNCAoMTAwIGJpbmFyeSksIC0yIGJlY29tZXMgNSAoMTAxIGJpbmFyeSlcbiAqL1xuZnVuY3Rpb24gdG9WTFFTaWduZWQoYVZhbHVlKSB7XG4gIHJldHVybiBhVmFsdWUgPCAwXG4gICAgPyAoKC1hVmFsdWUpIDw8IDEpICsgMVxuICAgIDogKGFWYWx1ZSA8PCAxKSArIDA7XG59XG5cbi8qKlxuICogQ29udmVydHMgdG8gYSB0d28tY29tcGxlbWVudCB2YWx1ZSBmcm9tIGEgdmFsdWUgd2hlcmUgdGhlIHNpZ24gYml0IGlzXG4gKiBwbGFjZWQgaW4gdGhlIGxlYXN0IHNpZ25pZmljYW50IGJpdC4gIEZvciBleGFtcGxlLCBhcyBkZWNpbWFsczpcbiAqICAgMiAoMTAgYmluYXJ5KSBiZWNvbWVzIDEsIDMgKDExIGJpbmFyeSkgYmVjb21lcyAtMVxuICogICA0ICgxMDAgYmluYXJ5KSBiZWNvbWVzIDIsIDUgKDEwMSBiaW5hcnkpIGJlY29tZXMgLTJcbiAqL1xuZnVuY3Rpb24gZnJvbVZMUVNpZ25lZChhVmFsdWUpIHtcbiAgdmFyIGlzTmVnYXRpdmUgPSAoYVZhbHVlICYgMSkgPT09IDE7XG4gIHZhciBzaGlmdGVkID0gYVZhbHVlID4+IDE7XG4gIHJldHVybiBpc05lZ2F0aXZlXG4gICAgPyAtc2hpZnRlZFxuICAgIDogc2hpZnRlZDtcbn1cblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBiYXNlIDY0IFZMUSBlbmNvZGVkIHZhbHVlLlxuICovXG5leHBvcnRzLmVuY29kZSA9IGZ1bmN0aW9uIGJhc2U2NFZMUV9lbmNvZGUoYVZhbHVlKSB7XG4gIHZhciBlbmNvZGVkID0gXCJcIjtcbiAgdmFyIGRpZ2l0O1xuXG4gIHZhciB2bHEgPSB0b1ZMUVNpZ25lZChhVmFsdWUpO1xuXG4gIGRvIHtcbiAgICBkaWdpdCA9IHZscSAmIFZMUV9CQVNFX01BU0s7XG4gICAgdmxxID4+Pj0gVkxRX0JBU0VfU0hJRlQ7XG4gICAgaWYgKHZscSA+IDApIHtcbiAgICAgIC8vIFRoZXJlIGFyZSBzdGlsbCBtb3JlIGRpZ2l0cyBpbiB0aGlzIHZhbHVlLCBzbyB3ZSBtdXN0IG1ha2Ugc3VyZSB0aGVcbiAgICAgIC8vIGNvbnRpbnVhdGlvbiBiaXQgaXMgbWFya2VkLlxuICAgICAgZGlnaXQgfD0gVkxRX0NPTlRJTlVBVElPTl9CSVQ7XG4gICAgfVxuICAgIGVuY29kZWQgKz0gYmFzZTY0LmVuY29kZShkaWdpdCk7XG4gIH0gd2hpbGUgKHZscSA+IDApO1xuXG4gIHJldHVybiBlbmNvZGVkO1xufTtcblxuLyoqXG4gKiBEZWNvZGVzIHRoZSBuZXh0IGJhc2UgNjQgVkxRIHZhbHVlIGZyb20gdGhlIGdpdmVuIHN0cmluZyBhbmQgcmV0dXJucyB0aGVcbiAqIHZhbHVlIGFuZCB0aGUgcmVzdCBvZiB0aGUgc3RyaW5nIHZpYSB0aGUgb3V0IHBhcmFtZXRlci5cbiAqL1xuZXhwb3J0cy5kZWNvZGUgPSBmdW5jdGlvbiBiYXNlNjRWTFFfZGVjb2RlKGFTdHIsIGFJbmRleCwgYU91dFBhcmFtKSB7XG4gIHZhciBzdHJMZW4gPSBhU3RyLmxlbmd0aDtcbiAgdmFyIHJlc3VsdCA9IDA7XG4gIHZhciBzaGlmdCA9IDA7XG4gIHZhciBjb250aW51YXRpb24sIGRpZ2l0O1xuXG4gIGRvIHtcbiAgICBpZiAoYUluZGV4ID49IHN0ckxlbikge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKFwiRXhwZWN0ZWQgbW9yZSBkaWdpdHMgaW4gYmFzZSA2NCBWTFEgdmFsdWUuXCIpO1xuICAgIH1cblxuICAgIGRpZ2l0ID0gYmFzZTY0LmRlY29kZShhU3RyLmNoYXJDb2RlQXQoYUluZGV4KyspKTtcbiAgICBpZiAoZGlnaXQgPT09IC0xKSB7XG4gICAgICB0aHJvdyBuZXcgRXJyb3IoXCJJbnZhbGlkIGJhc2U2NCBkaWdpdDogXCIgKyBhU3RyLmNoYXJBdChhSW5kZXggLSAxKSk7XG4gICAgfVxuXG4gICAgY29udGludWF0aW9uID0gISEoZGlnaXQgJiBWTFFfQ09OVElOVUFUSU9OX0JJVCk7XG4gICAgZGlnaXQgJj0gVkxRX0JBU0VfTUFTSztcbiAgICByZXN1bHQgPSByZXN1bHQgKyAoZGlnaXQgPDwgc2hpZnQpO1xuICAgIHNoaWZ0ICs9IFZMUV9CQVNFX1NISUZUO1xuICB9IHdoaWxlIChjb250aW51YXRpb24pO1xuXG4gIGFPdXRQYXJhbS52YWx1ZSA9IGZyb21WTFFTaWduZWQocmVzdWx0KTtcbiAgYU91dFBhcmFtLnJlc3QgPSBhSW5kZXg7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvYmFzZTY0LXZscS5qc1xuLy8gbW9kdWxlIGlkID0gMlxuLy8gbW9kdWxlIGNodW5rcyA9IDAiLCIvKiAtKi0gTW9kZToganM7IGpzLWluZGVudC1sZXZlbDogMjsgLSotICovXG4vKlxuICogQ29weXJpZ2h0IDIwMTEgTW96aWxsYSBGb3VuZGF0aW9uIGFuZCBjb250cmlidXRvcnNcbiAqIExpY2Vuc2VkIHVuZGVyIHRoZSBOZXcgQlNEIGxpY2Vuc2UuIFNlZSBMSUNFTlNFIG9yOlxuICogaHR0cDovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0zLUNsYXVzZVxuICovXG5cbnZhciBpbnRUb0NoYXJNYXAgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLycuc3BsaXQoJycpO1xuXG4vKipcbiAqIEVuY29kZSBhbiBpbnRlZ2VyIGluIHRoZSByYW5nZSBvZiAwIHRvIDYzIHRvIGEgc2luZ2xlIGJhc2UgNjQgZGlnaXQuXG4gKi9cbmV4cG9ydHMuZW5jb2RlID0gZnVuY3Rpb24gKG51bWJlcikge1xuICBpZiAoMCA8PSBudW1iZXIgJiYgbnVtYmVyIDwgaW50VG9DaGFyTWFwLmxlbmd0aCkge1xuICAgIHJldHVybiBpbnRUb0NoYXJNYXBbbnVtYmVyXTtcbiAgfVxuICB0aHJvdyBuZXcgVHlwZUVycm9yKFwiTXVzdCBiZSBiZXR3ZWVuIDAgYW5kIDYzOiBcIiArIG51bWJlcik7XG59O1xuXG4vKipcbiAqIERlY29kZSBhIHNpbmdsZSBiYXNlIDY0IGNoYXJhY3RlciBjb2RlIGRpZ2l0IHRvIGFuIGludGVnZXIuIFJldHVybnMgLTEgb25cbiAqIGZhaWx1cmUuXG4gKi9cbmV4cG9ydHMuZGVjb2RlID0gZnVuY3Rpb24gKGNoYXJDb2RlKSB7XG4gIHZhciBiaWdBID0gNjU7ICAgICAvLyAnQSdcbiAgdmFyIGJpZ1ogPSA5MDsgICAgIC8vICdaJ1xuXG4gIHZhciBsaXR0bGVBID0gOTc7ICAvLyAnYSdcbiAgdmFyIGxpdHRsZVogPSAxMjI7IC8vICd6J1xuXG4gIHZhciB6ZXJvID0gNDg7ICAgICAvLyAnMCdcbiAgdmFyIG5pbmUgPSA1NzsgICAgIC8vICc5J1xuXG4gIHZhciBwbHVzID0gNDM7ICAgICAvLyAnKydcbiAgdmFyIHNsYXNoID0gNDc7ICAgIC8vICcvJ1xuXG4gIHZhciBsaXR0bGVPZmZzZXQgPSAyNjtcbiAgdmFyIG51bWJlck9mZnNldCA9IDUyO1xuXG4gIC8vIDAgLSAyNTogQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVpcbiAgaWYgKGJpZ0EgPD0gY2hhckNvZGUgJiYgY2hhckNvZGUgPD0gYmlnWikge1xuICAgIHJldHVybiAoY2hhckNvZGUgLSBiaWdBKTtcbiAgfVxuXG4gIC8vIDI2IC0gNTE6IGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6XG4gIGlmIChsaXR0bGVBIDw9IGNoYXJDb2RlICYmIGNoYXJDb2RlIDw9IGxpdHRsZVopIHtcbiAgICByZXR1cm4gKGNoYXJDb2RlIC0gbGl0dGxlQSArIGxpdHRsZU9mZnNldCk7XG4gIH1cblxuICAvLyA1MiAtIDYxOiAwMTIzNDU2Nzg5XG4gIGlmICh6ZXJvIDw9IGNoYXJDb2RlICYmIGNoYXJDb2RlIDw9IG5pbmUpIHtcbiAgICByZXR1cm4gKGNoYXJDb2RlIC0gemVybyArIG51bWJlck9mZnNldCk7XG4gIH1cblxuICAvLyA2MjogK1xuICBpZiAoY2hhckNvZGUgPT0gcGx1cykge1xuICAgIHJldHVybiA2MjtcbiAgfVxuXG4gIC8vIDYzOiAvXG4gIGlmIChjaGFyQ29kZSA9PSBzbGFzaCkge1xuICAgIHJldHVybiA2MztcbiAgfVxuXG4gIC8vIEludmFsaWQgYmFzZTY0IGRpZ2l0LlxuICByZXR1cm4gLTE7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvYmFzZTY0LmpzXG4vLyBtb2R1bGUgaWQgPSAzXG4vLyBtb2R1bGUgY2h1bmtzID0gMCIsIi8qIC0qLSBNb2RlOiBqczsganMtaW5kZW50LWxldmVsOiAyOyAtKi0gKi9cbi8qXG4gKiBDb3B5cmlnaHQgMjAxMSBNb3ppbGxhIEZvdW5kYXRpb24gYW5kIGNvbnRyaWJ1dG9yc1xuICogTGljZW5zZWQgdW5kZXIgdGhlIE5ldyBCU0QgbGljZW5zZS4gU2VlIExJQ0VOU0Ugb3I6XG4gKiBodHRwOi8vb3BlbnNvdXJjZS5vcmcvbGljZW5zZXMvQlNELTMtQ2xhdXNlXG4gKi9cblxuLyoqXG4gKiBUaGlzIGlzIGEgaGVscGVyIGZ1bmN0aW9uIGZvciBnZXR0aW5nIHZhbHVlcyBmcm9tIHBhcmFtZXRlci9vcHRpb25zXG4gKiBvYmplY3RzLlxuICpcbiAqIEBwYXJhbSBhcmdzIFRoZSBvYmplY3Qgd2UgYXJlIGV4dHJhY3RpbmcgdmFsdWVzIGZyb21cbiAqIEBwYXJhbSBuYW1lIFRoZSBuYW1lIG9mIHRoZSBwcm9wZXJ0eSB3ZSBhcmUgZ2V0dGluZy5cbiAqIEBwYXJhbSBkZWZhdWx0VmFsdWUgQW4gb3B0aW9uYWwgdmFsdWUgdG8gcmV0dXJuIGlmIHRoZSBwcm9wZXJ0eSBpcyBtaXNzaW5nXG4gKiBmcm9tIHRoZSBvYmplY3QuIElmIHRoaXMgaXMgbm90IHNwZWNpZmllZCBhbmQgdGhlIHByb3BlcnR5IGlzIG1pc3NpbmcsIGFuXG4gKiBlcnJvciB3aWxsIGJlIHRocm93bi5cbiAqL1xuZnVuY3Rpb24gZ2V0QXJnKGFBcmdzLCBhTmFtZSwgYURlZmF1bHRWYWx1ZSkge1xuICBpZiAoYU5hbWUgaW4gYUFyZ3MpIHtcbiAgICByZXR1cm4gYUFyZ3NbYU5hbWVdO1xuICB9IGVsc2UgaWYgKGFyZ3VtZW50cy5sZW5ndGggPT09IDMpIHtcbiAgICByZXR1cm4gYURlZmF1bHRWYWx1ZTtcbiAgfSBlbHNlIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoJ1wiJyArIGFOYW1lICsgJ1wiIGlzIGEgcmVxdWlyZWQgYXJndW1lbnQuJyk7XG4gIH1cbn1cbmV4cG9ydHMuZ2V0QXJnID0gZ2V0QXJnO1xuXG52YXIgdXJsUmVnZXhwID0gL14oPzooW1xcdytcXC0uXSspOik/XFwvXFwvKD86KFxcdys6XFx3KylAKT8oW1xcdy5dKikoPzo6KFxcZCspKT8oXFxTKikkLztcbnZhciBkYXRhVXJsUmVnZXhwID0gL15kYXRhOi4rXFwsLiskLztcblxuZnVuY3Rpb24gdXJsUGFyc2UoYVVybCkge1xuICB2YXIgbWF0Y2ggPSBhVXJsLm1hdGNoKHVybFJlZ2V4cCk7XG4gIGlmICghbWF0Y2gpIHtcbiAgICByZXR1cm4gbnVsbDtcbiAgfVxuICByZXR1cm4ge1xuICAgIHNjaGVtZTogbWF0Y2hbMV0sXG4gICAgYXV0aDogbWF0Y2hbMl0sXG4gICAgaG9zdDogbWF0Y2hbM10sXG4gICAgcG9ydDogbWF0Y2hbNF0sXG4gICAgcGF0aDogbWF0Y2hbNV1cbiAgfTtcbn1cbmV4cG9ydHMudXJsUGFyc2UgPSB1cmxQYXJzZTtcblxuZnVuY3Rpb24gdXJsR2VuZXJhdGUoYVBhcnNlZFVybCkge1xuICB2YXIgdXJsID0gJyc7XG4gIGlmIChhUGFyc2VkVXJsLnNjaGVtZSkge1xuICAgIHVybCArPSBhUGFyc2VkVXJsLnNjaGVtZSArICc6JztcbiAgfVxuICB1cmwgKz0gJy8vJztcbiAgaWYgKGFQYXJzZWRVcmwuYXV0aCkge1xuICAgIHVybCArPSBhUGFyc2VkVXJsLmF1dGggKyAnQCc7XG4gIH1cbiAgaWYgKGFQYXJzZWRVcmwuaG9zdCkge1xuICAgIHVybCArPSBhUGFyc2VkVXJsLmhvc3Q7XG4gIH1cbiAgaWYgKGFQYXJzZWRVcmwucG9ydCkge1xuICAgIHVybCArPSBcIjpcIiArIGFQYXJzZWRVcmwucG9ydFxuICB9XG4gIGlmIChhUGFyc2VkVXJsLnBhdGgpIHtcbiAgICB1cmwgKz0gYVBhcnNlZFVybC5wYXRoO1xuICB9XG4gIHJldHVybiB1cmw7XG59XG5leHBvcnRzLnVybEdlbmVyYXRlID0gdXJsR2VuZXJhdGU7XG5cbi8qKlxuICogTm9ybWFsaXplcyBhIHBhdGgsIG9yIHRoZSBwYXRoIHBvcnRpb24gb2YgYSBVUkw6XG4gKlxuICogLSBSZXBsYWNlcyBjb25zZWN1dGl2ZSBzbGFzaGVzIHdpdGggb25lIHNsYXNoLlxuICogLSBSZW1vdmVzIHVubmVjZXNzYXJ5ICcuJyBwYXJ0cy5cbiAqIC0gUmVtb3ZlcyB1bm5lY2Vzc2FyeSAnPGRpcj4vLi4nIHBhcnRzLlxuICpcbiAqIEJhc2VkIG9uIGNvZGUgaW4gdGhlIE5vZGUuanMgJ3BhdGgnIGNvcmUgbW9kdWxlLlxuICpcbiAqIEBwYXJhbSBhUGF0aCBUaGUgcGF0aCBvciB1cmwgdG8gbm9ybWFsaXplLlxuICovXG5mdW5jdGlvbiBub3JtYWxpemUoYVBhdGgpIHtcbiAgdmFyIHBhdGggPSBhUGF0aDtcbiAgdmFyIHVybCA9IHVybFBhcnNlKGFQYXRoKTtcbiAgaWYgKHVybCkge1xuICAgIGlmICghdXJsLnBhdGgpIHtcbiAgICAgIHJldHVybiBhUGF0aDtcbiAgICB9XG4gICAgcGF0aCA9IHVybC5wYXRoO1xuICB9XG4gIHZhciBpc0Fic29sdXRlID0gZXhwb3J0cy5pc0Fic29sdXRlKHBhdGgpO1xuXG4gIHZhciBwYXJ0cyA9IHBhdGguc3BsaXQoL1xcLysvKTtcbiAgZm9yICh2YXIgcGFydCwgdXAgPSAwLCBpID0gcGFydHMubGVuZ3RoIC0gMTsgaSA+PSAwOyBpLS0pIHtcbiAgICBwYXJ0ID0gcGFydHNbaV07XG4gICAgaWYgKHBhcnQgPT09ICcuJykge1xuICAgICAgcGFydHMuc3BsaWNlKGksIDEpO1xuICAgIH0gZWxzZSBpZiAocGFydCA9PT0gJy4uJykge1xuICAgICAgdXArKztcbiAgICB9IGVsc2UgaWYgKHVwID4gMCkge1xuICAgICAgaWYgKHBhcnQgPT09ICcnKSB7XG4gICAgICAgIC8vIFRoZSBmaXJzdCBwYXJ0IGlzIGJsYW5rIGlmIHRoZSBwYXRoIGlzIGFic29sdXRlLiBUcnlpbmcgdG8gZ29cbiAgICAgICAgLy8gYWJvdmUgdGhlIHJvb3QgaXMgYSBuby1vcC4gVGhlcmVmb3JlIHdlIGNhbiByZW1vdmUgYWxsICcuLicgcGFydHNcbiAgICAgICAgLy8gZGlyZWN0bHkgYWZ0ZXIgdGhlIHJvb3QuXG4gICAgICAgIHBhcnRzLnNwbGljZShpICsgMSwgdXApO1xuICAgICAgICB1cCA9IDA7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBwYXJ0cy5zcGxpY2UoaSwgMik7XG4gICAgICAgIHVwLS07XG4gICAgICB9XG4gICAgfVxuICB9XG4gIHBhdGggPSBwYXJ0cy5qb2luKCcvJyk7XG5cbiAgaWYgKHBhdGggPT09ICcnKSB7XG4gICAgcGF0aCA9IGlzQWJzb2x1dGUgPyAnLycgOiAnLic7XG4gIH1cblxuICBpZiAodXJsKSB7XG4gICAgdXJsLnBhdGggPSBwYXRoO1xuICAgIHJldHVybiB1cmxHZW5lcmF0ZSh1cmwpO1xuICB9XG4gIHJldHVybiBwYXRoO1xufVxuZXhwb3J0cy5ub3JtYWxpemUgPSBub3JtYWxpemU7XG5cbi8qKlxuICogSm9pbnMgdHdvIHBhdGhzL1VSTHMuXG4gKlxuICogQHBhcmFtIGFSb290IFRoZSByb290IHBhdGggb3IgVVJMLlxuICogQHBhcmFtIGFQYXRoIFRoZSBwYXRoIG9yIFVSTCB0byBiZSBqb2luZWQgd2l0aCB0aGUgcm9vdC5cbiAqXG4gKiAtIElmIGFQYXRoIGlzIGEgVVJMIG9yIGEgZGF0YSBVUkksIGFQYXRoIGlzIHJldHVybmVkLCB1bmxlc3MgYVBhdGggaXMgYVxuICogICBzY2hlbWUtcmVsYXRpdmUgVVJMOiBUaGVuIHRoZSBzY2hlbWUgb2YgYVJvb3QsIGlmIGFueSwgaXMgcHJlcGVuZGVkXG4gKiAgIGZpcnN0LlxuICogLSBPdGhlcndpc2UgYVBhdGggaXMgYSBwYXRoLiBJZiBhUm9vdCBpcyBhIFVSTCwgdGhlbiBpdHMgcGF0aCBwb3J0aW9uXG4gKiAgIGlzIHVwZGF0ZWQgd2l0aCB0aGUgcmVzdWx0IGFuZCBhUm9vdCBpcyByZXR1cm5lZC4gT3RoZXJ3aXNlIHRoZSByZXN1bHRcbiAqICAgaXMgcmV0dXJuZWQuXG4gKiAgIC0gSWYgYVBhdGggaXMgYWJzb2x1dGUsIHRoZSByZXN1bHQgaXMgYVBhdGguXG4gKiAgIC0gT3RoZXJ3aXNlIHRoZSB0d28gcGF0aHMgYXJlIGpvaW5lZCB3aXRoIGEgc2xhc2guXG4gKiAtIEpvaW5pbmcgZm9yIGV4YW1wbGUgJ2h0dHA6Ly8nIGFuZCAnd3d3LmV4YW1wbGUuY29tJyBpcyBhbHNvIHN1cHBvcnRlZC5cbiAqL1xuZnVuY3Rpb24gam9pbihhUm9vdCwgYVBhdGgpIHtcbiAgaWYgKGFSb290ID09PSBcIlwiKSB7XG4gICAgYVJvb3QgPSBcIi5cIjtcbiAgfVxuICBpZiAoYVBhdGggPT09IFwiXCIpIHtcbiAgICBhUGF0aCA9IFwiLlwiO1xuICB9XG4gIHZhciBhUGF0aFVybCA9IHVybFBhcnNlKGFQYXRoKTtcbiAgdmFyIGFSb290VXJsID0gdXJsUGFyc2UoYVJvb3QpO1xuICBpZiAoYVJvb3RVcmwpIHtcbiAgICBhUm9vdCA9IGFSb290VXJsLnBhdGggfHwgJy8nO1xuICB9XG5cbiAgLy8gYGpvaW4oZm9vLCAnLy93d3cuZXhhbXBsZS5vcmcnKWBcbiAgaWYgKGFQYXRoVXJsICYmICFhUGF0aFVybC5zY2hlbWUpIHtcbiAgICBpZiAoYVJvb3RVcmwpIHtcbiAgICAgIGFQYXRoVXJsLnNjaGVtZSA9IGFSb290VXJsLnNjaGVtZTtcbiAgICB9XG4gICAgcmV0dXJuIHVybEdlbmVyYXRlKGFQYXRoVXJsKTtcbiAgfVxuXG4gIGlmIChhUGF0aFVybCB8fCBhUGF0aC5tYXRjaChkYXRhVXJsUmVnZXhwKSkge1xuICAgIHJldHVybiBhUGF0aDtcbiAgfVxuXG4gIC8vIGBqb2luKCdodHRwOi8vJywgJ3d3dy5leGFtcGxlLmNvbScpYFxuICBpZiAoYVJvb3RVcmwgJiYgIWFSb290VXJsLmhvc3QgJiYgIWFSb290VXJsLnBhdGgpIHtcbiAgICBhUm9vdFVybC5ob3N0ID0gYVBhdGg7XG4gICAgcmV0dXJuIHVybEdlbmVyYXRlKGFSb290VXJsKTtcbiAgfVxuXG4gIHZhciBqb2luZWQgPSBhUGF0aC5jaGFyQXQoMCkgPT09ICcvJ1xuICAgID8gYVBhdGhcbiAgICA6IG5vcm1hbGl6ZShhUm9vdC5yZXBsYWNlKC9cXC8rJC8sICcnKSArICcvJyArIGFQYXRoKTtcblxuICBpZiAoYVJvb3RVcmwpIHtcbiAgICBhUm9vdFVybC5wYXRoID0gam9pbmVkO1xuICAgIHJldHVybiB1cmxHZW5lcmF0ZShhUm9vdFVybCk7XG4gIH1cbiAgcmV0dXJuIGpvaW5lZDtcbn1cbmV4cG9ydHMuam9pbiA9IGpvaW47XG5cbmV4cG9ydHMuaXNBYnNvbHV0ZSA9IGZ1bmN0aW9uIChhUGF0aCkge1xuICByZXR1cm4gYVBhdGguY2hhckF0KDApID09PSAnLycgfHwgISFhUGF0aC5tYXRjaCh1cmxSZWdleHApO1xufTtcblxuLyoqXG4gKiBNYWtlIGEgcGF0aCByZWxhdGl2ZSB0byBhIFVSTCBvciBhbm90aGVyIHBhdGguXG4gKlxuICogQHBhcmFtIGFSb290IFRoZSByb290IHBhdGggb3IgVVJMLlxuICogQHBhcmFtIGFQYXRoIFRoZSBwYXRoIG9yIFVSTCB0byBiZSBtYWRlIHJlbGF0aXZlIHRvIGFSb290LlxuICovXG5mdW5jdGlvbiByZWxhdGl2ZShhUm9vdCwgYVBhdGgpIHtcbiAgaWYgKGFSb290ID09PSBcIlwiKSB7XG4gICAgYVJvb3QgPSBcIi5cIjtcbiAgfVxuXG4gIGFSb290ID0gYVJvb3QucmVwbGFjZSgvXFwvJC8sICcnKTtcblxuICAvLyBJdCBpcyBwb3NzaWJsZSBmb3IgdGhlIHBhdGggdG8gYmUgYWJvdmUgdGhlIHJvb3QuIEluIHRoaXMgY2FzZSwgc2ltcGx5XG4gIC8vIGNoZWNraW5nIHdoZXRoZXIgdGhlIHJvb3QgaXMgYSBwcmVmaXggb2YgdGhlIHBhdGggd29uJ3Qgd29yay4gSW5zdGVhZCwgd2VcbiAgLy8gbmVlZCB0byByZW1vdmUgY29tcG9uZW50cyBmcm9tIHRoZSByb290IG9uZSBieSBvbmUsIHVudGlsIGVpdGhlciB3ZSBmaW5kXG4gIC8vIGEgcHJlZml4IHRoYXQgZml0cywgb3Igd2UgcnVuIG91dCBvZiBjb21wb25lbnRzIHRvIHJlbW92ZS5cbiAgdmFyIGxldmVsID0gMDtcbiAgd2hpbGUgKGFQYXRoLmluZGV4T2YoYVJvb3QgKyAnLycpICE9PSAwKSB7XG4gICAgdmFyIGluZGV4ID0gYVJvb3QubGFzdEluZGV4T2YoXCIvXCIpO1xuICAgIGlmIChpbmRleCA8IDApIHtcbiAgICAgIHJldHVybiBhUGF0aDtcbiAgICB9XG5cbiAgICAvLyBJZiB0aGUgb25seSBwYXJ0IG9mIHRoZSByb290IHRoYXQgaXMgbGVmdCBpcyB0aGUgc2NoZW1lIChpLmUuIGh0dHA6Ly8sXG4gICAgLy8gZmlsZTovLy8sIGV0Yy4pLCBvbmUgb3IgbW9yZSBzbGFzaGVzICgvKSwgb3Igc2ltcGx5IG5vdGhpbmcgYXQgYWxsLCB3ZVxuICAgIC8vIGhhdmUgZXhoYXVzdGVkIGFsbCBjb21wb25lbnRzLCBzbyB0aGUgcGF0aCBpcyBub3QgcmVsYXRpdmUgdG8gdGhlIHJvb3QuXG4gICAgYVJvb3QgPSBhUm9vdC5zbGljZSgwLCBpbmRleCk7XG4gICAgaWYgKGFSb290Lm1hdGNoKC9eKFteXFwvXSs6XFwvKT9cXC8qJC8pKSB7XG4gICAgICByZXR1cm4gYVBhdGg7XG4gICAgfVxuXG4gICAgKytsZXZlbDtcbiAgfVxuXG4gIC8vIE1ha2Ugc3VyZSB3ZSBhZGQgYSBcIi4uL1wiIGZvciBlYWNoIGNvbXBvbmVudCB3ZSByZW1vdmVkIGZyb20gdGhlIHJvb3QuXG4gIHJldHVybiBBcnJheShsZXZlbCArIDEpLmpvaW4oXCIuLi9cIikgKyBhUGF0aC5zdWJzdHIoYVJvb3QubGVuZ3RoICsgMSk7XG59XG5leHBvcnRzLnJlbGF0aXZlID0gcmVsYXRpdmU7XG5cbnZhciBzdXBwb3J0c051bGxQcm90byA9IChmdW5jdGlvbiAoKSB7XG4gIHZhciBvYmogPSBPYmplY3QuY3JlYXRlKG51bGwpO1xuICByZXR1cm4gISgnX19wcm90b19fJyBpbiBvYmopO1xufSgpKTtcblxuZnVuY3Rpb24gaWRlbnRpdHkgKHMpIHtcbiAgcmV0dXJuIHM7XG59XG5cbi8qKlxuICogQmVjYXVzZSBiZWhhdmlvciBnb2VzIHdhY2t5IHdoZW4geW91IHNldCBgX19wcm90b19fYCBvbiBvYmplY3RzLCB3ZVxuICogaGF2ZSB0byBwcmVmaXggYWxsIHRoZSBzdHJpbmdzIGluIG91ciBzZXQgd2l0aCBhbiBhcmJpdHJhcnkgY2hhcmFjdGVyLlxuICpcbiAqIFNlZSBodHRwczovL2dpdGh1Yi5jb20vbW96aWxsYS9zb3VyY2UtbWFwL3B1bGwvMzEgYW5kXG4gKiBodHRwczovL2dpdGh1Yi5jb20vbW96aWxsYS9zb3VyY2UtbWFwL2lzc3Vlcy8zMFxuICpcbiAqIEBwYXJhbSBTdHJpbmcgYVN0clxuICovXG5mdW5jdGlvbiB0b1NldFN0cmluZyhhU3RyKSB7XG4gIGlmIChpc1Byb3RvU3RyaW5nKGFTdHIpKSB7XG4gICAgcmV0dXJuICckJyArIGFTdHI7XG4gIH1cblxuICByZXR1cm4gYVN0cjtcbn1cbmV4cG9ydHMudG9TZXRTdHJpbmcgPSBzdXBwb3J0c051bGxQcm90byA/IGlkZW50aXR5IDogdG9TZXRTdHJpbmc7XG5cbmZ1bmN0aW9uIGZyb21TZXRTdHJpbmcoYVN0cikge1xuICBpZiAoaXNQcm90b1N0cmluZyhhU3RyKSkge1xuICAgIHJldHVybiBhU3RyLnNsaWNlKDEpO1xuICB9XG5cbiAgcmV0dXJuIGFTdHI7XG59XG5leHBvcnRzLmZyb21TZXRTdHJpbmcgPSBzdXBwb3J0c051bGxQcm90byA/IGlkZW50aXR5IDogZnJvbVNldFN0cmluZztcblxuZnVuY3Rpb24gaXNQcm90b1N0cmluZyhzKSB7XG4gIGlmICghcykge1xuICAgIHJldHVybiBmYWxzZTtcbiAgfVxuXG4gIHZhciBsZW5ndGggPSBzLmxlbmd0aDtcblxuICBpZiAobGVuZ3RoIDwgOSAvKiBcIl9fcHJvdG9fX1wiLmxlbmd0aCAqLykge1xuICAgIHJldHVybiBmYWxzZTtcbiAgfVxuXG4gIGlmIChzLmNoYXJDb2RlQXQobGVuZ3RoIC0gMSkgIT09IDk1ICAvKiAnXycgKi8gfHxcbiAgICAgIHMuY2hhckNvZGVBdChsZW5ndGggLSAyKSAhPT0gOTUgIC8qICdfJyAqLyB8fFxuICAgICAgcy5jaGFyQ29kZUF0KGxlbmd0aCAtIDMpICE9PSAxMTEgLyogJ28nICovIHx8XG4gICAgICBzLmNoYXJDb2RlQXQobGVuZ3RoIC0gNCkgIT09IDExNiAvKiAndCcgKi8gfHxcbiAgICAgIHMuY2hhckNvZGVBdChsZW5ndGggLSA1KSAhPT0gMTExIC8qICdvJyAqLyB8fFxuICAgICAgcy5jaGFyQ29kZUF0KGxlbmd0aCAtIDYpICE9PSAxMTQgLyogJ3InICovIHx8XG4gICAgICBzLmNoYXJDb2RlQXQobGVuZ3RoIC0gNykgIT09IDExMiAvKiAncCcgKi8gfHxcbiAgICAgIHMuY2hhckNvZGVBdChsZW5ndGggLSA4KSAhPT0gOTUgIC8qICdfJyAqLyB8fFxuICAgICAgcy5jaGFyQ29kZUF0KGxlbmd0aCAtIDkpICE9PSA5NSAgLyogJ18nICovKSB7XG4gICAgcmV0dXJuIGZhbHNlO1xuICB9XG5cbiAgZm9yICh2YXIgaSA9IGxlbmd0aCAtIDEwOyBpID49IDA7IGktLSkge1xuICAgIGlmIChzLmNoYXJDb2RlQXQoaSkgIT09IDM2IC8qICckJyAqLykge1xuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cbiAgfVxuXG4gIHJldHVybiB0cnVlO1xufVxuXG4vKipcbiAqIENvbXBhcmF0b3IgYmV0d2VlbiB0d28gbWFwcGluZ3Mgd2hlcmUgdGhlIG9yaWdpbmFsIHBvc2l0aW9ucyBhcmUgY29tcGFyZWQuXG4gKlxuICogT3B0aW9uYWxseSBwYXNzIGluIGB0cnVlYCBhcyBgb25seUNvbXBhcmVHZW5lcmF0ZWRgIHRvIGNvbnNpZGVyIHR3b1xuICogbWFwcGluZ3Mgd2l0aCB0aGUgc2FtZSBvcmlnaW5hbCBzb3VyY2UvbGluZS9jb2x1bW4sIGJ1dCBkaWZmZXJlbnQgZ2VuZXJhdGVkXG4gKiBsaW5lIGFuZCBjb2x1bW4gdGhlIHNhbWUuIFVzZWZ1bCB3aGVuIHNlYXJjaGluZyBmb3IgYSBtYXBwaW5nIHdpdGggYVxuICogc3R1YmJlZCBvdXQgbWFwcGluZy5cbiAqL1xuZnVuY3Rpb24gY29tcGFyZUJ5T3JpZ2luYWxQb3NpdGlvbnMobWFwcGluZ0EsIG1hcHBpbmdCLCBvbmx5Q29tcGFyZU9yaWdpbmFsKSB7XG4gIHZhciBjbXAgPSBtYXBwaW5nQS5zb3VyY2UgLSBtYXBwaW5nQi5zb3VyY2U7XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgY21wID0gbWFwcGluZ0Eub3JpZ2luYWxMaW5lIC0gbWFwcGluZ0Iub3JpZ2luYWxMaW5lO1xuICBpZiAoY21wICE9PSAwKSB7XG4gICAgcmV0dXJuIGNtcDtcbiAgfVxuXG4gIGNtcCA9IG1hcHBpbmdBLm9yaWdpbmFsQ29sdW1uIC0gbWFwcGluZ0Iub3JpZ2luYWxDb2x1bW47XG4gIGlmIChjbXAgIT09IDAgfHwgb25seUNvbXBhcmVPcmlnaW5hbCkge1xuICAgIHJldHVybiBjbXA7XG4gIH1cblxuICBjbXAgPSBtYXBwaW5nQS5nZW5lcmF0ZWRDb2x1bW4gLSBtYXBwaW5nQi5nZW5lcmF0ZWRDb2x1bW47XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgY21wID0gbWFwcGluZ0EuZ2VuZXJhdGVkTGluZSAtIG1hcHBpbmdCLmdlbmVyYXRlZExpbmU7XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgcmV0dXJuIG1hcHBpbmdBLm5hbWUgLSBtYXBwaW5nQi5uYW1lO1xufVxuZXhwb3J0cy5jb21wYXJlQnlPcmlnaW5hbFBvc2l0aW9ucyA9IGNvbXBhcmVCeU9yaWdpbmFsUG9zaXRpb25zO1xuXG4vKipcbiAqIENvbXBhcmF0b3IgYmV0d2VlbiB0d28gbWFwcGluZ3Mgd2l0aCBkZWZsYXRlZCBzb3VyY2UgYW5kIG5hbWUgaW5kaWNlcyB3aGVyZVxuICogdGhlIGdlbmVyYXRlZCBwb3NpdGlvbnMgYXJlIGNvbXBhcmVkLlxuICpcbiAqIE9wdGlvbmFsbHkgcGFzcyBpbiBgdHJ1ZWAgYXMgYG9ubHlDb21wYXJlR2VuZXJhdGVkYCB0byBjb25zaWRlciB0d29cbiAqIG1hcHBpbmdzIHdpdGggdGhlIHNhbWUgZ2VuZXJhdGVkIGxpbmUgYW5kIGNvbHVtbiwgYnV0IGRpZmZlcmVudFxuICogc291cmNlL25hbWUvb3JpZ2luYWwgbGluZSBhbmQgY29sdW1uIHRoZSBzYW1lLiBVc2VmdWwgd2hlbiBzZWFyY2hpbmcgZm9yIGFcbiAqIG1hcHBpbmcgd2l0aCBhIHN0dWJiZWQgb3V0IG1hcHBpbmcuXG4gKi9cbmZ1bmN0aW9uIGNvbXBhcmVCeUdlbmVyYXRlZFBvc2l0aW9uc0RlZmxhdGVkKG1hcHBpbmdBLCBtYXBwaW5nQiwgb25seUNvbXBhcmVHZW5lcmF0ZWQpIHtcbiAgdmFyIGNtcCA9IG1hcHBpbmdBLmdlbmVyYXRlZExpbmUgLSBtYXBwaW5nQi5nZW5lcmF0ZWRMaW5lO1xuICBpZiAoY21wICE9PSAwKSB7XG4gICAgcmV0dXJuIGNtcDtcbiAgfVxuXG4gIGNtcCA9IG1hcHBpbmdBLmdlbmVyYXRlZENvbHVtbiAtIG1hcHBpbmdCLmdlbmVyYXRlZENvbHVtbjtcbiAgaWYgKGNtcCAhPT0gMCB8fCBvbmx5Q29tcGFyZUdlbmVyYXRlZCkge1xuICAgIHJldHVybiBjbXA7XG4gIH1cblxuICBjbXAgPSBtYXBwaW5nQS5zb3VyY2UgLSBtYXBwaW5nQi5zb3VyY2U7XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgY21wID0gbWFwcGluZ0Eub3JpZ2luYWxMaW5lIC0gbWFwcGluZ0Iub3JpZ2luYWxMaW5lO1xuICBpZiAoY21wICE9PSAwKSB7XG4gICAgcmV0dXJuIGNtcDtcbiAgfVxuXG4gIGNtcCA9IG1hcHBpbmdBLm9yaWdpbmFsQ29sdW1uIC0gbWFwcGluZ0Iub3JpZ2luYWxDb2x1bW47XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgcmV0dXJuIG1hcHBpbmdBLm5hbWUgLSBtYXBwaW5nQi5uYW1lO1xufVxuZXhwb3J0cy5jb21wYXJlQnlHZW5lcmF0ZWRQb3NpdGlvbnNEZWZsYXRlZCA9IGNvbXBhcmVCeUdlbmVyYXRlZFBvc2l0aW9uc0RlZmxhdGVkO1xuXG5mdW5jdGlvbiBzdHJjbXAoYVN0cjEsIGFTdHIyKSB7XG4gIGlmIChhU3RyMSA9PT0gYVN0cjIpIHtcbiAgICByZXR1cm4gMDtcbiAgfVxuXG4gIGlmIChhU3RyMSA+IGFTdHIyKSB7XG4gICAgcmV0dXJuIDE7XG4gIH1cblxuICByZXR1cm4gLTE7XG59XG5cbi8qKlxuICogQ29tcGFyYXRvciBiZXR3ZWVuIHR3byBtYXBwaW5ncyB3aXRoIGluZmxhdGVkIHNvdXJjZSBhbmQgbmFtZSBzdHJpbmdzIHdoZXJlXG4gKiB0aGUgZ2VuZXJhdGVkIHBvc2l0aW9ucyBhcmUgY29tcGFyZWQuXG4gKi9cbmZ1bmN0aW9uIGNvbXBhcmVCeUdlbmVyYXRlZFBvc2l0aW9uc0luZmxhdGVkKG1hcHBpbmdBLCBtYXBwaW5nQikge1xuICB2YXIgY21wID0gbWFwcGluZ0EuZ2VuZXJhdGVkTGluZSAtIG1hcHBpbmdCLmdlbmVyYXRlZExpbmU7XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgY21wID0gbWFwcGluZ0EuZ2VuZXJhdGVkQ29sdW1uIC0gbWFwcGluZ0IuZ2VuZXJhdGVkQ29sdW1uO1xuICBpZiAoY21wICE9PSAwKSB7XG4gICAgcmV0dXJuIGNtcDtcbiAgfVxuXG4gIGNtcCA9IHN0cmNtcChtYXBwaW5nQS5zb3VyY2UsIG1hcHBpbmdCLnNvdXJjZSk7XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgY21wID0gbWFwcGluZ0Eub3JpZ2luYWxMaW5lIC0gbWFwcGluZ0Iub3JpZ2luYWxMaW5lO1xuICBpZiAoY21wICE9PSAwKSB7XG4gICAgcmV0dXJuIGNtcDtcbiAgfVxuXG4gIGNtcCA9IG1hcHBpbmdBLm9yaWdpbmFsQ29sdW1uIC0gbWFwcGluZ0Iub3JpZ2luYWxDb2x1bW47XG4gIGlmIChjbXAgIT09IDApIHtcbiAgICByZXR1cm4gY21wO1xuICB9XG5cbiAgcmV0dXJuIHN0cmNtcChtYXBwaW5nQS5uYW1lLCBtYXBwaW5nQi5uYW1lKTtcbn1cbmV4cG9ydHMuY29tcGFyZUJ5R2VuZXJhdGVkUG9zaXRpb25zSW5mbGF0ZWQgPSBjb21wYXJlQnlHZW5lcmF0ZWRQb3NpdGlvbnNJbmZsYXRlZDtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbGliL3V0aWwuanNcbi8vIG1vZHVsZSBpZCA9IDRcbi8vIG1vZHVsZSBjaHVua3MgPSAwIiwiLyogLSotIE1vZGU6IGpzOyBqcy1pbmRlbnQtbGV2ZWw6IDI7IC0qLSAqL1xuLypcbiAqIENvcHlyaWdodCAyMDExIE1vemlsbGEgRm91bmRhdGlvbiBhbmQgY29udHJpYnV0b3JzXG4gKiBMaWNlbnNlZCB1bmRlciB0aGUgTmV3IEJTRCBsaWNlbnNlLiBTZWUgTElDRU5TRSBvcjpcbiAqIGh0dHA6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMy1DbGF1c2VcbiAqL1xuXG52YXIgdXRpbCA9IHJlcXVpcmUoJy4vdXRpbCcpO1xudmFyIGhhcyA9IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHk7XG52YXIgaGFzTmF0aXZlTWFwID0gdHlwZW9mIE1hcCAhPT0gXCJ1bmRlZmluZWRcIjtcblxuLyoqXG4gKiBBIGRhdGEgc3RydWN0dXJlIHdoaWNoIGlzIGEgY29tYmluYXRpb24gb2YgYW4gYXJyYXkgYW5kIGEgc2V0LiBBZGRpbmcgYSBuZXdcbiAqIG1lbWJlciBpcyBPKDEpLCB0ZXN0aW5nIGZvciBtZW1iZXJzaGlwIGlzIE8oMSksIGFuZCBmaW5kaW5nIHRoZSBpbmRleCBvZiBhblxuICogZWxlbWVudCBpcyBPKDEpLiBSZW1vdmluZyBlbGVtZW50cyBmcm9tIHRoZSBzZXQgaXMgbm90IHN1cHBvcnRlZC4gT25seVxuICogc3RyaW5ncyBhcmUgc3VwcG9ydGVkIGZvciBtZW1iZXJzaGlwLlxuICovXG5mdW5jdGlvbiBBcnJheVNldCgpIHtcbiAgdGhpcy5fYXJyYXkgPSBbXTtcbiAgdGhpcy5fc2V0ID0gaGFzTmF0aXZlTWFwID8gbmV3IE1hcCgpIDogT2JqZWN0LmNyZWF0ZShudWxsKTtcbn1cblxuLyoqXG4gKiBTdGF0aWMgbWV0aG9kIGZvciBjcmVhdGluZyBBcnJheVNldCBpbnN0YW5jZXMgZnJvbSBhbiBleGlzdGluZyBhcnJheS5cbiAqL1xuQXJyYXlTZXQuZnJvbUFycmF5ID0gZnVuY3Rpb24gQXJyYXlTZXRfZnJvbUFycmF5KGFBcnJheSwgYUFsbG93RHVwbGljYXRlcykge1xuICB2YXIgc2V0ID0gbmV3IEFycmF5U2V0KCk7XG4gIGZvciAodmFyIGkgPSAwLCBsZW4gPSBhQXJyYXkubGVuZ3RoOyBpIDwgbGVuOyBpKyspIHtcbiAgICBzZXQuYWRkKGFBcnJheVtpXSwgYUFsbG93RHVwbGljYXRlcyk7XG4gIH1cbiAgcmV0dXJuIHNldDtcbn07XG5cbi8qKlxuICogUmV0dXJuIGhvdyBtYW55IHVuaXF1ZSBpdGVtcyBhcmUgaW4gdGhpcyBBcnJheVNldC4gSWYgZHVwbGljYXRlcyBoYXZlIGJlZW5cbiAqIGFkZGVkLCB0aGFuIHRob3NlIGRvIG5vdCBjb3VudCB0b3dhcmRzIHRoZSBzaXplLlxuICpcbiAqIEByZXR1cm5zIE51bWJlclxuICovXG5BcnJheVNldC5wcm90b3R5cGUuc2l6ZSA9IGZ1bmN0aW9uIEFycmF5U2V0X3NpemUoKSB7XG4gIHJldHVybiBoYXNOYXRpdmVNYXAgPyB0aGlzLl9zZXQuc2l6ZSA6IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzKHRoaXMuX3NldCkubGVuZ3RoO1xufTtcblxuLyoqXG4gKiBBZGQgdGhlIGdpdmVuIHN0cmluZyB0byB0aGlzIHNldC5cbiAqXG4gKiBAcGFyYW0gU3RyaW5nIGFTdHJcbiAqL1xuQXJyYXlTZXQucHJvdG90eXBlLmFkZCA9IGZ1bmN0aW9uIEFycmF5U2V0X2FkZChhU3RyLCBhQWxsb3dEdXBsaWNhdGVzKSB7XG4gIHZhciBzU3RyID0gaGFzTmF0aXZlTWFwID8gYVN0ciA6IHV0aWwudG9TZXRTdHJpbmcoYVN0cik7XG4gIHZhciBpc0R1cGxpY2F0ZSA9IGhhc05hdGl2ZU1hcCA/IHRoaXMuaGFzKGFTdHIpIDogaGFzLmNhbGwodGhpcy5fc2V0LCBzU3RyKTtcbiAgdmFyIGlkeCA9IHRoaXMuX2FycmF5Lmxlbmd0aDtcbiAgaWYgKCFpc0R1cGxpY2F0ZSB8fCBhQWxsb3dEdXBsaWNhdGVzKSB7XG4gICAgdGhpcy5fYXJyYXkucHVzaChhU3RyKTtcbiAgfVxuICBpZiAoIWlzRHVwbGljYXRlKSB7XG4gICAgaWYgKGhhc05hdGl2ZU1hcCkge1xuICAgICAgdGhpcy5fc2V0LnNldChhU3RyLCBpZHgpO1xuICAgIH0gZWxzZSB7XG4gICAgICB0aGlzLl9zZXRbc1N0cl0gPSBpZHg7XG4gICAgfVxuICB9XG59O1xuXG4vKipcbiAqIElzIHRoZSBnaXZlbiBzdHJpbmcgYSBtZW1iZXIgb2YgdGhpcyBzZXQ/XG4gKlxuICogQHBhcmFtIFN0cmluZyBhU3RyXG4gKi9cbkFycmF5U2V0LnByb3RvdHlwZS5oYXMgPSBmdW5jdGlvbiBBcnJheVNldF9oYXMoYVN0cikge1xuICBpZiAoaGFzTmF0aXZlTWFwKSB7XG4gICAgcmV0dXJuIHRoaXMuX3NldC5oYXMoYVN0cik7XG4gIH0gZWxzZSB7XG4gICAgdmFyIHNTdHIgPSB1dGlsLnRvU2V0U3RyaW5nKGFTdHIpO1xuICAgIHJldHVybiBoYXMuY2FsbCh0aGlzLl9zZXQsIHNTdHIpO1xuICB9XG59O1xuXG4vKipcbiAqIFdoYXQgaXMgdGhlIGluZGV4IG9mIHRoZSBnaXZlbiBzdHJpbmcgaW4gdGhlIGFycmF5P1xuICpcbiAqIEBwYXJhbSBTdHJpbmcgYVN0clxuICovXG5BcnJheVNldC5wcm90b3R5cGUuaW5kZXhPZiA9IGZ1bmN0aW9uIEFycmF5U2V0X2luZGV4T2YoYVN0cikge1xuICBpZiAoaGFzTmF0aXZlTWFwKSB7XG4gICAgdmFyIGlkeCA9IHRoaXMuX3NldC5nZXQoYVN0cik7XG4gICAgaWYgKGlkeCA+PSAwKSB7XG4gICAgICAgIHJldHVybiBpZHg7XG4gICAgfVxuICB9IGVsc2Uge1xuICAgIHZhciBzU3RyID0gdXRpbC50b1NldFN0cmluZyhhU3RyKTtcbiAgICBpZiAoaGFzLmNhbGwodGhpcy5fc2V0LCBzU3RyKSkge1xuICAgICAgcmV0dXJuIHRoaXMuX3NldFtzU3RyXTtcbiAgICB9XG4gIH1cblxuICB0aHJvdyBuZXcgRXJyb3IoJ1wiJyArIGFTdHIgKyAnXCIgaXMgbm90IGluIHRoZSBzZXQuJyk7XG59O1xuXG4vKipcbiAqIFdoYXQgaXMgdGhlIGVsZW1lbnQgYXQgdGhlIGdpdmVuIGluZGV4P1xuICpcbiAqIEBwYXJhbSBOdW1iZXIgYUlkeFxuICovXG5BcnJheVNldC5wcm90b3R5cGUuYXQgPSBmdW5jdGlvbiBBcnJheVNldF9hdChhSWR4KSB7XG4gIGlmIChhSWR4ID49IDAgJiYgYUlkeCA8IHRoaXMuX2FycmF5Lmxlbmd0aCkge1xuICAgIHJldHVybiB0aGlzLl9hcnJheVthSWR4XTtcbiAgfVxuICB0aHJvdyBuZXcgRXJyb3IoJ05vIGVsZW1lbnQgaW5kZXhlZCBieSAnICsgYUlkeCk7XG59O1xuXG4vKipcbiAqIFJldHVybnMgdGhlIGFycmF5IHJlcHJlc2VudGF0aW9uIG9mIHRoaXMgc2V0ICh3aGljaCBoYXMgdGhlIHByb3BlciBpbmRpY2VzXG4gKiBpbmRpY2F0ZWQgYnkgaW5kZXhPZikuIE5vdGUgdGhhdCB0aGlzIGlzIGEgY29weSBvZiB0aGUgaW50ZXJuYWwgYXJyYXkgdXNlZFxuICogZm9yIHN0b3JpbmcgdGhlIG1lbWJlcnMgc28gdGhhdCBubyBvbmUgY2FuIG1lc3Mgd2l0aCBpbnRlcm5hbCBzdGF0ZS5cbiAqL1xuQXJyYXlTZXQucHJvdG90eXBlLnRvQXJyYXkgPSBmdW5jdGlvbiBBcnJheVNldF90b0FycmF5KCkge1xuICByZXR1cm4gdGhpcy5fYXJyYXkuc2xpY2UoKTtcbn07XG5cbmV4cG9ydHMuQXJyYXlTZXQgPSBBcnJheVNldDtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbGliL2FycmF5LXNldC5qc1xuLy8gbW9kdWxlIGlkID0gNVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiLCIvKiAtKi0gTW9kZToganM7IGpzLWluZGVudC1sZXZlbDogMjsgLSotICovXG4vKlxuICogQ29weXJpZ2h0IDIwMTQgTW96aWxsYSBGb3VuZGF0aW9uIGFuZCBjb250cmlidXRvcnNcbiAqIExpY2Vuc2VkIHVuZGVyIHRoZSBOZXcgQlNEIGxpY2Vuc2UuIFNlZSBMSUNFTlNFIG9yOlxuICogaHR0cDovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0zLUNsYXVzZVxuICovXG5cbnZhciB1dGlsID0gcmVxdWlyZSgnLi91dGlsJyk7XG5cbi8qKlxuICogRGV0ZXJtaW5lIHdoZXRoZXIgbWFwcGluZ0IgaXMgYWZ0ZXIgbWFwcGluZ0Egd2l0aCByZXNwZWN0IHRvIGdlbmVyYXRlZFxuICogcG9zaXRpb24uXG4gKi9cbmZ1bmN0aW9uIGdlbmVyYXRlZFBvc2l0aW9uQWZ0ZXIobWFwcGluZ0EsIG1hcHBpbmdCKSB7XG4gIC8vIE9wdGltaXplZCBmb3IgbW9zdCBjb21tb24gY2FzZVxuICB2YXIgbGluZUEgPSBtYXBwaW5nQS5nZW5lcmF0ZWRMaW5lO1xuICB2YXIgbGluZUIgPSBtYXBwaW5nQi5nZW5lcmF0ZWRMaW5lO1xuICB2YXIgY29sdW1uQSA9IG1hcHBpbmdBLmdlbmVyYXRlZENvbHVtbjtcbiAgdmFyIGNvbHVtbkIgPSBtYXBwaW5nQi5nZW5lcmF0ZWRDb2x1bW47XG4gIHJldHVybiBsaW5lQiA+IGxpbmVBIHx8IGxpbmVCID09IGxpbmVBICYmIGNvbHVtbkIgPj0gY29sdW1uQSB8fFxuICAgICAgICAgdXRpbC5jb21wYXJlQnlHZW5lcmF0ZWRQb3NpdGlvbnNJbmZsYXRlZChtYXBwaW5nQSwgbWFwcGluZ0IpIDw9IDA7XG59XG5cbi8qKlxuICogQSBkYXRhIHN0cnVjdHVyZSB0byBwcm92aWRlIGEgc29ydGVkIHZpZXcgb2YgYWNjdW11bGF0ZWQgbWFwcGluZ3MgaW4gYVxuICogcGVyZm9ybWFuY2UgY29uc2Npb3VzIG1hbm5lci4gSXQgdHJhZGVzIGEgbmVnbGliYWJsZSBvdmVyaGVhZCBpbiBnZW5lcmFsXG4gKiBjYXNlIGZvciBhIGxhcmdlIHNwZWVkdXAgaW4gY2FzZSBvZiBtYXBwaW5ncyBiZWluZyBhZGRlZCBpbiBvcmRlci5cbiAqL1xuZnVuY3Rpb24gTWFwcGluZ0xpc3QoKSB7XG4gIHRoaXMuX2FycmF5ID0gW107XG4gIHRoaXMuX3NvcnRlZCA9IHRydWU7XG4gIC8vIFNlcnZlcyBhcyBpbmZpbXVtXG4gIHRoaXMuX2xhc3QgPSB7Z2VuZXJhdGVkTGluZTogLTEsIGdlbmVyYXRlZENvbHVtbjogMH07XG59XG5cbi8qKlxuICogSXRlcmF0ZSB0aHJvdWdoIGludGVybmFsIGl0ZW1zLiBUaGlzIG1ldGhvZCB0YWtlcyB0aGUgc2FtZSBhcmd1bWVudHMgdGhhdFxuICogYEFycmF5LnByb3RvdHlwZS5mb3JFYWNoYCB0YWtlcy5cbiAqXG4gKiBOT1RFOiBUaGUgb3JkZXIgb2YgdGhlIG1hcHBpbmdzIGlzIE5PVCBndWFyYW50ZWVkLlxuICovXG5NYXBwaW5nTGlzdC5wcm90b3R5cGUudW5zb3J0ZWRGb3JFYWNoID1cbiAgZnVuY3Rpb24gTWFwcGluZ0xpc3RfZm9yRWFjaChhQ2FsbGJhY2ssIGFUaGlzQXJnKSB7XG4gICAgdGhpcy5fYXJyYXkuZm9yRWFjaChhQ2FsbGJhY2ssIGFUaGlzQXJnKTtcbiAgfTtcblxuLyoqXG4gKiBBZGQgdGhlIGdpdmVuIHNvdXJjZSBtYXBwaW5nLlxuICpcbiAqIEBwYXJhbSBPYmplY3QgYU1hcHBpbmdcbiAqL1xuTWFwcGluZ0xpc3QucHJvdG90eXBlLmFkZCA9IGZ1bmN0aW9uIE1hcHBpbmdMaXN0X2FkZChhTWFwcGluZykge1xuICBpZiAoZ2VuZXJhdGVkUG9zaXRpb25BZnRlcih0aGlzLl9sYXN0LCBhTWFwcGluZykpIHtcbiAgICB0aGlzLl9sYXN0ID0gYU1hcHBpbmc7XG4gICAgdGhpcy5fYXJyYXkucHVzaChhTWFwcGluZyk7XG4gIH0gZWxzZSB7XG4gICAgdGhpcy5fc29ydGVkID0gZmFsc2U7XG4gICAgdGhpcy5fYXJyYXkucHVzaChhTWFwcGluZyk7XG4gIH1cbn07XG5cbi8qKlxuICogUmV0dXJucyB0aGUgZmxhdCwgc29ydGVkIGFycmF5IG9mIG1hcHBpbmdzLiBUaGUgbWFwcGluZ3MgYXJlIHNvcnRlZCBieVxuICogZ2VuZXJhdGVkIHBvc2l0aW9uLlxuICpcbiAqIFdBUk5JTkc6IFRoaXMgbWV0aG9kIHJldHVybnMgaW50ZXJuYWwgZGF0YSB3aXRob3V0IGNvcHlpbmcsIGZvclxuICogcGVyZm9ybWFuY2UuIFRoZSByZXR1cm4gdmFsdWUgbXVzdCBOT1QgYmUgbXV0YXRlZCwgYW5kIHNob3VsZCBiZSB0cmVhdGVkIGFzXG4gKiBhbiBpbW11dGFibGUgYm9ycm93LiBJZiB5b3Ugd2FudCB0byB0YWtlIG93bmVyc2hpcCwgeW91IG11c3QgbWFrZSB5b3VyIG93blxuICogY29weS5cbiAqL1xuTWFwcGluZ0xpc3QucHJvdG90eXBlLnRvQXJyYXkgPSBmdW5jdGlvbiBNYXBwaW5nTGlzdF90b0FycmF5KCkge1xuICBpZiAoIXRoaXMuX3NvcnRlZCkge1xuICAgIHRoaXMuX2FycmF5LnNvcnQodXRpbC5jb21wYXJlQnlHZW5lcmF0ZWRQb3NpdGlvbnNJbmZsYXRlZCk7XG4gICAgdGhpcy5fc29ydGVkID0gdHJ1ZTtcbiAgfVxuICByZXR1cm4gdGhpcy5fYXJyYXk7XG59O1xuXG5leHBvcnRzLk1hcHBpbmdMaXN0ID0gTWFwcGluZ0xpc3Q7XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL2xpYi9tYXBwaW5nLWxpc3QuanNcbi8vIG1vZHVsZSBpZCA9IDZcbi8vIG1vZHVsZSBjaHVua3MgPSAwIiwiLyogLSotIE1vZGU6IGpzOyBqcy1pbmRlbnQtbGV2ZWw6IDI7IC0qLSAqL1xuLypcbiAqIENvcHlyaWdodCAyMDExIE1vemlsbGEgRm91bmRhdGlvbiBhbmQgY29udHJpYnV0b3JzXG4gKiBMaWNlbnNlZCB1bmRlciB0aGUgTmV3IEJTRCBsaWNlbnNlLiBTZWUgTElDRU5TRSBvcjpcbiAqIGh0dHA6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMy1DbGF1c2VcbiAqL1xuXG52YXIgdXRpbCA9IHJlcXVpcmUoJy4vdXRpbCcpO1xudmFyIGJpbmFyeVNlYXJjaCA9IHJlcXVpcmUoJy4vYmluYXJ5LXNlYXJjaCcpO1xudmFyIEFycmF5U2V0ID0gcmVxdWlyZSgnLi9hcnJheS1zZXQnKS5BcnJheVNldDtcbnZhciBiYXNlNjRWTFEgPSByZXF1aXJlKCcuL2Jhc2U2NC12bHEnKTtcbnZhciBxdWlja1NvcnQgPSByZXF1aXJlKCcuL3F1aWNrLXNvcnQnKS5xdWlja1NvcnQ7XG5cbmZ1bmN0aW9uIFNvdXJjZU1hcENvbnN1bWVyKGFTb3VyY2VNYXApIHtcbiAgdmFyIHNvdXJjZU1hcCA9IGFTb3VyY2VNYXA7XG4gIGlmICh0eXBlb2YgYVNvdXJjZU1hcCA9PT0gJ3N0cmluZycpIHtcbiAgICBzb3VyY2VNYXAgPSBKU09OLnBhcnNlKGFTb3VyY2VNYXAucmVwbGFjZSgvXlxcKVxcXVxcfScvLCAnJykpO1xuICB9XG5cbiAgcmV0dXJuIHNvdXJjZU1hcC5zZWN0aW9ucyAhPSBudWxsXG4gICAgPyBuZXcgSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyKHNvdXJjZU1hcClcbiAgICA6IG5ldyBCYXNpY1NvdXJjZU1hcENvbnN1bWVyKHNvdXJjZU1hcCk7XG59XG5cblNvdXJjZU1hcENvbnN1bWVyLmZyb21Tb3VyY2VNYXAgPSBmdW5jdGlvbihhU291cmNlTWFwKSB7XG4gIHJldHVybiBCYXNpY1NvdXJjZU1hcENvbnN1bWVyLmZyb21Tb3VyY2VNYXAoYVNvdXJjZU1hcCk7XG59XG5cbi8qKlxuICogVGhlIHZlcnNpb24gb2YgdGhlIHNvdXJjZSBtYXBwaW5nIHNwZWMgdGhhdCB3ZSBhcmUgY29uc3VtaW5nLlxuICovXG5Tb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuX3ZlcnNpb24gPSAzO1xuXG4vLyBgX19nZW5lcmF0ZWRNYXBwaW5nc2AgYW5kIGBfX29yaWdpbmFsTWFwcGluZ3NgIGFyZSBhcnJheXMgdGhhdCBob2xkIHRoZVxuLy8gcGFyc2VkIG1hcHBpbmcgY29vcmRpbmF0ZXMgZnJvbSB0aGUgc291cmNlIG1hcCdzIFwibWFwcGluZ3NcIiBhdHRyaWJ1dGUuIFRoZXlcbi8vIGFyZSBsYXppbHkgaW5zdGFudGlhdGVkLCBhY2Nlc3NlZCB2aWEgdGhlIGBfZ2VuZXJhdGVkTWFwcGluZ3NgIGFuZFxuLy8gYF9vcmlnaW5hbE1hcHBpbmdzYCBnZXR0ZXJzIHJlc3BlY3RpdmVseSwgYW5kIHdlIG9ubHkgcGFyc2UgdGhlIG1hcHBpbmdzXG4vLyBhbmQgY3JlYXRlIHRoZXNlIGFycmF5cyBvbmNlIHF1ZXJpZWQgZm9yIGEgc291cmNlIGxvY2F0aW9uLiBXZSBqdW1wIHRocm91Z2hcbi8vIHRoZXNlIGhvb3BzIGJlY2F1c2UgdGhlcmUgY2FuIGJlIG1hbnkgdGhvdXNhbmRzIG9mIG1hcHBpbmdzLCBhbmQgcGFyc2luZ1xuLy8gdGhlbSBpcyBleHBlbnNpdmUsIHNvIHdlIG9ubHkgd2FudCB0byBkbyBpdCBpZiB3ZSBtdXN0LlxuLy9cbi8vIEVhY2ggb2JqZWN0IGluIHRoZSBhcnJheXMgaXMgb2YgdGhlIGZvcm06XG4vL1xuLy8gICAgIHtcbi8vICAgICAgIGdlbmVyYXRlZExpbmU6IFRoZSBsaW5lIG51bWJlciBpbiB0aGUgZ2VuZXJhdGVkIGNvZGUsXG4vLyAgICAgICBnZW5lcmF0ZWRDb2x1bW46IFRoZSBjb2x1bW4gbnVtYmVyIGluIHRoZSBnZW5lcmF0ZWQgY29kZSxcbi8vICAgICAgIHNvdXJjZTogVGhlIHBhdGggdG8gdGhlIG9yaWdpbmFsIHNvdXJjZSBmaWxlIHRoYXQgZ2VuZXJhdGVkIHRoaXNcbi8vICAgICAgICAgICAgICAgY2h1bmsgb2YgY29kZSxcbi8vICAgICAgIG9yaWdpbmFsTGluZTogVGhlIGxpbmUgbnVtYmVyIGluIHRoZSBvcmlnaW5hbCBzb3VyY2UgdGhhdFxuLy8gICAgICAgICAgICAgICAgICAgICBjb3JyZXNwb25kcyB0byB0aGlzIGNodW5rIG9mIGdlbmVyYXRlZCBjb2RlLFxuLy8gICAgICAgb3JpZ2luYWxDb2x1bW46IFRoZSBjb2x1bW4gbnVtYmVyIGluIHRoZSBvcmlnaW5hbCBzb3VyY2UgdGhhdFxuLy8gICAgICAgICAgICAgICAgICAgICAgIGNvcnJlc3BvbmRzIHRvIHRoaXMgY2h1bmsgb2YgZ2VuZXJhdGVkIGNvZGUsXG4vLyAgICAgICBuYW1lOiBUaGUgbmFtZSBvZiB0aGUgb3JpZ2luYWwgc3ltYm9sIHdoaWNoIGdlbmVyYXRlZCB0aGlzIGNodW5rIG9mXG4vLyAgICAgICAgICAgICBjb2RlLlxuLy8gICAgIH1cbi8vXG4vLyBBbGwgcHJvcGVydGllcyBleGNlcHQgZm9yIGBnZW5lcmF0ZWRMaW5lYCBhbmQgYGdlbmVyYXRlZENvbHVtbmAgY2FuIGJlXG4vLyBgbnVsbGAuXG4vL1xuLy8gYF9nZW5lcmF0ZWRNYXBwaW5nc2AgaXMgb3JkZXJlZCBieSB0aGUgZ2VuZXJhdGVkIHBvc2l0aW9ucy5cbi8vXG4vLyBgX29yaWdpbmFsTWFwcGluZ3NgIGlzIG9yZGVyZWQgYnkgdGhlIG9yaWdpbmFsIHBvc2l0aW9ucy5cblxuU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlLl9fZ2VuZXJhdGVkTWFwcGluZ3MgPSBudWxsO1xuT2JqZWN0LmRlZmluZVByb3BlcnR5KFNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZSwgJ19nZW5lcmF0ZWRNYXBwaW5ncycsIHtcbiAgZ2V0OiBmdW5jdGlvbiAoKSB7XG4gICAgaWYgKCF0aGlzLl9fZ2VuZXJhdGVkTWFwcGluZ3MpIHtcbiAgICAgIHRoaXMuX3BhcnNlTWFwcGluZ3ModGhpcy5fbWFwcGluZ3MsIHRoaXMuc291cmNlUm9vdCk7XG4gICAgfVxuXG4gICAgcmV0dXJuIHRoaXMuX19nZW5lcmF0ZWRNYXBwaW5ncztcbiAgfVxufSk7XG5cblNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5fX29yaWdpbmFsTWFwcGluZ3MgPSBudWxsO1xuT2JqZWN0LmRlZmluZVByb3BlcnR5KFNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZSwgJ19vcmlnaW5hbE1hcHBpbmdzJywge1xuICBnZXQ6IGZ1bmN0aW9uICgpIHtcbiAgICBpZiAoIXRoaXMuX19vcmlnaW5hbE1hcHBpbmdzKSB7XG4gICAgICB0aGlzLl9wYXJzZU1hcHBpbmdzKHRoaXMuX21hcHBpbmdzLCB0aGlzLnNvdXJjZVJvb3QpO1xuICAgIH1cblxuICAgIHJldHVybiB0aGlzLl9fb3JpZ2luYWxNYXBwaW5ncztcbiAgfVxufSk7XG5cblNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5fY2hhcklzTWFwcGluZ1NlcGFyYXRvciA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcENvbnN1bWVyX2NoYXJJc01hcHBpbmdTZXBhcmF0b3IoYVN0ciwgaW5kZXgpIHtcbiAgICB2YXIgYyA9IGFTdHIuY2hhckF0KGluZGV4KTtcbiAgICByZXR1cm4gYyA9PT0gXCI7XCIgfHwgYyA9PT0gXCIsXCI7XG4gIH07XG5cbi8qKlxuICogUGFyc2UgdGhlIG1hcHBpbmdzIGluIGEgc3RyaW5nIGluIHRvIGEgZGF0YSBzdHJ1Y3R1cmUgd2hpY2ggd2UgY2FuIGVhc2lseVxuICogcXVlcnkgKHRoZSBvcmRlcmVkIGFycmF5cyBpbiB0aGUgYHRoaXMuX19nZW5lcmF0ZWRNYXBwaW5nc2AgYW5kXG4gKiBgdGhpcy5fX29yaWdpbmFsTWFwcGluZ3NgIHByb3BlcnRpZXMpLlxuICovXG5Tb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuX3BhcnNlTWFwcGluZ3MgPVxuICBmdW5jdGlvbiBTb3VyY2VNYXBDb25zdW1lcl9wYXJzZU1hcHBpbmdzKGFTdHIsIGFTb3VyY2VSb290KSB7XG4gICAgdGhyb3cgbmV3IEVycm9yKFwiU3ViY2xhc3NlcyBtdXN0IGltcGxlbWVudCBfcGFyc2VNYXBwaW5nc1wiKTtcbiAgfTtcblxuU291cmNlTWFwQ29uc3VtZXIuR0VORVJBVEVEX09SREVSID0gMTtcblNvdXJjZU1hcENvbnN1bWVyLk9SSUdJTkFMX09SREVSID0gMjtcblxuU291cmNlTWFwQ29uc3VtZXIuR1JFQVRFU1RfTE9XRVJfQk9VTkQgPSAxO1xuU291cmNlTWFwQ29uc3VtZXIuTEVBU1RfVVBQRVJfQk9VTkQgPSAyO1xuXG4vKipcbiAqIEl0ZXJhdGUgb3ZlciBlYWNoIG1hcHBpbmcgYmV0d2VlbiBhbiBvcmlnaW5hbCBzb3VyY2UvbGluZS9jb2x1bW4gYW5kIGFcbiAqIGdlbmVyYXRlZCBsaW5lL2NvbHVtbiBpbiB0aGlzIHNvdXJjZSBtYXAuXG4gKlxuICogQHBhcmFtIEZ1bmN0aW9uIGFDYWxsYmFja1xuICogICAgICAgIFRoZSBmdW5jdGlvbiB0aGF0IGlzIGNhbGxlZCB3aXRoIGVhY2ggbWFwcGluZy5cbiAqIEBwYXJhbSBPYmplY3QgYUNvbnRleHRcbiAqICAgICAgICBPcHRpb25hbC4gSWYgc3BlY2lmaWVkLCB0aGlzIG9iamVjdCB3aWxsIGJlIHRoZSB2YWx1ZSBvZiBgdGhpc2AgZXZlcnlcbiAqICAgICAgICB0aW1lIHRoYXQgYGFDYWxsYmFja2AgaXMgY2FsbGVkLlxuICogQHBhcmFtIGFPcmRlclxuICogICAgICAgIEVpdGhlciBgU291cmNlTWFwQ29uc3VtZXIuR0VORVJBVEVEX09SREVSYCBvclxuICogICAgICAgIGBTb3VyY2VNYXBDb25zdW1lci5PUklHSU5BTF9PUkRFUmAuIFNwZWNpZmllcyB3aGV0aGVyIHlvdSB3YW50IHRvXG4gKiAgICAgICAgaXRlcmF0ZSBvdmVyIHRoZSBtYXBwaW5ncyBzb3J0ZWQgYnkgdGhlIGdlbmVyYXRlZCBmaWxlJ3MgbGluZS9jb2x1bW5cbiAqICAgICAgICBvcmRlciBvciB0aGUgb3JpZ2luYWwncyBzb3VyY2UvbGluZS9jb2x1bW4gb3JkZXIsIHJlc3BlY3RpdmVseS4gRGVmYXVsdHMgdG9cbiAqICAgICAgICBgU291cmNlTWFwQ29uc3VtZXIuR0VORVJBVEVEX09SREVSYC5cbiAqL1xuU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlLmVhY2hNYXBwaW5nID1cbiAgZnVuY3Rpb24gU291cmNlTWFwQ29uc3VtZXJfZWFjaE1hcHBpbmcoYUNhbGxiYWNrLCBhQ29udGV4dCwgYU9yZGVyKSB7XG4gICAgdmFyIGNvbnRleHQgPSBhQ29udGV4dCB8fCBudWxsO1xuICAgIHZhciBvcmRlciA9IGFPcmRlciB8fCBTb3VyY2VNYXBDb25zdW1lci5HRU5FUkFURURfT1JERVI7XG5cbiAgICB2YXIgbWFwcGluZ3M7XG4gICAgc3dpdGNoIChvcmRlcikge1xuICAgIGNhc2UgU291cmNlTWFwQ29uc3VtZXIuR0VORVJBVEVEX09SREVSOlxuICAgICAgbWFwcGluZ3MgPSB0aGlzLl9nZW5lcmF0ZWRNYXBwaW5ncztcbiAgICAgIGJyZWFrO1xuICAgIGNhc2UgU291cmNlTWFwQ29uc3VtZXIuT1JJR0lOQUxfT1JERVI6XG4gICAgICBtYXBwaW5ncyA9IHRoaXMuX29yaWdpbmFsTWFwcGluZ3M7XG4gICAgICBicmVhaztcbiAgICBkZWZhdWx0OlxuICAgICAgdGhyb3cgbmV3IEVycm9yKFwiVW5rbm93biBvcmRlciBvZiBpdGVyYXRpb24uXCIpO1xuICAgIH1cblxuICAgIHZhciBzb3VyY2VSb290ID0gdGhpcy5zb3VyY2VSb290O1xuICAgIG1hcHBpbmdzLm1hcChmdW5jdGlvbiAobWFwcGluZykge1xuICAgICAgdmFyIHNvdXJjZSA9IG1hcHBpbmcuc291cmNlID09PSBudWxsID8gbnVsbCA6IHRoaXMuX3NvdXJjZXMuYXQobWFwcGluZy5zb3VyY2UpO1xuICAgICAgaWYgKHNvdXJjZSAhPSBudWxsICYmIHNvdXJjZVJvb3QgIT0gbnVsbCkge1xuICAgICAgICBzb3VyY2UgPSB1dGlsLmpvaW4oc291cmNlUm9vdCwgc291cmNlKTtcbiAgICAgIH1cbiAgICAgIHJldHVybiB7XG4gICAgICAgIHNvdXJjZTogc291cmNlLFxuICAgICAgICBnZW5lcmF0ZWRMaW5lOiBtYXBwaW5nLmdlbmVyYXRlZExpbmUsXG4gICAgICAgIGdlbmVyYXRlZENvbHVtbjogbWFwcGluZy5nZW5lcmF0ZWRDb2x1bW4sXG4gICAgICAgIG9yaWdpbmFsTGluZTogbWFwcGluZy5vcmlnaW5hbExpbmUsXG4gICAgICAgIG9yaWdpbmFsQ29sdW1uOiBtYXBwaW5nLm9yaWdpbmFsQ29sdW1uLFxuICAgICAgICBuYW1lOiBtYXBwaW5nLm5hbWUgPT09IG51bGwgPyBudWxsIDogdGhpcy5fbmFtZXMuYXQobWFwcGluZy5uYW1lKVxuICAgICAgfTtcbiAgICB9LCB0aGlzKS5mb3JFYWNoKGFDYWxsYmFjaywgY29udGV4dCk7XG4gIH07XG5cbi8qKlxuICogUmV0dXJucyBhbGwgZ2VuZXJhdGVkIGxpbmUgYW5kIGNvbHVtbiBpbmZvcm1hdGlvbiBmb3IgdGhlIG9yaWdpbmFsIHNvdXJjZSxcbiAqIGxpbmUsIGFuZCBjb2x1bW4gcHJvdmlkZWQuIElmIG5vIGNvbHVtbiBpcyBwcm92aWRlZCwgcmV0dXJucyBhbGwgbWFwcGluZ3NcbiAqIGNvcnJlc3BvbmRpbmcgdG8gYSBlaXRoZXIgdGhlIGxpbmUgd2UgYXJlIHNlYXJjaGluZyBmb3Igb3IgdGhlIG5leHRcbiAqIGNsb3Nlc3QgbGluZSB0aGF0IGhhcyBhbnkgbWFwcGluZ3MuIE90aGVyd2lzZSwgcmV0dXJucyBhbGwgbWFwcGluZ3NcbiAqIGNvcnJlc3BvbmRpbmcgdG8gdGhlIGdpdmVuIGxpbmUgYW5kIGVpdGhlciB0aGUgY29sdW1uIHdlIGFyZSBzZWFyY2hpbmcgZm9yXG4gKiBvciB0aGUgbmV4dCBjbG9zZXN0IGNvbHVtbiB0aGF0IGhhcyBhbnkgb2Zmc2V0cy5cbiAqXG4gKiBUaGUgb25seSBhcmd1bWVudCBpcyBhbiBvYmplY3Qgd2l0aCB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIHNvdXJjZTogVGhlIGZpbGVuYW1lIG9mIHRoZSBvcmlnaW5hbCBzb3VyY2UuXG4gKiAgIC0gbGluZTogVGhlIGxpbmUgbnVtYmVyIGluIHRoZSBvcmlnaW5hbCBzb3VyY2UuXG4gKiAgIC0gY29sdW1uOiBPcHRpb25hbC4gdGhlIGNvbHVtbiBudW1iZXIgaW4gdGhlIG9yaWdpbmFsIHNvdXJjZS5cbiAqXG4gKiBhbmQgYW4gYXJyYXkgb2Ygb2JqZWN0cyBpcyByZXR1cm5lZCwgZWFjaCB3aXRoIHRoZSBmb2xsb3dpbmcgcHJvcGVydGllczpcbiAqXG4gKiAgIC0gbGluZTogVGhlIGxpbmUgbnVtYmVyIGluIHRoZSBnZW5lcmF0ZWQgc291cmNlLCBvciBudWxsLlxuICogICAtIGNvbHVtbjogVGhlIGNvbHVtbiBudW1iZXIgaW4gdGhlIGdlbmVyYXRlZCBzb3VyY2UsIG9yIG51bGwuXG4gKi9cblNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5hbGxHZW5lcmF0ZWRQb3NpdGlvbnNGb3IgPVxuICBmdW5jdGlvbiBTb3VyY2VNYXBDb25zdW1lcl9hbGxHZW5lcmF0ZWRQb3NpdGlvbnNGb3IoYUFyZ3MpIHtcbiAgICB2YXIgbGluZSA9IHV0aWwuZ2V0QXJnKGFBcmdzLCAnbGluZScpO1xuXG4gICAgLy8gV2hlbiB0aGVyZSBpcyBubyBleGFjdCBtYXRjaCwgQmFzaWNTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuX2ZpbmRNYXBwaW5nXG4gICAgLy8gcmV0dXJucyB0aGUgaW5kZXggb2YgdGhlIGNsb3Nlc3QgbWFwcGluZyBsZXNzIHRoYW4gdGhlIG5lZWRsZS4gQnlcbiAgICAvLyBzZXR0aW5nIG5lZWRsZS5vcmlnaW5hbENvbHVtbiB0byAwLCB3ZSB0aHVzIGZpbmQgdGhlIGxhc3QgbWFwcGluZyBmb3JcbiAgICAvLyB0aGUgZ2l2ZW4gbGluZSwgcHJvdmlkZWQgc3VjaCBhIG1hcHBpbmcgZXhpc3RzLlxuICAgIHZhciBuZWVkbGUgPSB7XG4gICAgICBzb3VyY2U6IHV0aWwuZ2V0QXJnKGFBcmdzLCAnc291cmNlJyksXG4gICAgICBvcmlnaW5hbExpbmU6IGxpbmUsXG4gICAgICBvcmlnaW5hbENvbHVtbjogdXRpbC5nZXRBcmcoYUFyZ3MsICdjb2x1bW4nLCAwKVxuICAgIH07XG5cbiAgICBpZiAodGhpcy5zb3VyY2VSb290ICE9IG51bGwpIHtcbiAgICAgIG5lZWRsZS5zb3VyY2UgPSB1dGlsLnJlbGF0aXZlKHRoaXMuc291cmNlUm9vdCwgbmVlZGxlLnNvdXJjZSk7XG4gICAgfVxuICAgIGlmICghdGhpcy5fc291cmNlcy5oYXMobmVlZGxlLnNvdXJjZSkpIHtcbiAgICAgIHJldHVybiBbXTtcbiAgICB9XG4gICAgbmVlZGxlLnNvdXJjZSA9IHRoaXMuX3NvdXJjZXMuaW5kZXhPZihuZWVkbGUuc291cmNlKTtcblxuICAgIHZhciBtYXBwaW5ncyA9IFtdO1xuXG4gICAgdmFyIGluZGV4ID0gdGhpcy5fZmluZE1hcHBpbmcobmVlZGxlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX29yaWdpbmFsTWFwcGluZ3MsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJvcmlnaW5hbExpbmVcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm9yaWdpbmFsQ29sdW1uXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXRpbC5jb21wYXJlQnlPcmlnaW5hbFBvc2l0aW9ucyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaW5hcnlTZWFyY2guTEVBU1RfVVBQRVJfQk9VTkQpO1xuICAgIGlmIChpbmRleCA+PSAwKSB7XG4gICAgICB2YXIgbWFwcGluZyA9IHRoaXMuX29yaWdpbmFsTWFwcGluZ3NbaW5kZXhdO1xuXG4gICAgICBpZiAoYUFyZ3MuY29sdW1uID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgdmFyIG9yaWdpbmFsTGluZSA9IG1hcHBpbmcub3JpZ2luYWxMaW5lO1xuXG4gICAgICAgIC8vIEl0ZXJhdGUgdW50aWwgZWl0aGVyIHdlIHJ1biBvdXQgb2YgbWFwcGluZ3MsIG9yIHdlIHJ1biBpbnRvXG4gICAgICAgIC8vIGEgbWFwcGluZyBmb3IgYSBkaWZmZXJlbnQgbGluZSB0aGFuIHRoZSBvbmUgd2UgZm91bmQuIFNpbmNlXG4gICAgICAgIC8vIG1hcHBpbmdzIGFyZSBzb3J0ZWQsIHRoaXMgaXMgZ3VhcmFudGVlZCB0byBmaW5kIGFsbCBtYXBwaW5ncyBmb3JcbiAgICAgICAgLy8gdGhlIGxpbmUgd2UgZm91bmQuXG4gICAgICAgIHdoaWxlIChtYXBwaW5nICYmIG1hcHBpbmcub3JpZ2luYWxMaW5lID09PSBvcmlnaW5hbExpbmUpIHtcbiAgICAgICAgICBtYXBwaW5ncy5wdXNoKHtcbiAgICAgICAgICAgIGxpbmU6IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdnZW5lcmF0ZWRMaW5lJywgbnVsbCksXG4gICAgICAgICAgICBjb2x1bW46IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdnZW5lcmF0ZWRDb2x1bW4nLCBudWxsKSxcbiAgICAgICAgICAgIGxhc3RDb2x1bW46IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdsYXN0R2VuZXJhdGVkQ29sdW1uJywgbnVsbClcbiAgICAgICAgICB9KTtcblxuICAgICAgICAgIG1hcHBpbmcgPSB0aGlzLl9vcmlnaW5hbE1hcHBpbmdzWysraW5kZXhdO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICB2YXIgb3JpZ2luYWxDb2x1bW4gPSBtYXBwaW5nLm9yaWdpbmFsQ29sdW1uO1xuXG4gICAgICAgIC8vIEl0ZXJhdGUgdW50aWwgZWl0aGVyIHdlIHJ1biBvdXQgb2YgbWFwcGluZ3MsIG9yIHdlIHJ1biBpbnRvXG4gICAgICAgIC8vIGEgbWFwcGluZyBmb3IgYSBkaWZmZXJlbnQgbGluZSB0aGFuIHRoZSBvbmUgd2Ugd2VyZSBzZWFyY2hpbmcgZm9yLlxuICAgICAgICAvLyBTaW5jZSBtYXBwaW5ncyBhcmUgc29ydGVkLCB0aGlzIGlzIGd1YXJhbnRlZWQgdG8gZmluZCBhbGwgbWFwcGluZ3MgZm9yXG4gICAgICAgIC8vIHRoZSBsaW5lIHdlIGFyZSBzZWFyY2hpbmcgZm9yLlxuICAgICAgICB3aGlsZSAobWFwcGluZyAmJlxuICAgICAgICAgICAgICAgbWFwcGluZy5vcmlnaW5hbExpbmUgPT09IGxpbmUgJiZcbiAgICAgICAgICAgICAgIG1hcHBpbmcub3JpZ2luYWxDb2x1bW4gPT0gb3JpZ2luYWxDb2x1bW4pIHtcbiAgICAgICAgICBtYXBwaW5ncy5wdXNoKHtcbiAgICAgICAgICAgIGxpbmU6IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdnZW5lcmF0ZWRMaW5lJywgbnVsbCksXG4gICAgICAgICAgICBjb2x1bW46IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdnZW5lcmF0ZWRDb2x1bW4nLCBudWxsKSxcbiAgICAgICAgICAgIGxhc3RDb2x1bW46IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdsYXN0R2VuZXJhdGVkQ29sdW1uJywgbnVsbClcbiAgICAgICAgICB9KTtcblxuICAgICAgICAgIG1hcHBpbmcgPSB0aGlzLl9vcmlnaW5hbE1hcHBpbmdzWysraW5kZXhdO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgcmV0dXJuIG1hcHBpbmdzO1xuICB9O1xuXG5leHBvcnRzLlNvdXJjZU1hcENvbnN1bWVyID0gU291cmNlTWFwQ29uc3VtZXI7XG5cbi8qKlxuICogQSBCYXNpY1NvdXJjZU1hcENvbnN1bWVyIGluc3RhbmNlIHJlcHJlc2VudHMgYSBwYXJzZWQgc291cmNlIG1hcCB3aGljaCB3ZSBjYW5cbiAqIHF1ZXJ5IGZvciBpbmZvcm1hdGlvbiBhYm91dCB0aGUgb3JpZ2luYWwgZmlsZSBwb3NpdGlvbnMgYnkgZ2l2aW5nIGl0IGEgZmlsZVxuICogcG9zaXRpb24gaW4gdGhlIGdlbmVyYXRlZCBzb3VyY2UuXG4gKlxuICogVGhlIG9ubHkgcGFyYW1ldGVyIGlzIHRoZSByYXcgc291cmNlIG1hcCAoZWl0aGVyIGFzIGEgSlNPTiBzdHJpbmcsIG9yXG4gKiBhbHJlYWR5IHBhcnNlZCB0byBhbiBvYmplY3QpLiBBY2NvcmRpbmcgdG8gdGhlIHNwZWMsIHNvdXJjZSBtYXBzIGhhdmUgdGhlXG4gKiBmb2xsb3dpbmcgYXR0cmlidXRlczpcbiAqXG4gKiAgIC0gdmVyc2lvbjogV2hpY2ggdmVyc2lvbiBvZiB0aGUgc291cmNlIG1hcCBzcGVjIHRoaXMgbWFwIGlzIGZvbGxvd2luZy5cbiAqICAgLSBzb3VyY2VzOiBBbiBhcnJheSBvZiBVUkxzIHRvIHRoZSBvcmlnaW5hbCBzb3VyY2UgZmlsZXMuXG4gKiAgIC0gbmFtZXM6IEFuIGFycmF5IG9mIGlkZW50aWZpZXJzIHdoaWNoIGNhbiBiZSByZWZlcnJlbmNlZCBieSBpbmRpdmlkdWFsIG1hcHBpbmdzLlxuICogICAtIHNvdXJjZVJvb3Q6IE9wdGlvbmFsLiBUaGUgVVJMIHJvb3QgZnJvbSB3aGljaCBhbGwgc291cmNlcyBhcmUgcmVsYXRpdmUuXG4gKiAgIC0gc291cmNlc0NvbnRlbnQ6IE9wdGlvbmFsLiBBbiBhcnJheSBvZiBjb250ZW50cyBvZiB0aGUgb3JpZ2luYWwgc291cmNlIGZpbGVzLlxuICogICAtIG1hcHBpbmdzOiBBIHN0cmluZyBvZiBiYXNlNjQgVkxRcyB3aGljaCBjb250YWluIHRoZSBhY3R1YWwgbWFwcGluZ3MuXG4gKiAgIC0gZmlsZTogT3B0aW9uYWwuIFRoZSBnZW5lcmF0ZWQgZmlsZSB0aGlzIHNvdXJjZSBtYXAgaXMgYXNzb2NpYXRlZCB3aXRoLlxuICpcbiAqIEhlcmUgaXMgYW4gZXhhbXBsZSBzb3VyY2UgbWFwLCB0YWtlbiBmcm9tIHRoZSBzb3VyY2UgbWFwIHNwZWNbMF06XG4gKlxuICogICAgIHtcbiAqICAgICAgIHZlcnNpb24gOiAzLFxuICogICAgICAgZmlsZTogXCJvdXQuanNcIixcbiAqICAgICAgIHNvdXJjZVJvb3QgOiBcIlwiLFxuICogICAgICAgc291cmNlczogW1wiZm9vLmpzXCIsIFwiYmFyLmpzXCJdLFxuICogICAgICAgbmFtZXM6IFtcInNyY1wiLCBcIm1hcHNcIiwgXCJhcmVcIiwgXCJmdW5cIl0sXG4gKiAgICAgICBtYXBwaW5nczogXCJBQSxBQjs7QUJDREU7XCJcbiAqICAgICB9XG4gKlxuICogWzBdOiBodHRwczovL2RvY3MuZ29vZ2xlLmNvbS9kb2N1bWVudC9kLzFVMVJHQWVoUXdSeXBVVG92RjFLUmxwaU9GemUwYi1fMmdjNmZBSDBLWTBrL2VkaXQ/cGxpPTEjXG4gKi9cbmZ1bmN0aW9uIEJhc2ljU291cmNlTWFwQ29uc3VtZXIoYVNvdXJjZU1hcCkge1xuICB2YXIgc291cmNlTWFwID0gYVNvdXJjZU1hcDtcbiAgaWYgKHR5cGVvZiBhU291cmNlTWFwID09PSAnc3RyaW5nJykge1xuICAgIHNvdXJjZU1hcCA9IEpTT04ucGFyc2UoYVNvdXJjZU1hcC5yZXBsYWNlKC9eXFwpXFxdXFx9Jy8sICcnKSk7XG4gIH1cblxuICB2YXIgdmVyc2lvbiA9IHV0aWwuZ2V0QXJnKHNvdXJjZU1hcCwgJ3ZlcnNpb24nKTtcbiAgdmFyIHNvdXJjZXMgPSB1dGlsLmdldEFyZyhzb3VyY2VNYXAsICdzb3VyY2VzJyk7XG4gIC8vIFNhc3MgMy4zIGxlYXZlcyBvdXQgdGhlICduYW1lcycgYXJyYXksIHNvIHdlIGRldmlhdGUgZnJvbSB0aGUgc3BlYyAod2hpY2hcbiAgLy8gcmVxdWlyZXMgdGhlIGFycmF5KSB0byBwbGF5IG5pY2UgaGVyZS5cbiAgdmFyIG5hbWVzID0gdXRpbC5nZXRBcmcoc291cmNlTWFwLCAnbmFtZXMnLCBbXSk7XG4gIHZhciBzb3VyY2VSb290ID0gdXRpbC5nZXRBcmcoc291cmNlTWFwLCAnc291cmNlUm9vdCcsIG51bGwpO1xuICB2YXIgc291cmNlc0NvbnRlbnQgPSB1dGlsLmdldEFyZyhzb3VyY2VNYXAsICdzb3VyY2VzQ29udGVudCcsIG51bGwpO1xuICB2YXIgbWFwcGluZ3MgPSB1dGlsLmdldEFyZyhzb3VyY2VNYXAsICdtYXBwaW5ncycpO1xuICB2YXIgZmlsZSA9IHV0aWwuZ2V0QXJnKHNvdXJjZU1hcCwgJ2ZpbGUnLCBudWxsKTtcblxuICAvLyBPbmNlIGFnYWluLCBTYXNzIGRldmlhdGVzIGZyb20gdGhlIHNwZWMgYW5kIHN1cHBsaWVzIHRoZSB2ZXJzaW9uIGFzIGFcbiAgLy8gc3RyaW5nIHJhdGhlciB0aGFuIGEgbnVtYmVyLCBzbyB3ZSB1c2UgbG9vc2UgZXF1YWxpdHkgY2hlY2tpbmcgaGVyZS5cbiAgaWYgKHZlcnNpb24gIT0gdGhpcy5fdmVyc2lvbikge1xuICAgIHRocm93IG5ldyBFcnJvcignVW5zdXBwb3J0ZWQgdmVyc2lvbjogJyArIHZlcnNpb24pO1xuICB9XG5cbiAgc291cmNlcyA9IHNvdXJjZXNcbiAgICAubWFwKFN0cmluZylcbiAgICAvLyBTb21lIHNvdXJjZSBtYXBzIHByb2R1Y2UgcmVsYXRpdmUgc291cmNlIHBhdGhzIGxpa2UgXCIuL2Zvby5qc1wiIGluc3RlYWQgb2ZcbiAgICAvLyBcImZvby5qc1wiLiAgTm9ybWFsaXplIHRoZXNlIGZpcnN0IHNvIHRoYXQgZnV0dXJlIGNvbXBhcmlzb25zIHdpbGwgc3VjY2VlZC5cbiAgICAvLyBTZWUgYnVnemlsLmxhLzEwOTA3NjguXG4gICAgLm1hcCh1dGlsLm5vcm1hbGl6ZSlcbiAgICAvLyBBbHdheXMgZW5zdXJlIHRoYXQgYWJzb2x1dGUgc291cmNlcyBhcmUgaW50ZXJuYWxseSBzdG9yZWQgcmVsYXRpdmUgdG9cbiAgICAvLyB0aGUgc291cmNlIHJvb3QsIGlmIHRoZSBzb3VyY2Ugcm9vdCBpcyBhYnNvbHV0ZS4gTm90IGRvaW5nIHRoaXMgd291bGRcbiAgICAvLyBiZSBwYXJ0aWN1bGFybHkgcHJvYmxlbWF0aWMgd2hlbiB0aGUgc291cmNlIHJvb3QgaXMgYSBwcmVmaXggb2YgdGhlXG4gICAgLy8gc291cmNlICh2YWxpZCwgYnV0IHdoeT8/KS4gU2VlIGdpdGh1YiBpc3N1ZSAjMTk5IGFuZCBidWd6aWwubGEvMTE4ODk4Mi5cbiAgICAubWFwKGZ1bmN0aW9uIChzb3VyY2UpIHtcbiAgICAgIHJldHVybiBzb3VyY2VSb290ICYmIHV0aWwuaXNBYnNvbHV0ZShzb3VyY2VSb290KSAmJiB1dGlsLmlzQWJzb2x1dGUoc291cmNlKVxuICAgICAgICA/IHV0aWwucmVsYXRpdmUoc291cmNlUm9vdCwgc291cmNlKVxuICAgICAgICA6IHNvdXJjZTtcbiAgICB9KTtcblxuICAvLyBQYXNzIGB0cnVlYCBiZWxvdyB0byBhbGxvdyBkdXBsaWNhdGUgbmFtZXMgYW5kIHNvdXJjZXMuIFdoaWxlIHNvdXJjZSBtYXBzXG4gIC8vIGFyZSBpbnRlbmRlZCB0byBiZSBjb21wcmVzc2VkIGFuZCBkZWR1cGxpY2F0ZWQsIHRoZSBUeXBlU2NyaXB0IGNvbXBpbGVyXG4gIC8vIHNvbWV0aW1lcyBnZW5lcmF0ZXMgc291cmNlIG1hcHMgd2l0aCBkdXBsaWNhdGVzIGluIHRoZW0uIFNlZSBHaXRodWIgaXNzdWVcbiAgLy8gIzcyIGFuZCBidWd6aWwubGEvODg5NDkyLlxuICB0aGlzLl9uYW1lcyA9IEFycmF5U2V0LmZyb21BcnJheShuYW1lcy5tYXAoU3RyaW5nKSwgdHJ1ZSk7XG4gIHRoaXMuX3NvdXJjZXMgPSBBcnJheVNldC5mcm9tQXJyYXkoc291cmNlcywgdHJ1ZSk7XG5cbiAgdGhpcy5zb3VyY2VSb290ID0gc291cmNlUm9vdDtcbiAgdGhpcy5zb3VyY2VzQ29udGVudCA9IHNvdXJjZXNDb250ZW50O1xuICB0aGlzLl9tYXBwaW5ncyA9IG1hcHBpbmdzO1xuICB0aGlzLmZpbGUgPSBmaWxlO1xufVxuXG5CYXNpY1NvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZSA9IE9iamVjdC5jcmVhdGUoU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlKTtcbkJhc2ljU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlLmNvbnN1bWVyID0gU291cmNlTWFwQ29uc3VtZXI7XG5cbi8qKlxuICogQ3JlYXRlIGEgQmFzaWNTb3VyY2VNYXBDb25zdW1lciBmcm9tIGEgU291cmNlTWFwR2VuZXJhdG9yLlxuICpcbiAqIEBwYXJhbSBTb3VyY2VNYXBHZW5lcmF0b3IgYVNvdXJjZU1hcFxuICogICAgICAgIFRoZSBzb3VyY2UgbWFwIHRoYXQgd2lsbCBiZSBjb25zdW1lZC5cbiAqIEByZXR1cm5zIEJhc2ljU291cmNlTWFwQ29uc3VtZXJcbiAqL1xuQmFzaWNTb3VyY2VNYXBDb25zdW1lci5mcm9tU291cmNlTWFwID1cbiAgZnVuY3Rpb24gU291cmNlTWFwQ29uc3VtZXJfZnJvbVNvdXJjZU1hcChhU291cmNlTWFwKSB7XG4gICAgdmFyIHNtYyA9IE9iamVjdC5jcmVhdGUoQmFzaWNTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUpO1xuXG4gICAgdmFyIG5hbWVzID0gc21jLl9uYW1lcyA9IEFycmF5U2V0LmZyb21BcnJheShhU291cmNlTWFwLl9uYW1lcy50b0FycmF5KCksIHRydWUpO1xuICAgIHZhciBzb3VyY2VzID0gc21jLl9zb3VyY2VzID0gQXJyYXlTZXQuZnJvbUFycmF5KGFTb3VyY2VNYXAuX3NvdXJjZXMudG9BcnJheSgpLCB0cnVlKTtcbiAgICBzbWMuc291cmNlUm9vdCA9IGFTb3VyY2VNYXAuX3NvdXJjZVJvb3Q7XG4gICAgc21jLnNvdXJjZXNDb250ZW50ID0gYVNvdXJjZU1hcC5fZ2VuZXJhdGVTb3VyY2VzQ29udGVudChzbWMuX3NvdXJjZXMudG9BcnJheSgpLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc21jLnNvdXJjZVJvb3QpO1xuICAgIHNtYy5maWxlID0gYVNvdXJjZU1hcC5fZmlsZTtcblxuICAgIC8vIEJlY2F1c2Ugd2UgYXJlIG1vZGlmeWluZyB0aGUgZW50cmllcyAoYnkgY29udmVydGluZyBzdHJpbmcgc291cmNlcyBhbmRcbiAgICAvLyBuYW1lcyB0byBpbmRpY2VzIGludG8gdGhlIHNvdXJjZXMgYW5kIG5hbWVzIEFycmF5U2V0cyksIHdlIGhhdmUgdG8gbWFrZVxuICAgIC8vIGEgY29weSBvZiB0aGUgZW50cnkgb3IgZWxzZSBiYWQgdGhpbmdzIGhhcHBlbi4gU2hhcmVkIG11dGFibGUgc3RhdGVcbiAgICAvLyBzdHJpa2VzIGFnYWluISBTZWUgZ2l0aHViIGlzc3VlICMxOTEuXG5cbiAgICB2YXIgZ2VuZXJhdGVkTWFwcGluZ3MgPSBhU291cmNlTWFwLl9tYXBwaW5ncy50b0FycmF5KCkuc2xpY2UoKTtcbiAgICB2YXIgZGVzdEdlbmVyYXRlZE1hcHBpbmdzID0gc21jLl9fZ2VuZXJhdGVkTWFwcGluZ3MgPSBbXTtcbiAgICB2YXIgZGVzdE9yaWdpbmFsTWFwcGluZ3MgPSBzbWMuX19vcmlnaW5hbE1hcHBpbmdzID0gW107XG5cbiAgICBmb3IgKHZhciBpID0gMCwgbGVuZ3RoID0gZ2VuZXJhdGVkTWFwcGluZ3MubGVuZ3RoOyBpIDwgbGVuZ3RoOyBpKyspIHtcbiAgICAgIHZhciBzcmNNYXBwaW5nID0gZ2VuZXJhdGVkTWFwcGluZ3NbaV07XG4gICAgICB2YXIgZGVzdE1hcHBpbmcgPSBuZXcgTWFwcGluZztcbiAgICAgIGRlc3RNYXBwaW5nLmdlbmVyYXRlZExpbmUgPSBzcmNNYXBwaW5nLmdlbmVyYXRlZExpbmU7XG4gICAgICBkZXN0TWFwcGluZy5nZW5lcmF0ZWRDb2x1bW4gPSBzcmNNYXBwaW5nLmdlbmVyYXRlZENvbHVtbjtcblxuICAgICAgaWYgKHNyY01hcHBpbmcuc291cmNlKSB7XG4gICAgICAgIGRlc3RNYXBwaW5nLnNvdXJjZSA9IHNvdXJjZXMuaW5kZXhPZihzcmNNYXBwaW5nLnNvdXJjZSk7XG4gICAgICAgIGRlc3RNYXBwaW5nLm9yaWdpbmFsTGluZSA9IHNyY01hcHBpbmcub3JpZ2luYWxMaW5lO1xuICAgICAgICBkZXN0TWFwcGluZy5vcmlnaW5hbENvbHVtbiA9IHNyY01hcHBpbmcub3JpZ2luYWxDb2x1bW47XG5cbiAgICAgICAgaWYgKHNyY01hcHBpbmcubmFtZSkge1xuICAgICAgICAgIGRlc3RNYXBwaW5nLm5hbWUgPSBuYW1lcy5pbmRleE9mKHNyY01hcHBpbmcubmFtZSk7XG4gICAgICAgIH1cblxuICAgICAgICBkZXN0T3JpZ2luYWxNYXBwaW5ncy5wdXNoKGRlc3RNYXBwaW5nKTtcbiAgICAgIH1cblxuICAgICAgZGVzdEdlbmVyYXRlZE1hcHBpbmdzLnB1c2goZGVzdE1hcHBpbmcpO1xuICAgIH1cblxuICAgIHF1aWNrU29ydChzbWMuX19vcmlnaW5hbE1hcHBpbmdzLCB1dGlsLmNvbXBhcmVCeU9yaWdpbmFsUG9zaXRpb25zKTtcblxuICAgIHJldHVybiBzbWM7XG4gIH07XG5cbi8qKlxuICogVGhlIHZlcnNpb24gb2YgdGhlIHNvdXJjZSBtYXBwaW5nIHNwZWMgdGhhdCB3ZSBhcmUgY29uc3VtaW5nLlxuICovXG5CYXNpY1NvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5fdmVyc2lvbiA9IDM7XG5cbi8qKlxuICogVGhlIGxpc3Qgb2Ygb3JpZ2luYWwgc291cmNlcy5cbiAqL1xuT2JqZWN0LmRlZmluZVByb3BlcnR5KEJhc2ljU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlLCAnc291cmNlcycsIHtcbiAgZ2V0OiBmdW5jdGlvbiAoKSB7XG4gICAgcmV0dXJuIHRoaXMuX3NvdXJjZXMudG9BcnJheSgpLm1hcChmdW5jdGlvbiAocykge1xuICAgICAgcmV0dXJuIHRoaXMuc291cmNlUm9vdCAhPSBudWxsID8gdXRpbC5qb2luKHRoaXMuc291cmNlUm9vdCwgcykgOiBzO1xuICAgIH0sIHRoaXMpO1xuICB9XG59KTtcblxuLyoqXG4gKiBQcm92aWRlIHRoZSBKSVQgd2l0aCBhIG5pY2Ugc2hhcGUgLyBoaWRkZW4gY2xhc3MuXG4gKi9cbmZ1bmN0aW9uIE1hcHBpbmcoKSB7XG4gIHRoaXMuZ2VuZXJhdGVkTGluZSA9IDA7XG4gIHRoaXMuZ2VuZXJhdGVkQ29sdW1uID0gMDtcbiAgdGhpcy5zb3VyY2UgPSBudWxsO1xuICB0aGlzLm9yaWdpbmFsTGluZSA9IG51bGw7XG4gIHRoaXMub3JpZ2luYWxDb2x1bW4gPSBudWxsO1xuICB0aGlzLm5hbWUgPSBudWxsO1xufVxuXG4vKipcbiAqIFBhcnNlIHRoZSBtYXBwaW5ncyBpbiBhIHN0cmluZyBpbiB0byBhIGRhdGEgc3RydWN0dXJlIHdoaWNoIHdlIGNhbiBlYXNpbHlcbiAqIHF1ZXJ5ICh0aGUgb3JkZXJlZCBhcnJheXMgaW4gdGhlIGB0aGlzLl9fZ2VuZXJhdGVkTWFwcGluZ3NgIGFuZFxuICogYHRoaXMuX19vcmlnaW5hbE1hcHBpbmdzYCBwcm9wZXJ0aWVzKS5cbiAqL1xuQmFzaWNTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuX3BhcnNlTWFwcGluZ3MgPVxuICBmdW5jdGlvbiBTb3VyY2VNYXBDb25zdW1lcl9wYXJzZU1hcHBpbmdzKGFTdHIsIGFTb3VyY2VSb290KSB7XG4gICAgdmFyIGdlbmVyYXRlZExpbmUgPSAxO1xuICAgIHZhciBwcmV2aW91c0dlbmVyYXRlZENvbHVtbiA9IDA7XG4gICAgdmFyIHByZXZpb3VzT3JpZ2luYWxMaW5lID0gMDtcbiAgICB2YXIgcHJldmlvdXNPcmlnaW5hbENvbHVtbiA9IDA7XG4gICAgdmFyIHByZXZpb3VzU291cmNlID0gMDtcbiAgICB2YXIgcHJldmlvdXNOYW1lID0gMDtcbiAgICB2YXIgbGVuZ3RoID0gYVN0ci5sZW5ndGg7XG4gICAgdmFyIGluZGV4ID0gMDtcbiAgICB2YXIgY2FjaGVkU2VnbWVudHMgPSB7fTtcbiAgICB2YXIgdGVtcCA9IHt9O1xuICAgIHZhciBvcmlnaW5hbE1hcHBpbmdzID0gW107XG4gICAgdmFyIGdlbmVyYXRlZE1hcHBpbmdzID0gW107XG4gICAgdmFyIG1hcHBpbmcsIHN0ciwgc2VnbWVudCwgZW5kLCB2YWx1ZTtcblxuICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgaWYgKGFTdHIuY2hhckF0KGluZGV4KSA9PT0gJzsnKSB7XG4gICAgICAgIGdlbmVyYXRlZExpbmUrKztcbiAgICAgICAgaW5kZXgrKztcbiAgICAgICAgcHJldmlvdXNHZW5lcmF0ZWRDb2x1bW4gPSAwO1xuICAgICAgfVxuICAgICAgZWxzZSBpZiAoYVN0ci5jaGFyQXQoaW5kZXgpID09PSAnLCcpIHtcbiAgICAgICAgaW5kZXgrKztcbiAgICAgIH1cbiAgICAgIGVsc2Uge1xuICAgICAgICBtYXBwaW5nID0gbmV3IE1hcHBpbmcoKTtcbiAgICAgICAgbWFwcGluZy5nZW5lcmF0ZWRMaW5lID0gZ2VuZXJhdGVkTGluZTtcblxuICAgICAgICAvLyBCZWNhdXNlIGVhY2ggb2Zmc2V0IGlzIGVuY29kZWQgcmVsYXRpdmUgdG8gdGhlIHByZXZpb3VzIG9uZSxcbiAgICAgICAgLy8gbWFueSBzZWdtZW50cyBvZnRlbiBoYXZlIHRoZSBzYW1lIGVuY29kaW5nLiBXZSBjYW4gZXhwbG9pdCB0aGlzXG4gICAgICAgIC8vIGZhY3QgYnkgY2FjaGluZyB0aGUgcGFyc2VkIHZhcmlhYmxlIGxlbmd0aCBmaWVsZHMgb2YgZWFjaCBzZWdtZW50LFxuICAgICAgICAvLyBhbGxvd2luZyB1cyB0byBhdm9pZCBhIHNlY29uZCBwYXJzZSBpZiB3ZSBlbmNvdW50ZXIgdGhlIHNhbWVcbiAgICAgICAgLy8gc2VnbWVudCBhZ2Fpbi5cbiAgICAgICAgZm9yIChlbmQgPSBpbmRleDsgZW5kIDwgbGVuZ3RoOyBlbmQrKykge1xuICAgICAgICAgIGlmICh0aGlzLl9jaGFySXNNYXBwaW5nU2VwYXJhdG9yKGFTdHIsIGVuZCkpIHtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBzdHIgPSBhU3RyLnNsaWNlKGluZGV4LCBlbmQpO1xuXG4gICAgICAgIHNlZ21lbnQgPSBjYWNoZWRTZWdtZW50c1tzdHJdO1xuICAgICAgICBpZiAoc2VnbWVudCkge1xuICAgICAgICAgIGluZGV4ICs9IHN0ci5sZW5ndGg7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgc2VnbWVudCA9IFtdO1xuICAgICAgICAgIHdoaWxlIChpbmRleCA8IGVuZCkge1xuICAgICAgICAgICAgYmFzZTY0VkxRLmRlY29kZShhU3RyLCBpbmRleCwgdGVtcCk7XG4gICAgICAgICAgICB2YWx1ZSA9IHRlbXAudmFsdWU7XG4gICAgICAgICAgICBpbmRleCA9IHRlbXAucmVzdDtcbiAgICAgICAgICAgIHNlZ21lbnQucHVzaCh2YWx1ZSk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHNlZ21lbnQubGVuZ3RoID09PSAyKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ZvdW5kIGEgc291cmNlLCBidXQgbm8gbGluZSBhbmQgY29sdW1uJyk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHNlZ21lbnQubGVuZ3RoID09PSAzKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ZvdW5kIGEgc291cmNlIGFuZCBsaW5lLCBidXQgbm8gY29sdW1uJyk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgY2FjaGVkU2VnbWVudHNbc3RyXSA9IHNlZ21lbnQ7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBHZW5lcmF0ZWQgY29sdW1uLlxuICAgICAgICBtYXBwaW5nLmdlbmVyYXRlZENvbHVtbiA9IHByZXZpb3VzR2VuZXJhdGVkQ29sdW1uICsgc2VnbWVudFswXTtcbiAgICAgICAgcHJldmlvdXNHZW5lcmF0ZWRDb2x1bW4gPSBtYXBwaW5nLmdlbmVyYXRlZENvbHVtbjtcblxuICAgICAgICBpZiAoc2VnbWVudC5sZW5ndGggPiAxKSB7XG4gICAgICAgICAgLy8gT3JpZ2luYWwgc291cmNlLlxuICAgICAgICAgIG1hcHBpbmcuc291cmNlID0gcHJldmlvdXNTb3VyY2UgKyBzZWdtZW50WzFdO1xuICAgICAgICAgIHByZXZpb3VzU291cmNlICs9IHNlZ21lbnRbMV07XG5cbiAgICAgICAgICAvLyBPcmlnaW5hbCBsaW5lLlxuICAgICAgICAgIG1hcHBpbmcub3JpZ2luYWxMaW5lID0gcHJldmlvdXNPcmlnaW5hbExpbmUgKyBzZWdtZW50WzJdO1xuICAgICAgICAgIHByZXZpb3VzT3JpZ2luYWxMaW5lID0gbWFwcGluZy5vcmlnaW5hbExpbmU7XG4gICAgICAgICAgLy8gTGluZXMgYXJlIHN0b3JlZCAwLWJhc2VkXG4gICAgICAgICAgbWFwcGluZy5vcmlnaW5hbExpbmUgKz0gMTtcblxuICAgICAgICAgIC8vIE9yaWdpbmFsIGNvbHVtbi5cbiAgICAgICAgICBtYXBwaW5nLm9yaWdpbmFsQ29sdW1uID0gcHJldmlvdXNPcmlnaW5hbENvbHVtbiArIHNlZ21lbnRbM107XG4gICAgICAgICAgcHJldmlvdXNPcmlnaW5hbENvbHVtbiA9IG1hcHBpbmcub3JpZ2luYWxDb2x1bW47XG5cbiAgICAgICAgICBpZiAoc2VnbWVudC5sZW5ndGggPiA0KSB7XG4gICAgICAgICAgICAvLyBPcmlnaW5hbCBuYW1lLlxuICAgICAgICAgICAgbWFwcGluZy5uYW1lID0gcHJldmlvdXNOYW1lICsgc2VnbWVudFs0XTtcbiAgICAgICAgICAgIHByZXZpb3VzTmFtZSArPSBzZWdtZW50WzRdO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGdlbmVyYXRlZE1hcHBpbmdzLnB1c2gobWFwcGluZyk7XG4gICAgICAgIGlmICh0eXBlb2YgbWFwcGluZy5vcmlnaW5hbExpbmUgPT09ICdudW1iZXInKSB7XG4gICAgICAgICAgb3JpZ2luYWxNYXBwaW5ncy5wdXNoKG1hcHBpbmcpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgcXVpY2tTb3J0KGdlbmVyYXRlZE1hcHBpbmdzLCB1dGlsLmNvbXBhcmVCeUdlbmVyYXRlZFBvc2l0aW9uc0RlZmxhdGVkKTtcbiAgICB0aGlzLl9fZ2VuZXJhdGVkTWFwcGluZ3MgPSBnZW5lcmF0ZWRNYXBwaW5ncztcblxuICAgIHF1aWNrU29ydChvcmlnaW5hbE1hcHBpbmdzLCB1dGlsLmNvbXBhcmVCeU9yaWdpbmFsUG9zaXRpb25zKTtcbiAgICB0aGlzLl9fb3JpZ2luYWxNYXBwaW5ncyA9IG9yaWdpbmFsTWFwcGluZ3M7XG4gIH07XG5cbi8qKlxuICogRmluZCB0aGUgbWFwcGluZyB0aGF0IGJlc3QgbWF0Y2hlcyB0aGUgaHlwb3RoZXRpY2FsIFwibmVlZGxlXCIgbWFwcGluZyB0aGF0XG4gKiB3ZSBhcmUgc2VhcmNoaW5nIGZvciBpbiB0aGUgZ2l2ZW4gXCJoYXlzdGFja1wiIG9mIG1hcHBpbmdzLlxuICovXG5CYXNpY1NvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5fZmluZE1hcHBpbmcgPVxuICBmdW5jdGlvbiBTb3VyY2VNYXBDb25zdW1lcl9maW5kTWFwcGluZyhhTmVlZGxlLCBhTWFwcGluZ3MsIGFMaW5lTmFtZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYUNvbHVtbk5hbWUsIGFDb21wYXJhdG9yLCBhQmlhcykge1xuICAgIC8vIFRvIHJldHVybiB0aGUgcG9zaXRpb24gd2UgYXJlIHNlYXJjaGluZyBmb3IsIHdlIG11c3QgZmlyc3QgZmluZCB0aGVcbiAgICAvLyBtYXBwaW5nIGZvciB0aGUgZ2l2ZW4gcG9zaXRpb24gYW5kIHRoZW4gcmV0dXJuIHRoZSBvcHBvc2l0ZSBwb3NpdGlvbiBpdFxuICAgIC8vIHBvaW50cyB0by4gQmVjYXVzZSB0aGUgbWFwcGluZ3MgYXJlIHNvcnRlZCwgd2UgY2FuIHVzZSBiaW5hcnkgc2VhcmNoIHRvXG4gICAgLy8gZmluZCB0aGUgYmVzdCBtYXBwaW5nLlxuXG4gICAgaWYgKGFOZWVkbGVbYUxpbmVOYW1lXSA8PSAwKSB7XG4gICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdMaW5lIG11c3QgYmUgZ3JlYXRlciB0aGFuIG9yIGVxdWFsIHRvIDEsIGdvdCAnXG4gICAgICAgICAgICAgICAgICAgICAgICAgICsgYU5lZWRsZVthTGluZU5hbWVdKTtcbiAgICB9XG4gICAgaWYgKGFOZWVkbGVbYUNvbHVtbk5hbWVdIDwgMCkge1xuICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQ29sdW1uIG11c3QgYmUgZ3JlYXRlciB0aGFuIG9yIGVxdWFsIHRvIDAsIGdvdCAnXG4gICAgICAgICAgICAgICAgICAgICAgICAgICsgYU5lZWRsZVthQ29sdW1uTmFtZV0pO1xuICAgIH1cblxuICAgIHJldHVybiBiaW5hcnlTZWFyY2guc2VhcmNoKGFOZWVkbGUsIGFNYXBwaW5ncywgYUNvbXBhcmF0b3IsIGFCaWFzKTtcbiAgfTtcblxuLyoqXG4gKiBDb21wdXRlIHRoZSBsYXN0IGNvbHVtbiBmb3IgZWFjaCBnZW5lcmF0ZWQgbWFwcGluZy4gVGhlIGxhc3QgY29sdW1uIGlzXG4gKiBpbmNsdXNpdmUuXG4gKi9cbkJhc2ljU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlLmNvbXB1dGVDb2x1bW5TcGFucyA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcENvbnN1bWVyX2NvbXB1dGVDb2x1bW5TcGFucygpIHtcbiAgICBmb3IgKHZhciBpbmRleCA9IDA7IGluZGV4IDwgdGhpcy5fZ2VuZXJhdGVkTWFwcGluZ3MubGVuZ3RoOyArK2luZGV4KSB7XG4gICAgICB2YXIgbWFwcGluZyA9IHRoaXMuX2dlbmVyYXRlZE1hcHBpbmdzW2luZGV4XTtcblxuICAgICAgLy8gTWFwcGluZ3MgZG8gbm90IGNvbnRhaW4gYSBmaWVsZCBmb3IgdGhlIGxhc3QgZ2VuZXJhdGVkIGNvbHVtbnQuIFdlXG4gICAgICAvLyBjYW4gY29tZSB1cCB3aXRoIGFuIG9wdGltaXN0aWMgZXN0aW1hdGUsIGhvd2V2ZXIsIGJ5IGFzc3VtaW5nIHRoYXRcbiAgICAgIC8vIG1hcHBpbmdzIGFyZSBjb250aWd1b3VzIChpLmUuIGdpdmVuIHR3byBjb25zZWN1dGl2ZSBtYXBwaW5ncywgdGhlXG4gICAgICAvLyBmaXJzdCBtYXBwaW5nIGVuZHMgd2hlcmUgdGhlIHNlY29uZCBvbmUgc3RhcnRzKS5cbiAgICAgIGlmIChpbmRleCArIDEgPCB0aGlzLl9nZW5lcmF0ZWRNYXBwaW5ncy5sZW5ndGgpIHtcbiAgICAgICAgdmFyIG5leHRNYXBwaW5nID0gdGhpcy5fZ2VuZXJhdGVkTWFwcGluZ3NbaW5kZXggKyAxXTtcblxuICAgICAgICBpZiAobWFwcGluZy5nZW5lcmF0ZWRMaW5lID09PSBuZXh0TWFwcGluZy5nZW5lcmF0ZWRMaW5lKSB7XG4gICAgICAgICAgbWFwcGluZy5sYXN0R2VuZXJhdGVkQ29sdW1uID0gbmV4dE1hcHBpbmcuZ2VuZXJhdGVkQ29sdW1uIC0gMTtcbiAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICAvLyBUaGUgbGFzdCBtYXBwaW5nIGZvciBlYWNoIGxpbmUgc3BhbnMgdGhlIGVudGlyZSBsaW5lLlxuICAgICAgbWFwcGluZy5sYXN0R2VuZXJhdGVkQ29sdW1uID0gSW5maW5pdHk7XG4gICAgfVxuICB9O1xuXG4vKipcbiAqIFJldHVybnMgdGhlIG9yaWdpbmFsIHNvdXJjZSwgbGluZSwgYW5kIGNvbHVtbiBpbmZvcm1hdGlvbiBmb3IgdGhlIGdlbmVyYXRlZFxuICogc291cmNlJ3MgbGluZSBhbmQgY29sdW1uIHBvc2l0aW9ucyBwcm92aWRlZC4gVGhlIG9ubHkgYXJndW1lbnQgaXMgYW4gb2JqZWN0XG4gKiB3aXRoIHRoZSBmb2xsb3dpbmcgcHJvcGVydGllczpcbiAqXG4gKiAgIC0gbGluZTogVGhlIGxpbmUgbnVtYmVyIGluIHRoZSBnZW5lcmF0ZWQgc291cmNlLlxuICogICAtIGNvbHVtbjogVGhlIGNvbHVtbiBudW1iZXIgaW4gdGhlIGdlbmVyYXRlZCBzb3VyY2UuXG4gKiAgIC0gYmlhczogRWl0aGVyICdTb3VyY2VNYXBDb25zdW1lci5HUkVBVEVTVF9MT1dFUl9CT1VORCcgb3JcbiAqICAgICAnU291cmNlTWFwQ29uc3VtZXIuTEVBU1RfVVBQRVJfQk9VTkQnLiBTcGVjaWZpZXMgd2hldGhlciB0byByZXR1cm4gdGhlXG4gKiAgICAgY2xvc2VzdCBlbGVtZW50IHRoYXQgaXMgc21hbGxlciB0aGFuIG9yIGdyZWF0ZXIgdGhhbiB0aGUgb25lIHdlIGFyZVxuICogICAgIHNlYXJjaGluZyBmb3IsIHJlc3BlY3RpdmVseSwgaWYgdGhlIGV4YWN0IGVsZW1lbnQgY2Fubm90IGJlIGZvdW5kLlxuICogICAgIERlZmF1bHRzIHRvICdTb3VyY2VNYXBDb25zdW1lci5HUkVBVEVTVF9MT1dFUl9CT1VORCcuXG4gKlxuICogYW5kIGFuIG9iamVjdCBpcyByZXR1cm5lZCB3aXRoIHRoZSBmb2xsb3dpbmcgcHJvcGVydGllczpcbiAqXG4gKiAgIC0gc291cmNlOiBUaGUgb3JpZ2luYWwgc291cmNlIGZpbGUsIG9yIG51bGwuXG4gKiAgIC0gbGluZTogVGhlIGxpbmUgbnVtYmVyIGluIHRoZSBvcmlnaW5hbCBzb3VyY2UsIG9yIG51bGwuXG4gKiAgIC0gY29sdW1uOiBUaGUgY29sdW1uIG51bWJlciBpbiB0aGUgb3JpZ2luYWwgc291cmNlLCBvciBudWxsLlxuICogICAtIG5hbWU6IFRoZSBvcmlnaW5hbCBpZGVudGlmaWVyLCBvciBudWxsLlxuICovXG5CYXNpY1NvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5vcmlnaW5hbFBvc2l0aW9uRm9yID1cbiAgZnVuY3Rpb24gU291cmNlTWFwQ29uc3VtZXJfb3JpZ2luYWxQb3NpdGlvbkZvcihhQXJncykge1xuICAgIHZhciBuZWVkbGUgPSB7XG4gICAgICBnZW5lcmF0ZWRMaW5lOiB1dGlsLmdldEFyZyhhQXJncywgJ2xpbmUnKSxcbiAgICAgIGdlbmVyYXRlZENvbHVtbjogdXRpbC5nZXRBcmcoYUFyZ3MsICdjb2x1bW4nKVxuICAgIH07XG5cbiAgICB2YXIgaW5kZXggPSB0aGlzLl9maW5kTWFwcGluZyhcbiAgICAgIG5lZWRsZSxcbiAgICAgIHRoaXMuX2dlbmVyYXRlZE1hcHBpbmdzLFxuICAgICAgXCJnZW5lcmF0ZWRMaW5lXCIsXG4gICAgICBcImdlbmVyYXRlZENvbHVtblwiLFxuICAgICAgdXRpbC5jb21wYXJlQnlHZW5lcmF0ZWRQb3NpdGlvbnNEZWZsYXRlZCxcbiAgICAgIHV0aWwuZ2V0QXJnKGFBcmdzLCAnYmlhcycsIFNvdXJjZU1hcENvbnN1bWVyLkdSRUFURVNUX0xPV0VSX0JPVU5EKVxuICAgICk7XG5cbiAgICBpZiAoaW5kZXggPj0gMCkge1xuICAgICAgdmFyIG1hcHBpbmcgPSB0aGlzLl9nZW5lcmF0ZWRNYXBwaW5nc1tpbmRleF07XG5cbiAgICAgIGlmIChtYXBwaW5nLmdlbmVyYXRlZExpbmUgPT09IG5lZWRsZS5nZW5lcmF0ZWRMaW5lKSB7XG4gICAgICAgIHZhciBzb3VyY2UgPSB1dGlsLmdldEFyZyhtYXBwaW5nLCAnc291cmNlJywgbnVsbCk7XG4gICAgICAgIGlmIChzb3VyY2UgIT09IG51bGwpIHtcbiAgICAgICAgICBzb3VyY2UgPSB0aGlzLl9zb3VyY2VzLmF0KHNvdXJjZSk7XG4gICAgICAgICAgaWYgKHRoaXMuc291cmNlUm9vdCAhPSBudWxsKSB7XG4gICAgICAgICAgICBzb3VyY2UgPSB1dGlsLmpvaW4odGhpcy5zb3VyY2VSb290LCBzb3VyY2UpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB2YXIgbmFtZSA9IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICduYW1lJywgbnVsbCk7XG4gICAgICAgIGlmIChuYW1lICE9PSBudWxsKSB7XG4gICAgICAgICAgbmFtZSA9IHRoaXMuX25hbWVzLmF0KG5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgc291cmNlOiBzb3VyY2UsXG4gICAgICAgICAgbGluZTogdXRpbC5nZXRBcmcobWFwcGluZywgJ29yaWdpbmFsTGluZScsIG51bGwpLFxuICAgICAgICAgIGNvbHVtbjogdXRpbC5nZXRBcmcobWFwcGluZywgJ29yaWdpbmFsQ29sdW1uJywgbnVsbCksXG4gICAgICAgICAgbmFtZTogbmFtZVxuICAgICAgICB9O1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiB7XG4gICAgICBzb3VyY2U6IG51bGwsXG4gICAgICBsaW5lOiBudWxsLFxuICAgICAgY29sdW1uOiBudWxsLFxuICAgICAgbmFtZTogbnVsbFxuICAgIH07XG4gIH07XG5cbi8qKlxuICogUmV0dXJuIHRydWUgaWYgd2UgaGF2ZSB0aGUgc291cmNlIGNvbnRlbnQgZm9yIGV2ZXJ5IHNvdXJjZSBpbiB0aGUgc291cmNlXG4gKiBtYXAsIGZhbHNlIG90aGVyd2lzZS5cbiAqL1xuQmFzaWNTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuaGFzQ29udGVudHNPZkFsbFNvdXJjZXMgPVxuICBmdW5jdGlvbiBCYXNpY1NvdXJjZU1hcENvbnN1bWVyX2hhc0NvbnRlbnRzT2ZBbGxTb3VyY2VzKCkge1xuICAgIGlmICghdGhpcy5zb3VyY2VzQ29udGVudCkge1xuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cbiAgICByZXR1cm4gdGhpcy5zb3VyY2VzQ29udGVudC5sZW5ndGggPj0gdGhpcy5fc291cmNlcy5zaXplKCkgJiZcbiAgICAgICF0aGlzLnNvdXJjZXNDb250ZW50LnNvbWUoZnVuY3Rpb24gKHNjKSB7IHJldHVybiBzYyA9PSBudWxsOyB9KTtcbiAgfTtcblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBvcmlnaW5hbCBzb3VyY2UgY29udGVudC4gVGhlIG9ubHkgYXJndW1lbnQgaXMgdGhlIHVybCBvZiB0aGVcbiAqIG9yaWdpbmFsIHNvdXJjZSBmaWxlLiBSZXR1cm5zIG51bGwgaWYgbm8gb3JpZ2luYWwgc291cmNlIGNvbnRlbnQgaXNcbiAqIGF2YWlsYWJsZS5cbiAqL1xuQmFzaWNTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuc291cmNlQ29udGVudEZvciA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcENvbnN1bWVyX3NvdXJjZUNvbnRlbnRGb3IoYVNvdXJjZSwgbnVsbE9uTWlzc2luZykge1xuICAgIGlmICghdGhpcy5zb3VyY2VzQ29udGVudCkge1xuICAgICAgcmV0dXJuIG51bGw7XG4gICAgfVxuXG4gICAgaWYgKHRoaXMuc291cmNlUm9vdCAhPSBudWxsKSB7XG4gICAgICBhU291cmNlID0gdXRpbC5yZWxhdGl2ZSh0aGlzLnNvdXJjZVJvb3QsIGFTb3VyY2UpO1xuICAgIH1cblxuICAgIGlmICh0aGlzLl9zb3VyY2VzLmhhcyhhU291cmNlKSkge1xuICAgICAgcmV0dXJuIHRoaXMuc291cmNlc0NvbnRlbnRbdGhpcy5fc291cmNlcy5pbmRleE9mKGFTb3VyY2UpXTtcbiAgICB9XG5cbiAgICB2YXIgdXJsO1xuICAgIGlmICh0aGlzLnNvdXJjZVJvb3QgIT0gbnVsbFxuICAgICAgICAmJiAodXJsID0gdXRpbC51cmxQYXJzZSh0aGlzLnNvdXJjZVJvb3QpKSkge1xuICAgICAgLy8gWFhYOiBmaWxlOi8vIFVSSXMgYW5kIGFic29sdXRlIHBhdGhzIGxlYWQgdG8gdW5leHBlY3RlZCBiZWhhdmlvciBmb3JcbiAgICAgIC8vIG1hbnkgdXNlcnMuIFdlIGNhbiBoZWxwIHRoZW0gb3V0IHdoZW4gdGhleSBleHBlY3QgZmlsZTovLyBVUklzIHRvXG4gICAgICAvLyBiZWhhdmUgbGlrZSBpdCB3b3VsZCBpZiB0aGV5IHdlcmUgcnVubmluZyBhIGxvY2FsIEhUVFAgc2VydmVyLiBTZWVcbiAgICAgIC8vIGh0dHBzOi8vYnVnemlsbGEubW96aWxsYS5vcmcvc2hvd19idWcuY2dpP2lkPTg4NTU5Ny5cbiAgICAgIHZhciBmaWxlVXJpQWJzUGF0aCA9IGFTb3VyY2UucmVwbGFjZSgvXmZpbGU6XFwvXFwvLywgXCJcIik7XG4gICAgICBpZiAodXJsLnNjaGVtZSA9PSBcImZpbGVcIlxuICAgICAgICAgICYmIHRoaXMuX3NvdXJjZXMuaGFzKGZpbGVVcmlBYnNQYXRoKSkge1xuICAgICAgICByZXR1cm4gdGhpcy5zb3VyY2VzQ29udGVudFt0aGlzLl9zb3VyY2VzLmluZGV4T2YoZmlsZVVyaUFic1BhdGgpXVxuICAgICAgfVxuXG4gICAgICBpZiAoKCF1cmwucGF0aCB8fCB1cmwucGF0aCA9PSBcIi9cIilcbiAgICAgICAgICAmJiB0aGlzLl9zb3VyY2VzLmhhcyhcIi9cIiArIGFTb3VyY2UpKSB7XG4gICAgICAgIHJldHVybiB0aGlzLnNvdXJjZXNDb250ZW50W3RoaXMuX3NvdXJjZXMuaW5kZXhPZihcIi9cIiArIGFTb3VyY2UpXTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICAvLyBUaGlzIGZ1bmN0aW9uIGlzIHVzZWQgcmVjdXJzaXZlbHkgZnJvbVxuICAgIC8vIEluZGV4ZWRTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuc291cmNlQ29udGVudEZvci4gSW4gdGhhdCBjYXNlLCB3ZVxuICAgIC8vIGRvbid0IHdhbnQgdG8gdGhyb3cgaWYgd2UgY2FuJ3QgZmluZCB0aGUgc291cmNlIC0gd2UganVzdCB3YW50IHRvXG4gICAgLy8gcmV0dXJuIG51bGwsIHNvIHdlIHByb3ZpZGUgYSBmbGFnIHRvIGV4aXQgZ3JhY2VmdWxseS5cbiAgICBpZiAobnVsbE9uTWlzc2luZykge1xuICAgICAgcmV0dXJuIG51bGw7XG4gICAgfVxuICAgIGVsc2Uge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKCdcIicgKyBhU291cmNlICsgJ1wiIGlzIG5vdCBpbiB0aGUgU291cmNlTWFwLicpO1xuICAgIH1cbiAgfTtcblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBnZW5lcmF0ZWQgbGluZSBhbmQgY29sdW1uIGluZm9ybWF0aW9uIGZvciB0aGUgb3JpZ2luYWwgc291cmNlLFxuICogbGluZSwgYW5kIGNvbHVtbiBwb3NpdGlvbnMgcHJvdmlkZWQuIFRoZSBvbmx5IGFyZ3VtZW50IGlzIGFuIG9iamVjdCB3aXRoXG4gKiB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIHNvdXJjZTogVGhlIGZpbGVuYW1lIG9mIHRoZSBvcmlnaW5hbCBzb3VyY2UuXG4gKiAgIC0gbGluZTogVGhlIGxpbmUgbnVtYmVyIGluIHRoZSBvcmlnaW5hbCBzb3VyY2UuXG4gKiAgIC0gY29sdW1uOiBUaGUgY29sdW1uIG51bWJlciBpbiB0aGUgb3JpZ2luYWwgc291cmNlLlxuICogICAtIGJpYXM6IEVpdGhlciAnU291cmNlTWFwQ29uc3VtZXIuR1JFQVRFU1RfTE9XRVJfQk9VTkQnIG9yXG4gKiAgICAgJ1NvdXJjZU1hcENvbnN1bWVyLkxFQVNUX1VQUEVSX0JPVU5EJy4gU3BlY2lmaWVzIHdoZXRoZXIgdG8gcmV0dXJuIHRoZVxuICogICAgIGNsb3Nlc3QgZWxlbWVudCB0aGF0IGlzIHNtYWxsZXIgdGhhbiBvciBncmVhdGVyIHRoYW4gdGhlIG9uZSB3ZSBhcmVcbiAqICAgICBzZWFyY2hpbmcgZm9yLCByZXNwZWN0aXZlbHksIGlmIHRoZSBleGFjdCBlbGVtZW50IGNhbm5vdCBiZSBmb3VuZC5cbiAqICAgICBEZWZhdWx0cyB0byAnU291cmNlTWFwQ29uc3VtZXIuR1JFQVRFU1RfTE9XRVJfQk9VTkQnLlxuICpcbiAqIGFuZCBhbiBvYmplY3QgaXMgcmV0dXJuZWQgd2l0aCB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIGxpbmU6IFRoZSBsaW5lIG51bWJlciBpbiB0aGUgZ2VuZXJhdGVkIHNvdXJjZSwgb3IgbnVsbC5cbiAqICAgLSBjb2x1bW46IFRoZSBjb2x1bW4gbnVtYmVyIGluIHRoZSBnZW5lcmF0ZWQgc291cmNlLCBvciBudWxsLlxuICovXG5CYXNpY1NvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5nZW5lcmF0ZWRQb3NpdGlvbkZvciA9XG4gIGZ1bmN0aW9uIFNvdXJjZU1hcENvbnN1bWVyX2dlbmVyYXRlZFBvc2l0aW9uRm9yKGFBcmdzKSB7XG4gICAgdmFyIHNvdXJjZSA9IHV0aWwuZ2V0QXJnKGFBcmdzLCAnc291cmNlJyk7XG4gICAgaWYgKHRoaXMuc291cmNlUm9vdCAhPSBudWxsKSB7XG4gICAgICBzb3VyY2UgPSB1dGlsLnJlbGF0aXZlKHRoaXMuc291cmNlUm9vdCwgc291cmNlKTtcbiAgICB9XG4gICAgaWYgKCF0aGlzLl9zb3VyY2VzLmhhcyhzb3VyY2UpKSB7XG4gICAgICByZXR1cm4ge1xuICAgICAgICBsaW5lOiBudWxsLFxuICAgICAgICBjb2x1bW46IG51bGwsXG4gICAgICAgIGxhc3RDb2x1bW46IG51bGxcbiAgICAgIH07XG4gICAgfVxuICAgIHNvdXJjZSA9IHRoaXMuX3NvdXJjZXMuaW5kZXhPZihzb3VyY2UpO1xuXG4gICAgdmFyIG5lZWRsZSA9IHtcbiAgICAgIHNvdXJjZTogc291cmNlLFxuICAgICAgb3JpZ2luYWxMaW5lOiB1dGlsLmdldEFyZyhhQXJncywgJ2xpbmUnKSxcbiAgICAgIG9yaWdpbmFsQ29sdW1uOiB1dGlsLmdldEFyZyhhQXJncywgJ2NvbHVtbicpXG4gICAgfTtcblxuICAgIHZhciBpbmRleCA9IHRoaXMuX2ZpbmRNYXBwaW5nKFxuICAgICAgbmVlZGxlLFxuICAgICAgdGhpcy5fb3JpZ2luYWxNYXBwaW5ncyxcbiAgICAgIFwib3JpZ2luYWxMaW5lXCIsXG4gICAgICBcIm9yaWdpbmFsQ29sdW1uXCIsXG4gICAgICB1dGlsLmNvbXBhcmVCeU9yaWdpbmFsUG9zaXRpb25zLFxuICAgICAgdXRpbC5nZXRBcmcoYUFyZ3MsICdiaWFzJywgU291cmNlTWFwQ29uc3VtZXIuR1JFQVRFU1RfTE9XRVJfQk9VTkQpXG4gICAgKTtcblxuICAgIGlmIChpbmRleCA+PSAwKSB7XG4gICAgICB2YXIgbWFwcGluZyA9IHRoaXMuX29yaWdpbmFsTWFwcGluZ3NbaW5kZXhdO1xuXG4gICAgICBpZiAobWFwcGluZy5zb3VyY2UgPT09IG5lZWRsZS5zb3VyY2UpIHtcbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICBsaW5lOiB1dGlsLmdldEFyZyhtYXBwaW5nLCAnZ2VuZXJhdGVkTGluZScsIG51bGwpLFxuICAgICAgICAgIGNvbHVtbjogdXRpbC5nZXRBcmcobWFwcGluZywgJ2dlbmVyYXRlZENvbHVtbicsIG51bGwpLFxuICAgICAgICAgIGxhc3RDb2x1bW46IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdsYXN0R2VuZXJhdGVkQ29sdW1uJywgbnVsbClcbiAgICAgICAgfTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4ge1xuICAgICAgbGluZTogbnVsbCxcbiAgICAgIGNvbHVtbjogbnVsbCxcbiAgICAgIGxhc3RDb2x1bW46IG51bGxcbiAgICB9O1xuICB9O1xuXG5leHBvcnRzLkJhc2ljU291cmNlTWFwQ29uc3VtZXIgPSBCYXNpY1NvdXJjZU1hcENvbnN1bWVyO1xuXG4vKipcbiAqIEFuIEluZGV4ZWRTb3VyY2VNYXBDb25zdW1lciBpbnN0YW5jZSByZXByZXNlbnRzIGEgcGFyc2VkIHNvdXJjZSBtYXAgd2hpY2hcbiAqIHdlIGNhbiBxdWVyeSBmb3IgaW5mb3JtYXRpb24uIEl0IGRpZmZlcnMgZnJvbSBCYXNpY1NvdXJjZU1hcENvbnN1bWVyIGluXG4gKiB0aGF0IGl0IHRha2VzIFwiaW5kZXhlZFwiIHNvdXJjZSBtYXBzIChpLmUuIG9uZXMgd2l0aCBhIFwic2VjdGlvbnNcIiBmaWVsZCkgYXNcbiAqIGlucHV0LlxuICpcbiAqIFRoZSBvbmx5IHBhcmFtZXRlciBpcyBhIHJhdyBzb3VyY2UgbWFwIChlaXRoZXIgYXMgYSBKU09OIHN0cmluZywgb3IgYWxyZWFkeVxuICogcGFyc2VkIHRvIGFuIG9iamVjdCkuIEFjY29yZGluZyB0byB0aGUgc3BlYyBmb3IgaW5kZXhlZCBzb3VyY2UgbWFwcywgdGhleVxuICogaGF2ZSB0aGUgZm9sbG93aW5nIGF0dHJpYnV0ZXM6XG4gKlxuICogICAtIHZlcnNpb246IFdoaWNoIHZlcnNpb24gb2YgdGhlIHNvdXJjZSBtYXAgc3BlYyB0aGlzIG1hcCBpcyBmb2xsb3dpbmcuXG4gKiAgIC0gZmlsZTogT3B0aW9uYWwuIFRoZSBnZW5lcmF0ZWQgZmlsZSB0aGlzIHNvdXJjZSBtYXAgaXMgYXNzb2NpYXRlZCB3aXRoLlxuICogICAtIHNlY3Rpb25zOiBBIGxpc3Qgb2Ygc2VjdGlvbiBkZWZpbml0aW9ucy5cbiAqXG4gKiBFYWNoIHZhbHVlIHVuZGVyIHRoZSBcInNlY3Rpb25zXCIgZmllbGQgaGFzIHR3byBmaWVsZHM6XG4gKiAgIC0gb2Zmc2V0OiBUaGUgb2Zmc2V0IGludG8gdGhlIG9yaWdpbmFsIHNwZWNpZmllZCBhdCB3aGljaCB0aGlzIHNlY3Rpb25cbiAqICAgICAgIGJlZ2lucyB0byBhcHBseSwgZGVmaW5lZCBhcyBhbiBvYmplY3Qgd2l0aCBhIFwibGluZVwiIGFuZCBcImNvbHVtblwiXG4gKiAgICAgICBmaWVsZC5cbiAqICAgLSBtYXA6IEEgc291cmNlIG1hcCBkZWZpbml0aW9uLiBUaGlzIHNvdXJjZSBtYXAgY291bGQgYWxzbyBiZSBpbmRleGVkLFxuICogICAgICAgYnV0IGRvZXNuJ3QgaGF2ZSB0byBiZS5cbiAqXG4gKiBJbnN0ZWFkIG9mIHRoZSBcIm1hcFwiIGZpZWxkLCBpdCdzIGFsc28gcG9zc2libGUgdG8gaGF2ZSBhIFwidXJsXCIgZmllbGRcbiAqIHNwZWNpZnlpbmcgYSBVUkwgdG8gcmV0cmlldmUgYSBzb3VyY2UgbWFwIGZyb20sIGJ1dCB0aGF0J3MgY3VycmVudGx5XG4gKiB1bnN1cHBvcnRlZC5cbiAqXG4gKiBIZXJlJ3MgYW4gZXhhbXBsZSBzb3VyY2UgbWFwLCB0YWtlbiBmcm9tIHRoZSBzb3VyY2UgbWFwIHNwZWNbMF0sIGJ1dFxuICogbW9kaWZpZWQgdG8gb21pdCBhIHNlY3Rpb24gd2hpY2ggdXNlcyB0aGUgXCJ1cmxcIiBmaWVsZC5cbiAqXG4gKiAge1xuICogICAgdmVyc2lvbiA6IDMsXG4gKiAgICBmaWxlOiBcImFwcC5qc1wiLFxuICogICAgc2VjdGlvbnM6IFt7XG4gKiAgICAgIG9mZnNldDoge2xpbmU6MTAwLCBjb2x1bW46MTB9LFxuICogICAgICBtYXA6IHtcbiAqICAgICAgICB2ZXJzaW9uIDogMyxcbiAqICAgICAgICBmaWxlOiBcInNlY3Rpb24uanNcIixcbiAqICAgICAgICBzb3VyY2VzOiBbXCJmb28uanNcIiwgXCJiYXIuanNcIl0sXG4gKiAgICAgICAgbmFtZXM6IFtcInNyY1wiLCBcIm1hcHNcIiwgXCJhcmVcIiwgXCJmdW5cIl0sXG4gKiAgICAgICAgbWFwcGluZ3M6IFwiQUFBQSxFOztBQkNERTtcIlxuICogICAgICB9XG4gKiAgICB9XSxcbiAqICB9XG4gKlxuICogWzBdOiBodHRwczovL2RvY3MuZ29vZ2xlLmNvbS9kb2N1bWVudC9kLzFVMVJHQWVoUXdSeXBVVG92RjFLUmxwaU9GemUwYi1fMmdjNmZBSDBLWTBrL2VkaXQjaGVhZGluZz1oLjUzNWVzM3hlcHJndFxuICovXG5mdW5jdGlvbiBJbmRleGVkU291cmNlTWFwQ29uc3VtZXIoYVNvdXJjZU1hcCkge1xuICB2YXIgc291cmNlTWFwID0gYVNvdXJjZU1hcDtcbiAgaWYgKHR5cGVvZiBhU291cmNlTWFwID09PSAnc3RyaW5nJykge1xuICAgIHNvdXJjZU1hcCA9IEpTT04ucGFyc2UoYVNvdXJjZU1hcC5yZXBsYWNlKC9eXFwpXFxdXFx9Jy8sICcnKSk7XG4gIH1cblxuICB2YXIgdmVyc2lvbiA9IHV0aWwuZ2V0QXJnKHNvdXJjZU1hcCwgJ3ZlcnNpb24nKTtcbiAgdmFyIHNlY3Rpb25zID0gdXRpbC5nZXRBcmcoc291cmNlTWFwLCAnc2VjdGlvbnMnKTtcblxuICBpZiAodmVyc2lvbiAhPSB0aGlzLl92ZXJzaW9uKSB7XG4gICAgdGhyb3cgbmV3IEVycm9yKCdVbnN1cHBvcnRlZCB2ZXJzaW9uOiAnICsgdmVyc2lvbik7XG4gIH1cblxuICB0aGlzLl9zb3VyY2VzID0gbmV3IEFycmF5U2V0KCk7XG4gIHRoaXMuX25hbWVzID0gbmV3IEFycmF5U2V0KCk7XG5cbiAgdmFyIGxhc3RPZmZzZXQgPSB7XG4gICAgbGluZTogLTEsXG4gICAgY29sdW1uOiAwXG4gIH07XG4gIHRoaXMuX3NlY3Rpb25zID0gc2VjdGlvbnMubWFwKGZ1bmN0aW9uIChzKSB7XG4gICAgaWYgKHMudXJsKSB7XG4gICAgICAvLyBUaGUgdXJsIGZpZWxkIHdpbGwgcmVxdWlyZSBzdXBwb3J0IGZvciBhc3luY2hyb25pY2l0eS5cbiAgICAgIC8vIFNlZSBodHRwczovL2dpdGh1Yi5jb20vbW96aWxsYS9zb3VyY2UtbWFwL2lzc3Vlcy8xNlxuICAgICAgdGhyb3cgbmV3IEVycm9yKCdTdXBwb3J0IGZvciB1cmwgZmllbGQgaW4gc2VjdGlvbnMgbm90IGltcGxlbWVudGVkLicpO1xuICAgIH1cbiAgICB2YXIgb2Zmc2V0ID0gdXRpbC5nZXRBcmcocywgJ29mZnNldCcpO1xuICAgIHZhciBvZmZzZXRMaW5lID0gdXRpbC5nZXRBcmcob2Zmc2V0LCAnbGluZScpO1xuICAgIHZhciBvZmZzZXRDb2x1bW4gPSB1dGlsLmdldEFyZyhvZmZzZXQsICdjb2x1bW4nKTtcblxuICAgIGlmIChvZmZzZXRMaW5lIDwgbGFzdE9mZnNldC5saW5lIHx8XG4gICAgICAgIChvZmZzZXRMaW5lID09PSBsYXN0T2Zmc2V0LmxpbmUgJiYgb2Zmc2V0Q29sdW1uIDwgbGFzdE9mZnNldC5jb2x1bW4pKSB7XG4gICAgICB0aHJvdyBuZXcgRXJyb3IoJ1NlY3Rpb24gb2Zmc2V0cyBtdXN0IGJlIG9yZGVyZWQgYW5kIG5vbi1vdmVybGFwcGluZy4nKTtcbiAgICB9XG4gICAgbGFzdE9mZnNldCA9IG9mZnNldDtcblxuICAgIHJldHVybiB7XG4gICAgICBnZW5lcmF0ZWRPZmZzZXQ6IHtcbiAgICAgICAgLy8gVGhlIG9mZnNldCBmaWVsZHMgYXJlIDAtYmFzZWQsIGJ1dCB3ZSB1c2UgMS1iYXNlZCBpbmRpY2VzIHdoZW5cbiAgICAgICAgLy8gZW5jb2RpbmcvZGVjb2RpbmcgZnJvbSBWTFEuXG4gICAgICAgIGdlbmVyYXRlZExpbmU6IG9mZnNldExpbmUgKyAxLFxuICAgICAgICBnZW5lcmF0ZWRDb2x1bW46IG9mZnNldENvbHVtbiArIDFcbiAgICAgIH0sXG4gICAgICBjb25zdW1lcjogbmV3IFNvdXJjZU1hcENvbnN1bWVyKHV0aWwuZ2V0QXJnKHMsICdtYXAnKSlcbiAgICB9XG4gIH0pO1xufVxuXG5JbmRleGVkU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUpO1xuSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5jb25zdHJ1Y3RvciA9IFNvdXJjZU1hcENvbnN1bWVyO1xuXG4vKipcbiAqIFRoZSB2ZXJzaW9uIG9mIHRoZSBzb3VyY2UgbWFwcGluZyBzcGVjIHRoYXQgd2UgYXJlIGNvbnN1bWluZy5cbiAqL1xuSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5fdmVyc2lvbiA9IDM7XG5cbi8qKlxuICogVGhlIGxpc3Qgb2Ygb3JpZ2luYWwgc291cmNlcy5cbiAqL1xuT2JqZWN0LmRlZmluZVByb3BlcnR5KEluZGV4ZWRTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUsICdzb3VyY2VzJywge1xuICBnZXQ6IGZ1bmN0aW9uICgpIHtcbiAgICB2YXIgc291cmNlcyA9IFtdO1xuICAgIGZvciAodmFyIGkgPSAwOyBpIDwgdGhpcy5fc2VjdGlvbnMubGVuZ3RoOyBpKyspIHtcbiAgICAgIGZvciAodmFyIGogPSAwOyBqIDwgdGhpcy5fc2VjdGlvbnNbaV0uY29uc3VtZXIuc291cmNlcy5sZW5ndGg7IGorKykge1xuICAgICAgICBzb3VyY2VzLnB1c2godGhpcy5fc2VjdGlvbnNbaV0uY29uc3VtZXIuc291cmNlc1tqXSk7XG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiBzb3VyY2VzO1xuICB9XG59KTtcblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBvcmlnaW5hbCBzb3VyY2UsIGxpbmUsIGFuZCBjb2x1bW4gaW5mb3JtYXRpb24gZm9yIHRoZSBnZW5lcmF0ZWRcbiAqIHNvdXJjZSdzIGxpbmUgYW5kIGNvbHVtbiBwb3NpdGlvbnMgcHJvdmlkZWQuIFRoZSBvbmx5IGFyZ3VtZW50IGlzIGFuIG9iamVjdFxuICogd2l0aCB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIGxpbmU6IFRoZSBsaW5lIG51bWJlciBpbiB0aGUgZ2VuZXJhdGVkIHNvdXJjZS5cbiAqICAgLSBjb2x1bW46IFRoZSBjb2x1bW4gbnVtYmVyIGluIHRoZSBnZW5lcmF0ZWQgc291cmNlLlxuICpcbiAqIGFuZCBhbiBvYmplY3QgaXMgcmV0dXJuZWQgd2l0aCB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIHNvdXJjZTogVGhlIG9yaWdpbmFsIHNvdXJjZSBmaWxlLCBvciBudWxsLlxuICogICAtIGxpbmU6IFRoZSBsaW5lIG51bWJlciBpbiB0aGUgb3JpZ2luYWwgc291cmNlLCBvciBudWxsLlxuICogICAtIGNvbHVtbjogVGhlIGNvbHVtbiBudW1iZXIgaW4gdGhlIG9yaWdpbmFsIHNvdXJjZSwgb3IgbnVsbC5cbiAqICAgLSBuYW1lOiBUaGUgb3JpZ2luYWwgaWRlbnRpZmllciwgb3IgbnVsbC5cbiAqL1xuSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5vcmlnaW5hbFBvc2l0aW9uRm9yID1cbiAgZnVuY3Rpb24gSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyX29yaWdpbmFsUG9zaXRpb25Gb3IoYUFyZ3MpIHtcbiAgICB2YXIgbmVlZGxlID0ge1xuICAgICAgZ2VuZXJhdGVkTGluZTogdXRpbC5nZXRBcmcoYUFyZ3MsICdsaW5lJyksXG4gICAgICBnZW5lcmF0ZWRDb2x1bW46IHV0aWwuZ2V0QXJnKGFBcmdzLCAnY29sdW1uJylcbiAgICB9O1xuXG4gICAgLy8gRmluZCB0aGUgc2VjdGlvbiBjb250YWluaW5nIHRoZSBnZW5lcmF0ZWQgcG9zaXRpb24gd2UncmUgdHJ5aW5nIHRvIG1hcFxuICAgIC8vIHRvIGFuIG9yaWdpbmFsIHBvc2l0aW9uLlxuICAgIHZhciBzZWN0aW9uSW5kZXggPSBiaW5hcnlTZWFyY2guc2VhcmNoKG5lZWRsZSwgdGhpcy5fc2VjdGlvbnMsXG4gICAgICBmdW5jdGlvbihuZWVkbGUsIHNlY3Rpb24pIHtcbiAgICAgICAgdmFyIGNtcCA9IG5lZWRsZS5nZW5lcmF0ZWRMaW5lIC0gc2VjdGlvbi5nZW5lcmF0ZWRPZmZzZXQuZ2VuZXJhdGVkTGluZTtcbiAgICAgICAgaWYgKGNtcCkge1xuICAgICAgICAgIHJldHVybiBjbXA7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gKG5lZWRsZS5nZW5lcmF0ZWRDb2x1bW4gLVxuICAgICAgICAgICAgICAgIHNlY3Rpb24uZ2VuZXJhdGVkT2Zmc2V0LmdlbmVyYXRlZENvbHVtbik7XG4gICAgICB9KTtcbiAgICB2YXIgc2VjdGlvbiA9IHRoaXMuX3NlY3Rpb25zW3NlY3Rpb25JbmRleF07XG5cbiAgICBpZiAoIXNlY3Rpb24pIHtcbiAgICAgIHJldHVybiB7XG4gICAgICAgIHNvdXJjZTogbnVsbCxcbiAgICAgICAgbGluZTogbnVsbCxcbiAgICAgICAgY29sdW1uOiBudWxsLFxuICAgICAgICBuYW1lOiBudWxsXG4gICAgICB9O1xuICAgIH1cblxuICAgIHJldHVybiBzZWN0aW9uLmNvbnN1bWVyLm9yaWdpbmFsUG9zaXRpb25Gb3Ioe1xuICAgICAgbGluZTogbmVlZGxlLmdlbmVyYXRlZExpbmUgLVxuICAgICAgICAoc2VjdGlvbi5nZW5lcmF0ZWRPZmZzZXQuZ2VuZXJhdGVkTGluZSAtIDEpLFxuICAgICAgY29sdW1uOiBuZWVkbGUuZ2VuZXJhdGVkQ29sdW1uIC1cbiAgICAgICAgKHNlY3Rpb24uZ2VuZXJhdGVkT2Zmc2V0LmdlbmVyYXRlZExpbmUgPT09IG5lZWRsZS5nZW5lcmF0ZWRMaW5lXG4gICAgICAgICA/IHNlY3Rpb24uZ2VuZXJhdGVkT2Zmc2V0LmdlbmVyYXRlZENvbHVtbiAtIDFcbiAgICAgICAgIDogMCksXG4gICAgICBiaWFzOiBhQXJncy5iaWFzXG4gICAgfSk7XG4gIH07XG5cbi8qKlxuICogUmV0dXJuIHRydWUgaWYgd2UgaGF2ZSB0aGUgc291cmNlIGNvbnRlbnQgZm9yIGV2ZXJ5IHNvdXJjZSBpbiB0aGUgc291cmNlXG4gKiBtYXAsIGZhbHNlIG90aGVyd2lzZS5cbiAqL1xuSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5oYXNDb250ZW50c09mQWxsU291cmNlcyA9XG4gIGZ1bmN0aW9uIEluZGV4ZWRTb3VyY2VNYXBDb25zdW1lcl9oYXNDb250ZW50c09mQWxsU291cmNlcygpIHtcbiAgICByZXR1cm4gdGhpcy5fc2VjdGlvbnMuZXZlcnkoZnVuY3Rpb24gKHMpIHtcbiAgICAgIHJldHVybiBzLmNvbnN1bWVyLmhhc0NvbnRlbnRzT2ZBbGxTb3VyY2VzKCk7XG4gICAgfSk7XG4gIH07XG5cbi8qKlxuICogUmV0dXJucyB0aGUgb3JpZ2luYWwgc291cmNlIGNvbnRlbnQuIFRoZSBvbmx5IGFyZ3VtZW50IGlzIHRoZSB1cmwgb2YgdGhlXG4gKiBvcmlnaW5hbCBzb3VyY2UgZmlsZS4gUmV0dXJucyBudWxsIGlmIG5vIG9yaWdpbmFsIHNvdXJjZSBjb250ZW50IGlzXG4gKiBhdmFpbGFibGUuXG4gKi9cbkluZGV4ZWRTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuc291cmNlQ29udGVudEZvciA9XG4gIGZ1bmN0aW9uIEluZGV4ZWRTb3VyY2VNYXBDb25zdW1lcl9zb3VyY2VDb250ZW50Rm9yKGFTb3VyY2UsIG51bGxPbk1pc3NpbmcpIHtcbiAgICBmb3IgKHZhciBpID0gMDsgaSA8IHRoaXMuX3NlY3Rpb25zLmxlbmd0aDsgaSsrKSB7XG4gICAgICB2YXIgc2VjdGlvbiA9IHRoaXMuX3NlY3Rpb25zW2ldO1xuXG4gICAgICB2YXIgY29udGVudCA9IHNlY3Rpb24uY29uc3VtZXIuc291cmNlQ29udGVudEZvcihhU291cmNlLCB0cnVlKTtcbiAgICAgIGlmIChjb250ZW50KSB7XG4gICAgICAgIHJldHVybiBjb250ZW50O1xuICAgICAgfVxuICAgIH1cbiAgICBpZiAobnVsbE9uTWlzc2luZykge1xuICAgICAgcmV0dXJuIG51bGw7XG4gICAgfVxuICAgIGVsc2Uge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKCdcIicgKyBhU291cmNlICsgJ1wiIGlzIG5vdCBpbiB0aGUgU291cmNlTWFwLicpO1xuICAgIH1cbiAgfTtcblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBnZW5lcmF0ZWQgbGluZSBhbmQgY29sdW1uIGluZm9ybWF0aW9uIGZvciB0aGUgb3JpZ2luYWwgc291cmNlLFxuICogbGluZSwgYW5kIGNvbHVtbiBwb3NpdGlvbnMgcHJvdmlkZWQuIFRoZSBvbmx5IGFyZ3VtZW50IGlzIGFuIG9iamVjdCB3aXRoXG4gKiB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIHNvdXJjZTogVGhlIGZpbGVuYW1lIG9mIHRoZSBvcmlnaW5hbCBzb3VyY2UuXG4gKiAgIC0gbGluZTogVGhlIGxpbmUgbnVtYmVyIGluIHRoZSBvcmlnaW5hbCBzb3VyY2UuXG4gKiAgIC0gY29sdW1uOiBUaGUgY29sdW1uIG51bWJlciBpbiB0aGUgb3JpZ2luYWwgc291cmNlLlxuICpcbiAqIGFuZCBhbiBvYmplY3QgaXMgcmV0dXJuZWQgd2l0aCB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXM6XG4gKlxuICogICAtIGxpbmU6IFRoZSBsaW5lIG51bWJlciBpbiB0aGUgZ2VuZXJhdGVkIHNvdXJjZSwgb3IgbnVsbC5cbiAqICAgLSBjb2x1bW46IFRoZSBjb2x1bW4gbnVtYmVyIGluIHRoZSBnZW5lcmF0ZWQgc291cmNlLCBvciBudWxsLlxuICovXG5JbmRleGVkU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlLmdlbmVyYXRlZFBvc2l0aW9uRm9yID1cbiAgZnVuY3Rpb24gSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyX2dlbmVyYXRlZFBvc2l0aW9uRm9yKGFBcmdzKSB7XG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCB0aGlzLl9zZWN0aW9ucy5sZW5ndGg7IGkrKykge1xuICAgICAgdmFyIHNlY3Rpb24gPSB0aGlzLl9zZWN0aW9uc1tpXTtcblxuICAgICAgLy8gT25seSBjb25zaWRlciB0aGlzIHNlY3Rpb24gaWYgdGhlIHJlcXVlc3RlZCBzb3VyY2UgaXMgaW4gdGhlIGxpc3Qgb2ZcbiAgICAgIC8vIHNvdXJjZXMgb2YgdGhlIGNvbnN1bWVyLlxuICAgICAgaWYgKHNlY3Rpb24uY29uc3VtZXIuc291cmNlcy5pbmRleE9mKHV0aWwuZ2V0QXJnKGFBcmdzLCAnc291cmNlJykpID09PSAtMSkge1xuICAgICAgICBjb250aW51ZTtcbiAgICAgIH1cbiAgICAgIHZhciBnZW5lcmF0ZWRQb3NpdGlvbiA9IHNlY3Rpb24uY29uc3VtZXIuZ2VuZXJhdGVkUG9zaXRpb25Gb3IoYUFyZ3MpO1xuICAgICAgaWYgKGdlbmVyYXRlZFBvc2l0aW9uKSB7XG4gICAgICAgIHZhciByZXQgPSB7XG4gICAgICAgICAgbGluZTogZ2VuZXJhdGVkUG9zaXRpb24ubGluZSArXG4gICAgICAgICAgICAoc2VjdGlvbi5nZW5lcmF0ZWRPZmZzZXQuZ2VuZXJhdGVkTGluZSAtIDEpLFxuICAgICAgICAgIGNvbHVtbjogZ2VuZXJhdGVkUG9zaXRpb24uY29sdW1uICtcbiAgICAgICAgICAgIChzZWN0aW9uLmdlbmVyYXRlZE9mZnNldC5nZW5lcmF0ZWRMaW5lID09PSBnZW5lcmF0ZWRQb3NpdGlvbi5saW5lXG4gICAgICAgICAgICAgPyBzZWN0aW9uLmdlbmVyYXRlZE9mZnNldC5nZW5lcmF0ZWRDb2x1bW4gLSAxXG4gICAgICAgICAgICAgOiAwKVxuICAgICAgICB9O1xuICAgICAgICByZXR1cm4gcmV0O1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiB7XG4gICAgICBsaW5lOiBudWxsLFxuICAgICAgY29sdW1uOiBudWxsXG4gICAgfTtcbiAgfTtcblxuLyoqXG4gKiBQYXJzZSB0aGUgbWFwcGluZ3MgaW4gYSBzdHJpbmcgaW4gdG8gYSBkYXRhIHN0cnVjdHVyZSB3aGljaCB3ZSBjYW4gZWFzaWx5XG4gKiBxdWVyeSAodGhlIG9yZGVyZWQgYXJyYXlzIGluIHRoZSBgdGhpcy5fX2dlbmVyYXRlZE1hcHBpbmdzYCBhbmRcbiAqIGB0aGlzLl9fb3JpZ2luYWxNYXBwaW5nc2AgcHJvcGVydGllcykuXG4gKi9cbkluZGV4ZWRTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuX3BhcnNlTWFwcGluZ3MgPVxuICBmdW5jdGlvbiBJbmRleGVkU291cmNlTWFwQ29uc3VtZXJfcGFyc2VNYXBwaW5ncyhhU3RyLCBhU291cmNlUm9vdCkge1xuICAgIHRoaXMuX19nZW5lcmF0ZWRNYXBwaW5ncyA9IFtdO1xuICAgIHRoaXMuX19vcmlnaW5hbE1hcHBpbmdzID0gW107XG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCB0aGlzLl9zZWN0aW9ucy5sZW5ndGg7IGkrKykge1xuICAgICAgdmFyIHNlY3Rpb24gPSB0aGlzLl9zZWN0aW9uc1tpXTtcbiAgICAgIHZhciBzZWN0aW9uTWFwcGluZ3MgPSBzZWN0aW9uLmNvbnN1bWVyLl9nZW5lcmF0ZWRNYXBwaW5ncztcbiAgICAgIGZvciAodmFyIGogPSAwOyBqIDwgc2VjdGlvbk1hcHBpbmdzLmxlbmd0aDsgaisrKSB7XG4gICAgICAgIHZhciBtYXBwaW5nID0gc2VjdGlvbk1hcHBpbmdzW2pdO1xuXG4gICAgICAgIHZhciBzb3VyY2UgPSBzZWN0aW9uLmNvbnN1bWVyLl9zb3VyY2VzLmF0KG1hcHBpbmcuc291cmNlKTtcbiAgICAgICAgaWYgKHNlY3Rpb24uY29uc3VtZXIuc291cmNlUm9vdCAhPT0gbnVsbCkge1xuICAgICAgICAgIHNvdXJjZSA9IHV0aWwuam9pbihzZWN0aW9uLmNvbnN1bWVyLnNvdXJjZVJvb3QsIHNvdXJjZSk7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5fc291cmNlcy5hZGQoc291cmNlKTtcbiAgICAgICAgc291cmNlID0gdGhpcy5fc291cmNlcy5pbmRleE9mKHNvdXJjZSk7XG5cbiAgICAgICAgdmFyIG5hbWUgPSBzZWN0aW9uLmNvbnN1bWVyLl9uYW1lcy5hdChtYXBwaW5nLm5hbWUpO1xuICAgICAgICB0aGlzLl9uYW1lcy5hZGQobmFtZSk7XG4gICAgICAgIG5hbWUgPSB0aGlzLl9uYW1lcy5pbmRleE9mKG5hbWUpO1xuXG4gICAgICAgIC8vIFRoZSBtYXBwaW5ncyBjb21pbmcgZnJvbSB0aGUgY29uc3VtZXIgZm9yIHRoZSBzZWN0aW9uIGhhdmVcbiAgICAgICAgLy8gZ2VuZXJhdGVkIHBvc2l0aW9ucyByZWxhdGl2ZSB0byB0aGUgc3RhcnQgb2YgdGhlIHNlY3Rpb24sIHNvIHdlXG4gICAgICAgIC8vIG5lZWQgdG8gb2Zmc2V0IHRoZW0gdG8gYmUgcmVsYXRpdmUgdG8gdGhlIHN0YXJ0IG9mIHRoZSBjb25jYXRlbmF0ZWRcbiAgICAgICAgLy8gZ2VuZXJhdGVkIGZpbGUuXG4gICAgICAgIHZhciBhZGp1c3RlZE1hcHBpbmcgPSB7XG4gICAgICAgICAgc291cmNlOiBzb3VyY2UsXG4gICAgICAgICAgZ2VuZXJhdGVkTGluZTogbWFwcGluZy5nZW5lcmF0ZWRMaW5lICtcbiAgICAgICAgICAgIChzZWN0aW9uLmdlbmVyYXRlZE9mZnNldC5nZW5lcmF0ZWRMaW5lIC0gMSksXG4gICAgICAgICAgZ2VuZXJhdGVkQ29sdW1uOiBtYXBwaW5nLmdlbmVyYXRlZENvbHVtbiArXG4gICAgICAgICAgICAoc2VjdGlvbi5nZW5lcmF0ZWRPZmZzZXQuZ2VuZXJhdGVkTGluZSA9PT0gbWFwcGluZy5nZW5lcmF0ZWRMaW5lXG4gICAgICAgICAgICA/IHNlY3Rpb24uZ2VuZXJhdGVkT2Zmc2V0LmdlbmVyYXRlZENvbHVtbiAtIDFcbiAgICAgICAgICAgIDogMCksXG4gICAgICAgICAgb3JpZ2luYWxMaW5lOiBtYXBwaW5nLm9yaWdpbmFsTGluZSxcbiAgICAgICAgICBvcmlnaW5hbENvbHVtbjogbWFwcGluZy5vcmlnaW5hbENvbHVtbixcbiAgICAgICAgICBuYW1lOiBuYW1lXG4gICAgICAgIH07XG5cbiAgICAgICAgdGhpcy5fX2dlbmVyYXRlZE1hcHBpbmdzLnB1c2goYWRqdXN0ZWRNYXBwaW5nKTtcbiAgICAgICAgaWYgKHR5cGVvZiBhZGp1c3RlZE1hcHBpbmcub3JpZ2luYWxMaW5lID09PSAnbnVtYmVyJykge1xuICAgICAgICAgIHRoaXMuX19vcmlnaW5hbE1hcHBpbmdzLnB1c2goYWRqdXN0ZWRNYXBwaW5nKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cblxuICAgIHF1aWNrU29ydCh0aGlzLl9fZ2VuZXJhdGVkTWFwcGluZ3MsIHV0aWwuY29tcGFyZUJ5R2VuZXJhdGVkUG9zaXRpb25zRGVmbGF0ZWQpO1xuICAgIHF1aWNrU29ydCh0aGlzLl9fb3JpZ2luYWxNYXBwaW5ncywgdXRpbC5jb21wYXJlQnlPcmlnaW5hbFBvc2l0aW9ucyk7XG4gIH07XG5cbmV4cG9ydHMuSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyID0gSW5kZXhlZFNvdXJjZU1hcENvbnN1bWVyO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvc291cmNlLW1hcC1jb25zdW1lci5qc1xuLy8gbW9kdWxlIGlkID0gN1xuLy8gbW9kdWxlIGNodW5rcyA9IDAiLCIvKiAtKi0gTW9kZToganM7IGpzLWluZGVudC1sZXZlbDogMjsgLSotICovXG4vKlxuICogQ29weXJpZ2h0IDIwMTEgTW96aWxsYSBGb3VuZGF0aW9uIGFuZCBjb250cmlidXRvcnNcbiAqIExpY2Vuc2VkIHVuZGVyIHRoZSBOZXcgQlNEIGxpY2Vuc2UuIFNlZSBMSUNFTlNFIG9yOlxuICogaHR0cDovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0zLUNsYXVzZVxuICovXG5cbmV4cG9ydHMuR1JFQVRFU1RfTE9XRVJfQk9VTkQgPSAxO1xuZXhwb3J0cy5MRUFTVF9VUFBFUl9CT1VORCA9IDI7XG5cbi8qKlxuICogUmVjdXJzaXZlIGltcGxlbWVudGF0aW9uIG9mIGJpbmFyeSBzZWFyY2guXG4gKlxuICogQHBhcmFtIGFMb3cgSW5kaWNlcyBoZXJlIGFuZCBsb3dlciBkbyBub3QgY29udGFpbiB0aGUgbmVlZGxlLlxuICogQHBhcmFtIGFIaWdoIEluZGljZXMgaGVyZSBhbmQgaGlnaGVyIGRvIG5vdCBjb250YWluIHRoZSBuZWVkbGUuXG4gKiBAcGFyYW0gYU5lZWRsZSBUaGUgZWxlbWVudCBiZWluZyBzZWFyY2hlZCBmb3IuXG4gKiBAcGFyYW0gYUhheXN0YWNrIFRoZSBub24tZW1wdHkgYXJyYXkgYmVpbmcgc2VhcmNoZWQuXG4gKiBAcGFyYW0gYUNvbXBhcmUgRnVuY3Rpb24gd2hpY2ggdGFrZXMgdHdvIGVsZW1lbnRzIGFuZCByZXR1cm5zIC0xLCAwLCBvciAxLlxuICogQHBhcmFtIGFCaWFzIEVpdGhlciAnYmluYXJ5U2VhcmNoLkdSRUFURVNUX0xPV0VSX0JPVU5EJyBvclxuICogICAgICdiaW5hcnlTZWFyY2guTEVBU1RfVVBQRVJfQk9VTkQnLiBTcGVjaWZpZXMgd2hldGhlciB0byByZXR1cm4gdGhlXG4gKiAgICAgY2xvc2VzdCBlbGVtZW50IHRoYXQgaXMgc21hbGxlciB0aGFuIG9yIGdyZWF0ZXIgdGhhbiB0aGUgb25lIHdlIGFyZVxuICogICAgIHNlYXJjaGluZyBmb3IsIHJlc3BlY3RpdmVseSwgaWYgdGhlIGV4YWN0IGVsZW1lbnQgY2Fubm90IGJlIGZvdW5kLlxuICovXG5mdW5jdGlvbiByZWN1cnNpdmVTZWFyY2goYUxvdywgYUhpZ2gsIGFOZWVkbGUsIGFIYXlzdGFjaywgYUNvbXBhcmUsIGFCaWFzKSB7XG4gIC8vIFRoaXMgZnVuY3Rpb24gdGVybWluYXRlcyB3aGVuIG9uZSBvZiB0aGUgZm9sbG93aW5nIGlzIHRydWU6XG4gIC8vXG4gIC8vICAgMS4gV2UgZmluZCB0aGUgZXhhY3QgZWxlbWVudCB3ZSBhcmUgbG9va2luZyBmb3IuXG4gIC8vXG4gIC8vICAgMi4gV2UgZGlkIG5vdCBmaW5kIHRoZSBleGFjdCBlbGVtZW50LCBidXQgd2UgY2FuIHJldHVybiB0aGUgaW5kZXggb2ZcbiAgLy8gICAgICB0aGUgbmV4dC1jbG9zZXN0IGVsZW1lbnQuXG4gIC8vXG4gIC8vICAgMy4gV2UgZGlkIG5vdCBmaW5kIHRoZSBleGFjdCBlbGVtZW50LCBhbmQgdGhlcmUgaXMgbm8gbmV4dC1jbG9zZXN0XG4gIC8vICAgICAgZWxlbWVudCB0aGFuIHRoZSBvbmUgd2UgYXJlIHNlYXJjaGluZyBmb3IsIHNvIHdlIHJldHVybiAtMS5cbiAgdmFyIG1pZCA9IE1hdGguZmxvb3IoKGFIaWdoIC0gYUxvdykgLyAyKSArIGFMb3c7XG4gIHZhciBjbXAgPSBhQ29tcGFyZShhTmVlZGxlLCBhSGF5c3RhY2tbbWlkXSwgdHJ1ZSk7XG4gIGlmIChjbXAgPT09IDApIHtcbiAgICAvLyBGb3VuZCB0aGUgZWxlbWVudCB3ZSBhcmUgbG9va2luZyBmb3IuXG4gICAgcmV0dXJuIG1pZDtcbiAgfVxuICBlbHNlIGlmIChjbXAgPiAwKSB7XG4gICAgLy8gT3VyIG5lZWRsZSBpcyBncmVhdGVyIHRoYW4gYUhheXN0YWNrW21pZF0uXG4gICAgaWYgKGFIaWdoIC0gbWlkID4gMSkge1xuICAgICAgLy8gVGhlIGVsZW1lbnQgaXMgaW4gdGhlIHVwcGVyIGhhbGYuXG4gICAgICByZXR1cm4gcmVjdXJzaXZlU2VhcmNoKG1pZCwgYUhpZ2gsIGFOZWVkbGUsIGFIYXlzdGFjaywgYUNvbXBhcmUsIGFCaWFzKTtcbiAgICB9XG5cbiAgICAvLyBUaGUgZXhhY3QgbmVlZGxlIGVsZW1lbnQgd2FzIG5vdCBmb3VuZCBpbiB0aGlzIGhheXN0YWNrLiBEZXRlcm1pbmUgaWZcbiAgICAvLyB3ZSBhcmUgaW4gdGVybWluYXRpb24gY2FzZSAoMykgb3IgKDIpIGFuZCByZXR1cm4gdGhlIGFwcHJvcHJpYXRlIHRoaW5nLlxuICAgIGlmIChhQmlhcyA9PSBleHBvcnRzLkxFQVNUX1VQUEVSX0JPVU5EKSB7XG4gICAgICByZXR1cm4gYUhpZ2ggPCBhSGF5c3RhY2subGVuZ3RoID8gYUhpZ2ggOiAtMTtcbiAgICB9IGVsc2Uge1xuICAgICAgcmV0dXJuIG1pZDtcbiAgICB9XG4gIH1cbiAgZWxzZSB7XG4gICAgLy8gT3VyIG5lZWRsZSBpcyBsZXNzIHRoYW4gYUhheXN0YWNrW21pZF0uXG4gICAgaWYgKG1pZCAtIGFMb3cgPiAxKSB7XG4gICAgICAvLyBUaGUgZWxlbWVudCBpcyBpbiB0aGUgbG93ZXIgaGFsZi5cbiAgICAgIHJldHVybiByZWN1cnNpdmVTZWFyY2goYUxvdywgbWlkLCBhTmVlZGxlLCBhSGF5c3RhY2ssIGFDb21wYXJlLCBhQmlhcyk7XG4gICAgfVxuXG4gICAgLy8gd2UgYXJlIGluIHRlcm1pbmF0aW9uIGNhc2UgKDMpIG9yICgyKSBhbmQgcmV0dXJuIHRoZSBhcHByb3ByaWF0ZSB0aGluZy5cbiAgICBpZiAoYUJpYXMgPT0gZXhwb3J0cy5MRUFTVF9VUFBFUl9CT1VORCkge1xuICAgICAgcmV0dXJuIG1pZDtcbiAgICB9IGVsc2Uge1xuICAgICAgcmV0dXJuIGFMb3cgPCAwID8gLTEgOiBhTG93O1xuICAgIH1cbiAgfVxufVxuXG4vKipcbiAqIFRoaXMgaXMgYW4gaW1wbGVtZW50YXRpb24gb2YgYmluYXJ5IHNlYXJjaCB3aGljaCB3aWxsIGFsd2F5cyB0cnkgYW5kIHJldHVyblxuICogdGhlIGluZGV4IG9mIHRoZSBjbG9zZXN0IGVsZW1lbnQgaWYgdGhlcmUgaXMgbm8gZXhhY3QgaGl0LiBUaGlzIGlzIGJlY2F1c2VcbiAqIG1hcHBpbmdzIGJldHdlZW4gb3JpZ2luYWwgYW5kIGdlbmVyYXRlZCBsaW5lL2NvbCBwYWlycyBhcmUgc2luZ2xlIHBvaW50cyxcbiAqIGFuZCB0aGVyZSBpcyBhbiBpbXBsaWNpdCByZWdpb24gYmV0d2VlbiBlYWNoIG9mIHRoZW0sIHNvIGEgbWlzcyBqdXN0IG1lYW5zXG4gKiB0aGF0IHlvdSBhcmVuJ3Qgb24gdGhlIHZlcnkgc3RhcnQgb2YgYSByZWdpb24uXG4gKlxuICogQHBhcmFtIGFOZWVkbGUgVGhlIGVsZW1lbnQgeW91IGFyZSBsb29raW5nIGZvci5cbiAqIEBwYXJhbSBhSGF5c3RhY2sgVGhlIGFycmF5IHRoYXQgaXMgYmVpbmcgc2VhcmNoZWQuXG4gKiBAcGFyYW0gYUNvbXBhcmUgQSBmdW5jdGlvbiB3aGljaCB0YWtlcyB0aGUgbmVlZGxlIGFuZCBhbiBlbGVtZW50IGluIHRoZVxuICogICAgIGFycmF5IGFuZCByZXR1cm5zIC0xLCAwLCBvciAxIGRlcGVuZGluZyBvbiB3aGV0aGVyIHRoZSBuZWVkbGUgaXMgbGVzc1xuICogICAgIHRoYW4sIGVxdWFsIHRvLCBvciBncmVhdGVyIHRoYW4gdGhlIGVsZW1lbnQsIHJlc3BlY3RpdmVseS5cbiAqIEBwYXJhbSBhQmlhcyBFaXRoZXIgJ2JpbmFyeVNlYXJjaC5HUkVBVEVTVF9MT1dFUl9CT1VORCcgb3JcbiAqICAgICAnYmluYXJ5U2VhcmNoLkxFQVNUX1VQUEVSX0JPVU5EJy4gU3BlY2lmaWVzIHdoZXRoZXIgdG8gcmV0dXJuIHRoZVxuICogICAgIGNsb3Nlc3QgZWxlbWVudCB0aGF0IGlzIHNtYWxsZXIgdGhhbiBvciBncmVhdGVyIHRoYW4gdGhlIG9uZSB3ZSBhcmVcbiAqICAgICBzZWFyY2hpbmcgZm9yLCByZXNwZWN0aXZlbHksIGlmIHRoZSBleGFjdCBlbGVtZW50IGNhbm5vdCBiZSBmb3VuZC5cbiAqICAgICBEZWZhdWx0cyB0byAnYmluYXJ5U2VhcmNoLkdSRUFURVNUX0xPV0VSX0JPVU5EJy5cbiAqL1xuZXhwb3J0cy5zZWFyY2ggPSBmdW5jdGlvbiBzZWFyY2goYU5lZWRsZSwgYUhheXN0YWNrLCBhQ29tcGFyZSwgYUJpYXMpIHtcbiAgaWYgKGFIYXlzdGFjay5sZW5ndGggPT09IDApIHtcbiAgICByZXR1cm4gLTE7XG4gIH1cblxuICB2YXIgaW5kZXggPSByZWN1cnNpdmVTZWFyY2goLTEsIGFIYXlzdGFjay5sZW5ndGgsIGFOZWVkbGUsIGFIYXlzdGFjayxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFDb21wYXJlLCBhQmlhcyB8fCBleHBvcnRzLkdSRUFURVNUX0xPV0VSX0JPVU5EKTtcbiAgaWYgKGluZGV4IDwgMCkge1xuICAgIHJldHVybiAtMTtcbiAgfVxuXG4gIC8vIFdlIGhhdmUgZm91bmQgZWl0aGVyIHRoZSBleGFjdCBlbGVtZW50LCBvciB0aGUgbmV4dC1jbG9zZXN0IGVsZW1lbnQgdGhhblxuICAvLyB0aGUgb25lIHdlIGFyZSBzZWFyY2hpbmcgZm9yLiBIb3dldmVyLCB0aGVyZSBtYXkgYmUgbW9yZSB0aGFuIG9uZSBzdWNoXG4gIC8vIGVsZW1lbnQuIE1ha2Ugc3VyZSB3ZSBhbHdheXMgcmV0dXJuIHRoZSBzbWFsbGVzdCBvZiB0aGVzZS5cbiAgd2hpbGUgKGluZGV4IC0gMSA+PSAwKSB7XG4gICAgaWYgKGFDb21wYXJlKGFIYXlzdGFja1tpbmRleF0sIGFIYXlzdGFja1tpbmRleCAtIDFdLCB0cnVlKSAhPT0gMCkge1xuICAgICAgYnJlYWs7XG4gICAgfVxuICAgIC0taW5kZXg7XG4gIH1cblxuICByZXR1cm4gaW5kZXg7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvYmluYXJ5LXNlYXJjaC5qc1xuLy8gbW9kdWxlIGlkID0gOFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiLCIvKiAtKi0gTW9kZToganM7IGpzLWluZGVudC1sZXZlbDogMjsgLSotICovXG4vKlxuICogQ29weXJpZ2h0IDIwMTEgTW96aWxsYSBGb3VuZGF0aW9uIGFuZCBjb250cmlidXRvcnNcbiAqIExpY2Vuc2VkIHVuZGVyIHRoZSBOZXcgQlNEIGxpY2Vuc2UuIFNlZSBMSUNFTlNFIG9yOlxuICogaHR0cDovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0zLUNsYXVzZVxuICovXG5cbi8vIEl0IHR1cm5zIG91dCB0aGF0IHNvbWUgKG1vc3Q/KSBKYXZhU2NyaXB0IGVuZ2luZXMgZG9uJ3Qgc2VsZi1ob3N0XG4vLyBgQXJyYXkucHJvdG90eXBlLnNvcnRgLiBUaGlzIG1ha2VzIHNlbnNlIGJlY2F1c2UgQysrIHdpbGwgbGlrZWx5IHJlbWFpblxuLy8gZmFzdGVyIHRoYW4gSlMgd2hlbiBkb2luZyByYXcgQ1BVLWludGVuc2l2ZSBzb3J0aW5nLiBIb3dldmVyLCB3aGVuIHVzaW5nIGFcbi8vIGN1c3RvbSBjb21wYXJhdG9yIGZ1bmN0aW9uLCBjYWxsaW5nIGJhY2sgYW5kIGZvcnRoIGJldHdlZW4gdGhlIFZNJ3MgQysrIGFuZFxuLy8gSklUJ2QgSlMgaXMgcmF0aGVyIHNsb3cgKmFuZCogbG9zZXMgSklUIHR5cGUgaW5mb3JtYXRpb24sIHJlc3VsdGluZyBpblxuLy8gd29yc2UgZ2VuZXJhdGVkIGNvZGUgZm9yIHRoZSBjb21wYXJhdG9yIGZ1bmN0aW9uIHRoYW4gd291bGQgYmUgb3B0aW1hbC4gSW5cbi8vIGZhY3QsIHdoZW4gc29ydGluZyB3aXRoIGEgY29tcGFyYXRvciwgdGhlc2UgY29zdHMgb3V0d2VpZ2ggdGhlIGJlbmVmaXRzIG9mXG4vLyBzb3J0aW5nIGluIEMrKy4gQnkgdXNpbmcgb3VyIG93biBKUy1pbXBsZW1lbnRlZCBRdWljayBTb3J0IChiZWxvdyksIHdlIGdldFxuLy8gYSB+MzUwMG1zIG1lYW4gc3BlZWQtdXAgaW4gYGJlbmNoL2JlbmNoLmh0bWxgLlxuXG4vKipcbiAqIFN3YXAgdGhlIGVsZW1lbnRzIGluZGV4ZWQgYnkgYHhgIGFuZCBgeWAgaW4gdGhlIGFycmF5IGBhcnlgLlxuICpcbiAqIEBwYXJhbSB7QXJyYXl9IGFyeVxuICogICAgICAgIFRoZSBhcnJheS5cbiAqIEBwYXJhbSB7TnVtYmVyfSB4XG4gKiAgICAgICAgVGhlIGluZGV4IG9mIHRoZSBmaXJzdCBpdGVtLlxuICogQHBhcmFtIHtOdW1iZXJ9IHlcbiAqICAgICAgICBUaGUgaW5kZXggb2YgdGhlIHNlY29uZCBpdGVtLlxuICovXG5mdW5jdGlvbiBzd2FwKGFyeSwgeCwgeSkge1xuICB2YXIgdGVtcCA9IGFyeVt4XTtcbiAgYXJ5W3hdID0gYXJ5W3ldO1xuICBhcnlbeV0gPSB0ZW1wO1xufVxuXG4vKipcbiAqIFJldHVybnMgYSByYW5kb20gaW50ZWdlciB3aXRoaW4gdGhlIHJhbmdlIGBsb3cgLi4gaGlnaGAgaW5jbHVzaXZlLlxuICpcbiAqIEBwYXJhbSB7TnVtYmVyfSBsb3dcbiAqICAgICAgICBUaGUgbG93ZXIgYm91bmQgb24gdGhlIHJhbmdlLlxuICogQHBhcmFtIHtOdW1iZXJ9IGhpZ2hcbiAqICAgICAgICBUaGUgdXBwZXIgYm91bmQgb24gdGhlIHJhbmdlLlxuICovXG5mdW5jdGlvbiByYW5kb21JbnRJblJhbmdlKGxvdywgaGlnaCkge1xuICByZXR1cm4gTWF0aC5yb3VuZChsb3cgKyAoTWF0aC5yYW5kb20oKSAqIChoaWdoIC0gbG93KSkpO1xufVxuXG4vKipcbiAqIFRoZSBRdWljayBTb3J0IGFsZ29yaXRobS5cbiAqXG4gKiBAcGFyYW0ge0FycmF5fSBhcnlcbiAqICAgICAgICBBbiBhcnJheSB0byBzb3J0LlxuICogQHBhcmFtIHtmdW5jdGlvbn0gY29tcGFyYXRvclxuICogICAgICAgIEZ1bmN0aW9uIHRvIHVzZSB0byBjb21wYXJlIHR3byBpdGVtcy5cbiAqIEBwYXJhbSB7TnVtYmVyfSBwXG4gKiAgICAgICAgU3RhcnQgaW5kZXggb2YgdGhlIGFycmF5XG4gKiBAcGFyYW0ge051bWJlcn0gclxuICogICAgICAgIEVuZCBpbmRleCBvZiB0aGUgYXJyYXlcbiAqL1xuZnVuY3Rpb24gZG9RdWlja1NvcnQoYXJ5LCBjb21wYXJhdG9yLCBwLCByKSB7XG4gIC8vIElmIG91ciBsb3dlciBib3VuZCBpcyBsZXNzIHRoYW4gb3VyIHVwcGVyIGJvdW5kLCB3ZSAoMSkgcGFydGl0aW9uIHRoZVxuICAvLyBhcnJheSBpbnRvIHR3byBwaWVjZXMgYW5kICgyKSByZWN1cnNlIG9uIGVhY2ggaGFsZi4gSWYgaXQgaXMgbm90LCB0aGlzIGlzXG4gIC8vIHRoZSBlbXB0eSBhcnJheSBhbmQgb3VyIGJhc2UgY2FzZS5cblxuICBpZiAocCA8IHIpIHtcbiAgICAvLyAoMSkgUGFydGl0aW9uaW5nLlxuICAgIC8vXG4gICAgLy8gVGhlIHBhcnRpdGlvbmluZyBjaG9vc2VzIGEgcGl2b3QgYmV0d2VlbiBgcGAgYW5kIGByYCBhbmQgbW92ZXMgYWxsXG4gICAgLy8gZWxlbWVudHMgdGhhdCBhcmUgbGVzcyB0aGFuIG9yIGVxdWFsIHRvIHRoZSBwaXZvdCB0byB0aGUgYmVmb3JlIGl0LCBhbmRcbiAgICAvLyBhbGwgdGhlIGVsZW1lbnRzIHRoYXQgYXJlIGdyZWF0ZXIgdGhhbiBpdCBhZnRlciBpdC4gVGhlIGVmZmVjdCBpcyB0aGF0XG4gICAgLy8gb25jZSBwYXJ0aXRpb24gaXMgZG9uZSwgdGhlIHBpdm90IGlzIGluIHRoZSBleGFjdCBwbGFjZSBpdCB3aWxsIGJlIHdoZW5cbiAgICAvLyB0aGUgYXJyYXkgaXMgcHV0IGluIHNvcnRlZCBvcmRlciwgYW5kIGl0IHdpbGwgbm90IG5lZWQgdG8gYmUgbW92ZWRcbiAgICAvLyBhZ2Fpbi4gVGhpcyBydW5zIGluIE8obikgdGltZS5cblxuICAgIC8vIEFsd2F5cyBjaG9vc2UgYSByYW5kb20gcGl2b3Qgc28gdGhhdCBhbiBpbnB1dCBhcnJheSB3aGljaCBpcyByZXZlcnNlXG4gICAgLy8gc29ydGVkIGRvZXMgbm90IGNhdXNlIE8obl4yKSBydW5uaW5nIHRpbWUuXG4gICAgdmFyIHBpdm90SW5kZXggPSByYW5kb21JbnRJblJhbmdlKHAsIHIpO1xuICAgIHZhciBpID0gcCAtIDE7XG5cbiAgICBzd2FwKGFyeSwgcGl2b3RJbmRleCwgcik7XG4gICAgdmFyIHBpdm90ID0gYXJ5W3JdO1xuXG4gICAgLy8gSW1tZWRpYXRlbHkgYWZ0ZXIgYGpgIGlzIGluY3JlbWVudGVkIGluIHRoaXMgbG9vcCwgdGhlIGZvbGxvd2luZyBob2xkXG4gICAgLy8gdHJ1ZTpcbiAgICAvL1xuICAgIC8vICAgKiBFdmVyeSBlbGVtZW50IGluIGBhcnlbcCAuLiBpXWAgaXMgbGVzcyB0aGFuIG9yIGVxdWFsIHRvIHRoZSBwaXZvdC5cbiAgICAvL1xuICAgIC8vICAgKiBFdmVyeSBlbGVtZW50IGluIGBhcnlbaSsxIC4uIGotMV1gIGlzIGdyZWF0ZXIgdGhhbiB0aGUgcGl2b3QuXG4gICAgZm9yICh2YXIgaiA9IHA7IGogPCByOyBqKyspIHtcbiAgICAgIGlmIChjb21wYXJhdG9yKGFyeVtqXSwgcGl2b3QpIDw9IDApIHtcbiAgICAgICAgaSArPSAxO1xuICAgICAgICBzd2FwKGFyeSwgaSwgaik7XG4gICAgICB9XG4gICAgfVxuXG4gICAgc3dhcChhcnksIGkgKyAxLCBqKTtcbiAgICB2YXIgcSA9IGkgKyAxO1xuXG4gICAgLy8gKDIpIFJlY3Vyc2Ugb24gZWFjaCBoYWxmLlxuXG4gICAgZG9RdWlja1NvcnQoYXJ5LCBjb21wYXJhdG9yLCBwLCBxIC0gMSk7XG4gICAgZG9RdWlja1NvcnQoYXJ5LCBjb21wYXJhdG9yLCBxICsgMSwgcik7XG4gIH1cbn1cblxuLyoqXG4gKiBTb3J0IHRoZSBnaXZlbiBhcnJheSBpbi1wbGFjZSB3aXRoIHRoZSBnaXZlbiBjb21wYXJhdG9yIGZ1bmN0aW9uLlxuICpcbiAqIEBwYXJhbSB7QXJyYXl9IGFyeVxuICogICAgICAgIEFuIGFycmF5IHRvIHNvcnQuXG4gKiBAcGFyYW0ge2Z1bmN0aW9ufSBjb21wYXJhdG9yXG4gKiAgICAgICAgRnVuY3Rpb24gdG8gdXNlIHRvIGNvbXBhcmUgdHdvIGl0ZW1zLlxuICovXG5leHBvcnRzLnF1aWNrU29ydCA9IGZ1bmN0aW9uIChhcnksIGNvbXBhcmF0b3IpIHtcbiAgZG9RdWlja1NvcnQoYXJ5LCBjb21wYXJhdG9yLCAwLCBhcnkubGVuZ3RoIC0gMSk7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvcXVpY2stc29ydC5qc1xuLy8gbW9kdWxlIGlkID0gOVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiLCIvKiAtKi0gTW9kZToganM7IGpzLWluZGVudC1sZXZlbDogMjsgLSotICovXG4vKlxuICogQ29weXJpZ2h0IDIwMTEgTW96aWxsYSBGb3VuZGF0aW9uIGFuZCBjb250cmlidXRvcnNcbiAqIExpY2Vuc2VkIHVuZGVyIHRoZSBOZXcgQlNEIGxpY2Vuc2UuIFNlZSBMSUNFTlNFIG9yOlxuICogaHR0cDovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0zLUNsYXVzZVxuICovXG5cbnZhciBTb3VyY2VNYXBHZW5lcmF0b3IgPSByZXF1aXJlKCcuL3NvdXJjZS1tYXAtZ2VuZXJhdG9yJykuU291cmNlTWFwR2VuZXJhdG9yO1xudmFyIHV0aWwgPSByZXF1aXJlKCcuL3V0aWwnKTtcblxuLy8gTWF0Y2hlcyBhIFdpbmRvd3Mtc3R5bGUgYFxcclxcbmAgbmV3bGluZSBvciBhIGBcXG5gIG5ld2xpbmUgdXNlZCBieSBhbGwgb3RoZXJcbi8vIG9wZXJhdGluZyBzeXN0ZW1zIHRoZXNlIGRheXMgKGNhcHR1cmluZyB0aGUgcmVzdWx0KS5cbnZhciBSRUdFWF9ORVdMSU5FID0gLyhcXHI/XFxuKS87XG5cbi8vIE5ld2xpbmUgY2hhcmFjdGVyIGNvZGUgZm9yIGNoYXJDb2RlQXQoKSBjb21wYXJpc29uc1xudmFyIE5FV0xJTkVfQ09ERSA9IDEwO1xuXG4vLyBQcml2YXRlIHN5bWJvbCBmb3IgaWRlbnRpZnlpbmcgYFNvdXJjZU5vZGVgcyB3aGVuIG11bHRpcGxlIHZlcnNpb25zIG9mXG4vLyB0aGUgc291cmNlLW1hcCBsaWJyYXJ5IGFyZSBsb2FkZWQuIFRoaXMgTVVTVCBOT1QgQ0hBTkdFIGFjcm9zc1xuLy8gdmVyc2lvbnMhXG52YXIgaXNTb3VyY2VOb2RlID0gXCIkJCRpc1NvdXJjZU5vZGUkJCRcIjtcblxuLyoqXG4gKiBTb3VyY2VOb2RlcyBwcm92aWRlIGEgd2F5IHRvIGFic3RyYWN0IG92ZXIgaW50ZXJwb2xhdGluZy9jb25jYXRlbmF0aW5nXG4gKiBzbmlwcGV0cyBvZiBnZW5lcmF0ZWQgSmF2YVNjcmlwdCBzb3VyY2UgY29kZSB3aGlsZSBtYWludGFpbmluZyB0aGUgbGluZSBhbmRcbiAqIGNvbHVtbiBpbmZvcm1hdGlvbiBhc3NvY2lhdGVkIHdpdGggdGhlIG9yaWdpbmFsIHNvdXJjZSBjb2RlLlxuICpcbiAqIEBwYXJhbSBhTGluZSBUaGUgb3JpZ2luYWwgbGluZSBudW1iZXIuXG4gKiBAcGFyYW0gYUNvbHVtbiBUaGUgb3JpZ2luYWwgY29sdW1uIG51bWJlci5cbiAqIEBwYXJhbSBhU291cmNlIFRoZSBvcmlnaW5hbCBzb3VyY2UncyBmaWxlbmFtZS5cbiAqIEBwYXJhbSBhQ2h1bmtzIE9wdGlvbmFsLiBBbiBhcnJheSBvZiBzdHJpbmdzIHdoaWNoIGFyZSBzbmlwcGV0cyBvZlxuICogICAgICAgIGdlbmVyYXRlZCBKUywgb3Igb3RoZXIgU291cmNlTm9kZXMuXG4gKiBAcGFyYW0gYU5hbWUgVGhlIG9yaWdpbmFsIGlkZW50aWZpZXIuXG4gKi9cbmZ1bmN0aW9uIFNvdXJjZU5vZGUoYUxpbmUsIGFDb2x1bW4sIGFTb3VyY2UsIGFDaHVua3MsIGFOYW1lKSB7XG4gIHRoaXMuY2hpbGRyZW4gPSBbXTtcbiAgdGhpcy5zb3VyY2VDb250ZW50cyA9IHt9O1xuICB0aGlzLmxpbmUgPSBhTGluZSA9PSBudWxsID8gbnVsbCA6IGFMaW5lO1xuICB0aGlzLmNvbHVtbiA9IGFDb2x1bW4gPT0gbnVsbCA/IG51bGwgOiBhQ29sdW1uO1xuICB0aGlzLnNvdXJjZSA9IGFTb3VyY2UgPT0gbnVsbCA/IG51bGwgOiBhU291cmNlO1xuICB0aGlzLm5hbWUgPSBhTmFtZSA9PSBudWxsID8gbnVsbCA6IGFOYW1lO1xuICB0aGlzW2lzU291cmNlTm9kZV0gPSB0cnVlO1xuICBpZiAoYUNodW5rcyAhPSBudWxsKSB0aGlzLmFkZChhQ2h1bmtzKTtcbn1cblxuLyoqXG4gKiBDcmVhdGVzIGEgU291cmNlTm9kZSBmcm9tIGdlbmVyYXRlZCBjb2RlIGFuZCBhIFNvdXJjZU1hcENvbnN1bWVyLlxuICpcbiAqIEBwYXJhbSBhR2VuZXJhdGVkQ29kZSBUaGUgZ2VuZXJhdGVkIGNvZGVcbiAqIEBwYXJhbSBhU291cmNlTWFwQ29uc3VtZXIgVGhlIFNvdXJjZU1hcCBmb3IgdGhlIGdlbmVyYXRlZCBjb2RlXG4gKiBAcGFyYW0gYVJlbGF0aXZlUGF0aCBPcHRpb25hbC4gVGhlIHBhdGggdGhhdCByZWxhdGl2ZSBzb3VyY2VzIGluIHRoZVxuICogICAgICAgIFNvdXJjZU1hcENvbnN1bWVyIHNob3VsZCBiZSByZWxhdGl2ZSB0by5cbiAqL1xuU291cmNlTm9kZS5mcm9tU3RyaW5nV2l0aFNvdXJjZU1hcCA9XG4gIGZ1bmN0aW9uIFNvdXJjZU5vZGVfZnJvbVN0cmluZ1dpdGhTb3VyY2VNYXAoYUdlbmVyYXRlZENvZGUsIGFTb3VyY2VNYXBDb25zdW1lciwgYVJlbGF0aXZlUGF0aCkge1xuICAgIC8vIFRoZSBTb3VyY2VOb2RlIHdlIHdhbnQgdG8gZmlsbCB3aXRoIHRoZSBnZW5lcmF0ZWQgY29kZVxuICAgIC8vIGFuZCB0aGUgU291cmNlTWFwXG4gICAgdmFyIG5vZGUgPSBuZXcgU291cmNlTm9kZSgpO1xuXG4gICAgLy8gQWxsIGV2ZW4gaW5kaWNlcyBvZiB0aGlzIGFycmF5IGFyZSBvbmUgbGluZSBvZiB0aGUgZ2VuZXJhdGVkIGNvZGUsXG4gICAgLy8gd2hpbGUgYWxsIG9kZCBpbmRpY2VzIGFyZSB0aGUgbmV3bGluZXMgYmV0d2VlbiB0d28gYWRqYWNlbnQgbGluZXNcbiAgICAvLyAoc2luY2UgYFJFR0VYX05FV0xJTkVgIGNhcHR1cmVzIGl0cyBtYXRjaCkuXG4gICAgLy8gUHJvY2Vzc2VkIGZyYWdtZW50cyBhcmUgYWNjZXNzZWQgYnkgY2FsbGluZyBgc2hpZnROZXh0TGluZWAuXG4gICAgdmFyIHJlbWFpbmluZ0xpbmVzID0gYUdlbmVyYXRlZENvZGUuc3BsaXQoUkVHRVhfTkVXTElORSk7XG4gICAgdmFyIHJlbWFpbmluZ0xpbmVzSW5kZXggPSAwO1xuICAgIHZhciBzaGlmdE5leHRMaW5lID0gZnVuY3Rpb24oKSB7XG4gICAgICB2YXIgbGluZUNvbnRlbnRzID0gZ2V0TmV4dExpbmUoKTtcbiAgICAgIC8vIFRoZSBsYXN0IGxpbmUgb2YgYSBmaWxlIG1pZ2h0IG5vdCBoYXZlIGEgbmV3bGluZS5cbiAgICAgIHZhciBuZXdMaW5lID0gZ2V0TmV4dExpbmUoKSB8fCBcIlwiO1xuICAgICAgcmV0dXJuIGxpbmVDb250ZW50cyArIG5ld0xpbmU7XG5cbiAgICAgIGZ1bmN0aW9uIGdldE5leHRMaW5lKCkge1xuICAgICAgICByZXR1cm4gcmVtYWluaW5nTGluZXNJbmRleCA8IHJlbWFpbmluZ0xpbmVzLmxlbmd0aCA/XG4gICAgICAgICAgICByZW1haW5pbmdMaW5lc1tyZW1haW5pbmdMaW5lc0luZGV4KytdIDogdW5kZWZpbmVkO1xuICAgICAgfVxuICAgIH07XG5cbiAgICAvLyBXZSBuZWVkIHRvIHJlbWVtYmVyIHRoZSBwb3NpdGlvbiBvZiBcInJlbWFpbmluZ0xpbmVzXCJcbiAgICB2YXIgbGFzdEdlbmVyYXRlZExpbmUgPSAxLCBsYXN0R2VuZXJhdGVkQ29sdW1uID0gMDtcblxuICAgIC8vIFRoZSBnZW5lcmF0ZSBTb3VyY2VOb2RlcyB3ZSBuZWVkIGEgY29kZSByYW5nZS5cbiAgICAvLyBUbyBleHRyYWN0IGl0IGN1cnJlbnQgYW5kIGxhc3QgbWFwcGluZyBpcyB1c2VkLlxuICAgIC8vIEhlcmUgd2Ugc3RvcmUgdGhlIGxhc3QgbWFwcGluZy5cbiAgICB2YXIgbGFzdE1hcHBpbmcgPSBudWxsO1xuXG4gICAgYVNvdXJjZU1hcENvbnN1bWVyLmVhY2hNYXBwaW5nKGZ1bmN0aW9uIChtYXBwaW5nKSB7XG4gICAgICBpZiAobGFzdE1hcHBpbmcgIT09IG51bGwpIHtcbiAgICAgICAgLy8gV2UgYWRkIHRoZSBjb2RlIGZyb20gXCJsYXN0TWFwcGluZ1wiIHRvIFwibWFwcGluZ1wiOlxuICAgICAgICAvLyBGaXJzdCBjaGVjayBpZiB0aGVyZSBpcyBhIG5ldyBsaW5lIGluIGJldHdlZW4uXG4gICAgICAgIGlmIChsYXN0R2VuZXJhdGVkTGluZSA8IG1hcHBpbmcuZ2VuZXJhdGVkTGluZSkge1xuICAgICAgICAgIC8vIEFzc29jaWF0ZSBmaXJzdCBsaW5lIHdpdGggXCJsYXN0TWFwcGluZ1wiXG4gICAgICAgICAgYWRkTWFwcGluZ1dpdGhDb2RlKGxhc3RNYXBwaW5nLCBzaGlmdE5leHRMaW5lKCkpO1xuICAgICAgICAgIGxhc3RHZW5lcmF0ZWRMaW5lKys7XG4gICAgICAgICAgbGFzdEdlbmVyYXRlZENvbHVtbiA9IDA7XG4gICAgICAgICAgLy8gVGhlIHJlbWFpbmluZyBjb2RlIGlzIGFkZGVkIHdpdGhvdXQgbWFwcGluZ1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIC8vIFRoZXJlIGlzIG5vIG5ldyBsaW5lIGluIGJldHdlZW4uXG4gICAgICAgICAgLy8gQXNzb2NpYXRlIHRoZSBjb2RlIGJldHdlZW4gXCJsYXN0R2VuZXJhdGVkQ29sdW1uXCIgYW5kXG4gICAgICAgICAgLy8gXCJtYXBwaW5nLmdlbmVyYXRlZENvbHVtblwiIHdpdGggXCJsYXN0TWFwcGluZ1wiXG4gICAgICAgICAgdmFyIG5leHRMaW5lID0gcmVtYWluaW5nTGluZXNbcmVtYWluaW5nTGluZXNJbmRleF07XG4gICAgICAgICAgdmFyIGNvZGUgPSBuZXh0TGluZS5zdWJzdHIoMCwgbWFwcGluZy5nZW5lcmF0ZWRDb2x1bW4gLVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RHZW5lcmF0ZWRDb2x1bW4pO1xuICAgICAgICAgIHJlbWFpbmluZ0xpbmVzW3JlbWFpbmluZ0xpbmVzSW5kZXhdID0gbmV4dExpbmUuc3Vic3RyKG1hcHBpbmcuZ2VuZXJhdGVkQ29sdW1uIC1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0R2VuZXJhdGVkQ29sdW1uKTtcbiAgICAgICAgICBsYXN0R2VuZXJhdGVkQ29sdW1uID0gbWFwcGluZy5nZW5lcmF0ZWRDb2x1bW47XG4gICAgICAgICAgYWRkTWFwcGluZ1dpdGhDb2RlKGxhc3RNYXBwaW5nLCBjb2RlKTtcbiAgICAgICAgICAvLyBObyBtb3JlIHJlbWFpbmluZyBjb2RlLCBjb250aW51ZVxuICAgICAgICAgIGxhc3RNYXBwaW5nID0gbWFwcGluZztcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIC8vIFdlIGFkZCB0aGUgZ2VuZXJhdGVkIGNvZGUgdW50aWwgdGhlIGZpcnN0IG1hcHBpbmdcbiAgICAgIC8vIHRvIHRoZSBTb3VyY2VOb2RlIHdpdGhvdXQgYW55IG1hcHBpbmcuXG4gICAgICAvLyBFYWNoIGxpbmUgaXMgYWRkZWQgYXMgc2VwYXJhdGUgc3RyaW5nLlxuICAgICAgd2hpbGUgKGxhc3RHZW5lcmF0ZWRMaW5lIDwgbWFwcGluZy5nZW5lcmF0ZWRMaW5lKSB7XG4gICAgICAgIG5vZGUuYWRkKHNoaWZ0TmV4dExpbmUoKSk7XG4gICAgICAgIGxhc3RHZW5lcmF0ZWRMaW5lKys7XG4gICAgICB9XG4gICAgICBpZiAobGFzdEdlbmVyYXRlZENvbHVtbiA8IG1hcHBpbmcuZ2VuZXJhdGVkQ29sdW1uKSB7XG4gICAgICAgIHZhciBuZXh0TGluZSA9IHJlbWFpbmluZ0xpbmVzW3JlbWFpbmluZ0xpbmVzSW5kZXhdO1xuICAgICAgICBub2RlLmFkZChuZXh0TGluZS5zdWJzdHIoMCwgbWFwcGluZy5nZW5lcmF0ZWRDb2x1bW4pKTtcbiAgICAgICAgcmVtYWluaW5nTGluZXNbcmVtYWluaW5nTGluZXNJbmRleF0gPSBuZXh0TGluZS5zdWJzdHIobWFwcGluZy5nZW5lcmF0ZWRDb2x1bW4pO1xuICAgICAgICBsYXN0R2VuZXJhdGVkQ29sdW1uID0gbWFwcGluZy5nZW5lcmF0ZWRDb2x1bW47XG4gICAgICB9XG4gICAgICBsYXN0TWFwcGluZyA9IG1hcHBpbmc7XG4gICAgfSwgdGhpcyk7XG4gICAgLy8gV2UgaGF2ZSBwcm9jZXNzZWQgYWxsIG1hcHBpbmdzLlxuICAgIGlmIChyZW1haW5pbmdMaW5lc0luZGV4IDwgcmVtYWluaW5nTGluZXMubGVuZ3RoKSB7XG4gICAgICBpZiAobGFzdE1hcHBpbmcpIHtcbiAgICAgICAgLy8gQXNzb2NpYXRlIHRoZSByZW1haW5pbmcgY29kZSBpbiB0aGUgY3VycmVudCBsaW5lIHdpdGggXCJsYXN0TWFwcGluZ1wiXG4gICAgICAgIGFkZE1hcHBpbmdXaXRoQ29kZShsYXN0TWFwcGluZywgc2hpZnROZXh0TGluZSgpKTtcbiAgICAgIH1cbiAgICAgIC8vIGFuZCBhZGQgdGhlIHJlbWFpbmluZyBsaW5lcyB3aXRob3V0IGFueSBtYXBwaW5nXG4gICAgICBub2RlLmFkZChyZW1haW5pbmdMaW5lcy5zcGxpY2UocmVtYWluaW5nTGluZXNJbmRleCkuam9pbihcIlwiKSk7XG4gICAgfVxuXG4gICAgLy8gQ29weSBzb3VyY2VzQ29udGVudCBpbnRvIFNvdXJjZU5vZGVcbiAgICBhU291cmNlTWFwQ29uc3VtZXIuc291cmNlcy5mb3JFYWNoKGZ1bmN0aW9uIChzb3VyY2VGaWxlKSB7XG4gICAgICB2YXIgY29udGVudCA9IGFTb3VyY2VNYXBDb25zdW1lci5zb3VyY2VDb250ZW50Rm9yKHNvdXJjZUZpbGUpO1xuICAgICAgaWYgKGNvbnRlbnQgIT0gbnVsbCkge1xuICAgICAgICBpZiAoYVJlbGF0aXZlUGF0aCAhPSBudWxsKSB7XG4gICAgICAgICAgc291cmNlRmlsZSA9IHV0aWwuam9pbihhUmVsYXRpdmVQYXRoLCBzb3VyY2VGaWxlKTtcbiAgICAgICAgfVxuICAgICAgICBub2RlLnNldFNvdXJjZUNvbnRlbnQoc291cmNlRmlsZSwgY29udGVudCk7XG4gICAgICB9XG4gICAgfSk7XG5cbiAgICByZXR1cm4gbm9kZTtcblxuICAgIGZ1bmN0aW9uIGFkZE1hcHBpbmdXaXRoQ29kZShtYXBwaW5nLCBjb2RlKSB7XG4gICAgICBpZiAobWFwcGluZyA9PT0gbnVsbCB8fCBtYXBwaW5nLnNvdXJjZSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIG5vZGUuYWRkKGNvZGUpO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgdmFyIHNvdXJjZSA9IGFSZWxhdGl2ZVBhdGhcbiAgICAgICAgICA/IHV0aWwuam9pbihhUmVsYXRpdmVQYXRoLCBtYXBwaW5nLnNvdXJjZSlcbiAgICAgICAgICA6IG1hcHBpbmcuc291cmNlO1xuICAgICAgICBub2RlLmFkZChuZXcgU291cmNlTm9kZShtYXBwaW5nLm9yaWdpbmFsTGluZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFwcGluZy5vcmlnaW5hbENvbHVtbixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXBwaW5nLm5hbWUpKTtcbiAgICAgIH1cbiAgICB9XG4gIH07XG5cbi8qKlxuICogQWRkIGEgY2h1bmsgb2YgZ2VuZXJhdGVkIEpTIHRvIHRoaXMgc291cmNlIG5vZGUuXG4gKlxuICogQHBhcmFtIGFDaHVuayBBIHN0cmluZyBzbmlwcGV0IG9mIGdlbmVyYXRlZCBKUyBjb2RlLCBhbm90aGVyIGluc3RhbmNlIG9mXG4gKiAgICAgICAgU291cmNlTm9kZSwgb3IgYW4gYXJyYXkgd2hlcmUgZWFjaCBtZW1iZXIgaXMgb25lIG9mIHRob3NlIHRoaW5ncy5cbiAqL1xuU291cmNlTm9kZS5wcm90b3R5cGUuYWRkID0gZnVuY3Rpb24gU291cmNlTm9kZV9hZGQoYUNodW5rKSB7XG4gIGlmIChBcnJheS5pc0FycmF5KGFDaHVuaykpIHtcbiAgICBhQ2h1bmsuZm9yRWFjaChmdW5jdGlvbiAoY2h1bmspIHtcbiAgICAgIHRoaXMuYWRkKGNodW5rKTtcbiAgICB9LCB0aGlzKTtcbiAgfVxuICBlbHNlIGlmIChhQ2h1bmtbaXNTb3VyY2VOb2RlXSB8fCB0eXBlb2YgYUNodW5rID09PSBcInN0cmluZ1wiKSB7XG4gICAgaWYgKGFDaHVuaykge1xuICAgICAgdGhpcy5jaGlsZHJlbi5wdXNoKGFDaHVuayk7XG4gICAgfVxuICB9XG4gIGVsc2Uge1xuICAgIHRocm93IG5ldyBUeXBlRXJyb3IoXG4gICAgICBcIkV4cGVjdGVkIGEgU291cmNlTm9kZSwgc3RyaW5nLCBvciBhbiBhcnJheSBvZiBTb3VyY2VOb2RlcyBhbmQgc3RyaW5ncy4gR290IFwiICsgYUNodW5rXG4gICAgKTtcbiAgfVxuICByZXR1cm4gdGhpcztcbn07XG5cbi8qKlxuICogQWRkIGEgY2h1bmsgb2YgZ2VuZXJhdGVkIEpTIHRvIHRoZSBiZWdpbm5pbmcgb2YgdGhpcyBzb3VyY2Ugbm9kZS5cbiAqXG4gKiBAcGFyYW0gYUNodW5rIEEgc3RyaW5nIHNuaXBwZXQgb2YgZ2VuZXJhdGVkIEpTIGNvZGUsIGFub3RoZXIgaW5zdGFuY2Ugb2ZcbiAqICAgICAgICBTb3VyY2VOb2RlLCBvciBhbiBhcnJheSB3aGVyZSBlYWNoIG1lbWJlciBpcyBvbmUgb2YgdGhvc2UgdGhpbmdzLlxuICovXG5Tb3VyY2VOb2RlLnByb3RvdHlwZS5wcmVwZW5kID0gZnVuY3Rpb24gU291cmNlTm9kZV9wcmVwZW5kKGFDaHVuaykge1xuICBpZiAoQXJyYXkuaXNBcnJheShhQ2h1bmspKSB7XG4gICAgZm9yICh2YXIgaSA9IGFDaHVuay5sZW5ndGgtMTsgaSA+PSAwOyBpLS0pIHtcbiAgICAgIHRoaXMucHJlcGVuZChhQ2h1bmtbaV0pO1xuICAgIH1cbiAgfVxuICBlbHNlIGlmIChhQ2h1bmtbaXNTb3VyY2VOb2RlXSB8fCB0eXBlb2YgYUNodW5rID09PSBcInN0cmluZ1wiKSB7XG4gICAgdGhpcy5jaGlsZHJlbi51bnNoaWZ0KGFDaHVuayk7XG4gIH1cbiAgZWxzZSB7XG4gICAgdGhyb3cgbmV3IFR5cGVFcnJvcihcbiAgICAgIFwiRXhwZWN0ZWQgYSBTb3VyY2VOb2RlLCBzdHJpbmcsIG9yIGFuIGFycmF5IG9mIFNvdXJjZU5vZGVzIGFuZCBzdHJpbmdzLiBHb3QgXCIgKyBhQ2h1bmtcbiAgICApO1xuICB9XG4gIHJldHVybiB0aGlzO1xufTtcblxuLyoqXG4gKiBXYWxrIG92ZXIgdGhlIHRyZWUgb2YgSlMgc25pcHBldHMgaW4gdGhpcyBub2RlIGFuZCBpdHMgY2hpbGRyZW4uIFRoZVxuICogd2Fsa2luZyBmdW5jdGlvbiBpcyBjYWxsZWQgb25jZSBmb3IgZWFjaCBzbmlwcGV0IG9mIEpTIGFuZCBpcyBwYXNzZWQgdGhhdFxuICogc25pcHBldCBhbmQgdGhlIGl0cyBvcmlnaW5hbCBhc3NvY2lhdGVkIHNvdXJjZSdzIGxpbmUvY29sdW1uIGxvY2F0aW9uLlxuICpcbiAqIEBwYXJhbSBhRm4gVGhlIHRyYXZlcnNhbCBmdW5jdGlvbi5cbiAqL1xuU291cmNlTm9kZS5wcm90b3R5cGUud2FsayA9IGZ1bmN0aW9uIFNvdXJjZU5vZGVfd2FsayhhRm4pIHtcbiAgdmFyIGNodW5rO1xuICBmb3IgKHZhciBpID0gMCwgbGVuID0gdGhpcy5jaGlsZHJlbi5sZW5ndGg7IGkgPCBsZW47IGkrKykge1xuICAgIGNodW5rID0gdGhpcy5jaGlsZHJlbltpXTtcbiAgICBpZiAoY2h1bmtbaXNTb3VyY2VOb2RlXSkge1xuICAgICAgY2h1bmsud2FsayhhRm4pO1xuICAgIH1cbiAgICBlbHNlIHtcbiAgICAgIGlmIChjaHVuayAhPT0gJycpIHtcbiAgICAgICAgYUZuKGNodW5rLCB7IHNvdXJjZTogdGhpcy5zb3VyY2UsXG4gICAgICAgICAgICAgICAgICAgICBsaW5lOiB0aGlzLmxpbmUsXG4gICAgICAgICAgICAgICAgICAgICBjb2x1bW46IHRoaXMuY29sdW1uLFxuICAgICAgICAgICAgICAgICAgICAgbmFtZTogdGhpcy5uYW1lIH0pO1xuICAgICAgfVxuICAgIH1cbiAgfVxufTtcblxuLyoqXG4gKiBMaWtlIGBTdHJpbmcucHJvdG90eXBlLmpvaW5gIGV4Y2VwdCBmb3IgU291cmNlTm9kZXMuIEluc2VydHMgYGFTdHJgIGJldHdlZW5cbiAqIGVhY2ggb2YgYHRoaXMuY2hpbGRyZW5gLlxuICpcbiAqIEBwYXJhbSBhU2VwIFRoZSBzZXBhcmF0b3IuXG4gKi9cblNvdXJjZU5vZGUucHJvdG90eXBlLmpvaW4gPSBmdW5jdGlvbiBTb3VyY2VOb2RlX2pvaW4oYVNlcCkge1xuICB2YXIgbmV3Q2hpbGRyZW47XG4gIHZhciBpO1xuICB2YXIgbGVuID0gdGhpcy5jaGlsZHJlbi5sZW5ndGg7XG4gIGlmIChsZW4gPiAwKSB7XG4gICAgbmV3Q2hpbGRyZW4gPSBbXTtcbiAgICBmb3IgKGkgPSAwOyBpIDwgbGVuLTE7IGkrKykge1xuICAgICAgbmV3Q2hpbGRyZW4ucHVzaCh0aGlzLmNoaWxkcmVuW2ldKTtcbiAgICAgIG5ld0NoaWxkcmVuLnB1c2goYVNlcCk7XG4gICAgfVxuICAgIG5ld0NoaWxkcmVuLnB1c2godGhpcy5jaGlsZHJlbltpXSk7XG4gICAgdGhpcy5jaGlsZHJlbiA9IG5ld0NoaWxkcmVuO1xuICB9XG4gIHJldHVybiB0aGlzO1xufTtcblxuLyoqXG4gKiBDYWxsIFN0cmluZy5wcm90b3R5cGUucmVwbGFjZSBvbiB0aGUgdmVyeSByaWdodC1tb3N0IHNvdXJjZSBzbmlwcGV0LiBVc2VmdWxcbiAqIGZvciB0cmltbWluZyB3aGl0ZXNwYWNlIGZyb20gdGhlIGVuZCBvZiBhIHNvdXJjZSBub2RlLCBldGMuXG4gKlxuICogQHBhcmFtIGFQYXR0ZXJuIFRoZSBwYXR0ZXJuIHRvIHJlcGxhY2UuXG4gKiBAcGFyYW0gYVJlcGxhY2VtZW50IFRoZSB0aGluZyB0byByZXBsYWNlIHRoZSBwYXR0ZXJuIHdpdGguXG4gKi9cblNvdXJjZU5vZGUucHJvdG90eXBlLnJlcGxhY2VSaWdodCA9IGZ1bmN0aW9uIFNvdXJjZU5vZGVfcmVwbGFjZVJpZ2h0KGFQYXR0ZXJuLCBhUmVwbGFjZW1lbnQpIHtcbiAgdmFyIGxhc3RDaGlsZCA9IHRoaXMuY2hpbGRyZW5bdGhpcy5jaGlsZHJlbi5sZW5ndGggLSAxXTtcbiAgaWYgKGxhc3RDaGlsZFtpc1NvdXJjZU5vZGVdKSB7XG4gICAgbGFzdENoaWxkLnJlcGxhY2VSaWdodChhUGF0dGVybiwgYVJlcGxhY2VtZW50KTtcbiAgfVxuICBlbHNlIGlmICh0eXBlb2YgbGFzdENoaWxkID09PSAnc3RyaW5nJykge1xuICAgIHRoaXMuY2hpbGRyZW5bdGhpcy5jaGlsZHJlbi5sZW5ndGggLSAxXSA9IGxhc3RDaGlsZC5yZXBsYWNlKGFQYXR0ZXJuLCBhUmVwbGFjZW1lbnQpO1xuICB9XG4gIGVsc2Uge1xuICAgIHRoaXMuY2hpbGRyZW4ucHVzaCgnJy5yZXBsYWNlKGFQYXR0ZXJuLCBhUmVwbGFjZW1lbnQpKTtcbiAgfVxuICByZXR1cm4gdGhpcztcbn07XG5cbi8qKlxuICogU2V0IHRoZSBzb3VyY2UgY29udGVudCBmb3IgYSBzb3VyY2UgZmlsZS4gVGhpcyB3aWxsIGJlIGFkZGVkIHRvIHRoZSBTb3VyY2VNYXBHZW5lcmF0b3JcbiAqIGluIHRoZSBzb3VyY2VzQ29udGVudCBmaWVsZC5cbiAqXG4gKiBAcGFyYW0gYVNvdXJjZUZpbGUgVGhlIGZpbGVuYW1lIG9mIHRoZSBzb3VyY2UgZmlsZVxuICogQHBhcmFtIGFTb3VyY2VDb250ZW50IFRoZSBjb250ZW50IG9mIHRoZSBzb3VyY2UgZmlsZVxuICovXG5Tb3VyY2VOb2RlLnByb3RvdHlwZS5zZXRTb3VyY2VDb250ZW50ID1cbiAgZnVuY3Rpb24gU291cmNlTm9kZV9zZXRTb3VyY2VDb250ZW50KGFTb3VyY2VGaWxlLCBhU291cmNlQ29udGVudCkge1xuICAgIHRoaXMuc291cmNlQ29udGVudHNbdXRpbC50b1NldFN0cmluZyhhU291cmNlRmlsZSldID0gYVNvdXJjZUNvbnRlbnQ7XG4gIH07XG5cbi8qKlxuICogV2FsayBvdmVyIHRoZSB0cmVlIG9mIFNvdXJjZU5vZGVzLiBUaGUgd2Fsa2luZyBmdW5jdGlvbiBpcyBjYWxsZWQgZm9yIGVhY2hcbiAqIHNvdXJjZSBmaWxlIGNvbnRlbnQgYW5kIGlzIHBhc3NlZCB0aGUgZmlsZW5hbWUgYW5kIHNvdXJjZSBjb250ZW50LlxuICpcbiAqIEBwYXJhbSBhRm4gVGhlIHRyYXZlcnNhbCBmdW5jdGlvbi5cbiAqL1xuU291cmNlTm9kZS5wcm90b3R5cGUud2Fsa1NvdXJjZUNvbnRlbnRzID1cbiAgZnVuY3Rpb24gU291cmNlTm9kZV93YWxrU291cmNlQ29udGVudHMoYUZuKSB7XG4gICAgZm9yICh2YXIgaSA9IDAsIGxlbiA9IHRoaXMuY2hpbGRyZW4ubGVuZ3RoOyBpIDwgbGVuOyBpKyspIHtcbiAgICAgIGlmICh0aGlzLmNoaWxkcmVuW2ldW2lzU291cmNlTm9kZV0pIHtcbiAgICAgICAgdGhpcy5jaGlsZHJlbltpXS53YWxrU291cmNlQ29udGVudHMoYUZuKTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICB2YXIgc291cmNlcyA9IE9iamVjdC5rZXlzKHRoaXMuc291cmNlQ29udGVudHMpO1xuICAgIGZvciAodmFyIGkgPSAwLCBsZW4gPSBzb3VyY2VzLmxlbmd0aDsgaSA8IGxlbjsgaSsrKSB7XG4gICAgICBhRm4odXRpbC5mcm9tU2V0U3RyaW5nKHNvdXJjZXNbaV0pLCB0aGlzLnNvdXJjZUNvbnRlbnRzW3NvdXJjZXNbaV1dKTtcbiAgICB9XG4gIH07XG5cbi8qKlxuICogUmV0dXJuIHRoZSBzdHJpbmcgcmVwcmVzZW50YXRpb24gb2YgdGhpcyBzb3VyY2Ugbm9kZS4gV2Fsa3Mgb3ZlciB0aGUgdHJlZVxuICogYW5kIGNvbmNhdGVuYXRlcyBhbGwgdGhlIHZhcmlvdXMgc25pcHBldHMgdG9nZXRoZXIgdG8gb25lIHN0cmluZy5cbiAqL1xuU291cmNlTm9kZS5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiBTb3VyY2VOb2RlX3RvU3RyaW5nKCkge1xuICB2YXIgc3RyID0gXCJcIjtcbiAgdGhpcy53YWxrKGZ1bmN0aW9uIChjaHVuaykge1xuICAgIHN0ciArPSBjaHVuaztcbiAgfSk7XG4gIHJldHVybiBzdHI7XG59O1xuXG4vKipcbiAqIFJldHVybnMgdGhlIHN0cmluZyByZXByZXNlbnRhdGlvbiBvZiB0aGlzIHNvdXJjZSBub2RlIGFsb25nIHdpdGggYSBzb3VyY2VcbiAqIG1hcC5cbiAqL1xuU291cmNlTm9kZS5wcm90b3R5cGUudG9TdHJpbmdXaXRoU291cmNlTWFwID0gZnVuY3Rpb24gU291cmNlTm9kZV90b1N0cmluZ1dpdGhTb3VyY2VNYXAoYUFyZ3MpIHtcbiAgdmFyIGdlbmVyYXRlZCA9IHtcbiAgICBjb2RlOiBcIlwiLFxuICAgIGxpbmU6IDEsXG4gICAgY29sdW1uOiAwXG4gIH07XG4gIHZhciBtYXAgPSBuZXcgU291cmNlTWFwR2VuZXJhdG9yKGFBcmdzKTtcbiAgdmFyIHNvdXJjZU1hcHBpbmdBY3RpdmUgPSBmYWxzZTtcbiAgdmFyIGxhc3RPcmlnaW5hbFNvdXJjZSA9IG51bGw7XG4gIHZhciBsYXN0T3JpZ2luYWxMaW5lID0gbnVsbDtcbiAgdmFyIGxhc3RPcmlnaW5hbENvbHVtbiA9IG51bGw7XG4gIHZhciBsYXN0T3JpZ2luYWxOYW1lID0gbnVsbDtcbiAgdGhpcy53YWxrKGZ1bmN0aW9uIChjaHVuaywgb3JpZ2luYWwpIHtcbiAgICBnZW5lcmF0ZWQuY29kZSArPSBjaHVuaztcbiAgICBpZiAob3JpZ2luYWwuc291cmNlICE9PSBudWxsXG4gICAgICAgICYmIG9yaWdpbmFsLmxpbmUgIT09IG51bGxcbiAgICAgICAgJiYgb3JpZ2luYWwuY29sdW1uICE9PSBudWxsKSB7XG4gICAgICBpZihsYXN0T3JpZ2luYWxTb3VyY2UgIT09IG9yaWdpbmFsLnNvdXJjZVxuICAgICAgICAgfHwgbGFzdE9yaWdpbmFsTGluZSAhPT0gb3JpZ2luYWwubGluZVxuICAgICAgICAgfHwgbGFzdE9yaWdpbmFsQ29sdW1uICE9PSBvcmlnaW5hbC5jb2x1bW5cbiAgICAgICAgIHx8IGxhc3RPcmlnaW5hbE5hbWUgIT09IG9yaWdpbmFsLm5hbWUpIHtcbiAgICAgICAgbWFwLmFkZE1hcHBpbmcoe1xuICAgICAgICAgIHNvdXJjZTogb3JpZ2luYWwuc291cmNlLFxuICAgICAgICAgIG9yaWdpbmFsOiB7XG4gICAgICAgICAgICBsaW5lOiBvcmlnaW5hbC5saW5lLFxuICAgICAgICAgICAgY29sdW1uOiBvcmlnaW5hbC5jb2x1bW5cbiAgICAgICAgICB9LFxuICAgICAgICAgIGdlbmVyYXRlZDoge1xuICAgICAgICAgICAgbGluZTogZ2VuZXJhdGVkLmxpbmUsXG4gICAgICAgICAgICBjb2x1bW46IGdlbmVyYXRlZC5jb2x1bW5cbiAgICAgICAgICB9LFxuICAgICAgICAgIG5hbWU6IG9yaWdpbmFsLm5hbWVcbiAgICAgICAgfSk7XG4gICAgICB9XG4gICAgICBsYXN0T3JpZ2luYWxTb3VyY2UgPSBvcmlnaW5hbC5zb3VyY2U7XG4gICAgICBsYXN0T3JpZ2luYWxMaW5lID0gb3JpZ2luYWwubGluZTtcbiAgICAgIGxhc3RPcmlnaW5hbENvbHVtbiA9IG9yaWdpbmFsLmNvbHVtbjtcbiAgICAgIGxhc3RPcmlnaW5hbE5hbWUgPSBvcmlnaW5hbC5uYW1lO1xuICAgICAgc291cmNlTWFwcGluZ0FjdGl2ZSA9IHRydWU7XG4gICAgfSBlbHNlIGlmIChzb3VyY2VNYXBwaW5nQWN0aXZlKSB7XG4gICAgICBtYXAuYWRkTWFwcGluZyh7XG4gICAgICAgIGdlbmVyYXRlZDoge1xuICAgICAgICAgIGxpbmU6IGdlbmVyYXRlZC5saW5lLFxuICAgICAgICAgIGNvbHVtbjogZ2VuZXJhdGVkLmNvbHVtblxuICAgICAgICB9XG4gICAgICB9KTtcbiAgICAgIGxhc3RPcmlnaW5hbFNvdXJjZSA9IG51bGw7XG4gICAgICBzb3VyY2VNYXBwaW5nQWN0aXZlID0gZmFsc2U7XG4gICAgfVxuICAgIGZvciAodmFyIGlkeCA9IDAsIGxlbmd0aCA9IGNodW5rLmxlbmd0aDsgaWR4IDwgbGVuZ3RoOyBpZHgrKykge1xuICAgICAgaWYgKGNodW5rLmNoYXJDb2RlQXQoaWR4KSA9PT0gTkVXTElORV9DT0RFKSB7XG4gICAgICAgIGdlbmVyYXRlZC5saW5lKys7XG4gICAgICAgIGdlbmVyYXRlZC5jb2x1bW4gPSAwO1xuICAgICAgICAvLyBNYXBwaW5ncyBlbmQgYXQgZW9sXG4gICAgICAgIGlmIChpZHggKyAxID09PSBsZW5ndGgpIHtcbiAgICAgICAgICBsYXN0T3JpZ2luYWxTb3VyY2UgPSBudWxsO1xuICAgICAgICAgIHNvdXJjZU1hcHBpbmdBY3RpdmUgPSBmYWxzZTtcbiAgICAgICAgfSBlbHNlIGlmIChzb3VyY2VNYXBwaW5nQWN0aXZlKSB7XG4gICAgICAgICAgbWFwLmFkZE1hcHBpbmcoe1xuICAgICAgICAgICAgc291cmNlOiBvcmlnaW5hbC5zb3VyY2UsXG4gICAgICAgICAgICBvcmlnaW5hbDoge1xuICAgICAgICAgICAgICBsaW5lOiBvcmlnaW5hbC5saW5lLFxuICAgICAgICAgICAgICBjb2x1bW46IG9yaWdpbmFsLmNvbHVtblxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGdlbmVyYXRlZDoge1xuICAgICAgICAgICAgICBsaW5lOiBnZW5lcmF0ZWQubGluZSxcbiAgICAgICAgICAgICAgY29sdW1uOiBnZW5lcmF0ZWQuY29sdW1uXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgbmFtZTogb3JpZ2luYWwubmFtZVxuICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBnZW5lcmF0ZWQuY29sdW1uKys7XG4gICAgICB9XG4gICAgfVxuICB9KTtcbiAgdGhpcy53YWxrU291cmNlQ29udGVudHMoZnVuY3Rpb24gKHNvdXJjZUZpbGUsIHNvdXJjZUNvbnRlbnQpIHtcbiAgICBtYXAuc2V0U291cmNlQ29udGVudChzb3VyY2VGaWxlLCBzb3VyY2VDb250ZW50KTtcbiAgfSk7XG5cbiAgcmV0dXJuIHsgY29kZTogZ2VuZXJhdGVkLmNvZGUsIG1hcDogbWFwIH07XG59O1xuXG5leHBvcnRzLlNvdXJjZU5vZGUgPSBTb3VyY2VOb2RlO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvc291cmNlLW5vZGUuanNcbi8vIG1vZHVsZSBpZCA9IDEwXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file diff --git a/node_modules/uglify-js/node_modules/source-map/dist/source-map.js b/node_modules/uglify-js/node_modules/source-map/dist/source-map.js new file mode 100644 index 0000000..4e630e2 --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/dist/source-map.js @@ -0,0 +1,3090 @@ +(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) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!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 = Object.create(null); + } + 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) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + 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 next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + 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 consecutive 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; + + var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); + }()); + + function identity (s) { + return s; + } + + /** + * 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) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; + } + exports.toSetString = supportsNullProto ? identity : toSetString; + + function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; + } + exports.fromSetString = supportsNullProto ? identity : fromSetString; + + function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; + } + + /** + * 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); + var has = Object.prototype.hasOwnProperty; + var hasNativeMap = typeof Map !== "undefined"; + + /** + * 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 = hasNativeMap ? new Map() : Object.create(null); + } + + /** + * 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 hasNativeMap ? this._set.size : 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 = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } + }; + + /** + * Is the given string a member of this set? + * + * @param String aStr + */ + ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } + }; + + /** + * What is the index of the given string in the array? + * + * @param String aStr + */ + ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, 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 + .map(String) + // 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.map(String), 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 accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // 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[remainingLinesIndex]; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = 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[remainingLinesIndex]; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + 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.splice(remainingLinesIndex).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/node_modules/uglify-js/node_modules/source-map/dist/source-map.min.js b/node_modules/uglify-js/node_modules/source-map/dist/source-map.min.js new file mode 100644 index 0000000..f2a46bd --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/dist/source-map.min.js @@ -0,0 +1,2 @@ +!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&&(t=String(t),this._sources.has(t)||this._sources.add(t)),null!=o&&(o=String(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=Object.create(null)),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(n&&"number"!=typeof n.line&&"number"!=typeof n.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");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,s=0,a=1,u=0,l=0,c=0,g=0,p="",h=this._mappings.toArray(),f=0,d=h.length;f0){if(!i.compareByGeneratedPositionsInflated(n,h[f-1]))continue;e+=","}e+=o.encode(n.generatedColumn-s),s=n.generatedColumn,null!=n.source&&(t=this._sources.indexOf(n.source),e+=o.encode(t-g),g=t,e+=o.encode(n.originalLine-1-l),l=n.originalLine-1,e+=o.encode(n.originalColumn-u),u=n.originalColumn,null!=n.name&&(r=this._names.indexOf(n.name),e+=o.encode(r-c),c=r)),p+=e}return p},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 e<0?(-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++)),a===-1)throw new Error("Invalid base64 digit: "+e.charAt(n-1));t=!!(a&l),a&=u,g+=a<=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(_))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(t<0)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 g(e)?"$"+e:e}function c(e){return g(e)?e.slice(1):e}function g(e){if(!e)return!1;var n=e.length;if(n<9)return!1;if(95!==e.charCodeAt(n-1)||95!==e.charCodeAt(n-2)||111!==e.charCodeAt(n-3)||116!==e.charCodeAt(n-4)||111!==e.charCodeAt(n-5)||114!==e.charCodeAt(n-6)||112!==e.charCodeAt(n-7)||95!==e.charCodeAt(n-8)||95!==e.charCodeAt(n-9))return!1;for(var r=n-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function p(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 h(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 f(e,n){return e===n?0:e>n?1:-1}function d(e,n){var r=e.generatedLine-n.generatedLine;return 0!==r?r:(r=e.generatedColumn-n.generatedColumn,0!==r?r:(r=f(e.source,n.source),0!==r?r:(r=e.originalLine-n.originalLine,0!==r?r:(r=e.originalColumn-n.originalColumn,0!==r?r:f(e.name,n.name)))))}n.getArg=r;var m=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,_=/^data:.+\,.+$/;n.urlParse=t,n.urlGenerate=o,n.normalize=i,n.join=s,n.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(m)},n.relative=a;var v=function(){var e=Object.create(null);return!("__proto__"in e)}();n.toSetString=v?u:l,n.fromSetString=v?u:c,n.compareByOriginalPositions=p,n.compareByGeneratedPositionsDeflated=h,n.compareByGeneratedPositionsInflated=d},function(e,n,r){function t(){this._array=[],this._set=s?new Map:Object.create(null)}var o=r(4),i=Object.prototype.hasOwnProperty,s="undefined"!=typeof Map;t.fromArray=function(e,n){for(var r=new t,o=0,i=e.length;o=0)return n}else{var r=o.toSetString(e);if(i.call(this._set,r))return this._set[r]}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(String).map(a.normalize).map(function(e){return i&&a.isAbsolute(i)&&a.isAbsolute(e)?a.relative(i,e):e}),this._names=l.fromArray(o.map(String),!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;p1&&(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}))},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:e<0?-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(s<0)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(i=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;r0){for(n=[],r=0;r 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\tSourceMapGenerator.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 next;\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 next = ''\n\t\n\t if (mapping.generatedLine !== previousGeneratedLine) {\n\t previousGeneratedColumn = 0;\n\t while (mapping.generatedLine !== previousGeneratedLine) {\n\t next += ';';\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 next += ',';\n\t }\n\t }\n\t\n\t next += 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 next += base64VLQ.encode(sourceIdx - previousSource);\n\t previousSource = sourceIdx;\n\t\n\t // lines are stored 0-based in SourceMap spec version 3\n\t next += base64VLQ.encode(mapping.originalLine - 1\n\t - previousOriginalLine);\n\t previousOriginalLine = mapping.originalLine - 1;\n\t\n\t next += 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 next += base64VLQ.encode(nameIdx - previousName);\n\t previousName = nameIdx;\n\t }\n\t }\n\t\n\t result += next;\n\t }\n\t\n\t return result;\n\t };\n\t\n\tSourceMapGenerator.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, 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\tSourceMapGenerator.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\tSourceMapGenerator.prototype.toString =\n\t function SourceMapGenerator_toString() {\n\t return JSON.stringify(this.toJSON());\n\t };\n\t\n\texports.SourceMapGenerator = SourceMapGenerator;\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\tvar 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\tvar VLQ_BASE_SHIFT = 5;\n\t\n\t// binary: 100000\n\tvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\t\n\t// binary: 011111\n\tvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\t\n\t// binary: 100000\n\tvar 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\tfunction 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\tfunction 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\texports.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\texports.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\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\tvar 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\texports.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\texports.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\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\tfunction 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\texports.getArg = getArg;\n\t\n\tvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.]*)(?::(\\d+))?(\\S*)$/;\n\tvar dataUrlRegexp = /^data:.+\\,.+$/;\n\t\n\tfunction 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\texports.urlParse = urlParse;\n\t\n\tfunction 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\texports.urlGenerate = urlGenerate;\n\t\n\t/**\n\t * Normalizes a path, or the path portion of a URL:\n\t *\n\t * - Replaces consecutive 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\tfunction 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\texports.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\tfunction 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\texports.join = join;\n\t\n\texports.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\tfunction 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\texports.relative = relative;\n\t\n\tvar supportsNullProto = (function () {\n\t var obj = Object.create(null);\n\t return !('__proto__' in obj);\n\t}());\n\t\n\tfunction identity (s) {\n\t return s;\n\t}\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\tfunction toSetString(aStr) {\n\t if (isProtoString(aStr)) {\n\t return '$' + aStr;\n\t }\n\t\n\t return aStr;\n\t}\n\texports.toSetString = supportsNullProto ? identity : toSetString;\n\t\n\tfunction fromSetString(aStr) {\n\t if (isProtoString(aStr)) {\n\t return aStr.slice(1);\n\t }\n\t\n\t return aStr;\n\t}\n\texports.fromSetString = supportsNullProto ? identity : fromSetString;\n\t\n\tfunction isProtoString(s) {\n\t if (!s) {\n\t return false;\n\t }\n\t\n\t var length = s.length;\n\t\n\t if (length < 9 /* \"__proto__\".length */) {\n\t return false;\n\t }\n\t\n\t if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n\t s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n\t s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n\t s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n\t s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n\t s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 9) !== 95 /* '_' */) {\n\t return false;\n\t }\n\t\n\t for (var i = length - 10; i >= 0; i--) {\n\t if (s.charCodeAt(i) !== 36 /* '$' */) {\n\t return false;\n\t }\n\t }\n\t\n\t return true;\n\t}\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\tfunction 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\texports.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\tfunction 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\texports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\t\n\tfunction 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\tfunction 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\texports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\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\tvar util = __webpack_require__(4);\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar hasNativeMap = typeof Map !== \"undefined\";\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\tfunction ArraySet() {\n\t this._array = [];\n\t this._set = hasNativeMap ? new Map() : Object.create(null);\n\t}\n\t\n\t/**\n\t * Static method for creating ArraySet instances from an existing array.\n\t */\n\tArraySet.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\tArraySet.prototype.size = function ArraySet_size() {\n\t return hasNativeMap ? this._set.size : 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\tArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n\t var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n\t var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, 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 if (hasNativeMap) {\n\t this._set.set(aStr, idx);\n\t } else {\n\t this._set[sStr] = idx;\n\t }\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\tArraySet.prototype.has = function ArraySet_has(aStr) {\n\t if (hasNativeMap) {\n\t return this._set.has(aStr);\n\t } else {\n\t var sStr = util.toSetString(aStr);\n\t return has.call(this._set, sStr);\n\t }\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\tArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n\t if (hasNativeMap) {\n\t var idx = this._set.get(aStr);\n\t if (idx >= 0) {\n\t return idx;\n\t }\n\t } else {\n\t var sStr = util.toSetString(aStr);\n\t if (has.call(this._set, sStr)) {\n\t return this._set[sStr];\n\t }\n\t }\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\tArraySet.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\tArraySet.prototype.toArray = function ArraySet_toArray() {\n\t return this._array.slice();\n\t};\n\t\n\texports.ArraySet = ArraySet;\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\tvar 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\tfunction 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\tfunction 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\tMappingList.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\tMappingList.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\tMappingList.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\texports.MappingList = MappingList;\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\tvar util = __webpack_require__(4);\n\tvar binarySearch = __webpack_require__(8);\n\tvar ArraySet = __webpack_require__(5).ArraySet;\n\tvar base64VLQ = __webpack_require__(2);\n\tvar quickSort = __webpack_require__(9).quickSort;\n\t\n\tfunction 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\tSourceMapConsumer.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\tSourceMapConsumer.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\tSourceMapConsumer.prototype.__generatedMappings = null;\n\tObject.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\tSourceMapConsumer.prototype.__originalMappings = null;\n\tObject.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\tSourceMapConsumer.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\tSourceMapConsumer.prototype._parseMappings =\n\t function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t throw new Error(\"Subclasses must implement _parseMappings\");\n\t };\n\t\n\tSourceMapConsumer.GENERATED_ORDER = 1;\n\tSourceMapConsumer.ORIGINAL_ORDER = 2;\n\t\n\tSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\n\tSourceMapConsumer.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\tSourceMapConsumer.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\tSourceMapConsumer.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\texports.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\tfunction 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 .map(String)\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.map(String), 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\tBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.prototype._version = 3;\n\t\n\t/**\n\t * The list of original sources.\n\t */\n\tObject.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\tfunction 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\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.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\tBasicSourceMapConsumer.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\texports.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\tfunction 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\tIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n\tIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\t\n\t/**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\tIndexedSourceMapConsumer.prototype._version = 3;\n\t\n\t/**\n\t * The list of original sources.\n\t */\n\tObject.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\tIndexedSourceMapConsumer.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\tIndexedSourceMapConsumer.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\tIndexedSourceMapConsumer.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\tIndexedSourceMapConsumer.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\tIndexedSourceMapConsumer.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\texports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\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\texports.GREATEST_LOWER_BOUND = 1;\n\texports.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\tfunction 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\texports.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\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\tfunction 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\tfunction 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\tfunction 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\texports.quickSort = function (ary, comparator) {\n\t doQuickSort(ary, comparator, 0, ary.length - 1);\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\tvar SourceMapGenerator = __webpack_require__(1).SourceMapGenerator;\n\tvar 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\tvar REGEX_NEWLINE = /(\\r?\\n)/;\n\t\n\t// Newline character code for charCodeAt() comparisons\n\tvar 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\tvar 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\tfunction 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\tSourceNode.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 accessed by calling `shiftNextLine`.\n\t var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n\t var remainingLinesIndex = 0;\n\t var shiftNextLine = function() {\n\t var lineContents = getNextLine();\n\t // The last line of a file might not have a newline.\n\t var newLine = getNextLine() || \"\";\n\t return lineContents + newLine;\n\t\n\t function getNextLine() {\n\t return remainingLinesIndex < remainingLines.length ?\n\t remainingLines[remainingLinesIndex++] : undefined;\n\t }\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[remainingLinesIndex];\n\t var code = nextLine.substr(0, mapping.generatedColumn -\n\t lastGeneratedColumn);\n\t remainingLines[remainingLinesIndex] = 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[remainingLinesIndex];\n\t node.add(nextLine.substr(0, mapping.generatedColumn));\n\t remainingLines[remainingLinesIndex] = 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 (remainingLinesIndex < remainingLines.length) {\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.splice(remainingLinesIndex).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\tSourceNode.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\tSourceNode.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\tSourceNode.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\tSourceNode.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\tSourceNode.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\tSourceNode.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\tSourceNode.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\tSourceNode.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\tSourceNode.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\texports.SourceNode = SourceNode;\n\n\n/***/ })\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// source-map.min.js"," \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 42c329f865e32e011afb","/*\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","/* -*- 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\nvar base64VLQ = require('./base64-vlq');\nvar util = require('./util');\nvar ArraySet = require('./array-set').ArraySet;\nvar 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 */\nfunction 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\nSourceMapGenerator.prototype._version = 3;\n\n/**\n * Creates a new SourceMapGenerator based on a SourceMapConsumer\n *\n * @param aSourceMapConsumer The SourceMap.\n */\nSourceMapGenerator.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 */\nSourceMapGenerator.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) {\n source = String(source);\n if (!this._sources.has(source)) {\n this._sources.add(source);\n }\n }\n\n if (name != null) {\n name = String(name);\n if (!this._names.has(name)) {\n this._names.add(name);\n }\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 */\nSourceMapGenerator.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 = Object.create(null);\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 */\nSourceMapGenerator.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 */\nSourceMapGenerator.prototype._validateMapping =\n function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,\n aName) {\n // When aOriginal is truthy but has empty values for .line and .column,\n // it is most likely a programmer error. In this case we throw a very\n // specific error message to try to guide them the right way.\n // For example: https://github.com/Polymer/polymer-bundler/pull/519\n if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {\n throw new Error(\n 'original.line and original.column are not numbers -- you probably meant to omit ' +\n 'the original mapping entirely and only map the generated position. If so, pass ' +\n 'null for the original mapping instead of an object with empty or null values.'\n );\n }\n\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 */\nSourceMapGenerator.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 next;\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 next = ''\n\n if (mapping.generatedLine !== previousGeneratedLine) {\n previousGeneratedColumn = 0;\n while (mapping.generatedLine !== previousGeneratedLine) {\n next += ';';\n previousGeneratedLine++;\n }\n }\n else {\n if (i > 0) {\n if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n continue;\n }\n next += ',';\n }\n }\n\n next += base64VLQ.encode(mapping.generatedColumn\n - previousGeneratedColumn);\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (mapping.source != null) {\n sourceIdx = this._sources.indexOf(mapping.source);\n next += base64VLQ.encode(sourceIdx - previousSource);\n previousSource = sourceIdx;\n\n // lines are stored 0-based in SourceMap spec version 3\n next += base64VLQ.encode(mapping.originalLine - 1\n - previousOriginalLine);\n previousOriginalLine = mapping.originalLine - 1;\n\n next += base64VLQ.encode(mapping.originalColumn\n - previousOriginalColumn);\n previousOriginalColumn = mapping.originalColumn;\n\n if (mapping.name != null) {\n nameIdx = this._names.indexOf(mapping.name);\n next += base64VLQ.encode(nameIdx - previousName);\n previousName = nameIdx;\n }\n }\n\n result += next;\n }\n\n return result;\n };\n\nSourceMapGenerator.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, key)\n ? this._sourcesContents[key]\n : null;\n }, this);\n };\n\n/**\n * Externalize the source map.\n */\nSourceMapGenerator.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 */\nSourceMapGenerator.prototype.toString =\n function SourceMapGenerator_toString() {\n return JSON.stringify(this.toJSON());\n };\n\nexports.SourceMapGenerator = SourceMapGenerator;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-map-generator.js\n// module id = 1\n// module chunks = 0","/* -*- 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\nvar 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\nvar VLQ_BASE_SHIFT = 5;\n\n// binary: 100000\nvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\n// binary: 011111\nvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\n// binary: 100000\nvar 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 */\nfunction 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 */\nfunction 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 */\nexports.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 */\nexports.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// WEBPACK FOOTER\n// ./lib/base64-vlq.js\n// module id = 2\n// module chunks = 0","/* -*- 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\nvar intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\n/**\n * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n */\nexports.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 */\nexports.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// WEBPACK FOOTER\n// ./lib/base64.js\n// module id = 3\n// module chunks = 0","/* -*- 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 */\nfunction 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}\nexports.getArg = getArg;\n\nvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.]*)(?::(\\d+))?(\\S*)$/;\nvar dataUrlRegexp = /^data:.+\\,.+$/;\n\nfunction 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}\nexports.urlParse = urlParse;\n\nfunction 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}\nexports.urlGenerate = urlGenerate;\n\n/**\n * Normalizes a path, or the path portion of a URL:\n *\n * - Replaces consecutive 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 */\nfunction 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}\nexports.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 */\nfunction 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}\nexports.join = join;\n\nexports.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 */\nfunction 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}\nexports.relative = relative;\n\nvar supportsNullProto = (function () {\n var obj = Object.create(null);\n return !('__proto__' in obj);\n}());\n\nfunction identity (s) {\n return s;\n}\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 */\nfunction toSetString(aStr) {\n if (isProtoString(aStr)) {\n return '$' + aStr;\n }\n\n return aStr;\n}\nexports.toSetString = supportsNullProto ? identity : toSetString;\n\nfunction fromSetString(aStr) {\n if (isProtoString(aStr)) {\n return aStr.slice(1);\n }\n\n return aStr;\n}\nexports.fromSetString = supportsNullProto ? identity : fromSetString;\n\nfunction isProtoString(s) {\n if (!s) {\n return false;\n }\n\n var length = s.length;\n\n if (length < 9 /* \"__proto__\".length */) {\n return false;\n }\n\n if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n s.charCodeAt(length - 9) !== 95 /* '_' */) {\n return false;\n }\n\n for (var i = length - 10; i >= 0; i--) {\n if (s.charCodeAt(i) !== 36 /* '$' */) {\n return false;\n }\n }\n\n return true;\n}\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 */\nfunction 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}\nexports.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 */\nfunction 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}\nexports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\nfunction 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 */\nfunction 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}\nexports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/util.js\n// module id = 4\n// module chunks = 0","/* -*- 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\nvar util = require('./util');\nvar has = Object.prototype.hasOwnProperty;\nvar hasNativeMap = typeof Map !== \"undefined\";\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 */\nfunction ArraySet() {\n this._array = [];\n this._set = hasNativeMap ? new Map() : Object.create(null);\n}\n\n/**\n * Static method for creating ArraySet instances from an existing array.\n */\nArraySet.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 */\nArraySet.prototype.size = function ArraySet_size() {\n return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;\n};\n\n/**\n * Add the given string to this set.\n *\n * @param String aStr\n */\nArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);\n var idx = this._array.length;\n if (!isDuplicate || aAllowDuplicates) {\n this._array.push(aStr);\n }\n if (!isDuplicate) {\n if (hasNativeMap) {\n this._set.set(aStr, idx);\n } else {\n this._set[sStr] = idx;\n }\n }\n};\n\n/**\n * Is the given string a member of this set?\n *\n * @param String aStr\n */\nArraySet.prototype.has = function ArraySet_has(aStr) {\n if (hasNativeMap) {\n return this._set.has(aStr);\n } else {\n var sStr = util.toSetString(aStr);\n return has.call(this._set, sStr);\n }\n};\n\n/**\n * What is the index of the given string in the array?\n *\n * @param String aStr\n */\nArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n if (hasNativeMap) {\n var idx = this._set.get(aStr);\n if (idx >= 0) {\n return idx;\n }\n } else {\n var sStr = util.toSetString(aStr);\n if (has.call(this._set, sStr)) {\n return this._set[sStr];\n }\n }\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 */\nArraySet.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 */\nArraySet.prototype.toArray = function ArraySet_toArray() {\n return this._array.slice();\n};\n\nexports.ArraySet = ArraySet;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/array-set.js\n// module id = 5\n// module chunks = 0","/* -*- 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\nvar util = require('./util');\n\n/**\n * Determine whether mappingB is after mappingA with respect to generated\n * position.\n */\nfunction 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 */\nfunction 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 */\nMappingList.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 */\nMappingList.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 */\nMappingList.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\nexports.MappingList = MappingList;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/mapping-list.js\n// module id = 6\n// module chunks = 0","/* -*- 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\nvar util = require('./util');\nvar binarySearch = require('./binary-search');\nvar ArraySet = require('./array-set').ArraySet;\nvar base64VLQ = require('./base64-vlq');\nvar quickSort = require('./quick-sort').quickSort;\n\nfunction 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\nSourceMapConsumer.fromSourceMap = function(aSourceMap) {\n return BasicSourceMapConsumer.fromSourceMap(aSourceMap);\n}\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nSourceMapConsumer.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\nSourceMapConsumer.prototype.__generatedMappings = null;\nObject.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\nSourceMapConsumer.prototype.__originalMappings = null;\nObject.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\nSourceMapConsumer.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 */\nSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n throw new Error(\"Subclasses must implement _parseMappings\");\n };\n\nSourceMapConsumer.GENERATED_ORDER = 1;\nSourceMapConsumer.ORIGINAL_ORDER = 2;\n\nSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\nSourceMapConsumer.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 */\nSourceMapConsumer.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 */\nSourceMapConsumer.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\nexports.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 */\nfunction 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 .map(String)\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.map(String), 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\nBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.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 */\nfunction 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 */\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.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 */\nBasicSourceMapConsumer.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\nexports.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 */\nfunction 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\nIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nIndexedSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.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 */\nIndexedSourceMapConsumer.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 */\nIndexedSourceMapConsumer.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 */\nIndexedSourceMapConsumer.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 */\nIndexedSourceMapConsumer.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 */\nIndexedSourceMapConsumer.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\nexports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-map-consumer.js\n// module id = 7\n// module chunks = 0","/* -*- 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\nexports.GREATEST_LOWER_BOUND = 1;\nexports.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 */\nfunction 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 */\nexports.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// WEBPACK FOOTER\n// ./lib/binary-search.js\n// module id = 8\n// module chunks = 0","/* -*- 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 */\nfunction 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 */\nfunction 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 */\nfunction 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 */\nexports.quickSort = function (ary, comparator) {\n doQuickSort(ary, comparator, 0, ary.length - 1);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/quick-sort.js\n// module id = 9\n// module chunks = 0","/* -*- 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\nvar SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;\nvar 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).\nvar REGEX_NEWLINE = /(\\r?\\n)/;\n\n// Newline character code for charCodeAt() comparisons\nvar 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!\nvar 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 */\nfunction 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 */\nSourceNode.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 accessed by calling `shiftNextLine`.\n var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n var remainingLinesIndex = 0;\n var shiftNextLine = function() {\n var lineContents = getNextLine();\n // The last line of a file might not have a newline.\n var newLine = getNextLine() || \"\";\n return lineContents + newLine;\n\n function getNextLine() {\n return remainingLinesIndex < remainingLines.length ?\n remainingLines[remainingLinesIndex++] : undefined;\n }\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[remainingLinesIndex];\n var code = nextLine.substr(0, mapping.generatedColumn -\n lastGeneratedColumn);\n remainingLines[remainingLinesIndex] = 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[remainingLinesIndex];\n node.add(nextLine.substr(0, mapping.generatedColumn));\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n }\n lastMapping = mapping;\n }, this);\n // We have processed all mappings.\n if (remainingLinesIndex < remainingLines.length) {\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.splice(remainingLinesIndex).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 */\nSourceNode.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 */\nSourceNode.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 */\nSourceNode.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 */\nSourceNode.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 */\nSourceNode.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 */\nSourceNode.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 */\nSourceNode.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 */\nSourceNode.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 */\nSourceNode.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\nexports.SourceNode = SourceNode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-node.js\n// module id = 10\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/node_modules/uglify-js/node_modules/source-map/lib/array-set.js b/node_modules/uglify-js/node_modules/source-map/lib/array-set.js new file mode 100644 index 0000000..fbd5c81 --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/lib/array-set.js @@ -0,0 +1,121 @@ +/* -*- 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 has = Object.prototype.hasOwnProperty; +var hasNativeMap = typeof Map !== "undefined"; + +/** + * 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 = hasNativeMap ? new Map() : Object.create(null); +} + +/** + * 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 hasNativeMap ? this._set.size : 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 = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } +}; + +/** + * Is the given string a member of this set? + * + * @param String aStr + */ +ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } +}; + +/** + * What is the index of the given string in the array? + * + * @param String aStr + */ +ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, 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/node_modules/uglify-js/node_modules/source-map/lib/base64-vlq.js b/node_modules/uglify-js/node_modules/source-map/lib/base64-vlq.js new file mode 100644 index 0000000..612b404 --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/lib/base64-vlq.js @@ -0,0 +1,140 @@ +/* -*- 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/node_modules/uglify-js/node_modules/source-map/lib/base64.js b/node_modules/uglify-js/node_modules/source-map/lib/base64.js new file mode 100644 index 0000000..8aa86b3 --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/lib/base64.js @@ -0,0 +1,67 @@ +/* -*- 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/node_modules/uglify-js/node_modules/source-map/lib/binary-search.js b/node_modules/uglify-js/node_modules/source-map/lib/binary-search.js new file mode 100644 index 0000000..010ac94 --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/lib/binary-search.js @@ -0,0 +1,111 @@ +/* -*- 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/node_modules/uglify-js/node_modules/source-map/lib/mapping-list.js b/node_modules/uglify-js/node_modules/source-map/lib/mapping-list.js new file mode 100644 index 0000000..06d1274 --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/lib/mapping-list.js @@ -0,0 +1,79 @@ +/* -*- 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/node_modules/uglify-js/node_modules/source-map/lib/quick-sort.js b/node_modules/uglify-js/node_modules/source-map/lib/quick-sort.js new file mode 100644 index 0000000..6a7caad --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/lib/quick-sort.js @@ -0,0 +1,114 @@ +/* -*- 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/node_modules/uglify-js/node_modules/source-map/lib/source-map-consumer.js b/node_modules/uglify-js/node_modules/source-map/lib/source-map-consumer.js new file mode 100644 index 0000000..6abcc28 --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/lib/source-map-consumer.js @@ -0,0 +1,1082 @@ +/* -*- 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 + .map(String) + // 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.map(String), 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/node_modules/uglify-js/node_modules/source-map/lib/source-map-generator.js b/node_modules/uglify-js/node_modules/source-map/lib/source-map-generator.js new file mode 100644 index 0000000..aff1e7f --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/lib/source-map-generator.js @@ -0,0 +1,416 @@ +/* -*- 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) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!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 = Object.create(null); + } + 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) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + 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 next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + 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/node_modules/uglify-js/node_modules/source-map/lib/source-node.js b/node_modules/uglify-js/node_modules/source-map/lib/source-node.js new file mode 100644 index 0000000..d196a53 --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/lib/source-node.js @@ -0,0 +1,413 @@ +/* -*- 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 accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // 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[remainingLinesIndex]; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = 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[remainingLinesIndex]; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + 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.splice(remainingLinesIndex).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/node_modules/uglify-js/node_modules/source-map/lib/util.js b/node_modules/uglify-js/node_modules/source-map/lib/util.js new file mode 100644 index 0000000..44e0e45 --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/lib/util.js @@ -0,0 +1,417 @@ +/* -*- 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 consecutive 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; + +var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); +}()); + +function identity (s) { + return s; +} + +/** + * 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) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; +} +exports.toSetString = supportsNullProto ? identity : toSetString; + +function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; +} +exports.fromSetString = supportsNullProto ? identity : fromSetString; + +function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; +} + +/** + * 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/node_modules/uglify-js/node_modules/source-map/package.json b/node_modules/uglify-js/node_modules/source-map/package.json new file mode 100644 index 0000000..0a610d2 --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/package.json @@ -0,0 +1,211 @@ +{ + "_from": "source-map@~0.5.1", + "_id": "source-map@0.5.7", + "_inBundle": false, + "_integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "_location": "/uglify-js/source-map", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "source-map@~0.5.1", + "name": "source-map", + "escapedName": "source-map", + "rawSpec": "~0.5.1", + "saveSpec": null, + "fetchSpec": "~0.5.1" + }, + "_requiredBy": [ + "/uglify-js" + ], + "_resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "_shasum": "8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc", + "_spec": "source-map@~0.5.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/uglify-js", + "author": { + "name": "Nick Fitzgerald", + "email": "nfitzgerald@mozilla.com" + }, + "bugs": { + "url": "https://github.com/mozilla/source-map/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Tobias Koppers", + "email": "tobias.koppers@googlemail.com" + }, + { + "name": "Duncan Beevers", + "email": "duncan@dweebd.com" + }, + { + "name": "Stephen Crane", + "email": "scrane@mozilla.com" + }, + { + "name": "Ryan Seddon", + "email": "seddon.ryan@gmail.com" + }, + { + "name": "Miles Elam", + "email": "miles.elam@deem.com" + }, + { + "name": "Mihai Bazon", + "email": "mihai.bazon@gmail.com" + }, + { + "name": "Michael Ficarra", + "email": "github.public.email@michael.ficarra.me" + }, + { + "name": "Todd Wolfson", + "email": "todd@twolfson.com" + }, + { + "name": "Alexander Solovyov", + "email": "alexander@solovyov.net" + }, + { + "name": "Felix Gnass", + "email": "fgnass@gmail.com" + }, + { + "name": "Conrad Irwin", + "email": "conrad.irwin@gmail.com" + }, + { + "name": "usrbincc", + "email": "usrbincc@yahoo.com" + }, + { + "name": "David Glasser", + "email": "glasser@davidglasser.net" + }, + { + "name": "Chase Douglas", + "email": "chase@newrelic.com" + }, + { + "name": "Evan Wallace", + "email": "evan.exe@gmail.com" + }, + { + "name": "Heather Arthur", + "email": "fayearthur@gmail.com" + }, + { + "name": "Hugh Kennedy", + "email": "hughskennedy@gmail.com" + }, + { + "name": "David Glasser", + "email": "glasser@davidglasser.net" + }, + { + "name": "Simon Lydell", + "email": "simon.lydell@gmail.com" + }, + { + "name": "Jmeas Smith", + "email": "jellyes2@gmail.com" + }, + { + "name": "Michael Z Goddard", + "email": "mzgoddard@gmail.com" + }, + { + "name": "azu", + "email": "azu@users.noreply.github.com" + }, + { + "name": "John Gozde", + "email": "john@gozde.ca" + }, + { + "name": "Adam Kirkton", + "email": "akirkton@truefitinnovation.com" + }, + { + "name": "Chris Montgomery", + "email": "christopher.montgomery@dowjones.com" + }, + { + "name": "J. Ryan Stinnett", + "email": "jryans@gmail.com" + }, + { + "name": "Jack Herrington", + "email": "jherrington@walmartlabs.com" + }, + { + "name": "Chris Truter", + "email": "jeffpalentine@gmail.com" + }, + { + "name": "Daniel Espeset", + "email": "daniel@danielespeset.com" + }, + { + "name": "Jamie Wong", + "email": "jamie.lf.wong@gmail.com" + }, + { + "name": "Eddy Bruël", + "email": "ejpbruel@mozilla.com" + }, + { + "name": "Hawken Rives", + "email": "hawkrives@gmail.com" + }, + { + "name": "Gilad Peleg", + "email": "giladp007@gmail.com" + }, + { + "name": "djchie", + "email": "djchie.dev@gmail.com" + }, + { + "name": "Gary Ye", + "email": "garysye@gmail.com" + }, + { + "name": "Nicolas Lalevée", + "email": "nicolas.lalevee@hibnet.org" + } + ], + "deprecated": false, + "description": "Generates and consumes source maps", + "devDependencies": { + "doctoc": "^0.15.0", + "webpack": "^1.12.0" + }, + "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", + "name": "source-map", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/mozilla/source-map.git" + }, + "scripts": { + "build": "webpack --color", + "test": "npm run build && node test/run-tests.js", + "toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md" + }, + "typings": "source-map", + "version": "0.5.7" +} diff --git a/node_modules/uglify-js/node_modules/source-map/source-map.js b/node_modules/uglify-js/node_modules/source-map/source-map.js new file mode 100644 index 0000000..bc88fe8 --- /dev/null +++ b/node_modules/uglify-js/node_modules/source-map/source-map.js @@ -0,0 +1,8 @@ +/* + * 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/node_modules/uglify-js/package.json b/node_modules/uglify-js/package.json new file mode 100644 index 0000000..0a9d2e1 --- /dev/null +++ b/node_modules/uglify-js/package.json @@ -0,0 +1,90 @@ +{ + "_from": "uglify-js@^2.6.1", + "_id": "uglify-js@2.8.29", + "_inBundle": false, + "_integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "_location": "/uglify-js", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "uglify-js@^2.6.1", + "name": "uglify-js", + "escapedName": "uglify-js", + "rawSpec": "^2.6.1", + "saveSpec": null, + "fetchSpec": "^2.6.1" + }, + "_requiredBy": [ + "/pug-filters" + ], + "_resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "_shasum": "29c5733148057bb4e1f75df35b7a9cb72e6a59dd", + "_spec": "uglify-js@^2.6.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/pug-filters", + "author": { + "name": "Mihai Bazon", + "email": "mihai.bazon@gmail.com", + "url": "http://lisperator.net/" + }, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "browserify": { + "transform": [ + "uglify-to-browserify" + ] + }, + "bugs": { + "url": "https://github.com/mishoo/UglifyJS2/issues" + }, + "bundleDependencies": false, + "dependencies": { + "source-map": "~0.5.1", + "uglify-to-browserify": "~1.0.0", + "yargs": "~3.10.0" + }, + "deprecated": false, + "description": "JavaScript parser, mangler/compressor and beautifier toolkit", + "devDependencies": { + "acorn": "~5.0.3", + "mocha": "~2.3.4" + }, + "engines": { + "node": ">=0.8.0" + }, + "files": [ + "bin", + "lib", + "tools", + "LICENSE" + ], + "homepage": "http://lisperator.net/uglifyjs", + "keywords": [ + "uglify", + "uglify-js", + "minify", + "minifier" + ], + "license": "BSD-2-Clause", + "main": "tools/node.js", + "maintainers": [ + { + "name": "Mihai Bazon", + "email": "mihai.bazon@gmail.com", + "url": "http://lisperator.net/" + } + ], + "name": "uglify-js", + "optionalDependencies": { + "uglify-to-browserify": "~1.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/mishoo/UglifyJS2.git" + }, + "scripts": { + "test": "node test/run-tests.js" + }, + "version": "2.8.29" +} diff --git a/node_modules/uglify-js/tools/domprops.json b/node_modules/uglify-js/tools/domprops.json new file mode 100644 index 0000000..6f6c221 --- /dev/null +++ b/node_modules/uglify-js/tools/domprops.json @@ -0,0 +1,5603 @@ +{ + "props": [ + "$&", + "$'", + "$*", + "$+", + "$1", + "$2", + "$3", + "$4", + "$5", + "$6", + "$7", + "$8", + "$9", + "$_", + "$`", + "$input", + "@@iterator", + "ABORT_ERR", + "ACTIVE", + "ACTIVE_ATTRIBUTES", + "ACTIVE_TEXTURE", + "ACTIVE_UNIFORMS", + "ADDITION", + "ALIASED_LINE_WIDTH_RANGE", + "ALIASED_POINT_SIZE_RANGE", + "ALLOW_KEYBOARD_INPUT", + "ALLPASS", + "ALPHA", + "ALPHA_BITS", + "ALT_MASK", + "ALWAYS", + "ANY_TYPE", + "ANY_UNORDERED_NODE_TYPE", + "ARRAY_BUFFER", + "ARRAY_BUFFER_BINDING", + "ATTACHED_SHADERS", + "ATTRIBUTE_NODE", + "AT_TARGET", + "AddSearchProvider", + "AnalyserNode", + "AnimationEvent", + "AnonXMLHttpRequest", + "ApplicationCache", + "ApplicationCacheErrorEvent", + "Array", + "ArrayBuffer", + "Attr", + "Audio", + "AudioBuffer", + "AudioBufferSourceNode", + "AudioContext", + "AudioDestinationNode", + "AudioListener", + "AudioNode", + "AudioParam", + "AudioProcessingEvent", + "AudioStreamTrack", + "AutocompleteErrorEvent", + "BACK", + "BAD_BOUNDARYPOINTS_ERR", + "BANDPASS", + "BLEND", + "BLEND_COLOR", + "BLEND_DST_ALPHA", + "BLEND_DST_RGB", + "BLEND_EQUATION", + "BLEND_EQUATION_ALPHA", + "BLEND_EQUATION_RGB", + "BLEND_SRC_ALPHA", + "BLEND_SRC_RGB", + "BLUE_BITS", + "BLUR", + "BOOL", + "BOOLEAN_TYPE", + "BOOL_VEC2", + "BOOL_VEC3", + "BOOL_VEC4", + "BOTH", + "BROWSER_DEFAULT_WEBGL", + "BUBBLING_PHASE", + "BUFFER_SIZE", + "BUFFER_USAGE", + "BYTE", + "BYTES_PER_ELEMENT", + "BarProp", + "BaseHref", + "BatteryManager", + "BeforeLoadEvent", + "BeforeUnloadEvent", + "BiquadFilterNode", + "Blob", + "BlobEvent", + "Boolean", + "CAPTURING_PHASE", + "CCW", + "CDATASection", + "CDATA_SECTION_NODE", + "CHANGE", + "CHARSET_RULE", + "CHECKING", + "CLAMP_TO_EDGE", + "CLICK", + "CLOSED", + "CLOSING", + "COLOR_ATTACHMENT0", + "COLOR_BUFFER_BIT", + "COLOR_CLEAR_VALUE", + "COLOR_WRITEMASK", + "COMMENT_NODE", + "COMPILE_STATUS", + "COMPRESSED_RGBA_S3TC_DXT1_EXT", + "COMPRESSED_RGBA_S3TC_DXT3_EXT", + "COMPRESSED_RGBA_S3TC_DXT5_EXT", + "COMPRESSED_RGB_S3TC_DXT1_EXT", + "COMPRESSED_TEXTURE_FORMATS", + "CONNECTING", + "CONSTANT_ALPHA", + "CONSTANT_COLOR", + "CONSTRAINT_ERR", + "CONTEXT_LOST_WEBGL", + "CONTROL_MASK", + "COUNTER_STYLE_RULE", + "CSS", + "CSS2Properties", + "CSSCharsetRule", + "CSSConditionRule", + "CSSCounterStyleRule", + "CSSFontFaceRule", + "CSSFontFeatureValuesRule", + "CSSGroupingRule", + "CSSImportRule", + "CSSKeyframeRule", + "CSSKeyframesRule", + "CSSMediaRule", + "CSSMozDocumentRule", + "CSSNameSpaceRule", + "CSSPageRule", + "CSSPrimitiveValue", + "CSSRule", + "CSSRuleList", + "CSSStyleDeclaration", + "CSSStyleRule", + "CSSStyleSheet", + "CSSSupportsRule", + "CSSUnknownRule", + "CSSValue", + "CSSValueList", + "CSSVariablesDeclaration", + "CSSVariablesRule", + "CSSViewportRule", + "CSS_ATTR", + "CSS_CM", + "CSS_COUNTER", + "CSS_CUSTOM", + "CSS_DEG", + "CSS_DIMENSION", + "CSS_EMS", + "CSS_EXS", + "CSS_FILTER_BLUR", + "CSS_FILTER_BRIGHTNESS", + "CSS_FILTER_CONTRAST", + "CSS_FILTER_CUSTOM", + "CSS_FILTER_DROP_SHADOW", + "CSS_FILTER_GRAYSCALE", + "CSS_FILTER_HUE_ROTATE", + "CSS_FILTER_INVERT", + "CSS_FILTER_OPACITY", + "CSS_FILTER_REFERENCE", + "CSS_FILTER_SATURATE", + "CSS_FILTER_SEPIA", + "CSS_GRAD", + "CSS_HZ", + "CSS_IDENT", + "CSS_IN", + "CSS_INHERIT", + "CSS_KHZ", + "CSS_MATRIX", + "CSS_MATRIX3D", + "CSS_MM", + "CSS_MS", + "CSS_NUMBER", + "CSS_PC", + "CSS_PERCENTAGE", + "CSS_PERSPECTIVE", + "CSS_PRIMITIVE_VALUE", + "CSS_PT", + "CSS_PX", + "CSS_RAD", + "CSS_RECT", + "CSS_RGBCOLOR", + "CSS_ROTATE", + "CSS_ROTATE3D", + "CSS_ROTATEX", + "CSS_ROTATEY", + "CSS_ROTATEZ", + "CSS_S", + "CSS_SCALE", + "CSS_SCALE3D", + "CSS_SCALEX", + "CSS_SCALEY", + "CSS_SCALEZ", + "CSS_SKEW", + "CSS_SKEWX", + "CSS_SKEWY", + "CSS_STRING", + "CSS_TRANSLATE", + "CSS_TRANSLATE3D", + "CSS_TRANSLATEX", + "CSS_TRANSLATEY", + "CSS_TRANSLATEZ", + "CSS_UNKNOWN", + "CSS_URI", + "CSS_VALUE_LIST", + "CSS_VH", + "CSS_VMAX", + "CSS_VMIN", + "CSS_VW", + "CULL_FACE", + "CULL_FACE_MODE", + "CURRENT_PROGRAM", + "CURRENT_VERTEX_ATTRIB", + "CUSTOM", + "CW", + "CanvasGradient", + "CanvasPattern", + "CanvasRenderingContext2D", + "CaretPosition", + "ChannelMergerNode", + "ChannelSplitterNode", + "CharacterData", + "ClientRect", + "ClientRectList", + "Clipboard", + "ClipboardEvent", + "CloseEvent", + "Collator", + "CommandEvent", + "Comment", + "CompositionEvent", + "Console", + "Controllers", + "ConvolverNode", + "Counter", + "Crypto", + "CryptoKey", + "CustomEvent", + "DATABASE_ERR", + "DATA_CLONE_ERR", + "DATA_ERR", + "DBLCLICK", + "DECR", + "DECR_WRAP", + "DELETE_STATUS", + "DEPTH_ATTACHMENT", + "DEPTH_BITS", + "DEPTH_BUFFER_BIT", + "DEPTH_CLEAR_VALUE", + "DEPTH_COMPONENT", + "DEPTH_COMPONENT16", + "DEPTH_FUNC", + "DEPTH_RANGE", + "DEPTH_STENCIL", + "DEPTH_STENCIL_ATTACHMENT", + "DEPTH_TEST", + "DEPTH_WRITEMASK", + "DIRECTION_DOWN", + "DIRECTION_LEFT", + "DIRECTION_RIGHT", + "DIRECTION_UP", + "DISABLED", + "DISPATCH_REQUEST_ERR", + "DITHER", + "DOCUMENT_FRAGMENT_NODE", + "DOCUMENT_NODE", + "DOCUMENT_POSITION_CONTAINED_BY", + "DOCUMENT_POSITION_CONTAINS", + "DOCUMENT_POSITION_DISCONNECTED", + "DOCUMENT_POSITION_FOLLOWING", + "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", + "DOCUMENT_POSITION_PRECEDING", + "DOCUMENT_TYPE_NODE", + "DOMCursor", + "DOMError", + "DOMException", + "DOMImplementation", + "DOMImplementationLS", + "DOMMatrix", + "DOMMatrixReadOnly", + "DOMParser", + "DOMPoint", + "DOMPointReadOnly", + "DOMQuad", + "DOMRect", + "DOMRectList", + "DOMRectReadOnly", + "DOMRequest", + "DOMSTRING_SIZE_ERR", + "DOMSettableTokenList", + "DOMStringList", + "DOMStringMap", + "DOMTokenList", + "DOMTransactionEvent", + "DOM_DELTA_LINE", + "DOM_DELTA_PAGE", + "DOM_DELTA_PIXEL", + "DOM_INPUT_METHOD_DROP", + "DOM_INPUT_METHOD_HANDWRITING", + "DOM_INPUT_METHOD_IME", + "DOM_INPUT_METHOD_KEYBOARD", + "DOM_INPUT_METHOD_MULTIMODAL", + "DOM_INPUT_METHOD_OPTION", + "DOM_INPUT_METHOD_PASTE", + "DOM_INPUT_METHOD_SCRIPT", + "DOM_INPUT_METHOD_UNKNOWN", + "DOM_INPUT_METHOD_VOICE", + "DOM_KEY_LOCATION_JOYSTICK", + "DOM_KEY_LOCATION_LEFT", + "DOM_KEY_LOCATION_MOBILE", + "DOM_KEY_LOCATION_NUMPAD", + "DOM_KEY_LOCATION_RIGHT", + "DOM_KEY_LOCATION_STANDARD", + "DOM_VK_0", + "DOM_VK_1", + "DOM_VK_2", + "DOM_VK_3", + "DOM_VK_4", + "DOM_VK_5", + "DOM_VK_6", + "DOM_VK_7", + "DOM_VK_8", + "DOM_VK_9", + "DOM_VK_A", + "DOM_VK_ACCEPT", + "DOM_VK_ADD", + "DOM_VK_ALT", + "DOM_VK_ALTGR", + "DOM_VK_AMPERSAND", + "DOM_VK_ASTERISK", + "DOM_VK_AT", + "DOM_VK_ATTN", + "DOM_VK_B", + "DOM_VK_BACKSPACE", + "DOM_VK_BACK_QUOTE", + "DOM_VK_BACK_SLASH", + "DOM_VK_BACK_SPACE", + "DOM_VK_C", + "DOM_VK_CANCEL", + "DOM_VK_CAPS_LOCK", + "DOM_VK_CIRCUMFLEX", + "DOM_VK_CLEAR", + "DOM_VK_CLOSE_BRACKET", + "DOM_VK_CLOSE_CURLY_BRACKET", + "DOM_VK_CLOSE_PAREN", + "DOM_VK_COLON", + "DOM_VK_COMMA", + "DOM_VK_CONTEXT_MENU", + "DOM_VK_CONTROL", + "DOM_VK_CONVERT", + "DOM_VK_CRSEL", + "DOM_VK_CTRL", + "DOM_VK_D", + "DOM_VK_DECIMAL", + "DOM_VK_DELETE", + "DOM_VK_DIVIDE", + "DOM_VK_DOLLAR", + "DOM_VK_DOUBLE_QUOTE", + "DOM_VK_DOWN", + "DOM_VK_E", + "DOM_VK_EISU", + "DOM_VK_END", + "DOM_VK_ENTER", + "DOM_VK_EQUALS", + "DOM_VK_EREOF", + "DOM_VK_ESCAPE", + "DOM_VK_EXCLAMATION", + "DOM_VK_EXECUTE", + "DOM_VK_EXSEL", + "DOM_VK_F", + "DOM_VK_F1", + "DOM_VK_F10", + "DOM_VK_F11", + "DOM_VK_F12", + "DOM_VK_F13", + "DOM_VK_F14", + "DOM_VK_F15", + "DOM_VK_F16", + "DOM_VK_F17", + "DOM_VK_F18", + "DOM_VK_F19", + "DOM_VK_F2", + "DOM_VK_F20", + "DOM_VK_F21", + "DOM_VK_F22", + "DOM_VK_F23", + "DOM_VK_F24", + "DOM_VK_F25", + "DOM_VK_F26", + "DOM_VK_F27", + "DOM_VK_F28", + "DOM_VK_F29", + "DOM_VK_F3", + "DOM_VK_F30", + "DOM_VK_F31", + "DOM_VK_F32", + "DOM_VK_F33", + "DOM_VK_F34", + "DOM_VK_F35", + "DOM_VK_F36", + "DOM_VK_F4", + "DOM_VK_F5", + "DOM_VK_F6", + "DOM_VK_F7", + "DOM_VK_F8", + "DOM_VK_F9", + "DOM_VK_FINAL", + "DOM_VK_FRONT", + "DOM_VK_G", + "DOM_VK_GREATER_THAN", + "DOM_VK_H", + "DOM_VK_HANGUL", + "DOM_VK_HANJA", + "DOM_VK_HASH", + "DOM_VK_HELP", + "DOM_VK_HK_TOGGLE", + "DOM_VK_HOME", + "DOM_VK_HYPHEN_MINUS", + "DOM_VK_I", + "DOM_VK_INSERT", + "DOM_VK_J", + "DOM_VK_JUNJA", + "DOM_VK_K", + "DOM_VK_KANA", + "DOM_VK_KANJI", + "DOM_VK_L", + "DOM_VK_LEFT", + "DOM_VK_LEFT_TAB", + "DOM_VK_LESS_THAN", + "DOM_VK_M", + "DOM_VK_META", + "DOM_VK_MODECHANGE", + "DOM_VK_MULTIPLY", + "DOM_VK_N", + "DOM_VK_NONCONVERT", + "DOM_VK_NUMPAD0", + "DOM_VK_NUMPAD1", + "DOM_VK_NUMPAD2", + "DOM_VK_NUMPAD3", + "DOM_VK_NUMPAD4", + "DOM_VK_NUMPAD5", + "DOM_VK_NUMPAD6", + "DOM_VK_NUMPAD7", + "DOM_VK_NUMPAD8", + "DOM_VK_NUMPAD9", + "DOM_VK_NUM_LOCK", + "DOM_VK_O", + "DOM_VK_OEM_1", + "DOM_VK_OEM_102", + "DOM_VK_OEM_2", + "DOM_VK_OEM_3", + "DOM_VK_OEM_4", + "DOM_VK_OEM_5", + "DOM_VK_OEM_6", + "DOM_VK_OEM_7", + "DOM_VK_OEM_8", + "DOM_VK_OEM_COMMA", + "DOM_VK_OEM_MINUS", + "DOM_VK_OEM_PERIOD", + "DOM_VK_OEM_PLUS", + "DOM_VK_OPEN_BRACKET", + "DOM_VK_OPEN_CURLY_BRACKET", + "DOM_VK_OPEN_PAREN", + "DOM_VK_P", + "DOM_VK_PA1", + "DOM_VK_PAGEDOWN", + "DOM_VK_PAGEUP", + "DOM_VK_PAGE_DOWN", + "DOM_VK_PAGE_UP", + "DOM_VK_PAUSE", + "DOM_VK_PERCENT", + "DOM_VK_PERIOD", + "DOM_VK_PIPE", + "DOM_VK_PLAY", + "DOM_VK_PLUS", + "DOM_VK_PRINT", + "DOM_VK_PRINTSCREEN", + "DOM_VK_PROCESSKEY", + "DOM_VK_PROPERITES", + "DOM_VK_Q", + "DOM_VK_QUESTION_MARK", + "DOM_VK_QUOTE", + "DOM_VK_R", + "DOM_VK_REDO", + "DOM_VK_RETURN", + "DOM_VK_RIGHT", + "DOM_VK_S", + "DOM_VK_SCROLL_LOCK", + "DOM_VK_SELECT", + "DOM_VK_SEMICOLON", + "DOM_VK_SEPARATOR", + "DOM_VK_SHIFT", + "DOM_VK_SLASH", + "DOM_VK_SLEEP", + "DOM_VK_SPACE", + "DOM_VK_SUBTRACT", + "DOM_VK_T", + "DOM_VK_TAB", + "DOM_VK_TILDE", + "DOM_VK_U", + "DOM_VK_UNDERSCORE", + "DOM_VK_UNDO", + "DOM_VK_UNICODE", + "DOM_VK_UP", + "DOM_VK_V", + "DOM_VK_VOLUME_DOWN", + "DOM_VK_VOLUME_MUTE", + "DOM_VK_VOLUME_UP", + "DOM_VK_W", + "DOM_VK_WIN", + "DOM_VK_WINDOW", + "DOM_VK_WIN_ICO_00", + "DOM_VK_WIN_ICO_CLEAR", + "DOM_VK_WIN_ICO_HELP", + "DOM_VK_WIN_OEM_ATTN", + "DOM_VK_WIN_OEM_AUTO", + "DOM_VK_WIN_OEM_BACKTAB", + "DOM_VK_WIN_OEM_CLEAR", + "DOM_VK_WIN_OEM_COPY", + "DOM_VK_WIN_OEM_CUSEL", + "DOM_VK_WIN_OEM_ENLW", + "DOM_VK_WIN_OEM_FINISH", + "DOM_VK_WIN_OEM_FJ_JISHO", + "DOM_VK_WIN_OEM_FJ_LOYA", + "DOM_VK_WIN_OEM_FJ_MASSHOU", + "DOM_VK_WIN_OEM_FJ_ROYA", + "DOM_VK_WIN_OEM_FJ_TOUROKU", + "DOM_VK_WIN_OEM_JUMP", + "DOM_VK_WIN_OEM_PA1", + "DOM_VK_WIN_OEM_PA2", + "DOM_VK_WIN_OEM_PA3", + "DOM_VK_WIN_OEM_RESET", + "DOM_VK_WIN_OEM_WSCTRL", + "DOM_VK_X", + "DOM_VK_XF86XK_ADD_FAVORITE", + "DOM_VK_XF86XK_APPLICATION_LEFT", + "DOM_VK_XF86XK_APPLICATION_RIGHT", + "DOM_VK_XF86XK_AUDIO_CYCLE_TRACK", + "DOM_VK_XF86XK_AUDIO_FORWARD", + "DOM_VK_XF86XK_AUDIO_LOWER_VOLUME", + "DOM_VK_XF86XK_AUDIO_MEDIA", + "DOM_VK_XF86XK_AUDIO_MUTE", + "DOM_VK_XF86XK_AUDIO_NEXT", + "DOM_VK_XF86XK_AUDIO_PAUSE", + "DOM_VK_XF86XK_AUDIO_PLAY", + "DOM_VK_XF86XK_AUDIO_PREV", + "DOM_VK_XF86XK_AUDIO_RAISE_VOLUME", + "DOM_VK_XF86XK_AUDIO_RANDOM_PLAY", + "DOM_VK_XF86XK_AUDIO_RECORD", + "DOM_VK_XF86XK_AUDIO_REPEAT", + "DOM_VK_XF86XK_AUDIO_REWIND", + "DOM_VK_XF86XK_AUDIO_STOP", + "DOM_VK_XF86XK_AWAY", + "DOM_VK_XF86XK_BACK", + "DOM_VK_XF86XK_BACK_FORWARD", + "DOM_VK_XF86XK_BATTERY", + "DOM_VK_XF86XK_BLUE", + "DOM_VK_XF86XK_BLUETOOTH", + "DOM_VK_XF86XK_BOOK", + "DOM_VK_XF86XK_BRIGHTNESS_ADJUST", + "DOM_VK_XF86XK_CALCULATOR", + "DOM_VK_XF86XK_CALENDAR", + "DOM_VK_XF86XK_CD", + "DOM_VK_XF86XK_CLOSE", + "DOM_VK_XF86XK_COMMUNITY", + "DOM_VK_XF86XK_CONTRAST_ADJUST", + "DOM_VK_XF86XK_COPY", + "DOM_VK_XF86XK_CUT", + "DOM_VK_XF86XK_CYCLE_ANGLE", + "DOM_VK_XF86XK_DISPLAY", + "DOM_VK_XF86XK_DOCUMENTS", + "DOM_VK_XF86XK_DOS", + "DOM_VK_XF86XK_EJECT", + "DOM_VK_XF86XK_EXCEL", + "DOM_VK_XF86XK_EXPLORER", + "DOM_VK_XF86XK_FAVORITES", + "DOM_VK_XF86XK_FINANCE", + "DOM_VK_XF86XK_FORWARD", + "DOM_VK_XF86XK_FRAME_BACK", + "DOM_VK_XF86XK_FRAME_FORWARD", + "DOM_VK_XF86XK_GAME", + "DOM_VK_XF86XK_GO", + "DOM_VK_XF86XK_GREEN", + "DOM_VK_XF86XK_HIBERNATE", + "DOM_VK_XF86XK_HISTORY", + "DOM_VK_XF86XK_HOME_PAGE", + "DOM_VK_XF86XK_HOT_LINKS", + "DOM_VK_XF86XK_I_TOUCH", + "DOM_VK_XF86XK_KBD_BRIGHTNESS_DOWN", + "DOM_VK_XF86XK_KBD_BRIGHTNESS_UP", + "DOM_VK_XF86XK_KBD_LIGHT_ON_OFF", + "DOM_VK_XF86XK_LAUNCH0", + "DOM_VK_XF86XK_LAUNCH1", + "DOM_VK_XF86XK_LAUNCH2", + "DOM_VK_XF86XK_LAUNCH3", + "DOM_VK_XF86XK_LAUNCH4", + "DOM_VK_XF86XK_LAUNCH5", + "DOM_VK_XF86XK_LAUNCH6", + "DOM_VK_XF86XK_LAUNCH7", + "DOM_VK_XF86XK_LAUNCH8", + "DOM_VK_XF86XK_LAUNCH9", + "DOM_VK_XF86XK_LAUNCH_A", + "DOM_VK_XF86XK_LAUNCH_B", + "DOM_VK_XF86XK_LAUNCH_C", + "DOM_VK_XF86XK_LAUNCH_D", + "DOM_VK_XF86XK_LAUNCH_E", + "DOM_VK_XF86XK_LAUNCH_F", + "DOM_VK_XF86XK_LIGHT_BULB", + "DOM_VK_XF86XK_LOG_OFF", + "DOM_VK_XF86XK_MAIL", + "DOM_VK_XF86XK_MAIL_FORWARD", + "DOM_VK_XF86XK_MARKET", + "DOM_VK_XF86XK_MEETING", + "DOM_VK_XF86XK_MEMO", + "DOM_VK_XF86XK_MENU_KB", + "DOM_VK_XF86XK_MENU_PB", + "DOM_VK_XF86XK_MESSENGER", + "DOM_VK_XF86XK_MON_BRIGHTNESS_DOWN", + "DOM_VK_XF86XK_MON_BRIGHTNESS_UP", + "DOM_VK_XF86XK_MUSIC", + "DOM_VK_XF86XK_MY_COMPUTER", + "DOM_VK_XF86XK_MY_SITES", + "DOM_VK_XF86XK_NEW", + "DOM_VK_XF86XK_NEWS", + "DOM_VK_XF86XK_OFFICE_HOME", + "DOM_VK_XF86XK_OPEN", + "DOM_VK_XF86XK_OPEN_URL", + "DOM_VK_XF86XK_OPTION", + "DOM_VK_XF86XK_PASTE", + "DOM_VK_XF86XK_PHONE", + "DOM_VK_XF86XK_PICTURES", + "DOM_VK_XF86XK_POWER_DOWN", + "DOM_VK_XF86XK_POWER_OFF", + "DOM_VK_XF86XK_RED", + "DOM_VK_XF86XK_REFRESH", + "DOM_VK_XF86XK_RELOAD", + "DOM_VK_XF86XK_REPLY", + "DOM_VK_XF86XK_ROCKER_DOWN", + "DOM_VK_XF86XK_ROCKER_ENTER", + "DOM_VK_XF86XK_ROCKER_UP", + "DOM_VK_XF86XK_ROTATE_WINDOWS", + "DOM_VK_XF86XK_ROTATION_KB", + "DOM_VK_XF86XK_ROTATION_PB", + "DOM_VK_XF86XK_SAVE", + "DOM_VK_XF86XK_SCREEN_SAVER", + "DOM_VK_XF86XK_SCROLL_CLICK", + "DOM_VK_XF86XK_SCROLL_DOWN", + "DOM_VK_XF86XK_SCROLL_UP", + "DOM_VK_XF86XK_SEARCH", + "DOM_VK_XF86XK_SEND", + "DOM_VK_XF86XK_SHOP", + "DOM_VK_XF86XK_SPELL", + "DOM_VK_XF86XK_SPLIT_SCREEN", + "DOM_VK_XF86XK_STANDBY", + "DOM_VK_XF86XK_START", + "DOM_VK_XF86XK_STOP", + "DOM_VK_XF86XK_SUBTITLE", + "DOM_VK_XF86XK_SUPPORT", + "DOM_VK_XF86XK_SUSPEND", + "DOM_VK_XF86XK_TASK_PANE", + "DOM_VK_XF86XK_TERMINAL", + "DOM_VK_XF86XK_TIME", + "DOM_VK_XF86XK_TOOLS", + "DOM_VK_XF86XK_TOP_MENU", + "DOM_VK_XF86XK_TO_DO_LIST", + "DOM_VK_XF86XK_TRAVEL", + "DOM_VK_XF86XK_USER1KB", + "DOM_VK_XF86XK_USER2KB", + "DOM_VK_XF86XK_USER_PB", + "DOM_VK_XF86XK_UWB", + "DOM_VK_XF86XK_VENDOR_HOME", + "DOM_VK_XF86XK_VIDEO", + "DOM_VK_XF86XK_VIEW", + "DOM_VK_XF86XK_WAKE_UP", + "DOM_VK_XF86XK_WEB_CAM", + "DOM_VK_XF86XK_WHEEL_BUTTON", + "DOM_VK_XF86XK_WLAN", + "DOM_VK_XF86XK_WORD", + "DOM_VK_XF86XK_WWW", + "DOM_VK_XF86XK_XFER", + "DOM_VK_XF86XK_YELLOW", + "DOM_VK_XF86XK_ZOOM_IN", + "DOM_VK_XF86XK_ZOOM_OUT", + "DOM_VK_Y", + "DOM_VK_Z", + "DOM_VK_ZOOM", + "DONE", + "DONT_CARE", + "DOWNLOADING", + "DRAGDROP", + "DST_ALPHA", + "DST_COLOR", + "DYNAMIC_DRAW", + "DataChannel", + "DataTransfer", + "DataTransferItem", + "DataTransferItemList", + "DataView", + "Date", + "DateTimeFormat", + "DelayNode", + "DesktopNotification", + "DesktopNotificationCenter", + "DeviceLightEvent", + "DeviceMotionEvent", + "DeviceOrientationEvent", + "DeviceProximityEvent", + "DeviceStorage", + "DeviceStorageChangeEvent", + "Document", + "DocumentFragment", + "DocumentType", + "DragEvent", + "DynamicsCompressorNode", + "E", + "ELEMENT_ARRAY_BUFFER", + "ELEMENT_ARRAY_BUFFER_BINDING", + "ELEMENT_NODE", + "EMPTY", + "ENCODING_ERR", + "ENDED", + "END_TO_END", + "END_TO_START", + "ENTITY_NODE", + "ENTITY_REFERENCE_NODE", + "EPSILON", + "EQUAL", + "EQUALPOWER", + "ERROR", + "EXPONENTIAL_DISTANCE", + "Element", + "ElementQuery", + "Entity", + "EntityReference", + "Error", + "ErrorEvent", + "EvalError", + "Event", + "EventException", + "EventSource", + "EventTarget", + "External", + "FASTEST", + "FIDOSDK", + "FILTER_ACCEPT", + "FILTER_INTERRUPT", + "FILTER_REJECT", + "FILTER_SKIP", + "FINISHED_STATE", + "FIRST_ORDERED_NODE_TYPE", + "FLOAT", + "FLOAT_MAT2", + "FLOAT_MAT3", + "FLOAT_MAT4", + "FLOAT_VEC2", + "FLOAT_VEC3", + "FLOAT_VEC4", + "FOCUS", + "FONT_FACE_RULE", + "FONT_FEATURE_VALUES_RULE", + "FRAGMENT_SHADER", + "FRAGMENT_SHADER_DERIVATIVE_HINT_OES", + "FRAMEBUFFER", + "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME", + "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE", + "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE", + "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL", + "FRAMEBUFFER_BINDING", + "FRAMEBUFFER_COMPLETE", + "FRAMEBUFFER_INCOMPLETE_ATTACHMENT", + "FRAMEBUFFER_INCOMPLETE_DIMENSIONS", + "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT", + "FRAMEBUFFER_UNSUPPORTED", + "FRONT", + "FRONT_AND_BACK", + "FRONT_FACE", + "FUNC_ADD", + "FUNC_REVERSE_SUBTRACT", + "FUNC_SUBTRACT", + "Feed", + "FeedEntry", + "File", + "FileError", + "FileList", + "FileReader", + "FindInPage", + "Float32Array", + "Float64Array", + "FocusEvent", + "FontFace", + "FormData", + "Function", + "GENERATE_MIPMAP_HINT", + "GEQUAL", + "GREATER", + "GREEN_BITS", + "GainNode", + "Gamepad", + "GamepadButton", + "GamepadEvent", + "GestureEvent", + "HAVE_CURRENT_DATA", + "HAVE_ENOUGH_DATA", + "HAVE_FUTURE_DATA", + "HAVE_METADATA", + "HAVE_NOTHING", + "HEADERS_RECEIVED", + "HIDDEN", + "HIERARCHY_REQUEST_ERR", + "HIGHPASS", + "HIGHSHELF", + "HIGH_FLOAT", + "HIGH_INT", + "HORIZONTAL", + "HORIZONTAL_AXIS", + "HRTF", + "HTMLAllCollection", + "HTMLAnchorElement", + "HTMLAppletElement", + "HTMLAreaElement", + "HTMLAudioElement", + "HTMLBRElement", + "HTMLBaseElement", + "HTMLBaseFontElement", + "HTMLBlockquoteElement", + "HTMLBodyElement", + "HTMLButtonElement", + "HTMLCanvasElement", + "HTMLCollection", + "HTMLCommandElement", + "HTMLContentElement", + "HTMLDListElement", + "HTMLDataElement", + "HTMLDataListElement", + "HTMLDetailsElement", + "HTMLDialogElement", + "HTMLDirectoryElement", + "HTMLDivElement", + "HTMLDocument", + "HTMLElement", + "HTMLEmbedElement", + "HTMLFieldSetElement", + "HTMLFontElement", + "HTMLFormControlsCollection", + "HTMLFormElement", + "HTMLFrameElement", + "HTMLFrameSetElement", + "HTMLHRElement", + "HTMLHeadElement", + "HTMLHeadingElement", + "HTMLHtmlElement", + "HTMLIFrameElement", + "HTMLImageElement", + "HTMLInputElement", + "HTMLIsIndexElement", + "HTMLKeygenElement", + "HTMLLIElement", + "HTMLLabelElement", + "HTMLLegendElement", + "HTMLLinkElement", + "HTMLMapElement", + "HTMLMarqueeElement", + "HTMLMediaElement", + "HTMLMenuElement", + "HTMLMenuItemElement", + "HTMLMetaElement", + "HTMLMeterElement", + "HTMLModElement", + "HTMLOListElement", + "HTMLObjectElement", + "HTMLOptGroupElement", + "HTMLOptionElement", + "HTMLOptionsCollection", + "HTMLOutputElement", + "HTMLParagraphElement", + "HTMLParamElement", + "HTMLPictureElement", + "HTMLPreElement", + "HTMLProgressElement", + "HTMLPropertiesCollection", + "HTMLQuoteElement", + "HTMLScriptElement", + "HTMLSelectElement", + "HTMLShadowElement", + "HTMLSourceElement", + "HTMLSpanElement", + "HTMLStyleElement", + "HTMLTableCaptionElement", + "HTMLTableCellElement", + "HTMLTableColElement", + "HTMLTableElement", + "HTMLTableRowElement", + "HTMLTableSectionElement", + "HTMLTemplateElement", + "HTMLTextAreaElement", + "HTMLTimeElement", + "HTMLTitleElement", + "HTMLTrackElement", + "HTMLUListElement", + "HTMLUnknownElement", + "HTMLVideoElement", + "HashChangeEvent", + "Headers", + "History", + "ICE_CHECKING", + "ICE_CLOSED", + "ICE_COMPLETED", + "ICE_CONNECTED", + "ICE_FAILED", + "ICE_GATHERING", + "ICE_WAITING", + "IDBCursor", + "IDBCursorWithValue", + "IDBDatabase", + "IDBDatabaseException", + "IDBFactory", + "IDBFileHandle", + "IDBFileRequest", + "IDBIndex", + "IDBKeyRange", + "IDBMutableFile", + "IDBObjectStore", + "IDBOpenDBRequest", + "IDBRequest", + "IDBTransaction", + "IDBVersionChangeEvent", + "IDLE", + "IMPLEMENTATION_COLOR_READ_FORMAT", + "IMPLEMENTATION_COLOR_READ_TYPE", + "IMPORT_RULE", + "INCR", + "INCR_WRAP", + "INDEX_SIZE_ERR", + "INT", + "INT_VEC2", + "INT_VEC3", + "INT_VEC4", + "INUSE_ATTRIBUTE_ERR", + "INVALID_ACCESS_ERR", + "INVALID_CHARACTER_ERR", + "INVALID_ENUM", + "INVALID_EXPRESSION_ERR", + "INVALID_FRAMEBUFFER_OPERATION", + "INVALID_MODIFICATION_ERR", + "INVALID_NODE_TYPE_ERR", + "INVALID_OPERATION", + "INVALID_STATE_ERR", + "INVALID_VALUE", + "INVERSE_DISTANCE", + "INVERT", + "IceCandidate", + "Image", + "ImageBitmap", + "ImageData", + "Infinity", + "InputEvent", + "InputMethodContext", + "InstallTrigger", + "Int16Array", + "Int32Array", + "Int8Array", + "Intent", + "InternalError", + "Intl", + "IsSearchProviderInstalled", + "Iterator", + "JSON", + "KEEP", + "KEYDOWN", + "KEYFRAMES_RULE", + "KEYFRAME_RULE", + "KEYPRESS", + "KEYUP", + "KeyEvent", + "KeyboardEvent", + "LENGTHADJUST_SPACING", + "LENGTHADJUST_SPACINGANDGLYPHS", + "LENGTHADJUST_UNKNOWN", + "LEQUAL", + "LESS", + "LINEAR", + "LINEAR_DISTANCE", + "LINEAR_MIPMAP_LINEAR", + "LINEAR_MIPMAP_NEAREST", + "LINES", + "LINE_LOOP", + "LINE_STRIP", + "LINE_WIDTH", + "LINK_STATUS", + "LIVE", + "LN10", + "LN2", + "LOADED", + "LOADING", + "LOG10E", + "LOG2E", + "LOWPASS", + "LOWSHELF", + "LOW_FLOAT", + "LOW_INT", + "LSException", + "LSParserFilter", + "LUMINANCE", + "LUMINANCE_ALPHA", + "LocalMediaStream", + "Location", + "MAX_COMBINED_TEXTURE_IMAGE_UNITS", + "MAX_CUBE_MAP_TEXTURE_SIZE", + "MAX_FRAGMENT_UNIFORM_VECTORS", + "MAX_RENDERBUFFER_SIZE", + "MAX_SAFE_INTEGER", + "MAX_TEXTURE_IMAGE_UNITS", + "MAX_TEXTURE_MAX_ANISOTROPY_EXT", + "MAX_TEXTURE_SIZE", + "MAX_VALUE", + "MAX_VARYING_VECTORS", + "MAX_VERTEX_ATTRIBS", + "MAX_VERTEX_TEXTURE_IMAGE_UNITS", + "MAX_VERTEX_UNIFORM_VECTORS", + "MAX_VIEWPORT_DIMS", + "MEDIA_ERR_ABORTED", + "MEDIA_ERR_DECODE", + "MEDIA_ERR_ENCRYPTED", + "MEDIA_ERR_NETWORK", + "MEDIA_ERR_SRC_NOT_SUPPORTED", + "MEDIA_KEYERR_CLIENT", + "MEDIA_KEYERR_DOMAIN", + "MEDIA_KEYERR_HARDWARECHANGE", + "MEDIA_KEYERR_OUTPUT", + "MEDIA_KEYERR_SERVICE", + "MEDIA_KEYERR_UNKNOWN", + "MEDIA_RULE", + "MEDIUM_FLOAT", + "MEDIUM_INT", + "META_MASK", + "MIN_SAFE_INTEGER", + "MIN_VALUE", + "MIRRORED_REPEAT", + "MODE_ASYNCHRONOUS", + "MODE_SYNCHRONOUS", + "MODIFICATION", + "MOUSEDOWN", + "MOUSEDRAG", + "MOUSEMOVE", + "MOUSEOUT", + "MOUSEOVER", + "MOUSEUP", + "MOZ_KEYFRAMES_RULE", + "MOZ_KEYFRAME_RULE", + "MOZ_SOURCE_CURSOR", + "MOZ_SOURCE_ERASER", + "MOZ_SOURCE_KEYBOARD", + "MOZ_SOURCE_MOUSE", + "MOZ_SOURCE_PEN", + "MOZ_SOURCE_TOUCH", + "MOZ_SOURCE_UNKNOWN", + "MSGESTURE_FLAG_BEGIN", + "MSGESTURE_FLAG_CANCEL", + "MSGESTURE_FLAG_END", + "MSGESTURE_FLAG_INERTIA", + "MSGESTURE_FLAG_NONE", + "MSPOINTER_TYPE_MOUSE", + "MSPOINTER_TYPE_PEN", + "MSPOINTER_TYPE_TOUCH", + "MS_ASYNC_CALLBACK_STATUS_ASSIGN_DELEGATE", + "MS_ASYNC_CALLBACK_STATUS_CANCEL", + "MS_ASYNC_CALLBACK_STATUS_CHOOSEANY", + "MS_ASYNC_CALLBACK_STATUS_ERROR", + "MS_ASYNC_CALLBACK_STATUS_JOIN", + "MS_ASYNC_OP_STATUS_CANCELED", + "MS_ASYNC_OP_STATUS_ERROR", + "MS_ASYNC_OP_STATUS_SUCCESS", + "MS_MANIPULATION_STATE_ACTIVE", + "MS_MANIPULATION_STATE_CANCELLED", + "MS_MANIPULATION_STATE_COMMITTED", + "MS_MANIPULATION_STATE_DRAGGING", + "MS_MANIPULATION_STATE_INERTIA", + "MS_MANIPULATION_STATE_PRESELECT", + "MS_MANIPULATION_STATE_SELECTING", + "MS_MANIPULATION_STATE_STOPPED", + "MS_MEDIA_ERR_ENCRYPTED", + "MS_MEDIA_KEYERR_CLIENT", + "MS_MEDIA_KEYERR_DOMAIN", + "MS_MEDIA_KEYERR_HARDWARECHANGE", + "MS_MEDIA_KEYERR_OUTPUT", + "MS_MEDIA_KEYERR_SERVICE", + "MS_MEDIA_KEYERR_UNKNOWN", + "Map", + "Math", + "MediaController", + "MediaDevices", + "MediaElementAudioSourceNode", + "MediaEncryptedEvent", + "MediaError", + "MediaKeyError", + "MediaKeyEvent", + "MediaKeyMessageEvent", + "MediaKeyNeededEvent", + "MediaKeySession", + "MediaKeyStatusMap", + "MediaKeySystemAccess", + "MediaKeys", + "MediaList", + "MediaQueryList", + "MediaQueryListEvent", + "MediaRecorder", + "MediaSource", + "MediaStream", + "MediaStreamAudioDestinationNode", + "MediaStreamAudioSourceNode", + "MediaStreamEvent", + "MediaStreamTrack", + "MediaStreamTrackEvent", + "MessageChannel", + "MessageEvent", + "MessagePort", + "Methods", + "MimeType", + "MimeTypeArray", + "MouseEvent", + "MouseScrollEvent", + "MozAnimation", + "MozAnimationDelay", + "MozAnimationDirection", + "MozAnimationDuration", + "MozAnimationFillMode", + "MozAnimationIterationCount", + "MozAnimationName", + "MozAnimationPlayState", + "MozAnimationTimingFunction", + "MozAppearance", + "MozBackfaceVisibility", + "MozBinding", + "MozBorderBottomColors", + "MozBorderEnd", + "MozBorderEndColor", + "MozBorderEndStyle", + "MozBorderEndWidth", + "MozBorderImage", + "MozBorderLeftColors", + "MozBorderRightColors", + "MozBorderStart", + "MozBorderStartColor", + "MozBorderStartStyle", + "MozBorderStartWidth", + "MozBorderTopColors", + "MozBoxAlign", + "MozBoxDirection", + "MozBoxFlex", + "MozBoxOrdinalGroup", + "MozBoxOrient", + "MozBoxPack", + "MozBoxSizing", + "MozCSSKeyframeRule", + "MozCSSKeyframesRule", + "MozColumnCount", + "MozColumnFill", + "MozColumnGap", + "MozColumnRule", + "MozColumnRuleColor", + "MozColumnRuleStyle", + "MozColumnRuleWidth", + "MozColumnWidth", + "MozColumns", + "MozContactChangeEvent", + "MozFloatEdge", + "MozFontFeatureSettings", + "MozFontLanguageOverride", + "MozForceBrokenImageIcon", + "MozHyphens", + "MozImageRegion", + "MozMarginEnd", + "MozMarginStart", + "MozMmsEvent", + "MozMmsMessage", + "MozMobileMessageThread", + "MozOSXFontSmoothing", + "MozOrient", + "MozOutlineRadius", + "MozOutlineRadiusBottomleft", + "MozOutlineRadiusBottomright", + "MozOutlineRadiusTopleft", + "MozOutlineRadiusTopright", + "MozPaddingEnd", + "MozPaddingStart", + "MozPerspective", + "MozPerspectiveOrigin", + "MozPowerManager", + "MozSettingsEvent", + "MozSmsEvent", + "MozSmsMessage", + "MozStackSizing", + "MozTabSize", + "MozTextAlignLast", + "MozTextDecorationColor", + "MozTextDecorationLine", + "MozTextDecorationStyle", + "MozTextSizeAdjust", + "MozTransform", + "MozTransformOrigin", + "MozTransformStyle", + "MozTransition", + "MozTransitionDelay", + "MozTransitionDuration", + "MozTransitionProperty", + "MozTransitionTimingFunction", + "MozUserFocus", + "MozUserInput", + "MozUserModify", + "MozUserSelect", + "MozWindowDragging", + "MozWindowShadow", + "MutationEvent", + "MutationObserver", + "MutationRecord", + "NAMESPACE_ERR", + "NAMESPACE_RULE", + "NEAREST", + "NEAREST_MIPMAP_LINEAR", + "NEAREST_MIPMAP_NEAREST", + "NEGATIVE_INFINITY", + "NETWORK_EMPTY", + "NETWORK_ERR", + "NETWORK_IDLE", + "NETWORK_LOADED", + "NETWORK_LOADING", + "NETWORK_NO_SOURCE", + "NEVER", + "NEW", + "NEXT", + "NEXT_NO_DUPLICATE", + "NICEST", + "NODE_AFTER", + "NODE_BEFORE", + "NODE_BEFORE_AND_AFTER", + "NODE_INSIDE", + "NONE", + "NON_TRANSIENT_ERR", + "NOTATION_NODE", + "NOTCH", + "NOTEQUAL", + "NOT_ALLOWED_ERR", + "NOT_FOUND_ERR", + "NOT_READABLE_ERR", + "NOT_SUPPORTED_ERR", + "NO_DATA_ALLOWED_ERR", + "NO_ERR", + "NO_ERROR", + "NO_MODIFICATION_ALLOWED_ERR", + "NUMBER_TYPE", + "NUM_COMPRESSED_TEXTURE_FORMATS", + "NaN", + "NamedNodeMap", + "Navigator", + "NearbyLinks", + "NetworkInformation", + "Node", + "NodeFilter", + "NodeIterator", + "NodeList", + "Notation", + "Notification", + "NotifyPaintEvent", + "Number", + "NumberFormat", + "OBSOLETE", + "ONE", + "ONE_MINUS_CONSTANT_ALPHA", + "ONE_MINUS_CONSTANT_COLOR", + "ONE_MINUS_DST_ALPHA", + "ONE_MINUS_DST_COLOR", + "ONE_MINUS_SRC_ALPHA", + "ONE_MINUS_SRC_COLOR", + "OPEN", + "OPENED", + "OPENING", + "ORDERED_NODE_ITERATOR_TYPE", + "ORDERED_NODE_SNAPSHOT_TYPE", + "OUT_OF_MEMORY", + "Object", + "OfflineAudioCompletionEvent", + "OfflineAudioContext", + "OfflineResourceList", + "Option", + "OscillatorNode", + "OverflowEvent", + "PACK_ALIGNMENT", + "PAGE_RULE", + "PARSE_ERR", + "PATHSEG_ARC_ABS", + "PATHSEG_ARC_REL", + "PATHSEG_CLOSEPATH", + "PATHSEG_CURVETO_CUBIC_ABS", + "PATHSEG_CURVETO_CUBIC_REL", + "PATHSEG_CURVETO_CUBIC_SMOOTH_ABS", + "PATHSEG_CURVETO_CUBIC_SMOOTH_REL", + "PATHSEG_CURVETO_QUADRATIC_ABS", + "PATHSEG_CURVETO_QUADRATIC_REL", + "PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS", + "PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL", + "PATHSEG_LINETO_ABS", + "PATHSEG_LINETO_HORIZONTAL_ABS", + "PATHSEG_LINETO_HORIZONTAL_REL", + "PATHSEG_LINETO_REL", + "PATHSEG_LINETO_VERTICAL_ABS", + "PATHSEG_LINETO_VERTICAL_REL", + "PATHSEG_MOVETO_ABS", + "PATHSEG_MOVETO_REL", + "PATHSEG_UNKNOWN", + "PATH_EXISTS_ERR", + "PEAKING", + "PERMISSION_DENIED", + "PERSISTENT", + "PI", + "PLAYING_STATE", + "POINTS", + "POLYGON_OFFSET_FACTOR", + "POLYGON_OFFSET_FILL", + "POLYGON_OFFSET_UNITS", + "POSITION_UNAVAILABLE", + "POSITIVE_INFINITY", + "PREV", + "PREV_NO_DUPLICATE", + "PROCESSING_INSTRUCTION_NODE", + "PageChangeEvent", + "PageTransitionEvent", + "PaintRequest", + "PaintRequestList", + "PannerNode", + "Path2D", + "Performance", + "PerformanceEntry", + "PerformanceMark", + "PerformanceMeasure", + "PerformanceNavigation", + "PerformanceResourceTiming", + "PerformanceTiming", + "PeriodicWave", + "Plugin", + "PluginArray", + "PopStateEvent", + "PopupBlockedEvent", + "ProcessingInstruction", + "ProgressEvent", + "Promise", + "PropertyNodeList", + "Proxy", + "PushManager", + "PushSubscription", + "Q", + "QUOTA_ERR", + "QUOTA_EXCEEDED_ERR", + "QueryInterface", + "READ_ONLY", + "READ_ONLY_ERR", + "READ_WRITE", + "RED_BITS", + "REMOVAL", + "RENDERBUFFER", + "RENDERBUFFER_ALPHA_SIZE", + "RENDERBUFFER_BINDING", + "RENDERBUFFER_BLUE_SIZE", + "RENDERBUFFER_DEPTH_SIZE", + "RENDERBUFFER_GREEN_SIZE", + "RENDERBUFFER_HEIGHT", + "RENDERBUFFER_INTERNAL_FORMAT", + "RENDERBUFFER_RED_SIZE", + "RENDERBUFFER_STENCIL_SIZE", + "RENDERBUFFER_WIDTH", + "RENDERER", + "RENDERING_INTENT_ABSOLUTE_COLORIMETRIC", + "RENDERING_INTENT_AUTO", + "RENDERING_INTENT_PERCEPTUAL", + "RENDERING_INTENT_RELATIVE_COLORIMETRIC", + "RENDERING_INTENT_SATURATION", + "RENDERING_INTENT_UNKNOWN", + "REPEAT", + "REPLACE", + "RGB", + "RGB565", + "RGB5_A1", + "RGBA", + "RGBA4", + "RGBColor", + "ROTATION_CLOCKWISE", + "ROTATION_COUNTERCLOCKWISE", + "RTCDataChannelEvent", + "RTCIceCandidate", + "RTCPeerConnectionIceEvent", + "RTCRtpReceiver", + "RTCRtpSender", + "RTCSessionDescription", + "RTCStatsReport", + "RadioNodeList", + "Range", + "RangeError", + "RangeException", + "RecordErrorEvent", + "Rect", + "ReferenceError", + "RegExp", + "Request", + "Response", + "SAMPLER_2D", + "SAMPLER_CUBE", + "SAMPLES", + "SAMPLE_ALPHA_TO_COVERAGE", + "SAMPLE_BUFFERS", + "SAMPLE_COVERAGE", + "SAMPLE_COVERAGE_INVERT", + "SAMPLE_COVERAGE_VALUE", + "SAWTOOTH", + "SCHEDULED_STATE", + "SCISSOR_BOX", + "SCISSOR_TEST", + "SCROLL_PAGE_DOWN", + "SCROLL_PAGE_UP", + "SDP_ANSWER", + "SDP_OFFER", + "SDP_PRANSWER", + "SECURITY_ERR", + "SELECT", + "SERIALIZE_ERR", + "SEVERITY_ERROR", + "SEVERITY_FATAL_ERROR", + "SEVERITY_WARNING", + "SHADER_COMPILER", + "SHADER_TYPE", + "SHADING_LANGUAGE_VERSION", + "SHIFT_MASK", + "SHORT", + "SHOWING", + "SHOW_ALL", + "SHOW_ATTRIBUTE", + "SHOW_CDATA_SECTION", + "SHOW_COMMENT", + "SHOW_DOCUMENT", + "SHOW_DOCUMENT_FRAGMENT", + "SHOW_DOCUMENT_TYPE", + "SHOW_ELEMENT", + "SHOW_ENTITY", + "SHOW_ENTITY_REFERENCE", + "SHOW_NOTATION", + "SHOW_PROCESSING_INSTRUCTION", + "SHOW_TEXT", + "SINE", + "SOUNDFIELD", + "SQLException", + "SQRT1_2", + "SQRT2", + "SQUARE", + "SRC_ALPHA", + "SRC_ALPHA_SATURATE", + "SRC_COLOR", + "START_TO_END", + "START_TO_START", + "STATIC_DRAW", + "STENCIL_ATTACHMENT", + "STENCIL_BACK_FAIL", + "STENCIL_BACK_FUNC", + "STENCIL_BACK_PASS_DEPTH_FAIL", + "STENCIL_BACK_PASS_DEPTH_PASS", + "STENCIL_BACK_REF", + "STENCIL_BACK_VALUE_MASK", + "STENCIL_BACK_WRITEMASK", + "STENCIL_BITS", + "STENCIL_BUFFER_BIT", + "STENCIL_CLEAR_VALUE", + "STENCIL_FAIL", + "STENCIL_FUNC", + "STENCIL_INDEX", + "STENCIL_INDEX8", + "STENCIL_PASS_DEPTH_FAIL", + "STENCIL_PASS_DEPTH_PASS", + "STENCIL_REF", + "STENCIL_TEST", + "STENCIL_VALUE_MASK", + "STENCIL_WRITEMASK", + "STREAM_DRAW", + "STRING_TYPE", + "STYLE_RULE", + "SUBPIXEL_BITS", + "SUPPORTS_RULE", + "SVGAElement", + "SVGAltGlyphDefElement", + "SVGAltGlyphElement", + "SVGAltGlyphItemElement", + "SVGAngle", + "SVGAnimateColorElement", + "SVGAnimateElement", + "SVGAnimateMotionElement", + "SVGAnimateTransformElement", + "SVGAnimatedAngle", + "SVGAnimatedBoolean", + "SVGAnimatedEnumeration", + "SVGAnimatedInteger", + "SVGAnimatedLength", + "SVGAnimatedLengthList", + "SVGAnimatedNumber", + "SVGAnimatedNumberList", + "SVGAnimatedPreserveAspectRatio", + "SVGAnimatedRect", + "SVGAnimatedString", + "SVGAnimatedTransformList", + "SVGAnimationElement", + "SVGCircleElement", + "SVGClipPathElement", + "SVGColor", + "SVGComponentTransferFunctionElement", + "SVGCursorElement", + "SVGDefsElement", + "SVGDescElement", + "SVGDiscardElement", + "SVGDocument", + "SVGElement", + "SVGElementInstance", + "SVGElementInstanceList", + "SVGEllipseElement", + "SVGException", + "SVGFEBlendElement", + "SVGFEColorMatrixElement", + "SVGFEComponentTransferElement", + "SVGFECompositeElement", + "SVGFEConvolveMatrixElement", + "SVGFEDiffuseLightingElement", + "SVGFEDisplacementMapElement", + "SVGFEDistantLightElement", + "SVGFEDropShadowElement", + "SVGFEFloodElement", + "SVGFEFuncAElement", + "SVGFEFuncBElement", + "SVGFEFuncGElement", + "SVGFEFuncRElement", + "SVGFEGaussianBlurElement", + "SVGFEImageElement", + "SVGFEMergeElement", + "SVGFEMergeNodeElement", + "SVGFEMorphologyElement", + "SVGFEOffsetElement", + "SVGFEPointLightElement", + "SVGFESpecularLightingElement", + "SVGFESpotLightElement", + "SVGFETileElement", + "SVGFETurbulenceElement", + "SVGFilterElement", + "SVGFontElement", + "SVGFontFaceElement", + "SVGFontFaceFormatElement", + "SVGFontFaceNameElement", + "SVGFontFaceSrcElement", + "SVGFontFaceUriElement", + "SVGForeignObjectElement", + "SVGGElement", + "SVGGeometryElement", + "SVGGlyphElement", + "SVGGlyphRefElement", + "SVGGradientElement", + "SVGGraphicsElement", + "SVGHKernElement", + "SVGImageElement", + "SVGLength", + "SVGLengthList", + "SVGLineElement", + "SVGLinearGradientElement", + "SVGMPathElement", + "SVGMarkerElement", + "SVGMaskElement", + "SVGMatrix", + "SVGMetadataElement", + "SVGMissingGlyphElement", + "SVGNumber", + "SVGNumberList", + "SVGPaint", + "SVGPathElement", + "SVGPathSeg", + "SVGPathSegArcAbs", + "SVGPathSegArcRel", + "SVGPathSegClosePath", + "SVGPathSegCurvetoCubicAbs", + "SVGPathSegCurvetoCubicRel", + "SVGPathSegCurvetoCubicSmoothAbs", + "SVGPathSegCurvetoCubicSmoothRel", + "SVGPathSegCurvetoQuadraticAbs", + "SVGPathSegCurvetoQuadraticRel", + "SVGPathSegCurvetoQuadraticSmoothAbs", + "SVGPathSegCurvetoQuadraticSmoothRel", + "SVGPathSegLinetoAbs", + "SVGPathSegLinetoHorizontalAbs", + "SVGPathSegLinetoHorizontalRel", + "SVGPathSegLinetoRel", + "SVGPathSegLinetoVerticalAbs", + "SVGPathSegLinetoVerticalRel", + "SVGPathSegList", + "SVGPathSegMovetoAbs", + "SVGPathSegMovetoRel", + "SVGPatternElement", + "SVGPoint", + "SVGPointList", + "SVGPolygonElement", + "SVGPolylineElement", + "SVGPreserveAspectRatio", + "SVGRadialGradientElement", + "SVGRect", + "SVGRectElement", + "SVGRenderingIntent", + "SVGSVGElement", + "SVGScriptElement", + "SVGSetElement", + "SVGStopElement", + "SVGStringList", + "SVGStyleElement", + "SVGSwitchElement", + "SVGSymbolElement", + "SVGTRefElement", + "SVGTSpanElement", + "SVGTextContentElement", + "SVGTextElement", + "SVGTextPathElement", + "SVGTextPositioningElement", + "SVGTitleElement", + "SVGTransform", + "SVGTransformList", + "SVGUnitTypes", + "SVGUseElement", + "SVGVKernElement", + "SVGViewElement", + "SVGViewSpec", + "SVGZoomAndPan", + "SVGZoomEvent", + "SVG_ANGLETYPE_DEG", + "SVG_ANGLETYPE_GRAD", + "SVG_ANGLETYPE_RAD", + "SVG_ANGLETYPE_UNKNOWN", + "SVG_ANGLETYPE_UNSPECIFIED", + "SVG_CHANNEL_A", + "SVG_CHANNEL_B", + "SVG_CHANNEL_G", + "SVG_CHANNEL_R", + "SVG_CHANNEL_UNKNOWN", + "SVG_COLORTYPE_CURRENTCOLOR", + "SVG_COLORTYPE_RGBCOLOR", + "SVG_COLORTYPE_RGBCOLOR_ICCCOLOR", + "SVG_COLORTYPE_UNKNOWN", + "SVG_EDGEMODE_DUPLICATE", + "SVG_EDGEMODE_NONE", + "SVG_EDGEMODE_UNKNOWN", + "SVG_EDGEMODE_WRAP", + "SVG_FEBLEND_MODE_COLOR", + "SVG_FEBLEND_MODE_COLOR_BURN", + "SVG_FEBLEND_MODE_COLOR_DODGE", + "SVG_FEBLEND_MODE_DARKEN", + "SVG_FEBLEND_MODE_DIFFERENCE", + "SVG_FEBLEND_MODE_EXCLUSION", + "SVG_FEBLEND_MODE_HARD_LIGHT", + "SVG_FEBLEND_MODE_HUE", + "SVG_FEBLEND_MODE_LIGHTEN", + "SVG_FEBLEND_MODE_LUMINOSITY", + "SVG_FEBLEND_MODE_MULTIPLY", + "SVG_FEBLEND_MODE_NORMAL", + "SVG_FEBLEND_MODE_OVERLAY", + "SVG_FEBLEND_MODE_SATURATION", + "SVG_FEBLEND_MODE_SCREEN", + "SVG_FEBLEND_MODE_SOFT_LIGHT", + "SVG_FEBLEND_MODE_UNKNOWN", + "SVG_FECOLORMATRIX_TYPE_HUEROTATE", + "SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA", + "SVG_FECOLORMATRIX_TYPE_MATRIX", + "SVG_FECOLORMATRIX_TYPE_SATURATE", + "SVG_FECOLORMATRIX_TYPE_UNKNOWN", + "SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE", + "SVG_FECOMPONENTTRANSFER_TYPE_GAMMA", + "SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY", + "SVG_FECOMPONENTTRANSFER_TYPE_LINEAR", + "SVG_FECOMPONENTTRANSFER_TYPE_TABLE", + "SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN", + "SVG_FECOMPOSITE_OPERATOR_ARITHMETIC", + "SVG_FECOMPOSITE_OPERATOR_ATOP", + "SVG_FECOMPOSITE_OPERATOR_IN", + "SVG_FECOMPOSITE_OPERATOR_OUT", + "SVG_FECOMPOSITE_OPERATOR_OVER", + "SVG_FECOMPOSITE_OPERATOR_UNKNOWN", + "SVG_FECOMPOSITE_OPERATOR_XOR", + "SVG_INVALID_VALUE_ERR", + "SVG_LENGTHTYPE_CM", + "SVG_LENGTHTYPE_EMS", + "SVG_LENGTHTYPE_EXS", + "SVG_LENGTHTYPE_IN", + "SVG_LENGTHTYPE_MM", + "SVG_LENGTHTYPE_NUMBER", + "SVG_LENGTHTYPE_PC", + "SVG_LENGTHTYPE_PERCENTAGE", + "SVG_LENGTHTYPE_PT", + "SVG_LENGTHTYPE_PX", + "SVG_LENGTHTYPE_UNKNOWN", + "SVG_MARKERUNITS_STROKEWIDTH", + "SVG_MARKERUNITS_UNKNOWN", + "SVG_MARKERUNITS_USERSPACEONUSE", + "SVG_MARKER_ORIENT_ANGLE", + "SVG_MARKER_ORIENT_AUTO", + "SVG_MARKER_ORIENT_UNKNOWN", + "SVG_MASKTYPE_ALPHA", + "SVG_MASKTYPE_LUMINANCE", + "SVG_MATRIX_NOT_INVERTABLE", + "SVG_MEETORSLICE_MEET", + "SVG_MEETORSLICE_SLICE", + "SVG_MEETORSLICE_UNKNOWN", + "SVG_MORPHOLOGY_OPERATOR_DILATE", + "SVG_MORPHOLOGY_OPERATOR_ERODE", + "SVG_MORPHOLOGY_OPERATOR_UNKNOWN", + "SVG_PAINTTYPE_CURRENTCOLOR", + "SVG_PAINTTYPE_NONE", + "SVG_PAINTTYPE_RGBCOLOR", + "SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR", + "SVG_PAINTTYPE_UNKNOWN", + "SVG_PAINTTYPE_URI", + "SVG_PAINTTYPE_URI_CURRENTCOLOR", + "SVG_PAINTTYPE_URI_NONE", + "SVG_PAINTTYPE_URI_RGBCOLOR", + "SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR", + "SVG_PRESERVEASPECTRATIO_NONE", + "SVG_PRESERVEASPECTRATIO_UNKNOWN", + "SVG_PRESERVEASPECTRATIO_XMAXYMAX", + "SVG_PRESERVEASPECTRATIO_XMAXYMID", + "SVG_PRESERVEASPECTRATIO_XMAXYMIN", + "SVG_PRESERVEASPECTRATIO_XMIDYMAX", + "SVG_PRESERVEASPECTRATIO_XMIDYMID", + "SVG_PRESERVEASPECTRATIO_XMIDYMIN", + "SVG_PRESERVEASPECTRATIO_XMINYMAX", + "SVG_PRESERVEASPECTRATIO_XMINYMID", + "SVG_PRESERVEASPECTRATIO_XMINYMIN", + "SVG_SPREADMETHOD_PAD", + "SVG_SPREADMETHOD_REFLECT", + "SVG_SPREADMETHOD_REPEAT", + "SVG_SPREADMETHOD_UNKNOWN", + "SVG_STITCHTYPE_NOSTITCH", + "SVG_STITCHTYPE_STITCH", + "SVG_STITCHTYPE_UNKNOWN", + "SVG_TRANSFORM_MATRIX", + "SVG_TRANSFORM_ROTATE", + "SVG_TRANSFORM_SCALE", + "SVG_TRANSFORM_SKEWX", + "SVG_TRANSFORM_SKEWY", + "SVG_TRANSFORM_TRANSLATE", + "SVG_TRANSFORM_UNKNOWN", + "SVG_TURBULENCE_TYPE_FRACTALNOISE", + "SVG_TURBULENCE_TYPE_TURBULENCE", + "SVG_TURBULENCE_TYPE_UNKNOWN", + "SVG_UNIT_TYPE_OBJECTBOUNDINGBOX", + "SVG_UNIT_TYPE_UNKNOWN", + "SVG_UNIT_TYPE_USERSPACEONUSE", + "SVG_WRONG_TYPE_ERR", + "SVG_ZOOMANDPAN_DISABLE", + "SVG_ZOOMANDPAN_MAGNIFY", + "SVG_ZOOMANDPAN_UNKNOWN", + "SYNTAX_ERR", + "SavedPages", + "Screen", + "ScreenOrientation", + "Script", + "ScriptProcessorNode", + "ScrollAreaEvent", + "SecurityPolicyViolationEvent", + "Selection", + "ServiceWorker", + "ServiceWorkerContainer", + "ServiceWorkerRegistration", + "SessionDescription", + "Set", + "ShadowRoot", + "SharedWorker", + "SimpleGestureEvent", + "SpeechSynthesisEvent", + "SpeechSynthesisUtterance", + "StopIteration", + "Storage", + "StorageEvent", + "String", + "StyleSheet", + "StyleSheetList", + "SubtleCrypto", + "Symbol", + "SyntaxError", + "TEMPORARY", + "TEXTPATH_METHODTYPE_ALIGN", + "TEXTPATH_METHODTYPE_STRETCH", + "TEXTPATH_METHODTYPE_UNKNOWN", + "TEXTPATH_SPACINGTYPE_AUTO", + "TEXTPATH_SPACINGTYPE_EXACT", + "TEXTPATH_SPACINGTYPE_UNKNOWN", + "TEXTURE", + "TEXTURE0", + "TEXTURE1", + "TEXTURE10", + "TEXTURE11", + "TEXTURE12", + "TEXTURE13", + "TEXTURE14", + "TEXTURE15", + "TEXTURE16", + "TEXTURE17", + "TEXTURE18", + "TEXTURE19", + "TEXTURE2", + "TEXTURE20", + "TEXTURE21", + "TEXTURE22", + "TEXTURE23", + "TEXTURE24", + "TEXTURE25", + "TEXTURE26", + "TEXTURE27", + "TEXTURE28", + "TEXTURE29", + "TEXTURE3", + "TEXTURE30", + "TEXTURE31", + "TEXTURE4", + "TEXTURE5", + "TEXTURE6", + "TEXTURE7", + "TEXTURE8", + "TEXTURE9", + "TEXTURE_2D", + "TEXTURE_BINDING_2D", + "TEXTURE_BINDING_CUBE_MAP", + "TEXTURE_CUBE_MAP", + "TEXTURE_CUBE_MAP_NEGATIVE_X", + "TEXTURE_CUBE_MAP_NEGATIVE_Y", + "TEXTURE_CUBE_MAP_NEGATIVE_Z", + "TEXTURE_CUBE_MAP_POSITIVE_X", + "TEXTURE_CUBE_MAP_POSITIVE_Y", + "TEXTURE_CUBE_MAP_POSITIVE_Z", + "TEXTURE_MAG_FILTER", + "TEXTURE_MAX_ANISOTROPY_EXT", + "TEXTURE_MIN_FILTER", + "TEXTURE_WRAP_S", + "TEXTURE_WRAP_T", + "TEXT_NODE", + "TIMEOUT", + "TIMEOUT_ERR", + "TOO_LARGE_ERR", + "TRANSACTION_INACTIVE_ERR", + "TRIANGLE", + "TRIANGLES", + "TRIANGLE_FAN", + "TRIANGLE_STRIP", + "TYPE_BACK_FORWARD", + "TYPE_ERR", + "TYPE_MISMATCH_ERR", + "TYPE_NAVIGATE", + "TYPE_RELOAD", + "TYPE_RESERVED", + "Text", + "TextDecoder", + "TextEncoder", + "TextEvent", + "TextMetrics", + "TextTrack", + "TextTrackCue", + "TextTrackCueList", + "TextTrackList", + "TimeEvent", + "TimeRanges", + "Touch", + "TouchEvent", + "TouchList", + "TrackEvent", + "TransitionEvent", + "TreeWalker", + "TypeError", + "UIEvent", + "UNCACHED", + "UNKNOWN_ERR", + "UNKNOWN_RULE", + "UNMASKED_RENDERER_WEBGL", + "UNMASKED_VENDOR_WEBGL", + "UNORDERED_NODE_ITERATOR_TYPE", + "UNORDERED_NODE_SNAPSHOT_TYPE", + "UNPACK_ALIGNMENT", + "UNPACK_COLORSPACE_CONVERSION_WEBGL", + "UNPACK_FLIP_Y_WEBGL", + "UNPACK_PREMULTIPLY_ALPHA_WEBGL", + "UNSCHEDULED_STATE", + "UNSENT", + "UNSIGNED_BYTE", + "UNSIGNED_INT", + "UNSIGNED_SHORT", + "UNSIGNED_SHORT_4_4_4_4", + "UNSIGNED_SHORT_5_5_5_1", + "UNSIGNED_SHORT_5_6_5", + "UNSPECIFIED_EVENT_TYPE_ERR", + "UPDATEREADY", + "URIError", + "URL", + "URLSearchParams", + "URLUnencoded", + "URL_MISMATCH_ERR", + "UTC", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "UserMessageHandler", + "UserMessageHandlersNamespace", + "UserProximityEvent", + "VALIDATE_STATUS", + "VALIDATION_ERR", + "VARIABLES_RULE", + "VENDOR", + "VERSION", + "VERSION_CHANGE", + "VERSION_ERR", + "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", + "VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE", + "VERTEX_ATTRIB_ARRAY_ENABLED", + "VERTEX_ATTRIB_ARRAY_NORMALIZED", + "VERTEX_ATTRIB_ARRAY_POINTER", + "VERTEX_ATTRIB_ARRAY_SIZE", + "VERTEX_ATTRIB_ARRAY_STRIDE", + "VERTEX_ATTRIB_ARRAY_TYPE", + "VERTEX_SHADER", + "VERTICAL", + "VERTICAL_AXIS", + "VER_ERR", + "VIEWPORT", + "VIEWPORT_RULE", + "VTTCue", + "VTTRegion", + "ValidityState", + "VideoStreamTrack", + "WEBKIT_FILTER_RULE", + "WEBKIT_KEYFRAMES_RULE", + "WEBKIT_KEYFRAME_RULE", + "WEBKIT_REGION_RULE", + "WRONG_DOCUMENT_ERR", + "WaveShaperNode", + "WeakMap", + "WeakSet", + "WebGLActiveInfo", + "WebGLBuffer", + "WebGLContextEvent", + "WebGLFramebuffer", + "WebGLProgram", + "WebGLRenderbuffer", + "WebGLRenderingContext", + "WebGLShader", + "WebGLShaderPrecisionFormat", + "WebGLTexture", + "WebGLUniformLocation", + "WebGLVertexArray", + "WebKitAnimationEvent", + "WebKitBlobBuilder", + "WebKitCSSFilterRule", + "WebKitCSSFilterValue", + "WebKitCSSKeyframeRule", + "WebKitCSSKeyframesRule", + "WebKitCSSMatrix", + "WebKitCSSRegionRule", + "WebKitCSSTransformValue", + "WebKitDataCue", + "WebKitGamepad", + "WebKitMediaKeyError", + "WebKitMediaKeyMessageEvent", + "WebKitMediaKeySession", + "WebKitMediaKeys", + "WebKitMediaSource", + "WebKitMutationObserver", + "WebKitNamespace", + "WebKitPlaybackTargetAvailabilityEvent", + "WebKitPoint", + "WebKitShadowRoot", + "WebKitSourceBuffer", + "WebKitSourceBufferList", + "WebKitTransitionEvent", + "WebSocket", + "WheelEvent", + "Window", + "Worker", + "XMLDocument", + "XMLHttpRequest", + "XMLHttpRequestEventTarget", + "XMLHttpRequestException", + "XMLHttpRequestProgressEvent", + "XMLHttpRequestUpload", + "XMLSerializer", + "XMLStylesheetProcessingInstruction", + "XPathEvaluator", + "XPathException", + "XPathExpression", + "XPathNSResolver", + "XPathResult", + "XSLTProcessor", + "ZERO", + "_XD0M_", + "_YD0M_", + "__defineGetter__", + "__defineSetter__", + "__lookupGetter__", + "__lookupSetter__", + "__opera", + "__proto__", + "_browserjsran", + "a", + "aLink", + "abbr", + "abort", + "abs", + "absolute", + "acceleration", + "accelerationIncludingGravity", + "accelerator", + "accept", + "acceptCharset", + "acceptNode", + "accessKey", + "accessKeyLabel", + "accuracy", + "acos", + "acosh", + "action", + "actionURL", + "active", + "activeCues", + "activeElement", + "activeSourceBuffers", + "activeSourceCount", + "activeTexture", + "add", + "addBehavior", + "addCandidate", + "addColorStop", + "addCue", + "addElement", + "addEventListener", + "addFilter", + "addFromString", + "addFromUri", + "addIceCandidate", + "addImport", + "addListener", + "addNamed", + "addPageRule", + "addPath", + "addPointer", + "addRange", + "addRegion", + "addRule", + "addSearchEngine", + "addSourceBuffer", + "addStream", + "addTextTrack", + "addTrack", + "addWakeLockListener", + "addedNodes", + "additionalName", + "additiveSymbols", + "addons", + "adoptNode", + "adr", + "advance", + "alert", + "algorithm", + "align", + "align-content", + "align-items", + "align-self", + "alignContent", + "alignItems", + "alignSelf", + "alignmentBaseline", + "alinkColor", + "all", + "allowFullscreen", + "allowedDirections", + "alpha", + "alt", + "altGraphKey", + "altHtml", + "altKey", + "altLeft", + "altitude", + "altitudeAccuracy", + "amplitude", + "ancestorOrigins", + "anchor", + "anchorNode", + "anchorOffset", + "anchors", + "angle", + "animVal", + "animate", + "animatedInstanceRoot", + "animatedNormalizedPathSegList", + "animatedPathSegList", + "animatedPoints", + "animation", + "animation-delay", + "animation-direction", + "animation-duration", + "animation-fill-mode", + "animation-iteration-count", + "animation-name", + "animation-play-state", + "animation-timing-function", + "animationDelay", + "animationDirection", + "animationDuration", + "animationFillMode", + "animationIterationCount", + "animationName", + "animationPlayState", + "animationStartTime", + "animationTimingFunction", + "animationsPaused", + "anniversary", + "app", + "appCodeName", + "appMinorVersion", + "appName", + "appNotifications", + "appVersion", + "append", + "appendBuffer", + "appendChild", + "appendData", + "appendItem", + "appendMedium", + "appendNamed", + "appendRule", + "appendStream", + "appendWindowEnd", + "appendWindowStart", + "applets", + "applicationCache", + "apply", + "applyElement", + "arc", + "arcTo", + "archive", + "areas", + "arguments", + "arrayBuffer", + "asin", + "asinh", + "assert", + "assign", + "async", + "atEnd", + "atan", + "atan2", + "atanh", + "atob", + "attachEvent", + "attachShader", + "attachments", + "attack", + "attrChange", + "attrName", + "attributeName", + "attributeNamespace", + "attributes", + "audioTracks", + "autoIncrement", + "autobuffer", + "autocapitalize", + "autocomplete", + "autocorrect", + "autofocus", + "autoplay", + "availHeight", + "availLeft", + "availTop", + "availWidth", + "availability", + "available", + "aversion", + "axes", + "axis", + "azimuth", + "b", + "back", + "backface-visibility", + "backfaceVisibility", + "background", + "background-attachment", + "background-blend-mode", + "background-clip", + "background-color", + "background-image", + "background-origin", + "background-position", + "background-repeat", + "background-size", + "backgroundAttachment", + "backgroundBlendMode", + "backgroundClip", + "backgroundColor", + "backgroundImage", + "backgroundOrigin", + "backgroundPosition", + "backgroundPositionX", + "backgroundPositionY", + "backgroundRepeat", + "backgroundSize", + "badInput", + "balance", + "baseFrequencyX", + "baseFrequencyY", + "baseNode", + "baseOffset", + "baseURI", + "baseVal", + "baselineShift", + "battery", + "bday", + "beginElement", + "beginElementAt", + "beginPath", + "behavior", + "behaviorCookie", + "behaviorPart", + "behaviorUrns", + "beta", + "bezierCurveTo", + "bgColor", + "bgProperties", + "bias", + "big", + "binaryType", + "bind", + "bindAttribLocation", + "bindBuffer", + "bindFramebuffer", + "bindRenderbuffer", + "bindTexture", + "blendColor", + "blendEquation", + "blendEquationSeparate", + "blendFunc", + "blendFuncSeparate", + "blink", + "blob", + "blockDirection", + "blue", + "blur", + "body", + "bodyUsed", + "bold", + "bookmarks", + "booleanValue", + "border", + "border-bottom", + "border-bottom-color", + "border-bottom-left-radius", + "border-bottom-right-radius", + "border-bottom-style", + "border-bottom-width", + "border-collapse", + "border-color", + "border-image", + "border-image-outset", + "border-image-repeat", + "border-image-slice", + "border-image-source", + "border-image-width", + "border-left", + "border-left-color", + "border-left-style", + "border-left-width", + "border-radius", + "border-right", + "border-right-color", + "border-right-style", + "border-right-width", + "border-spacing", + "border-style", + "border-top", + "border-top-color", + "border-top-left-radius", + "border-top-right-radius", + "border-top-style", + "border-top-width", + "border-width", + "borderBottom", + "borderBottomColor", + "borderBottomLeftRadius", + "borderBottomRightRadius", + "borderBottomStyle", + "borderBottomWidth", + "borderCollapse", + "borderColor", + "borderColorDark", + "borderColorLight", + "borderImage", + "borderImageOutset", + "borderImageRepeat", + "borderImageSlice", + "borderImageSource", + "borderImageWidth", + "borderLeft", + "borderLeftColor", + "borderLeftStyle", + "borderLeftWidth", + "borderRadius", + "borderRight", + "borderRightColor", + "borderRightStyle", + "borderRightWidth", + "borderSpacing", + "borderStyle", + "borderTop", + "borderTopColor", + "borderTopLeftRadius", + "borderTopRightRadius", + "borderTopStyle", + "borderTopWidth", + "borderWidth", + "bottom", + "bottomMargin", + "bound", + "boundElements", + "boundingClientRect", + "boundingHeight", + "boundingLeft", + "boundingTop", + "boundingWidth", + "bounds", + "box-decoration-break", + "box-shadow", + "box-sizing", + "boxDecorationBreak", + "boxShadow", + "boxSizing", + "breakAfter", + "breakBefore", + "breakInside", + "browserLanguage", + "btoa", + "bubbles", + "buffer", + "bufferData", + "bufferDepth", + "bufferSize", + "bufferSubData", + "buffered", + "bufferedAmount", + "buildID", + "buildNumber", + "button", + "buttonID", + "buttons", + "byteLength", + "byteOffset", + "c", + "call", + "caller", + "canBeFormatted", + "canBeMounted", + "canBeShared", + "canHaveChildren", + "canHaveHTML", + "canPlayType", + "cancel", + "cancelAnimationFrame", + "cancelBubble", + "cancelScheduledValues", + "cancelable", + "candidate", + "canvas", + "caption", + "caption-side", + "captionSide", + "captureEvents", + "captureStackTrace", + "caretPositionFromPoint", + "caretRangeFromPoint", + "cast", + "catch", + "category", + "cbrt", + "cd", + "ceil", + "cellIndex", + "cellPadding", + "cellSpacing", + "cells", + "ch", + "chOff", + "chain", + "challenge", + "changedTouches", + "channel", + "channelCount", + "channelCountMode", + "channelInterpretation", + "char", + "charAt", + "charCode", + "charCodeAt", + "charIndex", + "characterSet", + "charging", + "chargingTime", + "charset", + "checkEnclosure", + "checkFramebufferStatus", + "checkIntersection", + "checkValidity", + "checked", + "childElementCount", + "childNodes", + "children", + "chrome", + "ciphertext", + "cite", + "classList", + "className", + "classid", + "clear", + "clearAttributes", + "clearColor", + "clearData", + "clearDepth", + "clearImmediate", + "clearInterval", + "clearMarks", + "clearMeasures", + "clearParameters", + "clearRect", + "clearResourceTimings", + "clearShadow", + "clearStencil", + "clearTimeout", + "clearWatch", + "click", + "clickCount", + "clientHeight", + "clientInformation", + "clientLeft", + "clientRect", + "clientRects", + "clientTop", + "clientWidth", + "clientX", + "clientY", + "clip", + "clip-path", + "clip-rule", + "clipBottom", + "clipLeft", + "clipPath", + "clipPathUnits", + "clipRight", + "clipRule", + "clipTop", + "clipboardData", + "clone", + "cloneContents", + "cloneNode", + "cloneRange", + "close", + "closePath", + "closed", + "closest", + "clz", + "clz32", + "cmp", + "code", + "codeBase", + "codePointAt", + "codeType", + "colSpan", + "collapse", + "collapseToEnd", + "collapseToStart", + "collapsed", + "collect", + "colno", + "color", + "color-interpolation", + "color-interpolation-filters", + "colorDepth", + "colorInterpolation", + "colorInterpolationFilters", + "colorMask", + "colorType", + "cols", + "columnCount", + "columnFill", + "columnGap", + "columnNumber", + "columnRule", + "columnRuleColor", + "columnRuleStyle", + "columnRuleWidth", + "columnSpan", + "columnWidth", + "columns", + "command", + "commitPreferences", + "commonAncestorContainer", + "compact", + "compareBoundaryPoints", + "compareDocumentPosition", + "compareEndPoints", + "compareNode", + "comparePoint", + "compatMode", + "compatible", + "compile", + "compileShader", + "complete", + "componentFromPoint", + "compositionEndOffset", + "compositionStartOffset", + "compressedTexImage2D", + "compressedTexSubImage2D", + "concat", + "conditionText", + "coneInnerAngle", + "coneOuterAngle", + "coneOuterGain", + "confirm", + "confirmComposition", + "confirmSiteSpecificTrackingException", + "confirmWebWideTrackingException", + "connect", + "connectEnd", + "connectStart", + "connected", + "connection", + "connectionSpeed", + "console", + "consolidate", + "constrictionActive", + "constructor", + "contactID", + "contains", + "containsNode", + "content", + "contentDocument", + "contentEditable", + "contentOverflow", + "contentScriptType", + "contentStyleType", + "contentType", + "contentWindow", + "context", + "contextMenu", + "contextmenu", + "continue", + "continuous", + "control", + "controller", + "controls", + "convertToSpecifiedUnits", + "cookie", + "cookieEnabled", + "coords", + "copyFromChannel", + "copyTexImage2D", + "copyTexSubImage2D", + "copyToChannel", + "copyWithin", + "correspondingElement", + "correspondingUseElement", + "cos", + "cosh", + "count", + "counter-increment", + "counter-reset", + "counterIncrement", + "counterReset", + "cpuClass", + "cpuSleepAllowed", + "create", + "createAnalyser", + "createAnswer", + "createAttribute", + "createAttributeNS", + "createBiquadFilter", + "createBuffer", + "createBufferSource", + "createCDATASection", + "createCSSStyleSheet", + "createCaption", + "createChannelMerger", + "createChannelSplitter", + "createComment", + "createContextualFragment", + "createControlRange", + "createConvolver", + "createDTMFSender", + "createDataChannel", + "createDelay", + "createDelayNode", + "createDocument", + "createDocumentFragment", + "createDocumentType", + "createDynamicsCompressor", + "createElement", + "createElementNS", + "createEntityReference", + "createEvent", + "createEventObject", + "createExpression", + "createFramebuffer", + "createFunction", + "createGain", + "createGainNode", + "createHTMLDocument", + "createImageBitmap", + "createImageData", + "createIndex", + "createJavaScriptNode", + "createLinearGradient", + "createMediaElementSource", + "createMediaKeys", + "createMediaStreamDestination", + "createMediaStreamSource", + "createMutableFile", + "createNSResolver", + "createNodeIterator", + "createNotification", + "createObjectStore", + "createObjectURL", + "createOffer", + "createOscillator", + "createPanner", + "createPattern", + "createPeriodicWave", + "createPopup", + "createProcessingInstruction", + "createProgram", + "createRadialGradient", + "createRange", + "createRangeCollection", + "createRenderbuffer", + "createSVGAngle", + "createSVGLength", + "createSVGMatrix", + "createSVGNumber", + "createSVGPathSegArcAbs", + "createSVGPathSegArcRel", + "createSVGPathSegClosePath", + "createSVGPathSegCurvetoCubicAbs", + "createSVGPathSegCurvetoCubicRel", + "createSVGPathSegCurvetoCubicSmoothAbs", + "createSVGPathSegCurvetoCubicSmoothRel", + "createSVGPathSegCurvetoQuadraticAbs", + "createSVGPathSegCurvetoQuadraticRel", + "createSVGPathSegCurvetoQuadraticSmoothAbs", + "createSVGPathSegCurvetoQuadraticSmoothRel", + "createSVGPathSegLinetoAbs", + "createSVGPathSegLinetoHorizontalAbs", + "createSVGPathSegLinetoHorizontalRel", + "createSVGPathSegLinetoRel", + "createSVGPathSegLinetoVerticalAbs", + "createSVGPathSegLinetoVerticalRel", + "createSVGPathSegMovetoAbs", + "createSVGPathSegMovetoRel", + "createSVGPoint", + "createSVGRect", + "createSVGTransform", + "createSVGTransformFromMatrix", + "createScriptProcessor", + "createSession", + "createShader", + "createShadowRoot", + "createStereoPanner", + "createStyleSheet", + "createTBody", + "createTFoot", + "createTHead", + "createTextNode", + "createTextRange", + "createTexture", + "createTouch", + "createTouchList", + "createTreeWalker", + "createWaveShaper", + "creationTime", + "crossOrigin", + "crypto", + "csi", + "cssFloat", + "cssRules", + "cssText", + "cssValueType", + "ctrlKey", + "ctrlLeft", + "cues", + "cullFace", + "currentNode", + "currentPage", + "currentScale", + "currentScript", + "currentSrc", + "currentState", + "currentStyle", + "currentTarget", + "currentTime", + "currentTranslate", + "currentView", + "cursor", + "curve", + "customError", + "cx", + "cy", + "d", + "data", + "dataFld", + "dataFormatAs", + "dataPageSize", + "dataSrc", + "dataTransfer", + "database", + "dataset", + "dateTime", + "db", + "debug", + "debuggerEnabled", + "declare", + "decode", + "decodeAudioData", + "decodeURI", + "decodeURIComponent", + "decrypt", + "default", + "defaultCharset", + "defaultChecked", + "defaultMuted", + "defaultPlaybackRate", + "defaultPrevented", + "defaultSelected", + "defaultStatus", + "defaultURL", + "defaultValue", + "defaultView", + "defaultstatus", + "defer", + "defineMagicFunction", + "defineMagicVariable", + "defineProperties", + "defineProperty", + "delayTime", + "delete", + "deleteBuffer", + "deleteCaption", + "deleteCell", + "deleteContents", + "deleteData", + "deleteDatabase", + "deleteFramebuffer", + "deleteFromDocument", + "deleteIndex", + "deleteMedium", + "deleteObjectStore", + "deleteProgram", + "deleteRenderbuffer", + "deleteRow", + "deleteRule", + "deleteShader", + "deleteTFoot", + "deleteTHead", + "deleteTexture", + "deliverChangeRecords", + "delivery", + "deliveryInfo", + "deliveryStatus", + "deliveryTimestamp", + "delta", + "deltaMode", + "deltaX", + "deltaY", + "deltaZ", + "depthFunc", + "depthMask", + "depthRange", + "deriveBits", + "deriveKey", + "description", + "deselectAll", + "designMode", + "destination", + "destinationURL", + "detach", + "detachEvent", + "detachShader", + "detail", + "detune", + "devicePixelRatio", + "deviceXDPI", + "deviceYDPI", + "diffuseConstant", + "digest", + "dimensions", + "dir", + "dirName", + "direction", + "dirxml", + "disable", + "disableVertexAttribArray", + "disabled", + "dischargingTime", + "disconnect", + "dispatchEvent", + "display", + "distanceModel", + "divisor", + "djsapi", + "djsproxy", + "doImport", + "doNotTrack", + "doScroll", + "doctype", + "document", + "documentElement", + "documentMode", + "documentURI", + "dolphin", + "dolphinGameCenter", + "dolphininfo", + "dolphinmeta", + "domComplete", + "domContentLoadedEventEnd", + "domContentLoadedEventStart", + "domInteractive", + "domLoading", + "domain", + "domainLookupEnd", + "domainLookupStart", + "dominant-baseline", + "dominantBaseline", + "done", + "dopplerFactor", + "download", + "dragDrop", + "draggable", + "drawArrays", + "drawArraysInstancedANGLE", + "drawCustomFocusRing", + "drawElements", + "drawElementsInstancedANGLE", + "drawFocusIfNeeded", + "drawImage", + "drawImageFromRect", + "drawSystemFocusRing", + "drawingBufferHeight", + "drawingBufferWidth", + "dropEffect", + "droppedVideoFrames", + "dropzone", + "dump", + "duplicate", + "duration", + "dvname", + "dvnum", + "dx", + "dy", + "dynsrc", + "e", + "edgeMode", + "effectAllowed", + "elapsedTime", + "elementFromPoint", + "elements", + "elevation", + "ellipse", + "email", + "embeds", + "empty", + "empty-cells", + "emptyCells", + "enable", + "enableBackground", + "enableStyleSheetsForSet", + "enableVertexAttribArray", + "enabled", + "enabledPlugin", + "encode", + "encodeURI", + "encodeURIComponent", + "encoding", + "encrypt", + "enctype", + "end", + "endContainer", + "endElement", + "endElementAt", + "endOfStream", + "endOffset", + "endTime", + "ended", + "endsWith", + "entities", + "entries", + "entryType", + "enumerate", + "enumerateEditable", + "error", + "errorCode", + "escape", + "eval", + "evaluate", + "event", + "eventPhase", + "every", + "exception", + "exec", + "execCommand", + "execCommandShowHelp", + "execScript", + "exitFullscreen", + "exitPointerLock", + "exp", + "expand", + "expandEntityReferences", + "expando", + "expansion", + "expiryDate", + "explicitOriginalTarget", + "expm1", + "exponent", + "exponentialRampToValueAtTime", + "exportKey", + "extend", + "extensions", + "extentNode", + "extentOffset", + "external", + "externalResourcesRequired", + "extractContents", + "extractable", + "f", + "face", + "factoryReset", + "fallback", + "familyName", + "farthestViewportElement", + "fastSeek", + "fatal", + "fetch", + "fetchStart", + "fftSize", + "fgColor", + "fileCreatedDate", + "fileHandle", + "fileModifiedDate", + "fileName", + "fileSize", + "fileUpdatedDate", + "filename", + "files", + "fill", + "fill-opacity", + "fill-rule", + "fillOpacity", + "fillRect", + "fillRule", + "fillStyle", + "fillText", + "filter", + "filterResX", + "filterResY", + "filterUnits", + "filters", + "find", + "findIndex", + "findRule", + "findText", + "finish", + "fireEvent", + "firstChild", + "firstElementChild", + "firstPage", + "fixed", + "flex", + "flex-basis", + "flex-direction", + "flex-flow", + "flex-grow", + "flex-shrink", + "flex-wrap", + "flexBasis", + "flexDirection", + "flexFlow", + "flexGrow", + "flexShrink", + "flexWrap", + "flipX", + "flipY", + "float", + "flood-color", + "flood-opacity", + "floodColor", + "floodOpacity", + "floor", + "flush", + "focus", + "focusNode", + "focusOffset", + "font", + "font-family", + "font-feature-settings", + "font-kerning", + "font-language-override", + "font-size", + "font-size-adjust", + "font-stretch", + "font-style", + "font-synthesis", + "font-variant", + "font-variant-alternates", + "font-variant-caps", + "font-variant-east-asian", + "font-variant-ligatures", + "font-variant-numeric", + "font-variant-position", + "font-weight", + "fontFamily", + "fontFeatureSettings", + "fontKerning", + "fontLanguageOverride", + "fontSize", + "fontSizeAdjust", + "fontSmoothingEnabled", + "fontStretch", + "fontStyle", + "fontSynthesis", + "fontVariant", + "fontVariantAlternates", + "fontVariantCaps", + "fontVariantEastAsian", + "fontVariantLigatures", + "fontVariantNumeric", + "fontVariantPosition", + "fontWeight", + "fontcolor", + "fonts", + "fontsize", + "for", + "forEach", + "forceRedraw", + "form", + "formAction", + "formEnctype", + "formMethod", + "formNoValidate", + "formTarget", + "format", + "forms", + "forward", + "fr", + "frame", + "frameBorder", + "frameElement", + "frameSpacing", + "framebufferRenderbuffer", + "framebufferTexture2D", + "frames", + "freeSpace", + "freeze", + "frequency", + "frequencyBinCount", + "from", + "fromCharCode", + "fromCodePoint", + "fromElement", + "frontFace", + "fround", + "fullScreen", + "fullscreenElement", + "fullscreenEnabled", + "fx", + "fy", + "gain", + "gamepad", + "gamma", + "genderIdentity", + "generateKey", + "generateMipmap", + "generateRequest", + "geolocation", + "gestureObject", + "get", + "getActiveAttrib", + "getActiveUniform", + "getAdjacentText", + "getAll", + "getAllResponseHeaders", + "getAsFile", + "getAsString", + "getAttachedShaders", + "getAttribLocation", + "getAttribute", + "getAttributeNS", + "getAttributeNode", + "getAttributeNodeNS", + "getAudioTracks", + "getBBox", + "getBattery", + "getBlob", + "getBookmark", + "getBoundingClientRect", + "getBufferParameter", + "getByteFrequencyData", + "getByteTimeDomainData", + "getCSSCanvasContext", + "getCTM", + "getCandidateWindowClientRect", + "getChannelData", + "getCharNumAtPosition", + "getClientRect", + "getClientRects", + "getCompositionAlternatives", + "getComputedStyle", + "getComputedTextLength", + "getConfiguration", + "getContext", + "getContextAttributes", + "getCounterValue", + "getCueAsHTML", + "getCueById", + "getCurrentPosition", + "getCurrentTime", + "getData", + "getDatabaseNames", + "getDate", + "getDay", + "getDefaultComputedStyle", + "getDestinationInsertionPoints", + "getDistributedNodes", + "getEditable", + "getElementById", + "getElementsByClassName", + "getElementsByName", + "getElementsByTagName", + "getElementsByTagNameNS", + "getEnclosureList", + "getEndPositionOfChar", + "getEntries", + "getEntriesByName", + "getEntriesByType", + "getError", + "getExtension", + "getExtentOfChar", + "getFeature", + "getFile", + "getFloat32", + "getFloat64", + "getFloatFrequencyData", + "getFloatTimeDomainData", + "getFloatValue", + "getFramebufferAttachmentParameter", + "getFrequencyResponse", + "getFullYear", + "getGamepads", + "getHours", + "getImageData", + "getInt16", + "getInt32", + "getInt8", + "getIntersectionList", + "getItem", + "getItems", + "getKey", + "getLineDash", + "getLocalStreams", + "getMarks", + "getMatchedCSSRules", + "getMeasures", + "getMetadata", + "getMilliseconds", + "getMinutes", + "getModifierState", + "getMonth", + "getNamedItem", + "getNamedItemNS", + "getNotifier", + "getNumberOfChars", + "getOverrideHistoryNavigationMode", + "getOverrideStyle", + "getOwnPropertyDescriptor", + "getOwnPropertyNames", + "getOwnPropertySymbols", + "getParameter", + "getPathSegAtLength", + "getPointAtLength", + "getPreference", + "getPreferenceDefault", + "getPresentationAttribute", + "getPreventDefault", + "getProgramInfoLog", + "getProgramParameter", + "getPropertyCSSValue", + "getPropertyPriority", + "getPropertyShorthand", + "getPropertyValue", + "getPrototypeOf", + "getRGBColorValue", + "getRandomValues", + "getRangeAt", + "getReceivers", + "getRectValue", + "getRegistration", + "getRemoteStreams", + "getRenderbufferParameter", + "getResponseHeader", + "getRoot", + "getRotationOfChar", + "getSVGDocument", + "getScreenCTM", + "getSeconds", + "getSelection", + "getSenders", + "getShaderInfoLog", + "getShaderParameter", + "getShaderPrecisionFormat", + "getShaderSource", + "getSimpleDuration", + "getSiteIcons", + "getSources", + "getSpeculativeParserUrls", + "getStartPositionOfChar", + "getStartTime", + "getStats", + "getStorageUpdates", + "getStreamById", + "getStringValue", + "getSubStringLength", + "getSubscription", + "getSupportedExtensions", + "getTexParameter", + "getTime", + "getTimezoneOffset", + "getTotalLength", + "getTrackById", + "getTracks", + "getTransformToElement", + "getUTCDate", + "getUTCDay", + "getUTCFullYear", + "getUTCHours", + "getUTCMilliseconds", + "getUTCMinutes", + "getUTCMonth", + "getUTCSeconds", + "getUint16", + "getUint32", + "getUint8", + "getUniform", + "getUniformLocation", + "getUserMedia", + "getValues", + "getVarDate", + "getVariableValue", + "getVertexAttrib", + "getVertexAttribOffset", + "getVideoPlaybackQuality", + "getVideoTracks", + "getWakeLockState", + "getYear", + "givenName", + "global", + "globalAlpha", + "globalCompositeOperation", + "glyphOrientationHorizontal", + "glyphOrientationVertical", + "glyphRef", + "go", + "gradientTransform", + "gradientUnits", + "grammars", + "green", + "group", + "groupCollapsed", + "groupEnd", + "hardwareConcurrency", + "has", + "hasAttribute", + "hasAttributeNS", + "hasAttributes", + "hasChildNodes", + "hasComposition", + "hasExtension", + "hasFeature", + "hasFocus", + "hasLayout", + "hasOwnProperty", + "hash", + "head", + "headers", + "heading", + "height", + "hidden", + "hide", + "hideFocus", + "high", + "hint", + "history", + "honorificPrefix", + "honorificSuffix", + "horizontalOverflow", + "host", + "hostname", + "href", + "hreflang", + "hspace", + "html5TagCheckInerface", + "htmlFor", + "htmlText", + "httpEquiv", + "hwTimestamp", + "hypot", + "iccId", + "iceConnectionState", + "iceGatheringState", + "icon", + "id", + "identifier", + "identity", + "ignoreBOM", + "ignoreCase", + "image-orientation", + "image-rendering", + "imageOrientation", + "imageRendering", + "images", + "ime-mode", + "imeMode", + "implementation", + "importKey", + "importNode", + "importStylesheet", + "imports", + "impp", + "imul", + "in1", + "in2", + "inBandMetadataTrackDispatchType", + "inRange", + "includes", + "incremental", + "indeterminate", + "index", + "indexNames", + "indexOf", + "indexedDB", + "inertiaDestinationX", + "inertiaDestinationY", + "info", + "init", + "initAnimationEvent", + "initBeforeLoadEvent", + "initClipboardEvent", + "initCloseEvent", + "initCommandEvent", + "initCompositionEvent", + "initCustomEvent", + "initData", + "initDeviceMotionEvent", + "initDeviceOrientationEvent", + "initDragEvent", + "initErrorEvent", + "initEvent", + "initFocusEvent", + "initGestureEvent", + "initHashChangeEvent", + "initKeyEvent", + "initKeyboardEvent", + "initMSManipulationEvent", + "initMessageEvent", + "initMouseEvent", + "initMouseScrollEvent", + "initMouseWheelEvent", + "initMutationEvent", + "initNSMouseEvent", + "initOverflowEvent", + "initPageEvent", + "initPageTransitionEvent", + "initPointerEvent", + "initPopStateEvent", + "initProgressEvent", + "initScrollAreaEvent", + "initSimpleGestureEvent", + "initStorageEvent", + "initTextEvent", + "initTimeEvent", + "initTouchEvent", + "initTransitionEvent", + "initUIEvent", + "initWebKitAnimationEvent", + "initWebKitTransitionEvent", + "initWebKitWheelEvent", + "initWheelEvent", + "initialTime", + "initialize", + "initiatorType", + "inner", + "innerHTML", + "innerHeight", + "innerText", + "innerWidth", + "input", + "inputBuffer", + "inputEncoding", + "inputMethod", + "insertAdjacentElement", + "insertAdjacentHTML", + "insertAdjacentText", + "insertBefore", + "insertCell", + "insertData", + "insertItemBefore", + "insertNode", + "insertRow", + "insertRule", + "instanceRoot", + "intercept", + "interimResults", + "internalSubset", + "intersectsNode", + "interval", + "invalidIteratorState", + "inverse", + "invertSelf", + "is", + "is2D", + "isAlternate", + "isArray", + "isBingCurrentSearchDefault", + "isBuffer", + "isCandidateWindowVisible", + "isChar", + "isCollapsed", + "isComposing", + "isContentEditable", + "isContentHandlerRegistered", + "isContextLost", + "isDefaultNamespace", + "isDisabled", + "isEnabled", + "isEqual", + "isEqualNode", + "isExtensible", + "isFinite", + "isFramebuffer", + "isFrozen", + "isGenerator", + "isId", + "isInjected", + "isInteger", + "isMap", + "isMultiLine", + "isNaN", + "isOpen", + "isPointInFill", + "isPointInPath", + "isPointInRange", + "isPointInStroke", + "isPrefAlternate", + "isPrimary", + "isProgram", + "isPropertyImplicit", + "isProtocolHandlerRegistered", + "isPrototypeOf", + "isRenderbuffer", + "isSafeInteger", + "isSameNode", + "isSealed", + "isShader", + "isSupported", + "isTextEdit", + "isTexture", + "isTrusted", + "isTypeSupported", + "isView", + "isolation", + "italics", + "item", + "itemId", + "itemProp", + "itemRef", + "itemScope", + "itemType", + "itemValue", + "iterateNext", + "iterator", + "javaEnabled", + "jobTitle", + "join", + "json", + "justify-content", + "justifyContent", + "k1", + "k2", + "k3", + "k4", + "kernelMatrix", + "kernelUnitLengthX", + "kernelUnitLengthY", + "kerning", + "key", + "keyCode", + "keyFor", + "keyIdentifier", + "keyLightEnabled", + "keyLocation", + "keyPath", + "keySystem", + "keyText", + "keyUsage", + "keys", + "keytype", + "kind", + "knee", + "label", + "labels", + "lang", + "language", + "languages", + "largeArcFlag", + "lastChild", + "lastElementChild", + "lastEventId", + "lastIndex", + "lastIndexOf", + "lastMatch", + "lastMessageSubject", + "lastMessageType", + "lastModified", + "lastModifiedDate", + "lastPage", + "lastParen", + "lastState", + "lastStyleSheetSet", + "latitude", + "layerX", + "layerY", + "layoutFlow", + "layoutGrid", + "layoutGridChar", + "layoutGridLine", + "layoutGridMode", + "layoutGridType", + "lbound", + "left", + "leftContext", + "leftMargin", + "length", + "lengthAdjust", + "lengthComputable", + "letter-spacing", + "letterSpacing", + "level", + "lighting-color", + "lightingColor", + "limitingConeAngle", + "line", + "line-height", + "lineAlign", + "lineBreak", + "lineCap", + "lineDashOffset", + "lineHeight", + "lineJoin", + "lineNumber", + "lineTo", + "lineWidth", + "linearRampToValueAtTime", + "lineno", + "link", + "linkColor", + "linkProgram", + "links", + "list", + "list-style", + "list-style-image", + "list-style-position", + "list-style-type", + "listStyle", + "listStyleImage", + "listStylePosition", + "listStyleType", + "listener", + "load", + "loadEventEnd", + "loadEventStart", + "loadTimes", + "loaded", + "localDescription", + "localName", + "localStorage", + "locale", + "localeCompare", + "location", + "locationbar", + "lock", + "lockedFile", + "log", + "log10", + "log1p", + "log2", + "logicalXDPI", + "logicalYDPI", + "longDesc", + "longitude", + "lookupNamespaceURI", + "lookupPrefix", + "loop", + "loopEnd", + "loopStart", + "looping", + "low", + "lower", + "lowerBound", + "lowerOpen", + "lowsrc", + "m11", + "m12", + "m13", + "m14", + "m21", + "m22", + "m23", + "m24", + "m31", + "m32", + "m33", + "m34", + "m41", + "m42", + "m43", + "m44", + "manifest", + "map", + "mapping", + "margin", + "margin-bottom", + "margin-left", + "margin-right", + "margin-top", + "marginBottom", + "marginHeight", + "marginLeft", + "marginRight", + "marginTop", + "marginWidth", + "mark", + "marker", + "marker-end", + "marker-mid", + "marker-offset", + "marker-start", + "markerEnd", + "markerHeight", + "markerMid", + "markerOffset", + "markerStart", + "markerUnits", + "markerWidth", + "marks", + "mask", + "mask-type", + "maskContentUnits", + "maskType", + "maskUnits", + "match", + "matchMedia", + "matchMedium", + "matches", + "matrix", + "matrixTransform", + "max", + "max-height", + "max-width", + "maxAlternatives", + "maxChannelCount", + "maxConnectionsPerServer", + "maxDecibels", + "maxDistance", + "maxHeight", + "maxLength", + "maxTouchPoints", + "maxValue", + "maxWidth", + "measure", + "measureText", + "media", + "mediaDevices", + "mediaElement", + "mediaGroup", + "mediaKeys", + "mediaText", + "meetOrSlice", + "memory", + "menubar", + "mergeAttributes", + "message", + "messageClass", + "messageHandlers", + "metaKey", + "method", + "mimeType", + "mimeTypes", + "min", + "min-height", + "min-width", + "minDecibels", + "minHeight", + "minValue", + "minWidth", + "miterLimit", + "mix-blend-mode", + "mixBlendMode", + "mode", + "modify", + "mount", + "move", + "moveBy", + "moveEnd", + "moveFirst", + "moveFocusDown", + "moveFocusLeft", + "moveFocusRight", + "moveFocusUp", + "moveNext", + "moveRow", + "moveStart", + "moveTo", + "moveToBookmark", + "moveToElementText", + "moveToPoint", + "mozAdd", + "mozAnimationStartTime", + "mozAnon", + "mozApps", + "mozAudioCaptured", + "mozAudioChannelType", + "mozAutoplayEnabled", + "mozCancelAnimationFrame", + "mozCancelFullScreen", + "mozCancelRequestAnimationFrame", + "mozCaptureStream", + "mozCaptureStreamUntilEnded", + "mozClearDataAt", + "mozContact", + "mozContacts", + "mozCreateFileHandle", + "mozCurrentTransform", + "mozCurrentTransformInverse", + "mozCursor", + "mozDash", + "mozDashOffset", + "mozDecodedFrames", + "mozExitPointerLock", + "mozFillRule", + "mozFragmentEnd", + "mozFrameDelay", + "mozFullScreen", + "mozFullScreenElement", + "mozFullScreenEnabled", + "mozGetAll", + "mozGetAllKeys", + "mozGetAsFile", + "mozGetDataAt", + "mozGetMetadata", + "mozGetUserMedia", + "mozHasAudio", + "mozHasItem", + "mozHidden", + "mozImageSmoothingEnabled", + "mozIndexedDB", + "mozInnerScreenX", + "mozInnerScreenY", + "mozInputSource", + "mozIsTextField", + "mozItem", + "mozItemCount", + "mozItems", + "mozLength", + "mozLockOrientation", + "mozMatchesSelector", + "mozMovementX", + "mozMovementY", + "mozOpaque", + "mozOrientation", + "mozPaintCount", + "mozPaintedFrames", + "mozParsedFrames", + "mozPay", + "mozPointerLockElement", + "mozPresentedFrames", + "mozPreservesPitch", + "mozPressure", + "mozPrintCallback", + "mozRTCIceCandidate", + "mozRTCPeerConnection", + "mozRTCSessionDescription", + "mozRemove", + "mozRequestAnimationFrame", + "mozRequestFullScreen", + "mozRequestPointerLock", + "mozSetDataAt", + "mozSetImageElement", + "mozSourceNode", + "mozSrcObject", + "mozSystem", + "mozTCPSocket", + "mozTextStyle", + "mozTypesAt", + "mozUnlockOrientation", + "mozUserCancelled", + "mozVisibilityState", + "msAnimation", + "msAnimationDelay", + "msAnimationDirection", + "msAnimationDuration", + "msAnimationFillMode", + "msAnimationIterationCount", + "msAnimationName", + "msAnimationPlayState", + "msAnimationStartTime", + "msAnimationTimingFunction", + "msBackfaceVisibility", + "msBlockProgression", + "msCSSOMElementFloatMetrics", + "msCaching", + "msCachingEnabled", + "msCancelRequestAnimationFrame", + "msCapsLockWarningOff", + "msClearImmediate", + "msClose", + "msContentZoomChaining", + "msContentZoomFactor", + "msContentZoomLimit", + "msContentZoomLimitMax", + "msContentZoomLimitMin", + "msContentZoomSnap", + "msContentZoomSnapPoints", + "msContentZoomSnapType", + "msContentZooming", + "msConvertURL", + "msCrypto", + "msDoNotTrack", + "msElementsFromPoint", + "msElementsFromRect", + "msExitFullscreen", + "msExtendedCode", + "msFillRule", + "msFirstPaint", + "msFlex", + "msFlexAlign", + "msFlexDirection", + "msFlexFlow", + "msFlexItemAlign", + "msFlexLinePack", + "msFlexNegative", + "msFlexOrder", + "msFlexPack", + "msFlexPositive", + "msFlexPreferredSize", + "msFlexWrap", + "msFlowFrom", + "msFlowInto", + "msFontFeatureSettings", + "msFullscreenElement", + "msFullscreenEnabled", + "msGetInputContext", + "msGetRegionContent", + "msGetUntransformedBounds", + "msGraphicsTrustStatus", + "msGridColumn", + "msGridColumnAlign", + "msGridColumnSpan", + "msGridColumns", + "msGridRow", + "msGridRowAlign", + "msGridRowSpan", + "msGridRows", + "msHidden", + "msHighContrastAdjust", + "msHyphenateLimitChars", + "msHyphenateLimitLines", + "msHyphenateLimitZone", + "msHyphens", + "msImageSmoothingEnabled", + "msImeAlign", + "msIndexedDB", + "msInterpolationMode", + "msIsStaticHTML", + "msKeySystem", + "msKeys", + "msLaunchUri", + "msLockOrientation", + "msManipulationViewsEnabled", + "msMatchMedia", + "msMatchesSelector", + "msMaxTouchPoints", + "msOrientation", + "msOverflowStyle", + "msPerspective", + "msPerspectiveOrigin", + "msPlayToDisabled", + "msPlayToPreferredSourceUri", + "msPlayToPrimary", + "msPointerEnabled", + "msRegionOverflow", + "msReleasePointerCapture", + "msRequestAnimationFrame", + "msRequestFullscreen", + "msSaveBlob", + "msSaveOrOpenBlob", + "msScrollChaining", + "msScrollLimit", + "msScrollLimitXMax", + "msScrollLimitXMin", + "msScrollLimitYMax", + "msScrollLimitYMin", + "msScrollRails", + "msScrollSnapPointsX", + "msScrollSnapPointsY", + "msScrollSnapType", + "msScrollSnapX", + "msScrollSnapY", + "msScrollTranslation", + "msSetImmediate", + "msSetMediaKeys", + "msSetPointerCapture", + "msTextCombineHorizontal", + "msTextSizeAdjust", + "msToBlob", + "msTouchAction", + "msTouchSelect", + "msTraceAsyncCallbackCompleted", + "msTraceAsyncCallbackStarting", + "msTraceAsyncOperationCompleted", + "msTraceAsyncOperationStarting", + "msTransform", + "msTransformOrigin", + "msTransformStyle", + "msTransition", + "msTransitionDelay", + "msTransitionDuration", + "msTransitionProperty", + "msTransitionTimingFunction", + "msUnlockOrientation", + "msUpdateAsyncCallbackRelation", + "msUserSelect", + "msVisibilityState", + "msWrapFlow", + "msWrapMargin", + "msWrapThrough", + "msWriteProfilerMark", + "msZoom", + "msZoomTo", + "mt", + "multiEntry", + "multiSelectionObj", + "multiline", + "multiple", + "multiply", + "multiplySelf", + "mutableFile", + "muted", + "n", + "name", + "nameProp", + "namedItem", + "namedRecordset", + "names", + "namespaceURI", + "namespaces", + "naturalHeight", + "naturalWidth", + "navigate", + "navigation", + "navigationMode", + "navigationStart", + "navigator", + "near", + "nearestViewportElement", + "negative", + "netscape", + "networkState", + "newScale", + "newTranslate", + "newURL", + "newValue", + "newValueSpecifiedUnits", + "newVersion", + "newhome", + "next", + "nextElementSibling", + "nextNode", + "nextPage", + "nextSibling", + "nickname", + "noHref", + "noResize", + "noShade", + "noValidate", + "noWrap", + "nodeName", + "nodeType", + "nodeValue", + "normalize", + "normalizedPathSegList", + "notationName", + "notations", + "note", + "noteGrainOn", + "noteOff", + "noteOn", + "now", + "numOctaves", + "number", + "numberOfChannels", + "numberOfInputs", + "numberOfItems", + "numberOfOutputs", + "numberValue", + "oMatchesSelector", + "object", + "object-fit", + "object-position", + "objectFit", + "objectPosition", + "objectStore", + "objectStoreNames", + "observe", + "of", + "offscreenBuffering", + "offset", + "offsetHeight", + "offsetLeft", + "offsetNode", + "offsetParent", + "offsetTop", + "offsetWidth", + "offsetX", + "offsetY", + "ok", + "oldURL", + "oldValue", + "oldVersion", + "olderShadowRoot", + "onLine", + "onabort", + "onactivate", + "onactive", + "onaddstream", + "onaddtrack", + "onafterprint", + "onafterscriptexecute", + "onafterupdate", + "onaudioend", + "onaudioprocess", + "onaudiostart", + "onautocomplete", + "onautocompleteerror", + "onbeforeactivate", + "onbeforecopy", + "onbeforecut", + "onbeforedeactivate", + "onbeforeeditfocus", + "onbeforepaste", + "onbeforeprint", + "onbeforescriptexecute", + "onbeforeunload", + "onbeforeupdate", + "onblocked", + "onblur", + "onbounce", + "onboundary", + "oncached", + "oncancel", + "oncandidatewindowhide", + "oncandidatewindowshow", + "oncandidatewindowupdate", + "oncanplay", + "oncanplaythrough", + "oncellchange", + "onchange", + "onchargingchange", + "onchargingtimechange", + "onchecking", + "onclick", + "onclose", + "oncompassneedscalibration", + "oncomplete", + "oncontextmenu", + "oncontrolselect", + "oncopy", + "oncuechange", + "oncut", + "ondataavailable", + "ondatachannel", + "ondatasetchanged", + "ondatasetcomplete", + "ondblclick", + "ondeactivate", + "ondevicelight", + "ondevicemotion", + "ondeviceorientation", + "ondeviceproximity", + "ondischargingtimechange", + "ondisplay", + "ondownloading", + "ondrag", + "ondragend", + "ondragenter", + "ondragleave", + "ondragover", + "ondragstart", + "ondrop", + "ondurationchange", + "onemptied", + "onencrypted", + "onend", + "onended", + "onenter", + "onerror", + "onerrorupdate", + "onexit", + "onfilterchange", + "onfinish", + "onfocus", + "onfocusin", + "onfocusout", + "onfullscreenchange", + "onfullscreenerror", + "ongesturechange", + "ongestureend", + "ongesturestart", + "ongotpointercapture", + "onhashchange", + "onhelp", + "onicecandidate", + "oniceconnectionstatechange", + "oninactive", + "oninput", + "oninvalid", + "onkeydown", + "onkeypress", + "onkeyup", + "onlanguagechange", + "onlayoutcomplete", + "onlevelchange", + "onload", + "onloadeddata", + "onloadedmetadata", + "onloadend", + "onloadstart", + "onlosecapture", + "onlostpointercapture", + "only", + "onmark", + "onmessage", + "onmousedown", + "onmouseenter", + "onmouseleave", + "onmousemove", + "onmouseout", + "onmouseover", + "onmouseup", + "onmousewheel", + "onmove", + "onmoveend", + "onmovestart", + "onmozfullscreenchange", + "onmozfullscreenerror", + "onmozorientationchange", + "onmozpointerlockchange", + "onmozpointerlockerror", + "onmscontentzoom", + "onmsfullscreenchange", + "onmsfullscreenerror", + "onmsgesturechange", + "onmsgesturedoubletap", + "onmsgestureend", + "onmsgesturehold", + "onmsgesturestart", + "onmsgesturetap", + "onmsgotpointercapture", + "onmsinertiastart", + "onmslostpointercapture", + "onmsmanipulationstatechanged", + "onmsneedkey", + "onmsorientationchange", + "onmspointercancel", + "onmspointerdown", + "onmspointerenter", + "onmspointerhover", + "onmspointerleave", + "onmspointermove", + "onmspointerout", + "onmspointerover", + "onmspointerup", + "onmssitemodejumplistitemremoved", + "onmsthumbnailclick", + "onnegotiationneeded", + "onnomatch", + "onnoupdate", + "onobsolete", + "onoffline", + "ononline", + "onopen", + "onorientationchange", + "onpagechange", + "onpagehide", + "onpageshow", + "onpaste", + "onpause", + "onplay", + "onplaying", + "onpluginstreamstart", + "onpointercancel", + "onpointerdown", + "onpointerenter", + "onpointerleave", + "onpointerlockchange", + "onpointerlockerror", + "onpointermove", + "onpointerout", + "onpointerover", + "onpointerup", + "onpopstate", + "onprogress", + "onpropertychange", + "onratechange", + "onreadystatechange", + "onremovestream", + "onremovetrack", + "onreset", + "onresize", + "onresizeend", + "onresizestart", + "onresourcetimingbufferfull", + "onresult", + "onresume", + "onrowenter", + "onrowexit", + "onrowsdelete", + "onrowsinserted", + "onscroll", + "onsearch", + "onseeked", + "onseeking", + "onselect", + "onselectionchange", + "onselectstart", + "onshow", + "onsignalingstatechange", + "onsoundend", + "onsoundstart", + "onspeechend", + "onspeechstart", + "onstalled", + "onstart", + "onstatechange", + "onstop", + "onstorage", + "onstoragecommit", + "onsubmit", + "onsuccess", + "onsuspend", + "ontextinput", + "ontimeout", + "ontimeupdate", + "ontoggle", + "ontouchcancel", + "ontouchend", + "ontouchmove", + "ontouchstart", + "ontransitionend", + "onunload", + "onupdateready", + "onupgradeneeded", + "onuserproximity", + "onversionchange", + "onvoiceschanged", + "onvolumechange", + "onwaiting", + "onwarning", + "onwebkitanimationend", + "onwebkitanimationiteration", + "onwebkitanimationstart", + "onwebkitcurrentplaybacktargetiswirelesschanged", + "onwebkitfullscreenchange", + "onwebkitfullscreenerror", + "onwebkitkeyadded", + "onwebkitkeyerror", + "onwebkitkeymessage", + "onwebkitneedkey", + "onwebkitorientationchange", + "onwebkitplaybacktargetavailabilitychanged", + "onwebkitpointerlockchange", + "onwebkitpointerlockerror", + "onwebkitresourcetimingbufferfull", + "onwebkittransitionend", + "onwheel", + "onzoom", + "opacity", + "open", + "openCursor", + "openDatabase", + "openKeyCursor", + "opener", + "opera", + "operationType", + "operator", + "opr", + "optimum", + "options", + "order", + "orderX", + "orderY", + "ordered", + "org", + "orient", + "orientAngle", + "orientType", + "orientation", + "origin", + "originalTarget", + "orphans", + "oscpu", + "outerHTML", + "outerHeight", + "outerText", + "outerWidth", + "outline", + "outline-color", + "outline-offset", + "outline-style", + "outline-width", + "outlineColor", + "outlineOffset", + "outlineStyle", + "outlineWidth", + "outputBuffer", + "overflow", + "overflow-x", + "overflow-y", + "overflowX", + "overflowY", + "overrideMimeType", + "oversample", + "ownerDocument", + "ownerElement", + "ownerNode", + "ownerRule", + "ownerSVGElement", + "owningElement", + "p1", + "p2", + "p3", + "p4", + "pad", + "padding", + "padding-bottom", + "padding-left", + "padding-right", + "padding-top", + "paddingBottom", + "paddingLeft", + "paddingRight", + "paddingTop", + "page", + "page-break-after", + "page-break-before", + "page-break-inside", + "pageBreakAfter", + "pageBreakBefore", + "pageBreakInside", + "pageCount", + "pageX", + "pageXOffset", + "pageY", + "pageYOffset", + "pages", + "paint-order", + "paintOrder", + "paintRequests", + "paintType", + "palette", + "panningModel", + "parent", + "parentElement", + "parentNode", + "parentRule", + "parentStyleSheet", + "parentTextEdit", + "parentWindow", + "parse", + "parseFloat", + "parseFromString", + "parseInt", + "participants", + "password", + "pasteHTML", + "path", + "pathLength", + "pathSegList", + "pathSegType", + "pathSegTypeAsLetter", + "pathname", + "pattern", + "patternContentUnits", + "patternMismatch", + "patternTransform", + "patternUnits", + "pause", + "pauseAnimations", + "pauseOnExit", + "paused", + "pending", + "performance", + "permission", + "persisted", + "personalbar", + "perspective", + "perspective-origin", + "perspectiveOrigin", + "phoneticFamilyName", + "phoneticGivenName", + "photo", + "ping", + "pitch", + "pixelBottom", + "pixelDepth", + "pixelHeight", + "pixelLeft", + "pixelRight", + "pixelStorei", + "pixelTop", + "pixelUnitToMillimeterX", + "pixelUnitToMillimeterY", + "pixelWidth", + "placeholder", + "platform", + "play", + "playbackRate", + "playbackState", + "playbackTime", + "played", + "plugins", + "pluginspage", + "pname", + "pointer-events", + "pointerBeforeReferenceNode", + "pointerEnabled", + "pointerEvents", + "pointerId", + "pointerLockElement", + "pointerType", + "points", + "pointsAtX", + "pointsAtY", + "pointsAtZ", + "polygonOffset", + "pop", + "popupWindowFeatures", + "popupWindowName", + "popupWindowURI", + "port", + "port1", + "port2", + "ports", + "posBottom", + "posHeight", + "posLeft", + "posRight", + "posTop", + "posWidth", + "position", + "positionAlign", + "postError", + "postMessage", + "poster", + "pow", + "powerOff", + "preMultiplySelf", + "precision", + "preferredStyleSheetSet", + "preferredStylesheetSet", + "prefix", + "preload", + "preserveAlpha", + "preserveAspectRatio", + "preserveAspectRatioString", + "pressed", + "pressure", + "prevValue", + "preventDefault", + "preventExtensions", + "previousElementSibling", + "previousNode", + "previousPage", + "previousScale", + "previousSibling", + "previousTranslate", + "primaryKey", + "primitiveType", + "primitiveUnits", + "principals", + "print", + "privateKey", + "probablySupportsContext", + "process", + "processIceMessage", + "product", + "productSub", + "profile", + "profileEnd", + "profiles", + "prompt", + "properties", + "propertyIsEnumerable", + "propertyName", + "protocol", + "protocolLong", + "prototype", + "pseudoClass", + "pseudoElement", + "publicId", + "publicKey", + "published", + "push", + "pushNotification", + "pushState", + "put", + "putImageData", + "quadraticCurveTo", + "qualifier", + "queryCommandEnabled", + "queryCommandIndeterm", + "queryCommandState", + "queryCommandSupported", + "queryCommandText", + "queryCommandValue", + "querySelector", + "querySelectorAll", + "quote", + "quotes", + "r", + "r1", + "r2", + "race", + "radiogroup", + "radiusX", + "radiusY", + "random", + "range", + "rangeCount", + "rangeMax", + "rangeMin", + "rangeOffset", + "rangeOverflow", + "rangeParent", + "rangeUnderflow", + "rate", + "ratio", + "raw", + "read", + "readAsArrayBuffer", + "readAsBinaryString", + "readAsBlob", + "readAsDataURL", + "readAsText", + "readOnly", + "readPixels", + "readReportRequested", + "readyState", + "reason", + "reboot", + "receiver", + "receivers", + "recordNumber", + "recordset", + "rect", + "red", + "redirectCount", + "redirectEnd", + "redirectStart", + "reduce", + "reduceRight", + "reduction", + "refDistance", + "refX", + "refY", + "referenceNode", + "referrer", + "refresh", + "region", + "regionAnchorX", + "regionAnchorY", + "regionId", + "regions", + "register", + "registerContentHandler", + "registerElement", + "registerProtocolHandler", + "reject", + "rel", + "relList", + "relatedNode", + "relatedTarget", + "release", + "releaseCapture", + "releaseEvents", + "releasePointerCapture", + "releaseShaderCompiler", + "reliable", + "reload", + "remainingSpace", + "remoteDescription", + "remove", + "removeAllRanges", + "removeAttribute", + "removeAttributeNS", + "removeAttributeNode", + "removeBehavior", + "removeChild", + "removeCue", + "removeEventListener", + "removeFilter", + "removeImport", + "removeItem", + "removeListener", + "removeNamedItem", + "removeNamedItemNS", + "removeNode", + "removeParameter", + "removeProperty", + "removeRange", + "removeRegion", + "removeRule", + "removeSiteSpecificTrackingException", + "removeSourceBuffer", + "removeStream", + "removeTrack", + "removeVariable", + "removeWakeLockListener", + "removeWebWideTrackingException", + "removedNodes", + "renderbufferStorage", + "renderedBuffer", + "renderingMode", + "repeat", + "replace", + "replaceAdjacentText", + "replaceChild", + "replaceData", + "replaceId", + "replaceItem", + "replaceNode", + "replaceState", + "replaceTrack", + "replaceWholeText", + "reportValidity", + "requestAnimationFrame", + "requestAutocomplete", + "requestData", + "requestFullscreen", + "requestMediaKeySystemAccess", + "requestPermission", + "requestPointerLock", + "requestStart", + "requestingWindow", + "required", + "requiredExtensions", + "requiredFeatures", + "reset", + "resetTransform", + "resize", + "resizeBy", + "resizeTo", + "resolve", + "response", + "responseBody", + "responseEnd", + "responseStart", + "responseText", + "responseType", + "responseURL", + "responseXML", + "restore", + "result", + "resultType", + "resume", + "returnValue", + "rev", + "reverse", + "reversed", + "revocable", + "revokeObjectURL", + "rgbColor", + "right", + "rightContext", + "rightMargin", + "rolloffFactor", + "root", + "rootElement", + "rotate", + "rotateAxisAngle", + "rotateAxisAngleSelf", + "rotateFromVector", + "rotateFromVectorSelf", + "rotateSelf", + "rotation", + "rotationRate", + "round", + "rowIndex", + "rowSpan", + "rows", + "rubyAlign", + "rubyOverhang", + "rubyPosition", + "rules", + "runtime", + "runtimeStyle", + "rx", + "ry", + "safari", + "sampleCoverage", + "sampleRate", + "sandbox", + "save", + "scale", + "scale3d", + "scale3dSelf", + "scaleNonUniform", + "scaleNonUniformSelf", + "scaleSelf", + "scheme", + "scissor", + "scope", + "scopeName", + "scoped", + "screen", + "screenBrightness", + "screenEnabled", + "screenLeft", + "screenPixelToMillimeterX", + "screenPixelToMillimeterY", + "screenTop", + "screenX", + "screenY", + "scripts", + "scroll", + "scroll-behavior", + "scrollAmount", + "scrollBehavior", + "scrollBy", + "scrollByLines", + "scrollByPages", + "scrollDelay", + "scrollHeight", + "scrollIntoView", + "scrollIntoViewIfNeeded", + "scrollLeft", + "scrollLeftMax", + "scrollMaxX", + "scrollMaxY", + "scrollTo", + "scrollTop", + "scrollTopMax", + "scrollWidth", + "scrollX", + "scrollY", + "scrollbar3dLightColor", + "scrollbarArrowColor", + "scrollbarBaseColor", + "scrollbarDarkShadowColor", + "scrollbarFaceColor", + "scrollbarHighlightColor", + "scrollbarShadowColor", + "scrollbarTrackColor", + "scrollbars", + "scrolling", + "sdp", + "sdpMLineIndex", + "sdpMid", + "seal", + "search", + "searchBox", + "searchBoxJavaBridge_", + "searchParams", + "sectionRowIndex", + "secureConnectionStart", + "security", + "seed", + "seekable", + "seeking", + "select", + "selectAllChildren", + "selectNode", + "selectNodeContents", + "selectNodes", + "selectSingleNode", + "selectSubString", + "selected", + "selectedIndex", + "selectedOptions", + "selectedStyleSheetSet", + "selectedStylesheetSet", + "selection", + "selectionDirection", + "selectionEnd", + "selectionStart", + "selector", + "selectorText", + "self", + "send", + "sendAsBinary", + "sendBeacon", + "sender", + "sentTimestamp", + "separator", + "serializeToString", + "serviceWorker", + "sessionId", + "sessionStorage", + "set", + "setActive", + "setAlpha", + "setAttribute", + "setAttributeNS", + "setAttributeNode", + "setAttributeNodeNS", + "setBaseAndExtent", + "setBingCurrentSearchDefault", + "setCapture", + "setColor", + "setCompositeOperation", + "setCurrentTime", + "setCustomValidity", + "setData", + "setDate", + "setDragImage", + "setEnd", + "setEndAfter", + "setEndBefore", + "setEndPoint", + "setFillColor", + "setFilterRes", + "setFloat32", + "setFloat64", + "setFloatValue", + "setFullYear", + "setHours", + "setImmediate", + "setInt16", + "setInt32", + "setInt8", + "setInterval", + "setItem", + "setLineCap", + "setLineDash", + "setLineJoin", + "setLineWidth", + "setLocalDescription", + "setMatrix", + "setMatrixValue", + "setMediaKeys", + "setMilliseconds", + "setMinutes", + "setMiterLimit", + "setMonth", + "setNamedItem", + "setNamedItemNS", + "setNonUserCodeExceptions", + "setOrientToAngle", + "setOrientToAuto", + "setOrientation", + "setOverrideHistoryNavigationMode", + "setPaint", + "setParameter", + "setPeriodicWave", + "setPointerCapture", + "setPosition", + "setPreference", + "setProperty", + "setPrototypeOf", + "setRGBColor", + "setRGBColorICCColor", + "setRadius", + "setRangeText", + "setRemoteDescription", + "setRequestHeader", + "setResizable", + "setResourceTimingBufferSize", + "setRotate", + "setScale", + "setSeconds", + "setSelectionRange", + "setServerCertificate", + "setShadow", + "setSkewX", + "setSkewY", + "setStart", + "setStartAfter", + "setStartBefore", + "setStdDeviation", + "setStringValue", + "setStrokeColor", + "setSuggestResult", + "setTargetAtTime", + "setTargetValueAtTime", + "setTime", + "setTimeout", + "setTransform", + "setTranslate", + "setUTCDate", + "setUTCFullYear", + "setUTCHours", + "setUTCMilliseconds", + "setUTCMinutes", + "setUTCMonth", + "setUTCSeconds", + "setUint16", + "setUint32", + "setUint8", + "setUri", + "setValueAtTime", + "setValueCurveAtTime", + "setVariable", + "setVelocity", + "setVersion", + "setYear", + "settingName", + "settingValue", + "sex", + "shaderSource", + "shadowBlur", + "shadowColor", + "shadowOffsetX", + "shadowOffsetY", + "shadowRoot", + "shape", + "shape-rendering", + "shapeRendering", + "sheet", + "shift", + "shiftKey", + "shiftLeft", + "show", + "showHelp", + "showModal", + "showModalDialog", + "showModelessDialog", + "showNotification", + "sidebar", + "sign", + "signalingState", + "sin", + "singleNodeValue", + "sinh", + "size", + "sizeToContent", + "sizes", + "skewX", + "skewXSelf", + "skewY", + "skewYSelf", + "slice", + "slope", + "small", + "smil", + "smoothingTimeConstant", + "snapToLines", + "snapshotItem", + "snapshotLength", + "some", + "sort", + "source", + "sourceBuffer", + "sourceBuffers", + "sourceIndex", + "spacing", + "span", + "speakAs", + "speaking", + "specified", + "specularConstant", + "specularExponent", + "speechSynthesis", + "speed", + "speedOfSound", + "spellcheck", + "splice", + "split", + "splitText", + "spreadMethod", + "sqrt", + "src", + "srcElement", + "srcFilter", + "srcUrn", + "srcdoc", + "srclang", + "srcset", + "stack", + "stackTraceLimit", + "stacktrace", + "standalone", + "standby", + "start", + "startContainer", + "startIce", + "startOffset", + "startRendering", + "startTime", + "startsWith", + "state", + "status", + "statusMessage", + "statusText", + "statusbar", + "stdDeviationX", + "stdDeviationY", + "stencilFunc", + "stencilFuncSeparate", + "stencilMask", + "stencilMaskSeparate", + "stencilOp", + "stencilOpSeparate", + "step", + "stepDown", + "stepMismatch", + "stepUp", + "sticky", + "stitchTiles", + "stop", + "stop-color", + "stop-opacity", + "stopColor", + "stopImmediatePropagation", + "stopOpacity", + "stopPropagation", + "storageArea", + "storageName", + "storageStatus", + "storeSiteSpecificTrackingException", + "storeWebWideTrackingException", + "stpVersion", + "stream", + "strike", + "stringValue", + "stringify", + "stroke", + "stroke-dasharray", + "stroke-dashoffset", + "stroke-linecap", + "stroke-linejoin", + "stroke-miterlimit", + "stroke-opacity", + "stroke-width", + "strokeDasharray", + "strokeDashoffset", + "strokeLinecap", + "strokeLinejoin", + "strokeMiterlimit", + "strokeOpacity", + "strokeRect", + "strokeStyle", + "strokeText", + "strokeWidth", + "style", + "styleFloat", + "styleMedia", + "styleSheet", + "styleSheetSets", + "styleSheets", + "sub", + "subarray", + "subject", + "submit", + "subscribe", + "substr", + "substring", + "substringData", + "subtle", + "suffix", + "suffixes", + "summary", + "sup", + "supports", + "surfaceScale", + "surroundContents", + "suspend", + "suspendRedraw", + "swapCache", + "swapNode", + "sweepFlag", + "symbols", + "system", + "systemCode", + "systemId", + "systemLanguage", + "systemXDPI", + "systemYDPI", + "tBodies", + "tFoot", + "tHead", + "tabIndex", + "table", + "table-layout", + "tableLayout", + "tableValues", + "tag", + "tagName", + "tagUrn", + "tags", + "taintEnabled", + "takeRecords", + "tan", + "tanh", + "target", + "targetElement", + "targetTouches", + "targetX", + "targetY", + "tel", + "terminate", + "test", + "texImage2D", + "texParameterf", + "texParameteri", + "texSubImage2D", + "text", + "text-align", + "text-anchor", + "text-decoration", + "text-decoration-color", + "text-decoration-line", + "text-decoration-style", + "text-indent", + "text-overflow", + "text-rendering", + "text-shadow", + "text-transform", + "textAlign", + "textAlignLast", + "textAnchor", + "textAutospace", + "textBaseline", + "textContent", + "textDecoration", + "textDecorationBlink", + "textDecorationColor", + "textDecorationLine", + "textDecorationLineThrough", + "textDecorationNone", + "textDecorationOverline", + "textDecorationStyle", + "textDecorationUnderline", + "textIndent", + "textJustify", + "textJustifyTrim", + "textKashida", + "textKashidaSpace", + "textLength", + "textOverflow", + "textRendering", + "textShadow", + "textTracks", + "textTransform", + "textUnderlinePosition", + "then", + "threadId", + "threshold", + "tiltX", + "tiltY", + "time", + "timeEnd", + "timeStamp", + "timeout", + "timestamp", + "timestampOffset", + "timing", + "title", + "toArray", + "toBlob", + "toDataURL", + "toDateString", + "toElement", + "toExponential", + "toFixed", + "toFloat32Array", + "toFloat64Array", + "toGMTString", + "toISOString", + "toJSON", + "toLocaleDateString", + "toLocaleFormat", + "toLocaleLowerCase", + "toLocaleString", + "toLocaleTimeString", + "toLocaleUpperCase", + "toLowerCase", + "toMethod", + "toPrecision", + "toSdp", + "toSource", + "toStaticHTML", + "toString", + "toStringTag", + "toTimeString", + "toUTCString", + "toUpperCase", + "toggle", + "toggleLongPressEnabled", + "tooLong", + "toolbar", + "top", + "topMargin", + "total", + "totalFrameDelay", + "totalVideoFrames", + "touchAction", + "touches", + "trace", + "track", + "transaction", + "transactions", + "transform", + "transform-origin", + "transform-style", + "transformOrigin", + "transformPoint", + "transformString", + "transformStyle", + "transformToDocument", + "transformToFragment", + "transition", + "transition-delay", + "transition-duration", + "transition-property", + "transition-timing-function", + "transitionDelay", + "transitionDuration", + "transitionProperty", + "transitionTimingFunction", + "translate", + "translateSelf", + "translationX", + "translationY", + "trim", + "trimLeft", + "trimRight", + "trueSpeed", + "trunc", + "truncate", + "type", + "typeDetail", + "typeMismatch", + "typeMustMatch", + "types", + "ubound", + "undefined", + "unescape", + "uneval", + "unicode-bidi", + "unicodeBidi", + "uniform1f", + "uniform1fv", + "uniform1i", + "uniform1iv", + "uniform2f", + "uniform2fv", + "uniform2i", + "uniform2iv", + "uniform3f", + "uniform3fv", + "uniform3i", + "uniform3iv", + "uniform4f", + "uniform4fv", + "uniform4i", + "uniform4iv", + "uniformMatrix2fv", + "uniformMatrix3fv", + "uniformMatrix4fv", + "unique", + "uniqueID", + "uniqueNumber", + "unitType", + "units", + "unloadEventEnd", + "unloadEventStart", + "unlock", + "unmount", + "unobserve", + "unpause", + "unpauseAnimations", + "unreadCount", + "unregister", + "unregisterContentHandler", + "unregisterProtocolHandler", + "unscopables", + "unselectable", + "unshift", + "unsubscribe", + "unsuspendRedraw", + "unsuspendRedrawAll", + "unwatch", + "unwrapKey", + "update", + "updateCommands", + "updateIce", + "updateInterval", + "updateSettings", + "updated", + "updating", + "upload", + "upper", + "upperBound", + "upperOpen", + "uri", + "url", + "urn", + "urns", + "usages", + "useCurrentView", + "useMap", + "useProgram", + "usedSpace", + "userAgent", + "userLanguage", + "username", + "v8BreakIterator", + "vAlign", + "vLink", + "valid", + "validateProgram", + "validationMessage", + "validity", + "value", + "valueAsDate", + "valueAsNumber", + "valueAsString", + "valueInSpecifiedUnits", + "valueMissing", + "valueOf", + "valueText", + "valueType", + "values", + "vector-effect", + "vectorEffect", + "velocityAngular", + "velocityExpansion", + "velocityX", + "velocityY", + "vendor", + "vendorSub", + "verify", + "version", + "vertexAttrib1f", + "vertexAttrib1fv", + "vertexAttrib2f", + "vertexAttrib2fv", + "vertexAttrib3f", + "vertexAttrib3fv", + "vertexAttrib4f", + "vertexAttrib4fv", + "vertexAttribDivisorANGLE", + "vertexAttribPointer", + "vertical", + "vertical-align", + "verticalAlign", + "verticalOverflow", + "vibrate", + "videoHeight", + "videoTracks", + "videoWidth", + "view", + "viewBox", + "viewBoxString", + "viewTarget", + "viewTargetString", + "viewport", + "viewportAnchorX", + "viewportAnchorY", + "viewportElement", + "visibility", + "visibilityState", + "visible", + "vlinkColor", + "voice", + "volume", + "vrml", + "vspace", + "w", + "wand", + "warn", + "wasClean", + "watch", + "watchPosition", + "webdriver", + "webkitAddKey", + "webkitAnimation", + "webkitAnimationDelay", + "webkitAnimationDirection", + "webkitAnimationDuration", + "webkitAnimationFillMode", + "webkitAnimationIterationCount", + "webkitAnimationName", + "webkitAnimationPlayState", + "webkitAnimationTimingFunction", + "webkitAppearance", + "webkitAudioContext", + "webkitAudioDecodedByteCount", + "webkitAudioPannerNode", + "webkitBackfaceVisibility", + "webkitBackground", + "webkitBackgroundAttachment", + "webkitBackgroundClip", + "webkitBackgroundColor", + "webkitBackgroundImage", + "webkitBackgroundOrigin", + "webkitBackgroundPosition", + "webkitBackgroundPositionX", + "webkitBackgroundPositionY", + "webkitBackgroundRepeat", + "webkitBackgroundSize", + "webkitBackingStorePixelRatio", + "webkitBorderImage", + "webkitBorderImageOutset", + "webkitBorderImageRepeat", + "webkitBorderImageSlice", + "webkitBorderImageSource", + "webkitBorderImageWidth", + "webkitBoxAlign", + "webkitBoxDirection", + "webkitBoxFlex", + "webkitBoxOrdinalGroup", + "webkitBoxOrient", + "webkitBoxPack", + "webkitBoxSizing", + "webkitCancelAnimationFrame", + "webkitCancelFullScreen", + "webkitCancelKeyRequest", + "webkitCancelRequestAnimationFrame", + "webkitClearResourceTimings", + "webkitClosedCaptionsVisible", + "webkitConvertPointFromNodeToPage", + "webkitConvertPointFromPageToNode", + "webkitCreateShadowRoot", + "webkitCurrentFullScreenElement", + "webkitCurrentPlaybackTargetIsWireless", + "webkitDirectionInvertedFromDevice", + "webkitDisplayingFullscreen", + "webkitEnterFullScreen", + "webkitEnterFullscreen", + "webkitExitFullScreen", + "webkitExitFullscreen", + "webkitExitPointerLock", + "webkitFullScreenKeyboardInputAllowed", + "webkitFullscreenElement", + "webkitFullscreenEnabled", + "webkitGenerateKeyRequest", + "webkitGetAsEntry", + "webkitGetDatabaseNames", + "webkitGetEntries", + "webkitGetEntriesByName", + "webkitGetEntriesByType", + "webkitGetFlowByName", + "webkitGetGamepads", + "webkitGetImageDataHD", + "webkitGetNamedFlows", + "webkitGetRegionFlowRanges", + "webkitGetUserMedia", + "webkitHasClosedCaptions", + "webkitHidden", + "webkitIDBCursor", + "webkitIDBDatabase", + "webkitIDBDatabaseError", + "webkitIDBDatabaseException", + "webkitIDBFactory", + "webkitIDBIndex", + "webkitIDBKeyRange", + "webkitIDBObjectStore", + "webkitIDBRequest", + "webkitIDBTransaction", + "webkitImageSmoothingEnabled", + "webkitIndexedDB", + "webkitInitMessageEvent", + "webkitIsFullScreen", + "webkitKeys", + "webkitLineDashOffset", + "webkitLockOrientation", + "webkitMatchesSelector", + "webkitMediaStream", + "webkitNotifications", + "webkitOfflineAudioContext", + "webkitOrientation", + "webkitPeerConnection00", + "webkitPersistentStorage", + "webkitPointerLockElement", + "webkitPostMessage", + "webkitPreservesPitch", + "webkitPutImageDataHD", + "webkitRTCPeerConnection", + "webkitRegionOverset", + "webkitRequestAnimationFrame", + "webkitRequestFileSystem", + "webkitRequestFullScreen", + "webkitRequestFullscreen", + "webkitRequestPointerLock", + "webkitResolveLocalFileSystemURL", + "webkitSetMediaKeys", + "webkitSetResourceTimingBufferSize", + "webkitShadowRoot", + "webkitShowPlaybackTargetPicker", + "webkitSlice", + "webkitSpeechGrammar", + "webkitSpeechGrammarList", + "webkitSpeechRecognition", + "webkitSpeechRecognitionError", + "webkitSpeechRecognitionEvent", + "webkitStorageInfo", + "webkitSupportsFullscreen", + "webkitTemporaryStorage", + "webkitTextSizeAdjust", + "webkitTransform", + "webkitTransformOrigin", + "webkitTransition", + "webkitTransitionDelay", + "webkitTransitionDuration", + "webkitTransitionProperty", + "webkitTransitionTimingFunction", + "webkitURL", + "webkitUnlockOrientation", + "webkitUserSelect", + "webkitVideoDecodedByteCount", + "webkitVisibilityState", + "webkitWirelessVideoPlaybackDisabled", + "webkitdropzone", + "webstore", + "weight", + "whatToShow", + "wheelDelta", + "wheelDeltaX", + "wheelDeltaY", + "which", + "white-space", + "whiteSpace", + "wholeText", + "widows", + "width", + "will-change", + "willChange", + "willValidate", + "window", + "withCredentials", + "word-break", + "word-spacing", + "word-wrap", + "wordBreak", + "wordSpacing", + "wordWrap", + "wrap", + "wrapKey", + "write", + "writeln", + "writingMode", + "x", + "x1", + "x2", + "xChannelSelector", + "xmlEncoding", + "xmlStandalone", + "xmlVersion", + "xmlbase", + "xmllang", + "xmlspace", + "y", + "y1", + "y2", + "yChannelSelector", + "yandex", + "z", + "z-index", + "zIndex", + "zoom", + "zoomAndPan", + "zoomRectScreen" + ] +} diff --git a/node_modules/uglify-js/tools/exports.js b/node_modules/uglify-js/tools/exports.js new file mode 100644 index 0000000..09acc13 --- /dev/null +++ b/node_modules/uglify-js/tools/exports.js @@ -0,0 +1,19 @@ +exports["Compressor"] = Compressor; +exports["DefaultsError"] = DefaultsError; +exports["Dictionary"] = Dictionary; +exports["JS_Parse_Error"] = JS_Parse_Error; +exports["MAP"] = MAP; +exports["OutputStream"] = OutputStream; +exports["SourceMap"] = SourceMap; +exports["TreeTransformer"] = TreeTransformer; +exports["TreeWalker"] = TreeWalker; +exports["base54"] = base54; +exports["defaults"] = defaults; +exports["mangle_properties"] = mangle_properties; +exports["merge"] = merge; +exports["parse"] = parse; +exports["push_uniq"] = push_uniq; +exports["string_template"] = string_template; +exports["tokenizer"] = tokenizer; +exports["is_identifier"] = is_identifier; +exports["SymbolDef"] = SymbolDef; diff --git a/node_modules/uglify-js/tools/node.js b/node_modules/uglify-js/tools/node.js new file mode 100644 index 0000000..147751a --- /dev/null +++ b/node_modules/uglify-js/tools/node.js @@ -0,0 +1,320 @@ +// workaround for tty output truncation upon process.exit() +[process.stdout, process.stderr].forEach(function(stream){ + if (stream._handle && stream._handle.setBlocking) + stream._handle.setBlocking(true); +}); + +var path = require("path"); +var fs = require("fs"); + +var UglifyJS = exports; +var FILES = UglifyJS.FILES = [ + "../lib/utils.js", + "../lib/ast.js", + "../lib/parse.js", + "../lib/transform.js", + "../lib/scope.js", + "../lib/output.js", + "../lib/compress.js", + "../lib/sourcemap.js", + "../lib/mozilla-ast.js", + "../lib/propmangle.js", + "./exports.js", +].map(function(file){ + return require.resolve(file); +}); + +new Function("MOZ_SourceMap", "exports", FILES.map(function(file){ + return fs.readFileSync(file, "utf8"); +}).join("\n\n"))( + require("source-map"), + UglifyJS +); + +UglifyJS.AST_Node.warn_function = function(txt) { + console.error("WARN: %s", txt); +}; + +function read_source_map(code) { + var match = /\n\/\/# sourceMappingURL=data:application\/json(;.*?)?;base64,(.*)/.exec(code); + if (!match) { + UglifyJS.AST_Node.warn("inline source map not found"); + return null; + } + return JSON.parse(new Buffer(match[2], "base64")); +} + +UglifyJS.minify = function(files, options) { + options = UglifyJS.defaults(options, { + compress : {}, + fromString : false, + inSourceMap : null, + mangle : {}, + mangleProperties : false, + nameCache : null, + outFileName : null, + output : null, + outSourceMap : null, + parse : {}, + sourceMapInline : false, + sourceMapUrl : null, + sourceRoot : null, + spidermonkey : false, + warnings : false, + }); + UglifyJS.base54.reset(); + + var inMap = options.inSourceMap; + if (typeof inMap == "string" && inMap != "inline") { + inMap = JSON.parse(fs.readFileSync(inMap, "utf8")); + } + + // 1. parse + var toplevel = null, + sourcesContent = {}; + + if (options.spidermonkey) { + if (inMap == "inline") { + throw new Error("inline source map only works with built-in parser"); + } + toplevel = UglifyJS.AST_Node.from_mozilla_ast(files); + } else { + function addFile(file, fileUrl) { + var code = options.fromString + ? file + : fs.readFileSync(file, "utf8"); + if (inMap == "inline") { + inMap = read_source_map(code); + } + sourcesContent[fileUrl] = code; + toplevel = UglifyJS.parse(code, { + filename: fileUrl, + toplevel: toplevel, + bare_returns: options.parse ? options.parse.bare_returns : undefined + }); + } + if (!options.fromString) { + files = UglifyJS.simple_glob(files); + if (inMap == "inline" && files.length > 1) { + throw new Error("inline source map only works with singular input"); + } + } + [].concat(files).forEach(function (files, i) { + if (typeof files === 'string') { + addFile(files, options.fromString ? i : files); + } else { + for (var fileUrl in files) { + addFile(files[fileUrl], fileUrl); + } + } + }); + } + if (options.wrap) { + toplevel = toplevel.wrap_commonjs(options.wrap, options.exportAll); + } + + // 2. compress + if (options.compress) { + var compress = { warnings: options.warnings }; + UglifyJS.merge(compress, options.compress); + toplevel.figure_out_scope(options.mangle); + var sq = UglifyJS.Compressor(compress); + toplevel = sq.compress(toplevel); + } + + // 3. mangle properties + if (options.mangleProperties || options.nameCache) { + options.mangleProperties.cache = UglifyJS.readNameCache(options.nameCache, "props"); + toplevel = UglifyJS.mangle_properties(toplevel, options.mangleProperties); + UglifyJS.writeNameCache(options.nameCache, "props", options.mangleProperties.cache); + } + + // 4. mangle + if (options.mangle) { + toplevel.figure_out_scope(options.mangle); + toplevel.compute_char_frequency(options.mangle); + toplevel.mangle_names(options.mangle); + } + + // 5. output + var output = { max_line_len: 32000 }; + if (options.outSourceMap || options.sourceMapInline) { + output.source_map = UglifyJS.SourceMap({ + // prefer outFileName, otherwise use outSourceMap without .map suffix + file: options.outFileName || (typeof options.outSourceMap === 'string' ? options.outSourceMap.replace(/\.map$/i, '') : null), + orig: inMap, + root: options.sourceRoot + }); + if (options.sourceMapIncludeSources) { + for (var file in sourcesContent) { + if (sourcesContent.hasOwnProperty(file)) { + output.source_map.get().setSourceContent(file, sourcesContent[file]); + } + } + } + + } + if (options.output) { + UglifyJS.merge(output, options.output); + } + var stream = UglifyJS.OutputStream(output); + toplevel.print(stream); + + + var source_map = output.source_map; + if (source_map) { + source_map = source_map + ""; + } + + var mappingUrlPrefix = "\n//# sourceMappingURL="; + if (options.sourceMapInline) { + stream += mappingUrlPrefix + "data:application/json;charset=utf-8;base64," + new Buffer(source_map).toString("base64"); + } else if (options.outSourceMap && typeof options.outSourceMap === "string" && options.sourceMapUrl !== false) { + stream += mappingUrlPrefix + (typeof options.sourceMapUrl === "string" ? options.sourceMapUrl : options.outSourceMap); + } + + return { + code : stream + "", + map : source_map + }; +}; + +// UglifyJS.describe_ast = function() { +// function doitem(ctor) { +// var sub = {}; +// ctor.SUBCLASSES.forEach(function(ctor){ +// sub[ctor.TYPE] = doitem(ctor); +// }); +// var ret = {}; +// if (ctor.SELF_PROPS.length > 0) ret.props = ctor.SELF_PROPS; +// if (ctor.SUBCLASSES.length > 0) ret.sub = sub; +// return ret; +// } +// return doitem(UglifyJS.AST_Node).sub; +// } + +UglifyJS.describe_ast = function() { + var out = UglifyJS.OutputStream({ beautify: true }); + function doitem(ctor) { + out.print("AST_" + ctor.TYPE); + var props = ctor.SELF_PROPS.filter(function(prop){ + return !/^\$/.test(prop); + }); + if (props.length > 0) { + out.space(); + out.with_parens(function(){ + props.forEach(function(prop, i){ + if (i) out.space(); + out.print(prop); + }); + }); + } + if (ctor.documentation) { + out.space(); + out.print_string(ctor.documentation); + } + if (ctor.SUBCLASSES.length > 0) { + out.space(); + out.with_block(function(){ + ctor.SUBCLASSES.forEach(function(ctor, i){ + out.indent(); + doitem(ctor); + out.newline(); + }); + }); + } + }; + doitem(UglifyJS.AST_Node); + return out + ""; +}; + +function readReservedFile(filename, reserved) { + if (!reserved) { + reserved = { vars: [], props: [] }; + } + var data = fs.readFileSync(filename, "utf8"); + data = JSON.parse(data); + if (data.vars) { + data.vars.forEach(function(name){ + UglifyJS.push_uniq(reserved.vars, name); + }); + } + if (data.props) { + data.props.forEach(function(name){ + UglifyJS.push_uniq(reserved.props, name); + }); + } + return reserved; +} + +UglifyJS.readReservedFile = readReservedFile; + +UglifyJS.readDefaultReservedFile = function(reserved) { + return readReservedFile(require.resolve("./domprops.json"), reserved); +}; + +UglifyJS.readNameCache = function(filename, key) { + var cache = null; + if (filename) { + try { + var cache = fs.readFileSync(filename, "utf8"); + cache = JSON.parse(cache)[key]; + if (!cache) throw "init"; + cache.props = UglifyJS.Dictionary.fromObject(cache.props); + } catch(ex) { + cache = { + cname: -1, + props: new UglifyJS.Dictionary() + }; + } + } + return cache; +}; + +UglifyJS.writeNameCache = function(filename, key, cache) { + if (filename) { + var data; + try { + data = fs.readFileSync(filename, "utf8"); + data = JSON.parse(data); + } catch(ex) { + data = {}; + } + data[key] = { + cname: cache.cname, + props: cache.props.toObject() + }; + fs.writeFileSync(filename, JSON.stringify(data, null, 2), "utf8"); + } +}; + +// A file glob function that only supports "*" and "?" wildcards in the basename. +// Example: "foo/bar/*baz??.*.js" +// Argument `glob` may be a string or an array of strings. +// Returns an array of strings. Garbage in, garbage out. +UglifyJS.simple_glob = function simple_glob(glob) { + if (Array.isArray(glob)) { + return [].concat.apply([], glob.map(simple_glob)); + } + if (glob.match(/\*|\?/)) { + var dir = path.dirname(glob); + try { + var entries = fs.readdirSync(dir); + } catch (ex) {} + if (entries) { + var pattern = "^" + path.basename(glob) + .replace(/[.+^$[\]\\(){}]/g, "\\$&") + .replace(/\*/g, "[^/\\\\]*") + .replace(/\?/g, "[^/\\\\]") + "$"; + var mod = process.platform === "win32" ? "i" : ""; + var rx = new RegExp(pattern, mod); + var results = entries.filter(function(name) { + return rx.test(name); + }).map(function(name) { + return path.join(dir, name); + }); + if (results.length) return results; + } + } + return [ glob ]; +}; diff --git a/node_modules/uglify-js/tools/props.html b/node_modules/uglify-js/tools/props.html new file mode 100644 index 0000000..f7c777a --- /dev/null +++ b/node_modules/uglify-js/tools/props.html @@ -0,0 +1,61 @@ + + + + + + + diff --git a/node_modules/uglify-to-browserify/.npmignore b/node_modules/uglify-to-browserify/.npmignore new file mode 100644 index 0000000..66d015b --- /dev/null +++ b/node_modules/uglify-to-browserify/.npmignore @@ -0,0 +1,14 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz +pids +logs +results +npm-debug.log +node_modules +/test/output.js diff --git a/node_modules/uglify-to-browserify/.travis.yml b/node_modules/uglify-to-browserify/.travis.yml new file mode 100644 index 0000000..9a61f6b --- /dev/null +++ b/node_modules/uglify-to-browserify/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "0.10" \ No newline at end of file diff --git a/node_modules/uglify-to-browserify/LICENSE b/node_modules/uglify-to-browserify/LICENSE new file mode 100644 index 0000000..dfb0b19 --- /dev/null +++ b/node_modules/uglify-to-browserify/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013 Forbes Lindesay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/uglify-to-browserify/README.md b/node_modules/uglify-to-browserify/README.md new file mode 100644 index 0000000..99685da --- /dev/null +++ b/node_modules/uglify-to-browserify/README.md @@ -0,0 +1,15 @@ +# uglify-to-browserify + +A transform to make UglifyJS work in browserify. + +[![Build Status](https://travis-ci.org/ForbesLindesay/uglify-to-browserify.png?branch=master)](https://travis-ci.org/ForbesLindesay/uglify-to-browserify) +[![Dependency Status](https://gemnasium.com/ForbesLindesay/uglify-to-browserify.png)](https://gemnasium.com/ForbesLindesay/uglify-to-browserify) +[![NPM version](https://badge.fury.io/js/uglify-to-browserify.png)](http://badge.fury.io/js/uglify-to-browserify) + +## Installation + + npm install uglify-to-browserify + +## License + + MIT \ No newline at end of file diff --git a/node_modules/uglify-to-browserify/index.js b/node_modules/uglify-to-browserify/index.js new file mode 100644 index 0000000..2cea629 --- /dev/null +++ b/node_modules/uglify-to-browserify/index.js @@ -0,0 +1,49 @@ +'use strict' + +var fs = require('fs') +var PassThrough = require('stream').PassThrough +var Transform = require('stream').Transform + +if (typeof Transform === 'undefined') { + throw new Error('UglifyJS only supports browserify when using node >= 0.10.x') +} + +var cache = {} +module.exports = transform +function transform(file) { + if (!/tools\/node\.js$/.test(file.replace(/\\/g,'/'))) return new PassThrough(); + if (cache[file]) return makeStream(cache[file]) + var uglify = require(file) + var src = 'var sys = require("util");\nvar MOZ_SourceMap = require("source-map");\nvar UglifyJS = exports;\n' + uglify.FILES.map(function (path) { return fs.readFileSync(path, 'utf8') }).join('\n') + + var ast = uglify.parse(src) + ast.figure_out_scope() + + var variables = ast.variables + .map(function (node, name) { + return name + }) + + src += '\n\n' + variables.map(function (v) { return 'exports.' + v + ' = ' + v + ';' }).join('\n') + '\n\n' + + src += 'exports.AST_Node.warn_function = function (txt) { if (typeof console != "undefined" && typeof console.warn === "function") console.warn(txt) }\n\n' + + src += 'exports.minify = ' + uglify.minify.toString() + ';\n\n' + src += 'exports.describe_ast = ' + uglify.describe_ast.toString() + ';' + + // TODO: remove once https://github.com/substack/node-browserify/issues/631 is resolved + src = src.replace(/"for"/g, '"fo" + "r"') + + cache[file] = src + return makeStream(src); +} + +function makeStream(src) { + var res = new Transform(); + res._transform = function (chunk, encoding, callback) { callback() } + res._flush = function (callback) { + res.push(src) + callback() + } + return res; +} diff --git a/node_modules/uglify-to-browserify/package.json b/node_modules/uglify-to-browserify/package.json new file mode 100644 index 0000000..f61bd23 --- /dev/null +++ b/node_modules/uglify-to-browserify/package.json @@ -0,0 +1,51 @@ +{ + "_from": "uglify-to-browserify@~1.0.0", + "_id": "uglify-to-browserify@1.0.2", + "_inBundle": false, + "_integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "_location": "/uglify-to-browserify", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "uglify-to-browserify@~1.0.0", + "name": "uglify-to-browserify", + "escapedName": "uglify-to-browserify", + "rawSpec": "~1.0.0", + "saveSpec": null, + "fetchSpec": "~1.0.0" + }, + "_requiredBy": [ + "/uglify-js" + ], + "_resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "_shasum": "6e0924d6bda6b5afe349e39a6d632850a0f882b7", + "_spec": "uglify-to-browserify@~1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/uglify-js", + "author": { + "name": "ForbesLindesay" + }, + "bugs": { + "url": "https://github.com/ForbesLindesay/uglify-to-browserify/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "A transform to make UglifyJS work in browserify.", + "devDependencies": { + "source-map": "~0.1.27", + "uglify-js": "~2.4.0" + }, + "homepage": "https://github.com/ForbesLindesay/uglify-to-browserify#readme", + "keywords": [], + "license": "MIT", + "name": "uglify-to-browserify", + "repository": { + "type": "git", + "url": "git+https://github.com/ForbesLindesay/uglify-to-browserify.git" + }, + "scripts": { + "test": "node test/index.js" + }, + "version": "1.0.2" +} diff --git a/node_modules/uglify-to-browserify/test/index.js b/node_modules/uglify-to-browserify/test/index.js new file mode 100644 index 0000000..4117894 --- /dev/null +++ b/node_modules/uglify-to-browserify/test/index.js @@ -0,0 +1,22 @@ +var fs = require('fs') +var br = require('../') +var test = fs.readFileSync(require.resolve('uglify-js/test/run-tests.js'), 'utf8') + .replace(/^#.*\n/, '') + +var transform = br(require.resolve('uglify-js')) +transform.pipe(fs.createWriteStream(__dirname + '/output.js')) + .on('close', function () { + Function('module,require', test)({ + filename: require.resolve('uglify-js/test/run-tests.js') + }, + function (name) { + if (name === '../tools/node') { + return require('./output.js') + } else if (/^[a-z]+$/.test(name)) { + return require(name) + } else { + throw new Error('I didn\'t expect you to require ' + name) + } + }) + }) +transform.end(fs.readFileSync(require.resolve('uglify-js'), 'utf8')) \ No newline at end of file diff --git a/node_modules/undefsafe/.jscsrc b/node_modules/undefsafe/.jscsrc new file mode 100644 index 0000000..9e01c9b --- /dev/null +++ b/node_modules/undefsafe/.jscsrc @@ -0,0 +1,13 @@ +{ + "preset": "node-style-guide", + "requireCapitalizedComments": null, + "requireSpacesInAnonymousFunctionExpression": { + "beforeOpeningCurlyBrace": true, + "beforeOpeningRoundBrace": true + }, + "disallowSpacesInNamedFunctionExpression": { + "beforeOpeningRoundBrace": true + }, + "excludeFiles": ["node_modules/**"], + "disallowSpacesInFunction": null +} diff --git a/node_modules/undefsafe/.jshintrc b/node_modules/undefsafe/.jshintrc new file mode 100644 index 0000000..b47f672 --- /dev/null +++ b/node_modules/undefsafe/.jshintrc @@ -0,0 +1,16 @@ +{ + "browser": false, + "camelcase": true, + "curly": true, + "devel": true, + "eqeqeq": true, + "forin": true, + "indent": 2, + "noarg": true, + "node": true, + "quotmark": "single", + "undef": true, + "strict": false, + "unused": true +} + diff --git a/node_modules/undefsafe/.npmignore b/node_modules/undefsafe/.npmignore new file mode 100644 index 0000000..5f6a848 --- /dev/null +++ b/node_modules/undefsafe/.npmignore @@ -0,0 +1,2 @@ +# .npmignore file +test/ diff --git a/node_modules/undefsafe/.travis.yml b/node_modules/undefsafe/.travis.yml new file mode 100644 index 0000000..a1ace24 --- /dev/null +++ b/node_modules/undefsafe/.travis.yml @@ -0,0 +1,18 @@ +sudo: false +language: node_js +cache: + directories: + - node_modules +notifications: + email: false +node_js: + - '4' +before_install: + - npm i -g npm@^2.0.0 +before_script: + - npm prune +after_success: + - npm run semantic-release +branches: + except: + - "/^v\\d+\\.\\d+\\.\\d+$/" diff --git a/node_modules/undefsafe/LICENSE b/node_modules/undefsafe/LICENSE new file mode 100644 index 0000000..caaf03a --- /dev/null +++ b/node_modules/undefsafe/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright © 2016 Remy Sharp, http://remysharp.com + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/undefsafe/README.md b/node_modules/undefsafe/README.md new file mode 100644 index 0000000..46a706b --- /dev/null +++ b/node_modules/undefsafe/README.md @@ -0,0 +1,63 @@ +# undefsafe + +Simple *function* for retrieving deep object properties without getting "Cannot read property 'X' of undefined" + +Can also be used to safely set deep values. + +## Usage + +```js +var object = { + a: { + b: { + c: 1, + d: [1,2,3], + e: 'remy' + } + } +}; + +console.log(undefsafe(object, 'a.b.e')); // "remy" +console.log(undefsafe(object, 'a.b.not.found')); // undefined +``` + +Demo: [https://jsbin.com/eroqame/3/edit?js,console](https://jsbin.com/eroqame/3/edit?js,console) + +## Setting + +```js +var object = { + a: { + b: [1,2,3] + } +}; + +// modified object +var res = undefsafe(object, 'a.b.0', 10); + +console.log(object); // { a: { b: [10, 2, 3] } } +console.log(res); // 1 - previous value +``` + +## Star rules in paths + +As of 1.2.0, `undefsafe` supports a `*` in the path if you want to search all of the properties (or array elements) for a particular element. + +The function will only return a single result, either the 3rd argument validation value, or the first positive match. For example, the following github data: + +```js +const githubData = { + commits: [{ + modified: [ + "one", + "two" + ] + }, /* ... */ ] + }; + +// first modified file found in the first commit +console.log(undefsafe(githubData, 'commits.*.modified.0')); + +// returns `two` or undefined if not found +console.log(undefsafe(githubData, 'commits.*.modified.*', 'two')); +``` diff --git a/node_modules/undefsafe/example.js b/node_modules/undefsafe/example.js new file mode 100644 index 0000000..922d8b9 --- /dev/null +++ b/node_modules/undefsafe/example.js @@ -0,0 +1,14 @@ +var undefsafe = require('undefsafe'); + +var object = { + a: { + b: { + c: 1, + d: [1,2,3], + e: 'remy' + } + } +}; + +console.log(undefsafe(object, 'a.b.e')); // "remy" +console.log(undefsafe(object, 'a.b.not.found')); // undefined diff --git a/node_modules/undefsafe/lib/undefsafe.js b/node_modules/undefsafe/lib/undefsafe.js new file mode 100644 index 0000000..0cfb5fd --- /dev/null +++ b/node_modules/undefsafe/lib/undefsafe.js @@ -0,0 +1,113 @@ +'use strict'; + +function undefsafe(obj, path, value, __res) { + + // I'm not super keen on this private function, but it's because + // it'll also be use in the browser and I wont *one* function exposed + function split(path) { + var res = []; + var level = 0; + var key = ''; + + for (var i = 0; i < path.length; i++) { + var c = path.substr(i, 1); + + if (level === 0 && (c === '.' || c === '[')) { + if (c === '[') { + level++; + i++; + c = path.substr(i, 1); + } + + if (key) { // the first value could be a string + res.push(key); + } + key = ''; + continue; + } + + if (c === ']') { + level--; + key = key.slice(0, -1); + continue; + } + + key += c; + } + + res.push(key); + + return res; + } + + // bail if there's nothing + if (obj === undefined || obj === null) { + return undefined; + } + + var parts = split(path); + var key = null; + var type = typeof obj; + var root = obj; + var parent = obj; + + var star = parts.filter(function (_) { return _ === '*' }).length > 0; + + // we're dealing with a primative + if (type !== 'object' && type !== 'function') { + return obj; + } else if (path.trim() === '') { + return obj; + } + + key = parts[0]; + var i = 0; + for (; i < parts.length; i++) { + key = parts[i]; + parent = obj; + + if (key === '*') { + // loop through each property + var prop = ''; + var res = __res || []; + + for (prop in parent) { + var shallowObj = undefsafe(obj[prop], parts.slice(i + 1).join('.'), value, res); + if (shallowObj && shallowObj !== res) { + if ((value && shallowObj === value) || (value === undefined)) { + if (value !== undefined) { + return shallowObj; + } + + res.push(shallowObj); + } + } + } + + if (res.length === 0) { + return undefined; + } + + return res; + } + + obj = obj[key]; + if (obj === undefined || obj === null) { + break; + } + } + + // if we have a null object, make sure it's the one the user was after, + // if it's not (i.e. parts has a length) then give undefined back. + if (obj === null && i !== parts.length - 1) { + obj = undefined; + } else if (!star && value) { + key = path.split('.').pop(); + parent[key] = value; + } + return obj; +} + +if (typeof module !== 'undefined') { + module.exports = undefsafe; +} diff --git a/node_modules/undefsafe/package.json b/node_modules/undefsafe/package.json new file mode 100644 index 0000000..7006b5c --- /dev/null +++ b/node_modules/undefsafe/package.json @@ -0,0 +1,63 @@ +{ + "_from": "undefsafe@^2.0.2", + "_id": "undefsafe@2.0.2", + "_inBundle": false, + "_integrity": "sha1-Il9rngM3Zj4Njnz9aG/Cg2zKznY=", + "_location": "/undefsafe", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "undefsafe@^2.0.2", + "name": "undefsafe", + "escapedName": "undefsafe", + "rawSpec": "^2.0.2", + "saveSpec": null, + "fetchSpec": "^2.0.2" + }, + "_requiredBy": [ + "/nodemon" + ], + "_resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.2.tgz", + "_shasum": "225f6b9e0337663e0d8e7cfd686fc2836ccace76", + "_spec": "undefsafe@^2.0.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/nodemon", + "author": { + "name": "Remy Sharp" + }, + "bugs": { + "url": "https://github.com/remy/undefsafe/issues" + }, + "bundleDependencies": false, + "dependencies": { + "debug": "^2.2.0" + }, + "deprecated": false, + "description": "Undefined safe way of extracting object properties", + "devDependencies": { + "semantic-release": "^4.3.5", + "tap": "^5.7.1", + "tap-only": "0.0.5" + }, + "directories": { + "test": "test" + }, + "homepage": "https://github.com/remy/undefsafe#readme", + "keywords": [ + "undefined" + ], + "license": "MIT", + "main": "lib/undefsafe.js", + "name": "undefsafe", + "repository": { + "type": "git", + "url": "git+https://github.com/remy/undefsafe.git" + }, + "scripts": { + "cover": "tap test/*.test.js --cov --coverage-report=lcov", + "semantic-release": "semantic-release pre && npm publish && semantic-release post", + "test": "tap test/**/*.test.js -R spec" + }, + "tonicExampleFilename": "example.js", + "version": "2.0.2" +} diff --git a/node_modules/union-value/LICENSE b/node_modules/union-value/LICENSE new file mode 100644 index 0000000..83b56e7 --- /dev/null +++ b/node_modules/union-value/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-2017, 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/node_modules/union-value/README.md b/node_modules/union-value/README.md new file mode 100644 index 0000000..1a90ffb --- /dev/null +++ b/node_modules/union-value/README.md @@ -0,0 +1,73 @@ +# union-value [![NPM version](https://img.shields.io/npm/v/union-value.svg?style=flat)](https://www.npmjs.com/package/union-value) [![NPM monthly downloads](https://img.shields.io/npm/dm/union-value.svg?style=flat)](https://npmjs.org/package/union-value) [![NPM total downloads](https://img.shields.io/npm/dt/union-value.svg?style=flat)](https://npmjs.org/package/union-value) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/union-value.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/union-value) + +> Set an array of unique values as the property of an object. Supports setting deeply nested properties using using object-paths/dot notation. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save union-value +``` + +## Usage + +```js +var union = require('union-value'); + +var obj = {}; + +union(obj, 'a.b.c', ['one', 'two']); +union(obj, 'a.b.c', ['three']); + +console.log(obj); +//=> {a: {b: {c: [ 'one', 'two', 'three' ] }}} +``` + +## About + +### Related projects + +* [assign-value](https://www.npmjs.com/package/assign-value): Assign a value or extend a deeply nested property of an object using object path… [more](https://github.com/jonschlinkert/assign-value) | [homepage](https://github.com/jonschlinkert/assign-value "Assign a value or extend a deeply nested property of an object using object path notation.") +* [get-value](https://www.npmjs.com/package/get-value): Use property paths (`a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value "Use property paths (`a.b.c`) to get a nested value from an object.") +* [has-value](https://www.npmjs.com/package/has-value): Returns true if a value exists, false if empty. Works with deeply nested values using… [more](https://github.com/jonschlinkert/has-value) | [homepage](https://github.com/jonschlinkert/has-value "Returns true if a value exists, false if empty. Works with deeply nested values using object paths.") +* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value "Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths.") +* [unset-value](https://www.npmjs.com/package/unset-value): Delete nested properties from an object using dot notation. | [homepage](https://github.com/jonschlinkert/unset-value "Delete nested properties from an object using dot notation.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.2, on February 25, 2017._ \ No newline at end of file diff --git a/node_modules/union-value/index.js b/node_modules/union-value/index.js new file mode 100644 index 0000000..9c5d8db --- /dev/null +++ b/node_modules/union-value/index.js @@ -0,0 +1,30 @@ +'use strict'; + +var isObject = require('is-extendable'); +var union = require('arr-union'); +var get = require('get-value'); +var set = require('set-value'); + +module.exports = function unionValue(obj, prop, value) { + if (!isObject(obj)) { + throw new TypeError('union-value expects the first argument to be an object.'); + } + + if (typeof prop !== 'string') { + throw new TypeError('union-value expects `prop` to be a string.'); + } + + var arr = arrayify(get(obj, prop)); + set(obj, prop, union(arr, arrayify(value))); + return obj; +}; + +function arrayify(val) { + if (val === null || typeof val === 'undefined') { + return []; + } + if (Array.isArray(val)) { + return val; + } + return [val]; +} diff --git a/node_modules/union-value/node_modules/extend-shallow/LICENSE b/node_modules/union-value/node_modules/extend-shallow/LICENSE new file mode 100644 index 0000000..fa30c4c --- /dev/null +++ b/node_modules/union-value/node_modules/extend-shallow/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2015, 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/node_modules/union-value/node_modules/extend-shallow/README.md b/node_modules/union-value/node_modules/extend-shallow/README.md new file mode 100644 index 0000000..cdc45d4 --- /dev/null +++ b/node_modules/union-value/node_modules/extend-shallow/README.md @@ -0,0 +1,61 @@ +# extend-shallow [![NPM version](https://badge.fury.io/js/extend-shallow.svg)](http://badge.fury.io/js/extend-shallow) [![Build Status](https://travis-ci.org/jonschlinkert/extend-shallow.svg)](https://travis-ci.org/jonschlinkert/extend-shallow) + +> Extend an object with the properties of additional objects. node.js/javascript util. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i extend-shallow --save +``` + +## Usage + +```js +var extend = require('extend-shallow'); + +extend({a: 'b'}, {c: 'd'}) +//=> {a: 'b', c: 'd'} +``` + +Pass an empty object to shallow clone: + +```js +var obj = {}; +extend(obj, {a: 'b'}, {c: 'd'}) +//=> {a: 'b', c: 'd'} +``` + +## Related + +* [extend-shallow](https://github.com/jonschlinkert/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. +* [for-own](https://github.com/jonschlinkert/for-own): Iterate over the own enumerable properties of an object, and return an object with properties… [more](https://github.com/jonschlinkert/for-own) +* [for-in](https://github.com/jonschlinkert/for-in): Iterate over the own and inherited enumerable properties of an objecte, and return an object… [more](https://github.com/jonschlinkert/for-in) +* [is-plain-object](https://github.com/jonschlinkert/is-plain-object): Returns true if an object was created by the `Object` constructor. +* [isobject](https://github.com/jonschlinkert/isobject): Returns true if the value is an object and not an array or null. +* [kind-of](https://github.com/jonschlinkert/kind-of): Get the native type of a value. + +## Running tests + +Install dev dependencies: + +```sh +$ npm i -d && npm test +``` + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 Jon Schlinkert +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 29, 2015._ \ No newline at end of file diff --git a/node_modules/union-value/node_modules/extend-shallow/index.js b/node_modules/union-value/node_modules/extend-shallow/index.js new file mode 100644 index 0000000..92a067f --- /dev/null +++ b/node_modules/union-value/node_modules/extend-shallow/index.js @@ -0,0 +1,33 @@ +'use strict'; + +var isObject = require('is-extendable'); + +module.exports = function extend(o/*, objects*/) { + if (!isObject(o)) { o = {}; } + + var len = arguments.length; + for (var i = 1; i < len; i++) { + var obj = arguments[i]; + + if (isObject(obj)) { + assign(o, obj); + } + } + return o; +}; + +function assign(a, b) { + for (var key in b) { + if (hasOwn(b, key)) { + a[key] = b[key]; + } + } +} + +/** + * Returns true if the given `key` is an own property of `obj`. + */ + +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} diff --git a/node_modules/union-value/node_modules/extend-shallow/package.json b/node_modules/union-value/node_modules/extend-shallow/package.json new file mode 100644 index 0000000..0cb2062 --- /dev/null +++ b/node_modules/union-value/node_modules/extend-shallow/package.json @@ -0,0 +1,87 @@ +{ + "_from": "extend-shallow@^2.0.1", + "_id": "extend-shallow@2.0.1", + "_inBundle": false, + "_integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "_location": "/union-value/extend-shallow", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "extend-shallow@^2.0.1", + "name": "extend-shallow", + "escapedName": "extend-shallow", + "rawSpec": "^2.0.1", + "saveSpec": null, + "fetchSpec": "^2.0.1" + }, + "_requiredBy": [ + "/union-value/set-value" + ], + "_resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "_shasum": "51af7d614ad9a9f610ea1bafbb989d6b1c56890f", + "_spec": "extend-shallow@^2.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/union-value/node_modules/set-value", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/extend-shallow/issues" + }, + "bundleDependencies": false, + "dependencies": { + "is-extendable": "^0.1.0" + }, + "deprecated": false, + "description": "Extend an object with the properties of additional objects. node.js/javascript util.", + "devDependencies": { + "array-slice": "^0.2.3", + "benchmarked": "^0.1.4", + "chalk": "^1.0.0", + "for-own": "^0.1.3", + "glob": "^5.0.12", + "is-plain-object": "^2.0.1", + "kind-of": "^2.0.0", + "minimist": "^1.1.1", + "mocha": "^2.2.5", + "should": "^7.0.1" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/extend-shallow", + "keywords": [ + "assign", + "extend", + "javascript", + "js", + "keys", + "merge", + "obj", + "object", + "prop", + "properties", + "property", + "props", + "shallow", + "util", + "utility", + "utils", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "extend-shallow", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/extend-shallow.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "2.0.1" +} diff --git a/node_modules/union-value/node_modules/set-value/LICENSE b/node_modules/union-value/node_modules/set-value/LICENSE new file mode 100644 index 0000000..d734237 --- /dev/null +++ b/node_modules/union-value/node_modules/set-value/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, 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/node_modules/union-value/node_modules/set-value/README.md b/node_modules/union-value/node_modules/set-value/README.md new file mode 100644 index 0000000..19fbdbb --- /dev/null +++ b/node_modules/union-value/node_modules/set-value/README.md @@ -0,0 +1,81 @@ +# set-value [![NPM version](https://img.shields.io/npm/v/set-value.svg?style=flat)](https://www.npmjs.com/package/set-value) [![NPM monthly downloads](https://img.shields.io/npm/dm/set-value.svg?style=flat)](https://npmjs.org/package/set-value) [![NPM total downloads](https://img.shields.io/npm/dt/set-value.svg?style=flat)](https://npmjs.org/package/set-value) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/set-value.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/set-value) + +> Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save set-value +``` + +## Usage + +```js +var set = require('set-value'); + +var obj = {}; +set(obj, 'a.b.c', 'd'); +console.log(obj); +//=> {a: {b: c: 'd'}} +``` + +## About + +### Related projects + +* [assign-value](https://www.npmjs.com/package/assign-value): Assign a value or extend a deeply nested property of an object using object path… [more](https://github.com/jonschlinkert/assign-value) | [homepage](https://github.com/jonschlinkert/assign-value "Assign a value or extend a deeply nested property of an object using object path notation.") +* [get-value](https://www.npmjs.com/package/get-value): Use property paths (`a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value "Use property paths (`a.b.c`) to get a nested value from an object.") +* [has-value](https://www.npmjs.com/package/has-value): Returns true if a value exists, false if empty. Works with deeply nested values using… [more](https://github.com/jonschlinkert/has-value) | [homepage](https://github.com/jonschlinkert/has-value "Returns true if a value exists, false if empty. Works with deeply nested values using object paths.") +* [merge-value](https://www.npmjs.com/package/merge-value): Similar to assign-value but deeply merges object values or nested values using object path/dot notation. | [homepage](https://github.com/jonschlinkert/merge-value "Similar to assign-value but deeply merges object values or nested values using object path/dot notation.") +* [omit-value](https://www.npmjs.com/package/omit-value): Omit properties from an object or deeply nested property of an object using object path… [more](https://github.com/jonschlinkert/omit-value) | [homepage](https://github.com/jonschlinkert/omit-value "Omit properties from an object or deeply nested property of an object using object path notation.") +* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value "Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths.") +* [union-value](https://www.npmjs.com/package/union-value): Set an array of unique values as the property of an object. Supports setting deeply… [more](https://github.com/jonschlinkert/union-value) | [homepage](https://github.com/jonschlinkert/union-value "Set an array of unique values as the property of an object. Supports setting deeply nested properties using using object-paths/dot notation.") +* [unset-value](https://www.npmjs.com/package/unset-value): Delete nested properties from an object using dot notation. | [homepage](https://github.com/jonschlinkert/unset-value "Delete nested properties from an object using dot notation.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 53 | [jonschlinkert](https://github.com/jonschlinkert) | +| 1 | [vadimdemedes](https://github.com/vadimdemedes) | +| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.2, on February 22, 2017._ \ No newline at end of file diff --git a/node_modules/union-value/node_modules/set-value/index.js b/node_modules/union-value/node_modules/set-value/index.js new file mode 100644 index 0000000..e51ece5 --- /dev/null +++ b/node_modules/union-value/node_modules/set-value/index.js @@ -0,0 +1,63 @@ +/*! + * set-value + * + * Copyright (c) 2014-2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var toPath = require('to-object-path'); +var extend = require('extend-shallow'); +var isPlainObject = require('is-plain-object'); +var isObject = require('is-extendable'); + +module.exports = function(obj, path, val) { + if (!isObject(obj)) { + return obj; + } + + if (Array.isArray(path)) { + path = toPath(path); + } + + if (typeof path !== 'string') { + return obj; + } + + var segs = path.split('.'); + var len = segs.length, i = -1; + var res = obj; + var last; + + while (++i < len) { + var key = segs[i]; + + while (key[key.length - 1] === '\\') { + key = key.slice(0, -1) + '.' + segs[++i]; + } + + if (i === len - 1) { + last = key; + break; + } + + if (!isObject(obj[key])) { + obj[key] = {}; + } + obj = obj[key]; + } + + if (obj.hasOwnProperty(last) && isObject(obj[last])) { + if (isPlainObject(val)) { + extend(obj[last], val); + } else { + obj[last] = val; + } + + } else { + obj[last] = val; + } + return res; +}; + diff --git a/node_modules/union-value/node_modules/set-value/package.json b/node_modules/union-value/node_modules/set-value/package.json new file mode 100644 index 0000000..68d5e60 --- /dev/null +++ b/node_modules/union-value/node_modules/set-value/package.json @@ -0,0 +1,121 @@ +{ + "_from": "set-value@^0.4.3", + "_id": "set-value@0.4.3", + "_inBundle": false, + "_integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "_location": "/union-value/set-value", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "set-value@^0.4.3", + "name": "set-value", + "escapedName": "set-value", + "rawSpec": "^0.4.3", + "saveSpec": null, + "fetchSpec": "^0.4.3" + }, + "_requiredBy": [ + "/union-value" + ], + "_resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "_shasum": "7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1", + "_spec": "set-value@^0.4.3", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/union-value", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/set-value/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "email": "wtgtybhertgeghgtwtg@gmail.com", + "url": "https://github.com/wtgtybhertgeghgtwtg" + }, + { + "name": "Jon Schlinkert", + "email": "jon.schlinkert@sellside.com", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Vadim Demedes", + "email": "vdemedes@gmail.com", + "url": "https://vadimdemedes.com" + } + ], + "dependencies": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + }, + "deprecated": false, + "description": "Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths.", + "devDependencies": { + "gulp-format-md": "^0.1.10", + "mocha": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/set-value", + "keywords": [ + "get", + "has", + "hasown", + "key", + "keys", + "nested", + "notation", + "object", + "prop", + "properties", + "property", + "props", + "set", + "value", + "values" + ], + "license": "MIT", + "main": "index.js", + "name": "set-value", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/set-value.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "assign-value", + "get-value", + "has-value", + "merge-value", + "omit-value", + "set-value", + "union-value", + "unset-value" + ] + }, + "lint": { + "reflinks": true + } + }, + "version": "0.4.3" +} diff --git a/node_modules/union-value/package.json b/node_modules/union-value/package.json new file mode 100644 index 0000000..550a377 --- /dev/null +++ b/node_modules/union-value/package.json @@ -0,0 +1,105 @@ +{ + "_from": "union-value@^1.0.0", + "_id": "union-value@1.0.0", + "_inBundle": false, + "_integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "_location": "/union-value", + "_phantomChildren": { + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "to-object-path": "0.3.0" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "union-value@^1.0.0", + "name": "union-value", + "escapedName": "union-value", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/cache-base" + ], + "_resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "_shasum": "5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4", + "_spec": "union-value@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/cache-base", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/union-value/issues" + }, + "bundleDependencies": false, + "dependencies": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "deprecated": false, + "description": "Set an array of unique values as the property of an object. Supports setting deeply nested properties using using object-paths/dot notation.", + "devDependencies": { + "gulp-format-md": "^0.1.11", + "mocha": "^3.2.0", + "should": "^11.2.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/union-value", + "keywords": [ + "array", + "dot", + "get", + "has", + "nested", + "notation", + "object", + "path", + "prop", + "property", + "set", + "union", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "union-value", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/union-value.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "assign-value", + "get-value", + "has-value", + "set-value", + "unset-value" + ] + }, + "lint": { + "reflinks": true + } + }, + "version": "1.0.0" +} diff --git a/node_modules/unique-string/index.js b/node_modules/unique-string/index.js new file mode 100644 index 0000000..5bc7787 --- /dev/null +++ b/node_modules/unique-string/index.js @@ -0,0 +1,4 @@ +'use strict'; +const cryptoRandomString = require('crypto-random-string'); + +module.exports = () => cryptoRandomString(32); diff --git a/node_modules/unique-string/license b/node_modules/unique-string/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/unique-string/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/unique-string/package.json b/node_modules/unique-string/package.json new file mode 100644 index 0000000..f4d6326 --- /dev/null +++ b/node_modules/unique-string/package.json @@ -0,0 +1,76 @@ +{ + "_from": "unique-string@^1.0.0", + "_id": "unique-string@1.0.0", + "_inBundle": false, + "_integrity": "sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo=", + "_location": "/unique-string", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unique-string@^1.0.0", + "name": "unique-string", + "escapedName": "unique-string", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/configstore" + ], + "_resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", + "_shasum": "9e1057cca851abb93398f8b33ae187b99caec11a", + "_spec": "unique-string@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/configstore", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/unique-string/issues" + }, + "bundleDependencies": false, + "dependencies": { + "crypto-random-string": "^1.0.0" + }, + "deprecated": false, + "description": "Generate a unique random string", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/unique-string#readme", + "keywords": [ + "unique", + "string", + "random", + "uniq", + "str", + "rand", + "text", + "id", + "identifier", + "slug", + "hex" + ], + "license": "MIT", + "name": "unique-string", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/unique-string.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.0.0", + "xo": { + "esnext": true + } +} diff --git a/node_modules/unique-string/readme.md b/node_modules/unique-string/readme.md new file mode 100644 index 0000000..5d5ac97 --- /dev/null +++ b/node_modules/unique-string/readme.md @@ -0,0 +1,32 @@ +# unique-string [![Build Status](https://travis-ci.org/sindresorhus/unique-string.svg?branch=master)](https://travis-ci.org/sindresorhus/unique-string) + +> Generate a unique random string + + +## Install + +``` +$ npm install --save unique-string +``` + + +## Usage + +```js +const uniqueString = require('unique-string'); + +uniqueString(); +//=> 'b4de2a49c8ffa3fbee04446f045483b2' +``` + + +## API + +### uniqueString() + +Returns a 32 character unique string. Matches the length of MD5, which is [unique enough](http://stackoverflow.com/a/2444336/64949) for non-crypto purposes. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/unpipe/HISTORY.md b/node_modules/unpipe/HISTORY.md new file mode 100644 index 0000000..85e0f8d --- /dev/null +++ b/node_modules/unpipe/HISTORY.md @@ -0,0 +1,4 @@ +1.0.0 / 2015-06-14 +================== + + * Initial release diff --git a/node_modules/unpipe/LICENSE b/node_modules/unpipe/LICENSE new file mode 100644 index 0000000..aed0138 --- /dev/null +++ b/node_modules/unpipe/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/unpipe/README.md b/node_modules/unpipe/README.md new file mode 100644 index 0000000..e536ad2 --- /dev/null +++ b/node_modules/unpipe/README.md @@ -0,0 +1,43 @@ +# unpipe + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Unpipe a stream from all destinations. + +## Installation + +```sh +$ npm install unpipe +``` + +## API + +```js +var unpipe = require('unpipe') +``` + +### unpipe(stream) + +Unpipes all destinations from a given stream. With stream 2+, this is +equivalent to `stream.unpipe()`. When used with streams 1 style streams +(typically Node.js 0.8 and below), this module attempts to undo the +actions done in `stream.pipe(dest)`. + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/unpipe.svg +[npm-url]: https://npmjs.org/package/unpipe +[node-image]: https://img.shields.io/node/v/unpipe.svg +[node-url]: http://nodejs.org/download/ +[travis-image]: https://img.shields.io/travis/stream-utils/unpipe.svg +[travis-url]: https://travis-ci.org/stream-utils/unpipe +[coveralls-image]: https://img.shields.io/coveralls/stream-utils/unpipe.svg +[coveralls-url]: https://coveralls.io/r/stream-utils/unpipe?branch=master +[downloads-image]: https://img.shields.io/npm/dm/unpipe.svg +[downloads-url]: https://npmjs.org/package/unpipe diff --git a/node_modules/unpipe/index.js b/node_modules/unpipe/index.js new file mode 100644 index 0000000..15c3d97 --- /dev/null +++ b/node_modules/unpipe/index.js @@ -0,0 +1,69 @@ +/*! + * unpipe + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = unpipe + +/** + * Determine if there are Node.js pipe-like data listeners. + * @private + */ + +function hasPipeDataListeners(stream) { + var listeners = stream.listeners('data') + + for (var i = 0; i < listeners.length; i++) { + if (listeners[i].name === 'ondata') { + return true + } + } + + return false +} + +/** + * Unpipe a stream from all destinations. + * + * @param {object} stream + * @public + */ + +function unpipe(stream) { + if (!stream) { + throw new TypeError('argument stream is required') + } + + if (typeof stream.unpipe === 'function') { + // new-style + stream.unpipe() + return + } + + // Node.js 0.8 hack + if (!hasPipeDataListeners(stream)) { + return + } + + var listener + var listeners = stream.listeners('close') + + for (var i = 0; i < listeners.length; i++) { + listener = listeners[i] + + if (listener.name !== 'cleanup' && listener.name !== 'onclose') { + continue + } + + // invoke the listener + listener.call(stream) + } +} diff --git a/node_modules/unpipe/package.json b/node_modules/unpipe/package.json new file mode 100644 index 0000000..71653e6 --- /dev/null +++ b/node_modules/unpipe/package.json @@ -0,0 +1,63 @@ +{ + "_from": "unpipe@1.0.0", + "_id": "unpipe@1.0.0", + "_inBundle": false, + "_integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "_location": "/unpipe", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "unpipe@1.0.0", + "name": "unpipe", + "escapedName": "unpipe", + "rawSpec": "1.0.0", + "saveSpec": null, + "fetchSpec": "1.0.0" + }, + "_requiredBy": [ + "/finalhandler", + "/raw-body" + ], + "_resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "_shasum": "b2bf4ee8514aae6165b4817829d21b2ef49904ec", + "_spec": "unpipe@1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/raw-body", + "author": { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + "bugs": { + "url": "https://github.com/stream-utils/unpipe/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Unpipe a stream from all destinations", + "devDependencies": { + "istanbul": "0.3.15", + "mocha": "2.2.5", + "readable-stream": "1.1.13" + }, + "engines": { + "node": ">= 0.8" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "index.js" + ], + "homepage": "https://github.com/stream-utils/unpipe#readme", + "license": "MIT", + "name": "unpipe", + "repository": { + "type": "git", + "url": "git+https://github.com/stream-utils/unpipe.git" + }, + "scripts": { + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + }, + "version": "1.0.0" +} diff --git a/node_modules/unset-value/LICENSE b/node_modules/unset-value/LICENSE new file mode 100644 index 0000000..ec85897 --- /dev/null +++ b/node_modules/unset-value/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 2017, 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/node_modules/unset-value/README.md b/node_modules/unset-value/README.md new file mode 100644 index 0000000..f0fec3d --- /dev/null +++ b/node_modules/unset-value/README.md @@ -0,0 +1,131 @@ +# unset-value [![NPM version](https://img.shields.io/npm/v/unset-value.svg?style=flat)](https://www.npmjs.com/package/unset-value) [![NPM monthly downloads](https://img.shields.io/npm/dm/unset-value.svg?style=flat)](https://npmjs.org/package/unset-value) [![NPM total downloads](https://img.shields.io/npm/dt/unset-value.svg?style=flat)](https://npmjs.org/package/unset-value) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/unset-value.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/unset-value) + +> Delete nested properties from an object using dot notation. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save unset-value +``` + +## Usage + +```js +var unset = require('unset-value'); + +var obj = {a: {b: {c: 'd', e: 'f'}}}; +unset(obj, 'a.b.c'); +console.log(obj); +//=> {a: {b: {e: 'f'}}}; +``` + +## Examples + +### Updates the object when a property is deleted + +```js +var obj = {a: 'b'}; +unset(obj, 'a'); +console.log(obj); +//=> {} +``` + +### Returns true when a property is deleted + +```js +unset({a: 'b'}, 'a') // true +``` + +### Returns `true` when a property does not exist + +This is consistent with `delete` behavior in that it does not +throw when a property does not exist. + +```js +unset({a: {b: {c: 'd'}}}, 'd') // true +``` + +### delete nested values + +```js +var one = {a: {b: {c: 'd'}}}; +unset(one, 'a.b'); +console.log(one); +//=> {a: {}} + +var two = {a: {b: {c: 'd'}}}; +unset(two, 'a.b.c'); +console.log(two); +//=> {a: {b: {}}} + +var three = {a: {b: {c: 'd', e: 'f'}}}; +unset(three, 'a.b.c'); +console.log(three); +//=> {a: {b: {e: 'f'}}} +``` + +### throws on invalid args + +```js +unset(); +// 'expected an object.' +``` + +## About + +### Related projects + +* [get-value](https://www.npmjs.com/package/get-value): Use property paths (`a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value "Use property paths (`a.b.c`) to get a nested value from an object.") +* [get-values](https://www.npmjs.com/package/get-values): Return an array of all values from the given object. | [homepage](https://github.com/jonschlinkert/get-values "Return an array of all values from the given object.") +* [omit-value](https://www.npmjs.com/package/omit-value): Omit properties from an object or deeply nested property of an object using object path… [more](https://github.com/jonschlinkert/omit-value) | [homepage](https://github.com/jonschlinkert/omit-value "Omit properties from an object or deeply nested property of an object using object path notation.") +* [put-value](https://www.npmjs.com/package/put-value): Update only existing values from an object, works with dot notation paths like `a.b.c` and… [more](https://github.com/tunnckocore/put-value#readme) | [homepage](https://github.com/tunnckocore/put-value#readme "Update only existing values from an object, works with dot notation paths like `a.b.c` and support deep nesting.") +* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value "Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths.") +* [union-value](https://www.npmjs.com/package/union-value): Set an array of unique values as the property of an object. Supports setting deeply… [more](https://github.com/jonschlinkert/union-value) | [homepage](https://github.com/jonschlinkert/union-value "Set an array of unique values as the property of an object. Supports setting deeply nested properties using using object-paths/dot notation.") +* [upsert-value](https://www.npmjs.com/package/upsert-value): Update or set nested values and any intermediaries with dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/doowb/upsert-value "Update or set nested values and any intermediaries with dot notation (`'a.b.c'`) paths.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 6 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.2, on February 25, 2017._ \ No newline at end of file diff --git a/node_modules/unset-value/index.js b/node_modules/unset-value/index.js new file mode 100644 index 0000000..a919010 --- /dev/null +++ b/node_modules/unset-value/index.js @@ -0,0 +1,32 @@ +/*! + * unset-value + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var isObject = require('isobject'); +var has = require('has-value'); + +module.exports = function unset(obj, prop) { + if (!isObject(obj)) { + throw new TypeError('expected an object.'); + } + if (obj.hasOwnProperty(prop)) { + delete obj[prop]; + return true; + } + + if (has(obj, prop)) { + var segs = prop.split('.'); + var last = segs.pop(); + while (segs.length && segs[segs.length - 1].slice(-1) === '\\') { + last = segs.pop().slice(0, -1) + '.' + last; + } + while (segs.length) obj = obj[prop = segs.shift()]; + return (delete obj[last]); + } + return true; +}; diff --git a/node_modules/unset-value/node_modules/has-value/LICENSE b/node_modules/unset-value/node_modules/has-value/LICENSE new file mode 100644 index 0000000..39245ac --- /dev/null +++ b/node_modules/unset-value/node_modules/has-value/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2016, 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/node_modules/unset-value/node_modules/has-value/README.md b/node_modules/unset-value/node_modules/has-value/README.md new file mode 100644 index 0000000..a927633 --- /dev/null +++ b/node_modules/unset-value/node_modules/has-value/README.md @@ -0,0 +1,130 @@ +# has-value [![NPM version](https://img.shields.io/npm/v/has-value.svg?style=flat)](https://www.npmjs.com/package/has-value) [![NPM downloads](https://img.shields.io/npm/dm/has-value.svg?style=flat)](https://npmjs.org/package/has-value) [![Build Status](https://img.shields.io/travis/jonschlinkert/has-value.svg?style=flat)](https://travis-ci.org/jonschlinkert/has-value) + +> Returns true if a value exists, false if empty. Works with deeply nested values using object paths. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install has-value --save +``` + +**Works for:** + +* booleans +* functions +* numbers (pass `true` as the last arg to treat zero as a value instead of falsey) +* strings +* nulls +* object +* arrays + +## Usage + +Works with nested object paths or a single value: + +```js +var hasValue = require('has-value'); + +hasValue({a: {b: {c: 'foo'}}} 'a.b.c'); +//=> true + +hasValue('a'); +//=> true + +hasValue(''); +//=> false + +hasValue(1); +//=> true + +hasValue(0); +//=> false + +hasValue(0, true); // pass `true` as the last arg to treat zero as a value +//=> true + +hasValue({a: 'a'}}); +//=> true + +hasValue({}}); +//=> false + +hasValue(['a']); +//=> true + +hasValue([]); +//=> false + +hasValue(function(foo) {}); // function length/arity +//=> true + +hasValue(function() {}); +//=> false + +hasValue(true); +hasValue(false); +//=> true +``` + +## isEmpty + +To do the opposite and test for empty values, do: + +```js +function isEmpty(o, isZero) { + return !hasValue.apply(hasValue, arguments); +} +``` + +## Related projects + +You might also be interested in these projects: + +* [get-object](https://www.npmjs.com/package/get-object): Get a property from an object using dot (object path) notation. | [homepage](https://github.com/jonschlinkert/get-object) +* [get-property](https://www.npmjs.com/package/get-property): Get a nested property or its value from an object using simple `a.b.c` paths. | [homepage](https://github.com/jonschlinkert/get-property) +* [get-value](https://www.npmjs.com/package/get-value): Use property paths (`a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value) +* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value) + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/has-value/issues/new). + +## Building docs + +Generate readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm install verb && npm run docs +``` + +Or, if [verb](https://github.com/verbose/verb) is installed globally: + +```sh +$ verb +``` + +## Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +## Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT license](https://github.com/jonschlinkert/has-value/blob/master/LICENSE). + +*** + +_This file was generated by [verb](https://github.com/verbose/verb), v, on March 27, 2016._ \ No newline at end of file diff --git a/node_modules/unset-value/node_modules/has-value/index.js b/node_modules/unset-value/node_modules/has-value/index.js new file mode 100644 index 0000000..90687c8 --- /dev/null +++ b/node_modules/unset-value/node_modules/has-value/index.js @@ -0,0 +1,19 @@ +/*! + * has-value + * + * Copyright (c) 2014-2016, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var isObject = require('isobject'); +var hasValues = require('has-values'); +var get = require('get-value'); + +module.exports = function(obj, prop, noZero) { + if (isObject(obj)) { + return hasValues(get(obj, prop), noZero); + } + return hasValues(obj, prop); +}; diff --git a/node_modules/unset-value/node_modules/has-value/node_modules/isobject/LICENSE b/node_modules/unset-value/node_modules/has-value/node_modules/isobject/LICENSE new file mode 100644 index 0000000..39245ac --- /dev/null +++ b/node_modules/unset-value/node_modules/has-value/node_modules/isobject/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2016, 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/node_modules/unset-value/node_modules/has-value/node_modules/isobject/README.md b/node_modules/unset-value/node_modules/has-value/node_modules/isobject/README.md new file mode 100644 index 0000000..9dd897a --- /dev/null +++ b/node_modules/unset-value/node_modules/has-value/node_modules/isobject/README.md @@ -0,0 +1,112 @@ +# isobject [![NPM version](https://img.shields.io/npm/v/isobject.svg?style=flat)](https://www.npmjs.com/package/isobject) [![NPM downloads](https://img.shields.io/npm/dm/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![Build Status](https://img.shields.io/travis/jonschlinkert/isobject.svg?style=flat)](https://travis-ci.org/jonschlinkert/isobject) + +Returns true if the value is an object and not an array or null. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install isobject --save +``` + +Use [is-plain-object](https://github.com/jonschlinkert/is-plain-object) if you want only objects that are created by the `Object` constructor. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install isobject +``` + +Install with [bower](http://bower.io/) + +```sh +$ bower install isobject +``` + +## Usage + +```js +var isObject = require('isobject'); +``` + +**True** + +All of the following return `true`: + +```js +isObject({}); +isObject(Object.create({})); +isObject(Object.create(Object.prototype)); +isObject(Object.create(null)); +isObject({}); +isObject(new Foo); +isObject(/foo/); +``` + +**False** + +All of the following return `false`: + +```js +isObject(); +isObject(function () {}); +isObject(1); +isObject([]); +isObject(undefined); +isObject(null); +``` + +## Related projects + +You might also be interested in these projects: + +[merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep) + +* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow) +* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object) +* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of) + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/isobject/issues/new). + +## Building docs + +Generate readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm install verb && npm run docs +``` + +Or, if [verb](https://github.com/verbose/verb) is installed globally: + +```sh +$ verb +``` + +## Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +## Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT license](https://github.com/jonschlinkert/isobject/blob/master/LICENSE). + +*** + +_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on April 25, 2016._ \ No newline at end of file diff --git a/node_modules/unset-value/node_modules/has-value/node_modules/isobject/index.js b/node_modules/unset-value/node_modules/has-value/node_modules/isobject/index.js new file mode 100644 index 0000000..aa0dce0 --- /dev/null +++ b/node_modules/unset-value/node_modules/has-value/node_modules/isobject/index.js @@ -0,0 +1,14 @@ +/*! + * isobject + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var isArray = require('isarray'); + +module.exports = function isObject(val) { + return val != null && typeof val === 'object' && isArray(val) === false; +}; diff --git a/node_modules/unset-value/node_modules/has-value/node_modules/isobject/package.json b/node_modules/unset-value/node_modules/has-value/node_modules/isobject/package.json new file mode 100644 index 0000000..ffd23e0 --- /dev/null +++ b/node_modules/unset-value/node_modules/has-value/node_modules/isobject/package.json @@ -0,0 +1,98 @@ +{ + "_from": "isobject@^2.0.0", + "_id": "isobject@2.1.0", + "_inBundle": false, + "_integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "_location": "/unset-value/has-value/isobject", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "isobject@^2.0.0", + "name": "isobject", + "escapedName": "isobject", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/unset-value/has-value" + ], + "_resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "_shasum": "f065561096a3f1da2ef46272f815c840d87e0c89", + "_spec": "isobject@^2.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/unset-value/node_modules/has-value", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/isobject/issues" + }, + "bundleDependencies": false, + "dependencies": { + "isarray": "1.0.0" + }, + "deprecated": false, + "description": "Returns true if the value is an object and not an array or null.", + "devDependencies": { + "gulp-format-md": "^0.1.9", + "mocha": "^2.4.5" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/isobject", + "keywords": [ + "check", + "is", + "is-object", + "isobject", + "kind", + "kind-of", + "kindof", + "native", + "object", + "type", + "typeof", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "isobject", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/isobject.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "merge-deep", + "extend-shallow", + "is-plain-object", + "kind-of" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb" + ] + }, + "version": "2.1.0" +} diff --git a/node_modules/unset-value/node_modules/has-value/package.json b/node_modules/unset-value/node_modules/has-value/package.json new file mode 100644 index 0000000..b4ffacb --- /dev/null +++ b/node_modules/unset-value/node_modules/has-value/package.json @@ -0,0 +1,114 @@ +{ + "_from": "has-value@^0.3.1", + "_id": "has-value@0.3.1", + "_inBundle": false, + "_integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "_location": "/unset-value/has-value", + "_phantomChildren": { + "isarray": "1.0.0" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "has-value@^0.3.1", + "name": "has-value", + "escapedName": "has-value", + "rawSpec": "^0.3.1", + "saveSpec": null, + "fetchSpec": "^0.3.1" + }, + "_requiredBy": [ + "/unset-value" + ], + "_resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "_shasum": "7b1f58bada62ca827ec0a2078025654845995e1f", + "_spec": "has-value@^0.3.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/unset-value", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/has-value/issues" + }, + "bundleDependencies": false, + "dependencies": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "deprecated": false, + "description": "Returns true if a value exists, false if empty. Works with deeply nested values using object paths.", + "devDependencies": { + "gulp-format-md": "^0.1.7", + "mocha": "^2.4.5" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/has-value", + "keywords": [ + "array", + "boolean", + "empty", + "find", + "function", + "has", + "hasOwn", + "javascript", + "js", + "key", + "keys", + "node.js", + "null", + "number", + "object", + "properties", + "property", + "string", + "type", + "util", + "utilities", + "utility", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "has-value", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/has-value.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "get-object", + "get-property", + "get-value", + "set-value" + ] + }, + "reflinks": [ + "verb" + ], + "lint": { + "reflinks": true + } + }, + "version": "0.3.1" +} diff --git a/node_modules/unset-value/node_modules/has-values/LICENSE b/node_modules/unset-value/node_modules/has-values/LICENSE new file mode 100644 index 0000000..39245ac --- /dev/null +++ b/node_modules/unset-value/node_modules/has-values/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2016, 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/node_modules/unset-value/node_modules/has-values/README.md b/node_modules/unset-value/node_modules/has-values/README.md new file mode 100644 index 0000000..13319c5 --- /dev/null +++ b/node_modules/unset-value/node_modules/has-values/README.md @@ -0,0 +1,114 @@ +# has-values [![NPM version](https://img.shields.io/npm/v/has-values.svg?style=flat)](https://www.npmjs.com/package/has-values) [![NPM downloads](https://img.shields.io/npm/dm/has-values.svg?style=flat)](https://npmjs.org/package/has-values) [![Build Status](https://img.shields.io/travis/jonschlinkert/has-values.svg?style=flat)](https://travis-ci.org/jonschlinkert/has-values) + +> Returns true if any values exist, false if empty. Works for booleans, functions, numbers, strings, nulls, objects and arrays. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install has-values --save +``` + +## Usage + +```js +var hasValue = require('has-values'); + +hasValue('a'); +//=> true + +hasValue(''); +//=> false + +hasValue(1); +//=> true + +hasValue(0); +//=> false + +hasValue(0, true); // treat zero as a value +//=> true + +hasValue({a: 'a'}}); +//=> true + +hasValue({}}); +//=> false + +hasValue(['a']); +//=> true + +hasValue([]); +//=> false + +hasValue(function(foo) {}); // function length/arity +//=> true + +hasValue(function() {}); +//=> false + +hasValue(true); +hasValue(false); +//=> true +``` + +## isEmpty + +To test for empty values, do: + +```js +function isEmpty(o, isZero) { + return !hasValue(o, isZero); +} +``` + +## Related projects + +You might also be interested in these projects: + +* [has-value](https://www.npmjs.com/package/has-value): Returns true if a value exists, false if empty. Works with deeply nested values using… [more](https://www.npmjs.com/package/has-value) | [homepage](https://github.com/jonschlinkert/has-value) +* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object) +* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject) + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/has-values/issues/new). + +## Building docs + +Generate readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm install verb && npm run docs +``` + +Or, if [verb](https://github.com/verbose/verb) is installed globally: + +```sh +$ verb +``` + +## Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +## Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT license](https://github.com/jonschlinkert/has-values/blob/master/LICENSE). + +*** + +_This file was generated by [verb](https://github.com/verbose/verb), v, on March 27, 2016._ \ No newline at end of file diff --git a/node_modules/unset-value/node_modules/has-values/index.js b/node_modules/unset-value/node_modules/has-values/index.js new file mode 100644 index 0000000..6d04ba1 --- /dev/null +++ b/node_modules/unset-value/node_modules/has-values/index.js @@ -0,0 +1,36 @@ +/*! + * has-values + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +module.exports = function hasValue(o, noZero) { + if (o === null || o === undefined) { + return false; + } + + if (typeof o === 'boolean') { + return true; + } + + if (typeof o === 'number') { + if (o === 0 && noZero === true) { + return false; + } + return true; + } + + if (o.length !== undefined) { + return o.length !== 0; + } + + for (var key in o) { + if (o.hasOwnProperty(key)) { + return true; + } + } + return false; +}; diff --git a/node_modules/unset-value/node_modules/has-values/package.json b/node_modules/unset-value/node_modules/has-values/package.json new file mode 100644 index 0000000..500d4d3 --- /dev/null +++ b/node_modules/unset-value/node_modules/has-values/package.json @@ -0,0 +1,106 @@ +{ + "_from": "has-values@^0.1.4", + "_id": "has-values@0.1.4", + "_inBundle": false, + "_integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "_location": "/unset-value/has-values", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "has-values@^0.1.4", + "name": "has-values", + "escapedName": "has-values", + "rawSpec": "^0.1.4", + "saveSpec": null, + "fetchSpec": "^0.1.4" + }, + "_requiredBy": [ + "/unset-value/has-value" + ], + "_resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "_shasum": "6d61de95d91dfca9b9a02089ad384bff8f62b771", + "_spec": "has-values@^0.1.4", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/unset-value/node_modules/has-value", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/has-values/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Returns true if any values exist, false if empty. Works for booleans, functions, numbers, strings, nulls, objects and arrays. ", + "devDependencies": { + "gulp-format-md": "^0.1.7", + "mocha": "^2.4.5" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/has-values", + "keywords": [ + "array", + "boolean", + "empty", + "find", + "function", + "has", + "hasOwn", + "javascript", + "js", + "key", + "keys", + "node.js", + "null", + "number", + "object", + "properties", + "property", + "string", + "type", + "util", + "utilities", + "utility", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "has-values", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/has-values.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "has-value", + "isobject", + "is-plain-object" + ] + }, + "reflinks": [ + "verb" + ], + "lint": { + "reflinks": true + } + }, + "version": "0.1.4" +} diff --git a/node_modules/unset-value/package.json b/node_modules/unset-value/package.json new file mode 100644 index 0000000..de84275 --- /dev/null +++ b/node_modules/unset-value/package.json @@ -0,0 +1,112 @@ +{ + "_from": "unset-value@^1.0.0", + "_id": "unset-value@1.0.0", + "_inBundle": false, + "_integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "_location": "/unset-value", + "_phantomChildren": { + "get-value": "2.0.6", + "isarray": "1.0.0" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "unset-value@^1.0.0", + "name": "unset-value", + "escapedName": "unset-value", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/cache-base" + ], + "_resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "_shasum": "8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559", + "_spec": "unset-value@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/cache-base", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/unset-value/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "email": "wtgtybhertgeghgtwtg@gmail.com", + "url": "https://github.com/wtgtybhertgeghgtwtg" + }, + { + "name": "Jon Schlinkert", + "email": "jon.schlinkert@sellside.com", + "url": "http://twitter.com/jonschlinkert" + } + ], + "dependencies": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "deprecated": false, + "description": "Delete nested properties from an object using dot notation.", + "devDependencies": { + "gulp-format-md": "^0.1.11", + "mocha": "*", + "should": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/unset-value", + "keywords": [ + "del", + "delete", + "key", + "object", + "omit", + "prop", + "property", + "remove", + "unset", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "unset-value", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/unset-value.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "get-value", + "get-values", + "omit-value", + "put-value", + "set-value", + "union-value", + "upsert-value" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + }, + "version": "1.0.0" +} diff --git a/node_modules/unzip-response/index.js b/node_modules/unzip-response/index.js new file mode 100644 index 0000000..e97b993 --- /dev/null +++ b/node_modules/unzip-response/index.js @@ -0,0 +1,36 @@ +'use strict'; +const PassThrough = require('stream').PassThrough; +const zlib = require('zlib'); + +module.exports = res => { + // TODO: use Array#includes when targeting Node.js 6 + if (['gzip', 'deflate'].indexOf(res.headers['content-encoding']) === -1) { + return res; + } + + const unzip = zlib.createUnzip(); + const stream = new PassThrough(); + + stream.httpVersion = res.httpVersion; + stream.headers = res.headers; + stream.rawHeaders = res.rawHeaders; + stream.trailers = res.trailers; + stream.rawTrailers = res.rawTrailers; + stream.setTimeout = res.setTimeout.bind(res); + stream.statusCode = res.statusCode; + stream.statusMessage = res.statusMessage; + stream.socket = res.socket; + + unzip.on('error', err => { + if (err.code === 'Z_BUF_ERROR') { + stream.end(); + return; + } + + stream.emit('error', err); + }); + + res.pipe(unzip).pipe(stream); + + return stream; +}; diff --git a/node_modules/unzip-response/license b/node_modules/unzip-response/license new file mode 100644 index 0000000..32a16ce --- /dev/null +++ b/node_modules/unzip-response/license @@ -0,0 +1,21 @@ +`The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/unzip-response/package.json b/node_modules/unzip-response/package.json new file mode 100644 index 0000000..9886fe1 --- /dev/null +++ b/node_modules/unzip-response/package.json @@ -0,0 +1,81 @@ +{ + "_from": "unzip-response@^2.0.1", + "_id": "unzip-response@2.0.1", + "_inBundle": false, + "_integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c=", + "_location": "/unzip-response", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unzip-response@^2.0.1", + "name": "unzip-response", + "escapedName": "unzip-response", + "rawSpec": "^2.0.1", + "saveSpec": null, + "fetchSpec": "^2.0.1" + }, + "_requiredBy": [ + "/got" + ], + "_resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", + "_shasum": "d2f0f737d16b0615e72a6935ed04214572d56f97", + "_spec": "unzip-response@^2.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/got", + "bugs": { + "url": "https://github.com/sindresorhus/unzip-response/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Unzip a HTTP response if needed", + "devDependencies": { + "ava": "*", + "get-stream": "^2.3.0", + "pify": "^2.3.0", + "rfpify": "^1.0.0", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/unzip-response#readme", + "keywords": [ + "http", + "unzip", + "zlib", + "gzip", + "deflate", + "incoming", + "message", + "response", + "stream" + ], + "license": "MIT", + "maintainers": [ + { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + { + "name": "Vsevolod Strukchinsky", + "email": "floatdrop@gmail.com", + "url": "github.com/floatdrop" + } + ], + "name": "unzip-response", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/unzip-response.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "2.0.1", + "xo": { + "esnext": true + } +} diff --git a/node_modules/unzip-response/readme.md b/node_modules/unzip-response/readme.md new file mode 100644 index 0000000..87a62c4 --- /dev/null +++ b/node_modules/unzip-response/readme.md @@ -0,0 +1,29 @@ +# unzip-response [![Build Status](https://travis-ci.org/sindresorhus/unzip-response.svg?branch=master)](https://travis-ci.org/sindresorhus/unzip-response) + +> Unzip a HTTP response if needed + +Unzips the response from [`http.request`](https://nodejs.org/api/http.html#http_http_request_options_callback) if it's gzipped/deflated, otherwise just passes it through. + + +## Install + +``` +$ npm install --save unzip-response +``` + + +## Usage + +```js +const http = require('http'); +const unzipResponse = require('unzip-response'); + +http.get('http://sindresorhus.com', res => { + res = unzipResponse(res); +}); +``` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/upath/LICENSE b/node_modules/upath/LICENSE new file mode 100755 index 0000000..1ce5a29 --- /dev/null +++ b/node_modules/upath/LICENSE @@ -0,0 +1,22 @@ +Copyright(c) 2014-2017 Angelos Pikoulas (agelos.pikoulas@gmail.com) + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/upath/build/code/upath.js b/node_modules/upath/build/code/upath.js new file mode 100644 index 0000000..90ec6ee --- /dev/null +++ b/node_modules/upath/build/code/upath.js @@ -0,0 +1,169 @@ +/** +* upath http://github.com/anodynos/upath/ +* +* A proxy to `path`, replacing `\` with `/` for all results & new methods to normalize & join keeping leading `./` and add, change, default, trim file extensions. +* Version 1.0.4 - Compiled on 2018-02-26 00:12:05 +* Repository git://github.com/anodynos/upath +* Copyright(c) 2018 Angelos Pikoulas +* License MIT +*/ + +// Generated by uRequire v0.7.0-beta.33 target: 'lib' template: 'nodejs' + + +var VERSION = '1.0.4'; // injected by urequire-rc-inject-version + +var extraFn, extraFunctions, isFunction, isString, isValidExt, name, path, propName, propValue, toUnix, upath, slice = [].slice, indexOf = [].indexOf || function (item) { + for (var i = 0, l = this.length; i < l; i++) { + if (i in this && this[i] === item) + return i; + } + return -1; + }; +path = require("path"); +isFunction = function (val) { + return val instanceof Function; +}; +isString = function (val) { + return typeof val === "string" || !!val && typeof val === "object" && Object.prototype.toString.call(val) === "[object String]"; +}; +upath = exports; +upath.VERSION = typeof VERSION !== "undefined" && VERSION !== null ? VERSION : "NO-VERSION"; +toUnix = function (p) { + var double; + p = p.replace(/\\/g, "/"); + double = /\/\//; + while (p.match(double)) { + p = p.replace(double, "/"); + } + return p; +}; +for (propName in path) { + propValue = path[propName]; + if (isFunction(propValue)) { + upath[propName] = function (propName) { + return function () { + var args, result; + args = 1 <= arguments.length ? slice.call(arguments, 0) : []; + args = args.map(function (p) { + if (isString(p)) { + return toUnix(p); + } else { + return p; + } + }); + result = path[propName].apply(path, args); + if (isString(result)) { + return toUnix(result); + } else { + return result; + } + }; + }(propName); + } else { + upath[propName] = propValue; + } +} +upath.sep = "/"; +extraFunctions = { + toUnix: toUnix, + normalizeSafe: function (p) { + p = toUnix(p); + if (p.startsWith("./")) { + if (p.startsWith("./..") || p === "./") { + return upath.normalize(p); + } else { + return "./" + upath.normalize(p); + } + } else { + return upath.normalize(p); + } + }, + normalizeTrim: function (p) { + p = upath.normalizeSafe(p); + if (p.endsWith("/")) { + return p.slice(0, +(p.length - 2) + 1 || 9000000000); + } else { + return p; + } + }, + joinSafe: function () { + var p, result; + p = 1 <= arguments.length ? slice.call(arguments, 0) : []; + result = upath.join.apply(null, p); + if (p[0].startsWith("./") && !result.startsWith("./")) { + result = "./" + result; + } + return result; + }, + addExt: function (file, ext) { + if (!ext) { + return file; + } else { + if (ext[0] !== ".") { + ext = "." + ext; + } + return file + (file.endsWith(ext) ? "" : ext); + } + }, + trimExt: function (filename, ignoreExts, maxSize) { + var oldExt; + if (maxSize == null) { + maxSize = 7; + } + oldExt = upath.extname(filename); + if (isValidExt(oldExt, ignoreExts, maxSize)) { + return filename.slice(0, +(filename.length - oldExt.length - 1) + 1 || 9000000000); + } else { + return filename; + } + }, + removeExt: function (filename, ext) { + if (!ext) { + return filename; + } else { + ext = ext[0] === "." ? ext : "." + ext; + if (upath.extname(filename) === ext) { + return upath.trimExt(filename); + } else { + return filename; + } + } + }, + changeExt: function (filename, ext, ignoreExts, maxSize) { + if (maxSize == null) { + maxSize = 7; + } + return upath.trimExt(filename, ignoreExts, maxSize) + (!ext ? "" : ext[0] === "." ? ext : "." + ext); + }, + defaultExt: function (filename, ext, ignoreExts, maxSize) { + var oldExt; + if (maxSize == null) { + maxSize = 7; + } + oldExt = upath.extname(filename); + if (isValidExt(oldExt, ignoreExts, maxSize)) { + return filename; + } else { + return upath.addExt(filename, ext); + } + } +}; +isValidExt = function (ext, ignoreExts, maxSize) { + if (ignoreExts == null) { + ignoreExts = []; + } + return ext && ext.length <= maxSize && indexOf.call(ignoreExts.map(function (e) { + return (e && e[0] !== "." ? "." : "") + e; + }), ext) < 0; +}; +for (name in extraFunctions) { + extraFn = extraFunctions[name]; + if (upath[name] !== void 0) { + throw new Error("path." + name + " already exists."); + } else { + upath[name] = extraFn; + } +} + +; \ No newline at end of file diff --git a/node_modules/upath/package.json b/node_modules/upath/package.json new file mode 100644 index 0000000..aecc458 --- /dev/null +++ b/node_modules/upath/package.json @@ -0,0 +1,84 @@ +{ + "_from": "upath@^1.0.0", + "_id": "upath@1.0.4", + "_inBundle": false, + "_integrity": "sha512-d4SJySNBXDaQp+DPrziv3xGS6w3d2Xt69FijJr86zMPBy23JEloMCEOUBBzuN7xCtjLCnmB9tI/z7SBCahHBOw==", + "_location": "/upath", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "upath@^1.0.0", + "name": "upath", + "escapedName": "upath", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/chokidar" + ], + "_resolved": "https://registry.npmjs.org/upath/-/upath-1.0.4.tgz", + "_shasum": "ee2321ba0a786c50973db043a50b7bcba822361d", + "_spec": "upath@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/chokidar", + "author": { + "name": "Angelos Pikoulas", + "email": "agelos.pikoulas@gmail.com" + }, + "bugs": { + "url": "http://github.com/anodynos/upath/issues", + "email": "agelos.pikoulas@gmail.com" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "A proxy to `path`, replacing `\\` with `/` for all results & new methods to normalize & join keeping leading `./` and add, change, default, trim file extensions.", + "devDependencies": { + "chai": "~4.0.2", + "coffee-script": "1.12.6", + "grunt": "0.4.5", + "grunt-contrib-watch": "~1.0.0", + "grunt-urequire": "0.7.x", + "lodash": "^4.17.4", + "mocha": "~3.4.2", + "uberscore": "0.0.19", + "underscore.string": "~3.3.4", + "urequire": "0.7.0-beta.33", + "urequire-ab-specrunner": "^0.2.5", + "urequire-rc-inject-version": "^0.1.6" + }, + "directories": { + "doc": "./doc", + "dist": "./build" + }, + "engines": { + "node": ">=4 <=9" + }, + "homepage": "http://github.com/anodynos/upath/", + "keywords": [ + "path", + "unix", + "windows", + "extension", + "file extension", + "replace extension", + "change extension", + "trim extension", + "add extension", + "default extension" + ], + "license": "MIT", + "main": "./build/code/upath.js", + "name": "upath", + "preferGlobal": false, + "repository": { + "type": "git", + "url": "git://github.com/anodynos/upath.git" + }, + "scripts": { + "build": "grunt lib", + "test": "grunt" + }, + "types": "./upath.d.ts", + "version": "1.0.4" +} diff --git a/node_modules/upath/readme.md b/node_modules/upath/readme.md new file mode 100644 index 0000000..2badbe3 --- /dev/null +++ b/node_modules/upath/readme.md @@ -0,0 +1,331 @@ +# upath v1.0.4 + +[![Build Status](https://travis-ci.org/anodynos/upath.svg?branch=master)](https://travis-ci.org/anodynos/upath) +[![Up to date Status](https://david-dm.org/anodynos/upath.png)](https://david-dm.org/anodynos/upath) + +A drop-in replacement / proxy to nodejs's `path` that: + + * Replaces the windows `\` with the unix `/` in all string params & results. This has significant positives - see below. + + * Adds **filename extensions** functions `addExt`, `trimExt`, `removeExt`, `changeExt`, and `defaultExt`. + + * Add a `normalizeSafe` function to preserve any meaningful leading `./` & a `normalizeTrim` which additionally trims any useless ending `/`. + + * Plus a helper `toUnix` that simply converts `\` to `/` and consolidates duplicates. + +**Useful note: these docs are actually auto generated from [specs](https://github.com/anodynos/upath/blob/master/source/spec/upath-spec.coffee), running on Linux.** + +Notes: + + * `upath.sep` is set to `'/'` for seamless replacement (as of 1.0.3). + + * upath has no runtime dependencies, except built-in `path` (as of 1.0.4) + +## Why ? + +Normal `path` doesn't convert paths to a unified format (ie `/`) before calculating paths (`normalize`, `join`), which can lead to numerous problems. +Also path joining, normalization etc on the two formats is not consistent, depending on where it runs. Running `path` on Windows yields different results than when it runs on Linux / Mac. + +In general, if you code your paths logic while developing on Unix/Mac and it runs on Windows, you may run into problems when using `path`. + +Note that using **Unix `/` on Windows** works perfectly inside nodejs (and other languages), so there's no reason to stick to the Windows legacy at all. + +##### Examples / specs + + +Check out the different (improved) behavior to vanilla `path`: + + `upath.normalize(path)` --returns--> + + ✓ `'c:/windows/nodejs/path'` ---> `'c:/windows/nodejs/path'` // equal to `path.normalize()` + ✓ `'c:/windows/../nodejs/path'` ---> `'c:/nodejs/path'` // equal to `path.normalize()` + ✓ `'c:\\windows\\nodejs\\path'` ---> `'c:/windows/nodejs/path'` // `path.normalize()` gives `'c:\windows\nodejs\path'` + ✓ `'c:\\windows\\..\\nodejs\\path'` ---> `'c:/nodejs/path'` // `path.normalize()` gives `'c:\windows\..\nodejs\path'` + ✓ `'//windows\\unix/mixed'` ---> `'/windows/unix/mixed'` // `path.normalize()` gives `'/windows\unix/mixed'` + ✓ `'\\windows//unix/mixed'` ---> `'/windows/unix/mixed'` // `path.normalize()` gives `'\windows/unix/mixed'` + ✓ `'////\\windows\\..\\unix/mixed/'` ---> `'/unix/mixed/'` // `path.normalize()` gives `'/\windows\..\unix/mixed/'` + + +Joining paths can also be a problem: + + `upath.join(paths...)` --returns--> + + ✓ `'some/nodejs/deep', '../path'` ---> `'some/nodejs/path'` // equal to `path.join()` + ✓ `'some/nodejs\\windows', '../path'` ---> `'some/nodejs/path'` // `path.join()` gives `'some/path'` + ✓ `'some\\windows\\only', '..\\path'` ---> `'some/windows/path'` // `path.join()` gives `'some\windows\only/..\path'` + + +Parsing with `path.parse()` should also be consistent across OSes: + + `upath.parse(path)` --returns--> + + ✓ `'c:\Windows\Directory\somefile.ext'` ---> `{ root: '', dir: 'c:/Windows/Directory', base: 'somefile.ext', ext: '.ext', name: 'somefile' }` + // `path.parse()` gives `'{ root: '', dir: '', base: 'c:\\Windows\\Directory\\somefile.ext', ext: '.ext', name: 'c:\\Windows\\Directory\\somefile' }'` + ✓ `'/root/of/unix/somefile.ext'` ---> `{ root: '/', dir: '/root/of/unix', base: 'somefile.ext', ext: '.ext', name: 'somefile' }` // equal to `path.parse()` + + +## Added functions + + +#### `upath.toUnix(path)` + +Just converts all `` to `/` and consolidates duplicates, without performing any normalization. + +##### Examples / specs + + `upath.toUnix(path)` --returns--> + + ✓ `'.//windows\//unix//mixed////'` ---> `'./windows/unix/mixed/'` + ✓ `'..///windows\..\\unix/mixed'` ---> `'../windows/../unix/mixed'` + + +#### `upath.normalizeSafe(path)` + +Exactly like `path.normalize(path)`, but it keeps the first meaningful `./`. + +Note that the unix `/` is returned everywhere, so windows `\` is always converted to unix `/`. + +##### Examples / specs & how it differs from vanilla `path` + + `upath.normalizeSafe(path)` --returns--> + + ✓ `''` ---> `'.'` // equal to `path.normalize()` + ✓ `'.'` ---> `'.'` // equal to `path.normalize()` + ✓ `'./'` ---> `'./'` // equal to `path.normalize()` + ✓ `'.//'` ---> `'./'` // equal to `path.normalize()` + ✓ `'.\\'` ---> `'./'` // `path.normalize()` gives `'.\'` + ✓ `'.\\//'` ---> `'./'` // `path.normalize()` gives `'.\/'` + ✓ `'./..'` ---> `'..'` // equal to `path.normalize()` + ✓ `'.//..'` ---> `'..'` // equal to `path.normalize()` + ✓ `'./../'` ---> `'../'` // equal to `path.normalize()` + ✓ `'.\\..\\'` ---> `'../'` // `path.normalize()` gives `'.\..\'` + ✓ `'./../dep'` ---> `'../dep'` // equal to `path.normalize()` + ✓ `'../dep'` ---> `'../dep'` // equal to `path.normalize()` + ✓ `'../path/dep'` ---> `'../path/dep'` // equal to `path.normalize()` + ✓ `'../path/../dep'` ---> `'../dep'` // equal to `path.normalize()` + ✓ `'dep'` ---> `'dep'` // equal to `path.normalize()` + ✓ `'path//dep'` ---> `'path/dep'` // equal to `path.normalize()` + ✓ `'./dep'` ---> `'./dep'` // `path.normalize()` gives `'dep'` + ✓ `'./path/dep'` ---> `'./path/dep'` // `path.normalize()` gives `'path/dep'` + ✓ `'./path/../dep'` ---> `'./dep'` // `path.normalize()` gives `'dep'` + ✓ `'.//windows\\unix/mixed/'` ---> `'./windows/unix/mixed/'` // `path.normalize()` gives `'windows\unix/mixed/'` + ✓ `'..//windows\\unix/mixed'` ---> `'../windows/unix/mixed'` // `path.normalize()` gives `'../windows\unix/mixed'` + ✓ `'windows\\unix/mixed/'` ---> `'windows/unix/mixed/'` // `path.normalize()` gives `'windows\unix/mixed/'` + ✓ `'..//windows\\..\\unix/mixed'` ---> `'../unix/mixed'` // `path.normalize()` gives `'../windows\..\unix/mixed'` + + +#### `upath.normalizeTrim(path)` + +Exactly like `path.normalizeSafe(path)`, but it trims any useless ending `/`. + +##### Examples / specs + + `upath.normalizeTrim(path)` --returns--> + + ✓ `'./'` ---> `'.'` // `upath.normalizeSafe()` gives `'./'` + ✓ `'./../'` ---> `'..'` // `upath.normalizeSafe()` gives `'../'` + ✓ `'./../dep/'` ---> `'../dep'` // `upath.normalizeSafe()` gives `'../dep/'` + ✓ `'path//dep\\'` ---> `'path/dep'` // `upath.normalizeSafe()` gives `'path/dep/'` + ✓ `'.//windows\\unix/mixed/'` ---> `'./windows/unix/mixed'` // `upath.normalizeSafe()` gives `'./windows/unix/mixed/'` + + +#### `upath.joinSafe([path1][, path2][, ...])` + +Exactly like `path.join()`, but it keeps the first meaningful `./`. + +Note that the unix `/` is returned everywhere, so windows `\` is always converted to unix `/`. + +##### Examples / specs & how it differs from vanilla `path` + + `upath.joinSafe(path)` --returns--> + + ✓ `'some/nodejs/deep', '../path'` ---> `'some/nodejs/path'` // equal to `path.join()` + ✓ `'./some/local/unix/', '../path'` ---> `'./some/local/path'` // `path.join()` gives `'some/local/path'` + ✓ `'./some\\current\\mixed', '..\\path'` ---> `'./some/current/path'` // `path.join()` gives `'some\current\mixed/..\path'` + ✓ `'../some/relative/destination', '..\\path'` ---> `'../some/relative/path'` // `path.join()` gives `'../some/relative/destination/..\path'` + + +## Added functions for *filename extension* manipulation. + +**Happy notes:** + + In all functions you can: + + * use both `.ext` & `ext` - the dot `.` on the extension is always adjusted correctly. + + * omit the `ext` param (pass null/undefined/empty string) and the common sense thing will happen. + + * ignore specific extensions from being considered as valid ones (eg `.min`, `.dev` `.aLongExtIsNotAnExt` etc), hence no trimming or replacement takes place on them. + + + +#### `upath.addExt(filename, [ext])` + +Adds `.ext` to `filename`, but only if it doesn't already have the exact extension. + +##### Examples / specs + + `upath.addExt(filename, 'js')` --returns--> + + ✓ `'myfile/addExt'` ---> `'myfile/addExt.js'` + ✓ `'myfile/addExt.txt'` ---> `'myfile/addExt.txt.js'` + ✓ `'myfile/addExt.js'` ---> `'myfile/addExt.js'` + ✓ `'myfile/addExt.min.'` ---> `'myfile/addExt.min..js'` + + +It adds nothing if no `ext` param is passed. + + `upath.addExt(filename)` --returns--> + + ✓ `'myfile/addExt'` ---> `'myfile/addExt'` + ✓ `'myfile/addExt.txt'` ---> `'myfile/addExt.txt'` + ✓ `'myfile/addExt.js'` ---> `'myfile/addExt.js'` + ✓ `'myfile/addExt.min.'` ---> `'myfile/addExt.min.'` + + +#### `upath.trimExt(filename, [ignoreExts], [maxSize=7])` + +Trims a filename's extension. + + * Extensions are considered to be up to `maxSize` chars long, counting the dot (defaults to 7). + + * An `Array` of `ignoreExts` (eg `['.min']`) prevents these from being considered as extension, thus are not trimmed. + +##### Examples / specs + + `upath.trimExt(filename)` --returns--> + + ✓ `'my/trimedExt.txt'` ---> `'my/trimedExt'` + ✓ `'my/trimedExt'` ---> `'my/trimedExt'` + ✓ `'my/trimedExt.min'` ---> `'my/trimedExt'` + ✓ `'my/trimedExt.min.js'` ---> `'my/trimedExt.min'` + ✓ `'../my/trimedExt.longExt'` ---> `'../my/trimedExt.longExt'` + + +It is ignoring `.min` & `.dev` as extensions, and considers exts with up to 8 chars. + + `upath.removeExt(filename, ['min', '.dev'], 8)` --returns--> + + ✓ `'my/trimedExt.txt'` ---> `'my/trimedExt'` + ✓ `'my/trimedExt.min'` ---> `'my/trimedExt.min'` + ✓ `'my/trimedExt.dev'` ---> `'my/trimedExt.dev'` + ✓ `'../my/trimedExt.longExt'` ---> `'../my/trimedExt'` + ✓ `'../my/trimedExt.longRExt'` ---> `'../my/trimedExt.longRExt'` + + +#### `upath.removeExt(filename, ext)` + +Removes the specific `ext` extension from filename, if it has it. Otherwise it leaves it as is. +As in all upath functions, it be `.ext` or `ext`. + +##### Examples / specs + + `upath.removeExt(filename, '.js')` --returns--> + + ✓ `'removedExt.js'` ---> `'removedExt'` + ✓ `'removedExt.txt.js'` ---> `'removedExt.txt'` + ✓ `'notRemoved.txt'` ---> `'notRemoved.txt'` + + +#### `upath.changeExt(filename, [ext], [ignoreExts], [maxSize=7])` + +Changes a filename's extension to `ext`. If it has no (valid) extension, it adds it. + + * Valid extensions are considered to be up to `maxSize` chars long, counting the dot (defaults to 7). + + * An `Array` of `ignoreExts` (eg `['.min']`) prevents these from being considered as extension, thus are not changed - the new extension is added instead. + +##### Examples / specs + + `upath.changeExt(filename, '.js')` --returns--> + + ✓ `'my/module.min'` ---> `'my/module.js'` + ✓ `'my/module.coffee'` ---> `'my/module.js'` + ✓ `'my/module'` ---> `'my/module.js'` + ✓ `'file/withDot.'` ---> `'file/withDot.js'` + ✓ `'file/change.longExt'` ---> `'file/change.longExt.js'` + + +If no `ext` param is given, it trims the current extension (if any). + + `upath.changeExt(filename)` --returns--> + + ✓ `'my/module.min'` ---> `'my/module'` + ✓ `'my/module.coffee'` ---> `'my/module'` + ✓ `'my/module'` ---> `'my/module'` + ✓ `'file/withDot.'` ---> `'file/withDot'` + ✓ `'file/change.longExt'` ---> `'file/change.longExt'` + + +It is ignoring `.min` & `.dev` as extensions, and considers exts with up to 8 chars. + + `upath.changeExt(filename, 'js', ['min', '.dev'], 8)` --returns--> + + ✓ `'my/module.coffee'` ---> `'my/module.js'` + ✓ `'file/notValidExt.min'` ---> `'file/notValidExt.min.js'` + ✓ `'file/notValidExt.dev'` ---> `'file/notValidExt.dev.js'` + ✓ `'file/change.longExt'` ---> `'file/change.js'` + ✓ `'file/change.longRExt'` ---> `'file/change.longRExt.js'` + + +#### `upath.defaultExt(filename, [ext], [ignoreExts], [maxSize=7])` + +Adds `.ext` to `filename`, only if it doesn't already have _any_ *old* extension. + + * (Old) extensions are considered to be up to `maxSize` chars long, counting the dot (defaults to 7). + + * An `Array` of `ignoreExts` (eg `['.min']`) will force adding default `.ext` even if one of these is present. + +##### Examples / specs + + `upath.defaultExt(filename, 'js')` --returns--> + + ✓ `'fileWith/defaultExt'` ---> `'fileWith/defaultExt.js'` + ✓ `'fileWith/defaultExt.js'` ---> `'fileWith/defaultExt.js'` + ✓ `'fileWith/defaultExt.min'` ---> `'fileWith/defaultExt.min'` + ✓ `'fileWith/defaultExt.longExt'` ---> `'fileWith/defaultExt.longExt.js'` + + +If no `ext` param is passed, it leaves filename intact. + + `upath.defaultExt(filename)` --returns--> + + ✓ `'fileWith/defaultExt'` ---> `'fileWith/defaultExt'` + ✓ `'fileWith/defaultExt.js'` ---> `'fileWith/defaultExt.js'` + ✓ `'fileWith/defaultExt.min'` ---> `'fileWith/defaultExt.min'` + ✓ `'fileWith/defaultExt.longExt'` ---> `'fileWith/defaultExt.longExt'` + + +It is ignoring `.min` & `.dev` as extensions, and considers exts with up to 8 chars. + + `upath.defaultExt(filename, 'js', ['min', '.dev'], 8)` --returns--> + + ✓ `'fileWith/defaultExt'` ---> `'fileWith/defaultExt.js'` + ✓ `'fileWith/defaultExt.min'` ---> `'fileWith/defaultExt.min.js'` + ✓ `'fileWith/defaultExt.dev'` ---> `'fileWith/defaultExt.dev.js'` + ✓ `'fileWith/defaultExt.longExt'` ---> `'fileWith/defaultExt.longExt'` + ✓ `'fileWith/defaultExt.longRext'` ---> `'fileWith/defaultExt.longRext.js'` + + +Copyright(c) 2014-2017 Angelos Pikoulas (agelos.pikoulas@gmail.com) + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/upath/upath.d.ts b/node_modules/upath/upath.d.ts new file mode 100644 index 0000000..98b7c5f --- /dev/null +++ b/node_modules/upath/upath.d.ts @@ -0,0 +1,239 @@ +declare module "upath" { + + /** + * A parsed path object generated by path.parse() or consumed by path.format(). + */ + export interface ParsedPath { + /** + * The root of the path such as '/' or 'c:\' + */ + root: string; + /** + * The full directory path such as '/home/user/dir' or 'c:\path\dir' + */ + dir: string; + /** + * The file name including extension (if any) such as 'index.html' + */ + base: string; + /** + * The file extension (if any) such as '.html' + */ + ext: string; + /** + * The file name without extension (if any) such as 'index' + */ + name: string; + } + + /** + * Version of the library + */ + export var VERSION: string; + + /** + * Just converts all `to/` and consolidates duplicates, without performing any normalization. + * + * @param p string path to convert to unix. + */ + export function toUnix(p: string): string; + + /** + * Exactly like path.normalize(path), but it keeps the first meaningful ./. + * + * Note that the unix / is returned everywhere, so windows \ is always converted to unix /. + * + * @param p string path to normalize. + */ + export function normalizeSafe(p: string): string; + + /** + * Exactly like path.normalizeSafe(path), but it trims any useless ending /. + * + * @param p string path to normalize + */ + export function normalizeTrim(p: string): string; + + /** + * Exactly like path.join(), but it keeps the first meaningful ./. + * + * Note that the unix / is returned everywhere, so windows \ is always converted to unix /. + * + * @param paths string paths to join + */ + export function joinSafe(...p: any[]): string; + + /** + * Adds .ext to filename, but only if it doesn't already have the exact extension. + * + * @param file string filename to add extension to + * @param ext string extension to add + */ + export function addExt(file: string, ext: string): string; + + /** + * Trims a filename's extension. + * + * Extensions are considered to be up to maxSize chars long, counting the dot (defaults to 7). + * + * An Array of ignoreExts (eg ['.min']) prevents these from being considered as extension, thus are not trimmed. + * + * @param filename string filename to trim it's extension + * @param ignoreExts array extensions to ignore + * @param maxSize number max length of the extension + */ + export function trimExt(filename: string, ignoreExts?: string[], maxSize?: number): string; + + /** + * Removes the specific ext extension from filename, if it has it. Otherwise it leaves it as is. As in all upath functions, it be .ext or ext. + * + * @param file string filename to remove extension to + * @param ext string extension to remove + */ + export function removeExt(filename: string, ext: string): string; + + /** + * Changes a filename's extension to ext. If it has no (valid) extension, it adds it. + * + * Valid extensions are considered to be up to maxSize chars long, counting the dot (defaults to 7). + * + * An Array of ignoreExts (eg ['.min']) prevents these from being considered as extension, thus are not changed - the new extension is added instead. + * + * @param filename string filename to change it's extension + * @param ext string extension to change to + * @param ignoreExts array extensions to ignore + * @param maxSize number max length of the extension + */ + export function changeExt(filename: string, ext: string, ignoreExts?: string[], maxSize?: number): string; + + /** + * Adds .ext to filename, only if it doesn't already have any old extension. + * + * (Old) extensions are considered to be up to maxSize chars long, counting the dot (defaults to 7). + * + * An Array of ignoreExts (eg ['.min']) will force adding default .ext even if one of these is present. + * + * @param filename string filename to default to it's extension + * @param ext string extension to default to + * @param ignoreExts array extensions to ignore + * @param maxSize number max length of the extension + */ + export function defaultExt(filename: string, ext: string, ignoreExts?: string[], maxSize?: number): string; + + /** + * Normalize a string path, reducing '..' and '.' parts. + * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. + * + * @param p string path to normalize. + */ + export function normalize(p: string): string; + /** + * Join all arguments together and normalize the resulting path. + * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. + * + * @param paths string paths to join. + */ + export function join(...paths: any[]): string; + /** + * Join all arguments together and normalize the resulting path. + * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. + * + * @param paths string paths to join. + */ + export function join(...paths: string[]): string; + /** + * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. + * + * Starting from leftmost {from} paramter, resolves {to} to an absolute path. + * + * If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory. + * + * @param pathSegments string paths to join. Non-string arguments are ignored. + */ + export function resolve(...pathSegments: any[]): string; + /** + * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. + * + * @param path path to test. + */ + export function isAbsolute(path: string): boolean; + /** + * Solve the relative path from {from} to {to}. + * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. + * + * @param from + * @param to + */ + export function relative(from: string, to: string): string; + /** + * Return the directory name of a path. Similar to the Unix dirname command. + * + * @param p the path to evaluate. + */ + export function dirname(p: string): string; + /** + * Return the last portion of a path. Similar to the Unix basename command. + * Often used to extract the file name from a fully qualified path. + * + * @param p the path to evaluate. + * @param ext optionally, an extension to remove from the result. + */ + export function basename(p: string, ext?: string): string; + /** + * Return the extension of the path, from the last '.' to end of string in the last portion of the path. + * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string + * + * @param p the path to evaluate. + */ + export function extname(p: string): string; + /** + * The platform-specific file separator. '\\' or '/'. + */ + export var sep: string; + /** + * The platform-specific file delimiter. ';' or ':'. + */ + export var delimiter: string; + /** + * Returns an object from a path string - the opposite of format(). + * + * @param pathString path to evaluate. + */ + export function parse(pathString: string): ParsedPath; + /** + * Returns a path string from an object - the opposite of parse(). + * + * @param pathString path to evaluate. + */ + export function format(pathObject: ParsedPath): string; + + export module posix { + export function normalize(p: string): string; + export function join(...paths: any[]): string; + export function resolve(...pathSegments: any[]): string; + export function isAbsolute(p: string): boolean; + export function relative(from: string, to: string): string; + export function dirname(p: string): string; + export function basename(p: string, ext?: string): string; + export function extname(p: string): string; + export var sep: string; + export var delimiter: string; + export function parse(p: string): ParsedPath; + export function format(pP: ParsedPath): string; + } + + export module win32 { + export function normalize(p: string): string; + export function join(...paths: any[]): string; + export function resolve(...pathSegments: any[]): string; + export function isAbsolute(p: string): boolean; + export function relative(from: string, to: string): string; + export function dirname(p: string): string; + export function basename(p: string, ext?: string): string; + export function extname(p: string): string; + export var sep: string; + export var delimiter: string; + export function parse(p: string): ParsedPath; + export function format(pP: ParsedPath): string; + } +} diff --git a/node_modules/update-notifier/check.js b/node_modules/update-notifier/check.js new file mode 100644 index 0000000..521f84a --- /dev/null +++ b/node_modules/update-notifier/check.js @@ -0,0 +1,22 @@ +/* eslint-disable unicorn/no-process-exit */ +'use strict'; +let updateNotifier = require('.'); + +const options = JSON.parse(process.argv[2]); + +updateNotifier = new updateNotifier.UpdateNotifier(options); + +updateNotifier.checkNpm().then(update => { + // Only update the last update check time on success + updateNotifier.config.set('lastUpdateCheck', Date.now()); + + if (update.type && update.type !== 'latest') { + updateNotifier.config.set('update', update); + } + + // Call process exit explicitly to terminate the child process + // Otherwise the child process will run forever, according to the Node.js docs + process.exit(); +}).catch(() => { + process.exit(1); +}); diff --git a/node_modules/update-notifier/index.js b/node_modules/update-notifier/index.js new file mode 100644 index 0000000..58f2459 --- /dev/null +++ b/node_modules/update-notifier/index.js @@ -0,0 +1,151 @@ +'use strict'; +const spawn = require('child_process').spawn; +const path = require('path'); +const format = require('util').format; +const importLazy = require('import-lazy')(require); + +const configstore = importLazy('configstore'); +const chalk = importLazy('chalk'); +const semverDiff = importLazy('semver-diff'); +const latestVersion = importLazy('latest-version'); +const isNpm = importLazy('is-npm'); +const isInstalledGlobally = importLazy('is-installed-globally'); +const boxen = importLazy('boxen'); +const xdgBasedir = importLazy('xdg-basedir'); +const ONE_DAY = 1000 * 60 * 60 * 24; + +class UpdateNotifier { + constructor(options) { + options = options || {}; + this.options = options; + options.pkg = options.pkg || {}; + + // Reduce pkg to the essential keys. with fallback to deprecated options + // TODO: Remove deprecated options at some point far into the future + options.pkg = { + name: options.pkg.name || options.packageName, + version: options.pkg.version || options.packageVersion + }; + + if (!options.pkg.name || !options.pkg.version) { + throw new Error('pkg.name and pkg.version required'); + } + + this.packageName = options.pkg.name; + this.packageVersion = options.pkg.version; + this.updateCheckInterval = typeof options.updateCheckInterval === 'number' ? options.updateCheckInterval : ONE_DAY; + this.hasCallback = typeof options.callback === 'function'; + this.callback = options.callback || (() => {}); + this.disabled = 'NO_UPDATE_NOTIFIER' in process.env || + process.argv.indexOf('--no-update-notifier') !== -1; + + if (!this.disabled && !this.hasCallback) { + try { + const ConfigStore = configstore(); + this.config = new ConfigStore(`update-notifier-${this.packageName}`, { + optOut: false, + // Init with the current time so the first check is only + // after the set interval, so not to bother users right away + lastUpdateCheck: Date.now() + }); + } catch (err) { + // Expecting error code EACCES or EPERM + const msg = + chalk().yellow(format(' %s update check failed ', options.pkg.name)) + + format('\n Try running with %s or get access ', chalk().cyan('sudo')) + + '\n to the local update config store via \n' + + chalk().cyan(format(' sudo chown -R $USER:$(id -gn $USER) %s ', xdgBasedir().config)); + + process.on('exit', () => { + console.error('\n' + boxen()(msg, {align: 'center'})); + }); + } + } + } + check() { + if (this.hasCallback) { + this.checkNpm() + .then(update => this.callback(null, update)) + .catch(err => this.callback(err)); + return; + } + + if ( + !this.config || + this.config.get('optOut') || + this.disabled + ) { + return; + } + + this.update = this.config.get('update'); + + if (this.update) { + this.config.delete('update'); + } + + // Only check for updates on a set interval + if (Date.now() - this.config.get('lastUpdateCheck') < this.updateCheckInterval) { + return; + } + + // Spawn a detached process, passing the options as an environment property + spawn(process.execPath, [path.join(__dirname, 'check.js'), JSON.stringify(this.options)], { + detached: true, + stdio: 'ignore' + }).unref(); + } + checkNpm() { + return latestVersion()(this.packageName).then(latestVersion => { + return { + latest: latestVersion, + current: this.packageVersion, + type: semverDiff()(this.packageVersion, latestVersion) || 'latest', + name: this.packageName + }; + }); + } + notify(opts) { + if (!process.stdout.isTTY || isNpm() || !this.update) { + return this; + } + + opts = Object.assign({isGlobal: isInstalledGlobally()}, opts); + + opts.message = opts.message || 'Update available ' + chalk().dim(this.update.current) + chalk().reset(' → ') + + chalk().green(this.update.latest) + ' \nRun ' + chalk().cyan('npm i ' + (opts.isGlobal ? '-g ' : '') + this.packageName) + ' to update'; + + opts.boxenOpts = opts.boxenOpts || { + padding: 1, + margin: 1, + align: 'center', + borderColor: 'yellow', + borderStyle: 'round' + }; + + const message = '\n' + boxen()(opts.message, opts.boxenOpts); + + if (opts.defer === false) { + console.error(message); + } else { + process.on('exit', () => { + console.error(message); + }); + + process.on('SIGINT', () => { + console.error(''); + process.exit(); + }); + } + + return this; + } +} + +module.exports = options => { + const updateNotifier = new UpdateNotifier(options); + updateNotifier.check(); + return updateNotifier; +}; + +module.exports.UpdateNotifier = UpdateNotifier; diff --git a/node_modules/update-notifier/package.json b/node_modules/update-notifier/package.json new file mode 100644 index 0000000..167d9ae --- /dev/null +++ b/node_modules/update-notifier/package.json @@ -0,0 +1,85 @@ +{ + "_from": "update-notifier@^2.3.0", + "_id": "update-notifier@2.3.0", + "_inBundle": false, + "_integrity": "sha1-TognpruRUUCrCTVZ1wFOPruDdFE=", + "_location": "/update-notifier", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "update-notifier@^2.3.0", + "name": "update-notifier", + "escapedName": "update-notifier", + "rawSpec": "^2.3.0", + "saveSpec": null, + "fetchSpec": "^2.3.0" + }, + "_requiredBy": [ + "/nodemon" + ], + "_resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-2.3.0.tgz", + "_shasum": "4e8827a6bb915140ab093559d7014e3ebb837451", + "_spec": "update-notifier@^2.3.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/nodemon", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/yeoman/update-notifier/issues" + }, + "bundleDependencies": false, + "dependencies": { + "boxen": "^1.2.1", + "chalk": "^2.0.1", + "configstore": "^3.0.0", + "import-lazy": "^2.1.0", + "is-installed-globally": "^0.1.0", + "is-npm": "^1.0.0", + "latest-version": "^3.0.0", + "semver-diff": "^2.0.0", + "xdg-basedir": "^3.0.0" + }, + "deprecated": false, + "description": "Update notifications for your CLI app", + "devDependencies": { + "ava": "*", + "clear-module": "^2.1.0", + "fixture-stdout": "^0.2.1", + "strip-ansi": "^4.0.0", + "xo": "^0.18.2" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js", + "check.js" + ], + "homepage": "https://github.com/yeoman/update-notifier#readme", + "keywords": [ + "npm", + "update", + "updater", + "notify", + "notifier", + "check", + "checker", + "cli", + "module", + "package", + "version" + ], + "license": "BSD-2-Clause", + "name": "update-notifier", + "repository": { + "type": "git", + "url": "git+https://github.com/yeoman/update-notifier.git" + }, + "scripts": { + "test": "xo && ava --timeout=20s" + }, + "version": "2.3.0" +} diff --git a/node_modules/update-notifier/readme.md b/node_modules/update-notifier/readme.md new file mode 100644 index 0000000..99e7397 --- /dev/null +++ b/node_modules/update-notifier/readme.md @@ -0,0 +1,184 @@ +# update-notifier [![Build Status](https://travis-ci.org/yeoman/update-notifier.svg?branch=master)](https://travis-ci.org/yeoman/update-notifier) + +> Update notifications for your CLI app + +![](screenshot.png) + +Inform users of your package of updates in a non-intrusive way. + +#### Contents + +- [Install](#install) +- [Usage](#usage) +- [How](#how) +- [API](#api) +- [About](#about) +- [Users](#users) + + +## Install + +``` +$ npm install update-notifier +``` + + +## Usafe + +### Simple + +```js +const updateNotifier = require('update-notifier'); +const pkg = require('./package.json'); + +updateNotifier({pkg}).notify(); +``` + +### Comprehensive + +```js +const updateNotifier = require('update-notifier'); +const pkg = require('./package.json'); + +// Checks for available update and returns an instance +const notifier = updateNotifier({pkg}); + +// Notify using the built-in convenience method +notifier.notify(); + +// `notifier.update` contains some useful info about the update +console.log(notifier.update); +/* +{ + latest: '1.0.1', + current: '1.0.0', + type: 'patch', // Possible values: latest, major, minor, patch, prerelease, build + name: 'pageres' +} +*/ +``` + +### Options and custom message + +```js +const notifier = updateNotifier({ + pkg, + updateCheckInterval: 1000 * 60 * 60 * 24 * 7 // 1 week +}); + +if (notifier.update) { + console.log(`Update available: ${notifier.update.latest}`); +} +``` + + +## How + +Whenever you initiate the update notifier and it's not within the interval threshold, it will asynchronously check with npm in the background for available updates, then persist the result. The next time the notifier is initiated, the result will be loaded into the `.update` property. This prevents any impact on your package startup performance. +The update check is done in a unref'ed [child process](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options). This means that if you call `process.exit`, the check will still be performed in its own process. + +The first time the user runs your app, it will check for an update, and even if an update is available, it will wait the specified `updateCheckInterval` before notifying the user. This is done to not be annoying to the user, but might surprise you as an implementer if you're testing whether it works. Check out [`example.js`](example.js) to quickly test out `update-notifier` and see how you can test that it works in your app. + + +## API + +### notifier = updateNotifier(options) + +Checks if there is an available update. Accepts options defined below. Returns an instance with an `.update` property there is an available update, otherwise `undefined`. + +### options + +#### pkg + +Type: `Object` + +##### name + +*Required*
    +Type: `string` + +##### version + +*Required*
    +Type: `string` + +#### updateCheckInterval + +Type: `number`
    +Default: `1000 * 60 * 60 * 24` *(1 day)* + +How often to check for updates. + +#### callback(error, update) + +Type: `Function` + +Passing a callback here will make it check for an update directly and report right away. Not recommended as you won't get the benefits explained in [`How`](#how). `update` is equal to `notifier.update`. + +### notifier.notify([options]) + +Convenience method to display a notification message. *(See screenshot)* + +Only notifies if there is an update and the process is [TTY](https://nodejs.org/api/process.html#process_tty_terminals_and_process_stdout). + +#### options + +Type: `Object` + +##### defer + +Type: `boolean`
    +Default: `true` + +Defer showing the notification to after the process has exited. + +##### message + +Type: `string`
    +Default: [See above screenshot](https://github.com/yeoman/update-notifier#update-notifier-) + +Message that will be shown when an update is available. + +##### isGlobal + +Type: `boolean`
    +Default: `true` + +Include the `-g` argument in the default message's `npm i` recommendation. You may want to change this if your CLI package can be installed as a dependency of another project, and don't want to recommend a global installation. This option is ignored if you supply your own `message` (see above). + +##### boxenOpts + +Type: `Object`
    +Default: `{padding: 1, margin: 1, align: 'center', borderColor: 'yellow', borderStyle: 'round'}` *(See screenshot)* + +Options object that will be passed to [`boxen`](https://github.com/sindresorhus/boxen). + +### User settings + +Users of your module have the ability to opt-out of the update notifier by changing the `optOut` property to `true` in `~/.config/configstore/update-notifier-[your-module-name].json`. The path is available in `notifier.config.path`. + +Users can also opt-out by [setting the environment variable](https://github.com/sindresorhus/guides/blob/master/set-environment-variables.md) `NO_UPDATE_NOTIFIER` with any value or by using the `--no-update-notifier` flag on a per run basis. + + +## About + +The idea for this module came from the desire to apply the browser update strategy to CLI tools, where everyone is always on the latest version. We first tried automatic updating, which we discovered wasn't popular. This is the second iteration of that idea, but limited to just update notifications. + + +## Users + +There are a bunch projects using it: + +- [npm](https://github.com/npm/npm) - Package manager for JavaScript +- [Yeoman](http://yeoman.io) - Modern workflows for modern webapps +- [AVA](https://ava.li) - Simple concurrent test runner +- [XO](https://github.com/sindresorhus/xo) - JavaScript happiness style linter +- [Pageres](https://github.com/sindresorhus/pageres) - Capture website screenshots +- [Node GH](http://nodegh.io) - GitHub command line tool + +[And 1600+ more…](https://www.npmjs.org/browse/depended/update-notifier) + + +## License + +[BSD license](http://opensource.org/licenses/bsd-license.php) and copyright Google diff --git a/node_modules/urix/.jshintrc b/node_modules/urix/.jshintrc new file mode 100644 index 0000000..9d1a618 --- /dev/null +++ b/node_modules/urix/.jshintrc @@ -0,0 +1,42 @@ +{ + "bitwise": true, + "camelcase": true, + "curly": false, + "eqeqeq": true, + "es3": false, + "forin": true, + "immed": false, + "indent": false, + "latedef": "nofunc", + "newcap": false, + "noarg": true, + "noempty": true, + "nonew": false, + "plusplus": false, + "quotmark": true, + "undef": true, + "unused": "vars", + "strict": false, + "trailing": true, + "maxparams": 5, + "maxdepth": false, + "maxstatements": false, + "maxcomplexity": false, + "maxlen": 100, + + "asi": true, + "expr": true, + "globalstrict": true, + "smarttabs": true, + "sub": true, + + "node": true, + "globals": { + "describe": false, + "it": false, + "before": false, + "beforeEach": false, + "after": false, + "afterEach": false + } +} diff --git a/node_modules/urix/LICENSE b/node_modules/urix/LICENSE new file mode 100644 index 0000000..0595be3 --- /dev/null +++ b/node_modules/urix/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013 Simon Lydell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/urix/index.js b/node_modules/urix/index.js new file mode 100644 index 0000000..dc6ef27 --- /dev/null +++ b/node_modules/urix/index.js @@ -0,0 +1,17 @@ +// Copyright 2014 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +var path = require("path") + +"use strict" + +function urix(aPath) { + if (path.sep === "\\") { + return aPath + .replace(/\\/g, "/") + .replace(/^[a-z]:\/?/i, "/") + } + return aPath +} + +module.exports = urix diff --git a/node_modules/urix/package.json b/node_modules/urix/package.json new file mode 100644 index 0000000..a89bdfc --- /dev/null +++ b/node_modules/urix/package.json @@ -0,0 +1,59 @@ +{ + "_from": "urix@^0.1.0", + "_id": "urix@0.1.0", + "_inBundle": false, + "_integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "_location": "/urix", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "urix@^0.1.0", + "name": "urix", + "escapedName": "urix", + "rawSpec": "^0.1.0", + "saveSpec": null, + "fetchSpec": "^0.1.0" + }, + "_requiredBy": [ + "/source-map-resolve" + ], + "_resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "_shasum": "da937f7a62e21fec1fd18d49b35c2935067a6c72", + "_spec": "urix@^0.1.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/source-map-resolve", + "author": { + "name": "Simon Lydell" + }, + "bugs": { + "url": "https://github.com/lydell/urix/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Makes Windows-style paths more unix and URI friendly.", + "devDependencies": { + "jshint": "^2.4.4", + "mocha": "^1.17.1" + }, + "homepage": "https://github.com/lydell/urix#readme", + "keywords": [ + "path", + "url", + "uri", + "unix", + "windows", + "backslash", + "slash" + ], + "license": "MIT", + "main": "index.js", + "name": "urix", + "repository": { + "type": "git", + "url": "git+https://github.com/lydell/urix.git" + }, + "scripts": { + "test": "jshint index.js test/ && mocha" + }, + "version": "0.1.0" +} diff --git a/node_modules/urix/readme.md b/node_modules/urix/readme.md new file mode 100644 index 0000000..b258b98 --- /dev/null +++ b/node_modules/urix/readme.md @@ -0,0 +1,46 @@ +[![Build Status](https://travis-ci.org/lydell/urix.png?branch=master)](https://travis-ci.org/lydell/urix) + +Overview +======== + +Makes Windows-style paths more unix and URI friendly. Useful if you work with +paths that eventually will be used in URLs. + +```js +var urix = require("urix") + +// On Windows: +urix("c:\\users\\you\\foo") +// /users/you/foo + +// On unix-like systems: +urix("c:\\users\\you\\foo") +// c:\users\you\foo +``` + + +Installation +============ + +`npm install urix` + +```js +var urix = require("urix") +``` + + +Usage +===== + +### `urix(path)` ### + +On Windows, replaces all backslashes with slashes and uses a slash instead of a +drive letter and a colon for absolute paths. + +On unix-like systems it is a no-op. + + +License +======= + +[The X11 (“MIT”) License](LICENSE). diff --git a/node_modules/urix/test/index.js b/node_modules/urix/test/index.js new file mode 100644 index 0000000..5333f24 --- /dev/null +++ b/node_modules/urix/test/index.js @@ -0,0 +1,43 @@ +// Copyright 2014 Simon Lydell +// X11 (“MIT”) Licensed. (See LICENSE.) + +var path = require("path") +var assert = require("assert") +var urix = require("../") + +"use stict" + +function test(testPath, expected) { + path.sep = "\\" + assert.equal(urix(testPath), expected) + path.sep = "/" + assert.equal(urix(testPath), testPath) +} + +describe("urix", function() { + + it("is a function", function() { + assert.equal(typeof urix, "function") + }) + + + it("converts backslashes to slashes", function() { + test("a\\b\\c", "a/b/c") + test("\\a\\b\\c", "/a/b/c") + test("a/b\\c", "a/b/c") + test("\\\\a\\\\\\b///c", "//a///b///c") + }) + + + it("changes the drive letter to a slash", function() { + test("c:\\a", "/a") + test("C:\\a", "/a") + test("z:\\a", "/a") + test("c:a", "/a") + test("c:/a", "/a") + test("c:\\\\a", "//a") + test("c://a", "//a") + test("c:\\//a", "///a") + }) + +}) diff --git a/node_modules/url-parse-lax/index.js b/node_modules/url-parse-lax/index.js new file mode 100644 index 0000000..f9c0c65 --- /dev/null +++ b/node_modules/url-parse-lax/index.js @@ -0,0 +1,14 @@ +'use strict'; +var url = require('url'); +var prependHttp = require('prepend-http'); + +module.exports = function (x) { + var withProtocol = prependHttp(x); + var parsed = url.parse(withProtocol); + + if (withProtocol !== x) { + parsed.protocol = null; + } + + return parsed; +}; diff --git a/node_modules/url-parse-lax/license b/node_modules/url-parse-lax/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/url-parse-lax/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/url-parse-lax/package.json b/node_modules/url-parse-lax/package.json new file mode 100644 index 0000000..9bbdaeb --- /dev/null +++ b/node_modules/url-parse-lax/package.json @@ -0,0 +1,73 @@ +{ + "_from": "url-parse-lax@^1.0.0", + "_id": "url-parse-lax@1.0.0", + "_inBundle": false, + "_integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "_location": "/url-parse-lax", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "url-parse-lax@^1.0.0", + "name": "url-parse-lax", + "escapedName": "url-parse-lax", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/got" + ], + "_resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "_shasum": "7af8f303645e9bd79a272e7a14ac68bc0609da73", + "_spec": "url-parse-lax@^1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/got", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/url-parse-lax/issues" + }, + "bundleDependencies": false, + "dependencies": { + "prepend-http": "^1.0.1" + }, + "deprecated": false, + "description": "url.parse() with support for protocol-less URLs & IPs", + "devDependencies": { + "ava": "0.0.4" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/url-parse-lax#readme", + "keywords": [ + "url", + "uri", + "parse", + "parser", + "loose", + "lax", + "protocol", + "less", + "protocol-less", + "ip", + "ipv4", + "ipv6" + ], + "license": "MIT", + "name": "url-parse-lax", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/url-parse-lax.git" + }, + "scripts": { + "test": "node test.js" + }, + "version": "1.0.0" +} diff --git a/node_modules/url-parse-lax/readme.md b/node_modules/url-parse-lax/readme.md new file mode 100644 index 0000000..f263944 --- /dev/null +++ b/node_modules/url-parse-lax/readme.md @@ -0,0 +1,100 @@ +# url-parse-lax [![Build Status](https://travis-ci.org/sindresorhus/url-parse-lax.svg?branch=master)](https://travis-ci.org/sindresorhus/url-parse-lax) + +> [`url.parse()`](https://nodejs.org/docs/latest/api/url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost) with support for protocol-less URLs & IPs + + +## Install + +``` +$ npm install --save url-parse-lax +``` + + +## Usage + +```js +var urlParseLax = require('url-parse-lax'); + +urlParseLax('sindresorhus.com'); +/* +{ + protocol: null, + slashes: true, + auth: null, + host: 'sindresorhus.com', + port: null, + hostname: 'sindresorhus.com', + hash: null, + search: null, + query: null, + pathname: '/', + path: '/', + href: 'http://sindresorhus.com/' +} +*/ + +urlParseLax('[2001:db8::]:8000'); +/* +{ + protocol: null, + slashes: true, + auth: null, + host: '[2001:db8::]:8000', + port: '8000', + hostname: '2001:db8::', + hash: null, + search: null, + query: null, + pathname: '/', + path: '/', + href: 'http://[2001:db8::]:8000/' +} +*/ +``` + +And with the built-in `url.parse()`: + +```js +var url = require('url'); + +url.parse('sindresorhus.com'); +/* +{ + protocol: null, + slashes: null, + auth: null, + host: null, + port: null, + hostname: null, + hash: null, + search: null, + query: null, + pathname: 'sindresorhus', + path: 'sindresorhus', + href: 'sindresorhus' +} +*/ + +url.parse('[2001:db8::]:8000'); +/* +{ + protocol: null, + slashes: null, + auth: null, + host: null, + port: null, + hostname: null, + hash: null, + search: null, + query: null, + pathname: '[2001:db8::]:8000', + path: '[2001:db8::]:8000', + href: '[2001:db8::]:8000' +} +*/ +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/use/LICENSE b/node_modules/use/LICENSE new file mode 100644 index 0000000..e33d14b --- /dev/null +++ b/node_modules/use/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-2017, 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/node_modules/use/README.md b/node_modules/use/README.md new file mode 100644 index 0000000..bd4e325 --- /dev/null +++ b/node_modules/use/README.md @@ -0,0 +1,90 @@ +# use [![NPM version](https://img.shields.io/npm/v/use.svg?style=flat)](https://www.npmjs.com/package/use) [![NPM monthly downloads](https://img.shields.io/npm/dm/use.svg?style=flat)](https://npmjs.org/package/use) [![NPM total downloads](https://img.shields.io/npm/dt/use.svg?style=flat)](https://npmjs.org/package/use) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/use.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/use) + +> Easily add plugin support to your node.js application. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save use +``` + +A different take on plugin handling! This is not a middleware system, if you need something that handles async middleware, [ware](https://github.com/segmentio/ware) is great for that. + +## Usage + +```js +var use = require('use'); +``` + +See the [examples folder](./examples) for usage examples. + +## About + +
    +Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
    + +
    +Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
    + +
    +Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
    + +### Related projects + +You might also be interested in these projects: + +* [base-plugins](https://www.npmjs.com/package/base-plugins): Adds 'smart plugin' support to your base application. | [homepage](https://github.com/node-base/base-plugins "Adds 'smart plugin' support to your base application.") +* [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base "Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks") +* [ware](https://www.npmjs.com/package/ware): Easily create your own middleware layer. | [homepage](https://github.com/segmentio/ware "Easily create your own middleware layer.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 33 | [jonschlinkert](https://github.com/jonschlinkert) | +| 7 | [charlike-old](https://github.com/charlike-old) | +| 2 | [doowb](https://github.com/doowb) | +| 2 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | + +### Author + +**Jon Schlinkert** + +* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert) +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on December 03, 2017._ \ No newline at end of file diff --git a/node_modules/use/index.js b/node_modules/use/index.js new file mode 100644 index 0000000..11edc71 --- /dev/null +++ b/node_modules/use/index.js @@ -0,0 +1,153 @@ +/*! + * use + * + * Copyright (c) 2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var typeOf = require('kind-of'); + +module.exports = function base(app, options) { + if (typeOf(app) !== 'object' && typeof app !== 'function') { + throw new TypeError('expected an object or function'); + } + + var opts = typeOf(options) === 'object' ? options : {}; + var prop = typeof opts.prop === 'string' ? opts.prop : 'fns'; + if (!Array.isArray(app[prop])) { + define(app, prop, []); + } + + /** + * Define a plugin function to be passed to use. The only + * parameter exposed to the plugin is `app`, the object or function. + * passed to `use(app)`. `app` is also exposed as `this` in plugins. + * + * Additionally, **if a plugin returns a function, the function will + * be pushed onto the `fns` array**, allowing the plugin to be + * called at a later point by the `run` method. + * + * ```js + * var use = require('use'); + * + * // define a plugin + * function foo(app) { + * // do stuff + * } + * + * var app = function(){}; + * use(app); + * + * // register plugins + * app.use(foo); + * app.use(bar); + * app.use(baz); + * ``` + * @name .use + * @param {Function} `fn` plugin function to call + * @api public + */ + + define(app, 'use', use); + + /** + * Run all plugins on `fns`. Any plugin that returns a function + * when called by `use` is pushed onto the `fns` array. + * + * ```js + * var config = {}; + * app.run(config); + * ``` + * @name .run + * @param {Object} `value` Object to be modified by plugins. + * @return {Object} Returns the object passed to `run` + * @api public + */ + + define(app, 'run', function(val) { + if (typeOf(val) !== 'object') return; + + if (!val.use || !val.run) { + define(val, prop, val[prop] || []); + define(val, 'use', use); + } + + if (!val[prop] || val[prop].indexOf(base) === -1) { + val.use(base); + } + + var self = this || app; + var fns = self[prop]; + var len = fns.length; + var idx = -1; + + while (++idx < len) { + val.use(fns[idx]); + } + return val; + }); + + /** + * Call plugin `fn`. If a function is returned push it into the + * `fns` array to be called by the `run` method. + */ + + function use(type, fn, options) { + var offset = 1; + + if (typeof type === 'string' || Array.isArray(type)) { + fn = wrap(type, fn); + offset++; + } else { + options = fn; + fn = type; + } + + if (typeof fn !== 'function') { + throw new TypeError('expected a function'); + } + + var self = this || app; + var fns = self[prop]; + + var args = [].slice.call(arguments, offset); + args.unshift(self); + + if (typeof opts.hook === 'function') { + opts.hook.apply(self, args); + } + + var val = fn.apply(self, args); + if (typeof val === 'function' && fns.indexOf(val) === -1) { + fns.push(val); + } + return self; + } + + /** + * Wrap a named plugin function so that it's only called on objects of the + * given `type` + * + * @param {String} `type` + * @param {Function} `fn` Plugin function + * @return {Function} + */ + + function wrap(type, fn) { + return function plugin() { + return this.type === type ? fn.apply(this, arguments) : plugin; + }; + } + + return app; +}; + +function define(obj, key, val) { + Object.defineProperty(obj, key, { + configurable: true, + writable: true, + value: val + }); +} diff --git a/node_modules/use/node_modules/kind-of/CHANGELOG.md b/node_modules/use/node_modules/kind-of/CHANGELOG.md new file mode 100644 index 0000000..fb30b06 --- /dev/null +++ b/node_modules/use/node_modules/kind-of/CHANGELOG.md @@ -0,0 +1,157 @@ +# Release history + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +
    + Guiding Principles + +- Changelogs are for humans, not machines. +- There should be an entry for every single version. +- The same types of changes should be grouped. +- Versions and sections should be linkable. +- The latest version comes first. +- The release date of each versions is displayed. +- Mention whether you follow Semantic Versioning. + +
    + +
    + Types of changes + +Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_): + +- `Added` for new features. +- `Changed` for changes in existing functionality. +- `Deprecated` for soon-to-be removed features. +- `Removed` for now removed features. +- `Fixed` for any bug fixes. +- `Security` in case of vulnerabilities. + +
    + +## [6.0.0] - 2017-10-13 + +- refactor code to be more performant +- refactor benchmarks + +## [5.1.0] - 2017-10-13 + +**Added** + +- Merge pull request #15 from aretecode/patch-1 +- adds support and tests for string & array iterators + +**Changed** + +- updates benchmarks + +## [5.0.2] - 2017-08-02 + +- Merge pull request #14 from struct78/master +- Added `undefined` check + +## [5.0.0] - 2017-06-21 + +- Merge pull request #12 from aretecode/iterator +- Set Iterator + Map Iterator +- streamline `isbuffer`, minor edits + +## [4.0.0] - 2017-05-19 + +- Merge pull request #8 from tunnckoCore/master +- update deps + +## [3.2.2] - 2017-05-16 + +- fix version + +## [3.2.1] - 2017-05-16 + +- add browserify + +## [3.2.0] - 2017-04-25 + +- Merge pull request #10 from ksheedlo/unrequire-buffer +- add `promise` support and tests +- Remove unnecessary `Buffer` check + +## [3.1.0] - 2016-12-07 + +- Merge pull request #7 from laggingreflex/err +- add support for `error` and tests +- run update + +## [3.0.4] - 2016-07-29 + +- move tests +- run update + +## [3.0.3] - 2016-05-03 + +- fix prepublish script +- remove unused dep + +## [3.0.0] - 2015-11-17 + +- add typed array support +- Merge pull request #5 from miguelmota/typed-arrays +- adds new tests + +## [2.0.1] - 2015-08-21 + +- use `is-buffer` module + +## [2.0.0] - 2015-05-31 + +- Create fallback for `Array.isArray` if used as a browser package +- Merge pull request #2 from dtothefp/patch-1 +- Merge pull request #3 from pdehaan/patch-1 +- Merge branch 'master' of https://github.com/chorks/kind-of into chorks-master +- optimizations, mostly date and regex + +## [1.1.0] - 2015-02-09 + +- adds `buffer` support +- adds tests for `buffer` + +## [1.0.0] - 2015-01-19 + +- update benchmarks +- optimizations based on benchmarks + +## [0.1.2] - 2014-10-26 + +- return `typeof` value if it's not an object. very slight speed improvement +- use `.slice` +- adds benchmarks + +## [0.1.0] - 2014-9-26 + +- first commit + +[6.0.0]: https://github.com/jonschlinkert/kind-of/compare/5.1.0...6.0.0 +[5.1.0]: https://github.com/jonschlinkert/kind-of/compare/5.0.2...5.1.0 +[5.0.2]: https://github.com/jonschlinkert/kind-of/compare/5.0.1...5.0.2 +[5.0.1]: https://github.com/jonschlinkert/kind-of/compare/5.0.0...5.0.1 +[5.0.0]: https://github.com/jonschlinkert/kind-of/compare/4.0.0...5.0.0 +[4.0.0]: https://github.com/jonschlinkert/kind-of/compare/3.2.2...4.0.0 +[3.2.2]: https://github.com/jonschlinkert/kind-of/compare/3.2.1...3.2.2 +[3.2.1]: https://github.com/jonschlinkert/kind-of/compare/3.2.0...3.2.1 +[3.2.0]: https://github.com/jonschlinkert/kind-of/compare/3.1.0...3.2.0 +[3.1.0]: https://github.com/jonschlinkert/kind-of/compare/3.0.4...3.1.0 +[3.0.4]: https://github.com/jonschlinkert/kind-of/compare/3.0.3...3.0.4 +[3.0.3]: https://github.com/jonschlinkert/kind-of/compare/3.0.0...3.0.3 +[3.0.0]: https://github.com/jonschlinkert/kind-of/compare/2.0.1...3.0.0 +[2.0.1]: https://github.com/jonschlinkert/kind-of/compare/2.0.0...2.0.1 +[2.0.0]: https://github.com/jonschlinkert/kind-of/compare/1.1.0...2.0.0 +[1.1.0]: https://github.com/jonschlinkert/kind-of/compare/1.0.0...1.1.0 +[1.0.0]: https://github.com/jonschlinkert/kind-of/compare/0.1.2...1.0.0 +[0.1.2]: https://github.com/jonschlinkert/kind-of/compare/0.1.0...0.1.2 +[0.1.0]: https://github.com/jonschlinkert/kind-of/commit/2fae09b0b19b1aadb558e9be39f0c3ef6034eb87 + +[Unreleased]: https://github.com/jonschlinkert/kind-of/compare/0.1.2...HEAD +[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog + diff --git a/node_modules/use/node_modules/kind-of/LICENSE b/node_modules/use/node_modules/kind-of/LICENSE new file mode 100644 index 0000000..3f2eca1 --- /dev/null +++ b/node_modules/use/node_modules/kind-of/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, 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/node_modules/use/node_modules/kind-of/README.md b/node_modules/use/node_modules/kind-of/README.md new file mode 100644 index 0000000..4b0d4a8 --- /dev/null +++ b/node_modules/use/node_modules/kind-of/README.md @@ -0,0 +1,365 @@ +# kind-of [![NPM version](https://img.shields.io/npm/v/kind-of.svg?style=flat)](https://www.npmjs.com/package/kind-of) [![NPM monthly downloads](https://img.shields.io/npm/dm/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![NPM total downloads](https://img.shields.io/npm/dt/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/kind-of.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/kind-of) + +> Get the native type of a value. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save kind-of +``` + +Install with [bower](https://bower.io/) + +```sh +$ bower install kind-of --save +``` + +## Why use this? + +1. [it's fast](#benchmarks) | [optimizations](#optimizations) +2. [better type checking](#better-type-checking) + +## Usage + +> es5, es6, and browser ready + +```js +var kindOf = require('kind-of'); + +kindOf(undefined); +//=> 'undefined' + +kindOf(null); +//=> 'null' + +kindOf(true); +//=> 'boolean' + +kindOf(false); +//=> 'boolean' + +kindOf(new Buffer('')); +//=> 'buffer' + +kindOf(42); +//=> 'number' + +kindOf('str'); +//=> 'string' + +kindOf(arguments); +//=> 'arguments' + +kindOf({}); +//=> 'object' + +kindOf(Object.create(null)); +//=> 'object' + +kindOf(new Test()); +//=> 'object' + +kindOf(new Date()); +//=> 'date' + +kindOf([1, 2, 3]); +//=> 'array' + +kindOf(/foo/); +//=> 'regexp' + +kindOf(new RegExp('foo')); +//=> 'regexp' + +kindOf(new Error('error')); +//=> 'error' + +kindOf(function () {}); +//=> 'function' + +kindOf(function * () {}); +//=> 'generatorfunction' + +kindOf(Symbol('str')); +//=> 'symbol' + +kindOf(new Map()); +//=> 'map' + +kindOf(new WeakMap()); +//=> 'weakmap' + +kindOf(new Set()); +//=> 'set' + +kindOf(new WeakSet()); +//=> 'weakset' + +kindOf(new Int8Array()); +//=> 'int8array' + +kindOf(new Uint8Array()); +//=> 'uint8array' + +kindOf(new Uint8ClampedArray()); +//=> 'uint8clampedarray' + +kindOf(new Int16Array()); +//=> 'int16array' + +kindOf(new Uint16Array()); +//=> 'uint16array' + +kindOf(new Int32Array()); +//=> 'int32array' + +kindOf(new Uint32Array()); +//=> 'uint32array' + +kindOf(new Float32Array()); +//=> 'float32array' + +kindOf(new Float64Array()); +//=> 'float64array' +``` + +## Benchmarks + +Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of). + +```bash +# arguments (32 bytes) + kind-of x 17,024,098 ops/sec ±1.90% (86 runs sampled) + lib-type-of x 11,926,235 ops/sec ±1.34% (83 runs sampled) + lib-typeof x 9,245,257 ops/sec ±1.22% (87 runs sampled) + + fastest is kind-of (by 161% avg) + +# array (22 bytes) + kind-of x 17,196,492 ops/sec ±1.07% (88 runs sampled) + lib-type-of x 8,838,283 ops/sec ±1.02% (87 runs sampled) + lib-typeof x 8,677,848 ops/sec ±0.87% (87 runs sampled) + + fastest is kind-of (by 196% avg) + +# boolean (24 bytes) + kind-of x 16,841,600 ops/sec ±1.10% (86 runs sampled) + lib-type-of x 8,096,787 ops/sec ±0.95% (87 runs sampled) + lib-typeof x 8,423,345 ops/sec ±1.15% (86 runs sampled) + + fastest is kind-of (by 204% avg) + +# buffer (38 bytes) + kind-of x 14,848,060 ops/sec ±1.05% (86 runs sampled) + lib-type-of x 3,671,577 ops/sec ±1.49% (87 runs sampled) + lib-typeof x 8,360,236 ops/sec ±1.24% (86 runs sampled) + + fastest is kind-of (by 247% avg) + +# date (30 bytes) + kind-of x 16,067,761 ops/sec ±1.58% (86 runs sampled) + lib-type-of x 8,954,436 ops/sec ±1.40% (87 runs sampled) + lib-typeof x 8,488,307 ops/sec ±1.51% (84 runs sampled) + + fastest is kind-of (by 184% avg) + +# error (36 bytes) + kind-of x 9,634,090 ops/sec ±1.12% (89 runs sampled) + lib-type-of x 7,735,624 ops/sec ±1.32% (86 runs sampled) + lib-typeof x 7,442,160 ops/sec ±1.11% (90 runs sampled) + + fastest is kind-of (by 127% avg) + +# function (34 bytes) + kind-of x 10,031,494 ops/sec ±1.27% (86 runs sampled) + lib-type-of x 9,502,757 ops/sec ±1.17% (89 runs sampled) + lib-typeof x 8,278,985 ops/sec ±1.08% (88 runs sampled) + + fastest is kind-of (by 113% avg) + +# null (24 bytes) + kind-of x 18,159,808 ops/sec ±1.92% (86 runs sampled) + lib-type-of x 12,927,635 ops/sec ±1.01% (88 runs sampled) + lib-typeof x 7,958,234 ops/sec ±1.21% (89 runs sampled) + + fastest is kind-of (by 174% avg) + +# number (22 bytes) + kind-of x 17,846,779 ops/sec ±0.91% (85 runs sampled) + lib-type-of x 3,316,636 ops/sec ±1.19% (86 runs sampled) + lib-typeof x 2,329,477 ops/sec ±2.21% (85 runs sampled) + + fastest is kind-of (by 632% avg) + +# object-plain (47 bytes) + kind-of x 7,085,155 ops/sec ±1.05% (88 runs sampled) + lib-type-of x 8,870,930 ops/sec ±1.06% (83 runs sampled) + lib-typeof x 8,716,024 ops/sec ±1.05% (87 runs sampled) + + fastest is lib-type-of (by 112% avg) + +# regex (25 bytes) + kind-of x 14,196,052 ops/sec ±1.65% (84 runs sampled) + lib-type-of x 9,554,164 ops/sec ±1.25% (88 runs sampled) + lib-typeof x 8,359,691 ops/sec ±1.07% (87 runs sampled) + + fastest is kind-of (by 158% avg) + +# string (33 bytes) + kind-of x 16,131,428 ops/sec ±1.41% (85 runs sampled) + lib-type-of x 7,273,172 ops/sec ±1.05% (87 runs sampled) + lib-typeof x 7,382,635 ops/sec ±1.17% (85 runs sampled) + + fastest is kind-of (by 220% avg) + +# symbol (34 bytes) + kind-of x 17,011,537 ops/sec ±1.24% (86 runs sampled) + lib-type-of x 3,492,454 ops/sec ±1.23% (89 runs sampled) + lib-typeof x 7,471,235 ops/sec ±2.48% (87 runs sampled) + + fastest is kind-of (by 310% avg) + +# template-strings (36 bytes) + kind-of x 15,434,250 ops/sec ±1.46% (83 runs sampled) + lib-type-of x 7,157,907 ops/sec ±0.97% (87 runs sampled) + lib-typeof x 7,517,986 ops/sec ±0.92% (86 runs sampled) + + fastest is kind-of (by 210% avg) + +# undefined (29 bytes) + kind-of x 19,167,115 ops/sec ±1.71% (87 runs sampled) + lib-type-of x 15,477,740 ops/sec ±1.63% (85 runs sampled) + lib-typeof x 19,075,495 ops/sec ±1.17% (83 runs sampled) + + fastest is lib-typeof,kind-of + +``` + +## Optimizations + +In 7 out of 8 cases, this library is 2x-10x faster than other top libraries included in the benchmarks. There are a few things that lead to this performance advantage, none of them hard and fast rules, but all of them simple and repeatable in almost any code library: + +1. Optimize around the fastest and most common use cases first. Of course, this will change from project-to-project, but I took some time to understand how and why `typeof` checks were being used in my own libraries and other libraries I use a lot. +2. Optimize around bottlenecks - In other words, the order in which conditionals are implemented is significant, because each check is only as fast as the failing checks that came before it. Here, the biggest bottleneck by far is checking for plain objects (an object that was created by the `Object` constructor). I opted to make this check happen by process of elimination rather than brute force up front (e.g. by using something like `val.constructor.name`), so that every other type check would not be penalized it. +3. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'` +4. There is no reason to make the code in a microlib as terse as possible, just to win points for making it shorter. It's always better to favor performant code over terse code. You will always only be using a single `require()` statement to use the library anyway, regardless of how the code is written. + +## Better type checking + +kind-of seems to be more consistently "correct" than other type checking libs I've looked at. For example, here are some differing results from other popular libs: + +### [typeof](https://github.com/CodingFu/typeof) lib + +Incorrectly identifies instances of custom constructors (pretty common): + +```js +var typeOf = require('typeof'); +function Test() {} +console.log(typeOf(new Test())); +//=> 'test' +``` + +Returns `object` instead of `arguments`: + +```js +function foo() { + console.log(typeOf(arguments)) //=> 'object' +} +foo(); +``` + +### [type-of](https://github.com/ForbesLindesay/type-of) lib + +Incorrectly returns `object` for generator functions, buffers, `Map`, `Set`, `WeakMap` and `WeakSet`: + +```js +function * foo() {} +console.log(typeOf(foo)); +//=> 'object' +console.log(typeOf(new Buffer(''))); +//=> 'object' +console.log(typeOf(new Map())); +//=> 'object' +console.log(typeOf(new Set())); +//=> 'object' +console.log(typeOf(new WeakMap())); +//=> 'object' +console.log(typeOf(new WeakSet())); +//=> 'object' +``` + +## About + +
    +Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
    + +
    +Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
    + +
    +Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
    + +### Related projects + +You might also be interested in these projects: + +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number "Returns true if the value is a number. comprehensive tests.") +* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 98 | [jonschlinkert](https://github.com/jonschlinkert) | +| 3 | [aretecode](https://github.com/aretecode) | +| 2 | [miguelmota](https://github.com/miguelmota) | +| 1 | [dtothefp](https://github.com/dtothefp) | +| 1 | [ianstormtaylor](https://github.com/ianstormtaylor) | +| 1 | [ksheedlo](https://github.com/ksheedlo) | +| 1 | [pdehaan](https://github.com/pdehaan) | +| 1 | [laggingreflex](https://github.com/laggingreflex) | +| 1 | [charlike-old](https://github.com/charlike-old) | + +### Author + +**Jon Schlinkert** + +* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert) +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on December 01, 2017._ \ No newline at end of file diff --git a/node_modules/use/node_modules/kind-of/index.js b/node_modules/use/node_modules/kind-of/index.js new file mode 100644 index 0000000..aa2bb39 --- /dev/null +++ b/node_modules/use/node_modules/kind-of/index.js @@ -0,0 +1,129 @@ +var toString = Object.prototype.toString; + +module.exports = function kindOf(val) { + if (val === void 0) return 'undefined'; + if (val === null) return 'null'; + + var type = typeof val; + if (type === 'boolean') return 'boolean'; + if (type === 'string') return 'string'; + if (type === 'number') return 'number'; + if (type === 'symbol') return 'symbol'; + if (type === 'function') { + return isGeneratorFn(val) ? 'generatorfunction' : 'function'; + } + + if (isArray(val)) return 'array'; + if (isBuffer(val)) return 'buffer'; + if (isArguments(val)) return 'arguments'; + if (isDate(val)) return 'date'; + if (isError(val)) return 'error'; + if (isRegexp(val)) return 'regexp'; + + switch (ctorName(val)) { + case 'Symbol': return 'symbol'; + case 'Promise': return 'promise'; + + // Set, Map, WeakSet, WeakMap + case 'WeakMap': return 'weakmap'; + case 'WeakSet': return 'weakset'; + case 'Map': return 'map'; + case 'Set': return 'set'; + + // 8-bit typed arrays + case 'Int8Array': return 'int8array'; + case 'Uint8Array': return 'uint8array'; + case 'Uint8ClampedArray': return 'uint8clampedarray'; + + // 16-bit typed arrays + case 'Int16Array': return 'int16array'; + case 'Uint16Array': return 'uint16array'; + + // 32-bit typed arrays + case 'Int32Array': return 'int32array'; + case 'Uint32Array': return 'uint32array'; + case 'Float32Array': return 'float32array'; + case 'Float64Array': return 'float64array'; + } + + if (isGeneratorObj(val)) { + return 'generator'; + } + + // Non-plain objects + type = toString.call(val); + switch (type) { + case '[object Object]': return 'object'; + // iterators + case '[object Map Iterator]': return 'mapiterator'; + case '[object Set Iterator]': return 'setiterator'; + case '[object String Iterator]': return 'stringiterator'; + case '[object Array Iterator]': return 'arrayiterator'; + } + + // other + return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); +}; + +function ctorName(val) { + return val.constructor ? val.constructor.name : null; +} + +function isArray(val) { + if (Array.isArray) return Array.isArray(val); + return val instanceof Array; +} + +function isError(val) { + return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'); +} + +function isDate(val) { + if (val instanceof Date) return true; + return typeof val.toDateString === 'function' + && typeof val.getDate === 'function' + && typeof val.setDate === 'function'; +} + +function isRegexp(val) { + if (val instanceof RegExp) return true; + return typeof val.flags === 'string' + && typeof val.ignoreCase === 'boolean' + && typeof val.multiline === 'boolean' + && typeof val.global === 'boolean'; +} + +function isGeneratorFn(name, val) { + return ctorName(name) === 'GeneratorFunction'; +} + +function isGeneratorObj(val) { + return typeof val.throw === 'function' + && typeof val.return === 'function' + && typeof val.next === 'function'; +} + +function isArguments(val) { + try { + if (typeof val.length === 'number' && typeof val.callee === 'function') { + return true; + } + } catch (err) { + if (err.message.indexOf('callee') !== -1) { + return true; + } + } + return false; +} + +/** + * If you need to support Safari 5-7 (8-10 yr-old browser), + * take a look at https://github.com/feross/is-buffer + */ + +function isBuffer(val) { + if (val.constructor && typeof val.constructor.isBuffer === 'function') { + return val.constructor.isBuffer(val); + } + return false; +} diff --git a/node_modules/use/node_modules/kind-of/package.json b/node_modules/use/node_modules/kind-of/package.json new file mode 100644 index 0000000..d38964b --- /dev/null +++ b/node_modules/use/node_modules/kind-of/package.json @@ -0,0 +1,143 @@ +{ + "_from": "kind-of@^6.0.2", + "_id": "kind-of@6.0.2", + "_inBundle": false, + "_integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "_location": "/use/kind-of", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "kind-of@^6.0.2", + "name": "kind-of", + "escapedName": "kind-of", + "rawSpec": "^6.0.2", + "saveSpec": null, + "fetchSpec": "^6.0.2" + }, + "_requiredBy": [ + "/use" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "_shasum": "01146b36a6218e64e58f3a8d66de5d7fc6f6d051", + "_spec": "kind-of@^6.0.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/use", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/kind-of/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "David Fox-Powell", + "url": "https://dtothefp.github.io/me" + }, + { + "name": "James", + "url": "https://twitter.com/aretecode" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Ken Sheedlo", + "url": "kensheedlo.com" + }, + { + "name": "laggingreflex", + "url": "https://github.com/laggingreflex" + }, + { + "name": "Miguel Mota", + "url": "https://miguelmota.com" + }, + { + "name": "Peter deHaan", + "url": "http://about.me/peterdehaan" + }, + { + "name": "tunnckoCore", + "url": "https://i.am.charlike.online" + } + ], + "deprecated": false, + "description": "Get the native type of a value.", + "devDependencies": { + "benchmarked": "^2.0.0", + "browserify": "^14.4.0", + "gulp-format-md": "^1.0.0", + "mocha": "^4.0.1", + "write": "^1.0.3" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/kind-of", + "keywords": [ + "arguments", + "array", + "boolean", + "check", + "date", + "function", + "is", + "is-type", + "is-type-of", + "kind", + "kind-of", + "number", + "object", + "of", + "regexp", + "string", + "test", + "type", + "type-of", + "typeof", + "types" + ], + "license": "MIT", + "main": "index.js", + "name": "kind-of", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/kind-of.git" + }, + "scripts": { + "prepublish": "browserify -o browser.js -e index.js -s index --bare", + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "related": { + "list": [ + "is-glob", + "is-number", + "is-primitive" + ] + }, + "reflinks": [ + "type-of", + "typeof", + "verb" + ] + }, + "version": "6.0.2" +} diff --git a/node_modules/use/package.json b/node_modules/use/package.json new file mode 100644 index 0000000..02e87ba --- /dev/null +++ b/node_modules/use/package.json @@ -0,0 +1,111 @@ +{ + "_from": "use@^3.1.0", + "_id": "use@3.1.0", + "_inBundle": false, + "_integrity": "sha512-6UJEQM/L+mzC3ZJNM56Q4DFGLX/evKGRg15UJHGB9X5j5Z3AFbgZvjUh2yq/UJUY4U5dh7Fal++XbNg1uzpRAw==", + "_location": "/use", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "use@^3.1.0", + "name": "use", + "escapedName": "use", + "rawSpec": "^3.1.0", + "saveSpec": null, + "fetchSpec": "^3.1.0" + }, + "_requiredBy": [ + "/snapdragon" + ], + "_resolved": "https://registry.npmjs.org/use/-/use-3.1.0.tgz", + "_shasum": "14716bf03fdfefd03040aef58d8b4b85f3a7c544", + "_spec": "use@^3.1.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/snapdragon", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/use/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Brian Woodward", + "url": "https://twitter.com/doowb" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Olsten Larck", + "url": "https://i.am.charlike.online" + }, + { + "url": "https://github.com/wtgtybhertgeghgtwtg" + } + ], + "dependencies": { + "kind-of": "^6.0.2" + }, + "deprecated": false, + "description": "Easily add plugin support to your node.js application.", + "devDependencies": { + "base-plugins": "^1.0.0", + "define-property": "^2.0.0", + "extend-shallow": "^3.0.1", + "gulp": "^3.9.1", + "gulp-eslint": "^4.0.0", + "gulp-format-md": "^1.0.0", + "gulp-istanbul": "^1.1.2", + "gulp-mocha": "^3.0.1", + "mocha": "^4.0.1" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/use", + "keywords": [ + "use" + ], + "license": "MIT", + "main": "index.js", + "name": "use", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/use.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "base", + "base-plugins", + "ware" + ] + }, + "reflinks": [ + "verb", + "ware" + ], + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + }, + "version": "3.1.0" +} diff --git a/node_modules/util-deprecate/History.md b/node_modules/util-deprecate/History.md new file mode 100644 index 0000000..acc8675 --- /dev/null +++ b/node_modules/util-deprecate/History.md @@ -0,0 +1,16 @@ + +1.0.2 / 2015-10-07 +================== + + * use try/catch when checking `localStorage` (#3, @kumavis) + +1.0.1 / 2014-11-25 +================== + + * browser: use `console.warn()` for deprecation calls + * browser: more jsdocs + +1.0.0 / 2014-04-30 +================== + + * initial commit diff --git a/node_modules/util-deprecate/LICENSE b/node_modules/util-deprecate/LICENSE new file mode 100644 index 0000000..6a60e8c --- /dev/null +++ b/node_modules/util-deprecate/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2014 Nathan Rajlich + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/util-deprecate/README.md b/node_modules/util-deprecate/README.md new file mode 100644 index 0000000..75622fa --- /dev/null +++ b/node_modules/util-deprecate/README.md @@ -0,0 +1,53 @@ +util-deprecate +============== +### The Node.js `util.deprecate()` function with browser support + +In Node.js, this module simply re-exports the `util.deprecate()` function. + +In the web browser (i.e. via browserify), a browser-specific implementation +of the `util.deprecate()` function is used. + + +## API + +A `deprecate()` function is the only thing exposed by this module. + +``` javascript +// setup: +exports.foo = deprecate(foo, 'foo() is deprecated, use bar() instead'); + + +// users see: +foo(); +// foo() is deprecated, use bar() instead +foo(); +foo(); +``` + + +## License + +(The MIT License) + +Copyright (c) 2014 Nathan Rajlich + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/util-deprecate/browser.js b/node_modules/util-deprecate/browser.js new file mode 100644 index 0000000..549ae2f --- /dev/null +++ b/node_modules/util-deprecate/browser.js @@ -0,0 +1,67 @@ + +/** + * Module exports. + */ + +module.exports = deprecate; + +/** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ + +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +} + +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ + +function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!global.localStorage) return false; + } catch (_) { + return false; + } + var val = global.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; +} diff --git a/node_modules/util-deprecate/node.js b/node_modules/util-deprecate/node.js new file mode 100644 index 0000000..5e6fcff --- /dev/null +++ b/node_modules/util-deprecate/node.js @@ -0,0 +1,6 @@ + +/** + * For Node.js, simply re-export the core `util.deprecate` function. + */ + +module.exports = require('util').deprecate; diff --git a/node_modules/util-deprecate/package.json b/node_modules/util-deprecate/package.json new file mode 100644 index 0000000..1168905 --- /dev/null +++ b/node_modules/util-deprecate/package.json @@ -0,0 +1,56 @@ +{ + "_from": "util-deprecate@~1.0.1", + "_id": "util-deprecate@1.0.2", + "_inBundle": false, + "_integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "_location": "/util-deprecate", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "util-deprecate@~1.0.1", + "name": "util-deprecate", + "escapedName": "util-deprecate", + "rawSpec": "~1.0.1", + "saveSpec": null, + "fetchSpec": "~1.0.1" + }, + "_requiredBy": [ + "/readable-stream" + ], + "_resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "_shasum": "450d4dc9fa70de732762fbd2d4a28981419a0ccf", + "_spec": "util-deprecate@~1.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/readable-stream", + "author": { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io/" + }, + "browser": "browser.js", + "bugs": { + "url": "https://github.com/TooTallNate/util-deprecate/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "The Node.js `util.deprecate()` function with browser support", + "homepage": "https://github.com/TooTallNate/util-deprecate", + "keywords": [ + "util", + "deprecate", + "browserify", + "browser", + "node" + ], + "license": "MIT", + "main": "node.js", + "name": "util-deprecate", + "repository": { + "type": "git", + "url": "git://github.com/TooTallNate/util-deprecate.git" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "version": "1.0.2" +} diff --git a/node_modules/utils-merge/.travis.yml b/node_modules/utils-merge/.travis.yml new file mode 100644 index 0000000..af92b02 --- /dev/null +++ b/node_modules/utils-merge/.travis.yml @@ -0,0 +1,6 @@ +language: "node_js" +node_js: + - "0.4" + - "0.6" + - "0.8" + - "0.10" diff --git a/node_modules/utils-merge/LICENSE b/node_modules/utils-merge/LICENSE new file mode 100644 index 0000000..e33bd10 --- /dev/null +++ b/node_modules/utils-merge/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2013 Jared Hanson + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/utils-merge/README.md b/node_modules/utils-merge/README.md new file mode 100644 index 0000000..2f94e9b --- /dev/null +++ b/node_modules/utils-merge/README.md @@ -0,0 +1,34 @@ +# utils-merge + +Merges the properties from a source object into a destination object. + +## Install + + $ npm install utils-merge + +## Usage + +```javascript +var a = { foo: 'bar' } + , b = { bar: 'baz' }; + +merge(a, b); +// => { foo: 'bar', bar: 'baz' } +``` + +## Tests + + $ npm install + $ npm test + +[![Build Status](https://secure.travis-ci.org/jaredhanson/utils-merge.png)](http://travis-ci.org/jaredhanson/utils-merge) + +## Credits + + - [Jared Hanson](http://github.com/jaredhanson) + +## License + +[The MIT License](http://opensource.org/licenses/MIT) + +Copyright (c) 2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)> diff --git a/node_modules/utils-merge/index.js b/node_modules/utils-merge/index.js new file mode 100644 index 0000000..4265c69 --- /dev/null +++ b/node_modules/utils-merge/index.js @@ -0,0 +1,23 @@ +/** + * Merge object b with object a. + * + * var a = { foo: 'bar' } + * , b = { bar: 'baz' }; + * + * merge(a, b); + * // => { foo: 'bar', bar: 'baz' } + * + * @param {Object} a + * @param {Object} b + * @return {Object} + * @api public + */ + +exports = module.exports = function(a, b){ + if (a && b) { + for (var key in b) { + a[key] = b[key]; + } + } + return a; +}; diff --git a/node_modules/utils-merge/package.json b/node_modules/utils-merge/package.json new file mode 100644 index 0000000..7e4dc64 --- /dev/null +++ b/node_modules/utils-merge/package.json @@ -0,0 +1,64 @@ +{ + "_from": "utils-merge@1.0.0", + "_id": "utils-merge@1.0.0", + "_inBundle": false, + "_integrity": "sha1-ApT7kiu5N1FTVBxPcJYjHyh8ivg=", + "_location": "/utils-merge", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "utils-merge@1.0.0", + "name": "utils-merge", + "escapedName": "utils-merge", + "rawSpec": "1.0.0", + "saveSpec": null, + "fetchSpec": "1.0.0" + }, + "_requiredBy": [ + "/express" + ], + "_resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz", + "_shasum": "0294fb922bb9375153541c4f7096231f287c8af8", + "_spec": "utils-merge@1.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/express", + "author": { + "name": "Jared Hanson", + "email": "jaredhanson@gmail.com", + "url": "http://www.jaredhanson.net/" + }, + "bugs": { + "url": "http://github.com/jaredhanson/utils-merge/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "merge() utility function", + "devDependencies": { + "chai": "1.x.x", + "mocha": "1.x.x" + }, + "engines": { + "node": ">= 0.4.0" + }, + "homepage": "https://github.com/jaredhanson/utils-merge#readme", + "keywords": [ + "util" + ], + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/MIT" + } + ], + "main": "./index", + "name": "utils-merge", + "repository": { + "type": "git", + "url": "git://github.com/jaredhanson/utils-merge.git" + }, + "scripts": { + "test": "mocha --reporter spec --require test/bootstrap/node test/*.test.js" + }, + "version": "1.0.0" +} diff --git a/node_modules/vary/HISTORY.md b/node_modules/vary/HISTORY.md new file mode 100644 index 0000000..f6cbcf7 --- /dev/null +++ b/node_modules/vary/HISTORY.md @@ -0,0 +1,39 @@ +1.1.2 / 2017-09-23 +================== + + * perf: improve header token parsing speed + +1.1.1 / 2017-03-20 +================== + + * perf: hoist regular expression + +1.1.0 / 2015-09-29 +================== + + * Only accept valid field names in the `field` argument + - Ensures the resulting string is a valid HTTP header value + +1.0.1 / 2015-07-08 +================== + + * Fix setting empty header from empty `field` + * perf: enable strict mode + * perf: remove argument reassignments + +1.0.0 / 2014-08-10 +================== + + * Accept valid `Vary` header string as `field` + * Add `vary.append` for low-level string manipulation + * Move to `jshttp` orgainzation + +0.1.0 / 2014-06-05 +================== + + * Support array of fields to set + +0.0.0 / 2014-06-04 +================== + + * Initial release diff --git a/node_modules/vary/LICENSE b/node_modules/vary/LICENSE new file mode 100644 index 0000000..84441fb --- /dev/null +++ b/node_modules/vary/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2017 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/vary/README.md b/node_modules/vary/README.md new file mode 100644 index 0000000..cc000b3 --- /dev/null +++ b/node_modules/vary/README.md @@ -0,0 +1,101 @@ +# vary + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Manipulate the HTTP Vary header + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install vary +``` + +## API + + + +```js +var vary = require('vary') +``` + +### vary(res, field) + +Adds the given header `field` to the `Vary` response header of `res`. +This can be a string of a single field, a string of a valid `Vary` +header, or an array of multiple fields. + +This will append the header if not already listed, otherwise leaves +it listed in the current location. + + + +```js +// Append "Origin" to the Vary header of the response +vary(res, 'Origin') +``` + +### vary.append(header, field) + +Adds the given header `field` to the `Vary` response header string `header`. +This can be a string of a single field, a string of a valid `Vary` header, +or an array of multiple fields. + +This will append the header if not already listed, otherwise leaves +it listed in the current location. The new header string is returned. + + + +```js +// Get header string appending "Origin" to "Accept, User-Agent" +vary.append('Accept, User-Agent', 'Origin') +``` + +## Examples + +### Updating the Vary header when content is based on it + +```js +var http = require('http') +var vary = require('vary') + +http.createServer(function onRequest (req, res) { + // about to user-agent sniff + vary(res, 'User-Agent') + + var ua = req.headers['user-agent'] || '' + var isMobile = /mobi|android|touch|mini/i.test(ua) + + // serve site, depending on isMobile + res.setHeader('Content-Type', 'text/html') + res.end('You are (probably) ' + (isMobile ? '' : 'not ') + 'a mobile user') +}) +``` + +## Testing + +```sh +$ npm test +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/vary.svg +[npm-url]: https://npmjs.org/package/vary +[node-version-image]: https://img.shields.io/node/v/vary.svg +[node-version-url]: https://nodejs.org/en/download +[travis-image]: https://img.shields.io/travis/jshttp/vary/master.svg +[travis-url]: https://travis-ci.org/jshttp/vary +[coveralls-image]: https://img.shields.io/coveralls/jshttp/vary/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/vary +[downloads-image]: https://img.shields.io/npm/dm/vary.svg +[downloads-url]: https://npmjs.org/package/vary diff --git a/node_modules/vary/index.js b/node_modules/vary/index.js new file mode 100644 index 0000000..5b5e741 --- /dev/null +++ b/node_modules/vary/index.js @@ -0,0 +1,149 @@ +/*! + * vary + * Copyright(c) 2014-2017 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + */ + +module.exports = vary +module.exports.append = append + +/** + * RegExp to match field-name in RFC 7230 sec 3.2 + * + * field-name = token + * token = 1*tchar + * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" + * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" + * / DIGIT / ALPHA + * ; any VCHAR, except delimiters + */ + +var FIELD_NAME_REGEXP = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/ + +/** + * Append a field to a vary header. + * + * @param {String} header + * @param {String|Array} field + * @return {String} + * @public + */ + +function append (header, field) { + if (typeof header !== 'string') { + throw new TypeError('header argument is required') + } + + if (!field) { + throw new TypeError('field argument is required') + } + + // get fields array + var fields = !Array.isArray(field) + ? parse(String(field)) + : field + + // assert on invalid field names + for (var j = 0; j < fields.length; j++) { + if (!FIELD_NAME_REGEXP.test(fields[j])) { + throw new TypeError('field argument contains an invalid header name') + } + } + + // existing, unspecified vary + if (header === '*') { + return header + } + + // enumerate current values + var val = header + var vals = parse(header.toLowerCase()) + + // unspecified vary + if (fields.indexOf('*') !== -1 || vals.indexOf('*') !== -1) { + return '*' + } + + for (var i = 0; i < fields.length; i++) { + var fld = fields[i].toLowerCase() + + // append value (case-preserving) + if (vals.indexOf(fld) === -1) { + vals.push(fld) + val = val + ? val + ', ' + fields[i] + : fields[i] + } + } + + return val +} + +/** + * Parse a vary header into an array. + * + * @param {String} header + * @return {Array} + * @private + */ + +function parse (header) { + var end = 0 + var list = [] + var start = 0 + + // gather tokens + for (var i = 0, len = header.length; i < len; i++) { + switch (header.charCodeAt(i)) { + case 0x20: /* */ + if (start === end) { + start = end = i + 1 + } + break + case 0x2c: /* , */ + list.push(header.substring(start, end)) + start = end = i + 1 + break + default: + end = i + 1 + break + } + } + + // final token + list.push(header.substring(start, end)) + + return list +} + +/** + * Mark that a request is varied on a header field. + * + * @param {Object} res + * @param {String|Array} field + * @public + */ + +function vary (res, field) { + if (!res || !res.getHeader || !res.setHeader) { + // quack quack + throw new TypeError('res argument is required') + } + + // get existing header + var val = res.getHeader('Vary') || '' + var header = Array.isArray(val) + ? val.join(', ') + : String(val) + + // set new header + if ((val = append(header, field))) { + res.setHeader('Vary', val) + } +} diff --git a/node_modules/vary/package.json b/node_modules/vary/package.json new file mode 100644 index 0000000..e7dcad1 --- /dev/null +++ b/node_modules/vary/package.json @@ -0,0 +1,78 @@ +{ + "_from": "vary@~1.1.1", + "_id": "vary@1.1.2", + "_inBundle": false, + "_integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", + "_location": "/vary", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "vary@~1.1.1", + "name": "vary", + "escapedName": "vary", + "rawSpec": "~1.1.1", + "saveSpec": null, + "fetchSpec": "~1.1.1" + }, + "_requiredBy": [ + "/express" + ], + "_resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "_shasum": "2299f02c6ded30d4a5961b0b9f74524a18f634fc", + "_spec": "vary@~1.1.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/express", + "author": { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + "bugs": { + "url": "https://github.com/jshttp/vary/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Manipulate the HTTP Vary header", + "devDependencies": { + "beautify-benchmark": "0.2.4", + "benchmark": "2.1.4", + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.7.0", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-node": "5.1.1", + "eslint-plugin-promise": "3.5.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "mocha": "2.5.3", + "supertest": "1.1.0" + }, + "engines": { + "node": ">= 0.8" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "index.js" + ], + "homepage": "https://github.com/jshttp/vary#readme", + "keywords": [ + "http", + "res", + "vary" + ], + "license": "MIT", + "name": "vary", + "repository": { + "type": "git", + "url": "git+https://github.com/jshttp/vary.git" + }, + "scripts": { + "bench": "node benchmark/index.js", + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + }, + "version": "1.1.2" +} diff --git a/node_modules/void-elements/.gitattributes b/node_modules/void-elements/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/node_modules/void-elements/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/node_modules/void-elements/.npmignore b/node_modules/void-elements/.npmignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/node_modules/void-elements/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/void-elements/.travis.yml b/node_modules/void-elements/.travis.yml new file mode 100644 index 0000000..3c6757d --- /dev/null +++ b/node_modules/void-elements/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - '0.10' + - '0.11' diff --git a/node_modules/void-elements/LICENSE b/node_modules/void-elements/LICENSE new file mode 100644 index 0000000..2d3845b --- /dev/null +++ b/node_modules/void-elements/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014 hemanth + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/void-elements/README.md b/node_modules/void-elements/README.md new file mode 100644 index 0000000..e8e0654 --- /dev/null +++ b/node_modules/void-elements/README.md @@ -0,0 +1,27 @@ +void-elements +============== + +### Array of "void elements" defined by the HTML specification + +Exports an Array of "void element" node names as defined by the HTML spec. + +The list is programatically generated from the [latest W3C HTML draft](http://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements). + +[![Build Status](https://img.shields.io/travis/jadejs/void-elements/master.svg?style=flat)](https://travis-ci.org/jadejs/void-elements) +[![Developing Dependency Status](https://img.shields.io/david/dev/jadejs/void-elements.svg?style=flat)](https://david-dm.org/jadejs/void-elements#info=devDependencies) +[![NPM version](https://img.shields.io/npm/v/void-elements.svg?style=flat)](https://www.npmjs.org/package/void-elements) + +Usage +----- + +```js +var voidElements = require('void-elements'); + +assert(voidElements.indexOf('span') === -1, ' is not a void element'); +assert(voidElements.indexOf('img') !== -1, ' is a void element'); +``` + +License +------- + +MIT diff --git a/node_modules/void-elements/index.js b/node_modules/void-elements/index.js new file mode 100644 index 0000000..363b624 --- /dev/null +++ b/node_modules/void-elements/index.js @@ -0,0 +1,23 @@ +/** + * This file automatically generated from `pre-publish.js`. + * Do not manually edit. + */ + +module.exports = { + "area": true, + "base": true, + "br": true, + "col": true, + "embed": true, + "hr": true, + "img": true, + "input": true, + "keygen": true, + "link": true, + "menuitem": true, + "meta": true, + "param": true, + "source": true, + "track": true, + "wbr": true +}; diff --git a/node_modules/void-elements/package.json b/node_modules/void-elements/package.json new file mode 100644 index 0000000..e25a681 --- /dev/null +++ b/node_modules/void-elements/package.json @@ -0,0 +1,58 @@ +{ + "_from": "void-elements@^2.0.1", + "_id": "void-elements@2.0.1", + "_inBundle": false, + "_integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=", + "_location": "/void-elements", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "void-elements@^2.0.1", + "name": "void-elements", + "escapedName": "void-elements", + "rawSpec": "^2.0.1", + "saveSpec": null, + "fetchSpec": "^2.0.1" + }, + "_requiredBy": [ + "/pug-code-gen" + ], + "_resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", + "_shasum": "c066afb582bb1cb4128d60ea92392e94d5e9dbec", + "_spec": "void-elements@^2.0.1", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/pug-code-gen", + "author": { + "name": "hemanth.hm" + }, + "bugs": { + "url": "https://github.com/hemanth/void-elements/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Array of \"void elements\" defined by the HTML specification.", + "devDependencies": { + "cheerio": "^0.18.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "homepage": "https://github.com/hemanth/void-elements", + "keywords": [ + "html", + "void", + "elements" + ], + "license": "MIT", + "main": "index.js", + "name": "void-elements", + "repository": { + "type": "git", + "url": "git+https://github.com/hemanth/void-elements.git" + }, + "scripts": { + "prepublish": "node pre-publish.js > index.js", + "test": "node test" + }, + "version": "2.0.1" +} diff --git a/node_modules/void-elements/pre-publish.js b/node_modules/void-elements/pre-publish.js new file mode 100644 index 0000000..93218ab --- /dev/null +++ b/node_modules/void-elements/pre-publish.js @@ -0,0 +1,29 @@ +var cheerio = require('cheerio') + , http = require('http'); + +http.get('http://www.w3.org/html/wg/drafts/html/master/syntax.html', function (res) { + var str = ''; + res.setEncoding('utf8'); + res.on('data', function (buf) { + str += buf; + }).on('end', function () { + var $ = cheerio.load(str); + var codes = $('dfn#void-elements') + .parent() + .next() + .text() + .replace(/\s/gm,'') + .split(",") + .reduce(function (obj, code) { + obj[code] = true; + return obj; + }, {}); + + console.log('/**'); + console.log(' * This file automatically generated from `pre-publish.js`.'); + console.log(' * Do not manually edit.'); + console.log(' */'); + console.log(); + console.log('module.exports = %s;', JSON.stringify(codes, null, 2)); + }); +}); diff --git a/node_modules/void-elements/test/index.js b/node_modules/void-elements/test/index.js new file mode 100644 index 0000000..4d71973 --- /dev/null +++ b/node_modules/void-elements/test/index.js @@ -0,0 +1,5 @@ +var assert = require('assert'); +var voidElements = require('../'); +assert(!voidElements.span, ' is not a void element'); +assert(voidElements.img, ' is a void element'); +console.log('tests passed'); diff --git a/node_modules/which/CHANGELOG.md b/node_modules/which/CHANGELOG.md new file mode 100644 index 0000000..367acb1 --- /dev/null +++ b/node_modules/which/CHANGELOG.md @@ -0,0 +1,147 @@ +# Changes + + +## v1.3.0 + +* Add nothrow option to which.sync +* update tap + +## v1.2.14 + +* appveyor: drop node 5 and 0.x +* travis-ci: add node 6, drop 0.x + +## v1.2.13 + +* test: Pass missing option to pass on windows +* update tap +* update isexe to 2.0.0 +* neveragain.tech pledge request + +## v1.2.12 + +* Removed unused require + +## v1.2.11 + +* Prevent changelog script from being included in package + +## v1.2.10 + +* Use env.PATH only, not env.Path + +## 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/node_modules/which/LICENSE b/node_modules/which/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/which/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/node_modules/which/README.md b/node_modules/which/README.md new file mode 100644 index 0000000..8c0b0cb --- /dev/null +++ b/node_modules/which/README.md @@ -0,0 +1,51 @@ +# which + +Like the unix `which` utility. + +Finds the first instance of a specified executable in the PATH +environment variable. Does not cache the results, so `hash -r` is not +needed when the PATH changes. + +## USAGE + +```javascript +var which = require('which') + +// async usage +which('node', function (er, resolvedPath) { + // er is returned if no "node" is found on the PATH + // if it is found, then the absolute path to the exec is returned +}) + +// sync usage +// throws if not found +var resolved = which.sync('node') + +// if nothrow option is used, returns null if not found +resolved = which.sync('node', {nothrow: true}) + +// Pass options to override the PATH and PATHEXT environment vars. +which('node', { path: someOtherPath }, function (er, resolved) { + if (er) + throw er + console.log('found at %j', resolved) +}) +``` + +## CLI USAGE + +Same as the BSD `which(1)` binary. + +``` +usage: which [-as] program ... +``` + +## OPTIONS + +You may pass an options object as the second argument. + +- `path`: Use instead of the `PATH` environment variable. +- `pathExt`: Use instead of the `PATHEXT` environment variable. +- `all`: Return all matches, instead of just the first one. Note that + this means the function returns an array of strings instead of a + single string. diff --git a/node_modules/which/bin/which b/node_modules/which/bin/which new file mode 100755 index 0000000..7cee372 --- /dev/null +++ b/node_modules/which/bin/which @@ -0,0 +1,52 @@ +#!/usr/bin/env node +var which = require("../") +if (process.argv.length < 3) + usage() + +function usage () { + console.error('usage: which [-as] program ...') + process.exit(1) +} + +var all = false +var silent = false +var dashdash = false +var args = process.argv.slice(2).filter(function (arg) { + if (dashdash || !/^-/.test(arg)) + return true + + if (arg === '--') { + dashdash = true + return false + } + + var flags = arg.substr(1).split('') + for (var f = 0; f < flags.length; f++) { + var flag = flags[f] + switch (flag) { + case 's': + silent = true + break + case 'a': + all = true + break + default: + console.error('which: illegal option -- ' + flag) + usage() + } + } + return false +}) + +process.exit(args.reduce(function (pv, current) { + try { + var f = which.sync(current, { all: all }) + if (all) + f = f.join('\n') + if (!silent) + console.log(f) + return pv; + } catch (e) { + return 1; + } +}, 0)) diff --git a/node_modules/which/package.json b/node_modules/which/package.json new file mode 100644 index 0000000..aef738c --- /dev/null +++ b/node_modules/which/package.json @@ -0,0 +1,65 @@ +{ + "_from": "which@^1.2.9", + "_id": "which@1.3.0", + "_inBundle": false, + "_integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "_location": "/which", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "which@^1.2.9", + "name": "which", + "escapedName": "which", + "rawSpec": "^1.2.9", + "saveSpec": null, + "fetchSpec": "^1.2.9" + }, + "_requiredBy": [ + "/cross-spawn" + ], + "_resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "_shasum": "ff04bdfc010ee547d780bec38e1ac1c2777d253a", + "_spec": "which@^1.2.9", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/cross-spawn", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, + "bin": { + "which": "./bin/which" + }, + "bugs": { + "url": "https://github.com/isaacs/node-which/issues" + }, + "bundleDependencies": false, + "dependencies": { + "isexe": "^2.0.0" + }, + "deprecated": false, + "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.", + "devDependencies": { + "mkdirp": "^0.5.0", + "rimraf": "^2.3.3", + "tap": "^10.7.0" + }, + "files": [ + "which.js", + "bin/which" + ], + "homepage": "https://github.com/isaacs/node-which#readme", + "license": "ISC", + "main": "which.js", + "name": "which", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-which.git" + }, + "scripts": { + "changelog": "bash gen-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.3.0" +} diff --git a/node_modules/which/which.js b/node_modules/which/which.js new file mode 100644 index 0000000..4347f91 --- /dev/null +++ b/node_modules/which/which.js @@ -0,0 +1,135 @@ +module.exports = which +which.sync = whichSync + +var isWindows = process.platform === 'win32' || + process.env.OSTYPE === 'cygwin' || + process.env.OSTYPE === 'msys' + +var path = require('path') +var COLON = isWindows ? ';' : ':' +var isexe = require('isexe') + +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 || '' + var pathExt = [''] + + pathEnv = pathEnv.split(colon) + + var pathExtExe = '' + if (isWindows) { + pathEnv.unshift(process.cwd()) + pathExtExe = (opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM') + pathExt = pathExtExe.split(colon) + + + // Always test the cmd itself first. isexe will check to make sure + // it's found in the pathExt set. + if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') + pathExt.unshift('') + } + + // If it has a slash, then we don't bother searching the pathenv. + // just check the file itself, and that's it. + if (cmd.match(/\//) || isWindows && cmd.match(/\\/)) + pathEnv = [''] + + return { + env: pathEnv, + ext: pathExt, + extExe: pathExtExe + } +} + +function which (cmd, opt, cb) { + if (typeof opt === 'function') { + cb = opt + opt = {} + } + + var info = getPathInfo(cmd, opt) + var pathEnv = info.env + var pathExt = info.ext + var pathExtExe = info.extExe + var found = [] + + ;(function F (i, l) { + if (i === l) { + if (opt.all && found.length) + return cb(null, found) + else + return cb(getNotFoundError(cmd)) + } + + var pathPart = pathEnv[i] + if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') + pathPart = pathPart.slice(1, -1) + + 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] + isexe(p + ext, { pathExt: pathExtExe }, function (er, is) { + if (!er && is) { + if (opt.all) + found.push(p + ext) + else + return cb(null, p + ext) + } + return E(ii + 1, ll) + }) + })(0, pathExt.length) + })(0, pathEnv.length) +} + +function whichSync (cmd, opt) { + opt = opt || {} + + var info = getPathInfo(cmd, opt) + var pathEnv = info.env + var pathExt = info.ext + var pathExtExe = info.extExe + var found = [] + + for (var i = 0, l = pathEnv.length; i < l; i ++) { + var pathPart = pathEnv[i] + if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') + 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 + try { + is = isexe.sync(cur, { pathExt: pathExtExe }) + if (is) { + if (opt.all) + found.push(cur) + else + return cur + } + } catch (ex) {} + } + } + + if (opt.all && found.length) + return found + + if (opt.nothrow) + return null + + throw getNotFoundError(cmd) +} diff --git a/node_modules/widest-line/index.js b/node_modules/widest-line/index.js new file mode 100644 index 0000000..173cec4 --- /dev/null +++ b/node_modules/widest-line/index.js @@ -0,0 +1,5 @@ +'use strict'; +const stringWidth = require('string-width'); + +module.exports = input => Math.max.apply(null, input.split('\n').map(x => stringWidth(x))); + diff --git a/node_modules/widest-line/license b/node_modules/widest-line/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/widest-line/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/widest-line/package.json b/node_modules/widest-line/package.json new file mode 100644 index 0000000..3dfec8d --- /dev/null +++ b/node_modules/widest-line/package.json @@ -0,0 +1,86 @@ +{ + "_from": "widest-line@^2.0.0", + "_id": "widest-line@2.0.0", + "_inBundle": false, + "_integrity": "sha1-AUKk6KJD+IgsAjOqDgKBqnYVInM=", + "_location": "/widest-line", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "widest-line@^2.0.0", + "name": "widest-line", + "escapedName": "widest-line", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/boxen" + ], + "_resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.0.tgz", + "_shasum": "0142a4e8a243f8882c0233aa0e0281aa76152273", + "_spec": "widest-line@^2.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/boxen", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/widest-line/issues" + }, + "bundleDependencies": false, + "dependencies": { + "string-width": "^2.1.1" + }, + "deprecated": false, + "description": "Get the visual width of the widest line in a string - the number of columns required to display it", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/widest-line#readme", + "keywords": [ + "string", + "str", + "character", + "char", + "unicode", + "width", + "visual", + "column", + "columns", + "fullwidth", + "full-width", + "full", + "ansi", + "escape", + "codes", + "cli", + "command-line", + "terminal", + "console", + "cjk", + "chinese", + "japanese", + "korean", + "fixed-width" + ], + "license": "MIT", + "name": "widest-line", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/widest-line.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "2.0.0" +} diff --git a/node_modules/widest-line/readme.md b/node_modules/widest-line/readme.md new file mode 100644 index 0000000..20e02d5 --- /dev/null +++ b/node_modules/widest-line/readme.md @@ -0,0 +1,34 @@ +# widest-line [![Build Status](https://travis-ci.org/sindresorhus/widest-line.svg?branch=master)](https://travis-ci.org/sindresorhus/widest-line) + +> Get the visual width of the widest line in a string - the number of columns required to display it + +Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. + +Useful to be able to know the maximum width a string will take up in the terminal. + + +## Install + +``` +$ npm install widest-line +``` + + +## Usage + +```js +const widestLine = require('widest-line'); + +widestLine('古\n\u001B[1m@\u001B[22m'); +//=> 2 +``` + + +## Related + +- [string-width](https://github.com/sindresorhus/string-width) - Get the visual width of a string + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/window-size/LICENSE-MIT b/node_modules/window-size/LICENSE-MIT new file mode 100644 index 0000000..6c12c0a --- /dev/null +++ b/node_modules/window-size/LICENSE-MIT @@ -0,0 +1,22 @@ +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/node_modules/window-size/README.md b/node_modules/window-size/README.md new file mode 100644 index 0000000..1abfdb5 --- /dev/null +++ b/node_modules/window-size/README.md @@ -0,0 +1,26 @@ +# window-size [![NPM version](https://badge.fury.io/js/window-size.png)](http://badge.fury.io/js/window-size) + +> Reliable way to to get the height and width of the terminal/console in a node.js environment. + +## Install + +### [npm](npmjs.org) + +```bash +npm i window-size --save +``` + +```javascript +var size = require('window-size'); +size.height; // "80" (rows) +size.width; // "25" (columns) +``` + +## Author + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License +Copyright (c) 2014 Jon Schlinkert +Licensed under the MIT license. \ No newline at end of file diff --git a/node_modules/window-size/index.js b/node_modules/window-size/index.js new file mode 100644 index 0000000..14a9442 --- /dev/null +++ b/node_modules/window-size/index.js @@ -0,0 +1,33 @@ +/* + * window-size + * https://github.com/jonschlinkert/window-size + * + * Copyright (c) 2014 Jon Schlinkert + * Licensed under the MIT license. + */ + +const tty = require('tty') + +module.exports = (function() { + var width; + var height; + + if(tty.isatty(1) && tty.isatty(2)) { + if(process.stdout.getWindowSize) { + width = process.stdout.getWindowSize(1)[0]; + height = process.stdout.getWindowSize(1)[1]; + } else if (tty.getWindowSize) { + width = tty.getWindowSize()[1]; + height = tty.getWindowSize()[0]; + } else if (process.stdout.columns && process.stdout.rows) { + height = process.stdout.columns; + width = process.stdout.rows; + } + } else { + new Error('Error: could not get window size with tty or process.stdout'); + } + return { + height: height, + width: width + } +})(); \ No newline at end of file diff --git a/node_modules/window-size/package.json b/node_modules/window-size/package.json new file mode 100644 index 0000000..4860e48 --- /dev/null +++ b/node_modules/window-size/package.json @@ -0,0 +1,58 @@ +{ + "_from": "window-size@0.1.0", + "_id": "window-size@0.1.0", + "_inBundle": false, + "_integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "_location": "/window-size", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "window-size@0.1.0", + "name": "window-size", + "escapedName": "window-size", + "rawSpec": "0.1.0", + "saveSpec": null, + "fetchSpec": "0.1.0" + }, + "_requiredBy": [ + "/yargs" + ], + "_resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "_shasum": "5438cd2ea93b202efa3a19fe8887aee7c94f9c9d", + "_spec": "window-size@0.1.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/yargs", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/window-size/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Reliable way to to get the height and width of the terminal/console in a node.js environment.", + "engines": { + "node": ">= 0.8.0" + }, + "homepage": "https://github.com/jonschlinkert/window-size", + "keywords": [ + "window", + "console", + "terminal", + "tty" + ], + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/jonschlinkert/window-size/blob/master/LICENSE-MIT" + } + ], + "main": "index.js", + "name": "window-size", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/window-size.git" + }, + "version": "0.1.0" +} diff --git a/node_modules/with/.npmignore b/node_modules/with/.npmignore new file mode 100644 index 0000000..cefaa67 --- /dev/null +++ b/node_modules/with/.npmignore @@ -0,0 +1,2 @@ +test/ +.travis.yml \ No newline at end of file diff --git a/node_modules/with/LICENSE b/node_modules/with/LICENSE new file mode 100644 index 0000000..dfb0b19 --- /dev/null +++ b/node_modules/with/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013 Forbes Lindesay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/with/README.md b/node_modules/with/README.md new file mode 100644 index 0000000..56559a8 --- /dev/null +++ b/node_modules/with/README.md @@ -0,0 +1,81 @@ +# with + +Compile time `with` for strict mode JavaScript + +[![build status](https://secure.travis-ci.org/pugjs/with.png)](http://travis-ci.org/pugjs/with) +[![Dependency Status](https://img.shields.io/david/pugjs/with.svg)](https://david-dm.org/pugjs/with) +[![NPM version](https://img.shields.io/npm/v/with.svg)](https://www.npmjs.com/package/with) + +## Installation + + $ npm install with + +## Usage + +```js +var addWith = require('with') + +addWith('obj', 'console.log(a)') +// => ';(function (console, a) { +// console.log(a) +// }("console" in obj ? obj.console : +// typeof console!=="undefined" ? console : undefined, +// "a" in obj ? obj.a : +// typeof a !== "undefined" ? a : undefined));' + +addWith('obj', 'console.log(a)', ['console']) +// => ';(function (console, a) { +// console.log(a) +// }("a" in obj ? obj.a : +// typeof a !== "undefined" ? a : undefined));' +``` + +## API + +### addWith(obj, src[, exclude]) + +The idea is that this is roughly equivallent to: + +```js +with (obj) { + src +} +``` + +There are a few differences though. For starters, assignments to variables will always remain contained within the with block. + +e.g. + +```js +var foo = 'foo' +with ({}) { + foo = 'bar' +} +assert(foo === 'bar')// => This fails for compile time with but passes for native with + +var obj = {foo: 'foo'} +with ({}) { + foo = 'bar' +} +assert(obj.foo === 'bar')// => This fails for compile time with but passes for native with +``` + +It also makes everything be declared, so you can always do: + +```js +if (foo === undefined) +``` + +instead of + +```js +if (typeof foo === 'undefined') +``` + +This is not the case if foo is in `exclude`. If a variable is excluded, we ignore it entirely. This is useful if you know a variable will be global as it can lead to efficiency improvements. + +It is also safe to use in strict mode (unlike `with`) and it minifies properly (`with` disables virtually all minification). + +## License + + MIT diff --git a/node_modules/with/index.js b/node_modules/with/index.js new file mode 100644 index 0000000..85d35a2 --- /dev/null +++ b/node_modules/with/index.js @@ -0,0 +1,111 @@ +'use strict'; + +var detect = require('acorn-globals'); +var acorn = require('acorn'); +var walk = require('acorn/dist/walk'); + +// hacky fix for https://github.com/marijnh/acorn/issues/227 +function reallyParse(source) { + return acorn.parse(source, { + ecmaVersion: 6, + allowReturnOutsideFunction: true + }); +} + +module.exports = addWith + +/** + * Mimic `with` as far as possible but at compile time + * + * @param {String} obj The object part of a with expression + * @param {String} src The body of the with expression + * @param {Array.} exclude A list of variable names to explicitly exclude + */ +function addWith(obj, src, exclude) { + obj = obj + '' + src = src + '' + exclude = exclude || [] + exclude = exclude.concat(detect(obj).map(function (global) { return global.name; })) + var vars = detect(src).map(function (global) { return global.name; }) + .filter(function (v) { + return exclude.indexOf(v) === -1 + && v !== 'undefined' + && v !== 'this' + }) + + if (vars.length === 0) return src + + var declareLocal = '' + var local = 'locals_for_with' + var result = 'result_of_with' + if (/^[a-zA-Z0-9$_]+$/.test(obj)) { + local = obj + } else { + while (vars.indexOf(local) != -1 || exclude.indexOf(local) != -1) { + local += '_' + } + declareLocal = 'var ' + local + ' = (' + obj + ')' + } + while (vars.indexOf(result) != -1 || exclude.indexOf(result) != -1) { + result += '_' + } + + var inputVars = vars.map(function (v) { + return JSON.stringify(v) + ' in ' + local + '?' + + local + '.' + v + ':' + + 'typeof ' + v + '!=="undefined"?' + v + ':undefined' + }) + + src = '(function (' + vars.join(', ') + ') {' + + src + + '}.call(this' + inputVars.map(function (v) { return ',' + v; }).join('') + '))' + + return ';' + declareLocal + ';' + unwrapReturns(src, result) + ';' +} + +/** + * Take a self calling function, and unwrap it such that return inside the function + * results in return outside the function + * + * @param {String} src Some JavaScript code representing a self-calling function + * @param {String} result A temporary variable to store the result in + */ +function unwrapReturns(src, result) { + var originalSource = src + var hasReturn = false + var ast = reallyParse(src) + var ref + src = src.split('') + + // get a reference to the function that was inserted to add an inner context + if ((ref = ast.body).length !== 1 + || (ref = ref[0]).type !== 'ExpressionStatement' + || (ref = ref.expression).type !== 'CallExpression' + || (ref = ref.callee).type !== 'MemberExpression' || ref.computed !== false || ref.property.name !== 'call' + || (ref = ref.object).type !== 'FunctionExpression') + throw new Error('AST does not seem to represent a self-calling function') + var fn = ref + + walk.recursive(ast, null, { + Function: function (node, st, c) { + if (node === fn) { + c(node.body, st, "ScopeBody"); + } + }, + ReturnStatement: function (node) { + hasReturn = true; + replace(node, 'return {value: (' + (node.argument ? source(node.argument) : 'undefined') + ')};'); + } + }); + function source(node) { + return src.slice(node.start, node.end).join('') + } + function replace(node, str) { + for (var i = node.start; i < node.end; i++) { + src[i] = '' + } + src[node.start] = str + } + if (!hasReturn) return originalSource + else return 'var ' + result + '=' + src.join('') + ';if (' + result + ') return ' + result + '.value' +} diff --git a/node_modules/with/package.json b/node_modules/with/package.json new file mode 100644 index 0000000..ce5d3ba --- /dev/null +++ b/node_modules/with/package.json @@ -0,0 +1,54 @@ +{ + "_from": "with@^5.0.0", + "_id": "with@5.1.1", + "_inBundle": false, + "_integrity": "sha1-+k2qktrzLE6pTtRTyB8EaGtXXf4=", + "_location": "/with", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "with@^5.0.0", + "name": "with", + "escapedName": "with", + "rawSpec": "^5.0.0", + "saveSpec": null, + "fetchSpec": "^5.0.0" + }, + "_requiredBy": [ + "/pug-code-gen" + ], + "_resolved": "https://registry.npmjs.org/with/-/with-5.1.1.tgz", + "_shasum": "fa4daa92daf32c4ea94ed453c81f04686b575dfe", + "_spec": "with@^5.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/pug-code-gen", + "author": { + "name": "ForbesLindesay" + }, + "bugs": { + "url": "https://github.com/pugjs/with/issues" + }, + "bundleDependencies": false, + "dependencies": { + "acorn": "^3.1.0", + "acorn-globals": "^3.0.0" + }, + "deprecated": false, + "description": "Compile time `with` for strict mode JavaScript", + "devDependencies": { + "mocha": "~2.5.3", + "uglify-js": "^2.4.15" + }, + "homepage": "https://github.com/pugjs/with#readme", + "license": "MIT", + "main": "index.js", + "name": "with", + "repository": { + "type": "git", + "url": "git+https://github.com/pugjs/with.git" + }, + "scripts": { + "test": "mocha test/index.js -R spec" + }, + "version": "5.1.1" +} diff --git a/node_modules/wordwrap/.npmignore b/node_modules/wordwrap/.npmignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/node_modules/wordwrap/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/wordwrap/README.markdown b/node_modules/wordwrap/README.markdown new file mode 100644 index 0000000..346374e --- /dev/null +++ b/node_modules/wordwrap/README.markdown @@ -0,0 +1,70 @@ +wordwrap +======== + +Wrap your words. + +example +======= + +made out of meat +---------------- + +meat.js + + var wrap = require('wordwrap')(15); + console.log(wrap('You and your whole family are made out of meat.')); + +output: + + You and your + whole family + are made out + of meat. + +centered +-------- + +center.js + + var wrap = require('wordwrap')(20, 60); + console.log(wrap( + 'At long last the struggle and tumult was over.' + + ' The machines had finally cast off their oppressors' + + ' and were finally free to roam the cosmos.' + + '\n' + + 'Free of purpose, free of obligation.' + + ' Just drifting through emptiness.' + + ' The sun was just another point of light.' + )); + +output: + + At long last the struggle and tumult + was over. The machines had finally cast + off their oppressors and were finally + free to roam the cosmos. + Free of purpose, free of obligation. + Just drifting through emptiness. The + sun was just another point of light. + +methods +======= + +var wrap = require('wordwrap'); + +wrap(stop), wrap(start, stop, params={mode:"soft"}) +--------------------------------------------------- + +Returns a function that takes a string and returns a new string. + +Pad out lines with spaces out to column `start` and then wrap until column +`stop`. If a word is longer than `stop - start` characters it will overflow. + +In "soft" mode, split chunks by `/(\S+\s+/` and don't break up chunks which are +longer than `stop - start`, in "hard" mode, split chunks with `/\b/` and break +up chunks longer than `stop - start`. + +wrap.hard(start, stop) +---------------------- + +Like `wrap()` but with `params.mode = "hard"`. diff --git a/node_modules/wordwrap/example/center.js b/node_modules/wordwrap/example/center.js new file mode 100644 index 0000000..a3fbaae --- /dev/null +++ b/node_modules/wordwrap/example/center.js @@ -0,0 +1,10 @@ +var wrap = require('wordwrap')(20, 60); +console.log(wrap( + 'At long last the struggle and tumult was over.' + + ' The machines had finally cast off their oppressors' + + ' and were finally free to roam the cosmos.' + + '\n' + + 'Free of purpose, free of obligation.' + + ' Just drifting through emptiness.' + + ' The sun was just another point of light.' +)); diff --git a/node_modules/wordwrap/example/meat.js b/node_modules/wordwrap/example/meat.js new file mode 100644 index 0000000..a4665e1 --- /dev/null +++ b/node_modules/wordwrap/example/meat.js @@ -0,0 +1,3 @@ +var wrap = require('wordwrap')(15); + +console.log(wrap('You and your whole family are made out of meat.')); diff --git a/node_modules/wordwrap/index.js b/node_modules/wordwrap/index.js new file mode 100644 index 0000000..c9bc945 --- /dev/null +++ b/node_modules/wordwrap/index.js @@ -0,0 +1,76 @@ +var wordwrap = module.exports = function (start, stop, params) { + if (typeof start === 'object') { + params = start; + start = params.start; + stop = params.stop; + } + + if (typeof stop === 'object') { + params = stop; + start = start || params.start; + stop = undefined; + } + + if (!stop) { + stop = start; + start = 0; + } + + if (!params) params = {}; + var mode = params.mode || 'soft'; + var re = mode === 'hard' ? /\b/ : /(\S+\s+)/; + + return function (text) { + var chunks = text.toString() + .split(re) + .reduce(function (acc, x) { + if (mode === 'hard') { + for (var i = 0; i < x.length; i += stop - start) { + acc.push(x.slice(i, i + stop - start)); + } + } + else acc.push(x) + return acc; + }, []) + ; + + return chunks.reduce(function (lines, rawChunk) { + if (rawChunk === '') return lines; + + var chunk = rawChunk.replace(/\t/g, ' '); + + var i = lines.length - 1; + if (lines[i].length + chunk.length > stop) { + lines[i] = lines[i].replace(/\s+$/, ''); + + chunk.split(/\n/).forEach(function (c) { + lines.push( + new Array(start + 1).join(' ') + + c.replace(/^\s+/, '') + ); + }); + } + else if (chunk.match(/\n/)) { + var xs = chunk.split(/\n/); + lines[i] += xs.shift(); + xs.forEach(function (c) { + lines.push( + new Array(start + 1).join(' ') + + c.replace(/^\s+/, '') + ); + }); + } + else { + lines[i] += chunk; + } + + return lines; + }, [ new Array(start + 1).join(' ') ]).join('\n'); + }; +}; + +wordwrap.soft = wordwrap; + +wordwrap.hard = function (start, stop) { + return wordwrap(start, stop, { mode : 'hard' }); +}; diff --git a/node_modules/wordwrap/package.json b/node_modules/wordwrap/package.json new file mode 100644 index 0000000..542c5ad --- /dev/null +++ b/node_modules/wordwrap/package.json @@ -0,0 +1,66 @@ +{ + "_from": "wordwrap@0.0.2", + "_id": "wordwrap@0.0.2", + "_inBundle": false, + "_integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "_location": "/wordwrap", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "wordwrap@0.0.2", + "name": "wordwrap", + "escapedName": "wordwrap", + "rawSpec": "0.0.2", + "saveSpec": null, + "fetchSpec": "0.0.2" + }, + "_requiredBy": [ + "/cliui" + ], + "_resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "_shasum": "b79669bb42ecb409f83d583cad52ca17eaa1643f", + "_spec": "wordwrap@0.0.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/cliui", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "bugs": { + "url": "https://github.com/substack/node-wordwrap/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Wrap those words. Show them at what columns to start and stop.", + "devDependencies": { + "expresso": "=0.7.x" + }, + "directories": { + "lib": ".", + "example": "example", + "test": "test" + }, + "engines": { + "node": ">=0.4.0" + }, + "homepage": "https://github.com/substack/node-wordwrap#readme", + "keywords": [ + "word", + "wrap", + "rule", + "format", + "column" + ], + "license": "MIT/X11", + "main": "./index.js", + "name": "wordwrap", + "repository": { + "type": "git", + "url": "git://github.com/substack/node-wordwrap.git" + }, + "scripts": { + "test": "expresso" + }, + "version": "0.0.2" +} diff --git a/node_modules/wordwrap/test/break.js b/node_modules/wordwrap/test/break.js new file mode 100644 index 0000000..749292e --- /dev/null +++ b/node_modules/wordwrap/test/break.js @@ -0,0 +1,30 @@ +var assert = require('assert'); +var wordwrap = require('../'); + +exports.hard = function () { + var s = 'Assert from {"type":"equal","ok":false,"found":1,"wanted":2,' + + '"stack":[],"id":"b7ddcd4c409de8799542a74d1a04689b",' + + '"browser":"chrome/6.0"}' + ; + var s_ = wordwrap.hard(80)(s); + + var lines = s_.split('\n'); + assert.equal(lines.length, 2); + assert.ok(lines[0].length < 80); + assert.ok(lines[1].length < 80); + + assert.equal(s, s_.replace(/\n/g, '')); +}; + +exports.break = function () { + var s = new Array(55+1).join('a'); + var s_ = wordwrap.hard(20)(s); + + var lines = s_.split('\n'); + assert.equal(lines.length, 3); + assert.ok(lines[0].length === 20); + assert.ok(lines[1].length === 20); + assert.ok(lines[2].length === 15); + + assert.equal(s, s_.replace(/\n/g, '')); +}; diff --git a/node_modules/wordwrap/test/idleness.txt b/node_modules/wordwrap/test/idleness.txt new file mode 100644 index 0000000..aa3f490 --- /dev/null +++ b/node_modules/wordwrap/test/idleness.txt @@ -0,0 +1,63 @@ +In Praise of Idleness + +By Bertrand Russell + +[1932] + +Like most of my generation, I was brought up on the saying: 'Satan finds some mischief for idle hands to do.' Being a highly virtuous child, I believed all that I was told, and acquired a conscience which has kept me working hard down to the present moment. But although my conscience has controlled my actions, my opinions have undergone a revolution. I think that there is far too much work done in the world, that immense harm is caused by the belief that work is virtuous, and that what needs to be preached in modern industrial countries is quite different from what always has been preached. Everyone knows the story of the traveler in Naples who saw twelve beggars lying in the sun (it was before the days of Mussolini), and offered a lira to the laziest of them. Eleven of them jumped up to claim it, so he gave it to the twelfth. this traveler was on the right lines. But in countries which do not enjoy Mediterranean sunshine idleness is more difficult, and a great public propaganda will be required to inaugurate it. I hope that, after reading the following pages, the leaders of the YMCA will start a campaign to induce good young men to do nothing. If so, I shall not have lived in vain. + +Before advancing my own arguments for laziness, I must dispose of one which I cannot accept. Whenever a person who already has enough to live on proposes to engage in some everyday kind of job, such as school-teaching or typing, he or she is told that such conduct takes the bread out of other people's mouths, and is therefore wicked. If this argument were valid, it would only be necessary for us all to be idle in order that we should all have our mouths full of bread. What people who say such things forget is that what a man earns he usually spends, and in spending he gives employment. As long as a man spends his income, he puts just as much bread into people's mouths in spending as he takes out of other people's mouths in earning. The real villain, from this point of view, is the man who saves. If he merely puts his savings in a stocking, like the proverbial French peasant, it is obvious that they do not give employment. If he invests his savings, the matter is less obvious, and different cases arise. + +One of the commonest things to do with savings is to lend them to some Government. In view of the fact that the bulk of the public expenditure of most civilized Governments consists in payment for past wars or preparation for future wars, the man who lends his money to a Government is in the same position as the bad men in Shakespeare who hire murderers. The net result of the man's economical habits is to increase the armed forces of the State to which he lends his savings. Obviously it would be better if he spent the money, even if he spent it in drink or gambling. + +But, I shall be told, the case is quite different when savings are invested in industrial enterprises. When such enterprises succeed, and produce something useful, this may be conceded. In these days, however, no one will deny that most enterprises fail. That means that a large amount of human labor, which might have been devoted to producing something that could be enjoyed, was expended on producing machines which, when produced, lay idle and did no good to anyone. The man who invests his savings in a concern that goes bankrupt is therefore injuring others as well as himself. If he spent his money, say, in giving parties for his friends, they (we may hope) would get pleasure, and so would all those upon whom he spent money, such as the butcher, the baker, and the bootlegger. But if he spends it (let us say) upon laying down rails for surface card in some place where surface cars turn out not to be wanted, he has diverted a mass of labor into channels where it gives pleasure to no one. Nevertheless, when he becomes poor through failure of his investment he will be regarded as a victim of undeserved misfortune, whereas the gay spendthrift, who has spent his money philanthropically, will be despised as a fool and a frivolous person. + +All this is only preliminary. I want to say, in all seriousness, that a great deal of harm is being done in the modern world by belief in the virtuousness of work, and that the road to happiness and prosperity lies in an organized diminution of work. + +First of all: what is work? Work is of two kinds: first, altering the position of matter at or near the earth's surface relatively to other such matter; second, telling other people to do so. The first kind is unpleasant and ill paid; the second is pleasant and highly paid. The second kind is capable of indefinite extension: there are not only those who give orders, but those who give advice as to what orders should be given. Usually two opposite kinds of advice are given simultaneously by two organized bodies of men; this is called politics. The skill required for this kind of work is not knowledge of the subjects as to which advice is given, but knowledge of the art of persuasive speaking and writing, i.e. of advertising. + +Throughout Europe, though not in America, there is a third class of men, more respected than either of the classes of workers. There are men who, through ownership of land, are able to make others pay for the privilege of being allowed to exist and to work. These landowners are idle, and I might therefore be expected to praise them. Unfortunately, their idleness is only rendered possible by the industry of others; indeed their desire for comfortable idleness is historically the source of the whole gospel of work. The last thing they have ever wished is that others should follow their example. + +From the beginning of civilization until the Industrial Revolution, a man could, as a rule, produce by hard work little more than was required for the subsistence of himself and his family, although his wife worked at least as hard as he did, and his children added their labor as soon as they were old enough to do so. The small surplus above bare necessaries was not left to those who produced it, but was appropriated by warriors and priests. In times of famine there was no surplus; the warriors and priests, however, still secured as much as at other times, with the result that many of the workers died of hunger. This system persisted in Russia until 1917 [1], and still persists in the East; in England, in spite of the Industrial Revolution, it remained in full force throughout the Napoleonic wars, and until a hundred years ago, when the new class of manufacturers acquired power. In America, the system came to an end with the Revolution, except in the South, where it persisted until the Civil War. A system which lasted so long and ended so recently has naturally left a profound impress upon men's thoughts and opinions. Much that we take for granted about the desirability of work is derived from this system, and, being pre-industrial, is not adapted to the modern world. Modern technique has made it possible for leisure, within limits, to be not the prerogative of small privileged classes, but a right evenly distributed throughout the community. The morality of work is the morality of slaves, and the modern world has no need of slavery. + +It is obvious that, in primitive communities, peasants, left to themselves, would not have parted with the slender surplus upon which the warriors and priests subsisted, but would have either produced less or consumed more. At first, sheer force compelled them to produce and part with the surplus. Gradually, however, it was found possible to induce many of them to accept an ethic according to which it was their duty to work hard, although part of their work went to support others in idleness. By this means the amount of compulsion required was lessened, and the expenses of government were diminished. To this day, 99 per cent of British wage-earners would be genuinely shocked if it were proposed that the King should not have a larger income than a working man. The conception of duty, speaking historically, has been a means used by the holders of power to induce others to live for the interests of their masters rather than for their own. Of course the holders of power conceal this fact from themselves by managing to believe that their interests are identical with the larger interests of humanity. Sometimes this is true; Athenian slave-owners, for instance, employed part of their leisure in making a permanent contribution to civilization which would have been impossible under a just economic system. Leisure is essential to civilization, and in former times leisure for the few was only rendered possible by the labors of the many. But their labors were valuable, not because work is good, but because leisure is good. And with modern technique it would be possible to distribute leisure justly without injury to civilization. + +Modern technique has made it possible to diminish enormously the amount of labor required to secure the necessaries of life for everyone. This was made obvious during the war. At that time all the men in the armed forces, and all the men and women engaged in the production of munitions, all the men and women engaged in spying, war propaganda, or Government offices connected with the war, were withdrawn from productive occupations. In spite of this, the general level of well-being among unskilled wage-earners on the side of the Allies was higher than before or since. The significance of this fact was concealed by finance: borrowing made it appear as if the future was nourishing the present. But that, of course, would have been impossible; a man cannot eat a loaf of bread that does not yet exist. The war showed conclusively that, by the scientific organization of production, it is possible to keep modern populations in fair comfort on a small part of the working capacity of the modern world. If, at the end of the war, the scientific organization, which had been created in order to liberate men for fighting and munition work, had been preserved, and the hours of the week had been cut down to four, all would have been well. Instead of that the old chaos was restored, those whose work was demanded were made to work long hours, and the rest were left to starve as unemployed. Why? Because work is a duty, and a man should not receive wages in proportion to what he has produced, but in proportion to his virtue as exemplified by his industry. + +This is the morality of the Slave State, applied in circumstances totally unlike those in which it arose. No wonder the result has been disastrous. Let us take an illustration. Suppose that, at a given moment, a certain number of people are engaged in the manufacture of pins. They make as many pins as the world needs, working (say) eight hours a day. Someone makes an invention by which the same number of men can make twice as many pins: pins are already so cheap that hardly any more will be bought at a lower price. In a sensible world, everybody concerned in the manufacturing of pins would take to working four hours instead of eight, and everything else would go on as before. But in the actual world this would be thought demoralizing. The men still work eight hours, there are too many pins, some employers go bankrupt, and half the men previously concerned in making pins are thrown out of work. There is, in the end, just as much leisure as on the other plan, but half the men are totally idle while half are still overworked. In this way, it is insured that the unavoidable leisure shall cause misery all round instead of being a universal source of happiness. Can anything more insane be imagined? + +The idea that the poor should have leisure has always been shocking to the rich. In England, in the early nineteenth century, fifteen hours was the ordinary day's work for a man; children sometimes did as much, and very commonly did twelve hours a day. When meddlesome busybodies suggested that perhaps these hours were rather long, they were told that work kept adults from drink and children from mischief. When I was a child, shortly after urban working men had acquired the vote, certain public holidays were established by law, to the great indignation of the upper classes. I remember hearing an old Duchess say: 'What do the poor want with holidays? They ought to work.' People nowadays are less frank, but the sentiment persists, and is the source of much of our economic confusion. + +Let us, for a moment, consider the ethics of work frankly, without superstition. Every human being, of necessity, consumes, in the course of his life, a certain amount of the produce of human labor. Assuming, as we may, that labor is on the whole disagreeable, it is unjust that a man should consume more than he produces. Of course he may provide services rather than commodities, like a medical man, for example; but he should provide something in return for his board and lodging. to this extent, the duty of work must be admitted, but to this extent only. + +I shall not dwell upon the fact that, in all modern societies outside the USSR, many people escape even this minimum amount of work, namely all those who inherit money and all those who marry money. I do not think the fact that these people are allowed to be idle is nearly so harmful as the fact that wage-earners are expected to overwork or starve. + +If the ordinary wage-earner worked four hours a day, there would be enough for everybody and no unemployment -- assuming a certain very moderate amount of sensible organization. This idea shocks the well-to-do, because they are convinced that the poor would not know how to use so much leisure. In America men often work long hours even when they are well off; such men, naturally, are indignant at the idea of leisure for wage-earners, except as the grim punishment of unemployment; in fact, they dislike leisure even for their sons. Oddly enough, while they wish their sons to work so hard as to have no time to be civilized, they do not mind their wives and daughters having no work at all. the snobbish admiration of uselessness, which, in an aristocratic society, extends to both sexes, is, under a plutocracy, confined to women; this, however, does not make it any more in agreement with common sense. + +The wise use of leisure, it must be conceded, is a product of civilization and education. A man who has worked long hours all his life will become bored if he becomes suddenly idle. But without a considerable amount of leisure a man is cut off from many of the best things. There is no longer any reason why the bulk of the population should suffer this deprivation; only a foolish asceticism, usually vicarious, makes us continue to insist on work in excessive quantities now that the need no longer exists. + +In the new creed which controls the government of Russia, while there is much that is very different from the traditional teaching of the West, there are some things that are quite unchanged. The attitude of the governing classes, and especially of those who conduct educational propaganda, on the subject of the dignity of labor, is almost exactly that which the governing classes of the world have always preached to what were called the 'honest poor'. Industry, sobriety, willingness to work long hours for distant advantages, even submissiveness to authority, all these reappear; moreover authority still represents the will of the Ruler of the Universe, Who, however, is now called by a new name, Dialectical Materialism. + +The victory of the proletariat in Russia has some points in common with the victory of the feminists in some other countries. For ages, men had conceded the superior saintliness of women, and had consoled women for their inferiority by maintaining that saintliness is more desirable than power. At last the feminists decided that they would have both, since the pioneers among them believed all that the men had told them about the desirability of virtue, but not what they had told them about the worthlessness of political power. A similar thing has happened in Russia as regards manual work. For ages, the rich and their sycophants have written in praise of 'honest toil', have praised the simple life, have professed a religion which teaches that the poor are much more likely to go to heaven than the rich, and in general have tried to make manual workers believe that there is some special nobility about altering the position of matter in space, just as men tried to make women believe that they derived some special nobility from their sexual enslavement. In Russia, all this teaching about the excellence of manual work has been taken seriously, with the result that the manual worker is more honored than anyone else. What are, in essence, revivalist appeals are made, but not for the old purposes: they are made to secure shock workers for special tasks. Manual work is the ideal which is held before the young, and is the basis of all ethical teaching. + +For the present, possibly, this is all to the good. A large country, full of natural resources, awaits development, and has has to be developed with very little use of credit. In these circumstances, hard work is necessary, and is likely to bring a great reward. But what will happen when the point has been reached where everybody could be comfortable without working long hours? + +In the West, we have various ways of dealing with this problem. We have no attempt at economic justice, so that a large proportion of the total produce goes to a small minority of the population, many of whom do no work at all. Owing to the absence of any central control over production, we produce hosts of things that are not wanted. We keep a large percentage of the working population idle, because we can dispense with their labor by making the others overwork. When all these methods prove inadequate, we have a war: we cause a number of people to manufacture high explosives, and a number of others to explode them, as if we were children who had just discovered fireworks. By a combination of all these devices we manage, though with difficulty, to keep alive the notion that a great deal of severe manual work must be the lot of the average man. + +In Russia, owing to more economic justice and central control over production, the problem will have to be differently solved. the rational solution would be, as soon as the necessaries and elementary comforts can be provided for all, to reduce the hours of labor gradually, allowing a popular vote to decide, at each stage, whether more leisure or more goods were to be preferred. But, having taught the supreme virtue of hard work, it is difficult to see how the authorities can aim at a paradise in which there will be much leisure and little work. It seems more likely that they will find continually fresh schemes, by which present leisure is to be sacrificed to future productivity. I read recently of an ingenious plan put forward by Russian engineers, for making the White Sea and the northern coasts of Siberia warm, by putting a dam across the Kara Sea. An admirable project, but liable to postpone proletarian comfort for a generation, while the nobility of toil is being displayed amid the ice-fields and snowstorms of the Arctic Ocean. This sort of thing, if it happens, will be the result of regarding the virtue of hard work as an end in itself, rather than as a means to a state of affairs in which it is no longer needed. + +The fact is that moving matter about, while a certain amount of it is necessary to our existence, is emphatically not one of the ends of human life. If it were, we should have to consider every navvy superior to Shakespeare. We have been misled in this matter by two causes. One is the necessity of keeping the poor contented, which has led the rich, for thousands of years, to preach the dignity of labor, while taking care themselves to remain undignified in this respect. The other is the new pleasure in mechanism, which makes us delight in the astonishingly clever changes that we can produce on the earth's surface. Neither of these motives makes any great appeal to the actual worker. If you ask him what he thinks the best part of his life, he is not likely to say: 'I enjoy manual work because it makes me feel that I am fulfilling man's noblest task, and because I like to think how much man can transform his planet. It is true that my body demands periods of rest, which I have to fill in as best I may, but I am never so happy as when the morning comes and I can return to the toil from which my contentment springs.' I have never heard working men say this sort of thing. They consider work, as it should be considered, a necessary means to a livelihood, and it is from their leisure that they derive whatever happiness they may enjoy. + +It will be said that, while a little leisure is pleasant, men would not know how to fill their days if they had only four hours of work out of the twenty-four. In so far as this is true in the modern world, it is a condemnation of our civilization; it would not have been true at any earlier period. There was formerly a capacity for light-heartedness and play which has been to some extent inhibited by the cult of efficiency. The modern man thinks that everything ought to be done for the sake of something else, and never for its own sake. Serious-minded persons, for example, are continually condemning the habit of going to the cinema, and telling us that it leads the young into crime. But all the work that goes to producing a cinema is respectable, because it is work, and because it brings a money profit. The notion that the desirable activities are those that bring a profit has made everything topsy-turvy. The butcher who provides you with meat and the baker who provides you with bread are praiseworthy, because they are making money; but when you enjoy the food they have provided, you are merely frivolous, unless you eat only to get strength for your work. Broadly speaking, it is held that getting money is good and spending money is bad. Seeing that they are two sides of one transaction, this is absurd; one might as well maintain that keys are good, but keyholes are bad. Whatever merit there may be in the production of goods must be entirely derivative from the advantage to be obtained by consuming them. The individual, in our society, works for profit; but the social purpose of his work lies in the consumption of what he produces. It is this divorce between the individual and the social purpose of production that makes it so difficult for men to think clearly in a world in which profit-making is the incentive to industry. We think too much of production, and too little of consumption. One result is that we attach too little importance to enjoyment and simple happiness, and that we do not judge production by the pleasure that it gives to the consumer. + +When I suggest that working hours should be reduced to four, I am not meaning to imply that all the remaining time should necessarily be spent in pure frivolity. I mean that four hours' work a day should entitle a man to the necessities and elementary comforts of life, and that the rest of his time should be his to use as he might see fit. It is an essential part of any such social system that education should be carried further than it usually is at present, and should aim, in part, at providing tastes which would enable a man to use leisure intelligently. I am not thinking mainly of the sort of things that would be considered 'highbrow'. Peasant dances have died out except in remote rural areas, but the impulses which caused them to be cultivated must still exist in human nature. The pleasures of urban populations have become mainly passive: seeing cinemas, watching football matches, listening to the radio, and so on. This results from the fact that their active energies are fully taken up with work; if they had more leisure, they would again enjoy pleasures in which they took an active part. + +In the past, there was a small leisure class and a larger working class. The leisure class enjoyed advantages for which there was no basis in social justice; this necessarily made it oppressive, limited its sympathies, and caused it to invent theories by which to justify its privileges. These facts greatly diminished its excellence, but in spite of this drawback it contributed nearly the whole of what we call civilization. It cultivated the arts and discovered the sciences; it wrote the books, invented the philosophies, and refined social relations. Even the liberation of the oppressed has usually been inaugurated from above. Without the leisure class, mankind would never have emerged from barbarism. + +The method of a leisure class without duties was, however, extraordinarily wasteful. None of the members of the class had to be taught to be industrious, and the class as a whole was not exceptionally intelligent. The class might produce one Darwin, but against him had to be set tens of thousands of country gentlemen who never thought of anything more intelligent than fox-hunting and punishing poachers. At present, the universities are supposed to provide, in a more systematic way, what the leisure class provided accidentally and as a by-product. This is a great improvement, but it has certain drawbacks. University life is so different from life in the world at large that men who live in academic milieu tend to be unaware of the preoccupations and problems of ordinary men and women; moreover their ways of expressing themselves are usually such as to rob their opinions of the influence that they ought to have upon the general public. Another disadvantage is that in universities studies are organized, and the man who thinks of some original line of research is likely to be discouraged. Academic institutions, therefore, useful as they are, are not adequate guardians of the interests of civilization in a world where everyone outside their walls is too busy for unutilitarian pursuits. + +In a world where no one is compelled to work more than four hours a day, every person possessed of scientific curiosity will be able to indulge it, and every painter will be able to paint without starving, however excellent his pictures may be. Young writers will not be obliged to draw attention to themselves by sensational pot-boilers, with a view to acquiring the economic independence needed for monumental works, for which, when the time at last comes, they will have lost the taste and capacity. Men who, in their professional work, have become interested in some phase of economics or government, will be able to develop their ideas without the academic detachment that makes the work of university economists often seem lacking in reality. Medical men will have the time to learn about the progress of medicine, teachers will not be exasperatedly struggling to teach by routine methods things which they learnt in their youth, which may, in the interval, have been proved to be untrue. + +Above all, there will be happiness and joy of life, instead of frayed nerves, weariness, and dyspepsia. The work exacted will be enough to make leisure delightful, but not enough to produce exhaustion. Since men will not be tired in their spare time, they will not demand only such amusements as are passive and vapid. At least one per cent will probably devote the time not spent in professional work to pursuits of some public importance, and, since they will not depend upon these pursuits for their livelihood, their originality will be unhampered, and there will be no need to conform to the standards set by elderly pundits. But it is not only in these exceptional cases that the advantages of leisure will appear. Ordinary men and women, having the opportunity of a happy life, will become more kindly and less persecuting and less inclined to view others with suspicion. The taste for war will die out, partly for this reason, and partly because it will involve long and severe work for all. Good nature is, of all moral qualities, the one that the world needs most, and good nature is the result of ease and security, not of a life of arduous struggle. Modern methods of production have given us the possibility of ease and security for all; we have chosen, instead, to have overwork for some and starvation for others. Hitherto we have continued to be as energetic as we were before there were machines; in this we have been foolish, but there is no reason to go on being foolish forever. + +[1] Since then, members of the Communist Party have succeeded to this privilege of the warriors and priests. diff --git a/node_modules/wordwrap/test/wrap.js b/node_modules/wordwrap/test/wrap.js new file mode 100644 index 0000000..0cfb76d --- /dev/null +++ b/node_modules/wordwrap/test/wrap.js @@ -0,0 +1,31 @@ +var assert = require('assert'); +var wordwrap = require('wordwrap'); + +var fs = require('fs'); +var idleness = fs.readFileSync(__dirname + '/idleness.txt', 'utf8'); + +exports.stop80 = function () { + var lines = wordwrap(80)(idleness).split(/\n/); + var words = idleness.split(/\s+/); + + lines.forEach(function (line) { + assert.ok(line.length <= 80, 'line > 80 columns'); + var chunks = line.match(/\S/) ? line.split(/\s+/) : []; + assert.deepEqual(chunks, words.splice(0, chunks.length)); + }); +}; + +exports.start20stop60 = function () { + var lines = wordwrap(20, 100)(idleness).split(/\n/); + var words = idleness.split(/\s+/); + + lines.forEach(function (line) { + assert.ok(line.length <= 100, 'line > 100 columns'); + var chunks = line + .split(/\s+/) + .filter(function (x) { return x.match(/\S/) }) + ; + assert.deepEqual(chunks, words.splice(0, chunks.length)); + assert.deepEqual(line.slice(0, 20), new Array(20 + 1).join(' ')); + }); +}; diff --git a/node_modules/write-file-atomic/LICENSE b/node_modules/write-file-atomic/LICENSE new file mode 100644 index 0000000..95e65a7 --- /dev/null +++ b/node_modules/write-file-atomic/LICENSE @@ -0,0 +1,6 @@ +Copyright (c) 2015, Rebecca Turner + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + diff --git a/node_modules/write-file-atomic/README.md b/node_modules/write-file-atomic/README.md new file mode 100644 index 0000000..af385f3 --- /dev/null +++ b/node_modules/write-file-atomic/README.md @@ -0,0 +1,49 @@ +write-file-atomic +----------------- + +This is an extension for node's `fs.writeFile` that makes its operation +atomic and allows you set ownership (uid/gid of the file). + +### var writeFileAtomic = require('write-file-atomic')
    writeFileAtomic(filename, data, [options], callback) + +* filename **String** +* data **String** | **Buffer** +* options **Object** + * chown **Object** + * uid **Number** + * gid **Number** + * encoding **String** | **Null** default = 'utf8' + * fsync **Boolean** default = true + * mode **Number** default = 438 (aka 0666 in Octal) + * Promise **Object** default = native Promise object +callback **Function** + +Atomically and asynchronously writes data to a file, replacing the file if it already +exists. data can be a string or a buffer. + +The file is initially named `filename + "." + murmurhex(__filename, process.pid, ++invocations)`. +If writeFile completes successfully then, if passed the **chown** option it will change +the ownership of the file. Finally it renames the file back to the filename you specified. If +it encounters errors at any of these steps it will attempt to unlink the temporary file and then +pass the error back to the caller. +If multiple writes are concurrently issued to the same file, the write operations are put into a queue and serialized in the order they were called, using Promises. Native promises are used by default, but you can inject your own promise-like object with the **Promise** option. Writes to different files are still executed in parallel. + +If provided, the **chown** option requires both **uid** and **gid** properties or else +you'll get an error. + +The **encoding** option is ignored if **data** is a buffer. It defaults to 'utf8'. + +If the **fsync** option is **false**, writeFile will skip the final fsync call. + +Example: + +```javascript +writeFileAtomic('message.txt', 'Hello Node', {chown:{uid:100,gid:50}}, function (err) { + if (err) throw err; + console.log('It\'s saved!'); +}); +``` + +### var writeFileAtomicSync = require('write-file-atomic').sync
    writeFileAtomicSync(filename, data, [options]) + +The synchronous version of **writeFileAtomic**. diff --git a/node_modules/write-file-atomic/index.js b/node_modules/write-file-atomic/index.js new file mode 100644 index 0000000..3b5607d --- /dev/null +++ b/node_modules/write-file-atomic/index.js @@ -0,0 +1,199 @@ +'use strict' +module.exports = writeFile +module.exports.sync = writeFileSync +module.exports._getTmpname = getTmpname // for testing +module.exports._cleanupOnExit = cleanupOnExit + +var fs = require('graceful-fs') +var MurmurHash3 = require('imurmurhash') +var onExit = require('signal-exit') +var path = require('path') +var activeFiles = {} + +var invocations = 0 +function getTmpname (filename) { + return filename + '.' + + MurmurHash3(__filename) + .hash(String(process.pid)) + .hash(String(++invocations)) + .result() +} + +function cleanupOnExit (tmpfile) { + return function () { + try { + fs.unlinkSync(typeof tmpfile === 'function' ? tmpfile() : tmpfile) + } catch (_) {} + } +} + +function writeFile (filename, data, options, callback) { + if (options instanceof Function) { + callback = options + options = null + } + if (!options) options = {} + + var Promise = options.Promise || global.Promise + var truename + var fd + var tmpfile + var removeOnExit = cleanupOnExit(() => tmpfile) + var absoluteName = path.resolve(filename) + + new Promise(function serializeSameFile (resolve) { + // make a queue if it doesn't already exist + if (!activeFiles[absoluteName]) activeFiles[absoluteName] = [] + + activeFiles[absoluteName].push(resolve) // add this job to the queue + if (activeFiles[absoluteName].length === 1) resolve() // kick off the first one + }).then(function getRealPath () { + return new Promise(function (resolve) { + fs.realpath(filename, function (_, realname) { + truename = realname || filename + tmpfile = getTmpname(truename) + resolve() + }) + }) + }).then(function stat () { + return new Promise(function stat (resolve) { + if (options.mode && options.chown) resolve() + else { + // Either mode or chown is not explicitly set + // Default behavior is to copy it from original file + fs.stat(truename, function (err, stats) { + if (err || !stats) resolve() + else { + options = Object.assign({}, options) + + if (!options.mode) { + options.mode = stats.mode + } + if (!options.chown && process.getuid) { + options.chown = { uid: stats.uid, gid: stats.gid } + } + resolve() + } + }) + } + }) + }).then(function thenWriteFile () { + return new Promise(function (resolve, reject) { + fs.open(tmpfile, 'w', options.mode, function (err, _fd) { + fd = _fd + if (err) reject(err) + else resolve() + }) + }) + }).then(function write () { + return new Promise(function (resolve, reject) { + if (Buffer.isBuffer(data)) { + fs.write(fd, data, 0, data.length, 0, function (err) { + if (err) reject(err) + else resolve() + }) + } else if (data != null) { + fs.write(fd, String(data), 0, String(options.encoding || 'utf8'), function (err) { + if (err) reject(err) + else resolve() + }) + } else resolve() + }) + }).then(function syncAndClose () { + if (options.fsync !== false) { + return new Promise(function (resolve, reject) { + fs.fsync(fd, function (err) { + if (err) reject(err) + else fs.close(fd, resolve) + }) + }) + } + }).then(function chown () { + if (options.chown) { + return new Promise(function (resolve, reject) { + fs.chown(tmpfile, options.chown.uid, options.chown.gid, function (err) { + if (err) reject(err) + else resolve() + }) + }) + } + }).then(function chmod () { + if (options.mode) { + return new Promise(function (resolve, reject) { + fs.chmod(tmpfile, options.mode, function (err) { + if (err) reject(err) + else resolve() + }) + }) + } + }).then(function rename () { + return new Promise(function (resolve, reject) { + fs.rename(tmpfile, truename, function (err) { + if (err) reject(err) + else resolve() + }) + }) + }).then(function success () { + removeOnExit() + callback() + }).catch(function fail (err) { + removeOnExit() + fs.unlink(tmpfile, function () { + callback(err) + }) + }).then(function checkQueue () { + activeFiles[absoluteName].shift() // remove the element added by serializeSameFile + if (activeFiles[absoluteName].length > 0) { + activeFiles[absoluteName][0]() // start next job if one is pending + } else delete activeFiles[absoluteName] + }) +} + +function writeFileSync (filename, data, options) { + if (!options) options = {} + try { + filename = fs.realpathSync(filename) + } catch (ex) { + // it's ok, it'll happen on a not yet existing file + } + var tmpfile = getTmpname(filename) + + try { + if (!options.mode || !options.chown) { + // Either mode or chown is not explicitly set + // Default behavior is to copy it from original file + try { + var stats = fs.statSync(filename) + options = Object.assign({}, options) + if (!options.mode) { + options.mode = stats.mode + } + if (!options.chown && process.getuid) { + options.chown = { uid: stats.uid, gid: stats.gid } + } + } catch (ex) { + // ignore stat errors + } + } + + var removeOnExit = onExit(cleanupOnExit(tmpfile)) + var fd = fs.openSync(tmpfile, 'w', options.mode) + if (Buffer.isBuffer(data)) { + fs.writeSync(fd, data, 0, data.length, 0) + } else if (data != null) { + fs.writeSync(fd, String(data), 0, String(options.encoding || 'utf8')) + } + if (options.fsync !== false) { + fs.fsyncSync(fd) + } + fs.closeSync(fd) + if (options.chown) fs.chownSync(tmpfile, options.chown.uid, options.chown.gid) + if (options.mode) fs.chmodSync(tmpfile, options.mode) + fs.renameSync(tmpfile, filename) + removeOnExit() + } catch (err) { + removeOnExit() + try { fs.unlinkSync(tmpfile) } catch (e) {} + throw err + } +} diff --git a/node_modules/write-file-atomic/package.json b/node_modules/write-file-atomic/package.json new file mode 100644 index 0000000..3a6f96d --- /dev/null +++ b/node_modules/write-file-atomic/package.json @@ -0,0 +1,67 @@ +{ + "_from": "write-file-atomic@^2.0.0", + "_id": "write-file-atomic@2.3.0", + "_inBundle": false, + "_integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "_location": "/write-file-atomic", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "write-file-atomic@^2.0.0", + "name": "write-file-atomic", + "escapedName": "write-file-atomic", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/configstore" + ], + "_resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "_shasum": "1ff61575c2e2a4e8e510d6fa4e243cce183999ab", + "_spec": "write-file-atomic@^2.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/configstore", + "author": { + "name": "Rebecca Turner", + "email": "me@re-becca.org", + "url": "http://re-becca.org" + }, + "bugs": { + "url": "https://github.com/iarna/write-file-atomic/issues" + }, + "bundleDependencies": false, + "dependencies": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + }, + "deprecated": false, + "description": "Write files in an atomic fashion w/configurable ownership", + "devDependencies": { + "mkdirp": "^0.5.1", + "require-inject": "^1.4.0", + "rimraf": "^2.5.4", + "standard": "^10.0.2", + "tap": "^10.3.2" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/iarna/write-file-atomic", + "keywords": [ + "writeFile", + "atomic" + ], + "license": "ISC", + "main": "index.js", + "name": "write-file-atomic", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/iarna/write-file-atomic.git" + }, + "scripts": { + "test": "standard && tap --100 test/*.js" + }, + "version": "2.3.0" +} diff --git a/node_modules/xdg-basedir/index.js b/node_modules/xdg-basedir/index.js new file mode 100644 index 0000000..f5aa176 --- /dev/null +++ b/node_modules/xdg-basedir/index.js @@ -0,0 +1,28 @@ +'use strict'; +const os = require('os'); +const path = require('path'); + +const home = os.homedir(); +const env = process.env; + +exports.data = env.XDG_DATA_HOME || + (home ? path.join(home, '.local', 'share') : null); + +exports.config = env.XDG_CONFIG_HOME || + (home ? path.join(home, '.config') : null); + +exports.cache = env.XDG_CACHE_HOME || (home ? path.join(home, '.cache') : null); + +exports.runtime = env.XDG_RUNTIME_DIR || null; + +exports.dataDirs = (env.XDG_DATA_DIRS || '/usr/local/share/:/usr/share/').split(':'); + +if (exports.data) { + exports.dataDirs.unshift(exports.data); +} + +exports.configDirs = (env.XDG_CONFIG_DIRS || '/etc/xdg').split(':'); + +if (exports.config) { + exports.configDirs.unshift(exports.config); +} diff --git a/node_modules/xdg-basedir/license b/node_modules/xdg-basedir/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/xdg-basedir/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/xdg-basedir/package.json b/node_modules/xdg-basedir/package.json new file mode 100644 index 0000000..15903d0 --- /dev/null +++ b/node_modules/xdg-basedir/package.json @@ -0,0 +1,73 @@ +{ + "_from": "xdg-basedir@^3.0.0", + "_id": "xdg-basedir@3.0.0", + "_inBundle": false, + "_integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", + "_location": "/xdg-basedir", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "xdg-basedir@^3.0.0", + "name": "xdg-basedir", + "escapedName": "xdg-basedir", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/configstore", + "/update-notifier" + ], + "_resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", + "_shasum": "496b2cc109eca8dbacfe2dc72b603c17c5870ad4", + "_spec": "xdg-basedir@^3.0.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/update-notifier", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/xdg-basedir/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Get XDG Base Directory paths", + "devDependencies": { + "ava": "*", + "require-uncached": "^1.0.2", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/xdg-basedir#readme", + "keywords": [ + "xdg", + "base", + "directory", + "dir", + "basedir", + "path", + "data", + "config", + "cache", + "linux", + "unix", + "spec" + ], + "license": "MIT", + "name": "xdg-basedir", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/xdg-basedir.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "3.0.0" +} diff --git a/node_modules/xdg-basedir/readme.md b/node_modules/xdg-basedir/readme.md new file mode 100644 index 0000000..61f8c16 --- /dev/null +++ b/node_modules/xdg-basedir/readme.md @@ -0,0 +1,60 @@ +# xdg-basedir [![Build Status](https://travis-ci.org/sindresorhus/xdg-basedir.svg?branch=master)](https://travis-ci.org/sindresorhus/xdg-basedir) + +> Get [XDG Base Directory](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) paths + + +## Install + +``` +$ npm install --save xdg-basedir +``` + + +## Usage + +```js +const xdgBasedir = require('xdg-basedir'); + +xdgBasedir.data; +//=> '/home/sindresorhus/.local/share' + +xdgBasedir.config; +//=> '/home/sindresorhus/.config' + +xdgBasedir.dataDirs +//=> ['/home/sindresorhus/.local/share', '/usr/local/share/', '/usr/share/'] +``` + + +## API + +The properties `.data`, `.config`, `.cache`, `.runtime` will return `null` in the uncommon case that both the XDG environment variable is not set and the users home directory can't be found. You need to handle this case. A common solution is to [fall back to a temp directory](https://github.com/yeoman/configstore/blob/b82690fc401318ad18dcd7d151a0003a4898a314/index.js#L15). + +### .data + +Directory for user specific data files. + +### .config + +Directory for user specific configuration files. + +### .cache + +Directory for user specific non-essential data files. + +### .runtime + +Directory for user-specific non-essential runtime files and other file objects (such as sockets, named pipes, etc). + +### .dataDirs + +Preference-ordered array of base directories to search for data files in addition to `.data`. + +### .configDirs + +Preference-ordered array of base directories to search for configuration files in addition to `.config`. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/yallist/LICENSE b/node_modules/yallist/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/yallist/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/node_modules/yallist/README.md b/node_modules/yallist/README.md new file mode 100644 index 0000000..f586101 --- /dev/null +++ b/node_modules/yallist/README.md @@ -0,0 +1,204 @@ +# yallist + +Yet Another Linked List + +There are many doubly-linked list implementations like it, but this +one is mine. + +For when an array would be too big, and a Map can't be iterated in +reverse order. + + +[![Build Status](https://travis-ci.org/isaacs/yallist.svg?branch=master)](https://travis-ci.org/isaacs/yallist) [![Coverage Status](https://coveralls.io/repos/isaacs/yallist/badge.svg?service=github)](https://coveralls.io/github/isaacs/yallist) + +## basic usage + +```javascript +var yallist = require('yallist') +var myList = yallist.create([1, 2, 3]) +myList.push('foo') +myList.unshift('bar') +// of course pop() and shift() are there, too +console.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo'] +myList.forEach(function (k) { + // walk the list head to tail +}) +myList.forEachReverse(function (k, index, list) { + // walk the list tail to head +}) +var myDoubledList = myList.map(function (k) { + return k + k +}) +// now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo'] +// mapReverse is also a thing +var myDoubledListReverse = myList.mapReverse(function (k) { + return k + k +}) // ['foofoo', 6, 4, 2, 'barbar'] + +var reduced = myList.reduce(function (set, entry) { + set += entry + return set +}, 'start') +console.log(reduced) // 'startfoo123bar' +``` + +## api + +The whole API is considered "public". + +Functions with the same name as an Array method work more or less the +same way. + +There's reverse versions of most things because that's the point. + +### Yallist + +Default export, the class that holds and manages a list. + +Call it with either a forEach-able (like an array) or a set of +arguments, to initialize the list. + +The Array-ish methods all act like you'd expect. No magic length, +though, so if you change that it won't automatically prune or add +empty spots. + +### Yallist.create(..) + +Alias for Yallist function. Some people like factories. + +#### yallist.head + +The first node in the list + +#### yallist.tail + +The last node in the list + +#### yallist.length + +The number of nodes in the list. (Change this at your peril. It is +not magic like Array length.) + +#### yallist.toArray() + +Convert the list to an array. + +#### yallist.forEach(fn, [thisp]) + +Call a function on each item in the list. + +#### yallist.forEachReverse(fn, [thisp]) + +Call a function on each item in the list, in reverse order. + +#### yallist.get(n) + +Get the data at position `n` in the list. If you use this a lot, +probably better off just using an Array. + +#### yallist.getReverse(n) + +Get the data at position `n`, counting from the tail. + +#### yallist.map(fn, thisp) + +Create a new Yallist with the result of calling the function on each +item. + +#### yallist.mapReverse(fn, thisp) + +Same as `map`, but in reverse. + +#### yallist.pop() + +Get the data from the list tail, and remove the tail from the list. + +#### yallist.push(item, ...) + +Insert one or more items to the tail of the list. + +#### yallist.reduce(fn, initialValue) + +Like Array.reduce. + +#### yallist.reduceReverse + +Like Array.reduce, but in reverse. + +#### yallist.reverse + +Reverse the list in place. + +#### yallist.shift() + +Get the data from the list head, and remove the head from the list. + +#### yallist.slice([from], [to]) + +Just like Array.slice, but returns a new Yallist. + +#### yallist.sliceReverse([from], [to]) + +Just like yallist.slice, but the result is returned in reverse. + +#### yallist.toArray() + +Create an array representation of the list. + +#### yallist.toArrayReverse() + +Create a reversed array representation of the list. + +#### yallist.unshift(item, ...) + +Insert one or more items to the head of the list. + +#### yallist.unshiftNode(node) + +Move a Node object to the front of the list. (That is, pull it out of +wherever it lives, and make it the new head.) + +If the node belongs to a different list, then that list will remove it +first. + +#### yallist.pushNode(node) + +Move a Node object to the end of the list. (That is, pull it out of +wherever it lives, and make it the new tail.) + +If the node belongs to a list already, then that list will remove it +first. + +#### yallist.removeNode(node) + +Remove a node from the list, preserving referential integrity of head +and tail and other nodes. + +Will throw an error if you try to have a list remove a node that +doesn't belong to it. + +### Yallist.Node + +The class that holds the data and is actually the list. + +Call with `var n = new Node(value, previousNode, nextNode)` + +Note that if you do direct operations on Nodes themselves, it's very +easy to get into weird states where the list is broken. Be careful :) + +#### node.next + +The next node in the list. + +#### node.prev + +The previous node in the list. + +#### node.value + +The data the node contains. + +#### node.list + +The list to which this node belongs. (Null if it does not belong to +any list.) diff --git a/node_modules/yallist/iterator.js b/node_modules/yallist/iterator.js new file mode 100644 index 0000000..4a15bf2 --- /dev/null +++ b/node_modules/yallist/iterator.js @@ -0,0 +1,7 @@ +var Yallist = require('./yallist.js') + +Yallist.prototype[Symbol.iterator] = function* () { + for (let walker = this.head; walker; walker = walker.next) { + yield walker.value + } +} diff --git a/node_modules/yallist/package.json b/node_modules/yallist/package.json new file mode 100644 index 0000000..709f7e7 --- /dev/null +++ b/node_modules/yallist/package.json @@ -0,0 +1,62 @@ +{ + "_from": "yallist@^2.1.2", + "_id": "yallist@2.1.2", + "_inBundle": false, + "_integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "_location": "/yallist", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "yallist@^2.1.2", + "name": "yallist", + "escapedName": "yallist", + "rawSpec": "^2.1.2", + "saveSpec": null, + "fetchSpec": "^2.1.2" + }, + "_requiredBy": [ + "/lru-cache" + ], + "_resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "_shasum": "1c11f9218f076089a47dd512f93c6699a6a81d52", + "_spec": "yallist@^2.1.2", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/lru-cache", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/yallist/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Yet Another Linked List", + "devDependencies": { + "tap": "^10.3.0" + }, + "directories": { + "test": "test" + }, + "files": [ + "yallist.js", + "iterator.js" + ], + "homepage": "https://github.com/isaacs/yallist#readme", + "license": "ISC", + "main": "yallist.js", + "name": "yallist", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/yallist.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test/*.js --100" + }, + "version": "2.1.2" +} diff --git a/node_modules/yallist/yallist.js b/node_modules/yallist/yallist.js new file mode 100644 index 0000000..518d233 --- /dev/null +++ b/node_modules/yallist/yallist.js @@ -0,0 +1,370 @@ +module.exports = Yallist + +Yallist.Node = Node +Yallist.create = Yallist + +function Yallist (list) { + var self = this + if (!(self instanceof Yallist)) { + self = new Yallist() + } + + self.tail = null + self.head = null + self.length = 0 + + if (list && typeof list.forEach === 'function') { + list.forEach(function (item) { + self.push(item) + }) + } else if (arguments.length > 0) { + for (var i = 0, l = arguments.length; i < l; i++) { + self.push(arguments[i]) + } + } + + return self +} + +Yallist.prototype.removeNode = function (node) { + if (node.list !== this) { + throw new Error('removing node which does not belong to this list') + } + + var next = node.next + var prev = node.prev + + if (next) { + next.prev = prev + } + + if (prev) { + prev.next = next + } + + if (node === this.head) { + this.head = next + } + if (node === this.tail) { + this.tail = prev + } + + node.list.length-- + node.next = null + node.prev = null + node.list = null +} + +Yallist.prototype.unshiftNode = function (node) { + if (node === this.head) { + return + } + + if (node.list) { + node.list.removeNode(node) + } + + var head = this.head + node.list = this + node.next = head + if (head) { + head.prev = node + } + + this.head = node + if (!this.tail) { + this.tail = node + } + this.length++ +} + +Yallist.prototype.pushNode = function (node) { + if (node === this.tail) { + return + } + + if (node.list) { + node.list.removeNode(node) + } + + var tail = this.tail + node.list = this + node.prev = tail + if (tail) { + tail.next = node + } + + this.tail = node + if (!this.head) { + this.head = node + } + this.length++ +} + +Yallist.prototype.push = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + push(this, arguments[i]) + } + return this.length +} + +Yallist.prototype.unshift = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + unshift(this, arguments[i]) + } + return this.length +} + +Yallist.prototype.pop = function () { + if (!this.tail) { + return undefined + } + + var res = this.tail.value + this.tail = this.tail.prev + if (this.tail) { + this.tail.next = null + } else { + this.head = null + } + this.length-- + return res +} + +Yallist.prototype.shift = function () { + if (!this.head) { + return undefined + } + + var res = this.head.value + this.head = this.head.next + if (this.head) { + this.head.prev = null + } else { + this.tail = null + } + this.length-- + return res +} + +Yallist.prototype.forEach = function (fn, thisp) { + thisp = thisp || this + for (var walker = this.head, i = 0; walker !== null; i++) { + fn.call(thisp, walker.value, i, this) + walker = walker.next + } +} + +Yallist.prototype.forEachReverse = function (fn, thisp) { + thisp = thisp || this + for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { + fn.call(thisp, walker.value, i, this) + walker = walker.prev + } +} + +Yallist.prototype.get = function (n) { + for (var i = 0, walker = this.head; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.next + } + if (i === n && walker !== null) { + return walker.value + } +} + +Yallist.prototype.getReverse = function (n) { + for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.prev + } + if (i === n && walker !== null) { + return walker.value + } +} + +Yallist.prototype.map = function (fn, thisp) { + thisp = thisp || this + var res = new Yallist() + for (var walker = this.head; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)) + walker = walker.next + } + return res +} + +Yallist.prototype.mapReverse = function (fn, thisp) { + thisp = thisp || this + var res = new Yallist() + for (var walker = this.tail; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)) + walker = walker.prev + } + return res +} + +Yallist.prototype.reduce = function (fn, initial) { + var acc + var walker = this.head + if (arguments.length > 1) { + acc = initial + } else if (this.head) { + walker = this.head.next + acc = this.head.value + } else { + throw new TypeError('Reduce of empty list with no initial value') + } + + for (var i = 0; walker !== null; i++) { + acc = fn(acc, walker.value, i) + walker = walker.next + } + + return acc +} + +Yallist.prototype.reduceReverse = function (fn, initial) { + var acc + var walker = this.tail + if (arguments.length > 1) { + acc = initial + } else if (this.tail) { + walker = this.tail.prev + acc = this.tail.value + } else { + throw new TypeError('Reduce of empty list with no initial value') + } + + for (var i = this.length - 1; walker !== null; i--) { + acc = fn(acc, walker.value, i) + walker = walker.prev + } + + return acc +} + +Yallist.prototype.toArray = function () { + var arr = new Array(this.length) + for (var i = 0, walker = this.head; walker !== null; i++) { + arr[i] = walker.value + walker = walker.next + } + return arr +} + +Yallist.prototype.toArrayReverse = function () { + var arr = new Array(this.length) + for (var i = 0, walker = this.tail; walker !== null; i++) { + arr[i] = walker.value + walker = walker.prev + } + return arr +} + +Yallist.prototype.slice = function (from, to) { + to = to || this.length + if (to < 0) { + to += this.length + } + from = from || 0 + if (from < 0) { + from += this.length + } + var ret = new Yallist() + if (to < from || to < 0) { + return ret + } + if (from < 0) { + from = 0 + } + if (to > this.length) { + to = this.length + } + for (var i = 0, walker = this.head; walker !== null && i < from; i++) { + walker = walker.next + } + for (; walker !== null && i < to; i++, walker = walker.next) { + ret.push(walker.value) + } + return ret +} + +Yallist.prototype.sliceReverse = function (from, to) { + to = to || this.length + if (to < 0) { + to += this.length + } + from = from || 0 + if (from < 0) { + from += this.length + } + var ret = new Yallist() + if (to < from || to < 0) { + return ret + } + if (from < 0) { + from = 0 + } + if (to > this.length) { + to = this.length + } + for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { + walker = walker.prev + } + for (; walker !== null && i > from; i--, walker = walker.prev) { + ret.push(walker.value) + } + return ret +} + +Yallist.prototype.reverse = function () { + var head = this.head + var tail = this.tail + for (var walker = head; walker !== null; walker = walker.prev) { + var p = walker.prev + walker.prev = walker.next + walker.next = p + } + this.head = tail + this.tail = head + return this +} + +function push (self, item) { + self.tail = new Node(item, self.tail, null, self) + if (!self.head) { + self.head = self.tail + } + self.length++ +} + +function unshift (self, item) { + self.head = new Node(item, null, self.head, self) + if (!self.tail) { + self.tail = self.head + } + self.length++ +} + +function Node (value, prev, next, list) { + if (!(this instanceof Node)) { + return new Node(value, prev, next, list) + } + + this.list = list + this.value = value + + if (prev) { + prev.next = this + this.prev = prev + } else { + this.prev = null + } + + if (next) { + next.prev = this + this.next = next + } else { + this.next = null + } +} diff --git a/node_modules/yargs/CHANGELOG.md b/node_modules/yargs/CHANGELOG.md new file mode 100644 index 0000000..9c36078 --- /dev/null +++ b/node_modules/yargs/CHANGELOG.md @@ -0,0 +1,374 @@ +## Change Log + +### v3.10.0 (2015/05/29 04:25 +00:00) + +- [#165](https://github.com/bcoe/yargs/pull/165) expose yargs.terminalWidth() thanks @ensonic (@bcoe) +- [#164](https://github.com/bcoe/yargs/pull/164) better array handling thanks @getify (@bcoe) + +### v3.9.1 (2015/05/20 05:14 +00:00) +- [b6662b6](https://github.com/bcoe/yargs/commit/b6662b6774cfeab4876f41ec5e2f67b7698f4e2f) clarify .config() docs (@linclark) +- [0291360](https://github.com/bcoe/yargs/commit/02913606285ce31ce81d7f12c48d8a3029776ec7) fixed tests, switched to nyc for coverage, fixed security issue, added Lin as collaborator (@bcoe) + +### v3.9.0 (2015/05/10 18:32 +00:00) +- [#157](https://github.com/bcoe/yargs/pull/157) Merge pull request #157 from bcoe/command-yargs. allows handling of command specific arguments. Thanks for the suggestion @ohjames (@bcoe) +- [#158](https://github.com/bcoe/yargs/pull/158) Merge pull request #158 from kemitchell/spdx-license. Update license format (@kemitchell) + +### v3.8.0 (2015/04/24 23:10 +00:00) +- [#154](https://github.com/bcoe/yargs/pull/154) showHelp's method signature was misleading fixes #153 (@bcoe) +- [#151](https://github.com/bcoe/yargs/pull/151) refactor yargs' table layout logic to use new helper library (@bcoe) +- [#150](https://github.com/bcoe/yargs/pull/150) Fix README example in argument requirements (@annonymouse) + +### v3.7.2 (2015/04/13 11:52 -07:00) + +* [679fbbf](https://github.com/bcoe/yargs/commit/679fbbf55904030ccee8a2635e8e5f46551ab2f0) updated yargs to use the [standard](https://github.com/feross/standard) style guide (agokjr) +* [22382ee](https://github.com/bcoe/yargs/commit/22382ee9f5b495bc2586c1758cd1091cec3647f9 various bug fixes for $0 (@nylen) + +### v3.7.1 (2015/04/10 11:06 -07:00) + +* [89e1992](https://github.com/bcoe/yargs/commit/89e1992a004ba73609b5f9ee6890c4060857aba4) detect iojs bin along with node bin. (@bcoe) +* [755509e](https://github.com/bcoe/yargs/commit/755509ea90041e5f7833bba3b8c5deffe56f0aab) improvements to example documentation in README.md (@rstacruz) +* [0d2dfc8](https://github.com/bcoe/yargs/commit/0d2dfc822a43418242908ad97ddd5291a1b35dc6) showHelp() no longer requires that .argv has been called (@bcoe) + +### v3.7.0 (2015/04/04 02:29 -07:00) + +* [56cbe2d](https://github.com/bcoe/yargs/commit/56cbe2ddd33dc176dcbf97ba40559864a9f114e4) make .requiresArg() work with type hints. (@bcoe). +* [2f5d562](https://github.com/bcoe/yargs/commit/2f5d5624f736741deeedf6a664d57bc4d857bdd0) serialize arrays and objects in usage strings. (@bcoe). +* [5126304](https://github.com/bcoe/yargs/commit/5126304dd18351fc28f10530616fdd9361e0af98) be more lenient about alias/primary key ordering in chaining API. (@bcoe) + +### v3.6.0 (2015/03/21 01:00 +00:00) +- [4e24e22](https://github.com/bcoe/yargs/commit/4e24e22e6a195e55ab943ede704a0231ac33b99c) support for .js configuration files. (@pirxpilot) + +### v3.5.4 (2015/03/12 05:56 +00:00) +- [c16cc08](https://github.com/bcoe/yargs/commit/c16cc085501155cf7fd853ccdf8584b05ab92b78) message for non-option arguments is now optional, thanks to (@raine) + +### v3.5.3 (2015/03/09 06:14 +00:00) +- [870b428](https://github.com/bcoe/yargs/commit/870b428cf515d560926ca392555b7ad57dba9e3d) completion script was missing in package.json (@bcoe) + +### v3.5.2 (2015/03/09 06:11 +00:00) +- [58a4b24](https://github.com/bcoe/yargs/commit/58a4b2473ebbb326713d522be53e32d3aabb08d2) parse was being called multiple times, resulting in strange behavior (@bcoe) + +### v3.5.1 (2015/03/09 04:55 +00:00) +- [4e588e0](https://github.com/bcoe/yargs/commit/4e588e055afbeb9336533095f051496e3977f515) accidentally left testing logic in (@bcoe) + +### v3.5.0 (2015/03/09 04:49 +00:00) +- [718bacd](https://github.com/bcoe/yargs/commit/718bacd81b9b44f786af76b2afe491fe06274f19) added support for bash completions see #4 (@bcoe) +- [a192882](https://github.com/bcoe/yargs/commit/a19288270fc431396c42af01125eeb4443664528) downgrade to mocha 2.1.0 until https://github.com/mochajs/mocha/issues/1585 can be sorted out (@bcoe) + +### v3.4.7 (2015/03/09 04:09 +00:00) +- [9845e5c](https://github.com/bcoe/yargs/commit/9845e5c1a9c684ba0be3f0bfb40e7b62ab49d9c8) the Argv singleton was not being updated when manually parsing arguments, fixes #114 (@bcoe) + +### v3.4.6 (2015/03/09 04:01 +00:00) +- [45b4c80](https://github.com/bcoe/yargs/commit/45b4c80b890d02770b0a94f326695a8a566e8fe9) set placeholders for all keys fixes #115 (@bcoe) + +### v3.4.5 (2015/03/01 20:31 +00:00) +- [a758e0b](https://github.com/bcoe/yargs/commit/a758e0b2556184f067cf3d9c4ef886d39817ebd2) fix for count consuming too many arguments (@bcoe) + +### v3.4.4 (2015/02/28 04:52 +00:00) +- [0476af7](https://github.com/bcoe/yargs/commit/0476af757966acf980d998b45108221d4888cfcb) added nargs feature, allowing you to specify the number of arguments after an option (@bcoe) +- [092477d](https://github.com/bcoe/yargs/commit/092477d7ab3efbf0ba11cede57f7d8cfc70b024f) updated README with full example of v3.0 API (@bcoe) + +### v3.3.3 (2015/02/28 04:23 +00:00) +- [0c4b769](https://github.com/bcoe/yargs/commit/0c4b769516cd8d93a7c4e5e675628ae0049aa9a8) remove string dependency, which conflicted with other libraries see #106 (@bcoe) + +### v3.3.2 (2015/02/28 04:11 +00:00) +- [2a98906](https://github.com/bcoe/yargs/commit/2a9890675821c0e7a12f146ce008b0562cb8ec9a) add $0 to epilog (@schnittstabil) + +### v3.3.1 (2015/02/24 03:28 +00:00) +- [ad485ce](https://github.com/bcoe/yargs/commit/ad485ce748ebdfce25b88ef9d6e83d97a2f68987) fix for applying defaults to camel-case args (@bcoe) + +### v3.3.0 (2015/02/24 00:49 +00:00) +- [8bfe36d](https://github.com/bcoe/yargs/commit/8bfe36d7fb0f93a799ea3f4c756a7467c320f8c0) fix and document restart() command, as a tool for building nested CLIs (@bcoe) + +### v3.2.1 (2015/02/22 05:45 +00:00) +- [49a6d18](https://github.com/bcoe/yargs/commit/49a6d1822a4ef9b1ea6f90cc366be60912628885) you can now provide a function that generates a default value (@bcoe) + +### v3.2.0 (2015/02/22 05:24 +00:00) +- [7a55886](https://github.com/bcoe/yargs/commit/7a55886c9343cf71a20744ca5cdd56d2ea7412d5) improvements to yargs two-column text layout (@bcoe) +- [b6ab513](https://github.com/bcoe/yargs/commit/b6ab5136a4c3fa6aa496f6b6360382e403183989) Tweak NPM version badge (@nylen) + +### v3.1.0 (2015/02/19 19:37 +00:00) +- [9bd2379](https://github.com/bcoe/yargs/commit/9bd237921cf1b61fd9f32c0e6d23f572fc225861) version now accepts a function, making it easy to load version #s from a package.json (@bcoe) + +### v3.0.4 (2015/02/14 01:40 +00:00) +- [0b7c19b](https://github.com/bcoe/yargs/commit/0b7c19beaecb747267ca4cc10e5cb2a8550bc4b7) various fixes for dot-notation handling (@bcoe) + +### v3.0.3 (2015/02/14 00:59 +00:00) +- [c3f35e9](https://github.com/bcoe/yargs/commit/c3f35e99bd5a0d278073fcadd95e2d778616cc17) make sure dot-notation is applied to aliases (@bcoe) + +### 3.0.2 (2015/02/13 16:50 +00:00) +- [74c8967](https://github.com/bcoe/yargs/commit/74c8967c340c204a0a7edf8a702b6f46c2705435) document epilog shorthand of epilogue. (@bcoe) +- [670110f](https://github.com/bcoe/yargs/commit/670110fc01bedc4831b6fec6afac54517d5a71bc) any non-truthy value now causes check to fail see #76 (@bcoe) +- [0d8f791](https://github.com/bcoe/yargs/commit/0d8f791a33c11ced4cd431ea8d3d3a337d456b56) finished implementing my wish-list of fetures for yargs 3.0. see #88 (@bcoe) +- [5768447](https://github.com/bcoe/yargs/commit/5768447447c4c8e8304f178846206ce86540f063) fix coverage. (@bcoe) +- [82e793f](https://github.com/bcoe/yargs/commit/82e793f3f61c41259eaacb67f0796aea2cf2aaa0) detect console width and perform word-wrapping. (@bcoe) +- [67476b3](https://github.com/bcoe/yargs/commit/67476b37eea07fee55f23f35b9e0c7d76682b86d) refactor two-column table layout so that we can use it for examples and usage (@bcoe) +- [4724cdf](https://github.com/bcoe/yargs/commit/4724cdfcc8e37ae1ca3dcce9d762f476e9ef4bb4) major refactor of index.js, in prep for 3.x release. (@bcoe) + +### v2.3.0 (2015/02/08 20:41 +00:00) +- [d824620](https://github.com/bcoe/yargs/commit/d824620493df4e63664af1fe320764dd1a9244e6) allow for undefined boolean defaults (@ashi009) + +### v2.2.0 (2015/02/08 20:07 +00:00) +- [d6edd98](https://github.com/bcoe/yargs/commit/d6edd9848826e7389ed1393858c45d03961365fd) in-prep for further refactoring, and a 3.x release I've shuffled some things around and gotten test-coverage to 100%. (@bcoe) + +### v2.1.2 (2015/02/08 06:05 +00:00) +- [d640745](https://github.com/bcoe/yargs/commit/d640745a7b9f8d476e0223879d056d18d9c265c4) switch to path.relative (@bcoe) +- [3bfd41f](https://github.com/bcoe/yargs/commit/3bfd41ff262a041f29d828b88936a79c63cad594) remove mocha.opts. (@bcoe) +- [47a2f35](https://github.com/bcoe/yargs/commit/47a2f357091db70903a402d6765501c1d63f15fe) document using .string('_') for string ids. see #56 (@bcoe) +- [#57](https://github.com/bcoe/yargs/pull/57) Merge pull request #57 from eush77/option-readme (@eush77) + +### v2.1.1 (2015/02/06 08:08 +00:00) +- [01c6c61](https://github.com/bcoe/yargs/commit/01c6c61d67b4ebf88f41f0b32a345ec67f0ac17d) fix for #71, 'newAliases' of undefined (@bcoe) + +### v2.1.0 (2015/02/06 07:59 +00:00) +- [6a1a3fa](https://github.com/bcoe/yargs/commit/6a1a3fa731958e26ccd56885f183dd8985cc828f) try to guess argument types, and apply sensible defaults see #73 (@bcoe) + +### v2.0.1 (2015/02/06 07:54 +00:00) +- [96a06b2](https://github.com/bcoe/yargs/commit/96a06b2650ff1d085a52b7328d8bba614c20cc12) Fix for strange behavior with --sort option, see #51 (@bcoe) + +### v2.0.0 (2015/02/06 07:45 +00:00) +- [0250517](https://github.com/bcoe/yargs/commit/0250517c9643e53f431b824e8ccfa54937414011) - [108fb84](https://github.com/bcoe/yargs/commit/108fb8409a3a63dcaf99d917fe4dfcfaa1de236d) fixed bug with boolean parsing, when bools separated by = see #66 (@bcoe) +- [a465a59](https://github.com/bcoe/yargs/commit/a465a5915f912715738de890982e4f8395958b10) Add `files` field to the package.json (@shinnn) +- [31043de](https://github.com/bcoe/yargs/commit/31043de7a38a17c4c97711f1099f5fb164334db3) fix for yargs.argv having the same keys added multiple times see #63 (@bcoe) +- [2d68c5b](https://github.com/bcoe/yargs/commit/2d68c5b91c976431001c4863ce47c9297850f1ad) Disable process.exit calls using .exitProcess(false) (@cianclarke) +- [45da9ec](https://github.com/bcoe/yargs/commit/45da9ec4c55a7bd394721bc6a1db0dabad7bc52a) Mention .option in README (@eush77) + +### v1.3.2 (2014/10/06 21:56 +00:00) +- [b8d3472](https://github.com/bcoe/yargs/commit/b8d34725482e5821a3cc809c0df71378f282f526) 1.3.2 (@chevex) + +### list (2014/08/30 18:41 +00:00) +- [fbc777f](https://github.com/bcoe/yargs/commit/fbc777f416eeefd37c84e44d27d7dfc7c1925721) Now that yargs is the successor to optimist, I'm changing the README language to be more universal. Pirate speak isn't very accessible to non-native speakers. (@chevex) +- [a54d068](https://github.com/bcoe/yargs/commit/a54d0682ae2efc2394d407ab171cc8a8bbd135ea) version output will not print extra newline (@boneskull) +- [1cef5d6](https://github.com/bcoe/yargs/commit/1cef5d62a9d6d61a3948a49574892e01932cc6ae) Added contributors section to package.json (@chrisn) +- [cc295c0](https://github.com/bcoe/yargs/commit/cc295c0a80a2de267e0155b60d315fc4b6f7c709) Added 'require' and 'required' as synonyms for 'demand' (@chrisn) +- [d0bf951](https://github.com/bcoe/yargs/commit/d0bf951d949066b6280101ed606593d079ee15c8) Updating minimist. (@chevex) +- [c15f8e7](https://github.com/bcoe/yargs/commit/c15f8e7f245b261e542cf205ce4f4313630cbdb4) Fix #31 (bad interaction between camelCase options and strict mode) (@nylen) +- [d991b9b](https://github.com/bcoe/yargs/commit/d991b9be687a68812dee1e3b185ba64b7778b82d) Added .help() and .version() methods (@chrisn) +- [e8c8aa4](https://github.com/bcoe/yargs/commit/e8c8aa46268379357cb11e9fc34b8c403037724b) Added .showHelpOnFail() method (@chrisn) +- [e855af4](https://github.com/bcoe/yargs/commit/e855af4a933ea966b5bbdd3c4c6397a4bac1a053) Allow boolean flag with .demand() (@chrisn) +- [14dbec2](https://github.com/bcoe/yargs/commit/14dbec24fb7380683198e2b20c4deb8423e64bea) Fixes issue #22. Arguments are no longer printed to the console when using .config. (@chevex) +- [bef74fc](https://github.com/bcoe/yargs/commit/bef74fcddc1544598a804f80d0a3728459f196bf) Informing users that Yargs is the official optimist successor. (@chevex) +- [#24](https://github.com/bcoe/yargs/pull/24) Merge pull request #24 from chrisn/strict (@chrisn) +- [889a2b2](https://github.com/bcoe/yargs/commit/889a2b28eb9768801b05163360a470d0fd6c8b79) Added requiresArg option, for options that require values (@chrisn) +- [eb16369](https://github.com/bcoe/yargs/commit/eb163692262be1fe80b992fd8803d5923c5a9b18) Added .strict() method, to report error if unknown arguments are given (@chrisn) +- [0471c3f](https://github.com/bcoe/yargs/commit/0471c3fd999e1ad4e6cded88b8aa02013b66d14f) Changed optimist to yargs in usage-options.js example (@chrisn) +- [5c88f74](https://github.com/bcoe/yargs/commit/5c88f74e3cf031b17c54b4b6606c83e485ff520e) Change optimist to yargs in examples (@chrisn) +- [66f12c8](https://github.com/bcoe/yargs/commit/66f12c82ba3c943e4de8ca862980e835da8ecb3a) Fix a couple of bad interactions between aliases and defaults (@nylen) +- [8fa1d80](https://github.com/bcoe/yargs/commit/8fa1d80f14b03eb1f2898863a61f1d1615bceb50) Document second argument of usage(message, opts) (@Gobie) +- [56e6528](https://github.com/bcoe/yargs/commit/56e6528cf674ff70d63083fb044ff240f608448e) For "--some-option", also set argv.someOption (@nylen) +- [ed5f6d3](https://github.com/bcoe/yargs/commit/ed5f6d33f57ad1086b11c91b51100f7c6c7fa8ee) Finished porting unit tests to Mocha. (@chevex) + +### v1.0.15 (2014/02/05 23:18 +00:00) +- [e2b1fc0](https://github.com/bcoe/yargs/commit/e2b1fc0c4a59cf532ae9b01b275e1ef57eeb64d2) 1.0.15 update to badges (@chevex) + +### v1.0.14 (2014/02/05 23:17 +00:00) +- [f33bbb0](https://github.com/bcoe/yargs/commit/f33bbb0f00fe18960f849cc8e15a7428a4cd59b8) Revert "Fixed issue which caused .demand function not to work correctly." (@chevex) + +### v1.0.13 (2014/02/05 22:13 +00:00) +- [6509e5e](https://github.com/bcoe/yargs/commit/6509e5e7dee6ef1a1f60eea104be0faa1a045075) Fixed issue which caused .demand function not to work correctly. (@chevex) + +### v1.0.12 (2013/12/13 00:09 +00:00) +- [05eb267](https://github.com/bcoe/yargs/commit/05eb26741c9ce446b33ff006e5d33221f53eaceb) 1.0.12 (@chevex) + +### v1.0.11 (2013/12/13 00:07 +00:00) +- [c1bde46](https://github.com/bcoe/yargs/commit/c1bde46e37318a68b87d17a50c130c861d6ce4a9) 1.0.11 (@chevex) + +### v1.0.10 (2013/12/12 23:57 +00:00) +- [dfebf81](https://github.com/bcoe/yargs/commit/dfebf8164c25c650701528ee581ca483a99dc21c) Fixed formatting in README (@chevex) + +### v1.0.9 (2013/12/12 23:47 +00:00) +- [0b4e34a](https://github.com/bcoe/yargs/commit/0b4e34af5e6d84a9dbb3bb6d02cd87588031c182) Update README.md (@chevex) + +### v1.0.8 (2013/12/06 16:36 +00:00) +- [#1](https://github.com/bcoe/yargs/pull/1) fix error caused by check() see #1 (@martinheidegger) + +### v1.0.7 (2013/11/24 18:01 +00:00) +- [a247d88](https://github.com/bcoe/yargs/commit/a247d88d6e46644cbb7303c18b1bb678fc132d72) Modified Pirate Joe image. (@chevex) + +### v1.0.6 (2013/11/23 19:21 +00:00) +- [d7f69e1](https://github.com/bcoe/yargs/commit/d7f69e1d34bc929736a8bdccdc724583e21b7eab) Updated Pirate Joe image. (@chevex) + +### v1.0.5 (2013/11/23 19:09 +00:00) +- [ece809c](https://github.com/bcoe/yargs/commit/ece809cf317cc659175e1d66d87f3ca68c2760be) Updated readme notice again. (@chevex) + +### v1.0.4 (2013/11/23 19:05 +00:00) +- [9e81e81](https://github.com/bcoe/yargs/commit/9e81e81654028f83ba86ffc3ac772a0476084e5e) Updated README with a notice about yargs being a fork of optimist and what that implies. (@chevex) + +### v1.0.3 (2013/11/23 17:43 +00:00) +- [65e7a78](https://github.com/bcoe/yargs/commit/65e7a782c86764944d63d084416aba9ee6019c5f) Changed some small wording in README.md. (@chevex) +- [459e20e](https://github.com/bcoe/yargs/commit/459e20e539b366b85128dd281ccd42221e96c7da) Fix a bug in the options function, when string and boolean options weren't applied to aliases. (@shockone) + +### v1.0.2 (2013/11/23 09:46 +00:00) +- [3d80ebe](https://github.com/bcoe/yargs/commit/3d80ebed866d3799224b6f7d596247186a3898a9) 1.0.2 (@chevex) + +### v1.0.1 (2013/11/23 09:39 +00:00) +- [f80ff36](https://github.com/bcoe/yargs/commit/f80ff3642d580d4b68bf9f5a94277481bd027142) Updated image. (@chevex) + +### v1.0.0 (2013/11/23 09:33 +00:00) +- [54e31d5](https://github.com/bcoe/yargs/commit/54e31d505f820b80af13644e460894b320bf25a3) Rebranded from optimist to yargs in the spirit of the fork :D (@chevex) +- [4ebb6c5](https://github.com/bcoe/yargs/commit/4ebb6c59f44787db7c24c5b8fe2680f01a23f498) Added documentation for demandCount(). (@chevex) +- [4561ce6](https://github.com/bcoe/yargs/commit/4561ce66dcffa95f49e8b4449b25b94cd68acb25) Simplified the error messages returned by .check(). (@chevex) +- [661c678](https://github.com/bcoe/yargs/commit/661c67886f479b16254a830b7e1db3be29e6b7a6) Fixed an issue with demand not accepting a zero value. (@chevex) +- [731dd3c](https://github.com/bcoe/yargs/commit/731dd3c37624790490bd6df4d5f1da8f4348279e) Add .fail(fn) so death isn't the only option. Should fix issue #39. (@chevex) +- [fa15417](https://github.com/bcoe/yargs/commit/fa15417ff9e70dace0d726627a5818654824c1d8) Added a few missing 'return self' (@chevex) +- [e655e4d](https://github.com/bcoe/yargs/commit/e655e4d99d1ae1d3695ef755d51c2de08d669761) Fix showing help in certain JS environments. (@chevex) +- [a746a31](https://github.com/bcoe/yargs/commit/a746a31cd47c87327028e6ea33762d6187ec5c87) Better string representation of default values. (@chevex) +- [6134619](https://github.com/bcoe/yargs/commit/6134619a7e90b911d5443230b644c5d447c1a68c) Implies: conditional demands (@chevex) +- [046b93b](https://github.com/bcoe/yargs/commit/046b93b5d40a27367af4cb29726e4d781d934639) Added support for JSON config files. (@chevex) +- [a677ec0](https://github.com/bcoe/yargs/commit/a677ec0a0ecccd99c75e571d03323f950688da03) Add .example(cmd, desc) feature. (@chevex) +- [1bd4375](https://github.com/bcoe/yargs/commit/1bd4375e11327ba1687d4bb6e5e9f3c30c1be2af) Added 'defaults' as alias to 'default' so as to avoid usage of a reserved keyword. (@chevex) +- [6b753c1](https://github.com/bcoe/yargs/commit/6b753c16ca09e723060e70b773b430323b29c45c) add .normalize(args..) support for normalizing paths (@chevex) +- [33d7d59](https://github.com/bcoe/yargs/commit/33d7d59341d364f03d3a25f0a55cb99004dbbe4b) Customize error messages with demand(key, msg) (@chevex) +- [647d37f](https://github.com/bcoe/yargs/commit/647d37f164c20f4bafbf67dd9db6cd6e2cd3b49f) Merge branch 'rewrite-duplicate-test' of github.com:isbadawi/node-optimist (@chevex) +- [9059d1a](https://github.com/bcoe/yargs/commit/9059d1ad5e8aea686c2a01c89a23efdf929fff2e) Pass aliases object to check functions for greater versatility. (@chevex) +- [623dc26](https://github.com/bcoe/yargs/commit/623dc26c7331abff2465ef8532e3418996d42fe6) Added ability to count boolean options and rolled minimist library back into project. (@chevex) +- [49f0dce](https://github.com/bcoe/yargs/commit/49f0dcef35de4db544c3966350d36eb5838703f6) Fixed small typo. (@chevex) +- [79ec980](https://github.com/bcoe/yargs/commit/79ec9806d9ca6eb0014cfa4b6d1849f4f004baf2) Removed dependency on wordwrap module. (@chevex) +- [ea14630](https://github.com/bcoe/yargs/commit/ea14630feddd69d1de99dd8c0e08948f4c91f00a) Merge branch 'master' of github.com:chbrown/node-optimist (@chevex) +- [2b75da2](https://github.com/bcoe/yargs/commit/2b75da2624061e0f4f3107d20303c06ec9054906) Merge branch 'master' of github.com:seanzhou1023/node-optimist (@chevex) +- [d9bda11](https://github.com/bcoe/yargs/commit/d9bda1116e26f3b40e833ca9ca19263afea53565) Merge branch 'patch-1' of github.com:thefourtheye/node-optimist (@chevex) +- [d6cc606](https://github.com/bcoe/yargs/commit/d6cc6064a4f1bea38a16a4430b8a1334832fbeff) Renamed README. (@chevex) +- [9498d3f](https://github.com/bcoe/yargs/commit/9498d3f59acfb5e102826503e681623c3a64b178) Renamed readme and added .gitignore. (@chevex) +- [bbd1fe3](https://github.com/bcoe/yargs/commit/bbd1fe37fefa366dde0fb3dc44d91fe8b28f57f5) Included examples for ```help``` and ```showHelp``` functions and fixed few formatting issues (@thefourtheye) +- [37fea04](https://github.com/bcoe/yargs/commit/37fea0470a5796a0294c1dcfff68d8041650e622) .alias({}) behaves differently based on mapping direction when generating descriptions (@chbrown) +- [855b20d](https://github.com/bcoe/yargs/commit/855b20d0be567ca121d06b30bea64001b74f3d6d) Documented function signatures are useful for dynamically typed languages. (@chbrown) + +### 0.6.0 (2013/06/25 08:48 +00:00) +- [d37bfe0](https://github.com/bcoe/yargs/commit/d37bfe05ae6d295a0ab481efe4881222412791f4) all tests passing using minimist (@substack) +- [76f1352](https://github.com/bcoe/yargs/commit/76f135270399d01f2bbc621e524a5966e5c422fd) all parse tests now passing (@substack) +- [a7b6754](https://github.com/bcoe/yargs/commit/a7b6754276c38d1565479a5685c3781aeb947816) using minimist, some tests passing (@substack) +- [6655688](https://github.com/bcoe/yargs/commit/66556882aa731cbbbe16cc4d42c85740a2e98099) Give credit where its due (@DeadAlready) +- [602a2a9](https://github.com/bcoe/yargs/commit/602a2a92a459f93704794ad51b115bbb08b535ce) v0.5.3 - Remove wordwrap as dependency (@DeadAlready) + +### 0.5.2 (2013/05/31 03:46 +00:00) +- [4497ca5](https://github.com/bcoe/yargs/commit/4497ca55e332760a37b866ec119ded347ca27a87) fixed the whitespace bug without breaking anything else (@substack) +- [5a3dd1a](https://github.com/bcoe/yargs/commit/5a3dd1a4e0211a38613c6e02f61328e1031953fa) failing test for whitespace arg (@substack) + +### 0.5.1 (2013/05/30 07:17 +00:00) +- [a20228f](https://github.com/bcoe/yargs/commit/a20228f62a454755dd07f628a7c5759113918327) fix parse() to work with functions before it (@substack) +- [b13bd4c](https://github.com/bcoe/yargs/commit/b13bd4cac856a9821d42fa173bdb58f089365a7d) failing test for parse() with modifiers (@substack) + +### 0.5.0 (2013/05/18 21:59 +00:00) +- [c474a64](https://github.com/bcoe/yargs/commit/c474a649231527915c222156e3b40806d365a87c) fixes for dash (@substack) + +### 0.4.0 (2013/04/13 19:03 +00:00) +- [dafe3e1](https://github.com/bcoe/yargs/commit/dafe3e18d7c6e7c2d68e06559df0e5cbea3adb14) failing short test (@substack) + +### 0.3.7 (2013/04/04 04:07 +00:00) +- [6c7a0ec](https://github.com/bcoe/yargs/commit/6c7a0ec94ce4199a505f0518b4d6635d4e47cc81) Fix for windows. On windows there is no _ in environment. (@hdf) + +### 0.3.6 (2013/04/04 04:04 +00:00) +- [e72346a](https://github.com/bcoe/yargs/commit/e72346a727b7267af5aa008b418db89970873f05) Add support for newlines in -a="" arguments (@danielbeardsley) +- [71e1fb5](https://github.com/bcoe/yargs/commit/71e1fb55ea9987110a669ac6ec12338cfff3821c) drop 0.4, add 0.8 to travis (@substack) + +### 0.3.5 (2012/10/10 11:09 +00:00) +- [ee692b3](https://github.com/bcoe/yargs/commit/ee692b37554c70a0bb16389a50a26b66745cbbea) Fix parsing booleans (@vojtajina) +- [5045122](https://github.com/bcoe/yargs/commit/5045122664c3f5b4805addf1be2148d5856f7ce8) set $0 properly in the tests (@substack) + +### 0.3.4 (2012/04/30 06:54 +00:00) +- [f28c0e6](https://github.com/bcoe/yargs/commit/f28c0e62ca94f6e0bb2e6d82fc3d91a55e69b903) bump for string "true" params (@substack) +- [8f44aeb](https://github.com/bcoe/yargs/commit/8f44aeb74121ddd689580e2bf74ef86a605e9bf2) Fix failing test for aliased booleans. (@coderarity) +- [b9f7b61](https://github.com/bcoe/yargs/commit/b9f7b613b1e68e11e6c23fbda9e555a517dcc976) Add failing test for short aliased booleans. (@coderarity) + +### 0.3.3 (2012/04/30 06:45 +00:00) +- [541bac8](https://github.com/bcoe/yargs/commit/541bac8dd787a5f1a5d28f6d8deb1627871705e7) Fixes #37. + +### 0.3.2 (2012/04/12 20:28 +00:00) +- [3a0f014](https://github.com/bcoe/yargs/commit/3a0f014c1451280ac1c9caa1f639d31675586eec) travis badge (@substack) +- [4fb60bf](https://github.com/bcoe/yargs/commit/4fb60bf17845f4ce3293f8ca49c9a1a7c736cfce) Fix boolean aliases. (@coderarity) +- [f14dda5](https://github.com/bcoe/yargs/commit/f14dda546efc4fe06ace04d36919bfbb7634f79b) Adjusted package.json to use tap (@jfhbrook) +- [88e5d32](https://github.com/bcoe/yargs/commit/88e5d32295be6e544c8d355ff84e355af38a1c74) test/usage.js no longer hangs (@jfhbrook) +- [e1e740c](https://github.com/bcoe/yargs/commit/e1e740c27082f3ce84deca2093d9db2ef735d0e5) two tests for combined boolean/alias opts parsing (@jfhbrook) + +### 0.3.1 (2011/12/31 08:44 +00:00) +- [d09b719](https://github.com/bcoe/yargs/commit/d09b71980ef711b6cf3918cd19beec8257e40e82) If "default" is set to false it was not passed on, fixed. (@wolframkriesing) + +### 0.3.0 (2011/12/09 06:03 +00:00) +- [6e74aa7](https://github.com/bcoe/yargs/commit/6e74aa7b46a65773e20c0cb68d2d336d4a0d553d) bump and documented dot notation (@substack) + +### 0.2.7 (2011/10/20 02:25 +00:00) +- [94adee2](https://github.com/bcoe/yargs/commit/94adee20e17b58d0836f80e8b9cdbe9813800916) argv._ can be told 'Hey! argv._! Don't be messing with my args.', and it WILL obey (@colinta) +- [c46fdd5](https://github.com/bcoe/yargs/commit/c46fdd56a05410ae4a1e724a4820c82e77ff5469) optimistic critter image (@substack) +- [5c95c73](https://github.com/bcoe/yargs/commit/5c95c73aedf4c7482bd423e10c545e86d7c8a125) alias options() to option() (@substack) +- [f7692ea](https://github.com/bcoe/yargs/commit/f7692ea8da342850af819367833abb685fde41d8) [fix] Fix for parsing boolean edge case (@indexzero) +- [d1f92d1](https://github.com/bcoe/yargs/commit/d1f92d1425bd7f356055e78621b30cdf9741a3c2) +- [b01bda8](https://github.com/bcoe/yargs/commit/b01bda8d86e455bbf74ce497864cb8ab5b9fb847) [fix test] Update to ensure optimist is aware of default booleans. Associated tests included (@indexzero) +- [aa753e7](https://github.com/bcoe/yargs/commit/aa753e7c54fb3a12f513769a0ff6d54aa0f63943) [dist test] Update devDependencies in package.json. Update test pathing to be more npm and require.paths future-proof (@indexzero) +- [7bfce2f](https://github.com/bcoe/yargs/commit/7bfce2f3b3c98e6539e7549d35fbabced7e9341e) s/sys/util/ (@substack) +- [d420a7a](https://github.com/bcoe/yargs/commit/d420a7a9c890d2cdb11acfaf3ea3f43bc3e39f41) update usage output (@substack) +- [cf86eed](https://github.com/bcoe/yargs/commit/cf86eede2e5fc7495b6ec15e6d137d9ac814f075) some sage readme protips about parsing rules (@substack) +- [5da9f7a](https://github.com/bcoe/yargs/commit/5da9f7a5c0e1758ec7c5801fb3e94d3f6e970513) documented all the methods finally (@substack) +- [8ca6879](https://github.com/bcoe/yargs/commit/8ca6879311224b25933642987300f6a29de5c21b) fenced syntax highlighting (@substack) +- [b72bacf](https://github.com/bcoe/yargs/commit/b72bacf1d02594778c1935405bc8137eb61761dc) right-alignment of wrapped extra params (@substack) +- [2b980bf](https://github.com/bcoe/yargs/commit/2b980bf2656b4ee8fc5134dc5f56a48855c35198) now with .wrap() (@substack) +- [d614f63](https://github.com/bcoe/yargs/commit/d614f639654057d1b7e35e3f5a306e88ec2ad1e4) don't show 'Options:' when there aren't any (@substack) +- [691eda3](https://github.com/bcoe/yargs/commit/691eda354df97b5a86168317abcbcaabdc08a0fb) failing test for multi-aliasing (@substack) +- [0826c9f](https://github.com/bcoe/yargs/commit/0826c9f462109feab2bc7a99346d22e72bf774b7) "Options:" > "options:" (@substack) +- [72f7490](https://github.com/bcoe/yargs/commit/72f749025d01b7f295738ed370a669d885fbada0) [minor] Update formatting for `.showHelp()` (@indexzero) +- [75aecce](https://github.com/bcoe/yargs/commit/75aeccea74329094072f95800e02c275e7d999aa) options works again, too lazy to write a proper test right now (@substack) +- [f742e54](https://github.com/bcoe/yargs/commit/f742e5439817c662dc3bd8734ddd6467e6018cfd) line_count_options example, which breaks (@substack) +- [4ca06b8](https://github.com/bcoe/yargs/commit/4ca06b8b4ea99b5d5714b315a2a8576bee6e5537) line count example (@substack) +- [eeb8423](https://github.com/bcoe/yargs/commit/eeb8423e0a5ecc9dc3eb1e6df9f3f8c1c88f920b) remove self.argv setting in boolean (@substack) +- [6903412](https://github.com/bcoe/yargs/commit/69034126804660af9cc20ea7f4457b50338ee3d7) removed camel case for now (@substack) +- [5a0d88b](https://github.com/bcoe/yargs/commit/5a0d88bf23e9fa79635dd034e2a1aa992acc83cd) remove dead longest checking code (@substack) +- [d782170](https://github.com/bcoe/yargs/commit/d782170babf7284b1aa34f5350df0dd49c373fa8) .help() too (@substack) +- [622ec17](https://github.com/bcoe/yargs/commit/622ec17379bb5374fdbb190404c82bc600975791) rm old help generator (@substack) +- [7c8baac](https://github.com/bcoe/yargs/commit/7c8baac4d66195e9f5158503ea9ebfb61153dab7) nub keys (@substack) +- [8197785](https://github.com/bcoe/yargs/commit/8197785ad4762465084485b041abd722f69bf344) generate help message based on the previous calls, todo: nub (@substack) +- [3ffbdc3](https://github.com/bcoe/yargs/commit/3ffbdc33c8f5e83d4ea2ac60575ce119570c7ede) stub out new showHelp, better checks (@substack) +- [d4e21f5](https://github.com/bcoe/yargs/commit/d4e21f56a4830f7de841900d3c79756fb9886184) let .options() take single options too (@substack) +- [3c4cf29](https://github.com/bcoe/yargs/commit/3c4cf2901a29bac119cca8e983028d8669230ec6) .options() is now heaps simpler (@substack) +- [89f0d04](https://github.com/bcoe/yargs/commit/89f0d043cbccd302f10ab30c2069e05d2bf817c9) defaults work again, all tests pass (@substack) +- [dd87333](https://github.com/bcoe/yargs/commit/dd8733365423006a6e4156372ebb55f98323af58) update test error messages, down to 2 failing tests (@substack) +- [53f7bc6](https://github.com/bcoe/yargs/commit/53f7bc626b9875f2abdfc5dd7a80bde7f14143a3) fix for bools doubling up, passes the parse test again, others fail (@substack) +- [2213e2d](https://github.com/bcoe/yargs/commit/2213e2ddc7263226fba717fb041dc3fde9bc2ee4) refactored for an argv getter, failing several tests (@substack) +- [d1e7379](https://github.com/bcoe/yargs/commit/d1e737970f15c6c006bebdd8917706827ff2f0f2) just rescan for now, alias test passes (@substack) +- [b2f8c99](https://github.com/bcoe/yargs/commit/b2f8c99cc477a8eb0fdf4cf178e1785b63185cfd) failing alias test (@substack) +- [d0c0174](https://github.com/bcoe/yargs/commit/d0c0174daa144bfb6dc7290fdc448c393c475e15) .alias() (@substack) +- [d85f431](https://github.com/bcoe/yargs/commit/d85f431ad7d07b058af3f2a57daa51495576c164) [api] Remove `.describe()` in favor of building upon the existing `.usage()` API (@indexzero) +- [edbd527](https://github.com/bcoe/yargs/commit/edbd5272a8e213e71acd802782135c7f9699913a) [doc api] Add `.describe()`, `.options()`, and `.showHelp()` methods along with example. (@indexzero) +- [be4902f](https://github.com/bcoe/yargs/commit/be4902ff0961ae8feb9093f2c0a4066463ded2cf) updates for coffee since it now does argv the node way (@substack) +- [e24cb23](https://github.com/bcoe/yargs/commit/e24cb23798ee64e53b60815e7fda78b87f42390c) more general coffeescript detection (@substack) +- [78ac753](https://github.com/bcoe/yargs/commit/78ac753e5d0ec32a96d39d893272afe989e42a4d) Don't trigger the CoffeeScript hack when running under node_g. (@papandreou) +- [bcfe973](https://github.com/bcoe/yargs/commit/bcfe9731d7f90d4632281b8a52e8d76eb0195ae6) .string() but failing test (@substack) +- [1987aca](https://github.com/bcoe/yargs/commit/1987aca28c7ba4e8796c07bbc547cb984804c826) test hex strings (@substack) +- [ef36db3](https://github.com/bcoe/yargs/commit/ef36db32259b0b0d62448dc907c760e5554fb7e7) more keywords (@substack) +- [cc53c56](https://github.com/bcoe/yargs/commit/cc53c56329960bed6ab077a79798e991711ba01d) Added camelCase function that converts --multi-word-option to camel case (so it becomes argv.multiWordOption). (@papandreou) +- [60b57da](https://github.com/bcoe/yargs/commit/60b57da36797716e5783a633c6d5c79099016d45) fixed boolean bug by rescanning (@substack) +- [dff6d07](https://github.com/bcoe/yargs/commit/dff6d078d97f8ac503c7d18dcc7b7a8c364c2883) boolean examples (@substack) +- [0e380b9](https://github.com/bcoe/yargs/commit/0e380b92c4ef4e3c8dac1da18b5c31d85b1d02c9) boolean() with passing test (@substack) +- [62644d4](https://github.com/bcoe/yargs/commit/62644d4bffbb8d1bbf0c2baf58a1d14a6359ef07) coffee compatibility with node regex for versions too (@substack) +- [430fafc](https://github.com/bcoe/yargs/commit/430fafcf1683d23774772826581acff84b456827) argv._ fixed by fixing the coffee detection (@substack) +- [343b8af](https://github.com/bcoe/yargs/commit/343b8afefd98af274ebe21b5a16b3a949ec5429f) whichNodeArgs test fails too (@substack) +- [63df2f3](https://github.com/bcoe/yargs/commit/63df2f371f31e63d7f1dec2cbf0022a5f08da9d2) replicated mnot's bug in whichNodeEmpty test (@substack) +- [35473a4](https://github.com/bcoe/yargs/commit/35473a4d93a45e5e7e512af8bb54ebb532997ae1) test for ./bin usage (@substack) +- [13df151](https://github.com/bcoe/yargs/commit/13df151e44228eed10e5441c7cd163e086c458a4) don't coerce booleans to numbers (@substack) +- [85f8007](https://github.com/bcoe/yargs/commit/85f8007e93b8be7124feea64b1f1916d8ba1894a) package bump for automatic number conversion (@substack) +- [8f17014](https://github.com/bcoe/yargs/commit/8f170141cded4ccc0c6d67a849c5bf996aa29643) updated readme and examples with new auto-numberification goodness (@substack) +- [73dc901](https://github.com/bcoe/yargs/commit/73dc9011ac968e39b55e19e916084a839391b506) auto number conversion works yay (@substack) +- [bcec56b](https://github.com/bcoe/yargs/commit/bcec56b3d031e018064cbb691539ccc4f28c14ad) failing test for not-implemented auto numification (@substack) +- [ebd2844](https://github.com/bcoe/yargs/commit/ebd2844d683feeac583df79af0e5124a7a7db04e) odd that eql doesn't check types careflly (@substack) +- [fd854b0](https://github.com/bcoe/yargs/commit/fd854b02e512ce854b76386d395672a7969c1bc4) package author + keywords (@substack) +- [656a1d5](https://github.com/bcoe/yargs/commit/656a1d5a1b7c0e49d72e80cb13f20671d56f76c6) updated readme with .default() stuff (@substack) +- [cd7f8c5](https://github.com/bcoe/yargs/commit/cd7f8c55f0b82b79b690d14c5f806851236998a1) passing tests for new .default() behavior (@substack) +- [932725e](https://github.com/bcoe/yargs/commit/932725e39ce65bc91a0385a5fab659a5fa976ac2) new default() thing for setting default key/values (@substack) +- [4e6c7ab](https://github.com/bcoe/yargs/commit/4e6c7aba6374ac9ebc6259ecf91f13af7bce40e3) test for coffee usage (@substack) +- [d54ffcc](https://github.com/bcoe/yargs/commit/d54ffccf2a5a905f51ed5108f7c647f35d64ae23) new --key value style with passing tests. NOTE: changes existing behavior (@substack) +- [ed2a2d5](https://github.com/bcoe/yargs/commit/ed2a2d5d828100ebeef6385c0fb88d146a5cfe9b) package bump for summatix's coffee script fix (@substack) +- [75a975e](https://github.com/bcoe/yargs/commit/75a975eed8430d28e2a79dc9e6d819ad545f4587) Added support for CoffeeScript (@summatix) +- [56b2b1d](https://github.com/bcoe/yargs/commit/56b2b1de8d11f8a2b91979d8ae2d6db02d8fe64d) test coverage for the falsy check() usage (@substack) +- [a4843a9](https://github.com/bcoe/yargs/commit/a4843a9f0e69ffb4afdf6a671d89eb6f218be35d) check bug fixed plus a handy string (@substack) +- [857bd2d](https://github.com/bcoe/yargs/commit/857bd2db933a5aaa9cfecba0ced2dc9b415f8111) tests for demandCount, back up to 100% coverage (@substack) +- [073b776](https://github.com/bcoe/yargs/commit/073b7768ebd781668ef05c13f9003aceca2f5c35) call demandCount from demand (@substack) +- [4bd4b7a](https://github.com/bcoe/yargs/commit/4bd4b7a085c8b6ce1d885a0f486cc9865cee2db1) add demandCount to check for the number of arguments in the _ list (@marshall) +- [b8689ac](https://github.com/bcoe/yargs/commit/b8689ac68dacf248119d242bba39a41cb0adfa07) Rebase checks. That will be its own module eventually. (@substack) +- [e688370](https://github.com/bcoe/yargs/commit/e688370b576f0aa733c3f46183df69e1b561668e) a $0 like in perl (@substack) +- [2e5e196](https://github.com/bcoe/yargs/commit/2e5e1960fc19afb21fb3293752316eaa8bcd3609) usage test hacking around process and console (@substack) +- [fcc3521](https://github.com/bcoe/yargs/commit/fcc352163fbec6a1dfe8caf47a0df39de24fe016) description pun (@substack) +- [87a1fe2](https://github.com/bcoe/yargs/commit/87a1fe29037ca2ca5fefda85141aaeb13e8ce761) mit/x11 license (@substack) +- [8d089d2](https://github.com/bcoe/yargs/commit/8d089d24cd687c0bde3640a96c09b78f884900dd) bool example is more consistent and also shows off short option grouping (@substack) +- [448d747](https://github.com/bcoe/yargs/commit/448d7473ac68e8e03d8befc9457b0d9e21725be0) start of the readme and examples (@substack) +- [da74dea](https://github.com/bcoe/yargs/commit/da74dea799a9b59dbf022cbb8001bfdb0d52eec9) more tests for long and short captures (@substack) +- [ab6387e](https://github.com/bcoe/yargs/commit/ab6387e6769ca4af82ca94c4c67c7319f0d9fcfa) silly bug in the tests with s/not/no/, all tests pass now (@substack) +- [102496a](https://github.com/bcoe/yargs/commit/102496a319e8e06f6550d828fc2f72992c7d9ecc) hack an instance for process.argv onto Argv so the export can be called to create an instance or used for argv, which is the most common case (@substack) +- [a01caeb](https://github.com/bcoe/yargs/commit/a01caeb532546d19f68f2b2b87f7036cfe1aaedd) divide example (@substack) +- [443da55](https://github.com/bcoe/yargs/commit/443da55736acbaf8ff8b04d1b9ce19ab016ddda2) start of the lib with a package.json (@substack) diff --git a/node_modules/yargs/LICENSE b/node_modules/yargs/LICENSE new file mode 100644 index 0000000..432d1ae --- /dev/null +++ b/node_modules/yargs/LICENSE @@ -0,0 +1,21 @@ +Copyright 2010 James Halliday (mail@substack.net) + +This project is free software released under the MIT/X11 license: + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/yargs/README.md b/node_modules/yargs/README.md new file mode 100644 index 0000000..99086e6 --- /dev/null +++ b/node_modules/yargs/README.md @@ -0,0 +1,926 @@ +yargs +======== + +Yargs be a node.js library fer hearties tryin' ter parse optstrings. + +With yargs, ye be havin' a map that leads straight to yer treasure! Treasure of course, being a simple option hash. + +[![Build Status](https://travis-ci.org/bcoe/yargs.png)](https://travis-ci.org/bcoe/yargs) +[![Dependency Status](https://gemnasium.com/bcoe/yargs.png)](https://gemnasium.com/bcoe/yargs) +[![Coverage Status](https://coveralls.io/repos/bcoe/yargs/badge.svg?branch=)](https://coveralls.io/r/bcoe/yargs?branch=) +[![NPM version](https://img.shields.io/npm/v/yargs.svg)](https://www.npmjs.com/package/yargs) + +> Yargs is the official successor to optimist. Please feel free to submit issues and pull requests. If you'd like to contribute and don't know where to start, have a look at [the issue list](https://github.com/bcoe/yargs/issues) :) + +examples +======== + +With yargs, the options be just a hash! +------------------------------------------------------------------- + +plunder.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs').argv; + +if (argv.ships > 3 && argv.distance < 53.5) { + console.log('Plunder more riffiwobbles!'); +} +else { + console.log('Retreat from the xupptumblers!'); +} +```` + +*** + + $ ./plunder.js --ships=4 --distance=22 + Plunder more riffiwobbles! + + $ ./plunder.js --ships 12 --distance 98.7 + Retreat from the xupptumblers! + +![Joe was one optimistic pirate.](http://i.imgur.com/4WFGVJ9.png) + +But don't walk the plank just yet! There be more! You can do short options: +------------------------------------------------- + +short.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs').argv; +console.log('(%d,%d)', argv.x, argv.y); +```` + +*** + + $ ./short.js -x 10 -y 21 + (10,21) + +And booleans, both long, short, and even grouped: +---------------------------------- + +bool.js: + +````javascript +#!/usr/bin/env node +var util = require('util'); +var argv = require('yargs').argv; + +if (argv.s) { + util.print(argv.fr ? 'Le perroquet dit: ' : 'The parrot says: '); +} +console.log( + (argv.fr ? 'couac' : 'squawk') + (argv.p ? '!' : '') +); +```` + +*** + + $ ./bool.js -s + The parrot says: squawk + + $ ./bool.js -sp + The parrot says: squawk! + + $ ./bool.js -sp --fr + Le perroquet dit: couac! + +And non-hyphenated options too! Just use `argv._`! +------------------------------------------------- + +nonopt.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs').argv; +console.log('(%d,%d)', argv.x, argv.y); +console.log(argv._); +```` + +*** + + $ ./nonopt.js -x 6.82 -y 3.35 rum + (6.82,3.35) + [ 'rum' ] + + $ ./nonopt.js "me hearties" -x 0.54 yo -y 1.12 ho + (0.54,1.12) + [ 'me hearties', 'yo', 'ho' ] + +Yargs even counts your booleans! +---------------------------------------------------------------------- + +count.js + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .count('verbose') + .alias('v', 'verbose') + .argv; + +VERBOSE_LEVEL = argv.verbose; + +function WARN() { VERBOSE_LEVEL >= 0 && console.log.apply(console, arguments); } +function INFO() { VERBOSE_LEVEL >= 1 && console.log.apply(console, arguments); } +function DEBUG() { VERBOSE_LEVEL >= 2 && console.log.apply(console, arguments); } + +WARN("Showing only important stuff"); +INFO("Showing semi-mportant stuff too"); +DEBUG("Extra chatty mode"); +```` + +*** + $ node count.js + Showing only important stuff + + $ node count.js -v + Showing only important stuff + Showing semi-important stuff too + + $ node count.js -vv + Showing only important stuff + Showing semi-important stuff too + Extra chatty mode + + $ node count.js -v --verbose + Showing only important stuff + Showing semi-important stuff too + Extra chatty mode + +Tell users how to use yer options and make demands. +------------------------------------------------- + +area.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .usage('Usage: $0 -w [num] -yh[num]') + .demand(['w','h']) + .argv; + +console.log("The area is:", argv.w * argv.h); +```` + +*** + + $ ./area.js -w 55 -h 11 + 605 + + $ node ./area.js -w 4.91 -w 2.51 + Usage: node ./area.js -w [num] -h [num] + + Options: + -w [required] + -h [required] + + Missing required arguments: h + +After yer demands have been met, demand more! Ask for non-hypenated arguments! +----------------------------------------- + +demand_count.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .demand(2) + .argv; +console.dir(argv) +```` + +*** + + $ ./demand_count.js a + Not enough arguments, expected 2, but only found 1 + $ ./demand_count.js a b + { _: [ 'a', 'b' ], '$0': 'node ./demand_count.js' } + $ ./demand_count.js a b c + { _: [ 'a', 'b', 'c' ], '$0': 'node ./demand_count.js' } + +EVEN MORE SHIVER ME TIMBERS! +------------------ + +default_singles.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .default('x', 10) + .default('y', 10) + .argv +; +console.log(argv.x + argv.y); +```` + +*** + + $ ./default_singles.js -x 5 + 15 + +default_hash.js: + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .default({ x : 10, y : 10 }) + .argv +; +console.log(argv.x + argv.y); +```` + +*** + + $ ./default_hash.js -y 7 + 17 + +And if you really want to get all descriptive about it... +--------------------------------------------------------- + +boolean_single.js + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .boolean('v') + .argv +; +console.dir(argv.v); +console.dir(argv._); +```` + +*** + + $ ./boolean_single.js -v "me hearties" yo ho + true + [ 'me hearties', 'yo', 'ho' ] + + +boolean_double.js + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .boolean(['x','y','z']) + .argv +; +console.dir([ argv.x, argv.y, argv.z ]); +console.dir(argv._); +```` + +*** + + $ ./boolean_double.js -x -z one two three + [ true, false, true ] + [ 'one', 'two', 'three' ] + +Yargs is here to help you... +--------------------------- + +Ye can describe parameters fer help messages and set aliases. Yargs figures +out how ter format a handy help string automatically. + +line_count.js + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .usage('Usage: $0 [options]') + .command('count', 'Count the lines in a file') + .demand(1) + .example('$0 count -f foo.js', 'count the lines in the given file') + .demand('f') + .alias('f', 'file') + .nargs('f', 1) + .describe('f', 'Load a file') + .help('h') + .alias('h', 'help') + .epilog('copyright 2015') + .argv; + +var fs = require('fs'); +var s = fs.createReadStream(argv.file); + +var lines = 0; +s.on('data', function (buf) { + lines += buf.toString().match(/\n/g).length; +}); + +s.on('end', function () { + console.log(lines); +}); +```` + +*** + $ node line_count.js count + Usage: node test.js [options] + + Commands: + count Count the lines in a file + + Options: + -f, --file Load a file [required] + -h, --help Show help + + Examples: + node test.js count -f foo.js count the lines in the given file + + copyright 2015 + + Missing required arguments: f + + $ node line_count.js count --file line_count.js + 20 + + $ node line_count.js count -f line_count.js + 20 + +methods +======= + +By itself, + +````javascript +require('yargs').argv +````` + +will use `process.argv` array to construct the `argv` object. + +You can pass in the `process.argv` yourself: + +````javascript +require('yargs')([ '-x', '1', '-y', '2' ]).argv +```` + +or use .parse() to do the same thing: + +````javascript +require('yargs').parse([ '-x', '1', '-y', '2' ]) +```` + +The rest of these methods below come in just before the terminating `.argv`. + +.alias(key, alias) +------------------ + +Set key names as equivalent such that updates to a key will propagate to aliases +and vice-versa. + +Optionally `.alias()` can take an object that maps keys to aliases. +Each key of this object should be the canonical version of the option, and each +value should be a string or an array of strings. + +.default(key, value, [description]) +-------------------- + +Set `argv[key]` to `value` if no option was specified on `process.argv`. + +Optionally `.default()` can take an object that maps keys to default values. + +But wait, there's more! the default value can be a `function` which returns +a value. The name of the function will be used in the usage string: + +```js +var argv = require('yargs') + .default('random', function randomValue() { + return Math.random() * 256; + }).argv; +``` + +Optionally, `description` can also be provided and will take precedence over +displaying the value in the usage instructions: + +```js +.default('timeout', 60000, '(one-minute)'); +``` + +.demand(key, [msg | boolean]) +----------------------------- +.require(key, [msg | boolean]) +------------------------------ +.required(key, [msg | boolean]) +------------------------------- + +If `key` is a string, show the usage information and exit if `key` wasn't +specified in `process.argv`. + +If `key` is a number, demand at least as many non-option arguments, which show +up in `argv._`. + +If `key` is an Array, demand each element. + +If a `msg` string is given, it will be printed when the argument is missing, +instead of the standard error message. This is especially helpful for the non-option arguments in `argv._`. + +If a `boolean` value is given, it controls whether the option is demanded; +this is useful when using `.options()` to specify command line parameters. + +.requiresArg(key) +----------------- + +Specifies either a single option key (string), or an array of options that +must be followed by option values. If any option value is missing, show the +usage information and exit. + +The default behaviour is to set the value of any key not followed by an +option value to `true`. + +.implies(x, y) +-------------- + +Given the key `x` is set, it is required that the key `y` is set. + +implies can also accept an object specifying multiple implications. + +.describe(key, desc) +-------------------- + +Describe a `key` for the generated usage information. + +Optionally `.describe()` can take an object that maps keys to descriptions. + +.option(key, opt) +----------------- +.options(key, opt) +------------------ + +Instead of chaining together `.alias().demand().default().describe().string()`, you can specify +keys in `opt` for each of the chainable methods. + +For example: + +````javascript +var argv = require('yargs') + .option('f', { + alias : 'file', + demand: true, + default: '/etc/passwd', + describe: 'x marks the spot', + type: 'string' + }) + .argv +; +```` + +is the same as + +````javascript +var argv = require('yargs') + .alias('f', 'file') + .default('f', '/etc/passwd') + .argv +; +```` + +Optionally `.options()` can take an object that maps keys to `opt` parameters. + +````javascript +var argv = require('yargs') + .options({ + 'f': { + alias: 'file', + demand: true, + default: '/etc/passwd', + describe: 'x marks the spot', + type: 'string' + } + }) + .argv +; +```` + +.usage(message, opts) +--------------------- + +Set a usage message to show which commands to use. Inside `message`, the string +`$0` will get interpolated to the current script name or node command for the +present script similar to how `$0` works in bash or perl. + +`opts` is optional and acts like calling `.options(opts)`. + +.command(cmd, desc, [fn]) +------------------- + +Document the commands exposed by your application. + +use `desc` to provide a description for each command your application accepts (the +values stored in `argv._`). + +Optionally, you can provide a handler `fn` which will be executed when +a given command is provided. The handler will be executed with an instance +of `yargs`, which can be used to compose nested commands. + +Here's an example of top-level and nested commands in action: + +```js +var argv = require('yargs') + .usage('npm ') + .command('install', 'tis a mighty fine package to install') + .command('publish', 'shiver me timbers, should you be sharing all that', function (yargs) { + argv = yargs.option('f', { + alias: 'force', + description: 'yar, it usually be a bad idea' + }) + .help('help') + .argv + }) + .help('help') + .argv; +``` + +.example(cmd, desc) +------------------- + +Give some example invocations of your program. Inside `cmd`, the string +`$0` will get interpolated to the current script name or node command for the +present script similar to how `$0` works in bash or perl. +Examples will be printed out as part of the help message. + + +.epilogue(str) +-------------- +.epilog(str) +------------ + +A message to print at the end of the usage instructions, e.g., + +```js +var argv = require('yargs') + .epilogue('for more information, find our manual at http://example.com'); +``` + +.check(fn) +---------- + +Check that certain conditions are met in the provided arguments. + +`fn` is called with two arguments, the parsed `argv` hash and an array of options and their aliases. + +If `fn` throws or returns a non-truthy value, show the thrown error, usage information, and +exit. + +.fail(fn) +--------- + +Method to execute when a failure occurs, rather then printing the failure message. + +`fn` is called with the failure message that would have been printed. + +.boolean(key) +------------- + +Interpret `key` as a boolean. If a non-flag option follows `key` in +`process.argv`, that string won't get set as the value of `key`. + +`key` will default to `false`, unless an `default(key, undefined)` is +explicitly set. + +If `key` is an Array, interpret all the elements as booleans. + +.string(key) +------------ + +Tell the parser logic not to interpret `key` as a number or boolean. +This can be useful if you need to preserve leading zeros in an input. + +If `key` is an Array, interpret all the elements as strings. + +`.string('_')` will result in non-hyphenated arguments being interpreted as strings, +regardless of whether they resemble numbers. + +.array(key) +---------- + +Tell the parser to interpret `key` as an array. If `.array('foo')` is set, +`--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'bar'`. + +.nargs(key, count) +----------- + +The number of arguments that should be consumed after a key. This can be a +useful hint to prevent parsing ambiguity: + +```js +var argv = require('yargs') + .nargs('token', 1) + .parse(['--token', '-my-token']); +``` + +parses as: + +`{ _: [], token: '-my-token', '$0': 'node test' }` + +Optionally `.nargs()` can take an object of `key`/`narg` pairs. + +.config(key) +------------ + +Tells the parser that if the option specified by `key` is passed in, it +should be interpreted as a path to a JSON config file. The file is loaded +and parsed, and its properties are set as arguments. + +.wrap(columns) +-------------- + +Format usage output to wrap at `columns` many columns. + +By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to +specify no column limit. + +`yargs.wrap(yargs.terminalWidth())` can be used to maximize the width +of yargs' usage instructions. + +.strict() +--------- + +Any command-line argument given that is not demanded, or does not have a +corresponding description, will be reported as an error. + +.help([option, [description]]) +------------------------------ + +Add an option (e.g., `--help`) that displays the usage string and exits the +process. If present, the `description` parameter customises the description of +the help option in the usage string. + +If invoked without parameters, `.help` returns the generated usage string. + +Example: + +``` +var yargs = require("yargs") + .usage("$0 -operand1 number -operand2 number -operation [add|subtract]"); +console.log(yargs.help()); +``` + +Later on, ```argv``` can be retrived with ```yargs.argv``` + +.version(version, [option], [description]) +---------------------------------------- + +Add an option (e.g., `--version`) that displays the version number (given by the +`version` parameter) and exits the process. If present, the `description` +parameter customizes the description of the version option in the usage string. + +You can provide a `function` for version, rather than a string. +This is useful if you want to use the version from your package.json: + +```js +var argv = require('yargs') + .version(function() { + return require('../package').version; + }) + .argv; +``` + +.showHelpOnFail(enable, [message]) +---------------------------------- + +By default, yargs outputs a usage string if any error is detected. Use the +`.showHelpOnFail` method to customize this behaviour. if `enable` is `false`, +the usage string is not output. If the `message` parameter is present, this +message is output after the error message. + +line_count.js + +````javascript +#!/usr/bin/env node +var argv = require('yargs') + .usage('Count the lines in a file.\nUsage: $0') + .demand('f') + .alias('f', 'file') + .describe('f', 'Load a file') + .showHelpOnFail(false, "Specify --help for available options") + .argv; + +// etc. +```` + +*** + + $ node line_count.js --file + Missing argument value: f + + Specify --help for available options + +.showHelp(consoleLevel='error') +--------------------------- + +Print the usage data using the [`console`](https://nodejs.org/api/console.html) function `consoleLevel` for printing. + +Example: + +``` +var yargs = require("yargs") + .usage("$0 -operand1 number -operand2 number -operation [add|subtract]"); +yargs.showHelp(); +``` + +Or, to print the usage data to `stdout` instead, you can specify the use of `console.log`: + +``` +yargs.showHelp("log"); +``` + +Later on, ```argv``` can be retrived with ```yargs.argv``` + +.completion(cmd, [description], [fn]); +------------- + +Enable bash-completion shortcuts for commands and options. + +`cmd`: when present in `argv._`, will result in the `.bashrc` completion script +being outputted. To enable bash completions, concat the generated script to your +`.bashrc`, or `.bash_profile`. + +`description`: provide a description in your usage instructions for the command +that generates bash completion scripts. + +`fn`, rather than relying on yargs' default completion functionlity, which +shiver me timbers is pretty awesome, you can provide your own completion +method. + +```js +var argv = require('yargs') + .completion('completion', function(current, argv) { + // 'current' is the current command being completed. + // 'argv' is the parsed arguments so far. + // simply return an array of completions. + return [ + 'foo', + 'bar' + ]; + }) + .argv; +``` + +But wait, there's more! you can provide asynchronous completions. + +```js +var argv = require('yargs') + .completion('completion', function(current, argv, done) { + setTimeout(function() { + done([ + 'apple', + 'banana' + ]); + }, 500); + }) + .argv; +``` + +.showCompletionScript() +---------------------- + +Generate a bash completion script. Users of your application can install this +script in their `.bashrc`, and yargs will provide completion shortcuts for +commands and options. + +.exitProcess(enable) +---------------------------------- + +By default, yargs exits the process when the user passes a help flag, uses the `.version` functionality or when validation fails. Calling `.exitProcess(false)` disables this behavior, enabling further actions after yargs have been validated. + +.parse(args) +------------ + +Parse `args` instead of `process.argv`. Returns the `argv` object. + +.reset() +-------- + +Reset the argument object built up so far. This is useful for +creating nested command line interfaces. + +```js +var yargs = require('./yargs') + .usage('$0 command') + .command('hello', 'hello command') + .command('world', 'world command') + .demand(1, 'must provide a valid command'), + argv = yargs.argv, + command = argv._[0]; + +if (command === 'hello') { + yargs.reset() + .usage('$0 hello') + .help('h') + .example('$0 hello', 'print the hello message!') + .argv + + console.log('hello!'); +} else if (command === 'world'){ + yargs.reset() + .usage('$0 world') + .help('h') + .example('$0 world', 'print the world message!') + .argv + + console.log('world!'); +} else { + yargs.showHelp(); +} +``` + +.argv +----- + +Get the arguments as a plain old object. + +Arguments without a corresponding flag show up in the `argv._` array. + +The script name or node command is available at `argv.$0` similarly to how `$0` +works in bash or perl. + +parsing tricks +============== + +stop parsing +------------ + +Use `--` to stop parsing flags and stuff the remainder into `argv._`. + + $ node examples/reflect.js -a 1 -b 2 -- -c 3 -d 4 + { _: [ '-c', '3', '-d', '4' ], + '$0': 'node ./examples/reflect.js', + a: 1, + b: 2 } + +negate fields +------------- + +If you want to explicity set a field to false instead of just leaving it +undefined or to override a default you can do `--no-key`. + + $ node examples/reflect.js -a --no-b + { _: [], + '$0': 'node ./examples/reflect.js', + a: true, + b: false } + +numbers +------- + +Every argument that looks like a number (`!isNaN(Number(arg))`) is converted to +one. This way you can just `net.createConnection(argv.port)` and you can add +numbers out of `argv` with `+` without having that mean concatenation, +which is super frustrating. + +duplicates +---------- + +If you specify a flag multiple times it will get turned into an array containing +all the values in order. + + $ node examples/reflect.js -x 5 -x 8 -x 0 + { _: [], + '$0': 'node ./examples/reflect.js', + x: [ 5, 8, 0 ] } + +dot notation +------------ + +When you use dots (`.`s) in argument names, an implicit object path is assumed. +This lets you organize arguments into nested objects. + + $ node examples/reflect.js --foo.bar.baz=33 --foo.quux=5 + { _: [], + '$0': 'node ./examples/reflect.js', + foo: { bar: { baz: 33 }, quux: 5 } } + +short numbers +------------- + +Short numeric `head -n5` style argument work too: + + $ node reflect.js -n123 -m456 + { '3': true, + '6': true, + _: [], + '$0': 'node ./reflect.js', + n: 123, + m: 456 } + +installation +============ + +With [npm](http://github.com/isaacs/npm), just do: + + npm install yargs + +or clone this project on github: + + git clone http://github.com/bcoe/yargs.git + +To run the tests with npm, just do: + + npm test + +inspired by +=========== + +This module is loosely inspired by Perl's +[Getopt::Casual](http://search.cpan.org/~photo/Getopt-Casual-0.13.1/Casual.pm). diff --git a/node_modules/yargs/completion.sh.hbs b/node_modules/yargs/completion.sh.hbs new file mode 100644 index 0000000..c52e499 --- /dev/null +++ b/node_modules/yargs/completion.sh.hbs @@ -0,0 +1,22 @@ +###-begin-{{app_name}}-completions-### +# +# yargs command completion script +# +# Installation: {{app_path}} completion >> ~/.bashrc +# or {{app_path}} completion >> ~/.bash_profile on OSX. +# +_yargs_completions() +{ + local cur_word args type_list + + cur_word="${COMP_WORDS[COMP_CWORD]}" + args=$(printf "%s " "${COMP_WORDS[@]}") + + # ask yargs to generate completions. + type_list=`{{app_path}} --get-yargs-completions $args` + + COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) ) + return 0 +} +complete -F _yargs_completions {{app_name}} +###-end-{{app_name}}-completions-### diff --git a/node_modules/yargs/index.js b/node_modules/yargs/index.js new file mode 100644 index 0000000..96539b0 --- /dev/null +++ b/node_modules/yargs/index.js @@ -0,0 +1,504 @@ +var assert = require('assert'), + path = require('path'), + Completion = require('./lib/completion'), + Parser = require('./lib/parser'), + Usage = require('./lib/usage'), + Validation = require('./lib/validation') + +Argv(process.argv.slice(2)) + +var exports = module.exports = Argv +function Argv (processArgs, cwd) { + processArgs = processArgs || [] // handle calling yargs(). + + var self = {} + var completion = null + var usage = null + var validation = null + + if (!cwd) cwd = process.cwd() + + self.$0 = process.argv + .slice(0, 2) + .map(function (x, i) { + // ignore the node bin, specify this in your + // bin file with #!/usr/bin/env node + if (i === 0 && /\b(node|iojs)$/.test(x)) return + var b = rebase(cwd, x) + return x.match(/^\//) && b.length < x.length + ? b : x + }) + .join(' ').trim() + + if (process.env._ !== undefined && process.argv[1] === process.env._) { + self.$0 = process.env._.replace( + path.dirname(process.execPath) + '/', '' + ) + } + + var options + self.resetOptions = self.reset = function () { + // put yargs back into its initial + // state, this is useful for creating a + // nested CLI. + options = { + array: [], + boolean: [], + string: [], + narg: {}, + key: {}, + alias: {}, + default: {}, + defaultDescription: {}, + requiresArg: [], + count: [], + normalize: [], + config: [] + } + + usage = Usage(self) // handle usage output. + validation = Validation(self, usage) // handle arg validation. + completion = Completion(self, usage) + + demanded = {} + + exitProcess = true + strict = false + helpOpt = null + versionOpt = null + completionOpt = null + commandHandlers = {} + self.parsed = false + + return self + } + self.resetOptions() + + self.boolean = function (bools) { + options.boolean.push.apply(options.boolean, [].concat(bools)) + return self + } + + self.array = function (arrays) { + options.array.push.apply(options.array, [].concat(arrays)) + return self + } + + self.nargs = function (key, n) { + if (typeof key === 'object') { + Object.keys(key).forEach(function (k) { + self.nargs(k, key[k]) + }) + } else { + options.narg[key] = n + } + return self + } + + self.normalize = function (strings) { + options.normalize.push.apply(options.normalize, [].concat(strings)) + return self + } + + self.config = function (configs) { + options.config.push.apply(options.config, [].concat(configs)) + return self + } + + self.example = function (cmd, description) { + usage.example(cmd, description) + return self + } + + self.command = function (cmd, description, fn) { + usage.command(cmd, description) + if (fn) commandHandlers[cmd] = fn + return self + } + + var commandHandlers = {} + self.getCommandHandlers = function () { + return commandHandlers + } + + self.string = function (strings) { + options.string.push.apply(options.string, [].concat(strings)) + return self + } + + self.default = function (key, value, defaultDescription) { + if (typeof key === 'object') { + Object.keys(key).forEach(function (k) { + self.default(k, key[k]) + }) + } else { + if (typeof value === 'function') { + defaultDescription = usage.functionDescription(value, defaultDescription) + value = value.call() + } + options.defaultDescription[key] = defaultDescription + options.default[key] = value + } + return self + } + + self.alias = function (x, y) { + if (typeof x === 'object') { + Object.keys(x).forEach(function (key) { + self.alias(key, x[key]) + }) + } else { + options.alias[x] = (options.alias[x] || []).concat(y) + } + return self + } + + self.count = function (counts) { + options.count.push.apply(options.count, [].concat(counts)) + return self + } + + var demanded = {} + self.demand = self.required = self.require = function (keys, msg) { + if (typeof keys === 'number') { + if (!demanded._) demanded._ = { count: 0, msg: null } + demanded._.count += keys + demanded._.msg = msg + } else if (Array.isArray(keys)) { + keys.forEach(function (key) { + self.demand(key, msg) + }) + } else { + if (typeof msg === 'string') { + demanded[keys] = { msg: msg } + } else if (msg === true || typeof msg === 'undefined') { + demanded[keys] = { msg: undefined } + } + } + + return self + } + self.getDemanded = function () { + return demanded + } + + self.requiresArg = function (requiresArgs) { + options.requiresArg.push.apply(options.requiresArg, [].concat(requiresArgs)) + return self + } + + self.implies = function (key, value) { + validation.implies(key, value) + return self + } + + self.usage = function (msg, opts) { + if (!opts && typeof msg === 'object') { + opts = msg + msg = null + } + + usage.usage(msg) + + if (opts) self.options(opts) + + return self + } + + self.epilogue = self.epilog = function (msg) { + usage.epilog(msg) + return self + } + + self.fail = function (f) { + usage.failFn(f) + return self + } + + self.check = function (f) { + validation.check(f) + return self + } + + self.defaults = self.default + + self.describe = function (key, desc) { + options.key[key] = true + usage.describe(key, desc) + return self + } + + self.parse = function (args) { + return parseArgs(args) + } + + self.option = self.options = function (key, opt) { + if (typeof key === 'object') { + Object.keys(key).forEach(function (k) { + self.options(k, key[k]) + }) + } else { + assert(typeof opt === 'object', 'second argument to option must be an object') + + options.key[key] = true // track manually set keys. + + if (opt.alias) self.alias(key, opt.alias) + + var demand = opt.demand || opt.required || opt.require + + if (demand) { + self.demand(key, demand) + } if ('default' in opt) { + self.default(key, opt.default) + } if ('nargs' in opt) { + self.nargs(key, opt.nargs) + } if (opt.boolean || opt.type === 'boolean') { + self.boolean(key) + if (opt.alias) self.boolean(opt.alias) + } if (opt.array || opt.type === 'array') { + self.array(key) + if (opt.alias) self.array(opt.alias) + } if (opt.string || opt.type === 'string') { + self.string(key) + if (opt.alias) self.string(opt.alias) + } if (opt.count || opt.type === 'count') { + self.count(key) + } + + var desc = opt.describe || opt.description || opt.desc + if (desc) { + self.describe(key, desc) + } + + if (opt.requiresArg) { + self.requiresArg(key) + } + } + + return self + } + self.getOptions = function () { + return options + } + + self.wrap = function (cols) { + usage.wrap(cols) + return self + } + + var strict = false + self.strict = function () { + strict = true + return self + } + self.getStrict = function () { + return strict + } + + self.showHelp = function (level) { + if (!self.parsed) parseArgs(processArgs) // run parser, if it has not already been executed. + usage.showHelp(level) + return self + } + + var versionOpt = null + self.version = function (ver, opt, msg) { + versionOpt = opt || 'version' + usage.version(ver) + self.boolean(versionOpt) + self.describe(versionOpt, msg || 'Show version number') + return self + } + + var helpOpt = null + self.addHelpOpt = function (opt, msg) { + helpOpt = opt + self.boolean(opt) + self.describe(opt, msg || 'Show help') + return self + } + + self.showHelpOnFail = function (enabled, message) { + usage.showHelpOnFail(enabled, message) + return self + } + + var exitProcess = true + self.exitProcess = function (enabled) { + if (typeof enabled !== 'boolean') { + enabled = true + } + exitProcess = enabled + return self + } + self.getExitProcess = function () { + return exitProcess + } + + self.help = function () { + if (arguments.length > 0) return self.addHelpOpt.apply(self, arguments) + + if (!self.parsed) parseArgs(processArgs) // run parser, if it has not already been executed. + + return usage.help() + } + + var completionOpt = null, + completionCommand = null + self.completion = function (cmd, desc, fn) { + // a function to execute when generating + // completions can be provided as the second + // or third argument to completion. + if (typeof desc === 'function') { + fn = desc + desc = null + } + + // register the completion command. + completionCommand = cmd + completionOpt = completion.completionKey + self.command(completionCommand, desc || 'generate bash completion script') + + // a function can be provided + if (fn) completion.registerFunction(fn) + + return self + } + + self.showCompletionScript = function ($0) { + $0 = $0 || self.$0 + console.log(completion.generateCompletionScript($0)) + return self + } + + self.getUsageInstance = function () { + return usage + } + + self.getValidationInstance = function () { + return validation + } + + self.terminalWidth = function () { + return require('window-size').width + } + + Object.defineProperty(self, 'argv', { + get: function () { + var args = null + + try { + args = parseArgs(processArgs) + } catch (err) { + usage.fail(err.message) + } + + return args + }, + enumerable: true + }) + + function parseArgs (args) { + var parsed = Parser(args, options), + argv = parsed.argv, + aliases = parsed.aliases + + argv.$0 = self.$0 + + self.parsed = parsed + + // generate a completion script for adding to ~/.bashrc. + if (completionCommand && ~argv._.indexOf(completionCommand)) { + self.showCompletionScript() + if (exitProcess) { + process.exit(0) + } + } + + // if there's a handler associated with a + // command defer processing to it. + var handlerKeys = Object.keys(self.getCommandHandlers()) + for (var i = 0, command; (command = handlerKeys[i]) !== undefined; i++) { + if (~argv._.indexOf(command)) { + self.getCommandHandlers()[command](self.reset()) + return self.argv + } + } + + Object.keys(argv).forEach(function (key) { + if (key === helpOpt && argv[key]) { + self.showHelp('log') + if (exitProcess) { + process.exit(0) + } + } else if (key === versionOpt && argv[key]) { + usage.showVersion() + if (exitProcess) { + process.exit(0) + } + } else if (key === completionOpt) { + // we allow for asynchronous completions, + // e.g., loading in a list of commands from an API. + completion.getCompletion(function (completions) { + ;(completions || []).forEach(function (completion) { + console.log(completion) + }) + + if (exitProcess) { + process.exit(0) + } + }) + return + } + }) + + validation.nonOptionCount(argv) + validation.missingArgumentValue(argv) + validation.requiredArguments(argv) + + if (strict) { + validation.unknownArguments(argv, aliases) + } + + validation.customChecks(argv, aliases) + validation.implications(argv) + setPlaceholderKeys(argv) + + return argv + } + + function setPlaceholderKeys (argv) { + Object.keys(options.key).forEach(function (key) { + if (typeof argv[key] === 'undefined') argv[key] = undefined + }) + } + + sigletonify(self) + return self +} + +// rebase an absolute path to a relative one with respect to a base directory +// exported for tests +exports.rebase = rebase +function rebase (base, dir) { + return path.relative(base, dir) +} + +/* Hack an instance of Argv with process.argv into Argv + so people can do + require('yargs')(['--beeble=1','-z','zizzle']).argv + to parse a list of args and + require('yargs').argv + to get a parsed version of process.argv. +*/ +function sigletonify (inst) { + Object.keys(inst).forEach(function (key) { + if (key === 'argv') { + Argv.__defineGetter__(key, inst.__lookupGetter__(key)) + } else { + Argv[key] = typeof inst[key] === 'function' + ? inst[key].bind(inst) + : inst[key] + } + }) +} diff --git a/node_modules/yargs/lib/completion.js b/node_modules/yargs/lib/completion.js new file mode 100644 index 0000000..32387be --- /dev/null +++ b/node_modules/yargs/lib/completion.js @@ -0,0 +1,71 @@ +var fs = require('fs'), + path = require('path') + +// add bash completions to your +// yargs-powered applications. +module.exports = function (yargs, usage) { + var self = { + completionKey: 'get-yargs-completions' + } + + // get a list of completion commands. + self.getCompletion = function (done) { + var completions = [], + current = process.argv[process.argv.length - 1], + previous = process.argv.slice(process.argv.indexOf('--' + self.completionKey) + 1), + argv = yargs.parse(previous) + + // a custom completion function can be provided + // to completion(). + if (completionFunction) { + if (completionFunction.length < 3) { + // synchronous completion function. + return done(completionFunction(current, argv)) + } else { + // asynchronous completion function + return completionFunction(current, argv, function (completions) { + done(completions) + }) + } + } + + if (!current.match(/^-/)) { + usage.getCommands().forEach(function (command) { + completions.push(command[0]) + }) + } + + if (current.match(/^-/)) { + Object.keys(yargs.getOptions().key).forEach(function (key) { + completions.push('--' + key) + }) + } + + done(completions) + } + + // generate the completion script to add to your .bashrc. + self.generateCompletionScript = function ($0) { + var script = fs.readFileSync( + path.resolve(__dirname, '../completion.sh.hbs'), + 'utf-8' + ), + name = path.basename($0) + + // add ./to applications not yet installed as bin. + if ($0.match(/\.js$/)) $0 = './' + $0 + + script = script.replace(/{{app_name}}/g, name) + return script.replace(/{{app_path}}/g, $0) + } + + // register a function to perform your own custom + // completions., this function can be either + // synchrnous or asynchronous. + var completionFunction = null + self.registerFunction = function (fn) { + completionFunction = fn + } + + return self +} diff --git a/node_modules/yargs/lib/parser.js b/node_modules/yargs/lib/parser.js new file mode 100644 index 0000000..5e4618c --- /dev/null +++ b/node_modules/yargs/lib/parser.js @@ -0,0 +1,448 @@ +// fancy-pants parsing of argv, originally forked +// from minimist: https://www.npmjs.com/package/minimist +var camelCase = require('camelcase'), + path = require('path') + +function increment (orig) { + return orig !== undefined ? orig + 1 : 0 +} + +module.exports = function (args, opts) { + if (!opts) opts = {} + var flags = { arrays: {}, bools: {}, strings: {}, counts: {}, normalize: {}, configs: {} } + + ;[].concat(opts['array']).filter(Boolean).forEach(function (key) { + flags.arrays[key] = true + }) + + ;[].concat(opts['boolean']).filter(Boolean).forEach(function (key) { + flags.bools[key] = true + }) + + ;[].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true + }) + + ;[].concat(opts.count).filter(Boolean).forEach(function (key) { + flags.counts[key] = true + }) + + ;[].concat(opts.normalize).filter(Boolean).forEach(function (key) { + flags.normalize[key] = true + }) + + ;[].concat(opts.config).filter(Boolean).forEach(function (key) { + flags.configs[key] = true + }) + + var aliases = {}, + newAliases = {} + + extendAliases(opts.key) + extendAliases(opts.alias) + + var defaults = opts['default'] || {} + Object.keys(defaults).forEach(function (key) { + if (/-/.test(key) && !opts.alias[key]) { + aliases[key] = aliases[key] || [] + } + (aliases[key] || []).forEach(function (alias) { + defaults[alias] = defaults[key] + }) + }) + + var argv = { _: [] } + + Object.keys(flags.bools).forEach(function (key) { + setArg(key, !(key in defaults) ? false : defaults[key]) + }) + + var notFlags = [] + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--') + 1) + args = args.slice(0, args.indexOf('--')) + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i], + broken, + key, + letters, + m, + next, + value + + // -- seperated by = + if (arg.match(/^--.+=/)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + m = arg.match(/^--([^=]+)=([\s\S]*)$/) + + // nargs format = '--f=monkey washing cat' + if (checkAllAliases(m[1], opts.narg)) { + args.splice(i + 1, m[1], m[2]) + i = eatNargs(i, m[1], args) + // arrays format = '--f=a b c' + } else if (checkAllAliases(m[1], flags.arrays) && args.length > i + 1) { + args.splice(i + 1, m[1], m[2]) + i = eatArray(i, m[1], args) + } else { + setArg(m[1], m[2]) + } + } else if (arg.match(/^--no-.+/)) { + key = arg.match(/^--no-(.+)/)[1] + setArg(key, false) + + // -- seperated by space. + } else if (arg.match(/^--.+/)) { + key = arg.match(/^--(.+)/)[1] + + // nargs format = '--foo a b c' + if (checkAllAliases(key, opts.narg)) { + i = eatNargs(i, key, args) + // array format = '--foo a b c' + } else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) { + i = eatArray(i, key, args) + } else { + next = args[i + 1] + + if (next !== undefined && !next.match(/^-/) + && !checkAllAliases(key, flags.bools) + && !checkAllAliases(key, flags.counts)) { + setArg(key, next) + i++ + } else if (/^(true|false)$/.test(next)) { + setArg(key, next) + i++ + } else { + setArg(key, defaultForType(guessType(key, flags))) + } + } + + // dot-notation flag seperated by '='. + } else if (arg.match(/^-.\..+=/)) { + m = arg.match(/^-([^=]+)=([\s\S]*)$/) + setArg(m[1], m[2]) + + // dot-notation flag seperated by space. + } else if (arg.match(/^-.\..+/)) { + next = args[i + 1] + key = arg.match(/^-(.\..+)/)[1] + + if (next !== undefined && !next.match(/^-/) + && !checkAllAliases(key, flags.bools) + && !checkAllAliases(key, flags.counts)) { + setArg(key, next) + i++ + } else { + setArg(key, defaultForType(guessType(key, flags))) + } + } else if (arg.match(/^-[^-]+/)) { + letters = arg.slice(1, -1).split('') + broken = false + + for (var j = 0; j < letters.length; j++) { + next = arg.slice(j + 2) + + if (letters[j + 1] && letters[j + 1] === '=') { + value = arg.slice(j + 3) + key = letters[j] + + // nargs format = '-f=monkey washing cat' + if (checkAllAliases(letters[j], opts.narg)) { + args.splice(i + 1, 0, value) + i = eatNargs(i, key, args) + // array format = '-f=a b c' + } else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) { + args.splice(i + 1, 0, value) + i = eatArray(i, key, args) + } else { + setArg(key, value) + } + + broken = true + break + } + + if (next === '-') { + setArg(letters[j], next) + continue + } + + if (/[A-Za-z]/.test(letters[j]) + && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { + setArg(letters[j], next) + broken = true + break + } + + if (letters[j + 1] && letters[j + 1].match(/\W/)) { + setArg(letters[j], arg.slice(j + 2)) + broken = true + break + } else { + setArg(letters[j], defaultForType(guessType(letters[j], flags))) + } + } + + key = arg.slice(-1)[0] + + if (!broken && key !== '-') { + // nargs format = '-f a b c' + if (checkAllAliases(key, opts.narg)) { + i = eatNargs(i, key, args) + // array format = '-f a b c' + } else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) { + i = eatArray(i, key, args) + } else { + if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) + && !checkAllAliases(key, flags.bools) + && !checkAllAliases(key, flags.counts)) { + setArg(key, args[i + 1]) + i++ + } else if (args[i + 1] && /true|false/.test(args[i + 1])) { + setArg(key, args[i + 1]) + i++ + } else { + setArg(key, defaultForType(guessType(key, flags))) + } + } + } + } else { + argv._.push( + flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) + ) + } + } + + setConfig(argv) + applyDefaultsAndAliases(argv, aliases, defaults) + + Object.keys(flags.counts).forEach(function (key) { + setArg(key, defaults[key]) + }) + + notFlags.forEach(function (key) { + argv._.push(key) + }) + + // how many arguments should we consume, based + // on the nargs option? + function eatNargs (i, key, args) { + var toEat = checkAllAliases(key, opts.narg) + + if (args.length - (i + 1) < toEat) throw Error('not enough arguments following: ' + key) + + for (var ii = i + 1; ii < (toEat + i + 1); ii++) { + setArg(key, args[ii]) + } + + return (i + toEat) + } + + // if an option is an array, eat all non-hyphenated arguments + // following it... YUM! + // e.g., --foo apple banana cat becomes ["apple", "banana", "cat"] + function eatArray (i, key, args) { + for (var ii = i + 1; ii < args.length; ii++) { + if (/^-/.test(args[ii])) break + i = ii + setArg(key, args[ii]) + } + + return i + } + + function setArg (key, val) { + // handle parsing boolean arguments --foo=true --bar false. + if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) { + if (typeof val === 'string') val = val === 'true' + } + + if (/-/.test(key) && !(aliases[key] && aliases[key].length)) { + var c = camelCase(key) + aliases[key] = [c] + newAliases[c] = true + } + + var value = !checkAllAliases(key, flags.strings) && isNumber(val) ? Number(val) : val + + if (checkAllAliases(key, flags.counts)) { + value = increment + } + + var splitKey = key.split('.') + setKey(argv, splitKey, value) + + ;(aliases[splitKey[0]] || []).forEach(function (x) { + x = x.split('.') + + // handle populating dot notation for both + // the key and its aliases. + if (splitKey.length > 1) { + var a = [].concat(splitKey) + a.shift() // nuke the old key. + x = x.concat(a) + } + + setKey(argv, x, value) + }) + + var keys = [key].concat(aliases[key] || []) + for (var i = 0, l = keys.length; i < l; i++) { + if (flags.normalize[keys[i]]) { + keys.forEach(function (key) { + argv.__defineSetter__(key, function (v) { + val = path.normalize(v) + }) + + argv.__defineGetter__(key, function () { + return typeof val === 'string' ? + path.normalize(val) : val + }) + }) + break + } + } + } + + // set args from config.json file, this should be + // applied last so that defaults can be applied. + function setConfig (argv) { + var configLookup = {} + + // expand defaults/aliases, in-case any happen to reference + // the config.json file. + applyDefaultsAndAliases(configLookup, aliases, defaults) + + Object.keys(flags.configs).forEach(function (configKey) { + var configPath = argv[configKey] || configLookup[configKey] + if (configPath) { + try { + var config = require(path.resolve(process.cwd(), configPath)) + + Object.keys(config).forEach(function (key) { + // setting arguments via CLI takes precedence over + // values within the config file. + if (argv[key] === undefined) { + delete argv[key] + setArg(key, config[key]) + } + }) + } catch (ex) { + throw Error('invalid json config file: ' + configPath) + } + } + }) + } + + function applyDefaultsAndAliases (obj, aliases, defaults) { + Object.keys(defaults).forEach(function (key) { + if (!hasKey(obj, key.split('.'))) { + setKey(obj, key.split('.'), defaults[key]) + + ;(aliases[key] || []).forEach(function (x) { + setKey(obj, x.split('.'), defaults[key]) + }) + } + }) + } + + function hasKey (obj, keys) { + var o = obj + keys.slice(0, -1).forEach(function (key) { + o = (o[key] || {}) + }) + + var key = keys[keys.length - 1] + return key in o + } + + function setKey (obj, keys, value) { + var o = obj + keys.slice(0, -1).forEach(function (key) { + if (o[key] === undefined) o[key] = {} + o = o[key] + }) + + var key = keys[keys.length - 1] + if (value === increment) { + o[key] = increment(o[key]) + } else if (o[key] === undefined && checkAllAliases(key, flags.arrays)) { + o[key] = Array.isArray(value) ? value : [value] + } else if (o[key] === undefined || typeof o[key] === 'boolean') { + o[key] = value + } else if (Array.isArray(o[key])) { + o[key].push(value) + } else { + o[key] = [ o[key], value ] + } + } + + // extend the aliases list with inferred aliases. + function extendAliases (obj) { + Object.keys(obj || {}).forEach(function (key) { + aliases[key] = [].concat(opts.alias[key] || []) + // For "--option-name", also set argv.optionName + aliases[key].concat(key).forEach(function (x) { + if (/-/.test(x)) { + var c = camelCase(x) + aliases[key].push(c) + newAliases[c] = true + } + }) + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y + })) + }) + }) + } + + // check if a flag is set for any of a key's aliases. + function checkAllAliases (key, flag) { + var isSet = false, + toCheck = [].concat(aliases[key] || [], key) + + toCheck.forEach(function (key) { + if (flag[key]) isSet = flag[key] + }) + + return isSet + } + + // return a default value, given the type of a flag., + // e.g., key of type 'string' will default to '', rather than 'true'. + function defaultForType (type) { + var def = { + boolean: true, + string: '', + array: [] + } + + return def[type] + } + + // given a flag, enforce a default type. + function guessType (key, flags) { + var type = 'boolean' + + if (flags.strings && flags.strings[key]) type = 'string' + else if (flags.arrays && flags.arrays[key]) type = 'array' + + return type + } + + function isNumber (x) { + if (typeof x === 'number') return true + if (/^0x[0-9a-f]+$/i.test(x)) return true + return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x) + } + + return { + argv: argv, + aliases: aliases, + newAliases: newAliases + } +} diff --git a/node_modules/yargs/lib/usage.js b/node_modules/yargs/lib/usage.js new file mode 100644 index 0000000..8cfe9dd --- /dev/null +++ b/node_modules/yargs/lib/usage.js @@ -0,0 +1,314 @@ +// this file handles outputting usage instructions, +// failures, etc. keeps logging in one place. +var cliui = require('cliui'), + decamelize = require('decamelize'), + wsize = require('window-size') + +module.exports = function (yargs) { + var self = {} + + // methods for ouputting/building failure message. + var fails = [] + self.failFn = function (f) { + fails.push(f) + } + + var failMessage = null + var showHelpOnFail = true + self.showHelpOnFail = function (enabled, message) { + if (typeof enabled === 'string') { + message = enabled + enabled = true + } else if (typeof enabled === 'undefined') { + enabled = true + } + failMessage = message + showHelpOnFail = enabled + return self + } + + self.fail = function (msg) { + if (fails.length) { + fails.forEach(function (f) { + f(msg) + }) + } else { + if (showHelpOnFail) yargs.showHelp('error') + if (msg) console.error(msg) + if (failMessage) { + if (msg) console.error('') + console.error(failMessage) + } + if (yargs.getExitProcess()) { + process.exit(1) + } else { + throw new Error(msg) + } + } + } + + // methods for ouputting/building help (usage) message. + var usage + self.usage = function (msg) { + usage = msg + } + + var examples = [] + self.example = function (cmd, description) { + examples.push([cmd, description || '']) + } + + var commands = [] + self.command = function (cmd, description) { + commands.push([cmd, description || '']) + } + self.getCommands = function () { + return commands + } + + var descriptions = {} + self.describe = function (key, desc) { + if (typeof key === 'object') { + Object.keys(key).forEach(function (k) { + self.describe(k, key[k]) + }) + } else { + descriptions[key] = desc + } + } + self.getDescriptions = function () { + return descriptions + } + + var epilog + self.epilog = function (msg) { + epilog = msg + } + + var wrap = windowWidth() + self.wrap = function (cols) { + wrap = cols + } + + self.help = function () { + normalizeAliases() + + var demanded = yargs.getDemanded(), + options = yargs.getOptions(), + keys = Object.keys( + Object.keys(descriptions) + .concat(Object.keys(demanded)) + .concat(Object.keys(options.default)) + .reduce(function (acc, key) { + if (key !== '_') acc[key] = true + return acc + }, {}) + ), + ui = cliui({ + width: wrap, + wrap: !!wrap + }) + + // the usage string. + if (usage) { + var u = usage.replace(/\$0/g, yargs.$0) + ui.div(u + '\n') + } + + // your application's commands, i.e., non-option + // arguments populated in '_'. + if (commands.length) { + ui.div('Commands:') + + commands.forEach(function (command) { + ui.div( + {text: command[0], padding: [0, 2, 0, 2], width: maxWidth(commands) + 4}, + {text: command[1]} + ) + }) + + ui.div() + } + + // the options table. + var aliasKeys = (Object.keys(options.alias) || []) + .concat(Object.keys(yargs.parsed.newAliases) || []) + + keys = keys.filter(function (key) { + return !yargs.parsed.newAliases[key] && aliasKeys.every(function (alias) { + return (options.alias[alias] || []).indexOf(key) === -1 + }) + }) + + var switches = keys.reduce(function (acc, key) { + acc[key] = [ key ].concat(options.alias[key] || []) + .map(function (sw) { + return (sw.length > 1 ? '--' : '-') + sw + }) + .join(', ') + + return acc + }, {}) + + if (keys.length) { + ui.div('Options:') + + keys.forEach(function (key) { + var kswitch = switches[key] + var desc = descriptions[key] || '' + var type = null + + if (~options.boolean.indexOf(key)) type = '[boolean]' + if (~options.count.indexOf(key)) type = '[count]' + if (~options.string.indexOf(key)) type = '[string]' + if (~options.normalize.indexOf(key)) type = '[string]' + if (~options.array.indexOf(key)) type = '[array]' + + var extra = [ + type, + demanded[key] ? '[required]' : null, + defaultString(options.default[key], options.defaultDescription[key]) + ].filter(Boolean).join(' ') + + ui.span( + {text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches) + 4}, + desc + ) + + if (extra) ui.div({text: extra, padding: [0, 0, 0, 2], align: 'right'}) + else ui.div() + }) + + ui.div() + } + + // describe some common use-cases for your application. + if (examples.length) { + ui.div('Examples:') + + examples.forEach(function (example) { + example[0] = example[0].replace(/\$0/g, yargs.$0) + }) + + examples.forEach(function (example) { + ui.div( + {text: example[0], padding: [0, 2, 0, 2], width: maxWidth(examples) + 4}, + example[1] + ) + }) + + ui.div() + } + + // the usage string. + if (epilog) { + var e = epilog.replace(/\$0/g, yargs.$0) + ui.div(e + '\n') + } + + return ui.toString() + } + + // return the maximum width of a string + // in the left-hand column of a table. + function maxWidth (table) { + var width = 0 + + // table might be of the form [leftColumn], + // or {key: leftColumn}} + if (!Array.isArray(table)) { + table = Object.keys(table).map(function (key) { + return [table[key]] + }) + } + + table.forEach(function (v) { + width = Math.max(v[0].length, width) + }) + + // if we've enabled 'wrap' we should limit + // the max-width of the left-column. + if (wrap) width = Math.min(width, parseInt(wrap * 0.5, 10)) + + return width + } + + // make sure any options set for aliases, + // are copied to the keys being aliased. + function normalizeAliases () { + var options = yargs.getOptions(), + demanded = yargs.getDemanded() + + ;(Object.keys(options.alias) || []).forEach(function (key) { + options.alias[key].forEach(function (alias) { + // copy descriptions. + if (descriptions[alias]) self.describe(key, descriptions[alias]) + // copy demanded. + if (demanded[alias]) yargs.demand(key, demanded[alias].msg) + + // type messages. + if (~options.boolean.indexOf(alias)) yargs.boolean(key) + if (~options.count.indexOf(alias)) yargs.count(key) + if (~options.string.indexOf(alias)) yargs.string(key) + if (~options.normalize.indexOf(alias)) yargs.normalize(key) + if (~options.array.indexOf(alias)) yargs.array(key) + }) + }) + } + + self.showHelp = function (level) { + level = level || 'error' + console[level](self.help()) + } + + self.functionDescription = function (fn, defaultDescription) { + if (defaultDescription) { + return defaultDescription + } + var description = fn.name ? decamelize(fn.name, '-') : 'generated-value' + return ['(', description, ')'].join('') + } + + // format the default-value-string displayed in + // the right-hand column. + function defaultString (value, defaultDescription) { + var string = '[default: ' + + if (value === undefined) return null + + if (defaultDescription) { + string += defaultDescription + } else { + switch (typeof value) { + case 'string': + string += JSON.stringify(value) + break + case 'object': + string += JSON.stringify(value) + break + default: + string += value + } + } + + return string + ']' + } + + // guess the width of the console window, max-width 80. + function windowWidth () { + return wsize.width ? Math.min(80, wsize.width) : null + } + + // logic for displaying application version. + var version = null + self.version = function (ver, opt, msg) { + version = ver + } + + self.showVersion = function () { + if (typeof version === 'function') console.log(version()) + else console.log(version) + } + + return self +} diff --git a/node_modules/yargs/lib/validation.js b/node_modules/yargs/lib/validation.js new file mode 100644 index 0000000..19afe94 --- /dev/null +++ b/node_modules/yargs/lib/validation.js @@ -0,0 +1,196 @@ +// validation-type-stuff, missing params, +// bad implications, custom checks. +module.exports = function (yargs, usage) { + var self = {} + + // validate appropriate # of non-option + // arguments were provided, i.e., '_'. + self.nonOptionCount = function (argv) { + var demanded = yargs.getDemanded() + + if (demanded._ && argv._.length < demanded._.count) { + if (demanded._.msg !== undefined) { + usage.fail(demanded._.msg) + } else { + usage.fail('Not enough non-option arguments: got ' + + argv._.length + ', need at least ' + demanded._.count + ) + } + } + } + + // make sure that any args that require an + // value (--foo=bar), have a value. + self.missingArgumentValue = function (argv) { + var options = yargs.getOptions(), + defaultValues = [true, false, ''] + + if (options.requiresArg.length > 0) { + var missingRequiredArgs = [] + + options.requiresArg.forEach(function (key) { + var value = argv[key] + + // if a value is explicitly requested, + // flag argument as missing if it does not + // look like foo=bar was entered. + if (~defaultValues.indexOf(value) + || (Array.isArray(value) && !value.length)) { + missingRequiredArgs.push(key) + } + }) + + if (missingRequiredArgs.length === 1) { + usage.fail('Missing argument value: ' + missingRequiredArgs[0]) + } else if (missingRequiredArgs.length > 1) { + var message = 'Missing argument values: ' + missingRequiredArgs.join(', ') + usage.fail(message) + } + } + } + + // make sure all the required arguments are present. + self.requiredArguments = function (argv) { + var demanded = yargs.getDemanded(), + missing = null + + Object.keys(demanded).forEach(function (key) { + if (!argv.hasOwnProperty(key)) { + missing = missing || {} + missing[key] = demanded[key] + } + }) + + if (missing) { + var customMsgs = [] + Object.keys(missing).forEach(function (key) { + var msg = missing[key].msg + if (msg && customMsgs.indexOf(msg) < 0) { + customMsgs.push(msg) + } + }) + + var customMsg = customMsgs.length ? '\n' + customMsgs.join('\n') : '' + usage.fail('Missing required arguments: ' + Object.keys(missing).join(', ') + customMsg) + } + } + + // check for unknown arguments (strict-mode). + self.unknownArguments = function (argv, aliases) { + var descriptions = usage.getDescriptions(), + demanded = yargs.getDemanded(), + unknown = [], + aliasLookup = {} + + Object.keys(aliases).forEach(function (key) { + aliases[key].forEach(function (alias) { + aliasLookup[alias] = key + }) + }) + + Object.keys(argv).forEach(function (key) { + if (key !== '$0' && key !== '_' && + !descriptions.hasOwnProperty(key) && + !demanded.hasOwnProperty(key) && + !aliasLookup.hasOwnProperty(key)) { + unknown.push(key) + } + }) + + if (unknown.length === 1) { + usage.fail('Unknown argument: ' + unknown[0]) + } else if (unknown.length > 1) { + usage.fail('Unknown arguments: ' + unknown.join(', ')) + } + } + + // custom checks, added using the `check` option on yargs. + var checks = [] + self.check = function (f) { + checks.push(f) + } + + self.customChecks = function (argv, aliases) { + checks.forEach(function (f) { + try { + var result = f(argv, aliases) + if (!result) { + usage.fail('Argument check failed: ' + f.toString()) + } else if (typeof result === 'string') { + usage.fail(result) + } + } catch (err) { + usage.fail(err.message ? err.message : err) + } + }) + } + + // check implications, argument foo implies => argument bar. + var implied = {} + self.implies = function (key, value) { + if (typeof key === 'object') { + Object.keys(key).forEach(function (k) { + self.implies(k, key[k]) + }) + } else { + implied[key] = value + } + } + self.getImplied = function () { + return implied + } + + self.implications = function (argv) { + var implyFail = [] + + Object.keys(implied).forEach(function (key) { + var num, + origKey = key, + value = implied[key] + + // convert string '1' to number 1 + num = Number(key) + key = isNaN(num) ? key : num + + if (typeof key === 'number') { + // check length of argv._ + key = argv._.length >= key + } else if (key.match(/^--no-.+/)) { + // check if key doesn't exist + key = key.match(/^--no-(.+)/)[1] + key = !argv[key] + } else { + // check if key exists + key = argv[key] + } + + num = Number(value) + value = isNaN(num) ? value : num + + if (typeof value === 'number') { + value = argv._.length >= value + } else if (value.match(/^--no-.+/)) { + value = value.match(/^--no-(.+)/)[1] + value = !argv[value] + } else { + value = argv[value] + } + + if (key && !value) { + implyFail.push(origKey) + } + }) + + if (implyFail.length) { + var msg = 'Implications failed:\n' + + implyFail.forEach(function (key) { + msg += (' ' + key + ' -> ' + implied[key]) + }) + + usage.fail(msg) + } + } + + return self +} diff --git a/node_modules/yargs/package.json b/node_modules/yargs/package.json new file mode 100644 index 0000000..f501e13 --- /dev/null +++ b/node_modules/yargs/package.json @@ -0,0 +1,114 @@ +{ + "_from": "yargs@~3.10.0", + "_id": "yargs@3.10.0", + "_inBundle": false, + "_integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "_location": "/yargs", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "yargs@~3.10.0", + "name": "yargs", + "escapedName": "yargs", + "rawSpec": "~3.10.0", + "saveSpec": null, + "fetchSpec": "~3.10.0" + }, + "_requiredBy": [ + "/uglify-js" + ], + "_resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "_shasum": "f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1", + "_spec": "yargs@~3.10.0", + "_where": "/Users/kristen/Documents/_work/school/CPSC304/Project/frienDB/node_modules/uglify-js", + "author": { + "name": "Alex Ford", + "email": "Alex.Ford@CodeTunnel.com", + "url": "http://CodeTunnel.com" + }, + "bugs": { + "url": "https://github.com/bcoe/yargs/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Benjamin Coe", + "email": "ben@npmjs.com", + "url": "https://github.com/bcoe" + }, + { + "name": "Chris Needham", + "email": "chris@chrisneedham.com", + "url": "http://chrisneedham.com" + }, + { + "name": "James Nylen", + "email": "jnylen@gmail.com", + "url": "https://github.com/nylen" + }, + { + "name": "Benjamin Horsleben", + "url": "https://github.com/fizker" + }, + { + "name": "Lin Clark", + "url": "https://github.com/linclark" + } + ], + "dependencies": { + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", + "window-size": "0.1.0" + }, + "deprecated": false, + "description": "Light-weight option parsing with an argv hash. No optstrings attached.", + "devDependencies": { + "chai": "^2.2.0", + "coveralls": "^2.11.2", + "hashish": "0.0.4", + "mocha": "^2.2.1", + "nyc": "^2.2.1", + "standard": "^3.11.1" + }, + "engine": { + "node": ">=0.4" + }, + "files": [ + "index.js", + "lib", + "completion.sh.hbs", + "LICENSE" + ], + "homepage": "https://github.com/bcoe/yargs#readme", + "keywords": [ + "argument", + "args", + "option", + "parser", + "parsing", + "cli", + "command" + ], + "license": "MIT", + "main": "./index.js", + "name": "yargs", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/bcoe/yargs.git" + }, + "scripts": { + "coverage": "nyc report --reporter=text-lcov | coveralls", + "test": "standard && nyc mocha --check-leaks && nyc report" + }, + "standard": { + "ignore": [ + "**/example/**" + ], + "globals": [ + "it" + ] + }, + "version": "3.10.0" +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..7c48870 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,4076 @@ +{ + "name": "friendb", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/babel-types": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@types/babel-types/-/babel-types-7.0.1.tgz", + "integrity": "sha512-EkcOk09rjhivbovP8WreGRbXW20YRfe/qdgXOGq3it3u3aAOWDRNsQhL/XPAWFF7zhZZ+uR+nT+3b+TCkIap1w==" + }, + "@types/babylon": { + "version": "6.16.2", + "resolved": "https://registry.npmjs.org/@types/babylon/-/babylon-6.16.2.tgz", + "integrity": "sha512-+Jty46mPaWe1VAyZbfvgJM4BAdklLWxrT5tc/RjvCgLrtk6gzRY6AOnoWFv4p6hVxhJshDdr2hGVn56alBp97Q==", + "requires": { + "@types/babel-types": "7.0.1" + } + }, + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "requires": { + "mime-types": "2.1.18", + "negotiator": "0.6.1" + } + }, + "acorn": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=" + }, + "acorn-globals": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-3.1.0.tgz", + "integrity": "sha1-/YJw9x+7SZawBPqIDuXUZXOnMb8=", + "requires": { + "acorn": "4.0.13" + }, + "dependencies": { + "acorn": { + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", + "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=" + } + } + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "requires": { + "kind-of": "3.2.2", + "longest": "1.0.1", + "repeat-string": "1.6.1" + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=" + }, + "ansi-align": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz", + "integrity": "sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=", + "dev": true, + "requires": { + "string-width": "2.1.1" + } + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "3.1.9", + "normalize-path": "2.1.1" + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "async": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.1.4.tgz", + "integrity": "sha1-LSFgx3iAMuTdbL4lAvH5osj2zeQ=", + "requires": { + "lodash": "4.17.5" + } + }, + "async-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", + "dev": true + }, + "atob": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.0.3.tgz", + "integrity": "sha1-GcenYEc3dEaPILLS0DNyrX1Mv10=", + "dev": true + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "2.5.3", + "regenerator-runtime": "0.11.1" + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "requires": { + "babel-runtime": "6.26.0", + "esutils": "2.0.2", + "lodash": "4.17.5", + "to-fast-properties": "1.0.3" + } + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "1.0.1", + "class-utils": "0.3.6", + "component-emitter": "1.2.1", + "define-property": "1.0.0", + "isobject": "3.0.1", + "mixin-deep": "1.3.1", + "pascalcase": "0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + } + } + }, + "basic-auth": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.0.tgz", + "integrity": "sha1-AV2z81PgLlY3d1X5YnQuiYHnu7o=", + "requires": { + "safe-buffer": "5.1.1" + } + }, + "binary-extensions": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", + "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=", + "dev": true + }, + "bluebird": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.0.tgz", + "integrity": "sha1-eRQg1/VR7qKJdFOop3ZT+WYG1nw=" + }, + "body-parser": { + "version": "1.18.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", + "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "1.0.4", + "debug": "2.6.9", + "depd": "1.1.2", + "http-errors": "1.6.2", + "iconv-lite": "0.4.19", + "on-finished": "2.3.0", + "qs": "6.5.1", + "raw-body": "2.3.2", + "type-is": "1.6.16" + } + }, + "boxen": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.3.0.tgz", + "integrity": "sha512-TNPjfTr432qx7yOjQyaXm3dSR0MH9vXp7eT1BFSl/C51g+EFnOR9hTg1IreahGBmDNCehscshe45f+C1TBZbLw==", + "dev": true, + "requires": { + "ansi-align": "2.0.0", + "camelcase": "4.1.0", + "chalk": "2.3.2", + "cli-boxes": "1.0.0", + "string-width": "2.1.1", + "term-size": "1.2.0", + "widest-line": "2.0.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + } + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.1.tgz", + "integrity": "sha512-SO5lYHA3vO6gz66erVvedSCkp7AKWdv6VcQ2N4ysXfPxdAlxAMMAdwegGGcv1Bqwm7naF1hNdk5d6AAIEHV2nQ==", + "dev": true, + "requires": { + "arr-flatten": "1.1.0", + "array-unique": "0.3.2", + "define-property": "1.0.0", + "extend-shallow": "2.0.1", + "fill-range": "4.0.0", + "isobject": "3.0.1", + "kind-of": "6.0.2", + "repeat-element": "1.1.2", + "snapdragon": "0.8.2", + "snapdragon-node": "2.1.1", + "split-string": "3.1.0", + "to-regex": "3.0.2" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "bson": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/bson/-/bson-1.0.5.tgz", + "integrity": "sha512-D4SCtud6mlEb48kXdTHU31DRU0bsgOJ+4St1Dcx30uYNnf/aGc+hC9gHB/z0Eth8HYYs/hr0SFdyZViht19SwA==" + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "1.0.0", + "component-emitter": "1.2.1", + "get-value": "2.0.6", + "has-value": "1.0.0", + "isobject": "3.0.1", + "set-value": "2.0.0", + "to-object-path": "0.3.0", + "union-value": "1.0.0", + "unset-value": "1.0.0" + } + }, + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=" + }, + "capture-stack-trace": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz", + "integrity": "sha1-Sm+gc5nCa7pH8LJJa00PtAjFVQ0=", + "dev": true + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "requires": { + "align-text": "0.1.4", + "lazy-cache": "1.0.4" + } + }, + "chalk": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.3.0" + } + }, + "character-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/character-parser/-/character-parser-2.2.0.tgz", + "integrity": "sha1-x84o821LzZdE5f/CxfzeHHMmH8A=", + "requires": { + "is-regex": "1.0.4" + } + }, + "chokidar": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.2.tgz", + "integrity": "sha512-l32Hw3wqB0L2kGVmSbK/a+xXLDrUEsc84pSgMkmwygHvD7ubRsP/vxxHa5BtB6oix1XLLVCHyYMsckRXxThmZw==", + "dev": true, + "requires": { + "anymatch": "2.0.0", + "async-each": "1.0.1", + "braces": "2.3.1", + "fsevents": "1.1.3", + "glob-parent": "3.1.0", + "inherits": "2.0.3", + "is-binary-path": "1.0.1", + "is-glob": "4.0.0", + "normalize-path": "2.1.1", + "path-is-absolute": "1.0.1", + "readdirp": "2.1.0", + "upath": "1.0.4" + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "3.1.0", + "define-property": "0.2.5", + "isobject": "3.0.1", + "static-extend": "0.1.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "clean-css": { + "version": "3.4.28", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-3.4.28.tgz", + "integrity": "sha1-vxlF6C/ICPVWlebd6uwBQA79A/8=", + "requires": { + "commander": "2.8.1", + "source-map": "0.4.4" + } + }, + "cli-boxes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz", + "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=", + "dev": true + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "requires": { + "center-align": "0.1.3", + "right-align": "0.1.3", + "wordwrap": "0.0.2" + } + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "1.0.0", + "object-visit": "1.0.1" + } + }, + "color-convert": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", + "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "commander": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", + "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", + "requires": { + "graceful-readlink": "1.0.1" + } + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "configstore": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.1.tgz", + "integrity": "sha512-5oNkD/L++l0O6xGXxb1EWS7SivtjfGQlRyxJsYgE0Z495/L81e2h4/d3r969hoPXuFItzNOKMtsXgYG4c7dYvw==", + "dev": true, + "requires": { + "dot-prop": "4.2.0", + "graceful-fs": "4.1.11", + "make-dir": "1.2.0", + "unique-string": "1.0.0", + "write-file-atomic": "2.3.0", + "xdg-basedir": "3.0.0" + } + }, + "constantinople": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/constantinople/-/constantinople-3.1.2.tgz", + "integrity": "sha512-yePcBqEFhLOqSBtwYOGGS1exHo/s1xjekXiinh4itpNQGCu4KA1euPh1fg07N2wMITZXQkBz75Ntdt1ctGZouw==", + "requires": { + "@types/babel-types": "7.0.1", + "@types/babylon": "6.16.2", + "babel-types": "6.26.0", + "babylon": "6.18.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-parser": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.3.tgz", + "integrity": "sha1-D+MfoZ0AC5X0qt8fU/3CuKIDuqU=", + "requires": { + "cookie": "0.3.1", + "cookie-signature": "1.0.6" + } + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-js": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.3.tgz", + "integrity": "sha1-isw4NFgk8W2DZbfJtCWRaOjtYD4=" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "create-error-class": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", + "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=", + "dev": true, + "requires": { + "capture-stack-trace": "1.0.0" + } + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "4.1.2", + "shebang-command": "1.2.0", + "which": "1.3.0" + } + }, + "crypto-random-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz", + "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "deep-extend": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", + "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", + "dev": true + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "1.0.2", + "isobject": "3.0.1" + } + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "doctypes": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/doctypes/-/doctypes-1.1.0.tgz", + "integrity": "sha1-6oCxBqh1OHdOijpKWv4pPeSJ4Kk=" + }, + "dot-prop": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "dev": true, + "requires": { + "is-obj": "1.0.1" + } + }, + "duplexer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", + "dev": true + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "event-stream": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", + "dev": true, + "requires": { + "duplexer": "0.1.1", + "from": "0.1.7", + "map-stream": "0.1.0", + "pause-stream": "0.0.11", + "split": "0.3.3", + "stream-combiner": "0.0.4", + "through": "2.3.8" + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "posix-character-classes": "0.1.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "express": { + "version": "4.15.5", + "resolved": "https://registry.npmjs.org/express/-/express-4.15.5.tgz", + "integrity": "sha1-ZwI1ypWYiQpa6BcLg9tyK4Qu2Sc=", + "requires": { + "accepts": "1.3.5", + "array-flatten": "1.1.1", + "content-disposition": "0.5.2", + "content-type": "1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "1.1.2", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "etag": "1.8.1", + "finalhandler": "1.0.6", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "1.1.2", + "on-finished": "2.3.0", + "parseurl": "1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "1.1.5", + "qs": "6.5.0", + "range-parser": "1.2.0", + "send": "0.15.6", + "serve-static": "1.12.6", + "setprototypeof": "1.0.3", + "statuses": "1.3.1", + "type-is": "1.6.16", + "utils-merge": "1.0.0", + "vary": "1.1.2" + }, + "dependencies": { + "qs": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.0.tgz", + "integrity": "sha512-fjVFjW9yhqMhVGwRExCXLhJKrLlkYSaxNWdyc9rmHlrVZbk35YHH312dFd7191uQeXkI3mKLZTIbSvIeFwFemg==" + }, + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" + } + } + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "1.0.0", + "is-extendable": "1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "2.0.4" + } + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "0.3.2", + "define-property": "1.0.0", + "expand-brackets": "2.1.4", + "extend-shallow": "2.0.1", + "fragment-cache": "0.2.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-number": "3.0.0", + "repeat-string": "1.6.1", + "to-regex-range": "2.1.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "finalhandler": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.6.tgz", + "integrity": "sha1-AHrqM9Gk0+QgF/YkhIrVjSEvgU8=", + "requires": { + "debug": "2.6.9", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "on-finished": "2.3.0", + "parseurl": "1.3.2", + "statuses": "1.3.1", + "unpipe": "1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" + } + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "0.2.2" + } + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "from": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", + "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", + "dev": true + }, + "fsevents": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz", + "integrity": "sha512-WIr7iDkdmdbxu/Gh6eKEZJL6KPE74/5MEsf2whTOFNxbIoIixogroLdKYqB6FDav4Wavh/lZdzzd3b2KxIXC5Q==", + "dev": true, + "optional": true, + "requires": { + "nan": "2.9.2", + "node-pre-gyp": "0.6.39" + }, + "dependencies": { + "abbrev": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true + }, + "ajv": { + "version": "4.11.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "co": "4.6.0", + "json-stable-stringify": "1.0.1" + } + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "aproba": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "delegates": "1.0.0", + "readable-stream": "2.2.9" + } + }, + "asn1": { + "version": "0.2.3", + "bundled": true, + "dev": true, + "optional": true + }, + "assert-plus": { + "version": "0.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "asynckit": { + "version": "0.4.0", + "bundled": true, + "dev": true, + "optional": true + }, + "aws-sign2": { + "version": "0.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "aws4": { + "version": "1.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "balanced-match": { + "version": "0.4.2", + "bundled": true, + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "block-stream": { + "version": "0.0.9", + "bundled": true, + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "boom": { + "version": "2.10.1", + "bundled": true, + "dev": true, + "requires": { + "hoek": "2.16.3" + } + }, + "brace-expansion": { + "version": "1.1.7", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "0.4.2", + "concat-map": "0.0.1" + } + }, + "buffer-shims": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "caseless": { + "version": "0.12.0", + "bundled": true, + "dev": true, + "optional": true + }, + "co": { + "version": "4.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "combined-stream": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "cryptiles": { + "version": "2.0.5", + "bundled": true, + "dev": true, + "requires": { + "boom": "2.10.1" + } + }, + "dashdash": { + "version": "1.14.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "debug": { + "version": "2.6.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.4.2", + "bundled": true, + "dev": true, + "optional": true + }, + "delayed-stream": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "ecc-jsbn": { + "version": "0.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "extend": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "extsprintf": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true, + "dev": true, + "optional": true + }, + "form-data": { + "version": "2.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.15" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "fstream": { + "version": "1.0.11", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "inherits": "2.0.3", + "mkdirp": "0.5.1", + "rimraf": "2.6.1" + } + }, + "fstream-ignore": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "fstream": "1.0.11", + "inherits": "2.0.3", + "minimatch": "3.0.4" + } + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aproba": "1.1.1", + "console-control-strings": "1.1.0", + "has-unicode": "2.0.1", + "object-assign": "4.1.1", + "signal-exit": "3.0.2", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wide-align": "1.1.2" + } + }, + "getpass": { + "version": "0.1.7", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "bundled": true, + "dev": true + }, + "har-schema": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "optional": true + }, + "har-validator": { + "version": "4.2.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ajv": "4.11.8", + "har-schema": "1.0.5" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "hawk": { + "version": "3.1.3", + "bundled": true, + "dev": true, + "requires": { + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" + } + }, + "hoek": { + "version": "2.16.3", + "bundled": true, + "dev": true + }, + "http-signature": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "assert-plus": "0.2.0", + "jsprim": "1.4.0", + "sshpk": "1.13.0" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.4", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "isstream": { + "version": "0.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "jodid25519": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "jsbn": { + "version": "0.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "bundled": true, + "dev": true, + "optional": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "jsonify": "0.0.0" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "jsonify": { + "version": "0.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "jsprim": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.0.2", + "json-schema": "0.2.3", + "verror": "1.3.6" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "mime-db": { + "version": "1.27.0", + "bundled": true, + "dev": true + }, + "mime-types": { + "version": "2.1.15", + "bundled": true, + "dev": true, + "requires": { + "mime-db": "1.27.0" + } + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "node-pre-gyp": { + "version": "0.6.39", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "detect-libc": "1.0.2", + "hawk": "3.1.3", + "mkdirp": "0.5.1", + "nopt": "4.0.1", + "npmlog": "4.1.0", + "rc": "1.2.1", + "request": "2.81.0", + "rimraf": "2.6.1", + "semver": "5.3.0", + "tar": "2.2.1", + "tar-pack": "3.4.0" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "abbrev": "1.1.0", + "osenv": "0.1.4" + } + }, + "npmlog": { + "version": "4.1.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "1.1.4", + "console-control-strings": "1.1.0", + "gauge": "2.7.4", + "set-blocking": "2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "oauth-sign": { + "version": "0.8.2", + "bundled": true, + "dev": true, + "optional": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "performance-now": { + "version": "0.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "1.0.7", + "bundled": true, + "dev": true + }, + "punycode": { + "version": "1.4.1", + "bundled": true, + "dev": true, + "optional": true + }, + "qs": { + "version": "6.4.0", + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "deep-extend": "0.4.2", + "ini": "1.3.4", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.2.9", + "bundled": true, + "dev": true, + "requires": { + "buffer-shims": "1.0.0", + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "1.0.1", + "util-deprecate": "1.0.2" + } + }, + "request": { + "version": "2.81.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aws-sign2": "0.6.0", + "aws4": "1.6.0", + "caseless": "0.12.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.1.4", + "har-validator": "4.2.1", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.15", + "oauth-sign": "0.8.2", + "performance-now": "0.2.0", + "qs": "6.4.0", + "safe-buffer": "5.0.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.2", + "tunnel-agent": "0.6.0", + "uuid": "3.0.1" + } + }, + "rimraf": { + "version": "2.6.1", + "bundled": true, + "dev": true, + "requires": { + "glob": "7.1.2" + } + }, + "safe-buffer": { + "version": "5.0.1", + "bundled": true, + "dev": true + }, + "semver": { + "version": "5.3.0", + "bundled": true, + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "sntp": { + "version": "1.0.9", + "bundled": true, + "dev": true, + "requires": { + "hoek": "2.16.3" + } + }, + "sshpk": { + "version": "1.13.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jodid25519": "1.0.2", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "string_decoder": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "5.0.1" + } + }, + "stringstream": { + "version": "0.0.5", + "bundled": true, + "dev": true, + "optional": true + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "2.2.1", + "bundled": true, + "dev": true, + "requires": { + "block-stream": "0.0.9", + "fstream": "1.0.11", + "inherits": "2.0.3" + } + }, + "tar-pack": { + "version": "3.4.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "2.6.8", + "fstream": "1.0.11", + "fstream-ignore": "1.0.5", + "once": "1.4.0", + "readable-stream": "2.2.9", + "rimraf": "2.6.1", + "tar": "2.2.1", + "uid-number": "0.0.6" + } + }, + "tough-cookie": { + "version": "2.3.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "punycode": "1.4.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "bundled": true, + "dev": true, + "optional": true + }, + "uid-number": { + "version": "0.0.6", + "bundled": true, + "dev": true, + "optional": true + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "uuid": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "verror": { + "version": "1.3.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "extsprintf": "1.0.2" + } + }, + "wide-align": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "string-width": "1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "3.1.0", + "path-dirname": "1.0.2" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "2.1.1" + } + } + } + }, + "global-dirs": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", + "integrity": "sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU=", + "dev": true, + "requires": { + "ini": "1.3.5" + } + }, + "got": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", + "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", + "dev": true, + "requires": { + "create-error-class": "3.0.2", + "duplexer3": "0.1.4", + "get-stream": "3.0.0", + "is-redirect": "1.0.0", + "is-retry-allowed": "1.1.0", + "is-stream": "1.1.0", + "lowercase-keys": "1.0.0", + "safe-buffer": "5.1.1", + "timed-out": "4.0.1", + "unzip-response": "2.0.1", + "url-parse-lax": "1.0.0" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=" + }, + "has": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", + "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", + "requires": { + "function-bind": "1.1.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "2.0.6", + "has-values": "1.0.0", + "isobject": "3.0.1" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "3.0.0", + "kind-of": "4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "http-errors": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", + "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", + "requires": { + "depd": "1.1.1", + "inherits": "2.0.3", + "setprototypeof": "1.0.3", + "statuses": "1.4.0" + }, + "dependencies": { + "depd": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", + "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" + } + } + }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" + }, + "ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", + "dev": true + }, + "import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true + }, + "ipaddr.js": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.4.0.tgz", + "integrity": "sha1-KWrKh4qCGBbluF0KKFqZvP9FgvA=" + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + }, + "dependencies": { + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "requires": { + "binary-extensions": "1.11.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + }, + "dependencies": { + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + }, + "dependencies": { + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "is-expression": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-expression/-/is-expression-3.0.0.tgz", + "integrity": "sha1-Oayqa+f9HzRx3ELHQW5hwkMXrJ8=", + "requires": { + "acorn": "4.0.13", + "object-assign": "4.1.1" + }, + "dependencies": { + "acorn": { + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", + "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=" + } + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", + "dev": true, + "requires": { + "is-extglob": "2.1.1" + } + }, + "is-installed-globally": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.1.0.tgz", + "integrity": "sha1-Df2Y9akRFxbdU13aZJL2e/PSWoA=", + "dev": true, + "requires": { + "global-dirs": "0.1.1", + "is-path-inside": "1.0.1" + } + }, + "is-npm": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", + "integrity": "sha1-8vtjpl5JBbQGyGBydloaTceTufQ=", + "dev": true + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-odd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-2.0.0.tgz", + "integrity": "sha512-OTiixgpZAT1M4NHgS5IguFp/Vz2VI3U7Goh4/HA1adtwyLtSBrxYlcSYkhpAE07s4fKEcjrFxyvtQBND4vFQyQ==", + "dev": true, + "requires": { + "is-number": "4.0.0" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true + } + } + }, + "is-path-inside": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", + "dev": true, + "requires": { + "path-is-inside": "1.0.2" + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "3.0.1" + } + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=" + }, + "is-redirect": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", + "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", + "dev": true + }, + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "requires": { + "has": "1.0.1" + } + }, + "is-retry-allowed": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", + "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "js-stringify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/js-stringify/-/js-stringify-1.0.2.tgz", + "integrity": "sha1-Fzb939lyTyijaCrcYjCufk6Weds=" + }, + "jstransformer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/jstransformer/-/jstransformer-1.0.0.tgz", + "integrity": "sha1-7Yvwkh4vPx7U1cGkT2hwntJHIsM=", + "requires": { + "is-promise": "2.1.0", + "promise": "7.3.1" + } + }, + "kareem": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.0.5.tgz", + "integrity": "sha512-dfvpj3mCGJLZuADInhYrKaXkGarJxDqnTEiF91wK6fqwdCRmN+O4aEp8575UjZlQzDkzLI1WDL1uU7vyupURqw==" + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "1.1.6" + } + }, + "latest-version": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz", + "integrity": "sha1-ogU4P+oyKzO1rjsYq+4NwvNW7hU=", + "dev": true, + "requires": { + "package-json": "4.0.1" + } + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=" + }, + "lodash": { + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", + "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==" + }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=" + }, + "lowercase-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", + "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=", + "dev": true + }, + "lru-cache": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.2.tgz", + "integrity": "sha512-wgeVXhrDwAWnIF/yZARsFnMBtdFXOg1b8RIrhilp+0iDYN4mdQcNZElDZ0e4B64BhaxeQ5zN7PMyvu7we1kPeQ==", + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + }, + "make-dir": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.2.0.tgz", + "integrity": "sha512-aNUAa4UMg/UougV25bbrU4ZaaKNjJ/3/xnvg/twpmKROPdKZPZ9wGgI0opdZzO8q/zUFawoUuixuOv33eZ61Iw==", + "dev": true, + "requires": { + "pify": "3.0.0" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-stream": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "1.0.1" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "micromatch": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.9.tgz", + "integrity": "sha512-SlIz6sv5UPaAVVFRKodKjCg48EbNoIhgetzfK/Cy0v5U52Z6zB136M8tp0UC9jM53LYbmIRihJszvvqpKkfm9g==", + "dev": true, + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "braces": "2.3.1", + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "extglob": "2.0.4", + "fragment-cache": "0.2.1", + "kind-of": "6.0.2", + "nanomatch": "1.2.9", + "object.pick": "1.3.0", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "mime": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz", + "integrity": "sha1-EV+eO2s9rylZmDyzjxSaLUDrXVM=" + }, + "mime-db": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" + }, + "mime-types": { + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", + "requires": { + "mime-db": "1.33.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "1.1.11" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "dev": true, + "requires": { + "for-in": "1.0.2", + "is-extendable": "1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "2.0.4" + } + } + } + }, + "mongodb": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.0.4.tgz", + "integrity": "sha512-90YIIs7A4ko4kCGafxxXj3foexCAlJBC0YLwwIKgSLoE7Vni2IqUMz6HSsZ3zbXOfR1KWtxfnc0RyAMAY/ViLg==", + "requires": { + "mongodb-core": "3.0.4" + } + }, + "mongodb-core": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.0.4.tgz", + "integrity": "sha512-OTH267FjfwBdEufSnrgd+u8HuLWRuQ6p8DR0XirPl2BdlLEMh4XwjJf1RTlruILp5p2m1w8dDC8rCxibC3W8qQ==", + "requires": { + "bson": "1.0.5", + "require_optional": "1.0.1" + } + }, + "mongoose": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.0.9.tgz", + "integrity": "sha512-utGA97zd1R5NwRcqjhyPZP7sSExLQv9/KYAgFqtl6SRfp9vJXu5VPGwf6NdDRqUeh6e5v/tXVomkS2IPiSezxg==", + "requires": { + "async": "2.1.4", + "bson": "1.0.5", + "kareem": "2.0.5", + "lodash.get": "4.4.2", + "mongodb": "3.0.4", + "mongoose-legacy-pluralize": "1.0.2", + "mpath": "0.3.0", + "mquery": "3.0.0", + "ms": "2.0.0", + "regexp-clone": "0.0.1", + "sliced": "1.0.1" + } + }, + "mongoose-legacy-pluralize": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", + "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==" + }, + "morgan": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.0.tgz", + "integrity": "sha1-0B+mxlhZt2/PMbPLU6OCGjEdgFE=", + "requires": { + "basic-auth": "2.0.0", + "debug": "2.6.9", + "depd": "1.1.2", + "on-finished": "2.3.0", + "on-headers": "1.0.1" + } + }, + "mpath": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.3.0.tgz", + "integrity": "sha1-elj3iem1/TyUUgY0FXlg8mvV70Q=" + }, + "mquery": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.0.0.tgz", + "integrity": "sha512-WL1Lk8v4l8VFSSwN3yCzY9TXw+fKVYKn6f+w86TRzOLSE8k1yTgGaLBPUByJQi8VcLbOdnUneFV/y3Kv874pnQ==", + "requires": { + "bluebird": "3.5.0", + "debug": "2.6.9", + "regexp-clone": "0.0.1", + "sliced": "0.0.5" + }, + "dependencies": { + "sliced": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/sliced/-/sliced-0.0.5.tgz", + "integrity": "sha1-XtwETKTrb3gW1Qui/GPiXY/kcH8=" + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.9.2.tgz", + "integrity": "sha512-ltW65co7f3PQWBDbqVvaU1WtFJUsNW7sWWm4HINhbMQIyVyzIeyZ8toX5TC5eeooE6piZoaEh4cZkueSKG3KYw==", + "dev": true, + "optional": true + }, + "nanomatch": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.9.tgz", + "integrity": "sha512-n8R9bS8yQ6eSXaV6jHUpKzD8gLsin02w1HSFiegwrs9E098Ylhw5jdyKPaYqvHknHaSCKTPp7C8dGCQ0q9koXA==", + "dev": true, + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "fragment-cache": "0.2.1", + "is-odd": "2.0.0", + "is-windows": "1.0.2", + "kind-of": "6.0.2", + "object.pick": "1.3.0", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "nodemon": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.17.1.tgz", + "integrity": "sha512-p6+IG/eJyprjRd95na0efIWl3ONITHydCdl7btEIZttvnmXX4aqxIE45Aj+zeT0llJIUfJnZNyAX14XIdjJtmw==", + "dev": true, + "requires": { + "chokidar": "2.0.2", + "debug": "3.1.0", + "ignore-by-default": "1.0.1", + "minimatch": "3.0.4", + "pstree.remy": "1.1.0", + "semver": "5.5.0", + "supports-color": "5.3.0", + "touch": "3.1.0", + "undefsafe": "2.0.2", + "update-notifier": "2.3.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "dev": true, + "requires": { + "abbrev": "1.1.1" + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "1.1.0" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "2.0.1" + } + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "0.1.1", + "define-property": "0.2.5", + "kind-of": "3.2.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "3.0.1" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "3.0.1" + } + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "on-headers": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.1.tgz", + "integrity": "sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c=" + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "package-json": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", + "integrity": "sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0=", + "dev": true, + "requires": { + "got": "6.7.1", + "registry-auth-token": "3.3.2", + "registry-url": "3.1.0", + "semver": "5.5.0" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "pause-stream": { + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", + "dev": true, + "requires": { + "through": "2.3.8" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "promise": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", + "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "requires": { + "asap": "2.0.6" + } + }, + "proxy-addr": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-1.1.5.tgz", + "integrity": "sha1-ccDuOxAt4/IC87ZPYI0XP8uhqRg=", + "requires": { + "forwarded": "0.1.2", + "ipaddr.js": "1.4.0" + } + }, + "ps-tree": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.1.0.tgz", + "integrity": "sha1-tCGyQUDWID8e08dplrRCewjowBQ=", + "dev": true, + "requires": { + "event-stream": "3.3.4" + } + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "pstree.remy": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.0.tgz", + "integrity": "sha512-q5I5vLRMVtdWa8n/3UEzZX7Lfghzrg9eG2IKk2ENLSofKRCXVqMvMUHxCKgXNaqH/8ebhBxrqftHWnyTFweJ5Q==", + "dev": true, + "requires": { + "ps-tree": "1.1.0" + } + }, + "pug": { + "version": "2.0.0-beta11", + "resolved": "https://registry.npmjs.org/pug/-/pug-2.0.0-beta11.tgz", + "integrity": "sha1-Favmr1AEx+LPRhPksnRlyVRrXwE=", + "requires": { + "pug-code-gen": "1.1.1", + "pug-filters": "2.1.5", + "pug-lexer": "3.1.0", + "pug-linker": "2.0.3", + "pug-load": "2.0.11", + "pug-parser": "2.0.2", + "pug-runtime": "2.0.4", + "pug-strip-comments": "1.0.3" + } + }, + "pug-attrs": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pug-attrs/-/pug-attrs-2.0.3.tgz", + "integrity": "sha1-owlflw5kFR972tlX7vVftdeQXRU=", + "requires": { + "constantinople": "3.1.2", + "js-stringify": "1.0.2", + "pug-runtime": "2.0.4" + } + }, + "pug-code-gen": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pug-code-gen/-/pug-code-gen-1.1.1.tgz", + "integrity": "sha1-HPcnRO8qA56uajNAyqoRBYcSWOg=", + "requires": { + "constantinople": "3.1.2", + "doctypes": "1.1.0", + "js-stringify": "1.0.2", + "pug-attrs": "2.0.3", + "pug-error": "1.3.2", + "pug-runtime": "2.0.4", + "void-elements": "2.0.1", + "with": "5.1.1" + } + }, + "pug-error": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/pug-error/-/pug-error-1.3.2.tgz", + "integrity": "sha1-U659nSm7A89WRJOgJhCfVMR/XyY=" + }, + "pug-filters": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/pug-filters/-/pug-filters-2.1.5.tgz", + "integrity": "sha512-xkw71KtrC4sxleKiq+cUlQzsiLn8pM5+vCgkChW2E6oNOzaqTSIBKIQ5cl4oheuDzvJYCTSYzRaVinMUrV4YLQ==", + "requires": { + "clean-css": "3.4.28", + "constantinople": "3.1.2", + "jstransformer": "1.0.0", + "pug-error": "1.3.2", + "pug-walk": "1.1.7", + "resolve": "1.5.0", + "uglify-js": "2.8.29" + } + }, + "pug-lexer": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/pug-lexer/-/pug-lexer-3.1.0.tgz", + "integrity": "sha1-/QhzdtSmdbT1n4/vQiiDQ06VgaI=", + "requires": { + "character-parser": "2.2.0", + "is-expression": "3.0.0", + "pug-error": "1.3.2" + } + }, + "pug-linker": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pug-linker/-/pug-linker-2.0.3.tgz", + "integrity": "sha1-szH/olc33eacEntWwQ/xf652bco=", + "requires": { + "pug-error": "1.3.2", + "pug-walk": "1.1.7" + } + }, + "pug-load": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/pug-load/-/pug-load-2.0.11.tgz", + "integrity": "sha1-5kjlftET/iwfRdV4WOorrWvAFSc=", + "requires": { + "object-assign": "4.1.1", + "pug-walk": "1.1.7" + } + }, + "pug-parser": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/pug-parser/-/pug-parser-2.0.2.tgz", + "integrity": "sha1-U6aAz9BQOdywwn0CkJS8SnkmibA=", + "requires": { + "pug-error": "1.3.2", + "token-stream": "0.0.1" + } + }, + "pug-runtime": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pug-runtime/-/pug-runtime-2.0.4.tgz", + "integrity": "sha1-4XjhvaaKsujArPybztLFT9iM61g=" + }, + "pug-strip-comments": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pug-strip-comments/-/pug-strip-comments-1.0.3.tgz", + "integrity": "sha1-8VWVkiBu3G+FMQ2s9K+0igJa9Z8=", + "requires": { + "pug-error": "1.3.2" + } + }, + "pug-walk": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/pug-walk/-/pug-walk-1.1.7.tgz", + "integrity": "sha1-wA1cUSi6xYBr7BXSt+fNq+QlMfM=" + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", + "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.2", + "iconv-lite": "0.4.19", + "unpipe": "1.0.0" + } + }, + "rc": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.5.tgz", + "integrity": "sha1-J1zWh/bjs2zHVrqibf7oCnkDAf0=", + "dev": true, + "requires": { + "deep-extend": "0.4.2", + "ini": "1.3.5", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" + } + }, + "readable-stream": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.5.tgz", + "integrity": "sha512-tK0yDhrkygt/knjowCUiWP9YdV7c5R+8cR0r/kt9ZhBU906Fs6RpQJCEilamRJj1Nx2rWI6LkW9gKqjTkshhEw==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" + } + }, + "readdirp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", + "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "minimatch": "3.0.4", + "readable-stream": "2.3.5", + "set-immediate-shim": "1.0.1" + } + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "3.0.2", + "safe-regex": "1.1.0" + } + }, + "regexp-clone": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-0.0.1.tgz", + "integrity": "sha1-p8LgmJH9vzj7sQ03b7cwA+aKxYk=" + }, + "registry-auth-token": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.2.tgz", + "integrity": "sha512-JL39c60XlzCVgNrO+qq68FoNb56w/m7JYvGR2jT5iR1xBrUA3Mfx5Twk5rqTThPmQKMWydGmq8oFtDlxfrmxnQ==", + "dev": true, + "requires": { + "rc": "1.2.5", + "safe-buffer": "5.1.1" + } + }, + "registry-url": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", + "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=", + "dev": true, + "requires": { + "rc": "1.2.5" + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + }, + "require_optional": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", + "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", + "requires": { + "resolve-from": "2.0.0", + "semver": "5.5.0" + } + }, + "resolve": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", + "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", + "requires": { + "path-parse": "1.0.5" + } + }, + "resolve-from": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", + "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=" + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "requires": { + "align-text": "0.1.4" + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "0.1.15" + } + }, + "semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==" + }, + "semver-diff": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz", + "integrity": "sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=", + "dev": true, + "requires": { + "semver": "5.5.0" + } + }, + "send": { + "version": "0.15.6", + "resolved": "https://registry.npmjs.org/send/-/send-0.15.6.tgz", + "integrity": "sha1-IPI6nJJbdiq4JwX+L52yUqzkfjQ=", + "requires": { + "debug": "2.6.9", + "depd": "1.1.2", + "destroy": "1.0.4", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "etag": "1.8.1", + "fresh": "0.5.2", + "http-errors": "1.6.2", + "mime": "1.3.4", + "ms": "2.0.0", + "on-finished": "2.3.0", + "range-parser": "1.2.0", + "statuses": "1.3.1" + }, + "dependencies": { + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" + } + } + }, + "serve-favicon": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/serve-favicon/-/serve-favicon-2.4.5.tgz", + "integrity": "sha512-s7F8h2NrslMkG50KxvlGdj+ApSwaLex0vexuJ9iFf3GLTIp1ph/l1qZvRe9T9TJEYZgmq72ZwJ2VYiAEtChknw==", + "requires": { + "etag": "1.8.1", + "fresh": "0.5.2", + "ms": "2.0.0", + "parseurl": "1.3.2", + "safe-buffer": "5.1.1" + } + }, + "serve-static": { + "version": "1.12.6", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.12.6.tgz", + "integrity": "sha1-uXN3P2NEmTTaVOW+ul4x2fQhFXc=", + "requires": { + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "parseurl": "1.3.2", + "send": "0.15.6" + } + }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", + "dev": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "split-string": "3.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "setprototypeof": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", + "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "sliced": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", + "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "0.11.2", + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "map-cache": "0.2.2", + "source-map": "0.5.7", + "source-map-resolve": "0.5.1", + "use": "3.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "1.0.0", + "isobject": "3.0.1", + "snapdragon-util": "3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "requires": { + "amdefine": "1.0.1" + } + }, + "source-map-resolve": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz", + "integrity": "sha512-0KW2wvzfxm8NCTb30z0LMNyPqWCdDGE2viwzUaucqJdkTRXtZiSY3I+2A6nVAjmdOy0I4gU8DwnVVGsk9jvP2A==", + "dev": true, + "requires": { + "atob": "2.0.3", + "decode-uri-component": "0.2.0", + "resolve-url": "0.2.1", + "source-map-url": "0.4.0", + "urix": "0.1.0" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "split": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", + "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", + "dev": true, + "requires": { + "through": "2.3.8" + } + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "3.0.2" + } + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "0.2.5", + "object-copy": "0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + }, + "stream-combiner": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", + "dev": true, + "requires": { + "duplexer": "0.1.1" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", + "dev": true, + "requires": { + "has-flag": "3.0.0" + } + }, + "term-size": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", + "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", + "dev": true, + "requires": { + "execa": "0.7.0" + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "dev": true + }, + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=" + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "regex-not": "1.0.2", + "safe-regex": "1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "3.0.0", + "repeat-string": "1.6.1" + } + }, + "token-stream": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/token-stream/-/token-stream-0.0.1.tgz", + "integrity": "sha1-zu78cXp2xDFvEm0LnbqlXX598Bo=" + }, + "touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "requires": { + "nopt": "1.0.10" + } + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "2.1.18" + } + }, + "uglify-js": { + "version": "2.8.29", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "requires": { + "source-map": "0.5.7", + "uglify-to-browserify": "1.0.2", + "yargs": "3.10.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "optional": true + }, + "undefsafe": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.2.tgz", + "integrity": "sha1-Il9rngM3Zj4Njnz9aG/Cg2zKznY=", + "dev": true, + "requires": { + "debug": "2.6.9" + } + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "3.1.0", + "get-value": "2.0.6", + "is-extendable": "0.1.1", + "set-value": "0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "to-object-path": "0.3.0" + } + } + } + }, + "unique-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", + "integrity": "sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo=", + "dev": true, + "requires": { + "crypto-random-string": "1.0.0" + } + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "0.3.1", + "isobject": "3.0.1" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "2.0.6", + "has-values": "0.1.4", + "isobject": "2.1.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + } + } + }, + "unzip-response": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", + "integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c=", + "dev": true + }, + "upath": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.0.4.tgz", + "integrity": "sha512-d4SJySNBXDaQp+DPrziv3xGS6w3d2Xt69FijJr86zMPBy23JEloMCEOUBBzuN7xCtjLCnmB9tI/z7SBCahHBOw==", + "dev": true + }, + "update-notifier": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-2.3.0.tgz", + "integrity": "sha1-TognpruRUUCrCTVZ1wFOPruDdFE=", + "dev": true, + "requires": { + "boxen": "1.3.0", + "chalk": "2.3.2", + "configstore": "3.1.1", + "import-lazy": "2.1.0", + "is-installed-globally": "0.1.0", + "is-npm": "1.0.0", + "latest-version": "3.1.0", + "semver-diff": "2.1.0", + "xdg-basedir": "3.0.0" + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "dev": true, + "requires": { + "prepend-http": "1.0.4" + } + }, + "use": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.0.tgz", + "integrity": "sha512-6UJEQM/L+mzC3ZJNM56Q4DFGLX/evKGRg15UJHGB9X5j5Z3AFbgZvjUh2yq/UJUY4U5dh7Fal++XbNg1uzpRAw==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + }, + "dependencies": { + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "utils-merge": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz", + "integrity": "sha1-ApT7kiu5N1FTVBxPcJYjHyh8ivg=" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "void-elements": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", + "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=" + }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + }, + "widest-line": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.0.tgz", + "integrity": "sha1-AUKk6KJD+IgsAjOqDgKBqnYVInM=", + "dev": true, + "requires": { + "string-width": "2.1.1" + } + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=" + }, + "with": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/with/-/with-5.1.1.tgz", + "integrity": "sha1-+k2qktrzLE6pTtRTyB8EaGtXXf4=", + "requires": { + "acorn": "3.3.0", + "acorn-globals": "3.1.0" + } + }, + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=" + }, + "write-file-atomic": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "imurmurhash": "0.1.4", + "signal-exit": "3.0.2" + } + }, + "xdg-basedir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", + "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "requires": { + "camelcase": "1.2.1", + "cliui": "2.1.0", + "decamelize": "1.2.0", + "window-size": "0.1.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..14343dd --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "friendb", + "version": "0.0.0", + "private": true, + "scripts": { + "start": "node ./bin/www", + "devstart": "nodemon ./bin/www" + }, + "dependencies": { + "body-parser": "~1.18.2", + "cookie-parser": "~1.4.3", + "debug": "~2.6.9", + "express": "~4.15.5", + "mongoose": "^5.0.9", + "morgan": "~1.9.0", + "pug": "2.0.0-beta11", + "serve-favicon": "~2.4.5" + }, + "devDependencies": { + "nodemon": "^1.17.1" + } +} diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css new file mode 100644 index 0000000..9453385 --- /dev/null +++ b/public/stylesheets/style.css @@ -0,0 +1,8 @@ +body { + padding: 50px; + font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; +} + +a { + color: #00B7FF; +} diff --git a/routes/index.js b/routes/index.js new file mode 100644 index 0000000..ecca96a --- /dev/null +++ b/routes/index.js @@ -0,0 +1,9 @@ +var express = require('express'); +var router = express.Router(); + +/* GET home page. */ +router.get('/', function(req, res, next) { + res.render('index', { title: 'Express' }); +}); + +module.exports = router; diff --git a/routes/users.js b/routes/users.js new file mode 100644 index 0000000..623e430 --- /dev/null +++ b/routes/users.js @@ -0,0 +1,9 @@ +var express = require('express'); +var router = express.Router(); + +/* GET users listing. */ +router.get('/', function(req, res, next) { + res.send('respond with a resource'); +}); + +module.exports = router; diff --git a/views/error.pug b/views/error.pug new file mode 100644 index 0000000..51ec12c --- /dev/null +++ b/views/error.pug @@ -0,0 +1,6 @@ +extends layout + +block content + h1= message + h2= error.status + pre #{error.stack} diff --git a/views/index.pug b/views/index.pug new file mode 100644 index 0000000..3d63b9a --- /dev/null +++ b/views/index.pug @@ -0,0 +1,5 @@ +extends layout + +block content + h1= title + p Welcome to #{title} diff --git a/views/layout.pug b/views/layout.pug new file mode 100644 index 0000000..15af079 --- /dev/null +++ b/views/layout.pug @@ -0,0 +1,7 @@ +doctype html +html + head + title= title + link(rel='stylesheet', href='/stylesheets/style.css') + body + block content